From 9dad150e8c37b2c4d3427d60b06f263e24145375 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 11 Nov 2021 12:57:29 +0100 Subject: [PATCH 001/406] Set version to 2021.10.1-dev.01 --- ResInsightVersion.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index ac066fc5be..8bfdec7a0e 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -4,14 +4,14 @@ set(RESINSIGHT_MINOR_VERSION 10) set(RESINSIGHT_PATCH_VERSION 1) # Opional text with no restrictions -#set(RESINSIGHT_VERSION_TEXT "-dev") +set(RESINSIGHT_VERSION_TEXT "-dev") #set(RESINSIGHT_VERSION_TEXT "-RC_01") # Optional text # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -#set(RESINSIGHT_DEV_VERSION ".01") +set(RESINSIGHT_DEV_VERSION ".01") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From a620ddb66504395a7c692d52f3276bb2454a2dab Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 11 Nov 2021 13:20:01 +0100 Subject: [PATCH 002/406] Update vcpkg to latest release (2021.05.12) Use https://github.com/microsoft/vcpkg --- .gitmodules | 2 +- ThirdParty/vcpkg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index d9608ea36e..bd07849034 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,7 +3,7 @@ url = https://github.com/CeetronSolutions/qwt.git [submodule "ThirdParty/vcpkg"] path = ThirdParty/vcpkg - url = https://github.com/CeetronSolutions/vcpkg + url = https://github.com/microsoft/vcpkg [submodule "ThirdParty/fast_float"] path = ThirdParty/fast_float url = https://github.com/fastfloat/fast_float diff --git a/ThirdParty/vcpkg b/ThirdParty/vcpkg index d9a0634166..5568f110b5 160000 --- a/ThirdParty/vcpkg +++ b/ThirdParty/vcpkg @@ -1 +1 @@ -Subproject commit d9a0634166af9e0cc7d915e711d87a5bd190b41c +Subproject commit 5568f110b509a9fd90711978a7cb76bae75bb092 From 5545aff4b5172d7541d7f04a124025629b606ada Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 12 Nov 2021 09:19:21 +0100 Subject: [PATCH 003/406] #8275 Ensemble Fracture Statistics: assert when fracture xml cannot be read --- .../RimEnsembleFractureStatistics.cpp | 20 +++++++++---------- .../RimEnsembleFractureStatistics.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp index ac145e7f2f..4871961b0d 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp @@ -357,8 +357,7 @@ void RimEnsembleFractureStatistics::loadAndUpdateData() auto unitSystem = RiaDefines::EclipseUnitSystem::UNITS_METRIC; - std::vector> stimPlanFractureDefinitions = - readFractureDefinitions( m_filePaths.v(), unitSystem ); + auto [stimPlanFractureDefinitions, okFilePaths] = readFractureDefinitions( m_filePaths.v(), unitSystem ); // Log area and conductivty for each fracture for debugging std::vector area = @@ -368,12 +367,12 @@ void RimEnsembleFractureStatistics::loadAndUpdateData() RigEnsembleFractureStatisticsCalculator::calculateProperty( stimPlanFractureDefinitions, RigEnsembleFractureStatisticsCalculator::PropertyType::KFWF ); - CAF_ASSERT( m_filePaths.v().size() == area.size() ); + CAF_ASSERT( okFilePaths.size() == area.size() ); CAF_ASSERT( area.size() == conductivity.size() ); - for ( size_t i = 0; i < m_filePaths.v().size(); i++ ) + for ( size_t i = 0; i < okFilePaths.size(); i++ ) { RiaLogging::info( - QString( "%1 Area: %2 Conductivity: %3" ).arg( m_filePaths.v()[i].path() ).arg( area[i] ).arg( conductivity[i] ) ); + QString( "%1 Area: %2 Conductivity: %3" ).arg( okFilePaths[i] ).arg( area[i] ).arg( conductivity[i] ) ); } if ( m_excludeZeroWidthFractures() ) @@ -395,8 +394,7 @@ std::vector RimEnsembleFractureStatistics::computeStatistics() { auto unitSystem = RiaDefines::EclipseUnitSystem::UNITS_METRIC; - std::vector> stimPlanFractureDefinitions = - readFractureDefinitions( m_filePaths.v(), unitSystem ); + auto [stimPlanFractureDefinitions, filePaths] = readFractureDefinitions( m_filePaths.v(), unitSystem ); if ( m_excludeZeroWidthFractures() ) { @@ -527,19 +525,20 @@ std::vector RimEnsembleFractureStatistics::computeStatistics() //-------------------------------------------------------------------------------------------------- std::vector> RimEnsembleFractureStatistics::readFractureDefinitions() const { - return readFractureDefinitions( m_filePaths, RiaDefines::EclipseUnitSystem::UNITS_METRIC ); + return readFractureDefinitions( m_filePaths, RiaDefines::EclipseUnitSystem::UNITS_METRIC ).first; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector> +std::pair>, std::vector> RimEnsembleFractureStatistics::readFractureDefinitions( const std::vector& filePaths, RiaDefines::EclipseUnitSystem unitSystem ) const { double conductivityScaleFactor = 1.0; std::vector> results; + std::vector okFilePaths; for ( auto filePath : m_filePaths.v() ) { RiaLogging::info( QString( "Loading file: %1" ).arg( filePath.path() ) ); @@ -558,10 +557,11 @@ std::vector> if ( stimPlanFractureDefinitionData.notNull() ) { results.push_back( stimPlanFractureDefinitionData ); + okFilePaths.push_back( filePath.path() ); } } - return results; + return std::make_pair( results, okFilePaths ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.h b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.h index f70ee86fd5..82974a5ced 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.h @@ -123,7 +123,7 @@ class RimEnsembleFractureStatistics : public RimNamedObject static double computeDepthOfWellPathAtFracture( cvf::ref stimPlanFractureDefinitionData ); static bool isCoordinateInsideFractureCell( double x, double y, const RigFractureCell& cell ); - std::vector> + std::pair>, std::vector> readFractureDefinitions( const std::vector& filePaths, RiaDefines::EclipseUnitSystem unitSystem ) const; From 6940e588b60b016c4adf04130f029c147ce939df Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 12 Nov 2021 11:33:19 +0100 Subject: [PATCH 004/406] #8277 StimPlan : Use case insensitive string compare for facies and formations --- .../StimPlanModel/RimElasticPropertyScalingCollection.cpp | 5 +++-- .../ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp index 8800a5c602..0a01f64e6d 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp @@ -99,8 +99,9 @@ double RimElasticPropertyScalingCollection::getScaling( const QString& { for ( const RimElasticPropertyScaling* scaling : m_elasticPropertyScalings ) { - if ( scaling->property() == property && scaling->formation() == formationName && - scaling->facies() == faciesName && scaling->isChecked() ) + if ( scaling->property() == property && + ( scaling->formation().compare( formationName, Qt::CaseInsensitive ) == 0 ) && + ( scaling->facies().compare( faciesName, Qt::CaseInsensitive ) == 0 ) && scaling->isChecked() ) { return scaling->scale(); } diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp index ec6374ec09..9e2607eae4 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp @@ -1725,7 +1725,7 @@ double RimStimPlanModel::findFaciesValue( const RimColorLegend& colorLegend, con { for ( auto item : colorLegend.colorLegendItems() ) { - if ( item->categoryName() == name ) return item->categoryValue(); + if ( item->categoryName().compare( name, Qt::CaseInsensitive ) == 0 ) return item->categoryValue(); } return std::numeric_limits::infinity(); From 1b869a9356fbe9c428a2c8b3603c78dc546c5a7f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 14 Nov 2021 14:13:01 +0100 Subject: [PATCH 005/406] #8250 AppFwk : Introduce variadic macros Use variadic macros to to support optional parameters in initialization macros --- .../cafCommand/cafCmdSelectionChangeExec.h | 6 +- .../cafPdmFieldScriptingCapability.h | 127 +++++++++++------- .../cafPdmObjectScriptingCapability.h | 10 +- .../cafPdmScriptingBasicTest.cpp | 10 +- .../cafProjectDataModel/cafPdmDocument.cpp | 2 +- Fwk/AppFwk/cafProjectDataModel/cafPdmObject.h | 28 +++- .../cafProjectDataModel/cafPdmObjectGroup.cpp | 4 +- .../cafProjectDataModel_UnitTests/Child.cpp | 2 +- .../cafProjectDataModel_UnitTests/Parent.cpp | 6 +- .../cafProjectDataModel_UnitTests/TestObj.cpp | 4 +- .../cafPdmBasicTest.cpp | 8 +- .../cafTestApplication/MainWindow.cpp | 2 +- 12 files changed, 133 insertions(+), 76 deletions(-) diff --git a/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h b/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h index e83d0c2c36..3964217077 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h +++ b/Fwk/AppFwk/cafCommand/cafCmdSelectionChangeExec.h @@ -59,9 +59,9 @@ class CmdSelectionChangeExecData : public PdmObject "CmdSelectionChangeExecData tooltip", "CmdSelectionChangeExecData whatsthis" ); - CAF_PDM_InitFieldNoDefault( &m_selectionLevel, "selectionLevel", "selectionLevel", "", "", "" ); - CAF_PDM_InitField( &m_previousSelection, "previousSelection", std::vector(), "previousSelection", "", "", "" ); - CAF_PDM_InitField( &m_newSelection, "newSelection", std::vector(), "newSelection", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectionLevel, "selectionLevel", "selectionLevel" ); + CAF_PDM_InitField( &m_previousSelection, "previousSelection", std::vector(), "previousSelection" ); + CAF_PDM_InitField( &m_newSelection, "newSelection", std::vector(), "newSelection" ); } PdmField m_selectionLevel; diff --git a/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h b/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h index b26a197be2..491307c6c8 100644 --- a/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h +++ b/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h @@ -50,56 +50,83 @@ #include -#define CAF_PDM_InitScriptableField( field, keyword, default, uiName, iconResourceName, toolTip, whatsThis ) \ - CAF_PDM_InitField( field, \ - keyword, \ - default, \ - uiName, \ - iconResourceName, \ - caf::PdmAbstractFieldScriptingCapability::helpString( toolTip, keyword ), \ - whatsThis ); \ - caf::AddScriptingCapabilityToField( field, keyword ) - -#define CAF_PDM_InitScriptableFieldNoDefault( field, keyword, uiName, iconResourceName, toolTip, whatsThis ) \ - CAF_PDM_InitFieldNoDefault( field, \ - keyword, \ - uiName, \ - iconResourceName, \ - caf::PdmAbstractFieldScriptingCapability::helpString( toolTip, keyword ), \ - whatsThis ); \ - caf::AddScriptingCapabilityToField( field, keyword ) - -#define CAF_PDM_InitScriptableFieldWithScriptKeyword( field, \ - keyword, \ - scriptKeyword, \ - default, \ - uiName, \ - iconResourceName, \ - toolTip, \ - whatsThis ) \ - CAF_PDM_InitField( field, \ - keyword, \ - default, \ - uiName, \ - iconResourceName, \ - caf::PdmAbstractFieldScriptingCapability::helpString( toolTip, scriptKeyword ), \ - whatsThis ); \ - caf::AddScriptingCapabilityToField( field, scriptKeyword ) - -#define CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( field, \ - keyword, \ - scriptKeyword, \ - uiName, \ - iconResourceName, \ - toolTip, \ - whatsThis ) \ - CAF_PDM_InitFieldNoDefault( field, \ - keyword, \ - uiName, \ - iconResourceName, \ - caf::PdmAbstractFieldScriptingCapability::helpString( toolTip, scriptKeyword ), \ - whatsThis ); \ - caf::AddScriptingCapabilityToField( field, scriptKeyword ) +#define CAF_PDM_InitScriptableField( field, keyword, default, uiName, ... ) \ + { \ + std::vector arguments = { __VA_ARGS__ }; \ + QString iconResourceName; \ + QString toolTip; \ + QString whatsThis; \ + if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \ + if ( arguments.size() > 1 ) toolTip = arguments[1]; \ + if ( arguments.size() > 2 ) whatsThis = arguments[2]; \ + \ + CAF_PDM_InitField( field, \ + keyword, \ + default, \ + uiName, \ + iconResourceName, \ + caf::PdmAbstractFieldScriptingCapability::helpString( toolTip, keyword ), \ + whatsThis ); \ + caf::AddScriptingCapabilityToField( field, keyword ); \ + } + +#define CAF_PDM_InitScriptableFieldNoDefault( field, keyword, uiName, ... ) \ + { \ + std::vector arguments = { __VA_ARGS__ }; \ + QString iconResourceName; \ + QString toolTip; \ + QString whatsThis; \ + if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \ + if ( arguments.size() > 1 ) toolTip = arguments[1]; \ + if ( arguments.size() > 2 ) whatsThis = arguments[2]; \ + \ + CAF_PDM_InitFieldNoDefault( field, \ + keyword, \ + uiName, \ + iconResourceName, \ + caf::PdmAbstractFieldScriptingCapability::helpString( toolTip, keyword ), \ + whatsThis ); \ + caf::AddScriptingCapabilityToField( field, keyword ); \ + } + +#define CAF_PDM_InitScriptableFieldWithScriptKeyword( field, keyword, scriptKeyword, default, uiName, ... ) \ + { \ + std::vector arguments = { __VA_ARGS__ }; \ + QString iconResourceName; \ + QString toolTip; \ + QString whatsThis; \ + if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \ + if ( arguments.size() > 1 ) toolTip = arguments[1]; \ + if ( arguments.size() > 2 ) whatsThis = arguments[2]; \ + \ + CAF_PDM_InitField( field, \ + keyword, \ + default, \ + uiName, \ + iconResourceName, \ + caf::PdmAbstractFieldScriptingCapability::helpString( toolTip, scriptKeyword ), \ + whatsThis ); \ + caf::AddScriptingCapabilityToField( field, scriptKeyword ); \ + } + +#define CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( field, keyword, scriptKeyword, uiName, ... ) \ + { \ + std::vector arguments = { __VA_ARGS__ }; \ + QString iconResourceName; \ + QString toolTip; \ + QString whatsThis; \ + if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \ + if ( arguments.size() > 1 ) toolTip = arguments[1]; \ + if ( arguments.size() > 2 ) whatsThis = arguments[2]; \ + \ + CAF_PDM_InitFieldNoDefault( field, \ + keyword, \ + uiName, \ + iconResourceName, \ + caf::PdmAbstractFieldScriptingCapability::helpString( toolTip, scriptKeyword ), \ + whatsThis ); \ + caf::AddScriptingCapabilityToField( field, scriptKeyword ); \ + } namespace caf { diff --git a/Fwk/AppFwk/cafPdmScripting/cafPdmObjectScriptingCapability.h b/Fwk/AppFwk/cafPdmScripting/cafPdmObjectScriptingCapability.h index dcd594766c..702ff30968 100644 --- a/Fwk/AppFwk/cafPdmScripting/cafPdmObjectScriptingCapability.h +++ b/Fwk/AppFwk/cafPdmScripting/cafPdmObjectScriptingCapability.h @@ -48,7 +48,15 @@ class QTextStream; -#define CAF_PDM_InitScriptableObject( uiName, iconResourceName, toolTip, whatsThis ) \ +#define CAF_PDM_InitScriptableObject( uiName, ... ) \ + std::vector arguments = { __VA_ARGS__ }; \ + QString iconResourceName; \ + QString toolTip; \ + QString whatsThis; \ + if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \ + if ( arguments.size() > 1 ) toolTip = arguments[1]; \ + if ( arguments.size() > 2 ) whatsThis = arguments[2]; \ + \ CAF_PDM_InitObject( uiName, iconResourceName, toolTip, whatsThis ); \ caf::PdmObjectScriptingCapabilityRegister::registerScriptClassNameAndComment( classKeyword(), \ classKeyword(), \ diff --git a/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/cafPdmScriptingBasicTest.cpp b/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/cafPdmScriptingBasicTest.cpp index 372b533003..e044b0f76d 100644 --- a/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/cafPdmScriptingBasicTest.cpp +++ b/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/cafPdmScriptingBasicTest.cpp @@ -76,7 +76,7 @@ class SimpleObj : public caf::PdmObject m_proxyDouble.registerGetMethod( this, &SimpleObj::doubleMember ); AddUiCapabilityToField( &m_proxyDouble ); AddXmlCapabilityToField( &m_proxyDouble ); - CAF_PDM_InitFieldNoDefault( &m_proxyDouble, "ProxyDouble", "ProxyDouble", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_proxyDouble, "ProxyDouble", "ProxyDouble" ); #endif } @@ -190,9 +190,9 @@ class InheritedDemoObj : public DemoPdmObject "ScriptClassName_InheritedDemoObj", "Script comment test" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_texts, "Texts", "Some words", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_numbers, "Numbers", "Some words", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_testEnumField, "TestEnumValue", "An Enum", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_texts, "Texts", "Some words" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_numbers, "Numbers", "Some words" ); + CAF_PDM_InitFieldNoDefault( &m_testEnumField, "TestEnumValue", "An Enum" ); CAF_PDM_InitFieldNoDefault( &m_simpleObjectsField, "SimpleObjects", "SimpleObjectsField", @@ -218,7 +218,7 @@ class MyPdmDocument : public caf::PdmDocument public: MyPdmDocument() { - CAF_PDM_InitObject( "PdmObjectCollection", "", "", "" ); + CAF_PDM_InitObject( "PdmObjectCollection" ); CAF_PDM_InitFieldNoDefault( &objects, "PdmObjects", "", "", "", "" ) } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmDocument.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmDocument.cpp index bb31ce2090..72a4b557c8 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmDocument.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmDocument.cpp @@ -48,7 +48,7 @@ CAF_PDM_SOURCE_INIT( PdmDocument, "PdmDocument" ); //-------------------------------------------------------------------------------------------------- PdmDocument::PdmDocument() { - CAF_PDM_InitFieldNoDefault( &fileName, "DocumentFileName", "File Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &fileName, "DocumentFileName", "File Name" ); } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.h index b2675d02f4..6e7290cc3c 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.h @@ -77,8 +77,16 @@ class PdmObjectCapability; /// Note that classKeyword() is not virtual in the constructor of the PdmObject /// This is expected and fine. -#define CAF_PDM_InitObject( uiName, iconResourceName, toolTip, whatsThis ) \ +#define CAF_PDM_InitObject( uiName, ... ) \ { \ + std::vector arguments = { __VA_ARGS__ }; \ + QString iconResourceName; \ + QString toolTip; \ + QString whatsThis; \ + if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \ + if ( arguments.size() > 1 ) toolTip = arguments[1]; \ + if ( arguments.size() > 2 ) whatsThis = arguments[2]; \ + \ this->isInheritedFromPdmUiObject(); \ this->isInheritedFromPdmXmlSerializable(); \ this->registerClassKeyword( classKeyword() ); \ @@ -94,8 +102,15 @@ class PdmObjectCapability; /// Note that classKeyword() is not virtual in the constructor of the PdmObject /// This is expected and fine. -#define CAF_PDM_InitField( field, keyword, default, uiName, iconResourceName, toolTip, whatsThis ) \ +#define CAF_PDM_InitField( field, keyword, default, uiName, ... ) \ { \ + std::vector arguments = { __VA_ARGS__ }; \ + QString iconResourceName; \ + QString toolTip; \ + QString whatsThis; \ + if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \ + if ( arguments.size() > 1 ) toolTip = arguments[1]; \ + if ( arguments.size() > 2 ) whatsThis = arguments[2]; \ CAF_PDM_VERIFY_XML_KEYWORD( keyword ) \ \ static bool chekingThePresenceOfHeaderAndSourceInitMacros = \ @@ -116,8 +131,15 @@ class PdmObjectCapability; /// Note that classKeyword() is not virtual in the constructor of the PdmObject /// This is expected and fine. -#define CAF_PDM_InitFieldNoDefault( field, keyword, uiName, iconResourceName, toolTip, whatsThis ) \ +#define CAF_PDM_InitFieldNoDefault( field, keyword, uiName, ... ) \ { \ + std::vector arguments = { __VA_ARGS__ }; \ + QString iconResourceName; \ + QString toolTip; \ + QString whatsThis; \ + if ( arguments.size() > 0 ) iconResourceName = arguments[0]; \ + if ( arguments.size() > 1 ) toolTip = arguments[1]; \ + if ( arguments.size() > 2 ) whatsThis = arguments[2]; \ CAF_PDM_VERIFY_XML_KEYWORD( keyword ) \ \ static bool chekingThePresenceOfHeaderAndSourceInitMacros = \ diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmObjectGroup.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmObjectGroup.cpp index 63a37d867e..68493ce328 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmObjectGroup.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmObjectGroup.cpp @@ -14,7 +14,7 @@ CAF_PDM_SOURCE_INIT( PdmObjectGroup, "PdmObjectGroup" ); //-------------------------------------------------------------------------------------------------- PdmObjectGroup::PdmObjectGroup() { - CAF_PDM_InitObject( "Object Group", "", "", "" ); + CAF_PDM_InitObject( "Object Group" ); } //-------------------------------------------------------------------------------------------------- @@ -51,7 +51,7 @@ CAF_PDM_SOURCE_INIT( PdmObjectCollection, "PdmObjectCollection" ); //-------------------------------------------------------------------------------------------------- PdmObjectCollection::PdmObjectCollection() { - CAF_PDM_InitObject( "PdmObjectCollection", "", "", "" ); + CAF_PDM_InitObject( "PdmObjectCollection" ); CAF_PDM_InitFieldNoDefault( &objects, "PdmObjects", "", "", "", "" ) } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/Child.cpp b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/Child.cpp index 0d8d8c767b..d65716ddd8 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/Child.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/Child.cpp @@ -5,7 +5,7 @@ CAF_PDM_SOURCE_INIT( Child, "Child" ); Child::Child() { - CAF_PDM_InitFieldNoDefault( &m_testObj, "Numbers", "Important Numbers", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_testObj, "Numbers", "Important Numbers" ); } Child::~Child() diff --git a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/Parent.cpp b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/Parent.cpp index 72c9ddbd68..45f1ae8c68 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/Parent.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/Parent.cpp @@ -7,9 +7,9 @@ CAF_PDM_SOURCE_INIT( Parent, "Parent" ); Parent::Parent() { - CAF_PDM_InitObject( "Parent", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_simpleObjectsField, "SimpleObjects", "A child object", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_simpleObjectF, "SimpleObject", "A child object", "", "", "" ); + CAF_PDM_InitObject( "Parent" ); + CAF_PDM_InitFieldNoDefault( &m_simpleObjectsField, "SimpleObjects", "A child object" ); + CAF_PDM_InitFieldNoDefault( &m_simpleObjectF, "SimpleObject", "A child object" ); } Parent::~Parent() diff --git a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/TestObj.cpp b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/TestObj.cpp index 0a09fe58c7..6640def275 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/TestObj.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/TestObj.cpp @@ -4,8 +4,8 @@ CAF_PDM_SOURCE_INIT( TestObj, "TestObj" ); TestObj::TestObj() { - CAF_PDM_InitObject( "TestObj", "", "", "" ); - CAF_PDM_InitField( &m_position, "Position", 8765.2, "Position", "", "", "" ); + CAF_PDM_InitObject( "TestObj" ); + CAF_PDM_InitField( &m_position, "Position", 8765.2, "Position" ); } TestObj::~TestObj() diff --git a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/cafPdmBasicTest.cpp b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/cafPdmBasicTest.cpp index 1e90341549..63dfae0aee 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/cafPdmBasicTest.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/cafPdmBasicTest.cpp @@ -74,7 +74,7 @@ class SimpleObj : public caf::PdmObject m_proxyDouble.registerGetMethod( this, &SimpleObj::doubleMember ); AddUiCapabilityToField( &m_proxyDouble ); AddXmlCapabilityToField( &m_proxyDouble ); - CAF_PDM_InitFieldNoDefault( &m_proxyDouble, "ProxyDouble", "ProxyDouble", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_proxyDouble, "ProxyDouble", "ProxyDouble" ); #endif } @@ -183,8 +183,8 @@ class InheritedDemoObj : public DemoPdmObject { CAF_PDM_InitObject( "InheritedDemoObj", "", "ToolTip InheritedDemoObj", "Whatsthis InheritedDemoObj" ); - CAF_PDM_InitFieldNoDefault( &m_texts, "Texts", "Some words", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_testEnumField, "TestEnumValue", "An Enum", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_texts, "Texts", "Some words" ); + CAF_PDM_InitFieldNoDefault( &m_testEnumField, "TestEnumValue", "An Enum" ); CAF_PDM_InitFieldNoDefault( &m_simpleObjectsField, "SimpleObjects", "SimpleObjectsField", @@ -208,7 +208,7 @@ class MyPdmDocument : public caf::PdmDocument public: MyPdmDocument() { - CAF_PDM_InitObject( "PdmObjectCollection", "", "", "" ); + CAF_PDM_InitObject( "PdmObjectCollection" ); CAF_PDM_InitFieldNoDefault( &objects, "PdmObjects", "", "", "", "" ) } diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp index 047c87d0de..90c752ba2c 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp +++ b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp @@ -130,7 +130,7 @@ class SmallDemoPdmObject : public caf::PdmObject m_proxyDoubleField.registerSetMethod(this, &SmallDemoPdmObject::setDoubleMember); m_proxyDoubleField.registerGetMethod(this, &SmallDemoPdmObject::doubleMember); - CAF_PDM_InitFieldNoDefault(&m_proxyDoubleField, "ProxyDouble", "Proxy Double", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_proxyDoubleField, "ProxyDouble", "Proxy Double"); CAF_PDM_InitFieldNoDefault(&m_colorTriplets, "colorTriplets", "color Triplets", "", "", ""); From 2a65636ba374964006ec33d88f243cd92bdac4dd Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 14 Nov 2021 14:15:12 +0100 Subject: [PATCH 006/406] #8250 Use variadic macros and remove obsolete parameters --- .../Application/RiaPreferences.cpp | 72 ++++---- .../Application/RiaPreferencesGeoMech.cpp | 22 +-- .../Application/RiaPreferencesSummary.cpp | 7 +- .../Application/RiaPreferencesSystem.cpp | 16 +- .../Application/Tools/RiaRegressionTest.cpp | 6 +- .../CommandFileInterface/RicfCloneView.cpp | 2 +- .../RicfComputeCaseGroupStatistics.cpp | 4 +- .../RicfCreateGridCaseGroup.cpp | 8 +- .../RicfCreateLgrForCompletions.cpp | 14 +- .../RicfCreateMultipleFractures.cpp | 16 +- .../RicfCreateSaturationPressurePlots.cpp | 2 +- .../RicfCreateStatisticsCase.cpp | 6 +- .../CommandFileInterface/RicfCreateView.cpp | 6 +- ...RicfCreateWellBoreStabilityPlotFeature.cpp | 12 +- .../RicfExportFlowCharacteristics.cpp | 14 +- .../RicfExportLgrForCompletions.cpp | 14 +- .../CommandFileInterface/RicfExportMsw.cpp | 10 +- .../RicfExportMultiCaseSnapshots.cpp | 2 +- .../RicfExportPropertyInViews.cpp | 8 +- .../RicfExportSimWellFractureCompletions.cpp | 8 +- .../RicfExportSnapshots.cpp | 12 +- .../RicfExportVisibleCells.cpp | 10 +- .../RicfExportWellLogPlotData.cpp | 20 +- .../RicfExportWellPathCompletions.cpp | 20 +- .../RicfExportWellPaths.cpp | 4 +- .../RicfImportFormationNames.cpp | 4 +- .../RicfImportWellLogFiles.cpp | 8 +- .../CommandFileInterface/RicfLoadCase.cpp | 8 +- .../CommandFileInterface/RicfOpenProject.cpp | 2 +- .../CommandFileInterface/RicfReplaceCase.cpp | 4 +- .../RicfReplaceSourceCases.cpp | 4 +- .../RicfRunOctaveScript.cpp | 4 +- .../RicfScaleFractureTemplate.cpp | 12 +- .../RicfSetFractureContainment.cpp | 6 +- .../RicfSetMainWindowSize.cpp | 4 +- .../RicfSetPlotWindowSize.cpp | 4 +- .../CommandFileInterface/RicfSetStartDir.cpp | 2 +- .../CommandFileInterface/RicfSetTimeStep.cpp | 6 +- .../RicSaveProjectAsFeature.cpp | 2 +- .../RicSaveProjectFeature.cpp | 2 +- .../RicCaseAndFileExportSettingsUi.cpp | 6 +- .../RicExportCompletionDataSettingsUi.cpp | 37 ++-- .../ExportCommands/RicCellRangeUi.cpp | 18 +- .../ExportCommands/RicExportCarfinUi.cpp | 16 +- .../RicExportEclipseSectorModelUi.cpp | 36 ++-- .../ExportCommands/RicExportLgrUi.cpp | 22 +-- .../RicExportToLasFileResampleUi.cpp | 22 +-- .../ExportCommands/RicExportWellPathsUi.cpp | 6 +- .../RicSaveEclipseInputVisibleCellsUi.cpp | 12 +- .../Commands/FlowCommands/RicSelectViewUI.cpp | 8 +- ...RicCreateMultipleFracturesOptionItemUi.cpp | 8 +- .../RicCreateMultipleFracturesUi.cpp | 10 +- .../RicSaturationPressureUi.cpp | 6 +- .../RicHoloLensCreateSessionUi.cpp | 8 +- .../RicHoloLensExportToFolderUi.cpp | 6 +- .../RicHoloLensServerSettings.cpp | 4 +- .../RicSelectPlotTemplateUi.cpp | 4 +- .../Commands/RicCreateEnsembleSurfaceUi.cpp | 8 +- .../Commands/RicCreateEnsembleWellLogUi.cpp | 12 +- .../Commands/RicDeleteItemExecData.h | 4 +- .../RicExportContourMapToTextFeature.cpp | 10 +- .../Commands/RicExportContourMapToTextUi.cpp | 10 +- .../Commands/RicNewMultiPlotFeature.cpp | 2 +- .../RicStackSelectedCurvesFeature.cpp | 2 +- .../RicUnstackSelectedCurvesFeature.cpp | 2 +- .../SsiHubImportCommands/RimOilFieldEntry.cpp | 12 +- .../RimOilRegionEntry.cpp | 8 +- .../RimWellPathImport.cpp | 18 +- .../SsiHubImportCommands/RimWellsEntry.cpp | 14 +- .../RiuWellImportWizard.cpp | 8 +- .../RiuWellImportWizard.h | 6 +- ...icPasteAsciiDataToSummaryPlotFeatureUi.cpp | 22 +-- .../RicSelectSummaryPlotUI.cpp | 8 +- .../RicSummaryCurveCalculatorUi.cpp | 8 +- .../RicSummaryPlotEditorUi.cpp | 26 +-- .../ViewLink/RicLinkVisibleViewsFeatureUi.cpp | 2 +- .../RicCreateMultipleWellPathLateralsUi.cpp | 6 +- .../WellPathCommands/RicImportWellPaths.cpp | 10 +- .../RicWellPathsUnitSystemSettingsUi.cpp | 4 +- .../FileInterface/RifReaderSettings.cpp | 12 +- .../RimGeoMechGeometrySelectionItem.cpp | 24 +-- .../AnalysisPlots/RimAnalysisPlot.cpp | 50 ++--- .../RimAnalysisPlotCollection.cpp | 2 +- .../RimAnalysisPlotDataEntry.cpp | 10 +- .../RimPlotDataFilterCollection.cpp | 4 +- .../AnalysisPlots/RimPlotDataFilterItem.cpp | 26 +-- .../Annotations/RimAnnotationCollection.cpp | 9 +- .../RimAnnotationCollectionBase.cpp | 4 +- .../RimAnnotationGroupCollection.cpp | 4 +- .../RimAnnotationInViewCollection.cpp | 23 +-- .../RimAnnotationLineAppearance.cpp | 14 +- .../RimAnnotationTextAppearance.cpp | 6 +- .../Annotations/RimPolylineTarget.cpp | 4 +- .../Annotations/RimPolylinesAnnotation.cpp | 10 +- .../RimPolylinesAnnotationInView.cpp | 4 +- .../RimPolylinesFromFileAnnotation.cpp | 4 +- .../Annotations/RimReachCircleAnnotation.cpp | 12 +- .../RimReachCircleAnnotationInView.cpp | 4 +- .../Annotations/RimTextAnnotation.cpp | 16 +- .../Annotations/RimTextAnnotationInView.cpp | 4 +- .../RimUserDefinedPolylinesAnnotation.cpp | 6 +- .../CellFilters/RimCellFilter.cpp | 14 +- .../CellFilters/RimCellFilterCollection.cpp | 6 +- .../CellFilters/RimCellRangeFilter.cpp | 12 +- .../CellFilters/RimEclipsePropertyFilter.cpp | 10 +- .../RimEclipsePropertyFilterCollection.cpp | 2 +- .../CellFilters/RimGeoMechPropertyFilter.cpp | 6 +- .../RimGeoMechPropertyFilterCollection.cpp | 2 +- .../CellFilters/RimPolygonFilter.cpp | 30 +-- .../CellFilters/RimPropertyFilter.cpp | 4 +- .../RimPropertyFilterCollection.cpp | 2 +- .../Rim3dWellLogCurveCollection.cpp | 10 +- .../RimCompletionTemplateCollection.cpp | 8 +- .../RimEllipseFractureTemplate.cpp | 8 +- .../RimEnsembleFractureStatistics.cpp | 24 +-- ...imEnsembleFractureStatisticsCollection.cpp | 2 +- .../Completions/RimFishbones.cpp | 37 ++-- .../Completions/RimFishbonesCollection.cpp | 8 +- .../RimFishbonesPipeProperties.cpp | 6 +- .../Completions/RimFracture.cpp | 35 ++-- .../Completions/RimFractureContainment.cpp | 4 +- .../Completions/RimFractureExportSettings.cpp | 6 +- .../Completions/RimFractureTemplate.cpp | 58 +++--- .../RimFractureTemplateCollection.cpp | 4 +- .../RimMswCompletionParameters.cpp | 14 +- .../Completions/RimMultipleValveLocations.cpp | 10 +- .../RimNonDarcyPerforationParameters.cpp | 8 +- .../Completions/RimPerforationCollection.cpp | 4 +- .../Completions/RimPerforationInterval.cpp | 20 +- .../Completions/RimSimWellFracture.cpp | 6 +- .../RimSimWellFractureCollection.cpp | 2 +- .../RimStimPlanFractureTemplate.cpp | 10 +- .../Completions/RimValveTemplate.cpp | 10 +- .../RimValveTemplateCollection.cpp | 9 +- .../Completions/RimWellPathAicdParameters.cpp | 26 +-- .../RimWellPathCompletionSettings.cpp | 26 +-- .../Completions/RimWellPathCompletions.cpp | 28 +-- .../Completions/RimWellPathFracture.cpp | 2 +- .../RimWellPathFractureCollection.cpp | 2 +- .../Completions/RimWellPathValve.cpp | 10 +- .../RimAbstractCorrelationPlot.cpp | 26 +-- .../RimCorrelationMatrixPlot.cpp | 14 +- .../CorrelationPlots/RimCorrelationPlot.cpp | 10 +- .../RimCorrelationPlotCollection.cpp | 4 +- .../RimCorrelationReportPlot.cpp | 16 +- .../RimParameterResultCrossPlot.cpp | 2 +- .../Faults/RimFaultInView.cpp | 6 +- .../Faults/RimFaultInViewCollection.cpp | 20 +- .../Faults/RimFaultRAPostprocSettings.cpp | 14 +- .../Faults/RimFaultRAPreprocSettings.cpp | 20 +- .../Faults/RimFaultRASettings.cpp | 22 +-- .../Flow/RimDataSourceForRftPlt.cpp | 10 +- .../Flow/RimFlowCharacteristicsPlot.cpp | 28 +-- .../Flow/RimFlowDiagSolution.cpp | 4 +- .../Flow/RimFlowPlotCollection.cpp | 15 +- .../RimTofAccumulatedPhaseFractionsPlot.cpp | 6 +- .../Flow/RimTotalWellAllocationPlot.cpp | 4 +- .../Flow/RimWellAllocationPlot.cpp | 29 ++- .../Flow/RimWellAllocationPlotLegend.cpp | 2 +- .../Flow/RimWellDistributionPlot.cpp | 14 +- .../RimWellDistributionPlotCollection.cpp | 18 +- .../Flow/RimWellFlowRateCurve.cpp | 2 +- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 16 +- .../Flow/RimWellRftEnsembleCurveSet.cpp | 10 +- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 20 +- .../GeoMech/RimGeoMechCase.cpp | 38 ++-- .../GeoMech/RimGeoMechCellColors.cpp | 2 +- .../RimGeoMechContourMapProjection.cpp | 4 +- .../GeoMech/RimGeoMechContourMapView.cpp | 6 +- .../GeoMech/RimGeoMechModels.cpp | 2 +- .../GeoMech/RimGeoMechPart.cpp | 2 +- .../GeoMech/RimGeoMechPartCollection.cpp | 2 +- .../GeoMech/RimGeoMechResultDefinition.cpp | 16 +- .../GeoMech/RimGeoMechView.cpp | 10 +- .../CellFilters/RimPlotCellFilter.cpp | 2 +- .../RimPlotCellFilterCollection.cpp | 4 +- .../CellFilters/RimPlotCellPropertyFilter.cpp | 8 +- .../GridCrossPlots/RimGridCrossPlot.cpp | 14 +- .../RimGridCrossPlotCollection.cpp | 2 +- .../RimGridCrossPlotDataSet.cpp | 34 ++-- .../RimSaturationPressurePlotCollection.cpp | 2 +- .../Intersections/RimBoxIntersection.cpp | 20 +- .../RimExtrudedCurveIntersection.cpp | 42 ++--- .../Intersections/RimIntersection.cpp | 8 +- .../RimIntersectionCollection.cpp | 6 +- .../RimIntersectionResultDefinition.cpp | 16 +- ...ntersectionResultsDefinitionCollection.cpp | 4 +- .../Parameters/RimDoubleParameter.cpp | 2 +- .../Parameters/RimGenericParameter.cpp | 10 +- .../Parameters/RimIntegerParameter.cpp | 2 +- .../Parameters/RimParameterGroup.cpp | 12 +- .../Parameters/RimStringParameter.cpp | 2 +- .../PlotTemplates/RimPlotTemplateFileItem.cpp | 2 +- .../RimPlotTemplateFolderItem.cpp | 6 +- .../ProcessControl/RimProcess.cpp | 6 +- .../Rim2dIntersectionView.cpp | 10 +- .../Rim3dOverlayInfoConfig.cpp | 18 +- .../ProjectDataModel/Rim3dView.cpp | 28 +-- .../RimAdvancedSnapshotExportDefinition.cpp | 20 +- .../RimBinaryExportSettings.cpp | 8 +- .../ProjectDataModel/RimCalcScript.cpp | 2 +- .../ProjectDataModel/RimCase.cpp | 12 +- .../ProjectDataModel/RimCaseCollection.cpp | 4 +- .../ProjectDataModel/RimCellEdgeColors.cpp | 12 +- .../RimCheckableNamedObject.cpp | 4 +- .../ProjectDataModel/RimCheckableObject.cpp | 2 +- .../ProjectDataModel/RimColorLegend.cpp | 4 +- .../ProjectDataModel/RimColorLegendItem.cpp | 10 +- .../ProjectDataModel/RimCommandObject.cpp | 16 +- .../RimContourMapProjection.cpp | 10 +- .../RimCustomObjectiveFunction.cpp | 8 +- .../RimCustomObjectiveFunctionCollection.cpp | 2 +- .../RimCustomObjectiveFunctionWeight.cpp | 17 +- .../ProjectDataModel/RimDepthTrackPlot.cpp | 28 +-- .../ProjectDataModel/RimDialogData.cpp | 25 ++- .../ProjectDataModel/RimEclipseCase.cpp | 14 +- .../RimEclipseCaseCollection.cpp | 4 +- .../ProjectDataModel/RimEclipseCellColors.cpp | 8 +- .../RimEclipseContourMapProjection.cpp | 4 +- .../RimEclipseContourMapView.cpp | 6 +- .../RimEclipseFaultColors.cpp | 2 +- .../RimEclipseGeometrySelectionItem.cpp | 17 +- .../ProjectDataModel/RimEclipseInputCase.cpp | 2 +- .../RimEclipseInputProperty.cpp | 8 +- .../RimEclipseInputPropertyCollection.cpp | 2 +- .../ProjectDataModel/RimEclipseResultCase.cpp | 6 +- .../RimEclipseResultDefinition.cpp | 38 ++-- .../RimEclipseStatisticsCase.cpp | 26 +-- .../RimEclipseStatisticsCaseCollection.cpp | 4 +- .../ProjectDataModel/RimEclipseView.cpp | 20 +- .../RimElementVectorResult.cpp | 33 ++-- .../RimEnsembleFractureStatisticsPlot.cpp | 9 +- ...sembleFractureStatisticsPlotCollection.cpp | 2 +- .../RimEquilibriumAxisAnnotation.cpp | 6 +- .../RimExportInputPropertySettings.cpp | 6 +- .../ProjectDataModel/RimFormationNames.cpp | 2 +- .../RimFormationNamesCollection.cpp | 2 +- .../ProjectDataModel/RimGridCollection.cpp | 18 +- .../RimGridStatisticsPlot.cpp | 8 +- .../RimGridStatisticsPlotCollection.cpp | 2 +- .../RimGridTimeHistoryCurve.cpp | 8 +- .../ProjectDataModel/RimGridView.cpp | 28 +-- .../RimIdenticalGridCaseGroup.cpp | 11 +- .../RimMainPlotCollection.cpp | 42 ++--- .../RimMdiWindowController.cpp | 12 +- .../ProjectDataModel/RimMockModelSettings.cpp | 14 +- .../RimMudWeightWindowParameters.cpp | 50 ++--- .../ProjectDataModel/RimMultiPlot.cpp | 18 +- .../RimMultiPlotCollection.cpp | 2 +- .../ProjectDataModel/RimMultipleLocations.cpp | 10 +- .../ProjectDataModel/RimNameConfig.cpp | 6 +- .../ProjectDataModel/RimNamedObject.cpp | 4 +- .../RimObservedDataCollection.cpp | 4 +- .../RimObservedFmuRftData.cpp | 4 +- .../ProjectDataModel/RimOilField.cpp | 19 +- .../ProjectDataModel/RimPlot.cpp | 4 +- .../RimPlotAxisAnnotation.cpp | 10 +- .../ProjectDataModel/RimPlotCurve.cpp | 36 ++-- .../RimPlotCurveAppearance.cpp | 24 +-- .../ProjectDataModel/RimPlotWindow.cpp | 12 +- .../ProjectDataModel/RimPltPlotCollection.cpp | 2 +- .../ProjectDataModel/RimProject.cpp | 42 ++--- .../RimRegularLegendConfig.cpp | 14 +- .../RimReservoirCellResultsStorage.cpp | 16 +- .../ProjectDataModel/RimRftPlotCollection.cpp | 2 +- .../ProjectDataModel/RimScriptCollection.cpp | 8 +- .../ProjectDataModel/RimSimWellInView.cpp | 28 +-- .../RimSimWellInViewCollection.cpp | 54 +++--- .../RimStackablePlotCurve.cpp | 4 +- .../ProjectDataModel/RimStatisticsPlot.cpp | 12 +- .../ProjectDataModel/RimStimPlanColors.cpp | 10 +- .../RimStimPlanLegendConfig.cpp | 4 +- .../RimSummaryCalculation.cpp | 14 +- .../RimSummaryCalculationCollection.cpp | 4 +- .../RimSummaryCalculationVariable.cpp | 10 +- .../RimSurfaceIntersectionBand.cpp | 10 +- .../RimSurfaceIntersectionCollection.cpp | 6 +- .../RimSurfaceIntersectionCurve.cpp | 6 +- .../ProjectDataModel/RimTensorResults.cpp | 22 +-- .../RimTernaryLegendConfig.cpp | 10 +- .../ProjectDataModel/RimTimeStepFilter.cpp | 20 +- .../ProjectDataModel/RimVfpPlot.cpp | 30 +-- .../ProjectDataModel/RimVfpPlotCollection.cpp | 2 +- .../RimViewLinkerCollection.cpp | 4 +- .../ProjectDataModel/RimViewNameConfig.cpp | 10 +- .../ProjectDataModel/RimViewWindow.cpp | 6 +- .../RimVirtualPerforationResults.cpp | 8 +- .../ProjectDataModel/RimWbsParameters.cpp | 16 +- .../StimPlanModel/RimElasticProperties.cpp | 10 +- .../RimElasticPropertyScaling.cpp | 10 +- .../RimElasticPropertyScalingCollection.cpp | 2 +- .../RimFaciesInitialPressureConfig.cpp | 8 +- .../StimPlanModel/RimFaciesProperties.cpp | 10 +- .../StimPlanModel/RimNonNetLayers.cpp | 8 +- .../StimPlanModel/RimPressureTable.cpp | 6 +- .../StimPlanModel/RimPressureTableItem.cpp | 8 +- .../StimPlanModel/RimStimPlanModel.cpp | 60 +++--- .../RimStimPlanModelCollection.cpp | 4 +- .../StimPlanModel/RimStimPlanModelCurve.cpp | 6 +- .../StimPlanModel/RimStimPlanModelPlot.cpp | 8 +- .../RimStimPlanModelPlotCollection.cpp | 2 +- .../RimStimPlanModelTemplate.cpp | 44 ++--- .../RimStimPlanModelTemplateCollection.cpp | 2 +- .../Streamlines/RimStreamline.cpp | 2 +- .../RimStreamlineInViewCollection.cpp | 34 ++-- .../Summary/RimAsciiDataCurve.cpp | 8 +- .../Summary/RimCsvUserData.cpp | 2 +- .../RimDerivedEnsembleCaseCollection.cpp | 16 +- .../Summary/RimDerivedSummaryCase.cpp | 12 +- .../Summary/RimEnsembleCurveFilter.cpp | 29 ++- .../RimEnsembleCurveFilterCollection.cpp | 6 +- .../Summary/RimEnsembleCurveSet.cpp | 74 ++++---- .../Summary/RimEnsembleCurveSetCollection.cpp | 6 +- .../Summary/RimEnsembleStatistics.cpp | 26 +-- .../Summary/RimFileSummaryCase.cpp | 2 +- .../Summary/RimGridSummaryCase.cpp | 8 +- .../Summary/RimObjectiveFunction.cpp | 8 +- .../Summary/RimObservedSummaryData.cpp | 6 +- .../Summary/RimSummaryAddress.cpp | 28 +-- .../Summary/RimSummaryCase.cpp | 10 +- .../Summary/RimSummaryCaseCollection.cpp | 10 +- .../Summary/RimSummaryCaseMainCollection.cpp | 4 +- .../Summary/RimSummaryCrossPlotCollection.cpp | 2 +- .../Summary/RimSummaryCurve.cpp | 30 +-- .../Summary/RimSummaryCurveCollection.cpp | 12 +- .../Summary/RimSummaryCurveFilter.cpp | 30 +-- .../Summary/RimSummaryFilter.cpp | 24 +-- .../Summary/RimSummaryPlot.cpp | 29 ++- .../Summary/RimSummaryPlotCollection.cpp | 2 +- ...RimSummaryPlotFilterTextCurveSetEditor.cpp | 6 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 24 +-- .../Summary/RimSummaryTimeAxisProperties.cpp | 44 ++--- .../Surfaces/RimEnsembleStatisticsSurface.cpp | 2 +- .../Surfaces/RimEnsembleSurface.cpp | 2 +- .../Surfaces/RimFileSurface.cpp | 2 +- .../Surfaces/RimGridCaseSurface.cpp | 6 +- .../ProjectDataModel/Surfaces/RimSurface.cpp | 8 +- .../Surfaces/RimSurfaceCollection.cpp | 6 +- .../Surfaces/RimSurfaceInView.cpp | 6 +- .../Surfaces/RimSurfaceInViewCollection.cpp | 13 +- .../Surfaces/RimSurfaceResultDefinition.cpp | 6 +- .../WellLog/Rim3dWellLogCurve.cpp | 6 +- .../WellLog/Rim3dWellLogExtractionCurve.cpp | 10 +- .../WellLog/Rim3dWellLogFileCurve.cpp | 6 +- .../WellLog/Rim3dWellLogRftCurve.cpp | 10 +- .../WellLog/RimEnsembleWellLogCurveSet.cpp | 26 +-- .../RimEnsembleWellLogStatisticsCurve.cpp | 6 +- .../WellLog/RimEnsembleWellLogs.cpp | 4 +- .../WellLog/RimEnsembleWellLogsCollection.cpp | 2 +- .../RimWellLogCurveCommonDataSource.cpp | 18 +- .../WellLog/RimWellLogExtractionCurve.cpp | 26 +-- .../RimWellLogExtractionCurveNameConfig.cpp | 12 +- .../WellLog/RimWellLogFile.cpp | 12 +- .../WellLog/RimWellLogFileChannel.cpp | 6 +- .../WellLog/RimWellLogFileCurve.cpp | 6 +- .../WellLog/RimWellLogFileCurveNameConfig.cpp | 2 +- .../WellLog/RimWellLogPlotCollection.cpp | 2 +- .../WellLog/RimWellLogPlotNameConfig.cpp | 12 +- .../WellLog/RimWellLogRftCurve.cpp | 16 +- .../WellLog/RimWellLogRftCurveNameConfig.cpp | 2 +- .../WellLog/RimWellLogTrack.cpp | 92 +++++----- .../WellLog/RimWellLogWbsCurve.cpp | 4 +- .../WellMeasurement/RimWellMeasurement.cpp | 16 +- .../RimWellMeasurementCollection.cpp | 4 +- .../RimWellMeasurementCurve.cpp | 4 +- .../RimWellMeasurementFilePath.cpp | 4 +- .../RimWellMeasurementInView.cpp | 18 +- .../RimWellMeasurementInViewCollection.cpp | 2 +- .../WellPath/RimFileWellPath.cpp | 18 +- .../WellPath/RimWellIASettings.cpp | 16 +- .../WellPath/RimWellIASettingsCollection.cpp | 2 +- .../ProjectDataModel/WellPath/RimWellPath.cpp | 38 ++-- .../WellPath/RimWellPathAttribute.cpp | 10 +- .../RimWellPathAttributeCollection.cpp | 2 +- .../WellPath/RimWellPathCollection.cpp | 20 +- .../WellPath/RimWellPathGeometryDef.cpp | 24 +-- .../WellPath/RimWellPathGroup.cpp | 6 +- .../WellPath/RimWellPathTarget.cpp | 18 +- .../WellPath/RimWellPathTieIn.cpp | 10 +- .../ProjectDataModel/cafTreeNode.cpp | 8 +- .../CommandRouter/RimcExtractSurfaces.cpp | 12 +- .../RimcDataContainerDouble.cpp | 4 +- .../RimcDataContainerString.cpp | 4 +- .../RimcDataContainerTime.cpp | 4 +- .../ProjectDataModelCommands/RimcProject.cpp | 6 +- .../RimcStimPlanModelCollection.cpp | 2 +- .../RimcSummaryCase.cpp | 6 +- .../RimcSummaryResampleData.cpp | 6 +- .../RimcSurfaceCollection.cpp | 4 +- .../ProjectDataModelCommands/RimcWellPath.cpp | 2 +- .../UnitTests/RifcCommandCore-Test.cpp | 16 +- .../RiuSummaryVectorSelectionUi.cpp | 171 ++++-------------- 392 files changed, 2283 insertions(+), 2541 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index 080a441376..bf786e23ac 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -93,9 +93,9 @@ RiaPreferences::RiaPreferences() "", "Remote Procedure Call Scripting Engine", "" ); - CAF_PDM_InitField( &defaultGrpcPortNumber, "defaultGrpcPort", 50051, "Default Python Script Server Port", "", "", "" ); + CAF_PDM_InitField( &defaultGrpcPortNumber, "defaultGrpcPort", 50051, "Default Python Script Server Port" ); - CAF_PDM_InitFieldNoDefault( &scriptDirectories, "scriptDirectory", "Shared Script Folder(s)", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &scriptDirectories, "scriptDirectory", "Shared Script Folder(s)" ); scriptDirectories.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); // TODO: This only currently works for installed ResInsight. @@ -112,10 +112,10 @@ RiaPreferences::RiaPreferences() } #endif - CAF_PDM_InitField( &scriptEditorExecutable, "scriptEditorExecutable", defaultTextEditor, "Script Editor", "", "", "" ); + CAF_PDM_InitField( &scriptEditorExecutable, "scriptEditorExecutable", defaultTextEditor, "Script Editor" ); scriptEditorExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_octaveExecutable, "octaveExecutable", QString( "octave" ), "Octave Executable Location", "", "", "" ); + CAF_PDM_InitField( &m_octaveExecutable, "octaveExecutable", QString( "octave" ), "Octave Executable Location" ); m_octaveExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_octaveExecutable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); @@ -128,15 +128,15 @@ RiaPreferences::RiaPreferences() "" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &octaveShowHeaderInfoWhenExecutingScripts ); - CAF_PDM_InitField( &m_pythonExecutable, "pythonExecutable", QString( "python" ), "Python Executable Location", "", "", "" ); + CAF_PDM_InitField( &m_pythonExecutable, "pythonExecutable", QString( "python" ), "Python Executable Location" ); m_pythonExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_pythonExecutable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitField( &showPythonDebugInfo, "pythonDebugInfo", false, "Show Python Debug Info", "", "", "" ); + CAF_PDM_InitField( &showPythonDebugInfo, "pythonDebugInfo", false, "Show Python Debug Info" ); - CAF_PDM_InitField( &ssihubAddress, "ssihubAddress", QString( "http://" ), "SSIHUB Address", "", "", "" ); + CAF_PDM_InitField( &ssihubAddress, "ssihubAddress", QString( "http://" ), "SSIHUB Address" ); ssihubAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitFieldNoDefault( &m_defaultMeshModeType, "defaultMeshModeType", "Show Grid Lines", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_defaultMeshModeType, "defaultMeshModeType", "Show Grid Lines" ); CAF_PDM_InitField( &defaultGridLineColors, "defaultGridLineColors", RiaColorTables::defaultGridLineColor(), @@ -167,26 +167,26 @@ RiaPreferences::RiaPreferences() "The viewer background color for new views", "" ); - CAF_PDM_InitField( &m_defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z Scale Factor", "", "", "" ); + CAF_PDM_InitField( &m_defaultScaleFactorZ, "defaultScaleFactorZ", 5, "Default Z Scale Factor" ); - CAF_PDM_InitFieldNoDefault( &defaultSceneFontSize, "defaultSceneFontSizePt", "Viewer Font Size", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &defaultAnnotationFontSize, "defaultAnnotationFontSizePt", "Annotation Font Size", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &defaultWellLabelFontSize, "defaultWellLabelFontSizePt", "Well Label Font Size", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &defaultPlotFontSize, "defaultPlotFontSizePt", "Plot Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &defaultSceneFontSize, "defaultSceneFontSizePt", "Viewer Font Size" ); + CAF_PDM_InitFieldNoDefault( &defaultAnnotationFontSize, "defaultAnnotationFontSizePt", "Annotation Font Size" ); + CAF_PDM_InitFieldNoDefault( &defaultWellLabelFontSize, "defaultWellLabelFontSizePt", "Well Label Font Size" ); + CAF_PDM_InitFieldNoDefault( &defaultPlotFontSize, "defaultPlotFontSizePt", "Plot Font Size" ); - CAF_PDM_InitField( &m_showLegendBackground, "showLegendBackground", true, "Show Box around Legends", "", "", "" ); + CAF_PDM_InitField( &m_showLegendBackground, "showLegendBackground", true, "Show Box around Legends" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showLegendBackground ); - CAF_PDM_InitField( &m_enableFaultsByDefault, "enableFaultsByDefault", true, "Enable Faults By Default", "", "", "" ); + CAF_PDM_InitField( &m_enableFaultsByDefault, "enableFaultsByDefault", true, "Enable Faults By Default" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_enableFaultsByDefault ); - CAF_PDM_InitField( &m_showInfoBox, "showInfoBox", true, "Show Info Box in New Projects", "", "", "" ); + CAF_PDM_InitField( &m_showInfoBox, "showInfoBox", true, "Show Info Box in New Projects" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showInfoBox ); - CAF_PDM_InitField( &m_showGridBox, "showGridBox", true, "Show Grid Box in New Projects", "", "", "" ); + CAF_PDM_InitField( &m_showGridBox, "showGridBox", true, "Show Grid Box in New Projects" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showGridBox ); - CAF_PDM_InitFieldNoDefault( &lastUsedProjectFileName, "lastUsedProjectFileName", "Last Used Project File", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &lastUsedProjectFileName, "lastUsedProjectFileName", "Last Used Project File" ); lastUsedProjectFileName.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &autocomputeDepthRelatedProperties, @@ -198,7 +198,7 @@ RiaPreferences::RiaPreferences() "" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &autocomputeDepthRelatedProperties ); - CAF_PDM_InitField( &loadAndShowSoil, "loadAndShowSoil", true, "Load and Show SOIL", "", "", "" ); + CAF_PDM_InitField( &loadAndShowSoil, "loadAndShowSoil", true, "Load and Show SOIL" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &loadAndShowSoil ); CAF_PDM_InitField( &holoLensDisableCertificateVerification, @@ -218,20 +218,20 @@ RiaPreferences::RiaPreferences() "", "" ); - CAF_PDM_InitFieldNoDefault( &m_readerSettings, "readerSettings", "Reader Settings", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_readerSettings, "readerSettings", "Reader Settings" ); m_readerSettings = new RifReaderSettings; - CAF_PDM_InitFieldNoDefault( &m_dateFormat, "dateFormat", "Date Format", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_dateFormat, "dateFormat", "Date Format" ); m_dateFormat.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); m_dateFormat = RiaQDateTimeTools::supportedDateFormats().front(); - CAF_PDM_InitFieldNoDefault( &m_timeFormat, "timeFormat", "Time Format", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timeFormat, "timeFormat", "Time Format" ); m_timeFormat.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); m_timeFormat = RiaQDateTimeTools::supportedTimeFormats().front(); - CAF_PDM_InitField( &m_useUndoRedo, "useUndoRedo", true, "Enable Undo/Redo for Property Editor changes", "", "", "" ); + CAF_PDM_InitField( &m_useUndoRedo, "useUndoRedo", true, "Enable Undo/Redo for Property Editor changes" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useUndoRedo ); - CAF_PDM_InitFieldNoDefault( &m_plotTemplateFolders, "plotTemplateFolders", "Plot Template Folder(s)", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plotTemplateFolders, "plotTemplateFolders", "Plot Template Folder(s)" ); m_plotTemplateFolders.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); CAF_PDM_InitField( &m_searchPlotTemplateFoldersRecursively, "SearchPlotTemplateFoldersRecursively", @@ -242,16 +242,16 @@ RiaPreferences::RiaPreferences() "" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_searchPlotTemplateFoldersRecursively ); - CAF_PDM_InitFieldNoDefault( &m_defaultPlotTemplate, "defaultPlotTemplate", "Default Plot Template", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_defaultPlotTemplate, "defaultPlotTemplate", "Default Plot Template" ); - CAF_PDM_InitFieldNoDefault( &m_pageSize, "pageSize", "Page Size", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_pageOrientation, "pageOrientation", "Page Orientation", "", "", "" ); - CAF_PDM_InitField( &m_pageLeftMargin, "pageLeftMargin", defaultMarginSize( m_pageSize() ), "Left Margin", "", "", "" ); - CAF_PDM_InitField( &m_pageTopMargin, "pageTopMargin", defaultMarginSize( m_pageSize() ), "Top Margin", "", "", "" ); - CAF_PDM_InitField( &m_pageRightMargin, "pageRightMargin", defaultMarginSize( m_pageSize() ), "Right Margin", "", "", "" ); - CAF_PDM_InitField( &m_pageBottomMargin, "pageBottomMargin", defaultMarginSize( m_pageSize() ), "Bottom Margin", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_pageSize, "pageSize", "Page Size" ); + CAF_PDM_InitFieldNoDefault( &m_pageOrientation, "pageOrientation", "Page Orientation" ); + CAF_PDM_InitField( &m_pageLeftMargin, "pageLeftMargin", defaultMarginSize( m_pageSize() ), "Left Margin" ); + CAF_PDM_InitField( &m_pageTopMargin, "pageTopMargin", defaultMarginSize( m_pageSize() ), "Top Margin" ); + CAF_PDM_InitField( &m_pageRightMargin, "pageRightMargin", defaultMarginSize( m_pageSize() ), "Right Margin" ); + CAF_PDM_InitField( &m_pageBottomMargin, "pageBottomMargin", defaultMarginSize( m_pageSize() ), "Bottom Margin" ); - CAF_PDM_InitField( &m_openExportedPdfInViewer, "openExportedPdfInViewer", false, "Open Exported PDF in Viewer", "", "", "" ); + CAF_PDM_InitField( &m_openExportedPdfInViewer, "openExportedPdfInViewer", false, "Open Exported PDF in Viewer" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_openExportedPdfInViewer ); CAF_PDM_InitField( &m_surfaceImportResamplingDistance, @@ -272,15 +272,15 @@ RiaPreferences::RiaPreferences() "" ); m_multiLateralWellPattern.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_guiTheme, "guiTheme", "GUI theme", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_guiTheme, "guiTheme", "GUI theme" ); - CAF_PDM_InitFieldNoDefault( &m_summaryPreferences, "summaryPreferences", "summaryPreferences", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryPreferences, "summaryPreferences", "summaryPreferences" ); m_summaryPreferences = new RiaPreferencesSummary; - CAF_PDM_InitFieldNoDefault( &m_geoMechPreferences, "geoMechPreferences", "geoMechPreferences", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geoMechPreferences, "geoMechPreferences", "geoMechPreferences" ); m_geoMechPreferences = new RiaPreferencesGeoMech; - CAF_PDM_InitFieldNoDefault( &m_systemPreferences, "systemPreferences", "systemPreferences", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_systemPreferences, "systemPreferences", "systemPreferences" ); m_systemPreferences = new RiaPreferencesSystem; } diff --git a/ApplicationLibCode/Application/RiaPreferencesGeoMech.cpp b/ApplicationLibCode/Application/RiaPreferencesGeoMech.cpp index cb356bc591..f890f836ed 100644 --- a/ApplicationLibCode/Application/RiaPreferencesGeoMech.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesGeoMech.cpp @@ -34,41 +34,33 @@ CAF_PDM_SOURCE_INIT( RiaPreferencesGeoMech, "RiaPreferencesGeoMech" ); //-------------------------------------------------------------------------------------------------- RiaPreferencesGeoMech::RiaPreferencesGeoMech() { - CAF_PDM_InitFieldNoDefault( &m_geomechFRAPreprocCommand, "geomechFRAPreprocCommand", "Pre-Processing Command", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geomechFRAPreprocCommand, "geomechFRAPreprocCommand", "Pre-Processing Command" ); m_geomechFRAPreprocCommand.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_geomechFRAPreprocCommand.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitFieldNoDefault( &m_geomechFRAPostprocCommand, "geomechFRAPostprocCommand", "Post-Processing Command", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geomechFRAPostprocCommand, "geomechFRAPostprocCommand", "Post-Processing Command" ); m_geomechFRAPostprocCommand.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_geomechFRAPostprocCommand.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitFieldNoDefault( &m_geomechFRAMacrisCommand, "geomechFRAMacrisCommand", "Main Macris Command", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geomechFRAMacrisCommand, "geomechFRAMacrisCommand", "Main Macris Command" ); m_geomechFRAMacrisCommand.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_geomechFRAMacrisCommand.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitFieldNoDefault( &m_geomechFRADefaultBasicXML, - "geomechFRADefaultXML", - "Basic Processing Parameter XML File", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_geomechFRADefaultBasicXML, "geomechFRADefaultXML", "Basic Processing Parameter XML File" ); m_geomechFRADefaultBasicXML.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_geomechFRADefaultBasicXML.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); CAF_PDM_InitFieldNoDefault( &m_geomechFRADefaultAdvXML, "geomechFRADefaultAdvXML", - "Advanced Processing Parameter XML File", - "", - "", - "" ); + "Advanced Processing Parameter XML File" ); m_geomechFRADefaultAdvXML.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_geomechFRADefaultAdvXML.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitFieldNoDefault( &m_geomechWIADefaultXML, "geomechWIADefaultXML", "Default Parameter XML File", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geomechWIADefaultXML, "geomechWIADefaultXML", "Default Parameter XML File" ); m_geomechWIADefaultXML.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_geomechWIADefaultXML.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitFieldNoDefault( &m_geomechWIACommand, "geomechWIACommand", "Command to run", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geomechWIACommand, "geomechWIACommand", "Command to run" ); m_geomechWIACommand.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_geomechWIACommand.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp index c57f0b1029..5e08e1b7b8 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp @@ -66,10 +66,7 @@ RiaPreferencesSummary::RiaPreferencesSummary() { CAF_PDM_InitFieldNoDefault( &m_summaryRestartFilesShowImportDialog, "summaryRestartFilesShowImportDialog", - "Show Import Dialog", - "", - "", - "" ); + "Show Import Dialog" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_summaryRestartFilesShowImportDialog ); @@ -154,7 +151,7 @@ RiaPreferencesSummary::RiaPreferencesSummary() "", "" ); - CAF_PDM_InitFieldNoDefault( &m_summaryReader, "summaryReaderType", "File Format", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryReader, "summaryReaderType", "File Format" ); CAF_PDM_InitField( &m_showSummaryTimeAsLongString, "showSummaryTimeAsLongString", diff --git a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp index 33d2e09749..e3c9944e07 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp @@ -46,11 +46,11 @@ CAF_PDM_SOURCE_INIT( RiaPreferencesSystem, "RiaPreferencesSystem" ); //-------------------------------------------------------------------------------------------------- RiaPreferencesSystem::RiaPreferencesSystem() { - CAF_PDM_InitField( &m_useShaders, "useShaders", true, "Use Shaders", "", "", "" ); + CAF_PDM_InitField( &m_useShaders, "useShaders", true, "Use Shaders" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useShaders ); - CAF_PDM_InitField( &m_showHud, "showHud", false, "Show 3D Information", "", "", "" ); + CAF_PDM_InitField( &m_showHud, "showHud", false, "Show 3D Information" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showHud ); - CAF_PDM_InitField( &m_appendClassNameToUiText, "appendClassNameToUiText", false, "Show Class Names", "", "", "" ); + CAF_PDM_InitField( &m_appendClassNameToUiText, "appendClassNameToUiText", false, "Show Class Names" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_appendClassNameToUiText ); CAF_PDM_InitField( &m_appendFieldKeywordToToolTipText, @@ -62,10 +62,10 @@ RiaPreferencesSystem::RiaPreferencesSystem() "" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_appendFieldKeywordToToolTipText ); - CAF_PDM_InitField( &m_showViewIdInProjectTree, "showViewIdInTree", false, "Show View Id in Project Tree", "", "", "" ); + CAF_PDM_InitField( &m_showViewIdInProjectTree, "showViewIdInTree", false, "Show View Id in Project Tree" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showViewIdInProjectTree ); - CAF_PDM_InitField( &m_showTestToolbar, "showTestToolbar", false, "Enable Test Toolbar", "", "", "" ); + CAF_PDM_InitField( &m_showTestToolbar, "showTestToolbar", false, "Enable Test Toolbar" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showTestToolbar ); CAF_PDM_InitField( &m_includeFractureDebugInfoFile, @@ -77,7 +77,7 @@ RiaPreferencesSystem::RiaPreferencesSystem() "" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_includeFractureDebugInfoFile ); - CAF_PDM_InitFieldNoDefault( &m_holoLensExportFolder, "holoLensExportFolder", "HoloLens Export Folder", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_holoLensExportFolder, "holoLensExportFolder", "HoloLens Export Folder" ); m_holoLensExportFolder.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_holoLensExportFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); @@ -90,10 +90,10 @@ RiaPreferencesSystem::RiaPreferencesSystem() "" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showProjectChangedDialog ); - CAF_PDM_InitField( &m_showProgressBar, "showProgressBar", true, "Show Progress Bar", "", "", "" ); + CAF_PDM_InitField( &m_showProgressBar, "showProgressBar", true, "Show Progress Bar" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showProgressBar ); - CAF_PDM_InitField( &m_gtestFilter, "gtestFilter", QString(), "Unit Test Filter (gtest)", "", "", "" ); + CAF_PDM_InitField( &m_gtestFilter, "gtestFilter", QString(), "Unit Test Filter (gtest)" ); CAF_PDM_InitField( &m_eclipseReaderMode, "eclipseReaderMode", diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp index 1f588577b3..035cd37926 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp @@ -53,10 +53,10 @@ RiaRegressionTest::RiaRegressionTest( void ) "" ); folderContainingGitTool.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( ®ressionTestFolder, "regressionTestFolder", "Regression Test Folder", "", "", "" ); + CAF_PDM_InitFieldNoDefault( ®ressionTestFolder, "regressionTestFolder", "Regression Test Folder" ); regressionTestFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &showInteractiveDiffImages, "showInteractiveDiffImages", false, "Interactive Diff Images", "", "", "" ); + CAF_PDM_InitField( &showInteractiveDiffImages, "showInteractiveDiffImages", false, "Interactive Diff Images" ); CAF_PDM_InitField( &useOpenMPForGeometryCreation, "useOpenMPForGeometryCreation", true, @@ -65,7 +65,7 @@ RiaRegressionTest::RiaRegressionTest( void ) "", "" ); - CAF_PDM_InitField( &openReportInBrowser, "openReportInBrowser", false, "Open Generated Report in Browser", "", "", "" ); + CAF_PDM_InitField( &openReportInBrowser, "openReportInBrowser", false, "Open Generated Report in Browser" ); CAF_PDM_InitFieldNoDefault( &testFilter, "testFilter", diff --git a/ApplicationLibCode/CommandFileInterface/RicfCloneView.cpp b/ApplicationLibCode/CommandFileInterface/RicfCloneView.cpp index 71b4fe68b0..a489e495b7 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfCloneView.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfCloneView.cpp @@ -25,7 +25,7 @@ CAF_PDM_SOURCE_INIT( RicfCloneView, "cloneView" ); //-------------------------------------------------------------------------------------------------- RicfCloneView::RicfCloneView() { - CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View Id", "", "", "" ); + CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View Id" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfComputeCaseGroupStatistics.cpp b/ApplicationLibCode/CommandFileInterface/RicfComputeCaseGroupStatistics.cpp index 39679c5387..87d317dd98 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfComputeCaseGroupStatistics.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfComputeCaseGroupStatistics.cpp @@ -38,8 +38,8 @@ CAF_PDM_SOURCE_INIT( RicfComputeCaseGroupStatistics, "computeCaseGroupStatistics //-------------------------------------------------------------------------------------------------- RicfComputeCaseGroupStatistics::RicfComputeCaseGroupStatistics() { - CAF_PDM_InitScriptableField( &m_groupId, "caseGroupId", -1, "Case Group ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_caseIds, "caseIds", std::vector(), "Case IDs", "", "", "" ); + CAF_PDM_InitScriptableField( &m_groupId, "caseGroupId", -1, "Case Group ID" ); + CAF_PDM_InitScriptableField( &m_caseIds, "caseIds", std::vector(), "Case IDs" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfCreateGridCaseGroup.cpp b/ApplicationLibCode/CommandFileInterface/RicfCreateGridCaseGroup.cpp index 3e8c21bcd0..8782270d1a 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfCreateGridCaseGroup.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfCreateGridCaseGroup.cpp @@ -37,9 +37,9 @@ CAF_PDM_SOURCE_INIT( RicfCreateGridCaseGroupResult, "createGridCaseGroupResult" RicfCreateGridCaseGroupResult::RicfCreateGridCaseGroupResult( int caseGroupId /*= -1*/, const QString& caseGroupName /*= ""*/ ) { - CAF_PDM_InitObject( "case_group_result", "", "", "" ); - CAF_PDM_InitField( &this->caseGroupId, "groupId", caseGroupId, "", "", "", "" ); - CAF_PDM_InitField( &this->caseGroupName, "groupName", caseGroupName, "", "", "", "" ); + CAF_PDM_InitObject( "case_group_result" ); + CAF_PDM_InitField( &this->caseGroupId, "groupId", caseGroupId, "" ); + CAF_PDM_InitField( &this->caseGroupName, "groupName", caseGroupName, "" ); } CAF_PDM_SOURCE_INIT( RicfCreateGridCaseGroup, "createGridCaseGroup" ); @@ -49,7 +49,7 @@ CAF_PDM_SOURCE_INIT( RicfCreateGridCaseGroup, "createGridCaseGroup" ); //-------------------------------------------------------------------------------------------------- RicfCreateGridCaseGroup::RicfCreateGridCaseGroup() { - CAF_PDM_InitScriptableFieldNoDefault( &m_casePaths, "casePaths", "List of Paths to Case Files", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_casePaths, "casePaths", "List of Paths to Case Files" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfCreateLgrForCompletions.cpp b/ApplicationLibCode/CommandFileInterface/RicfCreateLgrForCompletions.cpp index d55ab95501..fcceaf00c4 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfCreateLgrForCompletions.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfCreateLgrForCompletions.cpp @@ -48,13 +48,13 @@ CAF_PDM_SOURCE_INIT( RicfCreateLgrForCompletions, "createLgrForCompletions" ); //-------------------------------------------------------------------------------------------------- RicfCreateLgrForCompletions::RicfCreateLgrForCompletions() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", 0, "Time Step Index", "", "", "" ); - CAF_PDM_InitScriptableField( &m_wellPathNames, "wellPathNames", std::vector(), "Well Path Names", "", "", "" ); - CAF_PDM_InitScriptableField( &m_refinementI, "refinementI", -1, "RefinementI", "", "", "" ); - CAF_PDM_InitScriptableField( &m_refinementJ, "refinementJ", -1, "RefinementJ", "", "", "" ); - CAF_PDM_InitScriptableField( &m_refinementK, "refinementK", -1, "RefinementK", "", "", "" ); - CAF_PDM_InitScriptableField( &m_splitType, "splitType", Lgr::SplitTypeEnum(), "SplitType", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" ); + CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", 0, "Time Step Index" ); + CAF_PDM_InitScriptableField( &m_wellPathNames, "wellPathNames", std::vector(), "Well Path Names" ); + CAF_PDM_InitScriptableField( &m_refinementI, "refinementI", -1, "RefinementI" ); + CAF_PDM_InitScriptableField( &m_refinementJ, "refinementJ", -1, "RefinementJ" ); + CAF_PDM_InitScriptableField( &m_refinementK, "refinementK", -1, "RefinementK" ); + CAF_PDM_InitScriptableField( &m_splitType, "splitType", Lgr::SplitTypeEnum(), "SplitType" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfCreateMultipleFractures.cpp b/ApplicationLibCode/CommandFileInterface/RicfCreateMultipleFractures.cpp index 45393babd7..0408c7c57a 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfCreateMultipleFractures.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfCreateMultipleFractures.cpp @@ -58,14 +58,14 @@ void AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RicfCreateMultipleFractures::RicfCreateMultipleFractures() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_wellPathNames, "wellPathNames", std::vector(), "Well Path Names", "", "", "" ); - CAF_PDM_InitScriptableField( &m_minDistFromWellTd, "minDistFromWellTd", 100.0, "Min Distance From Well TD", "", "", "" ); - CAF_PDM_InitScriptableField( &m_maxFracturesPerWell, "maxFracturesPerWell", 100, "Max Fractures per Well", "", "", "" ); - CAF_PDM_InitScriptableField( &m_templateId, "templateId", -1, "Template ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_topLayer, "topLayer", -1, "Top Layer", "", "", "" ); - CAF_PDM_InitScriptableField( &m_baseLayer, "baseLayer", -1, "Base Layer", "", "", "" ); - CAF_PDM_InitScriptableField( &m_spacing, "spacing", 300.0, "Spacing", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" ); + CAF_PDM_InitScriptableField( &m_wellPathNames, "wellPathNames", std::vector(), "Well Path Names" ); + CAF_PDM_InitScriptableField( &m_minDistFromWellTd, "minDistFromWellTd", 100.0, "Min Distance From Well TD" ); + CAF_PDM_InitScriptableField( &m_maxFracturesPerWell, "maxFracturesPerWell", 100, "Max Fractures per Well" ); + CAF_PDM_InitScriptableField( &m_templateId, "templateId", -1, "Template ID" ); + CAF_PDM_InitScriptableField( &m_topLayer, "topLayer", -1, "Top Layer" ); + CAF_PDM_InitScriptableField( &m_baseLayer, "baseLayer", -1, "Base Layer" ); + CAF_PDM_InitScriptableField( &m_spacing, "spacing", 300.0, "Spacing" ); CAF_PDM_InitScriptableField( &m_action, "action", caf::AppEnum( MultipleFractures::Action::APPEND_FRACTURES ), diff --git a/ApplicationLibCode/CommandFileInterface/RicfCreateSaturationPressurePlots.cpp b/ApplicationLibCode/CommandFileInterface/RicfCreateSaturationPressurePlots.cpp index 1d000c51de..84db70096d 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfCreateSaturationPressurePlots.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfCreateSaturationPressurePlots.cpp @@ -38,7 +38,7 @@ CAF_PDM_SOURCE_INIT( RicfCreateSaturationPressurePlots, "createSaturationPressur //-------------------------------------------------------------------------------------------------- RicfCreateSaturationPressurePlots::RicfCreateSaturationPressurePlots() { - CAF_PDM_InitScriptableField( &m_caseIds, "caseIds", std::vector(), "Case IDs", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseIds, "caseIds", std::vector(), "Case IDs" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfCreateStatisticsCase.cpp b/ApplicationLibCode/CommandFileInterface/RicfCreateStatisticsCase.cpp index 750fb6ef6c..77ed10669f 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfCreateStatisticsCase.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfCreateStatisticsCase.cpp @@ -38,8 +38,8 @@ CAF_PDM_SOURCE_INIT( RicfCreateStatisticsCaseResult, "createStatisticsCaseResult //-------------------------------------------------------------------------------------------------- RicfCreateStatisticsCaseResult::RicfCreateStatisticsCaseResult( int caseId /*= -1*/ ) { - CAF_PDM_InitObject( "statistics_case_result", "", "", "" ); - CAF_PDM_InitField( &this->caseId, "caseId", caseId, "", "", "", "" ); + CAF_PDM_InitObject( "statistics_case_result" ); + CAF_PDM_InitField( &this->caseId, "caseId", caseId, "" ); } CAF_PDM_SOURCE_INIT( RicfCreateStatisticsCase, "createStatisticsCase" ); @@ -49,7 +49,7 @@ CAF_PDM_SOURCE_INIT( RicfCreateStatisticsCase, "createStatisticsCase" ); //-------------------------------------------------------------------------------------------------- RicfCreateStatisticsCase::RicfCreateStatisticsCase() { - CAF_PDM_InitScriptableField( &m_caseGroupId, "caseGroupId", -1, "Case Group Id", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseGroupId, "caseGroupId", -1, "Case Group Id" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfCreateView.cpp b/ApplicationLibCode/CommandFileInterface/RicfCreateView.cpp index af3e6f1796..1a518ef432 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfCreateView.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfCreateView.cpp @@ -23,8 +23,8 @@ CAF_PDM_SOURCE_INIT( RicfCreateViewResult, "createViewResult" ); //-------------------------------------------------------------------------------------------------- RicfCreateViewResult::RicfCreateViewResult( int viewId /*= -1*/ ) { - CAF_PDM_InitObject( "view_result", "", "", "" ); - CAF_PDM_InitField( &this->viewId, "viewId", viewId, "", "", "", "" ); + CAF_PDM_InitObject( "view_result" ); + CAF_PDM_InitField( &this->viewId, "viewId", viewId, "" ); } CAF_PDM_SOURCE_INIT( RicfCreateView, "createView" ); @@ -34,7 +34,7 @@ CAF_PDM_SOURCE_INIT( RicfCreateView, "createView" ); //-------------------------------------------------------------------------------------------------- RicfCreateView::RicfCreateView() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case Id", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case Id" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfCreateWellBoreStabilityPlotFeature.cpp b/ApplicationLibCode/CommandFileInterface/RicfCreateWellBoreStabilityPlotFeature.cpp index 758b9762b9..386d02286c 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfCreateWellBoreStabilityPlotFeature.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfCreateWellBoreStabilityPlotFeature.cpp @@ -39,8 +39,8 @@ CAF_PDM_SOURCE_INIT( RicfCreateWbsPlotResult, "createWbsPlotResult" ); //-------------------------------------------------------------------------------------------------- RicfCreateWbsPlotResult::RicfCreateWbsPlotResult( int viewId /*= -1*/ ) { - CAF_PDM_InitObject( "wbs_result", "", "", "" ); - CAF_PDM_InitField( &this->viewId, "viewId", viewId, "", "", "", "" ); + CAF_PDM_InitObject( "wbs_result" ); + CAF_PDM_InitField( &this->viewId, "viewId", viewId, "" ); } CAF_PDM_SOURCE_INIT( RicfCreateWellBoreStabilityPlotFeature, "createWellBoreStabilityPlot" ); @@ -50,11 +50,11 @@ CAF_PDM_SOURCE_INIT( RicfCreateWellBoreStabilityPlotFeature, "createWellBoreStab //-------------------------------------------------------------------------------------------------- RicfCreateWellBoreStabilityPlotFeature::RicfCreateWellBoreStabilityPlotFeature() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "GeoMech Case Id", "", "", "" ); - CAF_PDM_InitScriptableField( &m_wellPath, "wellPath", QString( "" ), "Well Path", "", "", "" ); - CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", -1, "Time Step", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "GeoMech Case Id" ); + CAF_PDM_InitScriptableField( &m_wellPath, "wellPath", QString( "" ), "Well Path" ); + CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", -1, "Time Step" ); - CAF_PDM_InitFieldNoDefault( &m_wbsParameters, "wbsParameters", "WbsParameters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wbsParameters, "wbsParameters", "WbsParameters" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportFlowCharacteristics.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportFlowCharacteristics.cpp index bdddec4424..954c246ff1 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportFlowCharacteristics.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportFlowCharacteristics.cpp @@ -42,13 +42,13 @@ CAF_PDM_SOURCE_INIT( RicfExportFlowCharacteristics, "exportFlowCharacteristics" //-------------------------------------------------------------------------------------------------- RicfExportFlowCharacteristics::RicfExportFlowCharacteristics() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_selectedTimeSteps, "timeSteps", std::vector(), "Selected Time Steps", "", "", "" ); - CAF_PDM_InitScriptableField( &m_injectors, "injectors", std::vector(), "Injectors", "", "", "" ); - CAF_PDM_InitScriptableField( &m_producers, "producers", std::vector(), "Producers", "", "", "" ); - CAF_PDM_InitScriptableField( &m_fileName, "fileName", QString(), "Export File Name", "", "", "" ); - CAF_PDM_InitScriptableField( &m_minCommunication, "minimumCommunication", 0.0, "Minimum Communication", "", "", "" ); - CAF_PDM_InitScriptableField( &m_maxPvFraction, "aquiferCellThreshold", 0.1, "Aquifer Cell Threshold", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" ); + CAF_PDM_InitScriptableField( &m_selectedTimeSteps, "timeSteps", std::vector(), "Selected Time Steps" ); + CAF_PDM_InitScriptableField( &m_injectors, "injectors", std::vector(), "Injectors" ); + CAF_PDM_InitScriptableField( &m_producers, "producers", std::vector(), "Producers" ); + CAF_PDM_InitScriptableField( &m_fileName, "fileName", QString(), "Export File Name" ); + CAF_PDM_InitScriptableField( &m_minCommunication, "minimumCommunication", 0.0, "Minimum Communication" ); + CAF_PDM_InitScriptableField( &m_maxPvFraction, "aquiferCellThreshold", 0.1, "Aquifer Cell Threshold" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportLgrForCompletions.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportLgrForCompletions.cpp index 1e746d2c37..36edfc00cf 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportLgrForCompletions.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportLgrForCompletions.cpp @@ -47,13 +47,13 @@ CAF_PDM_SOURCE_INIT( RicfExportLgrForCompletions, "exportLgrForCompletions" ); //-------------------------------------------------------------------------------------------------- RicfExportLgrForCompletions::RicfExportLgrForCompletions() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", -1, "Time Step Index", "", "", "" ); - CAF_PDM_InitScriptableField( &m_wellPathNames, "wellPathNames", std::vector(), "Well Path Names", "", "", "" ); - CAF_PDM_InitScriptableField( &m_refinementI, "refinementI", -1, "RefinementI", "", "", "" ); - CAF_PDM_InitScriptableField( &m_refinementJ, "refinementJ", -1, "RefinementJ", "", "", "" ); - CAF_PDM_InitScriptableField( &m_refinementK, "refinementK", -1, "RefinementK", "", "", "" ); - CAF_PDM_InitScriptableField( &m_splitType, "splitType", Lgr::SplitTypeEnum(), "SplitType", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" ); + CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", -1, "Time Step Index" ); + CAF_PDM_InitScriptableField( &m_wellPathNames, "wellPathNames", std::vector(), "Well Path Names" ); + CAF_PDM_InitScriptableField( &m_refinementI, "refinementI", -1, "RefinementI" ); + CAF_PDM_InitScriptableField( &m_refinementJ, "refinementJ", -1, "RefinementJ" ); + CAF_PDM_InitScriptableField( &m_refinementK, "refinementK", -1, "RefinementK" ); + CAF_PDM_InitScriptableField( &m_splitType, "splitType", Lgr::SplitTypeEnum(), "SplitType" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportMsw.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportMsw.cpp index 8b430a84e6..973fb1a09e 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportMsw.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportMsw.cpp @@ -45,11 +45,11 @@ CAF_PDM_SOURCE_INIT( RicfExportMsw, "exportMsw" ); //-------------------------------------------------------------------------------------------------- RicfExportMsw::RicfExportMsw() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_wellPathName, "wellPath", QString(), "Well Path Name", "", "", "" ); - CAF_PDM_InitScriptableField( &m_includePerforations, "includePerforations", true, "Include Perforations", "", "", "" ); - CAF_PDM_InitScriptableField( &m_includeFishbones, "includeFishbones", true, "Include Fishbones", "", "", "" ); - CAF_PDM_InitScriptableField( &m_includeFractures, "includeFractures", true, "Include Fractures", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" ); + CAF_PDM_InitScriptableField( &m_wellPathName, "wellPath", QString(), "Well Path Name" ); + CAF_PDM_InitScriptableField( &m_includePerforations, "includePerforations", true, "Include Perforations" ); + CAF_PDM_InitScriptableField( &m_includeFishbones, "includeFishbones", true, "Include Fishbones" ); + CAF_PDM_InitScriptableField( &m_includeFractures, "includeFractures", true, "Include Fractures" ); CAF_PDM_InitScriptableField( &m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportMultiCaseSnapshots.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportMultiCaseSnapshots.cpp index febd909ccb..ccac71abfb 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportMultiCaseSnapshots.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportMultiCaseSnapshots.cpp @@ -33,7 +33,7 @@ CAF_PDM_SOURCE_INIT( RicfExportMultiCaseSnapshots, "exportMultiCaseSnapshots" ); //-------------------------------------------------------------------------------------------------- RicfExportMultiCaseSnapshots::RicfExportMultiCaseSnapshots() { - CAF_PDM_InitScriptableField( &m_gridListFile, "gridListFile", QString(), "Grid List File", "", "", "" ); + CAF_PDM_InitScriptableField( &m_gridListFile, "gridListFile", QString(), "Grid List File" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportPropertyInViews.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportPropertyInViews.cpp index 4f02237214..eb62f8ae06 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportPropertyInViews.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportPropertyInViews.cpp @@ -47,10 +47,10 @@ CAF_PDM_SOURCE_INIT( RicfExportPropertyInViews, "exportPropertyInViews" ); //-------------------------------------------------------------------------------------------------- RicfExportPropertyInViews::RicfExportPropertyInViews() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_viewIds, "viewIds", std::vector(), "View IDs", "", "", "" ); - CAF_PDM_InitScriptableField( &m_viewNames, "viewNames", std::vector(), "View Names", "", "", "" ); - CAF_PDM_InitScriptableField( &m_undefinedValue, "undefinedValue", 0.0, "Undefined Value", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" ); + CAF_PDM_InitScriptableField( &m_viewIds, "viewIds", std::vector(), "View IDs" ); + CAF_PDM_InitScriptableField( &m_viewNames, "viewNames", std::vector(), "View Names" ); + CAF_PDM_InitScriptableField( &m_undefinedValue, "undefinedValue", 0.0, "Undefined Value" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp index 5ed162c483..471d41d739 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp @@ -46,10 +46,10 @@ CAF_PDM_SOURCE_INIT( RicfExportSimWellFractureCompletions, "exportSimWellFractur //-------------------------------------------------------------------------------------------------- RicfExportSimWellFractureCompletions::RicfExportSimWellFractureCompletions() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_viewName, "viewName", QString( "" ), "View Name", "", "", "" ); - CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", -1, "Time Step Index", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" ); + CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View ID" ); + CAF_PDM_InitScriptableField( &m_viewName, "viewName", QString( "" ), "View Name" ); + CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", -1, "Time Step Index" ); CAF_PDM_InitScriptableField( &m_simWellNames, "simulationWellNames", std::vector(), diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp index a5b7248243..137dab6268 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp @@ -60,12 +60,12 @@ void RicfExportSnapshots::SnapshotsTypeEnum::setUp() //-------------------------------------------------------------------------------------------------- RicfExportSnapshots::RicfExportSnapshots() { - CAF_PDM_InitScriptableField( &m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type", "", "", "" ); - CAF_PDM_InitScriptableField( &m_prefix, "prefix", QString(), "Prefix", "", "", "" ); - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case Id", "", "", "" ); - CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View Id", "", "", "" ); - CAF_PDM_InitScriptableField( &m_exportFolder, "exportFolder", QString(), "Export Folder", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_plotOutputFormat, "plotOutputFormat", "Output Format", "", "", "" ); + CAF_PDM_InitScriptableField( &m_type, "type", RicfExportSnapshots::SnapshotsTypeEnum(), "Type" ); + CAF_PDM_InitScriptableField( &m_prefix, "prefix", QString(), "Prefix" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case Id" ); + CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View Id" ); + CAF_PDM_InitScriptableField( &m_exportFolder, "exportFolder", QString(), "Export Folder" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_plotOutputFormat, "plotOutputFormat", "Output Format" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportVisibleCells.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportVisibleCells.cpp index 3d7b8f66e4..7855392475 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportVisibleCells.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportVisibleCells.cpp @@ -63,9 +63,9 @@ void AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RicfExportVisibleCells::RicfExportVisibleCells() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_viewName, "viewName", QString(), "View Name", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" ); + CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View ID" ); + CAF_PDM_InitScriptableField( &m_viewName, "viewName", QString(), "View Name" ); CAF_PDM_InitScriptableField( &m_exportKeyword, "exportKeyword", caf::AppEnum(), @@ -80,8 +80,8 @@ RicfExportVisibleCells::RicfExportVisibleCells() "", "", "" ); - CAF_PDM_InitScriptableField( &m_hiddenActiveCellsValue, "hiddenActiveCellsValue", 0, "Hidden Active Cells Value", "", "", "" ); - CAF_PDM_InitScriptableField( &m_inactiveCellsValue, "inactiveCellsValue", 0, "Inactive Cells Value", "", "", "" ); + CAF_PDM_InitScriptableField( &m_hiddenActiveCellsValue, "hiddenActiveCellsValue", 0, "Hidden Active Cells Value" ); + CAF_PDM_InitScriptableField( &m_inactiveCellsValue, "inactiveCellsValue", 0, "Inactive Cells Value" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportWellLogPlotData.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportWellLogPlotData.cpp index f6e0c2884e..1f070064b4 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportWellLogPlotData.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportWellLogPlotData.cpp @@ -49,8 +49,8 @@ CAF_PDM_SOURCE_INIT( RicfExportWellLogPlotDataResult, "exportWellLogPlotDataResu //-------------------------------------------------------------------------------------------------- RicfExportWellLogPlotDataResult::RicfExportWellLogPlotDataResult() { - CAF_PDM_InitObject( "export_well_data_result", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &this->exportedFiles, "exportedFiles", "", "", "", "" ); + CAF_PDM_InitObject( "export_well_data_result" ); + CAF_PDM_InitFieldNoDefault( &this->exportedFiles, "exportedFiles", "" ); } CAF_PDM_SOURCE_INIT( RicfExportWellLogPlotData, "exportWellLogPlotData" ); @@ -60,14 +60,14 @@ CAF_PDM_SOURCE_INIT( RicfExportWellLogPlotData, "exportWellLogPlotData" ); //-------------------------------------------------------------------------------------------------- RicfExportWellLogPlotData::RicfExportWellLogPlotData() { - CAF_PDM_InitScriptableFieldNoDefault( &m_format, "exportFormat", "", "", "", "" ); - CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "", "", "", "" ); - CAF_PDM_InitScriptableField( &m_folder, "exportFolder", QString(), "", "", "", "" ); - CAF_PDM_InitScriptableField( &m_filePrefix, "filePrefix", QString(), "", "", "", "" ); - CAF_PDM_InitScriptableField( &m_exportTvdRkb, "exportTvdRkb", false, "", "", "", "" ); - CAF_PDM_InitScriptableField( &m_capitalizeFileNames, "capitalizeFileNames", false, "", "", "", "" ); - CAF_PDM_InitScriptableField( &m_resampleInterval, "resampleInterval", 0.0, "", "", "", "" ); - CAF_PDM_InitScriptableField( &m_convertCurveUnits, "convertCurveUnits", false, "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_format, "exportFormat", "" ); + CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "" ); + CAF_PDM_InitScriptableField( &m_folder, "exportFolder", QString(), "" ); + CAF_PDM_InitScriptableField( &m_filePrefix, "filePrefix", QString(), "" ); + CAF_PDM_InitScriptableField( &m_exportTvdRkb, "exportTvdRkb", false, "" ); + CAF_PDM_InitScriptableField( &m_capitalizeFileNames, "capitalizeFileNames", false, "" ); + CAF_PDM_InitScriptableField( &m_resampleInterval, "resampleInterval", 0.0, "" ); + CAF_PDM_InitScriptableField( &m_convertCurveUnits, "convertCurveUnits", false, "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.cpp index 9ab16a08f4..f0f10d25f6 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.cpp @@ -43,9 +43,9 @@ CAF_PDM_SOURCE_INIT( RicfExportWellPathCompletions, "exportWellPathCompletions" //-------------------------------------------------------------------------------------------------- RicfExportWellPathCompletions::RicfExportWellPathCompletions() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", -1, "Time Step Index", "", "", "" ); - CAF_PDM_InitScriptableField( &m_wellPathNames, "wellPathNames", std::vector(), "Well Path Names", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" ); + CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", -1, "Time Step Index" ); + CAF_PDM_InitScriptableField( &m_wellPathNames, "wellPathNames", std::vector(), "Well Path Names" ); CAF_PDM_InitScriptableField( &m_fileSplit, "fileSplit", @@ -69,11 +69,11 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions() "", "" ); - CAF_PDM_InitScriptableField( &m_includeMsw, "includeMsw", true, "Export Multi Segment Well Model", "", "", "" ); - CAF_PDM_InitScriptableField( &m_useLateralNTG, "useNtgHorizontally", false, "Use NTG Horizontally", "", "", "" ); - CAF_PDM_InitScriptableField( &m_includePerforations, "includePerforations", true, "Include Perforations", "", "", "" ); - CAF_PDM_InitScriptableField( &m_includeFishbones, "includeFishbones", true, "Include Fishbones", "", "", "" ); - CAF_PDM_InitScriptableField( &m_includeFractures, "includeFractures", true, "Include Fractures", "", "", "" ); + CAF_PDM_InitScriptableField( &m_includeMsw, "includeMsw", true, "Export Multi Segment Well Model" ); + CAF_PDM_InitScriptableField( &m_useLateralNTG, "useNtgHorizontally", false, "Use NTG Horizontally" ); + CAF_PDM_InitScriptableField( &m_includePerforations, "includePerforations", true, "Include Perforations" ); + CAF_PDM_InitScriptableField( &m_includeFishbones, "includeFishbones", true, "Include Fishbones" ); + CAF_PDM_InitScriptableField( &m_includeFractures, "includeFractures", true, "Include Fractures" ); CAF_PDM_InitScriptableField( &m_excludeMainBoreForFishbones, "excludeMainBoreForFishbones", @@ -119,8 +119,8 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions() "", "", "" ); - CAF_PDM_InitScriptableField( &m_exportWelspec, "exportWelspec", true, "Export WELSPEC keyword", "", "", "" ); - CAF_PDM_InitScriptableField( &m_customFileName, "customFileName", QString(), "Custom Filename", "", "", "" ); + CAF_PDM_InitScriptableField( &m_exportWelspec, "exportWelspec", true, "Export WELSPEC keyword" ); + CAF_PDM_InitScriptableField( &m_customFileName, "customFileName", QString(), "Custom Filename" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportWellPaths.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportWellPaths.cpp index 34feb950f0..25ba65d6c3 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportWellPaths.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportWellPaths.cpp @@ -45,8 +45,8 @@ CAF_PDM_SOURCE_INIT( RicfExportWellPaths, "exportWellPaths" ); //-------------------------------------------------------------------------------------------------- RicfExportWellPaths::RicfExportWellPaths() { - CAF_PDM_InitScriptableField( &m_wellPathNames, "wellPathNames", std::vector(), "Well Path Names", "", "", "" ); - CAF_PDM_InitScriptableField( &m_mdStepSize, "mdStepSize", 5.0, "MD Step Size", "", "", "" ); + CAF_PDM_InitScriptableField( &m_wellPathNames, "wellPathNames", std::vector(), "Well Path Names" ); + CAF_PDM_InitScriptableField( &m_mdStepSize, "mdStepSize", 5.0, "MD Step Size" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfImportFormationNames.cpp b/ApplicationLibCode/CommandFileInterface/RicfImportFormationNames.cpp index 092865cdf2..87f7348faf 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfImportFormationNames.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfImportFormationNames.cpp @@ -34,8 +34,8 @@ CAF_PDM_SOURCE_INIT( RicfImportFormationNames, "importFormationNames" ); //-------------------------------------------------------------------------------------------------- RicfImportFormationNames::RicfImportFormationNames() { - CAF_PDM_InitScriptableFieldNoDefault( &m_formationFiles, "formationFiles", "", "", "", "" ); - CAF_PDM_InitScriptableField( &m_applyToCaseId, "applyToCaseId", -1, "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_formationFiles, "formationFiles", "" ); + CAF_PDM_InitScriptableField( &m_applyToCaseId, "applyToCaseId", -1, "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfImportWellLogFiles.cpp b/ApplicationLibCode/CommandFileInterface/RicfImportWellLogFiles.cpp index 6b92cfeff5..3e1ff49519 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfImportWellLogFiles.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfImportWellLogFiles.cpp @@ -35,8 +35,8 @@ CAF_PDM_SOURCE_INIT( RicfImportWellLogFilesResult, "importWellLogFilesResult" ); //-------------------------------------------------------------------------------------------------- RicfImportWellLogFilesResult::RicfImportWellLogFilesResult() { - CAF_PDM_InitObject( "well_log_files_result", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &wellPathNames, "wellPathNames", "", "", "", "" ); + CAF_PDM_InitObject( "well_log_files_result" ); + CAF_PDM_InitFieldNoDefault( &wellPathNames, "wellPathNames", "" ); } CAF_PDM_SOURCE_INIT( RicfImportWellLogFiles, "importWellLogFiles" ); @@ -46,8 +46,8 @@ CAF_PDM_SOURCE_INIT( RicfImportWellLogFiles, "importWellLogFiles" ); //-------------------------------------------------------------------------------------------------- RicfImportWellLogFiles::RicfImportWellLogFiles() { - CAF_PDM_InitScriptableFieldNoDefault( &m_wellLogFileFolder, "wellLogFolder", "", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_wellLogFilePaths, "wellLogFiles", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_wellLogFileFolder, "wellLogFolder", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_wellLogFilePaths, "wellLogFiles", "" ); } caf::PdmScriptResponse RicfImportWellLogFiles::execute() diff --git a/ApplicationLibCode/CommandFileInterface/RicfLoadCase.cpp b/ApplicationLibCode/CommandFileInterface/RicfLoadCase.cpp index 6657a13dd2..86838f1c9e 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfLoadCase.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfLoadCase.cpp @@ -37,8 +37,8 @@ CAF_PDM_SOURCE_INIT( RicfLoadCaseResult, "loadCaseResult" ); //-------------------------------------------------------------------------------------------------- RicfLoadCaseResult::RicfLoadCaseResult( int caseId ) { - CAF_PDM_InitObject( "case_result", "", "", "" ); - CAF_PDM_InitField( &this->caseId, "id", caseId, "", "", "", "" ); + CAF_PDM_InitObject( "case_result" ); + CAF_PDM_InitField( &this->caseId, "id", caseId, "" ); } CAF_PDM_SOURCE_INIT( RicfLoadCase, "loadCase" ); @@ -48,8 +48,8 @@ CAF_PDM_SOURCE_INIT( RicfLoadCase, "loadCase" ); //-------------------------------------------------------------------------------------------------- RicfLoadCase::RicfLoadCase() { - CAF_PDM_InitScriptableField( &m_path, "path", QString(), "Path to Case File", "", "", "" ); - CAF_PDM_InitScriptableField( &m_gridOnly, "gridOnly", false, "Load Grid Data Only", "", "", "" ); + CAF_PDM_InitScriptableField( &m_path, "path", QString(), "Path to Case File" ); + CAF_PDM_InitScriptableField( &m_gridOnly, "gridOnly", false, "Load Grid Data Only" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfOpenProject.cpp b/ApplicationLibCode/CommandFileInterface/RicfOpenProject.cpp index 53652df9a5..a8b8446517 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfOpenProject.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfOpenProject.cpp @@ -35,7 +35,7 @@ CAF_PDM_SOURCE_INIT( RicfOpenProject, "openProject" ); //-------------------------------------------------------------------------------------------------- RicfOpenProject::RicfOpenProject() { - CAF_PDM_InitScriptableField( &m_path, "path", QString(), "Path", "", "", "" ); + CAF_PDM_InitScriptableField( &m_path, "path", QString(), "Path" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfReplaceCase.cpp b/ApplicationLibCode/CommandFileInterface/RicfReplaceCase.cpp index 1cd99cc4af..aa525b7ede 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfReplaceCase.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfReplaceCase.cpp @@ -38,8 +38,8 @@ CAF_PDM_SOURCE_INIT( RicfSingleCaseReplace, "replaceCase" ); //-------------------------------------------------------------------------------------------------- RicfSingleCaseReplace::RicfSingleCaseReplace() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_newGridFile, "newGridFile", QString(), "New Grid File", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" ); + CAF_PDM_InitScriptableField( &m_newGridFile, "newGridFile", QString(), "New Grid File" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfReplaceSourceCases.cpp b/ApplicationLibCode/CommandFileInterface/RicfReplaceSourceCases.cpp index 165b4214c1..8bcc09779a 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfReplaceSourceCases.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfReplaceSourceCases.cpp @@ -33,8 +33,8 @@ CAF_PDM_SOURCE_INIT( RicfReplaceSourceCases, "replaceSourceCases" ); //-------------------------------------------------------------------------------------------------- RicfReplaceSourceCases::RicfReplaceSourceCases() { - CAF_PDM_InitScriptableField( &m_caseGroupId, "caseGroupId", -1, "Case Group ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_gridListFile, "gridListFile", QString(), "Grid List File", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseGroupId, "caseGroupId", -1, "Case Group ID" ); + CAF_PDM_InitScriptableField( &m_gridListFile, "gridListFile", QString(), "Grid List File" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfRunOctaveScript.cpp b/ApplicationLibCode/CommandFileInterface/RicfRunOctaveScript.cpp index 8a11e7bde0..09a8c1ac17 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfRunOctaveScript.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfRunOctaveScript.cpp @@ -37,8 +37,8 @@ CAF_PDM_SOURCE_INIT( RicfRunOctaveScript, "runOctaveScript" ); //-------------------------------------------------------------------------------------------------- RicfRunOctaveScript::RicfRunOctaveScript() { - CAF_PDM_InitScriptableField( &m_path, "path", QString(), "Path", "", "", "" ); - CAF_PDM_InitScriptableField( &m_caseIds, "caseIds", std::vector(), "Case IDs", "", "", "" ); + CAF_PDM_InitScriptableField( &m_path, "path", QString(), "Path" ); + CAF_PDM_InitScriptableField( &m_caseIds, "caseIds", std::vector(), "Case IDs" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfScaleFractureTemplate.cpp b/ApplicationLibCode/CommandFileInterface/RicfScaleFractureTemplate.cpp index b1de06eb27..99f733de55 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfScaleFractureTemplate.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfScaleFractureTemplate.cpp @@ -34,13 +34,13 @@ CAF_PDM_SOURCE_INIT( RicfScaleFractureTemplate, "scaleFractureTemplate" ); //-------------------------------------------------------------------------------------------------- RicfScaleFractureTemplate::RicfScaleFractureTemplate() { - CAF_PDM_InitScriptableField( &m_id, "id", -1, "Id", "", "", "" ); - CAF_PDM_InitScriptableField( &m_halfLengthScaleFactor, "halfLength", 1.0, "HalfLengthScaleFactor", "", "", "" ); - CAF_PDM_InitScriptableField( &m_heightScaleFactor, "height", 1.0, "HeightScaleFactor", "", "", "" ); - CAF_PDM_InitScriptableField( &m_dFactorScaleFactor, "dFactor", 1.0, "DFactorScaleFactor", "", "", "" ); - CAF_PDM_InitScriptableField( &m_conductivityScaleFactor, "conductivity", 1.0, "ConductivityScaleFactor", "", "", "" ); + CAF_PDM_InitScriptableField( &m_id, "id", -1, "Id" ); + CAF_PDM_InitScriptableField( &m_halfLengthScaleFactor, "halfLength", 1.0, "HalfLengthScaleFactor" ); + CAF_PDM_InitScriptableField( &m_heightScaleFactor, "height", 1.0, "HeightScaleFactor" ); + CAF_PDM_InitScriptableField( &m_dFactorScaleFactor, "dFactor", 1.0, "DFactorScaleFactor" ); + CAF_PDM_InitScriptableField( &m_conductivityScaleFactor, "conductivity", 1.0, "ConductivityScaleFactor" ); - CAF_PDM_InitScriptableField( &m_OBSOLETE_widthScaleFactor, "width", 1.0, "WidthScaleFactor", "", "", "" ); + CAF_PDM_InitScriptableField( &m_OBSOLETE_widthScaleFactor, "width", 1.0, "WidthScaleFactor" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfSetFractureContainment.cpp b/ApplicationLibCode/CommandFileInterface/RicfSetFractureContainment.cpp index c54f369280..d49633af4f 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfSetFractureContainment.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfSetFractureContainment.cpp @@ -34,9 +34,9 @@ CAF_PDM_SOURCE_INIT( RicfSetFractureContainment, "setFractureContainment" ); //-------------------------------------------------------------------------------------------------- RicfSetFractureContainment::RicfSetFractureContainment() { - CAF_PDM_InitScriptableField( &m_id, "id", -1, "Id", "", "", "" ); - CAF_PDM_InitScriptableField( &m_topLayer, "topLayer", -1, "TopLayer", "", "", "" ); - CAF_PDM_InitScriptableField( &m_baseLayer, "baseLayer", -1, "BaseLayer", "", "", "" ); + CAF_PDM_InitScriptableField( &m_id, "id", -1, "Id" ); + CAF_PDM_InitScriptableField( &m_topLayer, "topLayer", -1, "TopLayer" ); + CAF_PDM_InitScriptableField( &m_baseLayer, "baseLayer", -1, "BaseLayer" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp b/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp index 6b3f894056..041d1b8190 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp @@ -30,8 +30,8 @@ CAF_PDM_SOURCE_INIT( RicfSetMainWindowSize, "setMainWindowSize" ); //-------------------------------------------------------------------------------------------------- RicfSetMainWindowSize::RicfSetMainWindowSize() { - CAF_PDM_InitScriptableField( &m_height, "height", -1, "Height", "", "", "" ); - CAF_PDM_InitScriptableField( &m_width, "width", -1, "Width", "", "", "" ); + CAF_PDM_InitScriptableField( &m_height, "height", -1, "Height" ); + CAF_PDM_InitScriptableField( &m_width, "width", -1, "Width" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfSetPlotWindowSize.cpp b/ApplicationLibCode/CommandFileInterface/RicfSetPlotWindowSize.cpp index 0d8550dcf6..cfa4e22fe9 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfSetPlotWindowSize.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfSetPlotWindowSize.cpp @@ -30,8 +30,8 @@ CAF_PDM_SOURCE_INIT( RicfSetPlotWindowSize, "setPlotWindowSize" ); //-------------------------------------------------------------------------------------------------- RicfSetPlotWindowSize::RicfSetPlotWindowSize() { - CAF_PDM_InitScriptableField( &m_height, "height", -1, "Height", "", "", "" ); - CAF_PDM_InitScriptableField( &m_width, "width", -1, "Width", "", "", "" ); + CAF_PDM_InitScriptableField( &m_height, "height", -1, "Height" ); + CAF_PDM_InitScriptableField( &m_width, "width", -1, "Width" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfSetStartDir.cpp b/ApplicationLibCode/CommandFileInterface/RicfSetStartDir.cpp index 7a2e9918ab..f432f99a22 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfSetStartDir.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfSetStartDir.cpp @@ -32,7 +32,7 @@ CAF_PDM_SOURCE_INIT( RicfSetStartDir, "setStartDir" ); //-------------------------------------------------------------------------------------------------- RicfSetStartDir::RicfSetStartDir() { - CAF_PDM_InitScriptableField( &m_path, "path", QString(), "Path", "", "", "" ); + CAF_PDM_InitScriptableField( &m_path, "path", QString(), "Path" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfSetTimeStep.cpp b/ApplicationLibCode/CommandFileInterface/RicfSetTimeStep.cpp index 5ed9fae65f..b1214012a5 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfSetTimeStep.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfSetTimeStep.cpp @@ -35,9 +35,9 @@ CAF_PDM_SOURCE_INIT( RicfSetTimeStep, "setTimeStep" ); //-------------------------------------------------------------------------------------------------- RicfSetTimeStep::RicfSetTimeStep() { - CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View ID", "", "", "" ); - CAF_PDM_InitScriptableField( &m_timeStepIndex, "timeStep", -1, "Time Step Index", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "caseId", -1, "Case ID" ); + CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View ID" ); + CAF_PDM_InitScriptableField( &m_timeStepIndex, "timeStep", -1, "Time Step Index" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.cpp index edde3def97..15ba3385d6 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.cpp +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.cpp @@ -34,7 +34,7 @@ RICF_SOURCE_INIT( RicSaveProjectAsFeature, "RicSaveProjectAsFeature", "saveProje //-------------------------------------------------------------------------------------------------- RicSaveProjectAsFeature::RicSaveProjectAsFeature() { - CAF_PDM_InitScriptableFieldNoDefault( &m_filePath, "filePath", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_filePath, "filePath", "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectFeature.cpp index b82395c154..174014233a 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectFeature.cpp +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectFeature.cpp @@ -31,7 +31,7 @@ RICF_SOURCE_INIT( RicSaveProjectFeature, "RicSaveProjectFeature", "saveProject" //-------------------------------------------------------------------------------------------------- RicSaveProjectFeature::RicSaveProjectFeature() { - CAF_PDM_InitFieldNoDefault( &m_filePath, "filePath", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filePath, "filePath", "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.cpp index 6df38e4ff4..d2a2b1a7e2 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.cpp @@ -29,12 +29,12 @@ CAF_PDM_SOURCE_INIT( RicCaseAndFileExportSettingsUi, "RicCaseAndFileExportSettin //-------------------------------------------------------------------------------------------------- RicCaseAndFileExportSettingsUi::RicCaseAndFileExportSettingsUi() { - CAF_PDM_InitObject( "RimCaseAndFileExportSettings", "", "", "" ); + CAF_PDM_InitObject( "RimCaseAndFileExportSettings" ); - CAF_PDM_InitFieldNoDefault( &folder, "Folder", "Export Folder", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &folder, "Folder", "Export Folder" ); folder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &caseToApply, "CaseToApply", "Case to Apply", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &caseToApply, "CaseToApply", "Case to Apply" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp index 3f774af6d6..18123f9021 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp @@ -72,26 +72,26 @@ CAF_PDM_SOURCE_INIT( RicExportCompletionDataSettingsUi, "RicExportCompletionData //-------------------------------------------------------------------------------------------------- RicExportCompletionDataSettingsUi::RicExportCompletionDataSettingsUi() { - CAF_PDM_InitObject( "RimExportCompletionDataSettings", "", "", "" ); + CAF_PDM_InitObject( "RimExportCompletionDataSettings" ); - CAF_PDM_InitFieldNoDefault( &fileSplit, "FileSplit", "File Split", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &fileSplit, "FileSplit", "File Split" ); CAF_PDM_InitFieldNoDefault( &compdatExport, "compdatExport", "Export", "", " ", "" ); - CAF_PDM_InitField( &timeStep, "TimeStepIndex", 0, " Time Step", "", "", "" ); + CAF_PDM_InitField( &timeStep, "TimeStepIndex", 0, " Time Step" ); - CAF_PDM_InitField( &includeMsw, "IncludeMSW", true, "Multi Segment Well Model", "", "", "" ); + CAF_PDM_InitField( &includeMsw, "IncludeMSW", true, "Multi Segment Well Model" ); - CAF_PDM_InitField( &useLateralNTG, "UseLateralNTG", false, "Use NTG Horizontally", "", "", "" ); + CAF_PDM_InitField( &useLateralNTG, "UseLateralNTG", false, "Use NTG Horizontally" ); - CAF_PDM_InitField( &includePerforations, "IncludePerforations", true, "Perforations", "", "", "" ); - CAF_PDM_InitField( &includeFishbones, "IncludeFishbones", true, "Fishbones", "", "", "" ); - CAF_PDM_InitField( &includeFractures, "IncludeFractures", true, "Fractures", "", "", "" ); + CAF_PDM_InitField( &includePerforations, "IncludePerforations", true, "Perforations" ); + CAF_PDM_InitField( &includeFishbones, "IncludeFishbones", true, "Fishbones" ); + CAF_PDM_InitField( &includeFractures, "IncludeFractures", true, "Fractures" ); - CAF_PDM_InitField( &performTransScaling, "TransScalingType", false, "Perform Transmissibility Scaling", "", "", "" ); - CAF_PDM_InitField( &transScalingTimeStep, "TransScalingTimeStep", 0, "Current Time Step", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &transScalingWBHPSource, "TransScalingWBHPSource", "WBHP Selection", "", "", "" ); - CAF_PDM_InitField( &transScalingWBHP, "TransScalingWBHP", 200.0, "WBHP Before Production Start", "", "", "" ); + CAF_PDM_InitField( &performTransScaling, "TransScalingType", false, "Perform Transmissibility Scaling" ); + CAF_PDM_InitField( &transScalingTimeStep, "TransScalingTimeStep", 0, "Current Time Step" ); + CAF_PDM_InitFieldNoDefault( &transScalingWBHPSource, "TransScalingWBHPSource", "WBHP Selection" ); + CAF_PDM_InitField( &transScalingWBHP, "TransScalingWBHP", 200.0, "WBHP Before Production Start" ); CAF_PDM_InitField( &excludeMainBoreForFishbones, "ExcludeMainBoreForFishbones", @@ -104,14 +104,11 @@ RicExportCompletionDataSettingsUi::RicExportCompletionDataSettingsUi() CAF_PDM_InitFieldNoDefault( &m_reportCompletionTypesSeparately, "ReportCompletionTypesSeparately", - "Export Completion Types", - "", - "", - "" ); + "Export Completion Types" ); - CAF_PDM_InitField( &m_exportDataSourceAsComment, "ExportDataSourceAsComment", true, "Comments", "", "", "" ); + CAF_PDM_InitField( &m_exportDataSourceAsComment, "ExportDataSourceAsComment", true, "Comments" ); - CAF_PDM_InitField( &m_exportWelspec, "ExportWelspec", true, "WELSPEC keyword", "", "", "" ); + CAF_PDM_InitField( &m_exportWelspec, "ExportWelspec", true, "WELSPEC keyword" ); CAF_PDM_InitField( &m_completionWelspecAfterMainBore, "CompletionWelspecAfterMainBore", true, @@ -120,8 +117,8 @@ RicExportCompletionDataSettingsUi::RicExportCompletionDataSettingsUi() "", "" ); - CAF_PDM_InitField( &m_useCustomFileName, "UseCustomFileName", false, "Use Custom Filename", "", "", "" ); - CAF_PDM_InitField( &m_customFileName, "CustomFileName", {}, "Custom Filename", "", "", "" ); + CAF_PDM_InitField( &m_useCustomFileName, "UseCustomFileName", false, "Use Custom Filename" ); + CAF_PDM_InitField( &m_customFileName, "CustomFileName", {}, "Custom Filename" ); m_displayForSimWell = true; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.cpp index d1342672cf..8d2037ea9d 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.cpp @@ -40,20 +40,20 @@ CAF_PDM_SOURCE_INIT( RicCellRangeUi, "RicCellRangeUi" ); //-------------------------------------------------------------------------------------------------- RicCellRangeUi::RicCellRangeUi() { - CAF_PDM_InitObject( "Cell Range", "", "", "" ); + CAF_PDM_InitObject( "Cell Range" ); - CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case" ); m_case.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_gridIndex, "GridIndex", 0, "Grid", "", "", "" ); + CAF_PDM_InitField( &m_gridIndex, "GridIndex", 0, "Grid" ); - CAF_PDM_InitField( &m_startIndexI, "StartIndexI", 1, "Start Index I", "", "", "" ); - CAF_PDM_InitField( &m_startIndexJ, "StartIndexJ", 1, "Start Index J", "", "", "" ); - CAF_PDM_InitField( &m_startIndexK, "StartIndexK", 1, "Start Index K", "", "", "" ); + CAF_PDM_InitField( &m_startIndexI, "StartIndexI", 1, "Start Index I" ); + CAF_PDM_InitField( &m_startIndexJ, "StartIndexJ", 1, "Start Index J" ); + CAF_PDM_InitField( &m_startIndexK, "StartIndexK", 1, "Start Index K" ); - CAF_PDM_InitField( &m_cellCountI, "CellCountI", 1, "Cell Count I", "", "", "" ); - CAF_PDM_InitField( &m_cellCountJ, "CellCountJ", 1, "Cell Count J", "", "", "" ); - CAF_PDM_InitField( &m_cellCountK, "CellCountK", 1, "Cell Count K", "", "", "" ); + CAF_PDM_InitField( &m_cellCountI, "CellCountI", 1, "Cell Count I" ); + CAF_PDM_InitField( &m_cellCountJ, "CellCountJ", 1, "Cell Count J" ); + CAF_PDM_InitField( &m_cellCountK, "CellCountK", 1, "Cell Count K" ); m_startIndexI.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); m_startIndexJ.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.cpp index 77f65dd1fe..59ba9f82dc 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.cpp @@ -33,20 +33,20 @@ CAF_PDM_SOURCE_INIT( RicExportCarfinUi, "RicExportCarfinUi" ); //-------------------------------------------------------------------------------------------------- RicExportCarfinUi::RicExportCarfinUi() { - CAF_PDM_InitObject( "Export CARFIN", "", "", "" ); + CAF_PDM_InitObject( "Export CARFIN" ); - CAF_PDM_InitFieldNoDefault( &m_cellRange, "CellRange", "Cell Range", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cellRange, "CellRange", "Cell Range" ); m_cellRange = new RicCellRangeUi; - CAF_PDM_InitFieldNoDefault( &m_exportFileName, "ExportFileName", "Export Filename", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_exportFileName, "ExportFileName", "Export Filename" ); m_exportFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_caseToApply, "CaseToApply", "Source Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_caseToApply, "CaseToApply", "Source Case" ); - CAF_PDM_InitField( &m_cellCountI, "CellCountI", 2, "Cell Count I", "", "", "" ); - CAF_PDM_InitField( &m_cellCountJ, "CellCountJ", 2, "Cell Count J", "", "", "" ); - CAF_PDM_InitField( &m_cellCountK, "CellCountK", 2, "Cell Count K", "", "", "" ); - CAF_PDM_InitField( &m_maxWellCount, "MaxWellCount", 8, "Max Well Count", "", "", "" ); + CAF_PDM_InitField( &m_cellCountI, "CellCountI", 2, "Cell Count I" ); + CAF_PDM_InitField( &m_cellCountJ, "CellCountJ", 2, "Cell Count J" ); + CAF_PDM_InitField( &m_cellCountK, "CellCountK", 2, "Cell Count K" ); + CAF_PDM_InitField( &m_maxWellCount, "MaxWellCount", 8, "Max Well Count" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp index 96ad9179e3..170c61529e 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp @@ -75,10 +75,10 @@ void RicExportEclipseSectorModelUi::GridBoxSelectionEnum::setUp() //-------------------------------------------------------------------------------------------------- RicExportEclipseSectorModelUi::RicExportEclipseSectorModelUi() { - CAF_PDM_InitObject( "Export Visible Cells as Eclipse Input Grid", "", "", "" ); + CAF_PDM_InitObject( "Export Visible Cells as Eclipse Input Grid" ); CAF_PDM_InitField( &exportGrid, "ExportGrid", true, "Export Grid Data", "", "Includes COORD, ZCORN and ACTNUM", "" ); - CAF_PDM_InitField( &exportGridFilename, "ExportGridFilename", QString(), "Grid File Name", "", "", "" ); + CAF_PDM_InitField( &exportGridFilename, "ExportGridFilename", QString(), "Grid File Name" ); exportGridFilename.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); CAF_PDM_InitField( &exportInLocalCoordinates, "ExportInLocalCoords", @@ -87,39 +87,39 @@ RicExportEclipseSectorModelUi::RicExportEclipseSectorModelUi() "", "Remove UTM location on export", "" ); - CAF_PDM_InitField( &makeInvisibleCellsInactive, "InvisibleCellActnum", false, "Make Invisible Cells Inactive", "", "", "" ); + CAF_PDM_InitField( &makeInvisibleCellsInactive, "InvisibleCellActnum", false, "Make Invisible Cells Inactive" ); - CAF_PDM_InitFieldNoDefault( &exportGridBox, "GridBoxSelection", "Cells to Export", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &exportGridBox, "GridBoxSelection", "Cells to Export" ); QString minIJKLabel = "Min I, J, K"; - CAF_PDM_InitField( &minI, "MinI", std::numeric_limits::max(), minIJKLabel, "", "", "" ); - CAF_PDM_InitField( &minJ, "MinJ", std::numeric_limits::max(), "", "", "", "" ); + CAF_PDM_InitField( &minI, "MinI", std::numeric_limits::max(), minIJKLabel ); + CAF_PDM_InitField( &minJ, "MinJ", std::numeric_limits::max(), "" ); minJ.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitField( &minK, "MinK", std::numeric_limits::max(), "", "", "", "" ); + CAF_PDM_InitField( &minK, "MinK", std::numeric_limits::max(), "" ); minK.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); QString maxIJKLabel = "Max I, J, K"; - CAF_PDM_InitField( &maxI, "MaxI", -std::numeric_limits::max(), maxIJKLabel, "", "", "" ); - CAF_PDM_InitField( &maxJ, "MaxJ", -std::numeric_limits::max(), "", "", "", "" ); + CAF_PDM_InitField( &maxI, "MaxI", -std::numeric_limits::max(), maxIJKLabel ); + CAF_PDM_InitField( &maxJ, "MaxJ", -std::numeric_limits::max(), "" ); maxJ.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitField( &maxK, "MaxK", -std::numeric_limits::max(), "", "", "", "" ); + CAF_PDM_InitField( &maxK, "MaxK", -std::numeric_limits::max(), "" ); maxK.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &exportFaults, "ExportFaults", "Export Fault Data", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &exportFaults, "ExportFaults", "Export Fault Data" ); exportFaults = EXPORT_TO_SINGLE_SEPARATE_FILE; - CAF_PDM_InitField( &exportFaultsFilename, "ExportFaultsFilename", QString(), "Faults File Name", "", "", "" ); + CAF_PDM_InitField( &exportFaultsFilename, "ExportFaultsFilename", QString(), "Faults File Name" ); exportFaultsFilename.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); QString ijkLabel = "Cell Count I, J, K"; - CAF_PDM_InitField( &refinementCountI, "RefinementCountI", 1, ijkLabel, "", "", "" ); - CAF_PDM_InitField( &refinementCountJ, "RefinementCountJ", 1, "", "", "", "" ); - CAF_PDM_InitField( &refinementCountK, "RefinementCountK", 1, "", "", "", "" ); + CAF_PDM_InitField( &refinementCountI, "RefinementCountI", 1, ijkLabel ); + CAF_PDM_InitField( &refinementCountJ, "RefinementCountJ", 1, "" ); + CAF_PDM_InitField( &refinementCountK, "RefinementCountK", 1, "" ); - CAF_PDM_InitFieldNoDefault( &exportParameters, "ExportParams", "Export Parameters", "", "", "" ); - CAF_PDM_InitField( &exportParametersFilename, "ExportParamsFilename", QString(), "File Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &exportParameters, "ExportParams", "Export Parameters" ); + CAF_PDM_InitField( &exportParametersFilename, "ExportParamsFilename", QString(), "File Name" ); exportParametersFilename.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &selectedKeywords, "ExportMainKeywords", "Keywords to Export", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &selectedKeywords, "ExportMainKeywords", "Keywords to Export" ); exportGridFilename = defaultGridFileName(); exportParametersFilename = defaultResultsFileName(); diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.cpp index 05541d25ff..3f6e93530f 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.cpp @@ -50,27 +50,27 @@ void Lgr::SplitTypeEnum::setUp() //-------------------------------------------------------------------------------------------------- RicExportLgrUi::RicExportLgrUi() { - CAF_PDM_InitObject( "Export CARFIN", "", "", "" ); + CAF_PDM_InitObject( "Export CARFIN" ); - CAF_PDM_InitFieldNoDefault( &m_exportFolder, "ExportFolder", "Export Folder", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_exportFolder, "ExportFolder", "Export Folder" ); m_exportFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_caseToApply, "CaseToApply", "Source Case", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStepIndex", "Time Step", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_caseToApply, "CaseToApply", "Source Case" ); + CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStepIndex", "Time Step" ); - CAF_PDM_InitField( &m_includePerforations, "IncludePerforations", true, "Perforations", "", "", "" ); - CAF_PDM_InitField( &m_includeFractures, "IncludeFractures", true, "Fractures", "", "", "" ); - CAF_PDM_InitField( &m_includeFishbones, "IncludeFishbones", true, "Fishbones", "", "", "" ); + CAF_PDM_InitField( &m_includePerforations, "IncludePerforations", true, "Perforations" ); + CAF_PDM_InitField( &m_includeFractures, "IncludeFractures", true, "Fractures" ); + CAF_PDM_InitField( &m_includeFishbones, "IncludeFishbones", true, "Fishbones" ); QString ijkLabel = "Cell Count I, J, K"; - CAF_PDM_InitField( &m_cellCountI, "CellCountI", 2, ijkLabel, "", "", "" ); - CAF_PDM_InitField( &m_cellCountJ, "CellCountJ", 2, "", "", "", "" ); - CAF_PDM_InitField( &m_cellCountK, "CellCountK", 2, "", "", "", "" ); + CAF_PDM_InitField( &m_cellCountI, "CellCountI", 2, ijkLabel ); + CAF_PDM_InitField( &m_cellCountJ, "CellCountJ", 2, "" ); + CAF_PDM_InitField( &m_cellCountK, "CellCountK", 2, "" ); m_cellCountJ.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_cellCountK.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitField( &m_splitType, "SplitType", Lgr::SplitTypeEnum(), "Split Type", "", "", "" ); + CAF_PDM_InitField( &m_splitType, "SplitType", Lgr::SplitTypeEnum(), "Split Type" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp index 1490b1a4f6..3ad4e5e23e 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp @@ -45,9 +45,9 @@ CAF_PDM_SOURCE_INIT( RicExportToLasFileObj, "RicExportToLasFileObj" ); //-------------------------------------------------------------------------------------------------- RicExportToLasFileObj::RicExportToLasFileObj( void ) { - CAF_PDM_InitObject( "RicExportToLasFileObj", "", "", "" ); + CAF_PDM_InitObject( "RicExportToLasFileObj" ); - CAF_PDM_InitField( &tvdrkbOffset, "tvdrkbOffset", QString( "" ), "TVDRKB offset (RKB - MSL) [m]", "", "", "" ); + CAF_PDM_InitField( &tvdrkbOffset, "tvdrkbOffset", QString( "" ), "TVDRKB offset (RKB - MSL) [m]" ); } CAF_PDM_SOURCE_INIT( RicExportToLasFileResampleUi, "RicExportToLasFileResampleUi" ); @@ -58,23 +58,23 @@ CAF_PDM_SOURCE_INIT( RicExportToLasFileResampleUi, "RicExportToLasFileResampleUi RicExportToLasFileResampleUi::RicExportToLasFileResampleUi( void ) : m_enableCurveUnitConversion( false ) { - CAF_PDM_InitObject( "Resample LAS curves for export", "", "", "" ); + CAF_PDM_InitObject( "Resample LAS curves for export" ); - CAF_PDM_InitField( &exportFolder, "ExportFolder", QString(), "Export Folder", "", "", "" ); + CAF_PDM_InitField( &exportFolder, "ExportFolder", QString(), "Export Folder" ); exportFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &filePrefix, "FilePrefix", QString( "" ), "File Prefix", "", "", "" ); - CAF_PDM_InitField( &capitalizeFileName, "CapitalizeFileName", false, "Capitalize File Name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &curveUnitConversion, "CurveUnitConversion", "Curve Units", "", "", "" ); + CAF_PDM_InitField( &filePrefix, "FilePrefix", QString( "" ), "File Prefix" ); + CAF_PDM_InitField( &capitalizeFileName, "CapitalizeFileName", false, "Capitalize File Name" ); + CAF_PDM_InitFieldNoDefault( &curveUnitConversion, "CurveUnitConversion", "Curve Units" ); - CAF_PDM_InitField( &activateResample, "ActivateResample", false, "Resample Curve Data", "", "", "" ); + CAF_PDM_InitField( &activateResample, "ActivateResample", false, "Resample Curve Data" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &activateResample ); - CAF_PDM_InitField( &resampleInterval, "ResampleInterval", 1.0, "Resample Interval [m]", "", "", "" ); + CAF_PDM_InitField( &resampleInterval, "ResampleInterval", 1.0, "Resample Interval [m]" ); - CAF_PDM_InitField( &exportTvdrkb, "ExportTvdrkb", false, "Export TVDRKB", "", "", "" ); + CAF_PDM_InitField( &exportTvdrkb, "ExportTvdrkb", false, "Export TVDRKB" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &exportTvdrkb ); - CAF_PDM_InitFieldNoDefault( &m_tvdrkbOffsets, "tvdrkbOffsets", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_tvdrkbOffsets, "tvdrkbOffsets", "" ); updateFieldVisibility(); } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportWellPathsUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportWellPathsUi.cpp index ba741a8085..978da4f46c 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportWellPathsUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportWellPathsUi.cpp @@ -34,12 +34,12 @@ CAF_PDM_SOURCE_INIT( RicExportWellPathsUi, "RicExportWellPathsUi" ); //-------------------------------------------------------------------------------------------------- RicExportWellPathsUi::RicExportWellPathsUi() { - CAF_PDM_InitObject( "Resample LAS curves for export", "", "", "" ); + CAF_PDM_InitObject( "Resample LAS curves for export" ); - CAF_PDM_InitField( &m_exportFolder, "ExportFolder", QString(), "Export Folder", "", "", "" ); + CAF_PDM_InitField( &m_exportFolder, "ExportFolder", QString(), "Export Folder" ); m_exportFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_mdStepSize, "MdStepSize", 5.0, "MD Step Size", "", "", "" ); + CAF_PDM_InitField( &m_mdStepSize, "MdStepSize", 5.0, "MD Step Size" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsUi.cpp index ece728d1d8..b557f5d02f 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputVisibleCellsUi.cpp @@ -45,14 +45,14 @@ CAF_PDM_SOURCE_INIT( RicSaveEclipseInputVisibleCellsUi, "RicSaveEclipseInputVisi RicSaveEclipseInputVisibleCellsUi::RicSaveEclipseInputVisibleCellsUi() : exportFilenameManuallyChanged( false ) { - CAF_PDM_InitObject( "Export Visible Cells FLUXNUM/MULTNUM/ACTNUM", "", "", "" ); + CAF_PDM_InitObject( "Export Visible Cells FLUXNUM/MULTNUM/ACTNUM" ); - CAF_PDM_InitField( &exportFilename, "ExportFilename", QString(), "Export Filename", "", "", "" ); + CAF_PDM_InitField( &exportFilename, "ExportFilename", QString(), "Export Filename" ); exportFilename.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &exportKeyword, "ExportKeyword", "Export Keyword", "", "", "" ); - CAF_PDM_InitField( &visibleActiveCellsValue, "VisibleActiveCellsValue", 1, "Visible Active Cells Value", "", "", "" ); - CAF_PDM_InitField( &hiddenActiveCellsValue, "HiddenActiveCellsValue", 0, "Hidden Active Cells Value", "", "", "" ); - CAF_PDM_InitField( &inactiveCellsValue, "InactiveCellsValue", 0, "Inactive Cells Value", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &exportKeyword, "ExportKeyword", "Export Keyword" ); + CAF_PDM_InitField( &visibleActiveCellsValue, "VisibleActiveCellsValue", 1, "Visible Active Cells Value" ); + CAF_PDM_InitField( &hiddenActiveCellsValue, "HiddenActiveCellsValue", 0, "Hidden Active Cells Value" ); + CAF_PDM_InitField( &inactiveCellsValue, "InactiveCellsValue", 0, "Inactive Cells Value" ); exportFilename = getDefaultExportPath(); } diff --git a/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp b/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp index 76b8272145..54b0156cda 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp @@ -28,11 +28,11 @@ CAF_PDM_SOURCE_INIT( RicSelectViewUI, "RicSelectViewUI" ); //-------------------------------------------------------------------------------------------------- RicSelectViewUI::RicSelectViewUI() { - CAF_PDM_InitObject( "RicSelectViewUI", "", "", "" ); + CAF_PDM_InitObject( "RicSelectViewUI" ); - CAF_PDM_InitFieldNoDefault( &m_selectedView, "MasterView", "Select view", "", "", "" ); - CAF_PDM_InitField( &m_createNewView, "CreateNewView", true, "Create New View", "", "", "" ); - CAF_PDM_InitField( &m_newViewName, "NewViewName", QString( "ShowContributingWells" ), "New View Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedView, "MasterView", "Select view" ); + CAF_PDM_InitField( &m_createNewView, "CreateNewView", true, "Create New View" ); + CAF_PDM_InitField( &m_newViewName, "NewViewName", QString( "ShowContributingWells" ), "New View Name" ); m_currentView = nullptr; m_currentCase = nullptr; diff --git a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.cpp b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.cpp index de0187c052..9d70eb697a 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.cpp @@ -31,10 +31,10 @@ CAF_PDM_SOURCE_INIT( RicCreateMultipleFracturesOptionItemUi, "RiuMultipleFractio //-------------------------------------------------------------------------------------------------- RicCreateMultipleFracturesOptionItemUi::RicCreateMultipleFracturesOptionItemUi() { - CAF_PDM_InitField( &m_topKOneBased, "TopKLayer", 1, "Top K Layer", "", "", "" ); - CAF_PDM_InitField( &m_baseKOneBased, "BaseKLayer", 1, "Base K Layer", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_fractureTemplate, "Template", "Template", "", "", "" ); - CAF_PDM_InitField( &m_minSpacing, "MinSpacing", 300.0, "Spacing", "", "", "" ); + CAF_PDM_InitField( &m_topKOneBased, "TopKLayer", 1, "Top K Layer" ); + CAF_PDM_InitField( &m_baseKOneBased, "BaseKLayer", 1, "Base K Layer" ); + CAF_PDM_InitFieldNoDefault( &m_fractureTemplate, "Template", "Template" ); + CAF_PDM_InitField( &m_minSpacing, "MinSpacing", 300.0, "Spacing" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp index 54f3ebd7f4..674b56a1d9 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp @@ -85,17 +85,17 @@ const QString RiuCreateMultipleFractionsUi::REPLACE_FRACTURES_BUTTON_TEXT = "Rep //-------------------------------------------------------------------------------------------------- RiuCreateMultipleFractionsUi::RiuCreateMultipleFractionsUi() { - CAF_PDM_InitFieldNoDefault( &m_sourceCase, "SourceCase", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_sourceCase, "SourceCase", "Case" ); - CAF_PDM_InitField( &m_minDistanceFromWellTd, "MinDistanceFromWellTd", 10.0, "Min Distance From Well TD", "", "", "" ); - CAF_PDM_InitField( &m_maxFracturesPerWell, "MaxFracturesPerWell", 10, "Max Fractures Per Well", "", "", "" ); + CAF_PDM_InitField( &m_minDistanceFromWellTd, "MinDistanceFromWellTd", 10.0, "Min Distance From Well TD" ); + CAF_PDM_InitField( &m_maxFracturesPerWell, "MaxFracturesPerWell", 10, "Max Fractures Per Well" ); - CAF_PDM_InitFieldNoDefault( &m_options, "Options", "Options", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_options, "Options", "Options" ); m_options.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); m_options.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_options.uiCapability()->setCustomContextMenuEnabled( true ); - CAF_PDM_InitFieldNoDefault( &m_fractureCreationSummary, "FractureCreationSummary", "Generated Fractures", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fractureCreationSummary, "FractureCreationSummary", "Generated Fractures" ); m_fractureCreationSummary.registerGetMethod( this, &RiuCreateMultipleFractionsUi::summaryText ); m_fractureCreationSummary.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_fractureCreationSummary.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.cpp b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.cpp index 06859a8fed..944f8748d6 100644 --- a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.cpp +++ b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.cpp @@ -29,10 +29,10 @@ CAF_PDM_SOURCE_INIT( RicSaturationPressureUi, "RicSaturationPressureUi" ); //-------------------------------------------------------------------------------------------------- RicSaturationPressureUi::RicSaturationPressureUi() { - CAF_PDM_InitObject( "RicSaturationPressureUi", "", "", "" ); + CAF_PDM_InitObject( "RicSaturationPressureUi" ); - CAF_PDM_InitFieldNoDefault( &m_caseToApply, "CaseToApply", "Case to Apply", "", "", "" ); - CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_caseToApply, "CaseToApply", "Case to Apply" ); + CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensCreateSessionUi.cpp b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensCreateSessionUi.cpp index b34385e27f..80766ce294 100644 --- a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensCreateSessionUi.cpp +++ b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensCreateSessionUi.cpp @@ -35,12 +35,12 @@ CAF_PDM_SOURCE_INIT( RicHoloLensCreateSessionUi, "RicHoloLensCreateSessionUi" ); //-------------------------------------------------------------------------------------------------- RicHoloLensCreateSessionUi::RicHoloLensCreateSessionUi() { - CAF_PDM_InitObject( "HoloLens Create Session", "", "", "" ); + CAF_PDM_InitObject( "HoloLens Create Session" ); - CAF_PDM_InitField( &m_sessionName, "SessionName", QString( "DummySessionName" ), "Session Name", "", "", "" ); - CAF_PDM_InitField( &m_sessionPinCode, "SessionPinCode", QString( "1234" ), "Session Pin Code", "", "", "" ); + CAF_PDM_InitField( &m_sessionName, "SessionName", QString( "DummySessionName" ), "Session Name" ); + CAF_PDM_InitField( &m_sessionPinCode, "SessionPinCode", QString( "1234" ), "Session Pin Code" ); - CAF_PDM_InitFieldNoDefault( &m_serverSettings, "ServerSettings", "Server Settings", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_serverSettings, "ServerSettings", "Server Settings" ); m_serverSettings = new RicHoloLensServerSettings; caf::PdmSettings::readFieldsFromApplicationStore( m_serverSettings ); diff --git a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp index 9092d59360..567cf9a42c 100644 --- a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp +++ b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp @@ -34,11 +34,11 @@ CAF_PDM_SOURCE_INIT( RicHoloLensExportToFolderUi, "RicHoloLensExportToFolderUi" //-------------------------------------------------------------------------------------------------- RicHoloLensExportToFolderUi::RicHoloLensExportToFolderUi() { - CAF_PDM_InitObject( "Resample LAS curves for export", "", "", "" ); + CAF_PDM_InitObject( "Resample LAS curves for export" ); - CAF_PDM_InitFieldNoDefault( &m_viewForExport, "ViewForExport", "View", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_viewForExport, "ViewForExport", "View" ); - CAF_PDM_InitField( &m_exportFolder, "ExportFolder", QString(), "Export Folder", "", "", "" ); + CAF_PDM_InitField( &m_exportFolder, "ExportFolder", QString(), "Export Folder" ); m_exportFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); } diff --git a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensServerSettings.cpp b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensServerSettings.cpp index 6399e30dbc..275d2464ed 100644 --- a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensServerSettings.cpp +++ b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensServerSettings.cpp @@ -25,9 +25,9 @@ CAF_PDM_SOURCE_INIT( RicHoloLensServerSettings, "RicHoloLensServerSettings" ); //-------------------------------------------------------------------------------------------------- RicHoloLensServerSettings::RicHoloLensServerSettings() { - CAF_PDM_InitObject( "HoloLens Server Settings", "", "", "" ); + CAF_PDM_InitObject( "HoloLens Server Settings" ); - CAF_PDM_InitField( &m_serverAddress, "ServerAddress", QString(), "Server Address", "", "", "" ); + CAF_PDM_InitField( &m_serverAddress, "ServerAddress", QString(), "Server Address" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp index 35a8dd5bbd..d502ad93fb 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp @@ -38,9 +38,9 @@ CAF_PDM_SOURCE_INIT( RicSelectPlotTemplateUi, "RicSelectPlotTemplateUi" ); //-------------------------------------------------------------------------------------------------- RicSelectPlotTemplateUi::RicSelectPlotTemplateUi() { - CAF_PDM_InitObject( "RicSelectPlotTemplateUi", "", "", "" ); + CAF_PDM_InitObject( "RicSelectPlotTemplateUi" ); - CAF_PDM_InitFieldNoDefault( &m_selectedPlotTemplates, "SelectedPlotTemplates", "Plot Templates", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedPlotTemplates, "SelectedPlotTemplates", "Plot Templates" ); m_selectedPlotTemplates.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_selectedPlotTemplates.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); } diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp index 198229fbad..b70ee36af0 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp @@ -32,9 +32,9 @@ CAF_PDM_SOURCE_INIT( RicCreateEnsembleSurfaceUi, "RicCreateEnsembleSurfaceUi" ); //-------------------------------------------------------------------------------------------------- RicCreateEnsembleSurfaceUi::RicCreateEnsembleSurfaceUi() { - CAF_PDM_InitObject( "Export Multiple Surfaces", "", "", "" ); + CAF_PDM_InitObject( "Export Multiple Surfaces" ); - CAF_PDM_InitFieldNoDefault( &m_layers, "Layers", "Layers", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_layers, "Layers", "Layers" ); CAF_PDM_InitField( &m_autoCreateEnsembleSurfaces, "AutoCreateEnsembleSurfaces", false, @@ -44,8 +44,8 @@ RicCreateEnsembleSurfaceUi::RicCreateEnsembleSurfaceUi() "" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_autoCreateEnsembleSurfaces ); - CAF_PDM_InitFieldNoDefault( &m_minLayer, "MinLayer", "MinLayer", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_maxLayer, "MaxLayer", "MaxLayer", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_minLayer, "MinLayer", "MinLayer" ); + CAF_PDM_InitFieldNoDefault( &m_maxLayer, "MaxLayer", "MaxLayer" ); m_tabNames << "Configuration"; } diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp index 7a7cc052aa..cda4b4d30a 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp @@ -55,7 +55,7 @@ void caf::AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RicCreateEnsembleWellLogUi::RicCreateEnsembleWellLogUi() { - CAF_PDM_InitObject( "Create Ensemble Well Log", "", "", "" ); + CAF_PDM_InitObject( "Create Ensemble Well Log" ); CAF_PDM_InitField( &m_autoCreateEnsembleWellLogs, "AutoCreateEnsembleWellLogs", @@ -66,11 +66,11 @@ RicCreateEnsembleWellLogUi::RicCreateEnsembleWellLogUi() "" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_autoCreateEnsembleWellLogs ); - CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellPathSource, "WellPathSource", "Well Path Source", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "Well Path", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellFilePath, "WellFilePath", "Well File Path", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_selectedKeywords, "SelectedProperties", "Selected Properties", "", "", "" ); + CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step" ); + CAF_PDM_InitFieldNoDefault( &m_wellPathSource, "WellPathSource", "Well Path Source" ); + CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "Well Path" ); + CAF_PDM_InitFieldNoDefault( &m_wellFilePath, "WellFilePath", "Well File Path" ); + CAF_PDM_InitFieldNoDefault( &m_selectedKeywords, "SelectedProperties", "Selected Properties" ); m_selectedKeywords.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_tabNames << "Well" diff --git a/ApplicationLibCode/Commands/RicDeleteItemExecData.h b/ApplicationLibCode/Commands/RicDeleteItemExecData.h index 94b26d141c..6acc458f65 100644 --- a/ApplicationLibCode/Commands/RicDeleteItemExecData.h +++ b/ApplicationLibCode/Commands/RicDeleteItemExecData.h @@ -37,8 +37,8 @@ class RicDeleteItemExecData : public caf::PdmObject "CmdDeleteItemExecData tooltip", "CmdDeleteItemExecData whatsthis" ); - CAF_PDM_InitFieldNoDefault( &m_pathToField, "PathToField", "PathToField", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_description, "Description", "Description", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_pathToField, "PathToField", "PathToField" ); + CAF_PDM_InitFieldNoDefault( &m_description, "Description", "Description" ); CAF_PDM_InitField( &m_indexToObject, "indexToObject", -1, diff --git a/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp b/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp index 67c66b1b13..4d54de5417 100644 --- a/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp +++ b/ApplicationLibCode/Commands/RicExportContourMapToTextFeature.cpp @@ -50,11 +50,11 @@ RICF_SOURCE_INIT( RicExportContourMapToTextFeature, "RicExportContourMapToTextFe RicExportContourMapToTextFeature::RicExportContourMapToTextFeature() { - CAF_PDM_InitScriptableFieldNoDefault( &m_exportFileName, "exportFileName", "", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_exportLocalCoordinates, "exportLocalCoordinates", "", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_undefinedValueLabel, "undefinedValueLabel", "", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_excludeUndefinedValues, "excludeUndefinedValues", "", "", "", "" ); - CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View Id", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_exportFileName, "exportFileName", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_exportLocalCoordinates, "exportLocalCoordinates", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_undefinedValueLabel, "undefinedValueLabel", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_excludeUndefinedValues, "excludeUndefinedValues", "" ); + CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View Id" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/RicExportContourMapToTextUi.cpp b/ApplicationLibCode/Commands/RicExportContourMapToTextUi.cpp index 2c7439559b..b9b9d28971 100644 --- a/ApplicationLibCode/Commands/RicExportContourMapToTextUi.cpp +++ b/ApplicationLibCode/Commands/RicExportContourMapToTextUi.cpp @@ -9,14 +9,14 @@ CAF_PDM_SOURCE_INIT( RicExportContourMapToTextUi, "RicExportContourMapToTextUi" //-------------------------------------------------------------------------------------------------- RicExportContourMapToTextUi::RicExportContourMapToTextUi() { - CAF_PDM_InitObject( "Export Contour Map to Text", "", "", "" ); + CAF_PDM_InitObject( "Export Contour Map to Text" ); - CAF_PDM_InitField( &m_exportFileName, "ExportFileName", QString(), "Export File Name", "", "", "" ); + CAF_PDM_InitField( &m_exportFileName, "ExportFileName", QString(), "Export File Name" ); m_exportFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_exportLocalCoordinates, "ExportLocalCoordinates", false, "Export Local Coordinates", "", "", "" ); - CAF_PDM_InitField( &m_undefinedValueLabel, "UndefinedValueLabel", QString( "NaN" ), "Undefined Value Label", "", "", "" ); - CAF_PDM_InitField( &m_excludeUndefinedValues, "ExcludeUndefinedValues", false, "Exclude Undefined Values", "", "", "" ); + CAF_PDM_InitField( &m_exportLocalCoordinates, "ExportLocalCoordinates", false, "Export Local Coordinates" ); + CAF_PDM_InitField( &m_undefinedValueLabel, "UndefinedValueLabel", QString( "NaN" ), "Undefined Value Label" ); + CAF_PDM_InitField( &m_excludeUndefinedValues, "ExcludeUndefinedValues", false, "Exclude Undefined Values" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/RicNewMultiPlotFeature.cpp b/ApplicationLibCode/Commands/RicNewMultiPlotFeature.cpp index 2507bcf216..435223fb45 100644 --- a/ApplicationLibCode/Commands/RicNewMultiPlotFeature.cpp +++ b/ApplicationLibCode/Commands/RicNewMultiPlotFeature.cpp @@ -41,7 +41,7 @@ RICF_SOURCE_INIT( RicNewMultiPlotFeature, "RicNewMultiPlotFeature", "createMulti //-------------------------------------------------------------------------------------------------- RicNewMultiPlotFeature::RicNewMultiPlotFeature() { - CAF_PDM_InitFieldNoDefault( &m_plots, "plots", "Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plots, "plots", "Plots" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/RicStackSelectedCurvesFeature.cpp b/ApplicationLibCode/Commands/RicStackSelectedCurvesFeature.cpp index e863157054..b5812416c9 100644 --- a/ApplicationLibCode/Commands/RicStackSelectedCurvesFeature.cpp +++ b/ApplicationLibCode/Commands/RicStackSelectedCurvesFeature.cpp @@ -36,7 +36,7 @@ RICF_SOURCE_INIT( RicStackSelectedCurvesFeature, "RicStackSelectedCurvesFeature" //-------------------------------------------------------------------------------------------------- RicStackSelectedCurvesFeature::RicStackSelectedCurvesFeature() { - CAF_PDM_InitScriptableFieldNoDefault( &m_curves, "curves", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_curves, "curves", "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/RicUnstackSelectedCurvesFeature.cpp b/ApplicationLibCode/Commands/RicUnstackSelectedCurvesFeature.cpp index 68b5b8d7ca..b363bf3658 100644 --- a/ApplicationLibCode/Commands/RicUnstackSelectedCurvesFeature.cpp +++ b/ApplicationLibCode/Commands/RicUnstackSelectedCurvesFeature.cpp @@ -36,7 +36,7 @@ RICF_SOURCE_INIT( RicUnstackSelectedCurvesFeature, "RicUnstackSelectedCurvesFeat //-------------------------------------------------------------------------------------------------- RicUnstackSelectedCurvesFeature::RicUnstackSelectedCurvesFeature() { - CAF_PDM_InitScriptableFieldNoDefault( &m_curves, "curves", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_curves, "curves", "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilFieldEntry.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilFieldEntry.cpp index cb684c6ac0..c8c261c8b6 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilFieldEntry.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilFieldEntry.cpp @@ -35,15 +35,15 @@ CAF_PDM_SOURCE_INIT( RimOilFieldEntry, "RimOilFieldEntry" ); //-------------------------------------------------------------------------------------------------- RimOilFieldEntry::RimOilFieldEntry() { - CAF_PDM_InitObject( "OilFieldEntry", "", "", "" ); + CAF_PDM_InitObject( "OilFieldEntry" ); - CAF_PDM_InitFieldNoDefault( &name, "OilFieldName", "Oil Field Name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &edmId, "EdmId", "Edm ID", "", "", "" ); - CAF_PDM_InitField( &selected, "Selected", false, "Selected", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &name, "OilFieldName", "Oil Field Name" ); + CAF_PDM_InitFieldNoDefault( &edmId, "EdmId", "Edm ID" ); + CAF_PDM_InitField( &selected, "Selected", false, "Selected" ); - CAF_PDM_InitFieldNoDefault( &wellsFilePath, "wellsFilePath", "Wells File Path", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &wellsFilePath, "wellsFilePath", "Wells File Path" ); - CAF_PDM_InitFieldNoDefault( &wells, "Wells", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &wells, "Wells", "" ); wells.uiCapability()->setUiTreeHidden( true ); wells.uiCapability()->setUiTreeChildrenHidden( true ); } diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilRegionEntry.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilRegionEntry.cpp index 0e44542c6a..7a81370e84 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilRegionEntry.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilRegionEntry.cpp @@ -26,14 +26,14 @@ CAF_PDM_SOURCE_INIT( RimOilRegionEntry, "RimOilRegionEntry" ); //-------------------------------------------------------------------------------------------------- RimOilRegionEntry::RimOilRegionEntry() { - CAF_PDM_InitObject( "OilRegionEntry", "", "", "" ); + CAF_PDM_InitObject( "OilRegionEntry" ); - CAF_PDM_InitFieldNoDefault( &name, "OilRegionEntry", "OilRegionEntry", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &name, "OilRegionEntry", "OilRegionEntry" ); - CAF_PDM_InitFieldNoDefault( &fields, "Fields", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &fields, "Fields", "" ); fields.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &selected, "Selected", false, "Selected", "", "", "" ); + CAF_PDM_InitField( &selected, "Selected", false, "Selected" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp index bab5838747..06b9541b0a 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp @@ -49,20 +49,20 @@ CAF_PDM_SOURCE_INIT( RimWellPathImport, "RimWellPathImport" ); //-------------------------------------------------------------------------------------------------- RimWellPathImport::RimWellPathImport() { - CAF_PDM_InitObject( "RimWellPathImport", "", "", "" ); + CAF_PDM_InitObject( "RimWellPathImport" ); - CAF_PDM_InitField( &wellTypeSurvey, "WellTypeSurvey", true, "Survey", "", "", "" ); - CAF_PDM_InitField( &wellTypePlans, "WellTypePlans", true, "Plans", "", "", "" ); + CAF_PDM_InitField( &wellTypeSurvey, "WellTypeSurvey", true, "Survey" ); + CAF_PDM_InitField( &wellTypePlans, "WellTypePlans", true, "Plans" ); caf::AppEnum defaultUtmMode = UTM_FILTER_OFF; - CAF_PDM_InitField( &utmFilterMode, "UtmMode", defaultUtmMode, "Utm Filter", "", "", "" ); + CAF_PDM_InitField( &utmFilterMode, "UtmMode", defaultUtmMode, "Utm Filter" ); - CAF_PDM_InitField( &north, "UtmNorth", 0.0, "North", "", "", "" ); - CAF_PDM_InitField( &south, "UtmSouth", 0.0, "South", "", "", "" ); - CAF_PDM_InitField( &east, "UtmEast", 0.0, "East", "", "", "" ); - CAF_PDM_InitField( &west, "UtmWest", 0.0, "West", "", "", "" ); + CAF_PDM_InitField( &north, "UtmNorth", 0.0, "North" ); + CAF_PDM_InitField( &south, "UtmSouth", 0.0, "South" ); + CAF_PDM_InitField( &east, "UtmEast", 0.0, "East" ); + CAF_PDM_InitField( &west, "UtmWest", 0.0, "West" ); - CAF_PDM_InitFieldNoDefault( ®ions, "Regions", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( ®ions, "Regions", "" ); regions.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellsEntry.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellsEntry.cpp index 87eb598479..4da94f883d 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellsEntry.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellsEntry.cpp @@ -39,18 +39,18 @@ CAF_PDM_SOURCE_INIT( RimWellPathEntry, "RimWellPathEntry" ); //-------------------------------------------------------------------------------------------------- RimWellPathEntry::RimWellPathEntry() { - CAF_PDM_InitObject( "WellPathEntry", "", "", "" ); + CAF_PDM_InitObject( "WellPathEntry" ); - CAF_PDM_InitFieldNoDefault( &name, "Name", "Name", "", "", "" ); - CAF_PDM_InitField( &selected, "Selected", false, "Selected", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &name, "Name", "Name" ); + CAF_PDM_InitField( &selected, "Selected", false, "Selected" ); caf::AppEnum wellType = WELL_ALL; - CAF_PDM_InitField( &wellPathType, "WellPathType", wellType, "Well path type", "", "", "" ); + CAF_PDM_InitField( &wellPathType, "WellPathType", wellType, "Well path type" ); - CAF_PDM_InitFieldNoDefault( &surveyType, "surveyType", "surveyType", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &requestUrl, "requestUrl", "requestUrl", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &surveyType, "surveyType", "surveyType" ); + CAF_PDM_InitFieldNoDefault( &requestUrl, "requestUrl", "requestUrl" ); - CAF_PDM_InitFieldNoDefault( &wellPathFilePath, "wellPathFilePath", "wellPathFilePath", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &wellPathFilePath, "wellPathFilePath", "wellPathFilePath" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp index 17cb753607..0f61ccfc01 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp @@ -1198,9 +1198,9 @@ CAF_PDM_SOURCE_INIT( SummaryPageDownloadEntity, "SummaryPageDownloadEntity" ); //-------------------------------------------------------------------------------------------------- SummaryPageDownloadEntity::SummaryPageDownloadEntity() { - CAF_PDM_InitObject( "SummaryPageDownloadEntity", "", "", "" ); + CAF_PDM_InitObject( "SummaryPageDownloadEntity" ); - CAF_PDM_InitFieldNoDefault( &name, "Name", "", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &requestUrl, "RequestUrl", "", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &responseFilename, "ResponseFilename", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &name, "Name", "" ); + CAF_PDM_InitFieldNoDefault( &requestUrl, "RequestUrl", "" ); + CAF_PDM_InitFieldNoDefault( &responseFilename, "ResponseFilename", "" ); } diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.h b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.h index 6a5dce6ae5..16c841312f 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.h +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.h @@ -86,9 +86,9 @@ class ObjectGroupWithHeaders : public caf::PdmObject public: ObjectGroupWithHeaders() { - CAF_PDM_InitFieldNoDefault( &objects, "PdmObjects", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &objects, "PdmObjects", "" ); - CAF_PDM_InitField( &m_isChecked, "IsChecked", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_isChecked, "IsChecked", true, "Active" ); m_isChecked.uiCapability()->setUiHidden( true ); }; @@ -228,7 +228,7 @@ public slots: int wellSelectionPageId(); -#if !defined(QT_NO_OPENSSL) && !defined(CVF_OSX) +#if !defined( QT_NO_OPENSSL ) && !defined( CVF_OSX ) void sslErrors( QNetworkReply*, const QList& errors ); #endif diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp index 5b4216f528..7ca773b738 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp @@ -174,16 +174,16 @@ RicPasteAsciiDataToSummaryPlotFeatureUi::DecimalSeparator mapDecimalSeparator( c RicPasteAsciiDataToSummaryPlotFeatureUi::RicPasteAsciiDataToSummaryPlotFeatureUi() : m_createNewPlot( false ) { - CAF_PDM_InitObject( "RicPasteAsciiDataToSummaryPlotFeatureUi", "", "", "" ); + CAF_PDM_InitObject( "RicPasteAsciiDataToSummaryPlotFeatureUi" ); - CAF_PDM_InitField( &m_plotTitle, "PlotTitle", QString(), "Plot Title", "", "", "" ); - CAF_PDM_InitField( &m_curvePrefix, "CurvePrefix", QString(), "Curve Prefix", "", "", "" ); + CAF_PDM_InitField( &m_plotTitle, "PlotTitle", QString(), "Plot Title" ); + CAF_PDM_InitField( &m_curvePrefix, "CurvePrefix", QString(), "Curve Prefix" ); - CAF_PDM_InitFieldNoDefault( &m_decimalSeparator, "DecimalSeparator", "Decimal Separator", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_decimalSeparator, "DecimalSeparator", "Decimal Separator" ); - CAF_PDM_InitFieldNoDefault( &m_dateFormat, "DateFormat", "Date Format", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_timeFormat, "TimeFormat", "Time Format", "", "", "" ); - CAF_PDM_InitField( &m_useCustomDateFormat, "UseCustomDateFormat", false, "Use Custom Date Time Format", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_dateFormat, "DateFormat", "Date Format" ); + CAF_PDM_InitFieldNoDefault( &m_timeFormat, "TimeFormat", "Time Format" ); + CAF_PDM_InitField( &m_useCustomDateFormat, "UseCustomDateFormat", false, "Use Custom Date Time Format" ); CAF_PDM_InitField( &m_customDateTimeFormat, "CustomDateTimeFormat", QString(), @@ -207,13 +207,13 @@ RicPasteAsciiDataToSummaryPlotFeatureUi::RicPasteAsciiDataToSummaryPlotFeatureUi "", "", "" ); - CAF_PDM_InitField( &m_curveSymbolSkipDistance, "SymbolSkipDinstance", 0.0f, "Symbol Skip Distance", "", "", "" ); + CAF_PDM_InitField( &m_curveSymbolSkipDistance, "SymbolSkipDinstance", 0.0f, "Symbol Skip Distance" ); - CAF_PDM_InitFieldNoDefault( &m_cellSeparator, "CellSeparator", "Cell Separator", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cellSeparator, "CellSeparator", "Cell Separator" ); - CAF_PDM_InitFieldNoDefault( &m_timeSeriesColumnName, "TimeColumnName", "Selected Time Column", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timeSeriesColumnName, "TimeColumnName", "Selected Time Column" ); - CAF_PDM_InitFieldNoDefault( &m_previewText, "PreviewText", "Preview Text", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_previewText, "PreviewText", "Preview Text" ); m_previewText.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); m_previewText.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_previewText.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp index 5bfa492adf..7b357d924f 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp @@ -34,11 +34,11 @@ CAF_PDM_SOURCE_INIT( RicSelectSummaryPlotUI, "RicSelectSummaryPlotUI" ); //-------------------------------------------------------------------------------------------------- RicSelectSummaryPlotUI::RicSelectSummaryPlotUI() { - CAF_PDM_InitObject( "RicSelectSummaryPlotUI", "", "", "" ); + CAF_PDM_InitObject( "RicSelectSummaryPlotUI" ); - CAF_PDM_InitFieldNoDefault( &m_selectedSummaryPlot, "SelectedSummaryPlot", "Select Plot", "", "", "" ); - CAF_PDM_InitField( &m_createNewPlot, "CreateNewPlot", false, "Create New Plot", "", "", "" ); - CAF_PDM_InitField( &m_newSummaryPlotName, "NewViewName", QString( "Cell Results" ), "New Plot Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedSummaryPlot, "SelectedSummaryPlot", "Select Plot" ); + CAF_PDM_InitField( &m_createNewPlot, "CreateNewPlot", false, "Create New Plot" ); + CAF_PDM_InitField( &m_newSummaryPlotName, "NewViewName", QString( "Cell Results" ), "New Plot Name" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp index ce8267064a..b7d0427003 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp @@ -36,17 +36,17 @@ CAF_PDM_SOURCE_INIT( RicSummaryCurveCalculatorUi, "RicSummaryCurveCalculator" ); //-------------------------------------------------------------------------------------------------- RicSummaryCurveCalculatorUi::RicSummaryCurveCalculatorUi() { - CAF_PDM_InitObject( "RicSummaryCurveCalculator", "", "", "" ); + CAF_PDM_InitObject( "RicSummaryCurveCalculator" ); - CAF_PDM_InitFieldNoDefault( &m_currentCalculation, "CurrentCalculation", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_currentCalculation, "CurrentCalculation", "" ); m_currentCalculation.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); // m_currentCalculation.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); m_currentCalculation.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_newCalculation, "NewCalculation", "New Calculation", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_newCalculation, "NewCalculation", "New Calculation" ); RicSummaryCurveCalculatorUi::assignPushButtonEditor( &m_newCalculation ); - CAF_PDM_InitFieldNoDefault( &m_deleteCalculation, "DeleteCalculation", "Delete Calculation", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_deleteCalculation, "DeleteCalculation", "Delete Calculation" ); RicSummaryCurveCalculatorUi::assignPushButtonEditor( &m_deleteCalculation ); m_calcContextMenuMgr = std::unique_ptr( new RiuCalculationsContextMenuManager() ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index edb01800f5..a570358ab3 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -84,33 +84,33 @@ std::vector toVector( const std::set& set ); //-------------------------------------------------------------------------------------------------- RicSummaryPlotEditorUi::RicSummaryPlotEditorUi() { - CAF_PDM_InitFieldNoDefault( &m_targetPlot, "TargetPlot", "Target Plot", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_targetPlot, "TargetPlot", "Target Plot" ); - CAF_PDM_InitField( &m_useAutoAppearanceAssignment, "UseAutoAppearanceAssignment", true, "Auto", "", "", "" ); - CAF_PDM_InitField( &m_appearanceApplyButton, "AppearanceApplyButton", false, "", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_caseAppearanceType, "CaseAppearanceType", "Case", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_variableAppearanceType, "VariableAppearanceType", "Vector", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellAppearanceType, "WellAppearanceType", "Well", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_groupAppearanceType, "GroupAppearanceType", "Group", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_regionAppearanceType, "RegionAppearanceType", "Region", "", "", "" ); + CAF_PDM_InitField( &m_useAutoAppearanceAssignment, "UseAutoAppearanceAssignment", true, "Auto" ); + CAF_PDM_InitField( &m_appearanceApplyButton, "AppearanceApplyButton", false, "" ); + CAF_PDM_InitFieldNoDefault( &m_caseAppearanceType, "CaseAppearanceType", "Case" ); + CAF_PDM_InitFieldNoDefault( &m_variableAppearanceType, "VariableAppearanceType", "Vector" ); + CAF_PDM_InitFieldNoDefault( &m_wellAppearanceType, "WellAppearanceType", "Well" ); + CAF_PDM_InitFieldNoDefault( &m_groupAppearanceType, "GroupAppearanceType", "Group" ); + CAF_PDM_InitFieldNoDefault( &m_regionAppearanceType, "RegionAppearanceType", "Region" ); m_previewPlot.reset( new RimSummaryPlot() ); - CAF_PDM_InitFieldNoDefault( &m_useAutoPlotTitleProxy, "UseAutoPlotTitle", "Auto Plot Title", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_useAutoPlotTitleProxy, "UseAutoPlotTitle", "Auto Plot Title" ); m_useAutoPlotTitleProxy.registerGetMethod( this, &RicSummaryPlotEditorUi::proxyPlotAutoTitle ); m_useAutoPlotTitleProxy.registerSetMethod( this, &RicSummaryPlotEditorUi::proxyEnablePlotAutoTitle ); - CAF_PDM_InitFieldNoDefault( &m_applyButtonField, "ApplySelection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_applyButtonField, "ApplySelection", "" ); m_applyButtonField = false; m_applyButtonField.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_applyButtonField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_closeButtonField, "Close", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_closeButtonField, "Close", "" ); m_closeButtonField = false; m_closeButtonField.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_closeButtonField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_okButtonField, "OK", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_okButtonField, "OK", "" ); m_okButtonField = false; m_okButtonField.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_okButtonField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); @@ -119,7 +119,7 @@ RicSummaryPlotEditorUi::RicSummaryPlotEditorUi() m_appearanceApplyButton.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_appearanceApplyButton.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LEFT ); - CAF_PDM_InitFieldNoDefault( &m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig" ); m_curveNameConfig = new RimSummaryCurveAutoName(); m_curveNameConfig.uiCapability()->setUiTreeHidden( true ); m_curveNameConfig.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp index bc920a771c..b848117de0 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp +++ b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp @@ -36,7 +36,7 @@ RicLinkVisibleViewsFeatureUi::RicLinkVisibleViewsFeatureUi( void ) { CAF_PDM_InitObject( "Link Visible Views Feature UI", ":/LinkView16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_masterView, "MasterView", "Primary View", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_masterView, "MasterView", "Primary View" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp index 3e216b7d0b..42284e5051 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp @@ -45,12 +45,12 @@ CAF_PDM_SOURCE_INIT( RicCreateMultipleWellPathLateralsUi, "RicCreateMultipleWell //-------------------------------------------------------------------------------------------------- RicCreateMultipleWellPathLateralsUi::RicCreateMultipleWellPathLateralsUi() { - CAF_PDM_InitFieldNoDefault( &m_sourceLateral, "SourceLaterals", "Source Well Path Lateral", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_sourceLateral, "SourceLaterals", "Source Well Path Lateral" ); - CAF_PDM_InitFieldNoDefault( &m_topLevelWellPath, "TopLevelWellPath", "Top Level Well Path", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_topLevelWellPath, "TopLevelWellPath", "Top Level Well Path" ); m_topLevelWellPath.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_locations, "Locations", "Locations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_locations, "Locations", "Locations" ); m_locations = new RimMultipleLocations; } diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.cpp index 1eacb7b706..81db7cc48c 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicImportWellPaths.cpp @@ -48,8 +48,8 @@ class RicImportWellPathsResult : public caf::PdmObject public: RicImportWellPathsResult() { - CAF_PDM_InitObject( "well_path_result", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &wellPathNames, "wellPathNames", "", "", "", "" ); + CAF_PDM_InitObject( "well_path_result" ); + CAF_PDM_InitFieldNoDefault( &wellPathNames, "wellPathNames", "" ); } public: @@ -64,9 +64,9 @@ RICF_SOURCE_INIT( RicImportWellPaths, "RicWellPathsImportFileFeature", "importWe //-------------------------------------------------------------------------------------------------- RicImportWellPaths::RicImportWellPaths() { - CAF_PDM_InitScriptableFieldNoDefault( &m_wellPathFolder, "wellPathFolder", "", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_wellPathFiles, "wellPathFiles", "", "", "", "" ); - CAF_PDM_InitScriptableField( &m_importGrouped, "importGrouped", false, "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_wellPathFolder, "wellPathFolder", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_wellPathFiles, "wellPathFiles", "" ); + CAF_PDM_InitScriptableField( &m_importGrouped, "importGrouped", false, "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.cpp index 165caff678..56237f6399 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.cpp @@ -25,9 +25,9 @@ CAF_PDM_SOURCE_INIT( RicWellPathsUnitSystemSettingsUi, "RicWellPathsUnitSystemSe //-------------------------------------------------------------------------------------------------- RicWellPathsUnitSystemSettingsUi::RicWellPathsUnitSystemSettingsUi() { - CAF_PDM_InitObject( "RimWellPathsUnitSystemSettings", "", "", "" ); + CAF_PDM_InitObject( "RimWellPathsUnitSystemSettings" ); - CAF_PDM_InitFieldNoDefault( &unitSystem, "UnitSystem", "Unit System", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &unitSystem, "UnitSystem", "Unit System" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifReaderSettings.cpp b/ApplicationLibCode/FileInterface/RifReaderSettings.cpp index f105900974..15081d01f2 100644 --- a/ApplicationLibCode/FileInterface/RifReaderSettings.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderSettings.cpp @@ -28,12 +28,12 @@ CAF_PDM_SOURCE_INIT( RifReaderSettings, "RifReaderSettings" ); //-------------------------------------------------------------------------------------------------- RifReaderSettings::RifReaderSettings() { - CAF_PDM_InitObject( "RifReaderSettings", "", "", "" ); + CAF_PDM_InitObject( "RifReaderSettings" ); - CAF_PDM_InitField( &importFaults, "importFaults", true, "Import Faults", "", "", "" ); + CAF_PDM_InitField( &importFaults, "importFaults", true, "Import Faults" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &importFaults ); - CAF_PDM_InitField( &importNNCs, "importSimulationNNCs", true, "Import NNCs", "", "", "" ); + CAF_PDM_InitField( &importNNCs, "importSimulationNNCs", true, "Import NNCs" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &importNNCs ); CAF_PDM_InitField( &includeInactiveCellsInFaultGeometry, @@ -45,7 +45,7 @@ RifReaderSettings::RifReaderSettings() "" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &includeInactiveCellsInFaultGeometry ); - CAF_PDM_InitField( &importAdvancedMswData, "importAdvancedMswData", false, "Import Advanced MSW Data", "", "", "" ); + CAF_PDM_InitField( &importAdvancedMswData, "importAdvancedMswData", false, "Import Advanced MSW Data" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &importAdvancedMswData ); CAF_PDM_InitField( &useResultIndexFile, @@ -61,7 +61,7 @@ RifReaderSettings::RifReaderSettings() caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &useResultIndexFile ); - CAF_PDM_InitField( &skipWellData, "skipWellData", false, "Skip Import of Simulation Well Data", "", "", "" ); + CAF_PDM_InitField( &skipWellData, "skipWellData", false, "Skip Import of Simulation Well Data" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &skipWellData ); CAF_PDM_InitField( &includeFileAbsolutePathPrefix, @@ -73,7 +73,7 @@ RifReaderSettings::RifReaderSettings() "for FAULTS and EQUIL", "" ); - CAF_PDM_InitField( &importSummaryData, "importSummaryData", true, "Import summary data", "", "", "" ); + CAF_PDM_InitField( &importSummaryData, "importSummaryData", true, "Import summary data" ); importSummaryData.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/GeoMech/GeoMechDataModel/RimGeoMechGeometrySelectionItem.cpp b/ApplicationLibCode/GeoMech/GeoMechDataModel/RimGeoMechGeometrySelectionItem.cpp index b7923f287d..e51c9d9a32 100644 --- a/ApplicationLibCode/GeoMech/GeoMechDataModel/RimGeoMechGeometrySelectionItem.cpp +++ b/ApplicationLibCode/GeoMech/GeoMechDataModel/RimGeoMechGeometrySelectionItem.cpp @@ -31,18 +31,18 @@ CAF_PDM_SOURCE_INIT( RimGeoMechGeometrySelectionItem, "GeoMechGeometrySelectionI //-------------------------------------------------------------------------------------------------- RimGeoMechGeometrySelectionItem::RimGeoMechGeometrySelectionItem() { - CAF_PDM_InitObject( "GeoMech Topology Item", "", "", "" ); - - CAF_PDM_InitFieldNoDefault( &m_geoMechCase, "GeoMechCase", "Geo Mech Case", "", "", "" ); - - CAF_PDM_InitFieldNoDefault( &m_gridIndex, "m_gridIndex", "GridIndex", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_cellIndex, "m_cellIndex", "CellIndex", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_elementFace, "m_elementFace", "ElementFace", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_hasIntersectionTriangle, "m_hasIntersectionTriangle", "HasIntersectionTriangle", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_intersectionTriangle_0, "m_intersectionTriangle_0", "IntersectionTriangle_0", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_intersectionTriangle_1, "m_intersectionTriangle_1", "IntersectionTriangle_1", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_intersectionTriangle_2, "m_intersectionTriangle_2", "IntersectionTriangle_2", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_localIntersectionPoint, "m_localIntersectionPoint", "LocalIntersectionPoint", "", "", "" ); + CAF_PDM_InitObject( "GeoMech Topology Item" ); + + CAF_PDM_InitFieldNoDefault( &m_geoMechCase, "GeoMechCase", "Geo Mech Case" ); + + CAF_PDM_InitFieldNoDefault( &m_gridIndex, "m_gridIndex", "GridIndex" ); + CAF_PDM_InitFieldNoDefault( &m_cellIndex, "m_cellIndex", "CellIndex" ); + CAF_PDM_InitFieldNoDefault( &m_elementFace, "m_elementFace", "ElementFace" ); + CAF_PDM_InitFieldNoDefault( &m_hasIntersectionTriangle, "m_hasIntersectionTriangle", "HasIntersectionTriangle" ); + CAF_PDM_InitFieldNoDefault( &m_intersectionTriangle_0, "m_intersectionTriangle_0", "IntersectionTriangle_0" ); + CAF_PDM_InitFieldNoDefault( &m_intersectionTriangle_1, "m_intersectionTriangle_1", "IntersectionTriangle_1" ); + CAF_PDM_InitFieldNoDefault( &m_intersectionTriangle_2, "m_intersectionTriangle_2", "IntersectionTriangle_2" ); + CAF_PDM_InitFieldNoDefault( &m_localIntersectionPoint, "m_localIntersectionPoint", "LocalIntersectionPoint" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index 65048e9f08..437bd584f3 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -95,74 +95,74 @@ RimAnalysisPlot::RimAnalysisPlot() // Variable selection - CAF_PDM_InitFieldNoDefault( &m_selectedVarsUiField, "selectedVarsUiField", "Selected Vectors", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedVarsUiField, "selectedVarsUiField", "Selected Vectors" ); m_selectedVarsUiField.xmlCapability()->disableIO(); m_selectedVarsUiField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_selectedVarsUiField.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_selectVariablesButtonField, "BrowseButton", false, "...", "", "", "" ); + CAF_PDM_InitField( &m_selectVariablesButtonField, "BrowseButton", false, "..." ); caf::PdmUiActionPushButtonEditor::configureEditorForField( &m_selectVariablesButtonField ); - CAF_PDM_InitFieldNoDefault( &m_analysisPlotDataSelection, "AnalysisPlotData", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_analysisPlotDataSelection, "AnalysisPlotData", "" ); m_analysisPlotDataSelection.uiCapability()->setUiTreeChildrenHidden( true ); m_analysisPlotDataSelection.uiCapability()->setUiTreeHidden( true ); // Time Step Selection - CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Available Time Steps", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "Select Time Steps", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Available Time Steps" ); + CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "Select Time Steps" ); m_selectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_selectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); // Options - CAF_PDM_InitFieldNoDefault( &m_referenceCase, "ReferenceCase", "Reference Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_referenceCase, "ReferenceCase", "Reference Case" ); - CAF_PDM_InitField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto", "", "", "" ); + CAF_PDM_InitField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useAutoPlotTitle ); - CAF_PDM_InitField( &m_description, "PlotDescription", QString( "Analysis Plot" ), "Title", "", "", "" ); + CAF_PDM_InitField( &m_description, "PlotDescription", QString( "Analysis Plot" ), "Title" ); m_description.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_barOrientation, "BarOrientation", "Bar Orientation", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_barOrientation, "BarOrientation", "Bar Orientation" ); // Grouping - CAF_PDM_InitFieldNoDefault( &m_majorGroupType, "MajorGroupType", "Major Grouping", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_mediumGroupType, "MediumGroupType", "Medium Grouping", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_minorGroupType, "MinorGroupType", "Minor Grouping", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_majorGroupType, "MajorGroupType", "Major Grouping" ); + CAF_PDM_InitFieldNoDefault( &m_mediumGroupType, "MediumGroupType", "Medium Grouping" ); + CAF_PDM_InitFieldNoDefault( &m_minorGroupType, "MinorGroupType", "Minor Grouping" ); - CAF_PDM_InitFieldNoDefault( &m_valueSortOperation, "ValueSortOperation", "Sort by Value", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_valueSortOperation, "ValueSortOperation", "Sort by Value" ); - CAF_PDM_InitFieldNoDefault( &m_sortGroupForColors, "groupForColors", "Coloring Using", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_sortGroupForColors, "groupForColors", "Coloring Using" ); m_sortGroupForColors = RimAnalysisPlot::CASE; m_showPlotLegends = false; - CAF_PDM_InitField( &m_useTopBarsFilter, "UseTopBarsFilter", false, "Show Only Top", "", "", "" ); + CAF_PDM_InitField( &m_useTopBarsFilter, "UseTopBarsFilter", false, "Show Only Top" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useTopBarsFilter ); - CAF_PDM_InitField( &m_maxBarCount, "MaxBarCount", 20, "Bar Count", "", "", "" ); + CAF_PDM_InitField( &m_maxBarCount, "MaxBarCount", 20, "Bar Count" ); m_maxBarCount.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); // Bar text - CAF_PDM_InitField( &m_useBarText, "UseBarText", true, "Activate Bar Labels", "", "", "" ); + CAF_PDM_InitField( &m_useBarText, "UseBarText", true, "Activate Bar Labels" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useBarText ); - CAF_PDM_InitField( &m_useCaseInBarText, "UseCaseInBarText", true, "Case Name", "", "", "" ); - CAF_PDM_InitField( &m_useEnsembleInBarText, "UseEnsembleInBarText", false, "Ensemble", "", "", "" ); - CAF_PDM_InitField( &m_useSummaryItemInBarText, "UseSummaryItemInBarText", false, "Summary Item", "", "", "" ); - CAF_PDM_InitField( &m_useTimeStepInBarText, "UseTimeStepInBarText", false, "Time Step", "", "", "" ); - CAF_PDM_InitField( &m_useQuantityInBarText, "UseQuantityInBarText", false, "Quantity", "", "", "" ); + CAF_PDM_InitField( &m_useCaseInBarText, "UseCaseInBarText", true, "Case Name" ); + CAF_PDM_InitField( &m_useEnsembleInBarText, "UseEnsembleInBarText", false, "Ensemble" ); + CAF_PDM_InitField( &m_useSummaryItemInBarText, "UseSummaryItemInBarText", false, "Summary Item" ); + CAF_PDM_InitField( &m_useTimeStepInBarText, "UseTimeStepInBarText", false, "Time Step" ); + CAF_PDM_InitField( &m_useQuantityInBarText, "UseQuantityInBarText", false, "Quantity" ); - CAF_PDM_InitFieldNoDefault( &m_barTextFontSize, "BarTextFontSize", "Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_barTextFontSize, "BarTextFontSize", "Font Size" ); - CAF_PDM_InitFieldNoDefault( &m_valueAxisProperties, "ValueAxisProperties", "ValueAxisProperties", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_valueAxisProperties, "ValueAxisProperties", "ValueAxisProperties" ); m_valueAxisProperties.uiCapability()->setUiTreeHidden( true ); m_valueAxisProperties = new RimPlotAxisProperties; m_valueAxisProperties->setNameAndAxis( "Value-Axis", QwtPlot::yLeft ); m_valueAxisProperties->enableRangeSettings( false ); - CAF_PDM_InitFieldNoDefault( &m_plotDataFilterCollection, "PlotDataFilterCollection", "PlotDataFilterCollection", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plotDataFilterCollection, "PlotDataFilterCollection", "PlotDataFilterCollection" ); m_plotDataFilterCollection.uiCapability()->setUiTreeHidden( true ); m_plotDataFilterCollection = new RimPlotDataFilterCollection; diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp index 394fe93dec..582da46df4 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp @@ -34,7 +34,7 @@ RimAnalysisPlotCollection::RimAnalysisPlotCollection() { CAF_PDM_InitObject( "Analysis Plots", ":/AnalysisPlots16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_analysisPlots, "AnalysisPlots", "Analysis Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_analysisPlots, "AnalysisPlots", "Analysis Plots" ); m_analysisPlots.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotDataEntry.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotDataEntry.cpp index 35e75f1e50..eeb94c7c79 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotDataEntry.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotDataEntry.cpp @@ -33,22 +33,22 @@ CAF_PDM_SOURCE_INIT( RimAnalysisPlotDataEntry, "AnalysisPlotDataEntry" ); //-------------------------------------------------------------------------------------------------- RimAnalysisPlotDataEntry::RimAnalysisPlotDataEntry() { - CAF_PDM_InitObject( "Data Entry", "", "", "" ); + CAF_PDM_InitObject( "Data Entry" ); - CAF_PDM_InitFieldNoDefault( &m_summaryCase, "SummaryCase", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryCase, "SummaryCase", "Case" ); m_summaryCase.uiCapability()->setUiTreeChildrenHidden( true ); m_summaryCase.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble" ); m_ensemble.uiCapability()->setUiTreeChildrenHidden( true ); m_ensemble.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault( &m_summaryAddress, "SummaryAddress", "Summary Address", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryAddress, "SummaryAddress", "Summary Address" ); m_summaryAddress.uiCapability()->setUiTreeHidden( true ); m_summaryAddress.uiCapability()->setUiTreeChildrenHidden( true ); m_summaryAddress = new RimSummaryAddress; - CAF_PDM_InitField( &m_isEnsembleCurve, "IsEnsembleCurve", false, "Is Ensemble Curve", "", "", "" ); + CAF_PDM_InitField( &m_isEnsembleCurve, "IsEnsembleCurve", false, "Is Ensemble Curve" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp index 7b7fdedb01..8f3f6568d7 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp @@ -29,9 +29,9 @@ RimPlotDataFilterCollection::RimPlotDataFilterCollection() { CAF_PDM_InitObject( "Plot Data Filters", ":/AnalysisPlotFilter16x16.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "IsActive", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "IsActive" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_filters, "PlotDataFiltersField", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filters, "PlotDataFiltersField", "" ); m_filters.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp index 2b7d382f7b..676021850a 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp @@ -85,37 +85,37 @@ RimPlotDataFilterItem::RimPlotDataFilterItem() { CAF_PDM_InitObject( "Plot Data Filter", ":/AnalysisPlotFilter16x16.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_filterTarget, "FilterTarget", "Use only the", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filterTarget, "FilterTarget", "Use only the" ); - CAF_PDM_InitFieldNoDefault( &m_filterAddress, "FilterAddressField", "Filter Address", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filterAddress, "FilterAddressField", "Filter Address" ); m_filterAddress.uiCapability()->setUiTreeHidden( true ); m_filterAddress.uiCapability()->setUiTreeChildrenHidden( true ); m_filterAddress = new RimSummaryAddress(); - CAF_PDM_InitField( &m_filterEnsembleParameter, "QuantityText", QString( "" ), "where", "", "", "" ); + CAF_PDM_InitField( &m_filterEnsembleParameter, "QuantityText", QString( "" ), "where" ); - CAF_PDM_InitFieldNoDefault( &m_filterQuantityUiField, "SelectedVariableDisplayVar", "where", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filterQuantityUiField, "SelectedVariableDisplayVar", "where" ); m_filterQuantityUiField.xmlCapability()->disableIO(); m_filterQuantityUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_filterQuantitySelectButton, "SelectAddress", false, "...", "", "", "" ); + CAF_PDM_InitField( &m_filterQuantitySelectButton, "SelectAddress", false, "..." ); caf::PdmUiActionPushButtonEditor::configureEditorForField( &m_filterQuantitySelectButton ); - CAF_PDM_InitFieldNoDefault( &m_filterOperation, "FilterOperation", "is", "", "", "" ); - CAF_PDM_InitField( &m_topBottomN, "MinTopN", 20, "N", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filterOperation, "FilterOperation", "is" ); + CAF_PDM_InitField( &m_topBottomN, "MinTopN", 20, "N" ); m_topBottomN.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitField( &m_max, "Max", m_upperLimit, "Max", "", "", "" ); + CAF_PDM_InitField( &m_max, "Max", m_upperLimit, "Max" ); m_max.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_min, "Min", m_lowerLimit, "Min", "", "", "" ); + CAF_PDM_InitField( &m_min, "Min", m_lowerLimit, "Min" ); m_min.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_ensembleParameterValueCategories, "EnsembleParameterValueCategories", "one of", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_consideredTimestepsType, "ConsideredTimestepsType", "at the", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_explicitlySelectedTimeSteps, "ExplicitlySelectedTimeSteps", "TimeSteps", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleParameterValueCategories, "EnsembleParameterValueCategories", "one of" ); + CAF_PDM_InitFieldNoDefault( &m_consideredTimestepsType, "ConsideredTimestepsType", "at the" ); + CAF_PDM_InitFieldNoDefault( &m_explicitlySelectedTimeSteps, "ExplicitlySelectedTimeSteps", "TimeSteps" ); m_explicitlySelectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); m_explicitlySelectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp index c97eb9aaa8..3826f74d31 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp @@ -43,14 +43,11 @@ RimAnnotationCollection::RimAnnotationCollection() { CAF_PDM_InitObject( "Annotations", ":/Annotations16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_reachCircleAnnotations, "ReachCircleAnnotations", "Reach Circle Annotations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_reachCircleAnnotations, "ReachCircleAnnotations", "Reach Circle Annotations" ); CAF_PDM_InitFieldNoDefault( &m_userDefinedPolylineAnnotations, "UserDefinedPolylineAnnotations", - "User Defined Polyline Annotations", - "", - "", - "" ); - CAF_PDM_InitFieldNoDefault( &m_polylineFromFileAnnotations, "PolylineFromFileAnnotations", "Polylines From File", "", "", "" ); + "User Defined Polyline Annotations" ); + CAF_PDM_InitFieldNoDefault( &m_polylineFromFileAnnotations, "PolylineFromFileAnnotations", "Polylines From File" ); m_reachCircleAnnotations.uiCapability()->setUiTreeHidden( true ); m_userDefinedPolylineAnnotations.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp index 141f9c30b8..448be09074 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp @@ -38,10 +38,10 @@ RimAnnotationCollectionBase::RimAnnotationCollectionBase() { CAF_PDM_InitObject( "Annotations", ":/WellCollection.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_textAnnotations, "TextAnnotations", "Text Annotations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_textAnnotations, "TextAnnotations", "Text Annotations" ); m_textAnnotations.uiCapability()->setUiTreeHidden( true ); m_textAnnotations = new RimAnnotationGroupCollection(); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp index 7b261a9d24..85e8786684 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp @@ -46,8 +46,8 @@ RimAnnotationGroupCollection::RimAnnotationGroupCollection() { CAF_PDM_InitObject( "Annotations", ":/WellCollection.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_annotations, "Annotations", "Annotations", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); + CAF_PDM_InitFieldNoDefault( &m_annotations, "Annotations", "Annotations" ); m_isActive.uiCapability()->setUiHidden( true ); m_annotations.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.cpp index 47229d8f1e..4e403a60fc 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.cpp @@ -80,33 +80,24 @@ RimAnnotationInViewCollection::RimAnnotationInViewCollection() { CAF_PDM_InitObject( "Annotations", ":/Annotations16x16.png", "", "" ); - CAF_PDM_InitField( &m_annotationPlaneDepth, "AnnotationPlaneDepth", 0.0, "Annotation Plane Depth", "", "", "" ); - CAF_PDM_InitField( &m_snapAnnotations, "SnapAnnotations", false, "Snap Annotations to Plane", "", "", "" ); + CAF_PDM_InitField( &m_annotationPlaneDepth, "AnnotationPlaneDepth", 0.0, "Annotation Plane Depth" ); + CAF_PDM_InitField( &m_snapAnnotations, "SnapAnnotations", false, "Snap Annotations to Plane" ); m_annotationPlaneDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); m_annotationPlaneDepth.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::TOP ); - CAF_PDM_InitFieldNoDefault( &m_globalTextAnnotations, "TextAnnotationsInView", "Global Text Annotations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_globalTextAnnotations, "TextAnnotationsInView", "Global Text Annotations" ); CAF_PDM_InitFieldNoDefault( &m_globalReachCircleAnnotations, "ReachCircleAnnotationsInView", - "Global Reach Circle Annotations", - "", - "", - "" ); + "Global Reach Circle Annotations" ); CAF_PDM_InitFieldNoDefault( &m_globalUserDefinedPolylineAnnotations, "UserDefinedPolylinesAnnotationsInView", - "Global User Defined Polylines Annotations", - "", - "", - "" ); + "Global User Defined Polylines Annotations" ); CAF_PDM_InitFieldNoDefault( &m_globalPolylineFromFileAnnotations, "PolylinesFromFileAnnotationsInView", - "Global Polylines From File Annotations", - "", - "", - "" ); + "Global Polylines From File Annotations" ); - CAF_PDM_InitFieldNoDefault( &m_annotationFontSize, "AnnotationFontSize", "Default Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_annotationFontSize, "AnnotationFontSize", "Default Font Size" ); m_globalTextAnnotations.uiCapability()->setUiTreeHidden( true ); m_globalReachCircleAnnotations.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationLineAppearance.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationLineAppearance.cpp index 1f3b55dde6..df44ef31cc 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationLineAppearance.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationLineAppearance.cpp @@ -65,12 +65,12 @@ RimAnnotationLineAppearance::RimAnnotationLineAppearance() { CAF_PDM_InitObject( "AnnotationLineAppearance", ":/WellCollection.png", "", "" ); - CAF_PDM_InitField( &m_lineFieldsHidden, "LineFieldsHidden", false, "Line Fields Hidden", "", "", "" ); - CAF_PDM_InitField( &m_color, "Color", cvf::Color3f( cvf::Color3f::BLACK ), "Line Color", "", "", "" ); - CAF_PDM_InitField( &m_thickness, "Thickness", 2, "Line Thickness", "", "", "" ); + CAF_PDM_InitField( &m_lineFieldsHidden, "LineFieldsHidden", false, "Line Fields Hidden" ); + CAF_PDM_InitField( &m_color, "Color", cvf::Color3f( cvf::Color3f::BLACK ), "Line Color" ); + CAF_PDM_InitField( &m_thickness, "Thickness", 2, "Line Thickness" ); // Stippling not yet supported. Needs new stuff in VizFwk - CAF_PDM_InitField( &m_style, "Style", LineStyle(), "Style", "", "", "" ); + CAF_PDM_InitField( &m_style, "Style", LineStyle(), "Style" ); m_style.uiCapability()->setUiHidden( true ); m_style.xmlCapability()->disableIO(); @@ -172,9 +172,9 @@ RimPolylineAppearance::RimPolylineAppearance() { CAF_PDM_InitObject( "PolylineAppearance", ":/WellCollection.png", "", "" ); - CAF_PDM_InitField( &m_sphereFieldsHidden, "SphereFieldsHidden", false, "Sphere Fields Hidden", "", "", "" ); - CAF_PDM_InitField( &m_sphereColor, "SphereColor", cvf::Color3f( cvf::Color3f::BLACK ), "Sphere Color", "", "", "" ); - CAF_PDM_InitField( &m_sphereRadiusFactor, "SphereRadiusFactor", 0.1, "Sphere Radius Factor", "", "", "" ); + CAF_PDM_InitField( &m_sphereFieldsHidden, "SphereFieldsHidden", false, "Sphere Fields Hidden" ); + CAF_PDM_InitField( &m_sphereColor, "SphereColor", cvf::Color3f( cvf::Color3f::BLACK ), "Sphere Color" ); + CAF_PDM_InitField( &m_sphereRadiusFactor, "SphereRadiusFactor", 0.1, "Sphere Radius Factor" ); m_sphereFieldsHidden.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationTextAppearance.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationTextAppearance.cpp index 3e1fa1514c..5f68d5a5f8 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationTextAppearance.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationTextAppearance.cpp @@ -35,11 +35,11 @@ RimAnnotationTextAppearance::RimAnnotationTextAppearance() auto prefs = RiaPreferences::current(); auto defaultBackgroundColor = prefs->defaultViewerBackgroundColor(); - CAF_PDM_InitFieldNoDefault( &m_fontSize, "FontSize", "Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fontSize, "FontSize", "Font Size" ); m_fontSize = prefs->defaultAnnotationFontSize(); - CAF_PDM_InitField( &m_fontColor, "FontColor", cvf::Color3f( cvf::Color3f::BLACK ), "Font Color", "", "", "" ); - CAF_PDM_InitField( &m_backgroundColor, "BackgroundColor", defaultBackgroundColor, "Background Color", "", "", "" ); + CAF_PDM_InitField( &m_fontColor, "FontColor", cvf::Color3f( cvf::Color3f::BLACK ), "Font Color" ); + CAF_PDM_InitField( &m_backgroundColor, "BackgroundColor", defaultBackgroundColor, "Background Color" ); CAF_PDM_InitField( &m_anchorLineColor, "AnchorLineColor", cvf::Color3f( cvf::Color3f::BLACK ), diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.cpp index 435d332b39..113e6b9853 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.cpp @@ -31,8 +31,8 @@ CAF_PDM_SOURCE_INIT( RimPolylineTarget, "PolylineTarget" ); RimPolylineTarget::RimPolylineTarget() : m_isFullUpdateEnabled( true ) { - CAF_PDM_InitField( &m_isEnabled, "IsEnabled", true, "", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_targetPointXyd, "TargetPointXyd", "Point", "", "", "" ); + CAF_PDM_InitField( &m_isEnabled, "IsEnabled", true, "" ); + CAF_PDM_InitFieldNoDefault( &m_targetPointXyd, "TargetPointXyd", "Point" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotation.cpp index 5287b7bcf3..37ef0c6e59 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotation.cpp @@ -37,14 +37,14 @@ RimPolylinesAnnotation::RimPolylinesAnnotation() { CAF_PDM_InitObject( "PolylineAnnotation", ":/WellCollection.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_closePolyline, "ClosePolyline", false, "Close Polyline", "", "", "" ); - CAF_PDM_InitField( &m_showLines, "ShowLines", true, "Show Lines", "", "", "" ); - CAF_PDM_InitField( &m_showSpheres, "ShowSpheres", false, "Show Spheres", "", "", "" ); + CAF_PDM_InitField( &m_closePolyline, "ClosePolyline", false, "Close Polyline" ); + CAF_PDM_InitField( &m_showLines, "ShowLines", true, "Show Lines" ); + CAF_PDM_InitField( &m_showSpheres, "ShowSpheres", false, "Show Spheres" ); - CAF_PDM_InitFieldNoDefault( &m_appearance, "Appearance", "Appearance", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_appearance, "Appearance", "Appearance" ); m_appearance = new RimPolylineAppearance(); m_appearance.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotationInView.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotationInView.cpp index a2dda86312..0a402a10d4 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotationInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotationInView.cpp @@ -33,8 +33,8 @@ RimPolylinesAnnotationInView::RimPolylinesAnnotationInView() { CAF_PDM_InitObject( "PolyLinesAnnotationInView", ":/WellCollection.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_sourceAnnotation, "SourceAnnotation", "Source Annotation", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); + CAF_PDM_InitFieldNoDefault( &m_sourceAnnotation, "SourceAnnotation", "Source Annotation" ); m_isActive.uiCapability()->setUiHidden( true ); m_sourceAnnotation.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp index 9c35c70fa7..93adb202b7 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp @@ -37,8 +37,8 @@ RimPolylinesFromFileAnnotation::RimPolylinesFromFileAnnotation() { CAF_PDM_InitObject( "PolyLines Annotation", ":/PolylinesFromFile16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_polyLinesFileName, "PolyLineFilePath", "File", "", "", "" ); - CAF_PDM_InitField( &m_userDescription, "PolyLineDescription", QString( "" ), "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_polyLinesFileName, "PolyLineFilePath", "File" ); + CAF_PDM_InitField( &m_userDescription, "PolyLineDescription", QString( "" ), "Name" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.cpp index eb648d7191..0858df0128 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.cpp @@ -38,19 +38,19 @@ RimReachCircleAnnotation::RimReachCircleAnnotation() { CAF_PDM_InitObject( "CircleAnnotation", ":/ReachCircle16x16.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_centerPointXyd, "CenterPointXyd", Vec3d::ZERO, "Center Point", "", "", "" ); + CAF_PDM_InitField( &m_centerPointXyd, "CenterPointXyd", Vec3d::ZERO, "Center Point" ); m_centerPointXyd.uiCapability()->setUiEditorTypeName( caf::PdmUiPickableLineEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_centerPointPickEnabled, "AnchorPointPick", false, "", "", "", "" ); + CAF_PDM_InitField( &m_centerPointPickEnabled, "AnchorPointPick", false, "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_centerPointPickEnabled ); m_centerPointPickEnabled.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::HIDDEN ); - CAF_PDM_InitField( &m_radius, "Radius", 100.0, "Radius", "", "", "" ); - CAF_PDM_InitField( &m_name, "Name", QString( "Circle Annotation" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_radius, "Radius", 100.0, "Radius" ); + CAF_PDM_InitField( &m_name, "Name", QString( "Circle Annotation" ), "Name" ); - CAF_PDM_InitFieldNoDefault( &m_appearance, "Appearance", "Appearance", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_appearance, "Appearance", "Appearance" ); m_appearance = new RimReachCircleLineAppearance(); m_appearance.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.cpp index ec8f49c0cd..16c83c6345 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.cpp @@ -30,8 +30,8 @@ RimReachCircleAnnotationInView::RimReachCircleAnnotationInView() { CAF_PDM_InitObject( "ReachCircleAnnotationInView", ":/ReachCircle16x16.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_sourceAnnotation, "SourceAnnotation", "Source Annotation", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); + CAF_PDM_InitFieldNoDefault( &m_sourceAnnotation, "SourceAnnotation", "Source Annotation" ); m_isActive.uiCapability()->setUiHidden( true ); m_sourceAnnotation.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.cpp index 4912c4b77c..e227e25c2d 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.cpp @@ -47,30 +47,30 @@ RimTextAnnotation::RimTextAnnotation() CAF_PDM_InitObject( "TextAnnotation", ":/TextAnnotation16x16.png", "", "" ); this->setUi3dEditorTypeName( RicTextAnnotation3dEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_anchorPointXyd, "AnchorPointXyd", Vec3d::ZERO, "Anchor Point", "", "", "" ); + CAF_PDM_InitField( &m_anchorPointXyd, "AnchorPointXyd", Vec3d::ZERO, "Anchor Point" ); m_anchorPointXyd.uiCapability()->setUiEditorTypeName( caf::PdmUiPickableLineEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_anchorPointPickEnabledButtonField, "AnchorPointPick", false, "", "", "", "" ); + CAF_PDM_InitField( &m_anchorPointPickEnabledButtonField, "AnchorPointPick", false, "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_anchorPointPickEnabledButtonField ); m_anchorPointPickEnabledButtonField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::HIDDEN ); - CAF_PDM_InitField( &m_labelPointXyd, "LabelPointXyd", Vec3d::ZERO, "Label Point", "", "", "" ); + CAF_PDM_InitField( &m_labelPointXyd, "LabelPointXyd", Vec3d::ZERO, "Label Point" ); m_labelPointXyd.uiCapability()->setUiEditorTypeName( caf::PdmUiPickableLineEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_labelPointPickEnabledButtonField, "LabelPointPick", false, "", "", "", "" ); + CAF_PDM_InitField( &m_labelPointPickEnabledButtonField, "LabelPointPick", false, "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_labelPointPickEnabledButtonField ); m_labelPointPickEnabledButtonField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::HIDDEN ); - CAF_PDM_InitField( &m_text, "Text", QString( "(New text)" ), "Text", "", "", "" ); + CAF_PDM_InitField( &m_text, "Text", QString( "(New text)" ), "Text" ); m_text.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_textAppearance, "TextAppearance", "Text Appearance", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_textAppearance, "TextAppearance", "Text Appearance" ); m_textAppearance = new RimAnnotationTextAppearance(); m_textAppearance.uiCapability()->setUiTreeHidden( true ); m_textAppearance.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy" ); m_nameProxy.registerGetMethod( this, &RimTextAnnotation::extractNameFromText ); m_nameProxy.uiCapability()->setUiReadOnly( true ); m_nameProxy.xmlCapability()->disableIO(); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.cpp index 3b8f6a80e8..1a44f5406e 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.cpp @@ -30,8 +30,8 @@ RimTextAnnotationInView::RimTextAnnotationInView() { CAF_PDM_InitObject( "TextAnnotationInView", ":/TextAnnotation16x16.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_sourceAnnotation, "SourceAnnotation", "Source Annotation", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); + CAF_PDM_InitFieldNoDefault( &m_sourceAnnotation, "SourceAnnotation", "Source Annotation" ); m_isActive.uiCapability()->setUiHidden( true ); m_sourceAnnotation.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp index 4b32332d56..c3e2e63e37 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp @@ -46,13 +46,13 @@ RimUserDefinedPolylinesAnnotation::RimUserDefinedPolylinesAnnotation() { CAF_PDM_InitObject( "PolyLines Annotation", ":/PolylinesFromFile16x16.png", "", "" ); - CAF_PDM_InitField( &m_name, "Name", QString( "User Defined Polyline" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_name, "Name", QString( "User Defined Polyline" ), "Name" ); - CAF_PDM_InitField( &m_enablePicking, "EnablePicking", false, "", "", "", "" ); + CAF_PDM_InitField( &m_enablePicking, "EnablePicking", false, "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_enablePicking ); m_enablePicking.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_targets, "Targets", "Targets", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_targets, "Targets", "Targets" ); m_targets.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); // m_targets.uiCapability()->setUiTreeHidden(true); m_targets.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.cpp index d213bd93a7..6233f1fe2b 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.cpp @@ -45,18 +45,18 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimCellFilter, "CellFilter", "CellFilter" ); / RimCellFilter::RimCellFilter() : filterChanged( this ) { - CAF_PDM_InitObject( "Cell Filter", "", "", "" ); + CAF_PDM_InitObject( "Cell Filter" ); - CAF_PDM_InitField( &m_name, "UserDescription", QString( "New filter" ), "Name", "", "", "" ); - CAF_PDM_InitField( &m_isActive, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_name, "UserDescription", QString( "New filter" ), "Name" ); + CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_filterMode, "FilterType", "Filter Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filterMode, "FilterType", "Filter Type" ); - CAF_PDM_InitField( &m_gridIndex, "GridIndex", 0, "Grid", "", "", "" ); - CAF_PDM_InitField( &m_propagateToSubGrids, "PropagateToSubGrids", true, "Apply to Subgrids", "", "", "" ); + CAF_PDM_InitField( &m_gridIndex, "GridIndex", 0, "Grid" ); + CAF_PDM_InitField( &m_propagateToSubGrids, "PropagateToSubGrids", true, "Apply to Subgrids" ); - CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy" ); m_nameProxy.registerGetMethod( this, &RimCellFilter::fullName ); m_nameProxy.uiCapability()->setUiReadOnly( true ); m_nameProxy.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp index bd6f7a7852..de507eec56 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp @@ -41,15 +41,15 @@ RimCellFilterCollection::RimCellFilterCollection() { CAF_PDM_InitScriptableObject( "Cell Filters", ":/CellFilter.png", "", "" ); - CAF_PDM_InitScriptableField( &m_isActive, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitScriptableField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_cellFilters, "CellFilters", "Filters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cellFilters, "CellFilters", "Filters" ); m_cellFilters.uiCapability()->setUiTreeHidden( true ); caf::PdmFieldReorderCapability::addToField( &m_cellFilters ); // for backwards project file compatibility with old CellRangeFilterCollection - CAF_PDM_InitFieldNoDefault( &m_rangeFilters_OBSOLETE, "RangeFilters", "Range Filters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_rangeFilters_OBSOLETE, "RangeFilters", "Range Filters" ); m_rangeFilters_OBSOLETE.uiCapability()->setUiTreeHidden( true ); m_rangeFilters_OBSOLETE.xmlCapability()->setIOWritable( false ); } diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp index daa3bbecb5..5e3fc5bb4e 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp @@ -40,22 +40,22 @@ RimCellRangeFilter::RimCellRangeFilter() { CAF_PDM_InitObject( "Cell Range Filter", ":/CellFilter_Range.png", "", "" ); - CAF_PDM_InitField( &startIndexI, "StartIndexI", 1, "Start Index I", "", "", "" ); + CAF_PDM_InitField( &startIndexI, "StartIndexI", 1, "Start Index I" ); startIndexI.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &cellCountI, "CellCountI", 1, "Cell Count I", "", "", "" ); + CAF_PDM_InitField( &cellCountI, "CellCountI", 1, "Cell Count I" ); cellCountI.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &startIndexJ, "StartIndexJ", 1, "Start Index J", "", "", "" ); + CAF_PDM_InitField( &startIndexJ, "StartIndexJ", 1, "Start Index J" ); startIndexJ.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &cellCountJ, "CellCountJ", 1, "Cell Count J", "", "", "" ); + CAF_PDM_InitField( &cellCountJ, "CellCountJ", 1, "Cell Count J" ); cellCountJ.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &startIndexK, "StartIndexK", 1, "Start Index K", "", "", "" ); + CAF_PDM_InitField( &startIndexK, "StartIndexK", 1, "Start Index K" ); startIndexK.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &cellCountK, "CellCountK", 1, "Cell Count K", "", "", "" ); + CAF_PDM_InitField( &cellCountK, "CellCountK", 1, "Cell Count K" ); cellCountK.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); m_propagateToSubGrids = true; diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp index 6cc4919c72..81c72fe6fe 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp @@ -54,7 +54,7 @@ RimEclipsePropertyFilter::RimEclipsePropertyFilter() { CAF_PDM_InitObject( "Cell Property Filter", ":/CellFilter_Values.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition" ); m_resultDefinition = new RimEclipseResultDefinition(); m_resultDefinition->enableDeltaResults( true ); @@ -63,17 +63,17 @@ RimEclipsePropertyFilter::RimEclipsePropertyFilter() m_resultDefinition.uiCapability()->setUiTreeHidden( true ); m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_rangeLabelText, "Dummy_keyword", QString( "Range Type" ), "Range Type", "", "", "" ); + CAF_PDM_InitField( &m_rangeLabelText, "Dummy_keyword", QString( "Range Type" ), "Range Type" ); m_rangeLabelText.xmlCapability()->disableIO(); m_rangeLabelText.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_lowerBound, "LowerBound", 0.0, "Min", "", "", "" ); + CAF_PDM_InitField( &m_lowerBound, "LowerBound", 0.0, "Min" ); m_lowerBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_upperBound, "UpperBound", 0.0, "Max", "", "", "" ); + CAF_PDM_InitField( &m_upperBound, "UpperBound", 0.0, "Max" ); m_upperBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_useCategorySelection, "CategorySelection", false, "Category Selection", "", "", "" ); + CAF_PDM_InitField( &m_useCategorySelection, "CategorySelection", false, "Category Selection" ); m_upperBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); // HEADLESS HACK diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp index abc71541b2..db2c9f319b 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp @@ -38,7 +38,7 @@ RimEclipsePropertyFilterCollection::RimEclipsePropertyFilterCollection() { CAF_PDM_InitObject( "Property Filters", ":/CellFilter_Values.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &propertyFilters, "PropertyFilters", "Property Filters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &propertyFilters, "PropertyFilters", "Property Filters" ); propertyFilters.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilter.cpp index 1158810d24..579fddc105 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilter.cpp @@ -44,7 +44,7 @@ RimGeoMechPropertyFilter::RimGeoMechPropertyFilter() { CAF_PDM_InitObject( "Property Filter", ":/CellFilter_Values.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &resultDefinition, "ResultDefinition", "Result Definition", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &resultDefinition, "ResultDefinition", "Result Definition" ); resultDefinition = new RimGeoMechResultDefinition(); // Set to hidden to avoid this item to been displayed as a child item @@ -52,10 +52,10 @@ RimGeoMechPropertyFilter::RimGeoMechPropertyFilter() resultDefinition.uiCapability()->setUiTreeHidden( true ); resultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &lowerBound, "LowerBound", 0.0, "Min", "", "", "" ); + CAF_PDM_InitField( &lowerBound, "LowerBound", 0.0, "Min" ); lowerBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &upperBound, "UpperBound", 0.0, "Max", "", "", "" ); + CAF_PDM_InitField( &upperBound, "UpperBound", 0.0, "Max" ); upperBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); updateIconState(); diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp index a1ae588e36..25a0454096 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp @@ -36,7 +36,7 @@ RimGeoMechPropertyFilterCollection::RimGeoMechPropertyFilterCollection() { CAF_PDM_InitObject( "Property Filters", ":/CellFilter_Values.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &propertyFilters, "PropertyFilters", "Property Filters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &propertyFilters, "PropertyFilters", "Property Filters" ); propertyFilters.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp index baf82305aa..ca7b27ce9a 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp @@ -122,39 +122,39 @@ RimPolygonFilter::RimPolygonFilter() { CAF_PDM_InitObject( "Polyline Filter", ":/CellFilter_Polygon.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_polyFilterMode, "PolygonFilterType", "Vertical Filter", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_polyFilterMode, "PolygonFilterType", "Vertical Filter" ); - CAF_PDM_InitFieldNoDefault( &m_polyIncludeType, "PolyIncludeType", "Cells to include", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_polyIncludeType, "PolyIncludeType", "Cells to include" ); - CAF_PDM_InitField( &m_enablePicking, "EnablePicking", false, "", "", "", "" ); + CAF_PDM_InitField( &m_enablePicking, "EnablePicking", false, "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_enablePicking ); m_enablePicking.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_targets, "Targets", "Targets", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_targets, "Targets", "Targets" ); m_targets.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); m_targets.uiCapability()->setUiTreeChildrenHidden( true ); m_targets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_targets.uiCapability()->setCustomContextMenuEnabled( true ); - CAF_PDM_InitFieldNoDefault( &m_srcCase, "Case", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_srcCase, "Case", "Case" ); m_srcCase.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_showLines, "ShowLines", true, "Show Lines", "", "", "" ); - CAF_PDM_InitField( &m_showSpheres, "ShowSpheres", false, "Show Spheres", "", "", "" ); + CAF_PDM_InitField( &m_showLines, "ShowLines", true, "Show Lines" ); + CAF_PDM_InitField( &m_showSpheres, "ShowSpheres", false, "Show Spheres" ); - CAF_PDM_InitField( &m_lineThickness, "LineThickness", 3, "Line Thickness", "", "", "" ); - CAF_PDM_InitField( &m_sphereRadiusFactor, "SphereRadiusFactor", 0.15, "Sphere Radius Factor", "", "", "" ); + CAF_PDM_InitField( &m_lineThickness, "LineThickness", 3, "Line Thickness" ); + CAF_PDM_InitField( &m_sphereRadiusFactor, "SphereRadiusFactor", 0.15, "Sphere Radius Factor" ); - CAF_PDM_InitField( &m_lineColor, "LineColor", cvf::Color3f( cvf::Color3f::WHITE ), "Line Color", "", "", "" ); - CAF_PDM_InitField( &m_sphereColor, "SphereColor", cvf::Color3f( cvf::Color3f::WHITE ), "Sphere Color", "", "", "" ); + CAF_PDM_InitField( &m_lineColor, "LineColor", cvf::Color3f( cvf::Color3f::WHITE ), "Line Color" ); + CAF_PDM_InitField( &m_sphereColor, "SphereColor", cvf::Color3f( cvf::Color3f::WHITE ), "Sphere Color" ); - CAF_PDM_InitField( &m_enableFiltering, "EnableFiltering", false, "Enable Filter", "", "", "" ); + CAF_PDM_InitField( &m_enableFiltering, "EnableFiltering", false, "Enable Filter" ); - CAF_PDM_InitField( &m_enableKFilter, "EnableKFilter", false, "Enable K Range Filter", "", "", "" ); + CAF_PDM_InitField( &m_enableKFilter, "EnableKFilter", false, "Enable K Range Filter" ); CAF_PDM_InitFieldNoDefault( &m_kFilterStr, "KRangeFilter", "K Range Filter", "", "Example: 2,4,10-20,31", "" ); - CAF_PDM_InitField( &m_polygonPlaneDepth, "PolygonPlaneDepth", 0.0, "Polygon Plane Depth", "", "", "" ); - CAF_PDM_InitField( &m_lockPolygonToPlane, "LockPolygon", false, "Lock Polygon to Plane", "", "", "" ); + CAF_PDM_InitField( &m_polygonPlaneDepth, "PolygonPlaneDepth", 0.0, "Polygon Plane Depth" ); + CAF_PDM_InitField( &m_lockPolygonToPlane, "LockPolygon", false, "Lock Polygon to Plane" ); m_polygonPlaneDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); m_polygonPlaneDepth.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::TOP ); diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.cpp index 1e1bcfb088..57301f0d93 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.cpp @@ -27,9 +27,9 @@ CAF_PDM_SOURCE_INIT( RimPropertyFilter, "PropertyFilter" ); //-------------------------------------------------------------------------------------------------- RimPropertyFilter::RimPropertyFilter() { - CAF_PDM_InitObject( "Property Filter", "", "", "" ); + CAF_PDM_InitObject( "Property Filter" ); - CAF_PDM_InitFieldNoDefault( &m_selectedCategoryValues, "SelectedValues", "Values", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedCategoryValues, "SelectedValues", "Values" ); setDeletable( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilterCollection.cpp index f490c86292..4dd78b44c4 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilterCollection.cpp @@ -30,7 +30,7 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPropertyFilterCollection, "RimPropertyFilte //-------------------------------------------------------------------------------------------------- RimPropertyFilterCollection::RimPropertyFilterCollection() { - CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &isActive, "Active", true, "Active" ); isActive.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp index e21fe7ef4c..cc7533fccc 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp @@ -34,14 +34,14 @@ Rim3dWellLogCurveCollection::Rim3dWellLogCurveCollection() { CAF_PDM_InitObject( "3D Track", ":/WellLogCurve16x16.png", "", "" ); - CAF_PDM_InitField( &m_showPlot, "Show3dWellLogCurves", true, "Show 3d Well Log Curves", "", "", "" ); + CAF_PDM_InitField( &m_showPlot, "Show3dWellLogCurves", true, "Show 3d Well Log Curves" ); m_showPlot.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_planeWidthScaling, "PlaneWidthScaling", 1.0f, "Width Scaling", "", "", "" ); + CAF_PDM_InitField( &m_planeWidthScaling, "PlaneWidthScaling", 1.0f, "Width Scaling" ); m_planeWidthScaling.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_showGrid, "Show3dWellLogGrid", true, "Show Grid", "", "", "" ); - CAF_PDM_InitField( &m_showBackground, "Show3dWellLogBackground", false, "Show Background", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_3dWellLogCurves, "ArrayOf3dWellLogCurves", "", "", "", "" ); + CAF_PDM_InitField( &m_showGrid, "Show3dWellLogGrid", true, "Show Grid" ); + CAF_PDM_InitField( &m_showBackground, "Show3dWellLogBackground", false, "Show Background" ); + CAF_PDM_InitFieldNoDefault( &m_3dWellLogCurves, "ArrayOf3dWellLogCurves", "" ); m_3dWellLogCurves.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionTemplateCollection.cpp index 0df5e53e38..340d10d7d7 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionTemplateCollection.cpp @@ -36,17 +36,17 @@ RimCompletionTemplateCollection::RimCompletionTemplateCollection() { CAF_PDM_InitObject( "Completion Templates", ":/CompletionsSymbol16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_fractureTemplates, "FractureTemplates", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fractureTemplates, "FractureTemplates", "" ); m_fractureTemplates = new RimFractureTemplateCollection; m_fractureTemplates->addDefaultEllipseTemplate(); - CAF_PDM_InitFieldNoDefault( &m_stimPlanModelTemplates, "StimPlanModelTemplates", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_stimPlanModelTemplates, "StimPlanModelTemplates", "" ); m_stimPlanModelTemplates = new RimStimPlanModelTemplateCollection; - CAF_PDM_InitFieldNoDefault( &m_valveTemplates, "ValveTemplates", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_valveTemplates, "ValveTemplates", "" ); m_valveTemplates = new RimValveTemplateCollection; - CAF_PDM_InitFieldNoDefault( &m_fractureGroupStatisticsCollection, "FractureGroupStatisticsCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fractureGroupStatisticsCollection, "FractureGroupStatisticsCollection", "" ); m_fractureGroupStatisticsCollection = new RimEnsembleFractureStatisticsCollection; } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp index 9a3fb5073a..e622bf1d92 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp @@ -52,10 +52,10 @@ RimEllipseFractureTemplate::RimEllipseFractureTemplate() { CAF_PDM_InitObject( "Fracture Template", ":/FractureTemplate16x16.png", "", "" ); - CAF_PDM_InitField( &m_halfLength, "HalfLength", 0.0, "Half Length Xf", "", "", "" ); - CAF_PDM_InitField( &m_height, "Height", 0.0, "Height", "", "", "" ); - CAF_PDM_InitField( &m_width, "Width", 0.0, "Width", "", "", "" ); - CAF_PDM_InitField( &m_permeability, "Permeability", 0.0, "Permeability [mD]", "", "", "" ); + CAF_PDM_InitField( &m_halfLength, "HalfLength", 0.0, "Half Length Xf" ); + CAF_PDM_InitField( &m_height, "Height", 0.0, "Height" ); + CAF_PDM_InitField( &m_width, "Width", 0.0, "Width" ); + CAF_PDM_InitField( &m_permeability, "Permeability", 0.0, "Permeability [mD]" ); setDeletable( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp index 4871961b0d..d27f2cf63c 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp @@ -123,9 +123,9 @@ RimEnsembleFractureStatistics::RimEnsembleFractureStatistics() { CAF_PDM_InitObject( "Ensemble Fracture Statistics", ":/FractureTemplate16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_filePaths, "FilePaths", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filePaths, "FilePaths", "" ); - CAF_PDM_InitFieldNoDefault( &m_filePathsTable, "FilePathsTable", "File Paths Table", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filePathsTable, "FilePathsTable", "File Paths Table" ); m_filePathsTable.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); m_filePathsTable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_filePathsTable.uiCapability()->setUiReadOnly( true ); @@ -139,32 +139,32 @@ RimEnsembleFractureStatistics::RimEnsembleFractureStatistics() "", "" ); - CAF_PDM_InitFieldNoDefault( &m_statisticsTable, "StatisticsTable", "Statistics Table", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_statisticsTable, "StatisticsTable", "Statistics Table" ); m_statisticsTable.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); m_statisticsTable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_statisticsTable.uiCapability()->setUiReadOnly( true ); m_statisticsTable.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_meshAlignmentType, "MeshAlignmentType", "Mesh Alignment", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_meshType, "MeshType", "Mesh Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_meshAlignmentType, "MeshAlignmentType", "Mesh Alignment" ); + CAF_PDM_InitFieldNoDefault( &m_meshType, "MeshType", "Mesh Type" ); // Uniform sampling - CAF_PDM_InitField( &m_numSamplesX, "NumberOfSamplesX", 100, "X", "", "", "" ); - CAF_PDM_InitField( &m_numSamplesY, "NumberOfSamplesY", 200, "Y", "", "", "" ); + CAF_PDM_InitField( &m_numSamplesX, "NumberOfSamplesX", 100, "X" ); + CAF_PDM_InitField( &m_numSamplesY, "NumberOfSamplesY", 200, "Y" ); // Adaptive sampling - CAF_PDM_InitFieldNoDefault( &m_adaptiveMeanType, "AdaptiveMeanType", "Mean Type", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_adaptiveNumLayersType, "AdaptiveNumLayersType", "Number of Layers", "", "", "" ); - CAF_PDM_InitField( &m_adaptiveNumLayers, "AdaptiveNumLayers", 30, "Number of Layers Y", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_adaptiveMeanType, "AdaptiveMeanType", "Mean Type" ); + CAF_PDM_InitFieldNoDefault( &m_adaptiveNumLayersType, "AdaptiveNumLayersType", "Number of Layers" ); + CAF_PDM_InitField( &m_adaptiveNumLayers, "AdaptiveNumLayers", 30, "Number of Layers Y" ); std::vector> defaultStatisticsTypes = { caf::AppEnum( RimEnsembleFractureStatistics::StatisticsType::MEAN ) }; - CAF_PDM_InitField( &m_selectedStatisticsType, "SelectedStatisticsType", defaultStatisticsTypes, "Statistics Type", "", "", "" ); + CAF_PDM_InitField( &m_selectedStatisticsType, "SelectedStatisticsType", defaultStatisticsTypes, "Statistics Type" ); m_selectedStatisticsType.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_selectedStatisticsType.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitFieldNoDefault( &m_computeStatistics, "ComputeStatistics", "Compute Templates", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_computeStatistics, "ComputeStatistics", "Compute Templates" ); m_computeStatistics.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); m_computeStatistics.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp index b47cd33a1e..504d27475e 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp @@ -29,7 +29,7 @@ RimEnsembleFractureStatisticsCollection::RimEnsembleFractureStatisticsCollection { CAF_PDM_InitObject( "Ensemble Fracture Statistics", ":/FractureTemplates16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_fractureGroupStatistics, "FractureGroupStatistics", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fractureGroupStatistics, "FractureGroupStatistics", "" ); m_fractureGroupStatistics.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp index 9ba0198e99..e0a2aa37cd 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp @@ -71,18 +71,18 @@ RimFishbones::RimFishbones() { CAF_PDM_InitObject( "FishbonesMultipleSubs", ":/FishBoneGroup16x16.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name" ); m_name.registerGetMethod( this, &RimFishbones::generatedName ); m_name.uiCapability()->setUiReadOnly( true ); m_name.xmlCapability()->setIOWritable( false ); cvf::Color3f defaultColor = RiaColorTables::wellPathComponentColors()[RiaDefines::WellPathComponentType::FISHBONES]; - CAF_PDM_InitField( &fishbonesColor, "Color", defaultColor, "Fishbones Color", "", "", "" ); + CAF_PDM_InitField( &fishbonesColor, "Color", defaultColor, "Fishbones Color" ); - CAF_PDM_InitField( &m_lateralCountPerSub, "LateralCountPerSub", 3, "Laterals Per Sub", "", "", "" ); + CAF_PDM_InitField( &m_lateralCountPerSub, "LateralCountPerSub", 3, "Laterals Per Sub" ); CAF_PDM_InitField( &m_lateralLength, "LateralLength", QString( "11.0" ), @@ -91,10 +91,10 @@ RimFishbones::RimFishbones() "Specify multiple length values if the sub lengths differ", "" ); - CAF_PDM_InitField( &m_lateralExitAngle, "LateralExitAngle", 35.0, "Exit Angle [deg]", "", "", "" ); - CAF_PDM_InitField( &m_lateralBuildAngle, "LateralBuildAngle", 6.0, "Build Angle [deg/m]", "", "", "" ); + CAF_PDM_InitField( &m_lateralExitAngle, "LateralExitAngle", 35.0, "Exit Angle [deg]" ); + CAF_PDM_InitField( &m_lateralBuildAngle, "LateralBuildAngle", 6.0, "Build Angle [deg/m]" ); - CAF_PDM_InitField( &m_lateralTubingDiameter, "LateralTubingDiameter", 8.0, "Tubing Diameter [mm]", "", "", "" ); + CAF_PDM_InitField( &m_lateralTubingDiameter, "LateralTubingDiameter", 8.0, "Tubing Diameter [mm]" ); CAF_PDM_InitField( &m_lateralOpenHoleRoghnessFactor, "LateralOpenHoleRoghnessFactor", @@ -119,12 +119,12 @@ RimFishbones::RimFishbones() "", "" ); - CAF_PDM_InitField( &m_icdCount, "IcdCount", 2, "ICDs per Sub", "", "", "" ); - CAF_PDM_InitField( &m_icdOrificeDiameter, "IcdOrificeDiameter", 7.0, "ICD Orifice Diameter [mm]", "", "", "" ); - CAF_PDM_InitField( &m_icdFlowCoefficient, "IcdFlowCoefficient", 1.5, "ICD Flow Coefficient", "", "", "" ); + CAF_PDM_InitField( &m_icdCount, "IcdCount", 2, "ICDs per Sub" ); + CAF_PDM_InitField( &m_icdOrificeDiameter, "IcdOrificeDiameter", 7.0, "ICD Orifice Diameter [mm]" ); + CAF_PDM_InitField( &m_icdFlowCoefficient, "IcdFlowCoefficient", 1.5, "ICD Flow Coefficient" ); initialiseObsoleteFields(); - CAF_PDM_InitFieldNoDefault( &m_valveLocations, "ValveLocations", "Valve Locations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_valveLocations, "ValveLocations", "Valve Locations" ); m_valveLocations = new RimMultipleValveLocations(); m_valveLocations->findField( "RangeValveCount" )->uiCapability()->setUiName( "Number of Subs" ); m_valveLocations.uiCapability()->setUiTreeHidden( true ); @@ -140,10 +140,7 @@ RimFishbones::RimFishbones() CAF_PDM_InitFieldNoDefault( &m_installationRotationAngles, "InstallationRotationAngles", - "Installation Rotation Angles [deg]", - "", - "", - "" ); + "Installation Rotation Angles [deg]" ); m_installationRotationAngles.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &m_fixedInstallationRotationAngle, "FixedInstallationRotationAngle", @@ -153,7 +150,7 @@ RimFishbones::RimFishbones() "", "" ); - CAF_PDM_InitFieldNoDefault( &m_pipeProperties, "PipeProperties", "Pipe Properties", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_pipeProperties, "PipeProperties", "Pipe Properties" ); m_pipeProperties.uiCapability()->setUiTreeHidden( true ); m_pipeProperties.uiCapability()->setUiTreeChildrenHidden( true ); @@ -767,10 +764,10 @@ void RimFishbones::initialiseObsoleteFields() "" ); m_subsLocationMode_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_rangeStart_OBSOLETE, "RangeStart", std::numeric_limits::infinity(), "Start MD [m]", "", "", "" ); + CAF_PDM_InitField( &m_rangeStart_OBSOLETE, "RangeStart", std::numeric_limits::infinity(), "Start MD [m]" ); m_rangeStart_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_rangeEnd_OBSOLETE, "RangeEnd", std::numeric_limits::infinity(), "End MD [m]", "", "", "" ); + CAF_PDM_InitField( &m_rangeEnd_OBSOLETE, "RangeEnd", std::numeric_limits::infinity(), "End MD [m]" ); m_rangeEnd_OBSOLETE.xmlCapability()->setIOWritable( false ); CAF_PDM_InitField( &m_rangeSubSpacing_OBSOLETE, @@ -782,10 +779,10 @@ void RimFishbones::initialiseObsoleteFields() "" ); m_rangeSubSpacing_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_rangeSubCount_OBSOLETE, "RangeSubCount", -1, "Number of Subs", "", "", "" ); + CAF_PDM_InitField( &m_rangeSubCount_OBSOLETE, "RangeSubCount", -1, "Number of Subs" ); m_rangeSubCount_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_locationOfSubs_OBSOLETE, "LocationOfSubs", "Measured Depths [m]", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_locationOfSubs_OBSOLETE, "LocationOfSubs", "Measured Depths [m]" ); m_locationOfSubs_OBSOLETE.xmlCapability()->setIOWritable( false ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp index c2ded89a79..9a825cd481 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp @@ -45,12 +45,12 @@ RimFishbonesCollection::RimFishbonesCollection() nameField()->uiCapability()->setUiHidden( true ); this->setName( "Fishbones" ); - CAF_PDM_InitFieldNoDefault( &m_fishbones, "FishbonesSubs", "fishbonesSubs", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fishbones, "FishbonesSubs", "fishbonesSubs" ); m_fishbones.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_startMD, "StartMD", HUGE_VAL, "Start MD", "", "", "" ); - CAF_PDM_InitField( &m_mainBoreDiameter, "MainBoreDiameter", 0.216, "Main Bore Diameter", "", "", "" ); - CAF_PDM_InitField( &m_skinFactor, "MainBoreSkinFactor", 0., "Main Bore Skin Factor [0..1]", "", "", "" ); + CAF_PDM_InitField( &m_startMD, "StartMD", HUGE_VAL, "Start MD" ); + CAF_PDM_InitField( &m_mainBoreDiameter, "MainBoreDiameter", 0.216, "Main Bore Diameter" ); + CAF_PDM_InitField( &m_skinFactor, "MainBoreSkinFactor", 0., "Main Bore Skin Factor [0..1]" ); manuallyModifiedStartMD = false; } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesPipeProperties.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesPipeProperties.cpp index cd762a403c..bc9dead59e 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesPipeProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesPipeProperties.cpp @@ -31,10 +31,10 @@ CAF_PDM_SOURCE_INIT( RimFishbonesPipeProperties, "FishbonesPipeProperties" ); //-------------------------------------------------------------------------------------------------- RimFishbonesPipeProperties::RimFishbonesPipeProperties() { - CAF_PDM_InitObject( "FishbonesPipeProperties", "", "", "" ); + CAF_PDM_InitObject( "FishbonesPipeProperties" ); - CAF_PDM_InitField( &m_lateralHoleDiameter, "LateralHoleDiameter", 12.5, "Hole Diameter [mm]", "", "", "" ); - CAF_PDM_InitField( &m_skinFactor, "SkinFactor", 0.0, "Skin Factor [0..1]", "", "", "" ); + CAF_PDM_InitField( &m_lateralHoleDiameter, "LateralHoleDiameter", 12.5, "Hole Diameter [mm]" ); + CAF_PDM_InitField( &m_skinFactor, "SkinFactor", 0.0, "Skin Factor [0..1]" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp index b8e0f83817..f4a0b523cf 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp @@ -95,10 +95,10 @@ void setDefaultFractureColorResult() //-------------------------------------------------------------------------------------------------- RimFracture::RimFracture() { - CAF_PDM_InitObject( "Fracture", "", "", "" ); + CAF_PDM_InitObject( "Fracture" ); - CAF_PDM_InitFieldNoDefault( &m_fractureTemplate, "FractureDef", "Fracture Template", "", "", "" ); - CAF_PDM_InitField( &m_editFractureTemplate, "EditTemplate", false, "Edit", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fractureTemplate, "FractureDef", "Fracture Template" ); + CAF_PDM_InitField( &m_editFractureTemplate, "EditTemplate", false, "Edit" ); m_editFractureTemplate.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); m_editFractureTemplate.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); @@ -112,7 +112,7 @@ RimFracture::RimFracture() m_createEllipseFractureTemplate.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_createEllipseFractureTemplate.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitField( &m_createStimPlanFractureTemplate, "CreateStimPlanTemplate", false, "Create New Template?", "", "", "" ); + CAF_PDM_InitField( &m_createStimPlanFractureTemplate, "CreateStimPlanTemplate", false, "Create New Template?" ); m_createStimPlanFractureTemplate.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_createStimPlanFractureTemplate.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); @@ -124,28 +124,28 @@ RimFracture::RimFracture() "", "" ); - CAF_PDM_InitField( &m_wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Well/Fracture Intersection Depth", "", "", "" ); + CAF_PDM_InitField( &m_wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Well/Fracture Intersection Depth" ); m_wellPathDepthAtFracture.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_anchorPosition, "AnchorPosition", "Anchor Position", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_anchorPosition, "AnchorPosition", "Anchor Position" ); m_anchorPosition.uiCapability()->setUiHidden( true ); m_anchorPosition.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_uiAnchorPosition, "ui_positionAtWellpath", "Fracture Position", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_uiAnchorPosition, "ui_positionAtWellpath", "Fracture Position" ); m_uiAnchorPosition.registerGetMethod( this, &RimFracture::fracturePositionForUi ); m_uiAnchorPosition.uiCapability()->setUiReadOnly( true ); m_uiAnchorPosition.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_azimuth, "Azimuth", 0.0, "Azimuth", "", "", "" ); + CAF_PDM_InitField( &m_azimuth, "Azimuth", 0.0, "Azimuth" ); m_azimuth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_perforationLength, "PerforationLength", 1.0, "Perforation Length", "", "", "" ); - CAF_PDM_InitField( &m_perforationEfficiency, "PerforationEfficiency", 1.0, "Perforation Efficiency", "", "", "" ); + CAF_PDM_InitField( &m_perforationLength, "PerforationLength", 1.0, "Perforation Length" ); + CAF_PDM_InitField( &m_perforationEfficiency, "PerforationEfficiency", 1.0, "Perforation Efficiency" ); m_perforationEfficiency.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_wellDiameter, "WellDiameter", 0.216, "Well Diameter at Fracture", "", "", "" ); - CAF_PDM_InitField( &m_dip, "Dip", 0.0, "Dip", "", "", "" ); - CAF_PDM_InitField( &m_tilt, "Tilt", 0.0, "Tilt", "", "", "" ); + CAF_PDM_InitField( &m_wellDiameter, "WellDiameter", 0.216, "Well Diameter at Fracture" ); + CAF_PDM_InitField( &m_dip, "Dip", 0.0, "Dip" ); + CAF_PDM_InitField( &m_tilt, "Tilt", 0.0, "Tilt" ); CAF_PDM_InitField( &m_fractureUnit, "FractureUnit", @@ -156,19 +156,16 @@ RimFracture::RimFracture() "" ); m_fractureUnit.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_stimPlanTimeIndexToPlot, "TimeIndexToPlot", 0, "StimPlan Time Step", "", "", "" ); + CAF_PDM_InitField( &m_stimPlanTimeIndexToPlot, "TimeIndexToPlot", 0, "StimPlan Time Step" ); - CAF_PDM_InitFieldNoDefault( &m_uiWellPathAzimuth, "WellPathAzimuth", "Well Path Azimuth", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_uiWellPathAzimuth, "WellPathAzimuth", "Well Path Azimuth" ); m_uiWellPathAzimuth.registerGetMethod( this, &RimFracture::wellAzimuthAtFracturePositionText ); m_uiWellPathAzimuth.uiCapability()->setUiReadOnly( true ); m_uiWellPathAzimuth.xmlCapability()->disableIO(); CAF_PDM_InitFieldNoDefault( &m_uiWellFractureAzimuthDiff, "WellFractureAzimuthDiff", - "Azimuth Difference Between\nFracture and Well", - "", - "", - "" ); + "Azimuth Difference Between\nFracture and Well" ); m_uiWellFractureAzimuthDiff.registerGetMethod( this, &RimFracture::wellFractureAzimuthDiffText ); m_uiWellFractureAzimuthDiff.uiCapability()->setUiReadOnly( true ); m_uiWellFractureAzimuthDiff.xmlCapability()->disableIO(); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainment.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainment.cpp index 60b706d065..78ac9829f9 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainment.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainment.cpp @@ -30,9 +30,9 @@ CAF_PDM_SOURCE_INIT( RimFractureContainment, "FractureContainment" ); //-------------------------------------------------------------------------------------------------- RimFractureContainment::RimFractureContainment() { - CAF_PDM_InitObject( "Fracture Containment", "", "", "" ); + CAF_PDM_InitObject( "Fracture Containment" ); - CAF_PDM_InitField( &m_useContainment, "IsUsingFractureContainment", false, "Use Containment", "", "", "" ); + CAF_PDM_InitField( &m_useContainment, "IsUsingFractureContainment", false, "Use Containment" ); CAF_PDM_InitField( &m_topKLayer, "TopKLayer", 0, " Top Layer", "", "Do not allow fracture to grow into this layer", "" ); CAF_PDM_InitField( &m_baseKLayer, "BaseKLayer", 0, " Base Layer", "", "Do not allow fracture to grow into this layer", "" ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.cpp index 4d666c3a91..58f7b45627 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.cpp @@ -30,12 +30,12 @@ CAF_PDM_SOURCE_INIT( RimFractureExportSettings, "RimFractureExportSettings" ); //-------------------------------------------------------------------------------------------------- RimFractureExportSettings::RimFractureExportSettings() { - CAF_PDM_InitObject( "RimFractureExportSettings", "", "", "" ); + CAF_PDM_InitObject( "RimFractureExportSettings" ); - CAF_PDM_InitFieldNoDefault( &fileName, "Filename", "Export Filename", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &fileName, "Filename", "Export Filename" ); fileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &caseToApply, "CaseToApply", "Case to Apply", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &caseToApply, "CaseToApply", "Case to Apply" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp index 2963c303db..600e0e7c33 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp @@ -102,10 +102,6 @@ void caf::AppEnum::setUp() } // namespace caf -// TODO Move to cafPdmObject.h -#define CAF_PDM_InitField_Basic( field, keyword, default, uiName ) \ - CAF_PDM_InitField( field, keyword, default, uiName, "", "", "" ) - CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimFractureTemplate, "FractureTemplate", "RimFractureTemplate" ); //-------------------------------------------------------------------------------------------------- @@ -116,12 +112,12 @@ RimFractureTemplate::RimFractureTemplate() { CAF_PDM_InitScriptableObject( "Fracture Template", ":/FractureTemplate16x16.png", "", "" ); - CAF_PDM_InitField( &m_id, "Id", -1, "ID", "", "", "" ); + CAF_PDM_InitField( &m_id, "Id", -1, "ID" ); m_id.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_name, "UserDescription", QString( "Fracture Template" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_name, "UserDescription", QString( "Fracture Template" ), "Name" ); - CAF_PDM_InitFieldNoDefault( &m_nameAndUnit, "NameAndUnit", "NameAndUnit", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameAndUnit, "NameAndUnit", "NameAndUnit" ); m_nameAndUnit.registerGetMethod( this, &RimFractureTemplate::nameAndUnit ); m_nameAndUnit.uiCapability()->setUiHidden( true ); m_nameAndUnit.xmlCapability()->disableIO(); @@ -143,16 +139,16 @@ RimFractureTemplate::RimFractureTemplate() "", "" ); - CAF_PDM_InitScriptableField( &m_azimuthAngle, "AzimuthAngle", 0.0f, "Azimuth Angle", "", "", "" ); + CAF_PDM_InitScriptableField( &m_azimuthAngle, "AzimuthAngle", 0.0f, "Azimuth Angle" ); - CAF_PDM_InitField( &m_skinFactor, "SkinFactor", 0.0f, "Skin Factor", "", "", "" ); + CAF_PDM_InitField( &m_skinFactor, "SkinFactor", 0.0f, "Skin Factor" ); - CAF_PDM_InitField( &m_perforationLength, "PerforationLength", 1.0, "Perforation Length", "", "", "" ); + CAF_PDM_InitField( &m_perforationLength, "PerforationLength", 1.0, "Perforation Length" ); - CAF_PDM_InitField( &m_perforationEfficiency, "PerforationEfficiency", 1.0, "Perforation Efficiency", "", "", "" ); + CAF_PDM_InitField( &m_perforationEfficiency, "PerforationEfficiency", 1.0, "Perforation Efficiency" ); m_perforationEfficiency.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_wellDiameter, "WellDiameter", 0.216, "Well Diameter at Fracture", "", "", "" ); + CAF_PDM_InitField( &m_wellDiameter, "WellDiameter", 0.216, "Well Diameter at Fracture" ); CAF_PDM_InitField( &m_conductivityType, "ConductivityType", caf::AppEnum( FINITE_CONDUCTIVITY ), @@ -161,30 +157,30 @@ RimFractureTemplate::RimFractureTemplate() "", "" ); - CAF_PDM_InitField( &m_wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Well/Fracture Intersection Depth", "", "", "" ); + CAF_PDM_InitField( &m_wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Well/Fracture Intersection Depth" ); m_wellPathDepthAtFracture.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_fractureContainment, "FractureContainmentField", "Fracture Containment", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fractureContainment, "FractureContainmentField", "Fracture Containment" ); m_fractureContainment = new RimFractureContainment(); m_fractureContainment.uiCapability()->setUiTreeHidden( true ); m_fractureContainment.uiCapability()->setUiTreeChildrenHidden( true ); // Non-Darcy Flow options - CAF_PDM_InitFieldNoDefault( &m_nonDarcyFlowType, "NonDarcyFlowType", "Non-Darcy Flow", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nonDarcyFlowType, "NonDarcyFlowType", "Non-Darcy Flow" ); - CAF_PDM_InitField( &m_userDefinedDFactor, "UserDefinedDFactor", 1.0, "D Factor", "", "", "" ); + CAF_PDM_InitField( &m_userDefinedDFactor, "UserDefinedDFactor", 1.0, "D Factor" ); - CAF_PDM_InitFieldNoDefault( &m_fractureWidthType, "FractureWidthType", "Type", "", "", "" ); - CAF_PDM_InitField_Basic( &m_fractureWidth, "FractureWidth", 0.01, "Fracture Width (h)" ); + CAF_PDM_InitFieldNoDefault( &m_fractureWidthType, "FractureWidthType", "Type" ); + CAF_PDM_InitField( &m_fractureWidth, "FractureWidth", 0.01, "Fracture Width (h)" ); - CAF_PDM_InitFieldNoDefault( &m_betaFactorType, "BetaFactorType", "Type", "", "", "" ); - CAF_PDM_InitField_Basic( &m_inertialCoefficient, - "InertialCoefficient", - 0.006083236, - "Inertial Coefficient (β) [Forch. unit]" ); + CAF_PDM_InitFieldNoDefault( &m_betaFactorType, "BetaFactorType", "Type" ); + CAF_PDM_InitField( &m_inertialCoefficient, + "InertialCoefficient", + 0.006083236, + "Inertial Coefficient (β) [Forch. unit]" ); - CAF_PDM_InitFieldNoDefault( &m_permeabilityType, "PermeabilityType", "Type", "", "", "" ); - CAF_PDM_InitField_Basic( &m_relativePermeability, "RelativePermeability", 1.0, "Relative Permeability" ); + CAF_PDM_InitFieldNoDefault( &m_permeabilityType, "PermeabilityType", "Type" ); + CAF_PDM_InitField( &m_relativePermeability, "RelativePermeability", 1.0, "Relative Permeability" ); CAF_PDM_InitField( &m_userDefinedEffectivePermeability, "EffectivePermeability", 0.0, @@ -208,22 +204,22 @@ RimFractureTemplate::RimFractureTemplate() "Gas viscosity at bottom hole pressure", "" ); - CAF_PDM_InitFieldNoDefault( &m_dFactorDisplayField, "dFactorDisplayField", "D Factor", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_dFactorDisplayField, "dFactorDisplayField", "D Factor" ); m_dFactorDisplayField.registerGetMethod( this, &RimFractureTemplate::dFactorForTemplate ); m_dFactorDisplayField.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); m_dFactorDisplayField.uiCapability()->setUiReadOnly( true ); m_dFactorDisplayField.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_dFactorSummaryText, "dFactorSummaryText", "D Factor Summary", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_dFactorSummaryText, "dFactorSummaryText", "D Factor Summary" ); m_dFactorSummaryText.registerGetMethod( this, &RimFractureTemplate::dFactorSummary ); m_dFactorSummaryText.uiCapability()->setUiReadOnly( true ); m_dFactorSummaryText.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); m_dFactorSummaryText.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LabelPosType::TOP ); m_dFactorSummaryText.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_heightScaleFactor, "HeightScaleFactor", 1.0, "Height", "", "", "" ); - CAF_PDM_InitField( &m_halfLengthScaleFactor, "WidthScaleFactor", 1.0, "Half Length", "", "", "" ); - CAF_PDM_InitField( &m_dFactorScaleFactor, "DFactorScaleFactor", 1.0, "D-factor", "", "", "" ); + CAF_PDM_InitField( &m_heightScaleFactor, "HeightScaleFactor", 1.0, "Height" ); + CAF_PDM_InitField( &m_halfLengthScaleFactor, "WidthScaleFactor", 1.0, "Half Length" ); + CAF_PDM_InitField( &m_dFactorScaleFactor, "DFactorScaleFactor", 1.0, "D-factor" ); CAF_PDM_InitField( &m_conductivityScaleFactor, "ConductivityFactor", 1.0, @@ -231,7 +227,7 @@ RimFractureTemplate::RimFractureTemplate() "", "The conductivity values read from file will be scaled with this parameters", "" ); - CAF_PDM_InitField( &m_scaleApplyButton, "ScaleApplyButton", false, "Apply", "", "", "" ); + CAF_PDM_InitField( &m_scaleApplyButton, "ScaleApplyButton", false, "Apply" ); m_scaleApplyButton.xmlCapability()->disableIO(); m_scaleApplyButton.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp index 1401552e57..c83e603568 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp @@ -62,10 +62,10 @@ RimFractureTemplateCollection::RimFractureTemplateCollection() "", "" ); - CAF_PDM_InitFieldNoDefault( &m_fractureDefinitions, "FractureDefinitions", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fractureDefinitions, "FractureDefinitions", "" ); m_fractureDefinitions.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_nextValidFractureTemplateId, "NextValidFractureTemplateId", 0, "", "", "", "" ); + CAF_PDM_InitField( &m_nextValidFractureTemplateId, "NextValidFractureTemplateId", 0, "" ); m_nextValidFractureTemplateId.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp index ef5a9d53d2..b12bad4991 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp @@ -65,10 +65,10 @@ RimMswCompletionParameters::RimMswCompletionParameters() { CAF_PDM_InitObject( "MSW Completion Parameters", ":/CompletionsSymbol16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_refMDType, "RefMDType", "Reference MD", "", "", "" ); - CAF_PDM_InitField( &m_refMD, "RefMD", 0.0, "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_refMDType, "RefMDType", "Reference MD" ); + CAF_PDM_InitField( &m_refMD, "RefMD", 0.0, "" ); - CAF_PDM_InitField( &m_customValuesForLateral, "CustomValuesForLateral", false, "Custom Values for Lateral", "", "", "" ); + CAF_PDM_InitField( &m_customValuesForLateral, "CustomValuesForLateral", false, "Custom Values for Lateral" ); CAF_PDM_InitField( &m_linerDiameter, "LinerDiameter", std::numeric_limits::infinity(), @@ -84,11 +84,11 @@ RimMswCompletionParameters::RimMswCompletionParameters() "", "" ); - CAF_PDM_InitFieldNoDefault( &m_pressureDrop, "PressureDrop", "Pressure Drop", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_lengthAndDepth, "LengthAndDepth", "Length and Depth", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_pressureDrop, "PressureDrop", "Pressure Drop" ); + CAF_PDM_InitFieldNoDefault( &m_lengthAndDepth, "LengthAndDepth", "Length and Depth" ); - CAF_PDM_InitField( &m_enforceMaxSegmentLength, "EnforceMaxSegmentLength", false, "Enforce Max Segment Length", "", "", "" ); - CAF_PDM_InitField( &m_maxSegmentLength, "MaxSegmentLength", 200.0, "Max Segment Length", "", "", "" ); + CAF_PDM_InitField( &m_enforceMaxSegmentLength, "EnforceMaxSegmentLength", false, "Enforce Max Segment Length" ); + CAF_PDM_InitField( &m_maxSegmentLength, "MaxSegmentLength", 200.0, "Max Segment Length" ); m_maxSegmentLength.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp index db382fd77c..841d1c1522 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp @@ -60,18 +60,18 @@ RimMultipleValveLocations::RimMultipleValveLocations() "", "", "" ); - CAF_PDM_InitField( &m_rangeStart, "RangeStart", 100.0, "Start MD [m]", "", "", "" ); + CAF_PDM_InitField( &m_rangeStart, "RangeStart", 100.0, "Start MD [m]" ); m_rangeStart.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_rangeEnd, "RangeEnd", 250.0, "End MD [m]", "", "", "" ); + CAF_PDM_InitField( &m_rangeEnd, "RangeEnd", 250.0, "End MD [m]" ); m_rangeEnd.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_rangeValveSpacing, "ValveSpacing", "Spacing [m]", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_rangeValveSpacing, "ValveSpacing", "Spacing [m]" ); m_rangeValveSpacing.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_rangeValveCount, "RangeValveCount", 13, "Number of Valves", "", "", "" ); + CAF_PDM_InitField( &m_rangeValveCount, "RangeValveCount", 13, "Number of Valves" ); - CAF_PDM_InitFieldNoDefault( &m_locationOfValves, "LocationOfValves", "Measured Depths [m]", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_locationOfValves, "LocationOfValves", "Measured Depths [m]" ); m_locationOfValves.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp index 08fd1d89db..198eeba911 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp @@ -45,9 +45,9 @@ RimNonDarcyPerforationParameters::RimNonDarcyPerforationParameters() { CAF_PDM_InitObject( "NonDarcyPerforationParameters", ":/CompletionsSymbol16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_nonDarcyFlowType, "NonDarcyFlowType", "Non-Darcy Flow", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nonDarcyFlowType, "NonDarcyFlowType", "Non-Darcy Flow" ); - CAF_PDM_InitField( &m_userDefinedDFactor, "UserDefinedDFactor", 1.0, "D Factor", "", "", "" ); + CAF_PDM_InitField( &m_userDefinedDFactor, "UserDefinedDFactor", 1.0, "D Factor" ); CAF_PDM_InitField( &m_gridPermeabilityScalingFactor, "GridPermeabilityScalingFactor", @@ -57,7 +57,7 @@ RimNonDarcyPerforationParameters::RimNonDarcyPerforationParameters() "", "" ); - CAF_PDM_InitField( &m_wellRadius, "WellRadius", 0.108, "Well Radius (rw) [m]", "", "", "" ); + CAF_PDM_InitField( &m_wellRadius, "WellRadius", 0.108, "Well Radius (rw) [m]" ); CAF_PDM_InitField( &m_relativeGasDensity, "RelativeGasDensity", @@ -90,7 +90,7 @@ RimNonDarcyPerforationParameters::RimNonDarcyPerforationParameters() "", "" ); - CAF_PDM_InitField( &m_porosityScalingFactor, "PorosityScalingFactor", 0.0, "Porosity Scaling Factor (C)", "", "", "" ); + CAF_PDM_InitField( &m_porosityScalingFactor, "PorosityScalingFactor", 0.0, "Porosity Scaling Factor (C)" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp index d7d1b88003..9e9942269b 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp @@ -45,10 +45,10 @@ RimPerforationCollection::RimPerforationCollection() nameField()->uiCapability()->setUiHidden( true ); this->setName( "Perforations" ); - CAF_PDM_InitFieldNoDefault( &m_perforations, "Perforations", "Perforations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_perforations, "Perforations", "Perforations" ); m_perforations.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_nonDarcyParameters, "NonDarcyParameters", "Non-Darcy Parameters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nonDarcyParameters, "NonDarcyParameters", "Non-Darcy Parameters" ); m_nonDarcyParameters = new RimNonDarcyPerforationParameters(); m_nonDarcyParameters.uiCapability()->setUiTreeHidden( true ); m_nonDarcyParameters.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp index e7345dad17..cba31005cd 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp @@ -43,21 +43,21 @@ RimPerforationInterval::RimPerforationInterval() { CAF_PDM_InitObject( "Perforation", ":/PerforationInterval16x16.png", "", "" ); - CAF_PDM_InitField( &m_startMD, "StartMeasuredDepth", 0.0, "Start MD", "", "", "" ); - CAF_PDM_InitField( &m_endMD, "EndMeasuredDepth", 0.0, "End MD", "", "", "" ); - CAF_PDM_InitField( &m_diameter, "Diameter", 0.216, "Diameter", "", "", "" ); - CAF_PDM_InitField( &m_skinFactor, "SkinFactor", 0.0, "Skin Factor", "", "", "" ); + CAF_PDM_InitField( &m_startMD, "StartMeasuredDepth", 0.0, "Start MD" ); + CAF_PDM_InitField( &m_endMD, "EndMeasuredDepth", 0.0, "End MD" ); + CAF_PDM_InitField( &m_diameter, "Diameter", 0.216, "Diameter" ); + CAF_PDM_InitField( &m_skinFactor, "SkinFactor", 0.0, "Skin Factor" ); - CAF_PDM_InitField( &m_startOfHistory_OBSOLETE, "StartOfHistory", true, "All Timesteps", "", "", "" ); + CAF_PDM_InitField( &m_startOfHistory_OBSOLETE, "StartOfHistory", true, "All Timesteps" ); m_startOfHistory_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_useCustomStartDate, "UseCustomStartDate", false, "Custom Start Date", "", "", "" ); - CAF_PDM_InitField( &m_startDate, "StartDate", QDateTime::currentDateTime(), "Start Date", "", "", "" ); + CAF_PDM_InitField( &m_useCustomStartDate, "UseCustomStartDate", false, "Custom Start Date" ); + CAF_PDM_InitField( &m_startDate, "StartDate", QDateTime::currentDateTime(), "Start Date" ); - CAF_PDM_InitField( &m_useCustomEndDate, "UseCustomEndDate", false, "Custom End Date", "", "", "" ); - CAF_PDM_InitField( &m_endDate, "EndDate", QDateTime::currentDateTime(), "End Date", "", "", "" ); + CAF_PDM_InitField( &m_useCustomEndDate, "UseCustomEndDate", false, "Custom End Date" ); + CAF_PDM_InitField( &m_endDate, "EndDate", QDateTime::currentDateTime(), "End Date" ); - CAF_PDM_InitFieldNoDefault( &m_valves, "Valves", "Valves", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_valves, "Valves", "Valves" ); m_valves.uiCapability()->setUiTreeHidden( true ); nameField()->uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp index 23b92f0f4f..2f1e6a41d2 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp @@ -42,15 +42,15 @@ RimSimWellFracture::RimSimWellFracture( void ) { CAF_PDM_InitObject( "SimWellFracture", ":/FractureSymbol16x16.png", "", "" ); - CAF_PDM_InitField( &m_location, "MeasuredDepth", 0.0f, "Pseudo Length Location", "", "", "" ); + CAF_PDM_InitField( &m_location, "MeasuredDepth", 0.0f, "Pseudo Length Location" ); m_location.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_displayIJK, "Cell_IJK", "Cell IJK", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_displayIJK, "Cell_IJK", "Cell IJK" ); m_displayIJK.registerGetMethod( this, &RimSimWellFracture::createOneBasedIJKText ); m_displayIJK.uiCapability()->setUiReadOnly( true ); m_displayIJK.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_branchIndex, "Branch", 0, "Branch", "", "", "" ); + CAF_PDM_InitField( &m_branchIndex, "Branch", 0, "Branch" ); setDeletable( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp index ed3f50dfdb..e4a661da37 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp @@ -30,7 +30,7 @@ RimSimWellFractureCollection::RimSimWellFractureCollection( void ) { CAF_PDM_InitObject( "Fractures", ":/FractureLayout16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &simwellFractures, "Fractures", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &simwellFractures, "Fractures", "" ); simwellFractures.uiCapability()->setUiTreeHidden( true ); setDeletable( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index f2d44d975c..3a4cc43b07 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -74,7 +74,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate() { CAF_PDM_InitScriptableObject( "Fracture Template", ":/FractureTemplate16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_stimPlanFileName, "StimPlanFileName", "File Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_stimPlanFileName, "StimPlanFileName", "File Name" ); m_stimPlanFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); CAF_PDM_InitField( &m_userDefinedWellPathDepthAtFracture, @@ -85,10 +85,10 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate() "", "" ); - CAF_PDM_InitField( &m_borderPolygonResultName, "BorderPolygonResultName", QString( "" ), "Parameter", "", "", "" ); + CAF_PDM_InitField( &m_borderPolygonResultName, "BorderPolygonResultName", QString( "" ), "Parameter" ); m_borderPolygonResultName.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_activeTimeStepIndex, "ActiveTimeStepIndex", 0, "Active TimeStep Index", "", "", "" ); + CAF_PDM_InitField( &m_activeTimeStepIndex, "ActiveTimeStepIndex", 0, "Active TimeStep Index" ); CAF_PDM_InitField( &m_conductivityResultNameOnFile, "ConductivityResultName", QString( "" ), @@ -97,13 +97,13 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate() "", "" ); - CAF_PDM_InitFieldNoDefault( &m_propertiesTable, "PropertiesTable", "Properties Table", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_propertiesTable, "PropertiesTable", "Properties Table" ); m_propertiesTable.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); m_propertiesTable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_propertiesTable.uiCapability()->setUiReadOnly( true ); m_propertiesTable.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_showStimPlanMesh_OBSOLETE, "ShowStimPlanMesh", true, "", "", "", "" ); + CAF_PDM_InitField( &m_showStimPlanMesh_OBSOLETE, "ShowStimPlanMesh", true, "" ); m_showStimPlanMesh_OBSOLETE.uiCapability()->setUiHidden( true ); m_readError = false; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp index 9e57033c1b..97bf58736e 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp @@ -41,16 +41,16 @@ RimValveTemplate::RimValveTemplate() "" ); m_valveTemplateUnit.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_type, "CompletionType", "Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_type, "CompletionType", "Type" ); m_type = RiaDefines::WellPathComponentType::ICD; - CAF_PDM_InitField( &m_userLabel, "UserLabel", QString( "Template" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_userLabel, "UserLabel", QString( "Template" ), "Name" ); this->setName( fullLabel() ); - CAF_PDM_InitField( &m_orificeDiameter, "OrificeDiameter", 8.0, "Orifice Diameter [mm]", "", "", "" ); - CAF_PDM_InitField( &m_flowCoefficient, "FlowCoefficient", 0.7, "Flow Coefficient", "", "", "" ); + CAF_PDM_InitField( &m_orificeDiameter, "OrificeDiameter", 8.0, "Orifice Diameter [mm]" ); + CAF_PDM_InitField( &m_flowCoefficient, "FlowCoefficient", 0.7, "Flow Coefficient" ); - CAF_PDM_InitFieldNoDefault( &m_aicdParameters, "AICDParameters", "AICD Parameters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_aicdParameters, "AICDParameters", "AICD Parameters" ); m_aicdParameters = new RimWellPathAicdParameters; m_aicdParameters.uiCapability()->setUiTreeHidden( true ); m_aicdParameters.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp index 087d3b336b..9241f5f244 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp @@ -29,13 +29,8 @@ CAF_PDM_SOURCE_INIT( RimValveTemplateCollection, "ValveTemplateCollection" ); RimValveTemplateCollection::RimValveTemplateCollection() { CAF_PDM_InitObject( "Valve Templates", ":/ICDValve16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_valveDefinitions, "ValveDefinitions", "", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_defaultUnitsForValveTemplates, - "ValveUnits", - "Default unit system for valve templates", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_valveDefinitions, "ValveDefinitions", "" ); + CAF_PDM_InitFieldNoDefault( &m_defaultUnitsForValveTemplates, "ValveUnits", "Default unit system for valve templates" ); m_defaultUnitsForValveTemplates = RiaDefines::EclipseUnitSystem::UNITS_METRIC; m_valveDefinitions.uiCapability()->setUiTreeHidden( true ); addDefaultValveTemplates(); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp index 2f32516afb..f2a7e5fa36 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp @@ -35,35 +35,23 @@ CAF_PDM_SOURCE_INIT( RimWellPathAicdParameters, "WellPathAicdParameters" ); //-------------------------------------------------------------------------------------------------- RimWellPathAicdParameters::RimWellPathAicdParameters() { - CAF_PDM_InitObject( "RimWellPathAicdParameters", "", "", "" ); + CAF_PDM_InitObject( "RimWellPathAicdParameters" ); - CAF_PDM_InitField( &m_deviceOpen, "DeviceOpen", true, "Device Open?", "", "", "" ); + CAF_PDM_InitField( &m_deviceOpen, "DeviceOpen", true, "Device Open?" ); - CAF_PDM_InitFieldNoDefault( &m_aicdParameterFields[AICD_STRENGTH], "StrengthAICD", "Strength of AICD", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_aicdParameterFields[AICD_STRENGTH], "StrengthAICD", "Strength of AICD" ); CAF_PDM_InitFieldNoDefault( &m_aicdParameterFields[AICD_DENSITY_CALIB_FLUID], "DensityCalibrationFluid", - "Calibration Fluid Density (kg/m^3)", - "", - "", - "" ); + "Calibration Fluid Density (kg/m^3)" ); CAF_PDM_InitFieldNoDefault( &m_aicdParameterFields[AICD_VISCOSITY_CALIB_FLUID], "ViscosityCalibrationFluid", - "Calibration Fluid Viscosity (cP)", - "", - "", - "" ); + "Calibration Fluid Viscosity (cP)" ); CAF_PDM_InitFieldNoDefault( &m_aicdParameterFields[AICD_VOL_FLOW_EXP], "VolumeFlowRateExponent", - "Volume Flow Rate Exponent", - "", - "", - "" ); + "Volume Flow Rate Exponent" ); CAF_PDM_InitFieldNoDefault( &m_aicdParameterFields[AICD_VISOSITY_FUNC_EXP], "ViscosityFunctionExponent", - "Viscosity Function Exponent", - "", - "", - "" ); + "Viscosity Function Exponent" ); CAF_PDM_InitField( &m_aicdParameterFields[AICD_CRITICAL_WATER_IN_LIQUID_FRAC], "CriticalWaterLiquidFractionEmul", diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp index 0a3ea14c80..81b1f61783 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp @@ -78,21 +78,21 @@ CAF_PDM_SOURCE_INIT( RimWellPathCompletionSettings, "WellPathCompletionSettings" RimWellPathCompletionSettings::RimWellPathCompletionSettings() { CAF_PDM_InitObject( "Completion Settings", ":/CompletionsSymbol16x16.png", "", "" ); - CAF_PDM_InitField( &m_wellNameForExport, "WellNameForExport", QString(), "Well Name", "", "", "" ); + CAF_PDM_InitField( &m_wellNameForExport, "WellNameForExport", QString(), "Well Name" ); m_wellNameForExport.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_wellGroupName, "WellGroupNameForExport", QString(), "Well Group Name", "", "", "" ); - CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_preferredFluidPhase, "WellTypeForExport", "Preferred Fluid Phase", "", "", "" ); - CAF_PDM_InitField( &m_drainageRadiusForPI, "DrainageRadiusForPI", QString( "0.0" ), "Drainage Radius for PI", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation, "GasInflowEq", "Gas Inflow Equation", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_automaticWellShutIn, "AutoWellShutIn", "Automatic well shut-in", "", "", "" ); - CAF_PDM_InitField( &m_allowWellCrossFlow, "AllowWellCrossFlow", true, "Allow Well Cross-Flow", "", "", "" ); - CAF_PDM_InitField( &m_wellBoreFluidPVTTable, "WellBoreFluidPVTTable", 0, "Wellbore Fluid PVT table", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_hydrostaticDensity, "HydrostaticDensity", "Hydrostatic Density", "", "", "" ); - CAF_PDM_InitField( &m_fluidInPlaceRegion, "FluidInPlaceRegion", 0, "Fluid In-Place Region", "", "", "" ); - - CAF_PDM_InitFieldNoDefault( &m_mswParameters, "MswParameters", "Multi Segment Well Parameters", "", "", "" ); + CAF_PDM_InitField( &m_wellGroupName, "WellGroupNameForExport", QString(), "Well Group Name" ); + CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP" ); + CAF_PDM_InitFieldNoDefault( &m_preferredFluidPhase, "WellTypeForExport", "Preferred Fluid Phase" ); + CAF_PDM_InitField( &m_drainageRadiusForPI, "DrainageRadiusForPI", QString( "0.0" ), "Drainage Radius for PI" ); + CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation, "GasInflowEq", "Gas Inflow Equation" ); + CAF_PDM_InitFieldNoDefault( &m_automaticWellShutIn, "AutoWellShutIn", "Automatic well shut-in" ); + CAF_PDM_InitField( &m_allowWellCrossFlow, "AllowWellCrossFlow", true, "Allow Well Cross-Flow" ); + CAF_PDM_InitField( &m_wellBoreFluidPVTTable, "WellBoreFluidPVTTable", 0, "Wellbore Fluid PVT table" ); + CAF_PDM_InitFieldNoDefault( &m_hydrostaticDensity, "HydrostaticDensity", "Hydrostatic Density" ); + CAF_PDM_InitField( &m_fluidInPlaceRegion, "FluidInPlaceRegion", 0, "Fluid In-Place Region" ); + + CAF_PDM_InitFieldNoDefault( &m_mswParameters, "MswParameters", "Multi Segment Well Parameters" ); m_mswParameters = new RimMswCompletionParameters; m_mswParameters.uiCapability()->setUiTreeHidden( true ); m_mswParameters.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp index 7cd6bada20..e7769aaca6 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp @@ -51,29 +51,29 @@ RimWellPathCompletions::RimWellPathCompletions() { CAF_PDM_InitObject( "Completions", ":/CompletionsSymbol16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_perforationCollection, "Perforations", "Perforations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_perforationCollection, "Perforations", "Perforations" ); m_perforationCollection = new RimPerforationCollection; m_perforationCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_fishbonesCollection, "Fishbones", "Fishbones", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fishbonesCollection, "Fishbones", "Fishbones" ); m_fishbonesCollection = new RimFishbonesCollection; m_fishbonesCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_fractureCollection, "Fractures", "Fractures", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fractureCollection, "Fractures", "Fractures" ); m_fractureCollection = new RimWellPathFractureCollection; m_fractureCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_stimPlanModelCollection, "StimPlanModels", "StimPlan Models", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_stimPlanModelCollection, "StimPlanModels", "StimPlan Models" ); m_stimPlanModelCollection = new RimStimPlanModelCollection; m_stimPlanModelCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_wellNameForExport_OBSOLETE, "WellNameForExport", QString(), "Well Name", "", "", "" ); + CAF_PDM_InitField( &m_wellNameForExport_OBSOLETE, "WellNameForExport", QString(), "Well Name" ); m_wellNameForExport_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_wellGroupName_OBSOLETE, "WellGroupNameForExport", QString(), "Well Group Name", "", "", "" ); + CAF_PDM_InitField( &m_wellGroupName_OBSOLETE, "WellGroupNameForExport", QString(), "Well Group Name" ); m_wellGroupName_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_referenceDepth_OBSOLETE, "ReferenceDepthForExport", QString(), "Reference Depth for BHP", "", "", "" ); + CAF_PDM_InitField( &m_referenceDepth_OBSOLETE, "ReferenceDepthForExport", QString(), "Reference Depth for BHP" ); m_referenceDepth_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_preferredFluidPhase_OBSOLETE, "WellTypeForExport", "Preferred Fluid Phase", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_preferredFluidPhase_OBSOLETE, "WellTypeForExport", "Preferred Fluid Phase" ); m_preferredFluidPhase_OBSOLETE.xmlCapability()->setIOWritable( false ); CAF_PDM_InitField( &m_drainageRadiusForPI_OBSOLETE, "DrainageRadiusForPI", @@ -83,17 +83,17 @@ RimWellPathCompletions::RimWellPathCompletions() "", "" ); m_drainageRadiusForPI_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation_OBSOLETE, "GasInflowEq", "Gas Inflow Equation", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation_OBSOLETE, "GasInflowEq", "Gas Inflow Equation" ); m_gasInflowEquation_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_automaticWellShutIn_OBSOLETE, "AutoWellShutIn", "Automatic well shut-in", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_automaticWellShutIn_OBSOLETE, "AutoWellShutIn", "Automatic well shut-in" ); m_automaticWellShutIn_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_allowWellCrossFlow_OBSOLETE, "AllowWellCrossFlow", true, "Allow Well Cross-Flow", "", "", "" ); + CAF_PDM_InitField( &m_allowWellCrossFlow_OBSOLETE, "AllowWellCrossFlow", true, "Allow Well Cross-Flow" ); m_allowWellCrossFlow_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_wellBoreFluidPVTTable_OBSOLETE, "WellBoreFluidPVTTable", 0, "Wellbore Fluid PVT table", "", "", "" ); + CAF_PDM_InitField( &m_wellBoreFluidPVTTable_OBSOLETE, "WellBoreFluidPVTTable", 0, "Wellbore Fluid PVT table" ); m_wellBoreFluidPVTTable_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_hydrostaticDensity_OBSOLETE, "HydrostaticDensity", "Hydrostatic Density", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_hydrostaticDensity_OBSOLETE, "HydrostaticDensity", "Hydrostatic Density" ); m_hydrostaticDensity_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_fluidInPlaceRegion_OBSOLETE, "FluidInPlaceRegion", 0, "Fluid In-Place Region", "", "", "" ); + CAF_PDM_InitField( &m_fluidInPlaceRegion_OBSOLETE, "FluidInPlaceRegion", 0, "Fluid In-Place Region" ); m_fluidInPlaceRegion_OBSOLETE.xmlCapability()->setIOWritable( false ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp index 8fe6f71d90..1ef4d8cf8f 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp @@ -37,7 +37,7 @@ RimWellPathFracture::RimWellPathFracture( void ) { CAF_PDM_InitObject( "Fracture", ":/FractureSymbol16x16.png", "", "" ); - CAF_PDM_InitField( &m_measuredDepth, "MeasuredDepth", 0.0f, "Measured Depth Location", "", "", "" ); + CAF_PDM_InitField( &m_measuredDepth, "MeasuredDepth", 0.0f, "Measured Depth Location" ); m_measuredDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); setDeletable( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp index e1cd281aea..00282f1ec2 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp @@ -32,7 +32,7 @@ RimWellPathFractureCollection::RimWellPathFractureCollection( void ) { CAF_PDM_InitObject( "Fractures", ":/FractureLayout16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_fractures, "Fractures", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fractures, "Fractures", "" ); m_fractures.uiCapability()->setUiTreeHidden( true ); setName( "Fractures" ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp index 4ec0e90752..f934ab32cd 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp @@ -46,11 +46,11 @@ RimWellPathValve::RimWellPathValve() { CAF_PDM_InitObject( "WellPathValve", ":/ICDValve16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_valveTemplate, "ValveTemplate", "Valve Template", "", "", "" ); - CAF_PDM_InitField( &m_measuredDepth, "StartMeasuredDepth", 0.0, "Start MD", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_multipleValveLocations, "ValveLocations", "Valve Locations", "", "", "" ); - CAF_PDM_InitField( &m_editValveTemplate, "EditTemplate", false, "Edit", "", "", "" ); - CAF_PDM_InitField( &m_createValveTemplate, "CreateTemplate", false, "Create", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_valveTemplate, "ValveTemplate", "Valve Template" ); + CAF_PDM_InitField( &m_measuredDepth, "StartMeasuredDepth", 0.0, "Start MD" ); + CAF_PDM_InitFieldNoDefault( &m_multipleValveLocations, "ValveLocations", "Valve Locations" ); + CAF_PDM_InitField( &m_editValveTemplate, "EditTemplate", false, "Edit" ); + CAF_PDM_InitField( &m_createValveTemplate, "CreateTemplate", false, "Create" ); m_measuredDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); m_multipleValveLocations = new RimMultipleValveLocations; diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp index fa23d13bbd..27c565d1cc 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp @@ -53,40 +53,40 @@ RimAbstractCorrelationPlot::RimAbstractCorrelationPlot() CAF_PDM_InitObject( "Abstract Correlation Plot", ":/CorrelationPlot16x16.png", "", "" ); this->setDeletable( true ); - CAF_PDM_InitFieldNoDefault( &m_selectedVarsUiField, "SelectedVariableDisplayVar", "Vector", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedVarsUiField, "SelectedVariableDisplayVar", "Vector" ); m_selectedVarsUiField.xmlCapability()->disableIO(); m_selectedVarsUiField.uiCapability()->setUiReadOnly( true ); m_selectedVarsUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_dataSources, "AnalysisPlotData", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_dataSources, "AnalysisPlotData", "" ); m_dataSources.uiCapability()->setUiTreeChildrenHidden( true ); m_dataSources.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_pushButtonSelectSummaryAddress, "SelectAddress", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_pushButtonSelectSummaryAddress, "SelectAddress", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_pushButtonSelectSummaryAddress ); m_pushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_pushButtonSelectSummaryAddress = false; - CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Available Time Steps", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Available Time Steps" ); - CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStep", "Time Step", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStep", "Time Step" ); m_timeStep.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_useAutoPlotTitle, "AutoTitle", true, "Automatic Plot Title", "", "", "" ); - CAF_PDM_InitField( &m_description, "PlotTitle", QString( "Correlation Plot" ), "Custom Plot Title", "", "", "" ); + CAF_PDM_InitField( &m_useAutoPlotTitle, "AutoTitle", true, "Automatic Plot Title" ); + CAF_PDM_InitField( &m_description, "PlotTitle", QString( "Correlation Plot" ), "Custom Plot Title" ); - CAF_PDM_InitFieldNoDefault( &m_labelFontSize, "LabelFontSize", "Label Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_labelFontSize, "LabelFontSize", "Label Font Size" ); m_labelFontSize = caf::FontTools::RelativeSize::XSmall; - CAF_PDM_InitFieldNoDefault( &m_axisTitleFontSize, "AxisTitleFontSize", "Axis Title Font Size", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_axisValueFontSize, "AxisValueFontSize", "Axis Value Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_axisTitleFontSize, "AxisTitleFontSize", "Axis Title Font Size" ); + CAF_PDM_InitFieldNoDefault( &m_axisValueFontSize, "AxisValueFontSize", "Axis Value Font Size" ); m_axisValueFontSize = caf::FontTools::RelativeSize::XSmall; m_legendFontSize = caf::FontTools::RelativeSize::XSmall; - CAF_PDM_InitField( &m_useCaseFilter, "UseCaseFilter", false, "Use Ensemble Filter", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_curveSetForFiltering, "CurveSetForFiltering", " Ensemble Filter", "", "", "" ); - CAF_PDM_InitField( &m_editCaseFilter, "EditCaseFilter", false, "Edit", "", "", "" ); + CAF_PDM_InitField( &m_useCaseFilter, "UseCaseFilter", false, "Use Ensemble Filter" ); + CAF_PDM_InitFieldNoDefault( &m_curveSetForFiltering, "CurveSetForFiltering", " Ensemble Filter" ); + CAF_PDM_InitField( &m_editCaseFilter, "EditCaseFilter", false, "Edit" ); m_editCaseFilter.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); m_editCaseFilter.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); } diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index c18f39d799..3854b390b2 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -155,9 +155,9 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot() { CAF_PDM_InitObject( "Correlation Plot", ":/CorrelationMatrixPlot16x16.png", "", "" ); - CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_sortByValues, "CorrelationSorting", "Sort Matrix by Values", "", "", "" ); - CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values", "", "", "" ); + CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values" ); + CAF_PDM_InitFieldNoDefault( &m_sortByValues, "CorrelationSorting", "Sort Matrix by Values" ); + CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values" ); CAF_PDM_InitField( &m_excludeParametersWithoutVariation, "ExcludeParamsWithoutVariation", true, @@ -165,10 +165,10 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot() "", "", "" ); - CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", true, "Show Only Top Correlations", "", "", "" ); - CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 20, "Number rows/columns", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_selectedParametersList, "SelectedParameters", "Select Parameters", "", "", "" ); + CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", true, "Show Only Top Correlations" ); + CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 20, "Number rows/columns" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedParametersList, "SelectedParameters", "Select Parameters" ); m_selectedParametersList.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_selectedParametersList.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp index 00cb8e2063..1bd83921e4 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp @@ -57,8 +57,8 @@ RimCorrelationPlot::RimCorrelationPlot() { CAF_PDM_InitObject( "Correlation Tornado Plot", ":/CorrelationTornadoPlot16x16.png", "", "" ); - CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values", "", "", "" ); - CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values", "", "", "" ); + CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values" ); + CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values" ); CAF_PDM_InitField( &m_excludeParametersWithoutVariation, "ExcludeParamsWithoutVariation", true, @@ -66,10 +66,10 @@ RimCorrelationPlot::RimCorrelationPlot() "", "", "" ); - CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", true, "Show Only Top Correlations", "", "", "" ); - CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 20, "Number rows/columns", "", "", "" ); + CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", true, "Show Only Top Correlations" ); + CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 20, "Number rows/columns" ); - CAF_PDM_InitFieldNoDefault( &m_selectedParametersList, "SelectedParameters", "Select Parameters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedParametersList, "SelectedParameters", "Select Parameters" ); m_selectedParametersList.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_selectedParametersList.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp index d2397fa512..aed8b5d18c 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp @@ -36,8 +36,8 @@ RimCorrelationPlotCollection::RimCorrelationPlotCollection() { CAF_PDM_InitObject( "Ensemble Correlation Plots", ":/CorrelationPlots16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_correlationPlots, "CorrelationPlots", "Correlation Plots", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_correlationReports, "CorrelationReports", "Correlation Reports", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_correlationPlots, "CorrelationPlots", "Correlation Plots" ); + CAF_PDM_InitFieldNoDefault( &m_correlationReports, "CorrelationReports", "Correlation Reports" ); m_correlationPlots.uiCapability()->setUiTreeHidden( true ); m_correlationReports.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp index a8fde71a64..eda2bdaaf1 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp @@ -54,18 +54,18 @@ RimCorrelationReportPlot::RimCorrelationReportPlot() CAF_PDM_InitObject( "Correlation Report Plot", ":/CorrelationReportPlot16x16.png", "", "" ); this->setDeletable( true ); - CAF_PDM_InitFieldNoDefault( &m_plotWindowTitle, "PlotWindowTitle", "Title", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plotWindowTitle, "PlotWindowTitle", "Title" ); m_plotWindowTitle.registerGetMethod( this, &RimCorrelationReportPlot::createPlotWindowTitle ); - CAF_PDM_InitFieldNoDefault( &m_correlationMatrixPlot, "MatrixPlot", "Matrix Plot", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_correlationPlot, "CorrelationPlot", "Correlation Plot", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_parameterResultCrossPlot, "CrossPlot", "Cross Plot", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_correlationMatrixPlot, "MatrixPlot", "Matrix Plot" ); + CAF_PDM_InitFieldNoDefault( &m_correlationPlot, "CorrelationPlot", "Correlation Plot" ); + CAF_PDM_InitFieldNoDefault( &m_parameterResultCrossPlot, "CrossPlot", "Cross Plot" ); - CAF_PDM_InitFieldNoDefault( &m_subTitleFontSize, "SubTitleFontSize", "Sub Plot Title Font Size", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_labelFontSize, "LabelFontSize", "Label Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_subTitleFontSize, "SubTitleFontSize", "Sub Plot Title Font Size" ); + CAF_PDM_InitFieldNoDefault( &m_labelFontSize, "LabelFontSize", "Label Font Size" ); - CAF_PDM_InitFieldNoDefault( &m_axisTitleFontSize, "AxisTitleFontSize", "Axis Title Font Size", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_axisValueFontSize, "AxisValueFontSize", "Axis Value Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_axisTitleFontSize, "AxisTitleFontSize", "Axis Title Font Size" ); + CAF_PDM_InitFieldNoDefault( &m_axisValueFontSize, "AxisValueFontSize", "Axis Value Font Size" ); setAsPlotMdiWindow(); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp index 84d8dd3ef3..fe5fa1c3e7 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp @@ -68,7 +68,7 @@ RimParameterResultCrossPlot::RimParameterResultCrossPlot() { CAF_PDM_InitObject( "ParameterResultCross Plot", ":/CorrelationCrossPlot16x16.png", "", "" ); - CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter", "", "", "" ); + CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter" ); m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); m_selectMultipleVectors = true; diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInView.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInView.cpp index d94eea6e7a..0f35749077 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInView.cpp @@ -33,14 +33,14 @@ RimFaultInView::RimFaultInView() { CAF_PDM_InitObject( "RimFault", ":/draw_style_faults_24x24.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &name, "FaultName", "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &name, "FaultName", "Name" ); name.uiCapability()->setUiHidden( true ); name.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &showFault, "ShowFault", true, "Show Fault", "", "", "" ); + CAF_PDM_InitField( &showFault, "ShowFault", true, "Show Fault" ); showFault.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &faultColor, "Color", cvf::Color3f( 0.588f, 0.588f, 0.804f ), "Fault Color", "", "", "" ); + CAF_PDM_InitField( &faultColor, "Color", cvf::Color3f( 0.588f, 0.588f, 0.804f ), "Fault Color" ); m_rigFault = nullptr; } diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp index ea0d1cf13c..dafee52400 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp @@ -62,12 +62,12 @@ RimFaultInViewCollection::RimFaultInViewCollection() { CAF_PDM_InitObject( "Faults", ":/draw_style_faults_24x24.png", "", "" ); - CAF_PDM_InitField( &showFaultCollection, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &showFaultCollection, "Active", true, "Active" ); showFaultCollection.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &showFaultFaces, "ShowFaultFaces", true, "Show Defined faces", "", "", "" ); - CAF_PDM_InitField( &showOppositeFaultFaces, "ShowOppositeFaultFaces", true, "Show Opposite Faces", "", "", "" ); - CAF_PDM_InitField( &m_showFaultsOutsideFilters, "ShowFaultsOutsideFilters", true, "Show Faults Outside Filters", "", "", "" ); + CAF_PDM_InitField( &showFaultFaces, "ShowFaultFaces", true, "Show Defined faces" ); + CAF_PDM_InitField( &showOppositeFaultFaces, "ShowOppositeFaultFaces", true, "Show Opposite Faces" ); + CAF_PDM_InitField( &m_showFaultsOutsideFilters, "ShowFaultsOutsideFilters", true, "Show Faults Outside Filters" ); CAF_PDM_InitField( &faultResult, "FaultFaceCulling", @@ -78,11 +78,11 @@ RimFaultInViewCollection::RimFaultInViewCollection() "", "" ); - CAF_PDM_InitField( &showFaultLabel, "ShowFaultLabel", false, "Show Labels", "", "", "" ); + CAF_PDM_InitField( &showFaultLabel, "ShowFaultLabel", false, "Show Labels" ); cvf::Color3f defWellLabelColor = RiaPreferences::current()->defaultWellLabelColor(); - CAF_PDM_InitField( &faultLabelColor, "FaultLabelColor", defWellLabelColor, "Label Color", "", "", "" ); + CAF_PDM_InitField( &faultLabelColor, "FaultLabelColor", defWellLabelColor, "Label Color" ); - CAF_PDM_InitField( &showNNCs, "ShowNNCs", true, "Show NNCs", "", "", "" ); + CAF_PDM_InitField( &showNNCs, "ShowNNCs", true, "Show NNCs" ); CAF_PDM_InitField( &hideNncsWhenNoResultIsAvailable, "HideNncsWhenNoResultIsAvailable", true, @@ -91,14 +91,14 @@ RimFaultInViewCollection::RimFaultInViewCollection() "", "" ); - CAF_PDM_InitFieldNoDefault( &faults, "Faults", "Faults", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &faults, "Faults", "Faults" ); faults.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_enableFaultRA, "EnableFaultRA", false, "Enable Fault RA", "", "", "" ); + CAF_PDM_InitField( &m_enableFaultRA, "EnableFaultRA", false, "Enable Fault RA" ); m_enableFaultRA.uiCapability()->setUiReadOnly( true ); m_enableFaultRA.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_faultRASettings, "FaultRASettings", "Reactivation Assessment Settings", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_faultRASettings, "FaultRASettings", "Reactivation Assessment Settings" ); m_faultRASettings = new RimFaultRASettings(); m_faultRASettings.uiCapability()->setUiHidden( true ); m_faultRASettings.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPostprocSettings.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPostprocSettings.cpp index ae7f05efcc..031c09847d 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPostprocSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPostprocSettings.cpp @@ -32,13 +32,13 @@ RimFaultRAPostprocSettings::RimFaultRAPostprocSettings() { CAF_PDM_InitObject( "Reactivation Assessment Postproc Settings", ":/fault_react_24x24.png", "", "" ); - CAF_PDM_InitField( &m_baseDir, "BaseDir", QString( "" ), "Working Directory", "", "", "" ); - CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step", "", "", "" ); - CAF_PDM_InitField( &m_endTimestepEclipse, "EndTimeStepEclipse", 0, "End Time Step", "", "", "" ); - CAF_PDM_InitField( &m_geomechEnabled, "GeomechEnabled", false, "GeoMechanical Input Available", "", "", "" ); - CAF_PDM_InitField( &m_basicMacrisDatabase, "BasicMacrisDatabase", QString( "" ), "Basic Macris Database", "", "", "" ); - CAF_PDM_InitField( &m_advancedMacrisDatabase, "AdvancedMacrisDatabase", QString( "" ), "Advanced Macris Database", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_postprocParameters, "PostprocParameters", "Post-Processing Parameters", "", "", "" ); + CAF_PDM_InitField( &m_baseDir, "BaseDir", QString( "" ), "Working Directory" ); + CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step" ); + CAF_PDM_InitField( &m_endTimestepEclipse, "EndTimeStepEclipse", 0, "End Time Step" ); + CAF_PDM_InitField( &m_geomechEnabled, "GeomechEnabled", false, "GeoMechanical Input Available" ); + CAF_PDM_InitField( &m_basicMacrisDatabase, "BasicMacrisDatabase", QString( "" ), "Basic Macris Database" ); + CAF_PDM_InitField( &m_advancedMacrisDatabase, "AdvancedMacrisDatabase", QString( "" ), "Advanced Macris Database" ); + CAF_PDM_InitFieldNoDefault( &m_postprocParameters, "PostprocParameters", "Post-Processing Parameters" ); m_postprocParameters = new RimParameterGroup(); } diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp index cf3d80ea48..cb088e1168 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp @@ -42,29 +42,29 @@ RimFaultRAPreprocSettings::RimFaultRAPreprocSettings() { CAF_PDM_InitObject( "Fault RA Preproc Settings", ":/fault_react_24x24.png", "", "" ); - CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step", "", "", "" ); + CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step" ); m_startTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_endTimestepEclipse, "EndTimeStepEclipse", 0, "End Time Step", "", "", "" ); + CAF_PDM_InitField( &m_endTimestepEclipse, "EndTimeStepEclipse", 0, "End Time Step" ); m_endTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_startTimestepGeoMech, "StartTimeStepGeoMech", 0, "Start Time Step", "", "", "" ); + CAF_PDM_InitField( &m_startTimestepGeoMech, "StartTimeStepGeoMech", 0, "Start Time Step" ); m_startTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_endTimestepGeoMech, "EndTimeStepGeoMech", 0, "End Time Step", "", "", "" ); + CAF_PDM_InitField( &m_endTimestepGeoMech, "EndTimeStepGeoMech", 0, "End Time Step" ); m_endTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" ); m_eclipseCase.setValue( nullptr ); - CAF_PDM_InitFieldNoDefault( &m_geomechCase, "GeomechCase", "GeoMech Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geomechCase, "GeomechCase", "GeoMech Case" ); m_geomechCase.setValue( nullptr ); - CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDir", "Output Directory", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDir", "Output Directory" ); m_baseDir.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_cleanBaseDir, "CleanBaseDir", false, "Clean Output Directory", "", "", "" ); - CAF_PDM_InitField( &m_smoothEclipseData, "SmoothEclipseData", true, "Smooth Eclipse Data", "", "", "" ); + CAF_PDM_InitField( &m_cleanBaseDir, "CleanBaseDir", false, "Clean Output Directory" ); + CAF_PDM_InitField( &m_smoothEclipseData, "SmoothEclipseData", true, "Smooth Eclipse Data" ); - CAF_PDM_InitField( &m_elasticTableFilename, "ElasticTableFilename", QString( "" ), "Elastic Table", "", "", "" ); + CAF_PDM_InitField( &m_elasticTableFilename, "ElasticTableFilename", QString( "" ), "Elastic Table" ); m_elasticTableFilename.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_elasticTableFilename.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); } diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp index 76c71e509a..69b28c9e5d 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp @@ -55,31 +55,31 @@ RimFaultRASettings::RimFaultRASettings() { CAF_PDM_InitObject( "Reactivation Assessment Settings", ":/fault_react_24x24.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" ); m_eclipseCase.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_geomechCase, "GeomechCase", "GeoMech Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geomechCase, "GeomechCase", "GeoMech Case" ); m_geomechCase.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_eclipseFRAGeneratedCase, "EclipseFRACase", "Eclipse FRA Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseFRAGeneratedCase, "EclipseFRACase", "Eclipse FRA Case" ); m_eclipseFRAGeneratedCase.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDir", "Working Directory", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDir", "Working Directory" ); m_baseDir.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_elasticTableFilename, "ElasticTableFilename", QString( "" ), "Elastic Table", "", "", "" ); + CAF_PDM_InitField( &m_elasticTableFilename, "ElasticTableFilename", QString( "" ), "Elastic Table" ); m_elasticTableFilename.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_elasticTableFilename.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step", "", "", "" ); + CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step" ); m_startTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_endTimestepEclipse, "EndTimeStepEclipse", 0, "End Time Step", "", "", "" ); + CAF_PDM_InitField( &m_endTimestepEclipse, "EndTimeStepEclipse", 0, "End Time Step" ); m_endTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_startTimestepGeoMech, "StartTimeStepGeoMech", 0, "Start Time Step", "", "", "" ); + CAF_PDM_InitField( &m_startTimestepGeoMech, "StartTimeStepGeoMech", 0, "Start Time Step" ); m_startTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); m_startTimestepGeoMech.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_endTimestepGeoMech, "EndTimeStepGeoMech", 0, "End Time Step", "", "", "" ); + CAF_PDM_InitField( &m_endTimestepGeoMech, "EndTimeStepGeoMech", 0, "End Time Step" ); m_endTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); m_endTimestepGeoMech.uiCapability()->setUiReadOnly( true ); @@ -91,8 +91,8 @@ RimFaultRASettings::RimFaultRASettings() "", "" ); - CAF_PDM_InitFieldNoDefault( &m_basicParametersRI, "BasicParametersRI", "Basic ResInsight Parameters", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_advancedParametersRI, "AdvancedParametersRI", "Advanced ResInsight Parameters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_basicParametersRI, "BasicParametersRI", "Basic ResInsight Parameters" ); + CAF_PDM_InitFieldNoDefault( &m_advancedParametersRI, "AdvancedParametersRI", "Advanced ResInsight Parameters" ); setupResInsightParameters(); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimDataSourceForRftPlt.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimDataSourceForRftPlt.cpp index f2ddf34450..7a8c33f53f 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimDataSourceForRftPlt.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimDataSourceForRftPlt.cpp @@ -102,11 +102,11 @@ RifDataSourceForRftPlt RimDataSourceForRftPlt::address() const //-------------------------------------------------------------------------------------------------- void RimDataSourceForRftPlt::InitPdmObject() { - CAF_PDM_InitFieldNoDefault( &m_sourceType, "SourceType", "Source Type", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_eclCase, "EclipseCase", "Eclipse Case", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellLogFile, "WellLogFile", "Well Log File", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_observedFmuRftData, "ObservedFmuRftData", "Observed FMU Data", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_sourceType, "SourceType", "Source Type" ); + CAF_PDM_InitFieldNoDefault( &m_eclCase, "EclipseCase", "Eclipse Case" ); + CAF_PDM_InitFieldNoDefault( &m_wellLogFile, "WellLogFile", "Well Log File" ); + CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble" ); + CAF_PDM_InitFieldNoDefault( &m_observedFmuRftData, "ObservedFmuRftData", "Observed FMU Data" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp index 65e556d5a5..fbedaf8bfa 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp @@ -70,15 +70,15 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot() { CAF_PDM_InitObject( "Flow Characteristics", ":/FlowCharPlot16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_case, "FlowCase", "Case", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "FlowCase", "Case" ); + CAF_PDM_InitFieldNoDefault( &m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution" ); m_flowDiagSolution.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timeStepSelectionType, "TimeSelectionType", "Time Steps" ); + CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "SelectedTimeSteps", "" ); m_selectedTimeSteps.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_selectedTimeStepsUi, "SelectedTimeStepsUi", "", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_applyTimeSteps, "ApplyTimeSteps", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedTimeStepsUi, "SelectedTimeStepsUi", "" ); + CAF_PDM_InitFieldNoDefault( &m_applyTimeSteps, "ApplyTimeSteps", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_applyTimeSteps ); CAF_PDM_InitField( &m_maxPvFraction, @@ -90,19 +90,19 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot() "Volume.", "" ); - CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Legend", "", "", "" ); + CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Legend" ); // Region group - CAF_PDM_InitFieldNoDefault( &m_cellFilter, "CellFilter", "Cell Filter", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_cellFilterView, "CellFilterView", "View", "", "", "" ); - CAF_PDM_InitField( &m_tracerFilter, "TracerFilter", QString(), "Tracer Filter", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_selectedTracerNames, "SelectedTracerNames", " ", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cellFilter, "CellFilter", "Cell Filter" ); + CAF_PDM_InitFieldNoDefault( &m_cellFilterView, "CellFilterView", "View" ); + CAF_PDM_InitField( &m_tracerFilter, "TracerFilter", QString(), "Tracer Filter" ); + CAF_PDM_InitFieldNoDefault( &m_selectedTracerNames, "SelectedTracerNames", " " ); m_selectedTracerNames.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_showRegion, "ShowRegion", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_showRegion, "ShowRegion", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_showRegion ); - CAF_PDM_InitField( &m_minCommunication, "MinCommunication", 0.0, "Min Communication", "", "", "" ); - CAF_PDM_InitField( &m_maxTof, "MaxTof", 146000, "Max Time of Flight [days]", "", "", "" ); + CAF_PDM_InitField( &m_minCommunication, "MinCommunication", 0.0, "Min Communication" ); + CAF_PDM_InitField( &m_maxTof, "MaxTof", 146000, "Max Time of Flight [days]" ); this->m_showWindow = false; setAsPlotMdiWindow(); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp index 7c0069572b..9ffe5931f6 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowDiagSolution.cpp @@ -70,8 +70,8 @@ QString RimFlowDiagSolution::addCrossFlowEnding( const QString& wellName ) //-------------------------------------------------------------------------------------------------- RimFlowDiagSolution::RimFlowDiagSolution( void ) { - CAF_PDM_InitObject( "Flow Diagnostics Solution", "", "", "" ); - CAF_PDM_InitField( &m_userDescription, "UserDescription", QString( "All Wells" ), "Description", "", "", "" ); + CAF_PDM_InitObject( "Flow Diagnostics Solution" ); + CAF_PDM_InitField( &m_userDescription, "UserDescription", QString( "All Wells" ), "Description" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp index 251ee0ed3b..f61dfb9969 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp @@ -35,25 +35,22 @@ RimFlowPlotCollection::RimFlowPlotCollection() { CAF_PDM_InitObject( "Flow Diagnostics Plots", ":/WellAllocPlots16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_flowCharacteristicsPlot, "FlowCharacteristicsPlot", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_flowCharacteristicsPlot, "FlowCharacteristicsPlot", "" ); m_flowCharacteristicsPlot.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_defaultWellAllocPlot, "DefaultWellAllocationPlot", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_defaultWellAllocPlot, "DefaultWellAllocationPlot", "" ); m_defaultWellAllocPlot.uiCapability()->setUiTreeHidden( true ); - // CAF_PDM_InitFieldNoDefault( &m_dbgWellDistributionPlot, "DbgWellDistributionPlot", "", "", "", "" ); + // CAF_PDM_InitFieldNoDefault( &m_dbgWellDistributionPlot, "DbgWellDistributionPlot", ""); // m_dbgWellDistributionPlot.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_wellDistributionPlotCollection, "WellDistributionPlotCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellDistributionPlotCollection, "WellDistributionPlotCollection", "" ); m_wellDistributionPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_storedWellAllocPlots, "StoredWellAllocationPlots", "Stored Well Allocation Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_storedWellAllocPlots, "StoredWellAllocationPlots", "Stored Well Allocation Plots" ); CAF_PDM_InitFieldNoDefault( &m_storedFlowCharacteristicsPlots, "StoredFlowCharacteristicsPlots", - "Stored Flow Characteristics Plots", - "", - "", - "" ); + "Stored Flow Characteristics Plots" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp index a9967e0e49..f4774a6f73 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp @@ -46,13 +46,13 @@ RimTofAccumulatedPhaseFractionsPlot::RimTofAccumulatedPhaseFractionsPlot() { CAF_PDM_InitObject( "Cumulative Saturation by Time of Flight", ":/TOFAccSatPlot16x16.png", "", "" ); - CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Cumulative Saturation by Time of Flight" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Cumulative Saturation by Time of Flight" ), "Name" ); m_userName.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" ); + CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title" ); m_showPlotTitle.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_maxTof, "MaxTof", 50, "Max Time of Flight [year]", "", "", "" ); + CAF_PDM_InitField( &m_maxTof, "MaxTof", 50, "Max Time of Flight [year]" ); m_showWindow = false; } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp index 3551837b03..d028fff882 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp @@ -44,10 +44,10 @@ RimTotalWellAllocationPlot::RimTotalWellAllocationPlot() { CAF_PDM_InitObject( "Total Allocation", ":/WellAllocPie16x16.png", "", "" ); - CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Total Allocation" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Total Allocation" ), "Name" ); m_userName.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" ); + CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 54c262279e..c00e3a3f60 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -76,10 +76,10 @@ RimWellAllocationPlot::RimWellAllocationPlot() { CAF_PDM_InitObject( "Well Allocation Plot", ":/WellAllocPlot16x16.png", "", "" ); - CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Flow Diagnostics Plot" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Flow Diagnostics Plot" ), "Name" ); m_userName.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" ); + CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title" ); CAF_PDM_InitField( &m_branchDetection, "BranchDetection", @@ -89,16 +89,16 @@ RimWellAllocationPlot::RimWellAllocationPlot() "Compute branches based on how simulation well cells are organized", "" ); - CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case" ); m_case.uiCapability()->setUiTreeChildrenHidden( true ); - 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, "AccumulatedWellFlowPlot", "Accumulated Well Flow", "", "", "" ); + 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, "AccumulatedWellFlowPlot", "Accumulated Well Flow" ); m_accumulatedWellFlowPlot.uiCapability()->setUiTreeHidden( true ); m_accumulatedWellFlowPlot = new RimWellLogPlot; m_accumulatedWellFlowPlot->setDepthUnit( RiaDefines::DepthUnitType::UNIT_NONE ); @@ -106,20 +106,17 @@ RimWellAllocationPlot::RimWellAllocationPlot() m_accumulatedWellFlowPlot->setLegendsVisible( false ); m_accumulatedWellFlowPlot->uiCapability()->setUiIconFromResourceString( ":/WellFlowPlot16x16.png" ); - CAF_PDM_InitFieldNoDefault( &m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow" ); m_totalWellAllocationPlot.uiCapability()->setUiTreeHidden( true ); m_totalWellAllocationPlot = new RimTotalWellAllocationPlot; - CAF_PDM_InitFieldNoDefault( &m_wellAllocationPlotLegend, "WellAllocLegend", "Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellAllocationPlotLegend, "WellAllocLegend", "Legend" ); m_wellAllocationPlotLegend.uiCapability()->setUiTreeHidden( true ); m_wellAllocationPlotLegend = new RimWellAllocationPlotLegend; CAF_PDM_InitFieldNoDefault( &m_tofAccumulatedPhaseFractionsPlot, "TofAccumulatedPhaseFractionsPlot", - "TOF Accumulated Phase Fractions", - "", - "", - "" ); + "TOF Accumulated Phase Fractions" ); m_tofAccumulatedPhaseFractionsPlot.uiCapability()->setUiTreeHidden( true ); m_tofAccumulatedPhaseFractionsPlot = new RimTofAccumulatedPhaseFractionsPlot; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlotLegend.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlotLegend.cpp index 479752b735..d3f9faf106 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlotLegend.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlotLegend.cpp @@ -27,7 +27,7 @@ CAF_PDM_SOURCE_INIT( RimWellAllocationPlotLegend, "WellAllocationPlotLegend" ); RimWellAllocationPlotLegend::RimWellAllocationPlotLegend() { CAF_PDM_InitObject( "Legend", ":/WellAllocLegend16x16.png", "", "" ); - CAF_PDM_InitField( &m_showLegend, "ShowPlotLegend", true, "Show Plot Legend", "", "", "" ); + CAF_PDM_InitField( &m_showLegend, "ShowPlotLegend", true, "Show Plot Legend" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp index e3d8aa4402..a3e3e3a607 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp @@ -59,13 +59,13 @@ RimWellDistributionPlot::RimWellDistributionPlot( RiaDefines::PhaseType phase ) { // cvf::Trace::show("RimWellDistributionPlot::RimWellDistributionPlot()"); - CAF_PDM_InitObject( "Cumulative Phase Distribution Plot", "", "", "" ); + CAF_PDM_InitObject( "Cumulative Phase Distribution Plot" ); - CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" ); - CAF_PDM_InitField( &m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "" ); - CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well", "", "", "" ); - CAF_PDM_InitField( &m_phase, "Phase", caf::AppEnum( phase ), "Phase", "", "", "" ); - CAF_PDM_InitField( &m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case" ); + CAF_PDM_InitField( &m_timeStepIndex, "TimeStepIndex", -1, "Time Step" ); + CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well" ); + CAF_PDM_InitField( &m_phase, "Phase", caf::AppEnum( phase ), "Phase" ); + CAF_PDM_InitField( &m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions" ); CAF_PDM_InitField( &m_smallContributionsRelativeThreshold, "SmallContributionsRelativeThreshold", 0.005, @@ -74,7 +74,7 @@ RimWellDistributionPlot::RimWellDistributionPlot( RiaDefines::PhaseType phase ) "", "" ); - CAF_PDM_InitField( &m_maximumTof, "MaximumTOF", 20.0, "Maximum Time of Flight [0, 200]", "", "", "" ); + CAF_PDM_InitField( &m_maximumTof, "MaximumTOF", 20.0, "Maximum Time of Flight [0, 200]" ); m_showWindow = false; m_showPlotLegends = true; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp index 68d47b1e6a..8c6dfe99b6 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp @@ -61,10 +61,10 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection() CAF_PDM_InitObject( "Cumulative Phase Distribution Plot", ":/CumulativePhaseDist16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" ); - CAF_PDM_InitField( &m_timeStepIndex, "TimeStepIndex", -1, "Time Step", "", "", "" ); - CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well", "", "", "" ); - CAF_PDM_InitField( &m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case" ); + CAF_PDM_InitField( &m_timeStepIndex, "TimeStepIndex", -1, "Time Step" ); + CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well" ); + CAF_PDM_InitField( &m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions" ); CAF_PDM_InitField( &m_smallContributionsRelativeThreshold, "SmallContributionsRelativeThreshold", 0.005, @@ -73,15 +73,15 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection() "", "" ); - CAF_PDM_InitField( &m_maximumTof, "MaximumTOF", 20.0, "Maximum Time of Flight [0, 200]", "", "", "" ); + CAF_PDM_InitField( &m_maximumTof, "MaximumTOF", 20.0, "Maximum Time of Flight [0, 200]" ); - CAF_PDM_InitFieldNoDefault( &m_plots, "Plots", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plots, "Plots", "" ); m_plots.uiCapability()->setUiTreeHidden( true ); m_plots.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_showOil, "ShowOil", true, "Show Oil", "", "", "" ); - CAF_PDM_InitField( &m_showGas, "ShowGas", true, "Show Gas", "", "", "" ); - CAF_PDM_InitField( &m_showWater, "ShowWater", true, "Show Water", "", "", "" ); + CAF_PDM_InitField( &m_showOil, "ShowOil", true, "Show Oil" ); + CAF_PDM_InitField( &m_showGas, "ShowGas", true, "Show Gas" ); + CAF_PDM_InitField( &m_showWater, "ShowWater", true, "Show Water" ); CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp index 71c8b784ba..4ed994addd 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp @@ -46,7 +46,7 @@ CAF_PDM_SOURCE_INIT( RimWellFlowRateCurve, "WellFlowRateCurve" ); //-------------------------------------------------------------------------------------------------- RimWellFlowRateCurve::RimWellFlowRateCurve() { - CAF_PDM_InitObject( "Flow Rate Curve", "", "", "" ); + CAF_PDM_InitObject( "Flow Rate Curve" ); m_groupId = 0; m_doFillCurve = true; } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 77e866a49f..6d453c3287 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -100,30 +100,30 @@ RimWellPltPlot::RimWellPltPlot() { CAF_PDM_InitObject( "Well Allocation Plot", ":/WellFlowPlot16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "WellLog", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "WellLog" ); m_wellLogPlot_OBSOLETE.uiCapability()->setUiTreeHidden( 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", "", "", "" ); + 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", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedSourcesForIo, "Sources", "Sources" ); m_selectedSourcesForIo.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "Time Steps", "", "", "" ); + 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", "", "", "" ); + 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 ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp index 6a66cdb702..9dbab135f8 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp @@ -39,21 +39,21 @@ CAF_PDM_SOURCE_INIT( RimWellRftEnsembleCurveSet, "WellRftEnsembleCurveSet" ); RimWellRftEnsembleCurveSet::RimWellRftEnsembleCurveSet() { CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble" ); m_ensemble.uiCapability()->setUiTreeChildrenHidden( true ); m_ensemble.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault( &m_ensembleName, "NameAndUnit", "NameAndUnit", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleName, "NameAndUnit", "NameAndUnit" ); m_ensembleName.registerGetMethod( this, &RimWellRftEnsembleCurveSet::ensembleName ); m_ensembleName.uiCapability()->setUiHidden( true ); m_ensembleName.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_ensembleColorMode, "ColorMode", ColorModeEnum( ColorMode::SINGLE_COLOR ), "Coloring Mode", "", "", "" ); + CAF_PDM_InitField( &m_ensembleColorMode, "ColorMode", ColorModeEnum( ColorMode::SINGLE_COLOR ), "Coloring Mode" ); - CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter", "", "", "" ); + CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter" ); m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_ensembleLegendConfig, "LegendConfig", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleLegendConfig, "LegendConfig", "" ); m_ensembleLegendConfig = new RimRegularLegendConfig(); m_ensembleLegendConfig->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimEnsembleCurveSetColorManager::DEFAULT_ENSEMBLE_COLOR_RANGE ) ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index b3d1838b28..b1c48c05e3 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -84,18 +84,18 @@ RimWellRftPlot::RimWellRftPlot() { CAF_PDM_InitObject( "RFT Plot", ":/RFTPlot16x16.png", "", "" ); - CAF_PDM_InitField( &m_showStatisticsCurves, "ShowStatisticsCurves", true, "Show Statistics Curves", "", "", "" ); - CAF_PDM_InitField( &m_showEnsembleCurves, "ShowEnsembleCurves", true, "Show Ensemble Curves", "", "", "" ); - CAF_PDM_InitField( &m_showErrorInObservedData, "ShowErrorObserved", true, "Show Observed Data Error", "", "", "" ); + CAF_PDM_InitField( &m_showStatisticsCurves, "ShowStatisticsCurves", true, "Show Statistics Curves" ); + CAF_PDM_InitField( &m_showEnsembleCurves, "ShowEnsembleCurves", true, "Show Ensemble Curves" ); + CAF_PDM_InitField( &m_showErrorInObservedData, "ShowErrorObserved", true, "Show Observed Data Error" ); - CAF_PDM_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "Well Log", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "Well Log" ); m_wellLogPlot_OBSOLETE.uiCapability()->setUiTreeHidden( true ); m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable( false ); m_depthType = RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH; - CAF_PDM_InitFieldNoDefault( &m_wellPathNameOrSimWellName, "WellName", "Well Name", "", "", "" ); - CAF_PDM_InitField( &m_branchIndex, "BranchIndex", 0, "Branch Index", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellPathNameOrSimWellName, "WellName", "Well Name" ); + CAF_PDM_InitField( &m_branchIndex, "BranchIndex", 0, "Branch Index" ); CAF_PDM_InitField( &m_branchDetection, "BranchDetection", true, @@ -104,24 +104,24 @@ RimWellRftPlot::RimWellRftPlot() "Compute branches based on how simulation well cells are organized", "" ); - CAF_PDM_InitFieldNoDefault( &m_selectedSources, "Sources", "Sources", "", "", "" ); + 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 ); - CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "Time Steps", "", "", "" ); + 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 ); - CAF_PDM_InitFieldNoDefault( &m_wellPathCollection, "WellPathCollection", "Well Path Collection", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellPathCollection, "WellPathCollection", "Well Path Collection" ); m_wellPathCollection.uiCapability()->setUiHidden( true ); m_wellPathCollection.xmlCapability()->disableIO(); m_wellPathCollection = RimProject::current()->activeOilField()->wellPathCollection(); - CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSets, "EnsembleCurveSets", "Ensemble Curve Sets", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSets, "EnsembleCurveSets", "Ensemble Curve Sets" ); // TODO: may want to support TRUE_VERTICAL_DEPTH_RKB in the future // It was developed for regular well log plots and requires some more work for RFT plots. diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp index 3d4e414d33..3ac6c28523 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp @@ -126,31 +126,26 @@ RimGeoMechCase::RimGeoMechCase( void ) "Used to calculate the SE:SFI result", "" ); - CAF_PDM_InitFieldNoDefault( &m_elementPropertyFileNames, "ElementPropertyFileNames", "Element Property Files", "", "", "" ); - - CAF_PDM_InitFieldNoDefault( &m_elementPropertyFileNameIndexUiSelection, - "ElementPropertyFileNameIndexUiSelection", - "", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_elementPropertyFileNames, "ElementPropertyFileNames", "Element Property Files" ); + + CAF_PDM_InitFieldNoDefault( &m_elementPropertyFileNameIndexUiSelection, "ElementPropertyFileNameIndexUiSelection", "" ); m_elementPropertyFileNameIndexUiSelection.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_importElementPropertyFileCommand, "importElementPropertyFileCommad", false, "", "", "", "" ); + CAF_PDM_InitField( &m_importElementPropertyFileCommand, "importElementPropertyFileCommad", false, "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_importElementPropertyFileCommand ); - CAF_PDM_InitField( &m_closeElementPropertyFileCommand, "closeElementPropertyFileCommad", false, "", "", "", "" ); + CAF_PDM_InitField( &m_closeElementPropertyFileCommand, "closeElementPropertyFileCommad", false, "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_closeElementPropertyFileCommand ); - CAF_PDM_InitField( &m_reloadElementPropertyFileCommand, "reloadElementPropertyFileCommand", false, "", "", "", "" ); + CAF_PDM_InitField( &m_reloadElementPropertyFileCommand, "reloadElementPropertyFileCommand", false, "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_reloadElementPropertyFileCommand ); caf::AppEnum defaultBiotCoefficientType = RimGeoMechCase::BiotCoefficientType::BIOT_NONE; - CAF_PDM_InitField( &m_biotCoefficientType, "BiotCoefficientType", defaultBiotCoefficientType, "Biot Coefficient", "", "", "" ); - CAF_PDM_InitField( &m_biotFixedCoefficient, "BiotFixedCoefficient", 1.0, "Fixed Coefficient", "", "", "" ); + CAF_PDM_InitField( &m_biotCoefficientType, "BiotCoefficientType", defaultBiotCoefficientType, "Biot Coefficient" ); + CAF_PDM_InitField( &m_biotFixedCoefficient, "BiotFixedCoefficient", 1.0, "Fixed Coefficient" ); m_biotFixedCoefficient.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_biotResultAddress, "BiotResultAddress", QString( "" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_biotResultAddress, "BiotResultAddress", QString( "" ), "Value" ); m_biotResultAddress.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); caf::AppEnum defaultInitialPermeabilityType = @@ -171,25 +166,20 @@ RimGeoMechCase::RimGeoMechCase( void ) "" ); m_initialPermeabilityFixed.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_initialPermeabilityResultAddress, "InitialPermeabilityAddress", QString( "" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_initialPermeabilityResultAddress, "InitialPermeabilityAddress", QString( "" ), "Value" ); m_initialPermeabilityResultAddress.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_permeabilityExponent, "PermeabilityExponent", 1.0, "Permeability Exponent", "", "", "" ); + CAF_PDM_InitField( &m_permeabilityExponent, "PermeabilityExponent", 1.0, "Permeability Exponent" ); m_permeabilityExponent.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_waterDensityShearSlipIndicator, "WaterDensityShearSlipIndicator", 1.03, "Water Density", "", "", "" ); + CAF_PDM_InitField( &m_waterDensityShearSlipIndicator, "WaterDensityShearSlipIndicator", 1.03, "Water Density" ); m_waterDensityShearSlipIndicator.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_contourMapCollection, "ContourMaps", "2d Contour Maps", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_contourMapCollection, "ContourMaps", "2d Contour Maps" ); m_contourMapCollection = new RimGeoMechContourMapViewCollection; m_contourMapCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_mudWeightWindowParameters, - "MudWeightWindowParameters", - "Mud Weight Window Parameters", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_mudWeightWindowParameters, "MudWeightWindowParameters", "Mud Weight Window Parameters" ); m_mudWeightWindowParameters = new RimMudWeightWindowParameters; m_mudWeightWindowParameters.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCellColors.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCellColors.cpp index 52ff1fb461..54b29c9636 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCellColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCellColors.cpp @@ -32,7 +32,7 @@ CAF_PDM_SOURCE_INIT( RimGeoMechCellColors, "GeoMechResultSlot" ); RimGeoMechCellColors::RimGeoMechCellColors( void ) : legendConfigChanged( this ) { - CAF_PDM_InitFieldNoDefault( &legendConfig, "LegendDefinition", "Color Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &legendConfig, "LegendDefinition", "Color Legend" ); this->legendConfig = new RimRegularLegendConfig(); legendConfig.uiCapability()->setUiTreeHidden( true ); legendConfig->changed.connect( this, &RimGeoMechCellColors::onLegendConfigChanged ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp index c4bb67d966..c288a0f957 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp @@ -60,8 +60,8 @@ RimGeoMechContourMapProjection::RimGeoMechContourMapProjection() : m_kLayers( 0u ) { CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png", "", "" ); - CAF_PDM_InitField( &m_limitToPorePressureRegions, "LimitToPorRegion", true, "Limit to Pore Pressure regions", "", "", "" ); - CAF_PDM_InitField( &m_applyPPRegionLimitVertically, "VerticalLimit", false, "Apply Limit Vertically", "", "", "" ); + CAF_PDM_InitField( &m_limitToPorePressureRegions, "LimitToPorRegion", true, "Limit to Pore Pressure regions" ); + CAF_PDM_InitField( &m_applyPPRegionLimitVertically, "VerticalLimit", false, "Apply Limit Vertically" ); CAF_PDM_InitField( &m_paddingAroundPorePressureRegion, "PaddingAroundPorRegion", 0.0, diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp index 90e6987738..bcf3feaf23 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapView.cpp @@ -58,11 +58,11 @@ RimGeoMechContourMapView::RimGeoMechContourMapView() "GeoMechContourMap", "A contour map for GeoMech cases" ); - CAF_PDM_InitFieldNoDefault( &m_contourMapProjection, "ContourMapProjection", "Contour Map Projection", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_contourMapProjection, "ContourMapProjection", "Contour Map Projection" ); m_contourMapProjection = new RimGeoMechContourMapProjection(); - CAF_PDM_InitField( &m_showAxisLines, "ShowAxisLines", true, "Show Axis Lines", "", "", "" ); - CAF_PDM_InitField( &m_showScaleLegend, "ShowScaleLegend", true, "Show Scale Legend", "", "", "" ); + CAF_PDM_InitField( &m_showAxisLines, "ShowAxisLines", true, "Show Axis Lines" ); + CAF_PDM_InitField( &m_showScaleLegend, "ShowScaleLegend", true, "Show Scale Legend" ); m_gridCollection->setActive( false ); // This is also not added to the tree view, so cannot be enabled. diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp index 7489dd88cd..cacbf602cb 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp @@ -36,7 +36,7 @@ RimGeoMechModels::RimGeoMechModels( void ) { CAF_PDM_InitObject( "Geomechanical Models", ":/GeoMechCases48x48.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_cases, "Cases", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cases, "Cases", "" ); m_cases.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp index ab35aa23d6..bcf36365dc 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp @@ -32,7 +32,7 @@ RimGeoMechPart::RimGeoMechPart() { CAF_PDM_InitScriptableObject( "GeoMechPart", ":/GeoMechCase24x24.png", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_partId, "PartId", "Part Id", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_partId, "PartId", "Part Id" ); m_partId.uiCapability()->setUiReadOnly( true ); nameField()->uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp index f26cd94e5b..4f1346e9ea 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp @@ -43,7 +43,7 @@ RimGeoMechPartCollection::RimGeoMechPartCollection() { CAF_PDM_InitScriptableObject( "Parts", ":/GeoMechCase24x24.png", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_parts, "Parts", "Parts", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_parts, "Parts", "Parts" ); m_parts.uiCapability()->setUiTreeHidden( true ); setDeletable( false ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp index 07841aba05..de1650bb0b 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp @@ -78,13 +78,13 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition( void ) { CAF_PDM_InitObject( "Color Result", ":/CellResult.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_resultPositionType, "ResultPositionType", "Result Position", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resultPositionType, "ResultPositionType", "Result Position" ); m_resultPositionType.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_resultFieldName, "ResultFieldName", QString( "" ), "Field Name", "", "", "" ); + CAF_PDM_InitField( &m_resultFieldName, "ResultFieldName", QString( "" ), "Field Name" ); m_resultFieldName.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_resultComponentName, "ResultComponentName", QString( "" ), "Component", "", "", "" ); + CAF_PDM_InitField( &m_resultComponentName, "ResultComponentName", QString( "" ), "Component" ); m_resultComponentName.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &m_timeLapseBaseTimestep, @@ -94,15 +94,15 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition( void ) "", "", "" ); - CAF_PDM_InitField( &m_referenceTimeStep, "ReferenceTimeStep", 0, "Reference Time Step", "", "", "" ); + CAF_PDM_InitField( &m_referenceTimeStep, "ReferenceTimeStep", 0, "Reference Time Step" ); - CAF_PDM_InitField( &m_compactionRefLayer, "CompactionRefLayer", 0, "Compaction Ref Layer", "", "", "" ); + CAF_PDM_InitField( &m_compactionRefLayer, "CompactionRefLayer", 0, "Compaction Ref Layer" ); m_compactionRefLayer.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_resultPositionTypeUiField, "ResultPositionTypeUi", "Result Position", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resultPositionTypeUiField, "ResultPositionTypeUi", "Result Position" ); m_resultPositionTypeUiField.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_resultVariableUiField, "ResultVariableUI", QString( "" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_resultVariableUiField, "ResultVariableUI", QString( "" ), "Value" ); m_resultVariableUiField.xmlCapability()->disableIO(); m_resultVariableUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); @@ -115,7 +115,7 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition( void ) "", "", "" ); - CAF_PDM_InitField( &m_normalizationAirGap, "NormalizationAirGap", 0.0, "Air Gap", "", "", "" ); + CAF_PDM_InitField( &m_normalizationAirGap, "NormalizationAirGap", 0.0, "Air Gap" ); m_normalizationAirGap.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); CAF_PDM_InitField( &m_compactionRefLayerUiField, diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp index c9c94b6228..6f2d318683 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp @@ -90,20 +90,20 @@ RimGeoMechView::RimGeoMechView( void ) cellResult = new RimGeoMechCellColors(); cellResult.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_tensorResults, "TensorResults", "Tensor Results", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_tensorResults, "TensorResults", "Tensor Results" ); m_tensorResults = new RimTensorResults(); m_tensorResults.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_propertyFilterCollection, "PropertyFilters", "Property Filters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_propertyFilterCollection, "PropertyFilters", "Property Filters" ); m_propertyFilterCollection = new RimGeoMechPropertyFilterCollection(); m_propertyFilterCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_partsCollection, "Parts", "Parts", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_partsCollection, "Parts", "Parts" ); m_partsCollection = new RimGeoMechPartCollection(); m_partsCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_showDisplacement, "ShowDisplacement", false, "Show Displacement", "", "", "" ); - CAF_PDM_InitField( &m_displacementScaling, "DisplacementScaling", 1.0, "Scaling Factor", "", "", "" ); + CAF_PDM_InitField( &m_showDisplacement, "ShowDisplacement", false, "Show Displacement" ); + CAF_PDM_InitField( &m_displacementScaling, "DisplacementScaling", 1.0, "Scaling Factor" ); m_scaleTransform = new cvf::Transform(); m_vizLogic = new RivGeoMechVizLogic( this ); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellFilter.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellFilter.cpp index 8c726f2fe8..cda69b2991 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellFilter.cpp @@ -36,7 +36,7 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimPlotCellFilter, "RimPlotCellFilter" ); //-------------------------------------------------------------------------------------------------- RimPlotCellFilter::RimPlotCellFilter() { - CAF_PDM_InitFieldNoDefault( &m_filterMode, "FilterMode", "Filter Mode", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filterMode, "FilterMode", "Filter Mode" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellFilterCollection.cpp index e0d44b0b8d..e6b1d1c52c 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellFilterCollection.cpp @@ -28,9 +28,9 @@ CAF_PDM_SOURCE_INIT( RimPlotCellFilterCollection, "RimPlotCellFilterCollection" //-------------------------------------------------------------------------------------------------- RimPlotCellFilterCollection::RimPlotCellFilterCollection() { - CAF_PDM_InitObject( "Plot Cell Filters", "", "", "" ); + CAF_PDM_InitObject( "Plot Cell Filters" ); - CAF_PDM_InitFieldNoDefault( &m_cellFilters, "CellFilters", "Cell Filters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cellFilters, "CellFilters", "Cell Filters" ); m_cellFilters.uiCapability()->setUiTreeHidden( true ); setName( "Filter Collection" ); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp index c4848cd2b1..d95393144f 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/CellFilters/RimPlotCellPropertyFilter.cpp @@ -39,19 +39,19 @@ CAF_PDM_SOURCE_INIT( RimPlotCellPropertyFilter, "RimPlotCellPropertyFilter" ); //-------------------------------------------------------------------------------------------------- RimPlotCellPropertyFilter::RimPlotCellPropertyFilter() { - CAF_PDM_InitObject( "Plot Cell Property Filter", "", "", "" ); + CAF_PDM_InitObject( "Plot Cell Property Filter" ); - CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition" ); // Set to hidden to avoid this item to been displayed as a child item // Fields in this object are displayed using defineUiOrdering() m_resultDefinition.uiCapability()->setUiTreeHidden( true ); m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_lowerBound, "LowerBound", 0.0, "Min", "", "", "" ); + CAF_PDM_InitField( &m_lowerBound, "LowerBound", 0.0, "Min" ); m_lowerBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_upperBound, "UpperBound", 0.0, "Max", "", "", "" ); + CAF_PDM_InitField( &m_upperBound, "UpperBound", 0.0, "Max" ); m_upperBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index c65369fcfa..204dda826c 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -54,20 +54,20 @@ RimGridCrossPlot::RimGridCrossPlot() { CAF_PDM_InitObject( "Grid Cross Plot", ":/SummaryXPlotLight16x16.png", "", "" ); - CAF_PDM_InitField( &m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "" ); + CAF_PDM_InitField( &m_showInfoBox, "ShowInfoBox", true, "Show Info Box" ); - CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name Config", "", "", "" ); + 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", "", "", "" ); + 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 ); - CAF_PDM_InitFieldNoDefault( &m_yAxisProperties, "yAxisProperties", "Y Axis", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yAxisProperties, "yAxisProperties", "Y Axis" ); m_yAxisProperties.uiCapability()->setUiTreeHidden( true ); m_yAxisProperties = new RimPlotAxisProperties; m_yAxisProperties->setNameAndAxis( "Y-Axis", QwtPlot::yLeft ); @@ -76,7 +76,7 @@ RimGridCrossPlot::RimGridCrossPlot() connectAxisSignals( m_xAxisProperties() ); connectAxisSignals( m_yAxisProperties() ); - CAF_PDM_InitFieldNoDefault( &m_crossPlotDataSets, "CrossPlotCurve", "Cross Plot Data Set", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_crossPlotDataSets, "CrossPlotCurve", "Cross Plot Data Set" ); m_crossPlotDataSets.uiCapability()->setUiTreeHidden( true ); setDeletable( true ); @@ -1053,9 +1053,9 @@ CAF_PDM_SOURCE_INIT( RimGridCrossPlotNameConfig, "RimGridCrossPlotNameConfig" ); RimGridCrossPlotNameConfig::RimGridCrossPlotNameConfig() : RimNameConfig( "Cross Plot" ) { - 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" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp index 7543aa02fe..87f4f4548e 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp @@ -29,7 +29,7 @@ RimGridCrossPlotCollection::RimGridCrossPlotCollection() { CAF_PDM_InitObject( "Grid Cross Plots", ":/SummaryXPlotsLight16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_gridCrossPlots, "GridCrossPlots", "Grid Cross Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_gridCrossPlots, "GridCrossPlots", "Grid Cross Plots" ); m_gridCrossPlots.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp index cf1f73583a..7e726ea1fc 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp @@ -86,29 +86,29 @@ RimGridCrossPlotDataSet::RimGridCrossPlotDataSet() { CAF_PDM_InitObject( "Cross Plot Data Set", ":/WellLogCurve16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case" ); m_case.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_timeStep, "TimeStep", -1, "Time Step", "", "", "" ); + 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", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_xAxisProperty, "XAxisProperty", "X-Axis Property" ); m_xAxisProperty = new RimEclipseResultDefinition( caf::PdmUiItemInfo::TOP ); m_xAxisProperty.uiCapability()->setUiTreeHidden( true ); m_xAxisProperty.uiCapability()->setUiTreeChildrenHidden( true ); m_xAxisProperty->setTernaryEnabled( false ); - CAF_PDM_InitFieldNoDefault( &m_yAxisProperty, "YAxisProperty", "Y-Axis Property", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yAxisProperty, "YAxisProperty", "Y-Axis Property" ); m_yAxisProperty = new RimEclipseResultDefinition( caf::PdmUiItemInfo::TOP ); m_yAxisProperty.uiCapability()->setUiTreeHidden( true ); m_yAxisProperty.uiCapability()->setUiTreeChildrenHidden( true ); m_yAxisProperty->setTernaryEnabled( false ); - CAF_PDM_InitFieldNoDefault( &m_groupingProperty, "GroupingProperty", "Data Grouping Property", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_groupingProperty, "GroupingProperty", "Data Grouping Property" ); m_groupingProperty = new RimEclipseCellColors; m_groupingProperty->useDiscreteLogLevels( true ); m_groupingProperty.uiCapability()->setUiTreeHidden( true ); @@ -116,18 +116,18 @@ RimGridCrossPlotDataSet::RimGridCrossPlotDataSet() m_groupingProperty->legendConfig()->setMappingMode( RimRegularLegendConfig::MappingType::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 ); - CAF_PDM_InitFieldNoDefault( &m_crossPlotCurves, "CrossPlotCurves", "Curves", "", "", "" ); + 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", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plotCellFilterCollection, "PlotCellFilterCollection", "Cell Filters" ); m_plotCellFilterCollection.uiCapability()->setUiTreeHidden( true ); m_plotCellFilterCollection.uiCapability()->setUiTreeChildrenHidden( true ); m_plotCellFilterCollection = new RimPlotCellFilterCollection; @@ -1422,12 +1422,12 @@ CAF_PDM_SOURCE_INIT( RimGridCrossPlotDataSetNameConfig, "RimGridCrossPlotCurveSe 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" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp index 50349469b8..338b756ded 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp @@ -36,7 +36,7 @@ RimSaturationPressurePlotCollection::RimSaturationPressurePlotCollection() { CAF_PDM_InitObject( "Saturation Pressure Plots", ":/SummaryXPlotsLight16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_saturationPressurePlots, "SaturationPressurePlots", "Saturation Pressure Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_saturationPressurePlots, "SaturationPressurePlots", "Saturation Pressure Plots" ); m_saturationPressurePlots.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimBoxIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimBoxIntersection.cpp index ea6c0bd8b0..0d2f999e8d 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimBoxIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimBoxIntersection.cpp @@ -65,7 +65,7 @@ RimBoxIntersection::RimBoxIntersection() { CAF_PDM_InitObject( "Intersection Box", ":/IntersectionBox16x16.png", "", "" ); - CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name" ); CAF_PDM_InitField( &m_singlePlaneState, "singlePlaneState", @@ -75,28 +75,28 @@ RimBoxIntersection::RimBoxIntersection() "", "" ); - CAF_PDM_InitField( &m_minXCoord, "MinXCoord", 0.0, "Min", "", "", "" ); + CAF_PDM_InitField( &m_minXCoord, "MinXCoord", 0.0, "Min" ); m_minXCoord.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_maxXCoord, "MaxXCoord", 0.0, "Max", "", "", "" ); + CAF_PDM_InitField( &m_maxXCoord, "MaxXCoord", 0.0, "Max" ); m_maxXCoord.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_minYCoord, "MinYCoord", 0.0, "Min", "", "", "" ); + CAF_PDM_InitField( &m_minYCoord, "MinYCoord", 0.0, "Min" ); m_minYCoord.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_maxYCoord, "MaxYCoord", 0.0, "Max", "", "", "" ); + CAF_PDM_InitField( &m_maxYCoord, "MaxYCoord", 0.0, "Max" ); m_maxYCoord.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_minDepth, "MinDepth", 0.0, "Min", "", "", "" ); + CAF_PDM_InitField( &m_minDepth, "MinDepth", 0.0, "Min" ); m_minDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_maxDepth, "MaxDepth", 0.0, "Max", "", "", "" ); + CAF_PDM_InitField( &m_maxDepth, "MaxDepth", 0.0, "Max" ); m_maxDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_xySliderStepSize, "xySliderStepSize", 1.0, "XY Slider Step Size", "", "", "" ); - CAF_PDM_InitField( &m_depthSliderStepSize, "DepthSliderStepSize", 0.5, "Depth Slider Step Size", "", "", "" ); + CAF_PDM_InitField( &m_xySliderStepSize, "xySliderStepSize", 1.0, "XY Slider Step Size" ); + CAF_PDM_InitField( &m_depthSliderStepSize, "DepthSliderStepSize", 0.5, "Depth Slider Step Size" ); - CAF_PDM_InitFieldNoDefault( &m_show3DManipulator, "show3DManipulator", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_show3DManipulator, "show3DManipulator", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_show3DManipulator ); m_show3DManipulator = false; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp index 06ce283e76..9ca5631d96 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp @@ -193,25 +193,25 @@ void RimExtrudedCurveIntersection::configureForAzimuthLine() RimExtrudedCurveIntersection::RimExtrudedCurveIntersection() { CAF_PDM_InitObject( "Intersection", ":/CrossSection16x16.png", "", "" ); - CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name" ); - CAF_PDM_InitFieldNoDefault( &m_type, "Type", "Type", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_direction, "Direction", "Direction", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "Well Path ", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_simulationWell, "SimulationWell", "Simulation Well", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_type, "Type", "Type" ); + CAF_PDM_InitFieldNoDefault( &m_direction, "Direction", "Direction" ); + CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "Well Path " ); + CAF_PDM_InitFieldNoDefault( &m_simulationWell, "SimulationWell", "Simulation Well" ); CAF_PDM_InitFieldNoDefault( &m_userPolylineXyz, "Points", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" ); CAF_PDM_InitFieldNoDefault( &m_userPolylineXydForUi, "PointsUi", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" ); m_userPolylineXydForUi.registerSetMethod( this, &RimExtrudedCurveIntersection::setPointsFromXYD ); m_userPolylineXydForUi.registerGetMethod( this, &RimExtrudedCurveIntersection::pointsXYD ); - CAF_PDM_InitField( &m_azimuthAngle, "AzimuthAngle", 0.0, "Azimuth", "", "", "" ); + CAF_PDM_InitField( &m_azimuthAngle, "AzimuthAngle", 0.0, "Azimuth" ); m_azimuthAngle.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_dipAngle, "DipAngle", 90.0, "Dip", "", "", "" ); + CAF_PDM_InitField( &m_dipAngle, "DipAngle", 90.0, "Dip" ); m_dipAngle.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_customExtrusionPoints, "CustomExtrusionPoints", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_customExtrusionPoints, "CustomExtrusionPoints", "" ); CAF_PDM_InitFieldNoDefault( &m_twoAzimuthPoints, "TwoAzimuthPoints", "Points", @@ -219,34 +219,24 @@ RimExtrudedCurveIntersection::RimExtrudedCurveIntersection() "Pick two points to define a line.\nUse Ctrl-C for copy and Ctrl-V for paste", "" ); - CAF_PDM_InitField( &m_branchIndex, "Branch", -1, "Branch", "", "", "" ); - CAF_PDM_InitField( &m_extentLength, "ExtentLength", 200.0, "Extent Length", "", "", "" ); - CAF_PDM_InitField( &m_lengthUp, "lengthUp", 1000.0, "Length Up", "", "", "" ); - CAF_PDM_InitField( &m_lengthDown, "lengthDown", 1000.0, "Length Down", "", "", "" ); + CAF_PDM_InitField( &m_branchIndex, "Branch", -1, "Branch" ); + CAF_PDM_InitField( &m_extentLength, "ExtentLength", 200.0, "Extent Length" ); + CAF_PDM_InitField( &m_lengthUp, "lengthUp", 1000.0, "Length Up" ); + CAF_PDM_InitField( &m_lengthDown, "lengthDown", 1000.0, "Length Down" ); - CAF_PDM_InitFieldNoDefault( &m_inputPolylineFromViewerEnabled, "m_activateUiAppendPointsCommand", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_inputPolylineFromViewerEnabled, "m_activateUiAppendPointsCommand", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_inputPolylineFromViewerEnabled ); m_inputPolylineFromViewerEnabled = false; - CAF_PDM_InitFieldNoDefault( &m_inputExtrusionPointsFromViewerEnabled, - "inputExtrusionPointsFromViewerEnabled", - "", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_inputExtrusionPointsFromViewerEnabled, "inputExtrusionPointsFromViewerEnabled", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_inputExtrusionPointsFromViewerEnabled ); m_inputExtrusionPointsFromViewerEnabled = false; - CAF_PDM_InitFieldNoDefault( &m_inputTwoAzimuthPointsFromViewerEnabled, - "inputTwoAzimuthPointsFromViewerEnabled", - "", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_inputTwoAzimuthPointsFromViewerEnabled, "inputTwoAzimuthPointsFromViewerEnabled", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_inputTwoAzimuthPointsFromViewerEnabled ); m_inputTwoAzimuthPointsFromViewerEnabled = false; - CAF_PDM_InitFieldNoDefault( &m_surfaceIntersections, "SurfaceIntersections", "Surface Intersections", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_surfaceIntersections, "SurfaceIntersections", "Surface Intersections" ); m_surfaceIntersections = new RimSurfaceIntersectionCollection; m_surfaceIntersections->objectChanged.connect( this, &RimExtrudedCurveIntersection::onSurfaceIntersectionsChanged ); diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp index 78544f6fa7..7fe0da1f15 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp @@ -40,11 +40,11 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimIntersection, "RimIntersectionHandle" ); //-------------------------------------------------------------------------------------------------- RimIntersection::RimIntersection() { - CAF_PDM_InitField( &m_isActive, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "" ); - CAF_PDM_InitField( &m_useSeparateDataSource, "UseSeparateIntersectionDataSource", true, "Enable", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_separateDataSource, "SeparateIntersectionDataSource", "Source", "", "", "" ); + CAF_PDM_InitField( &m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells" ); + CAF_PDM_InitField( &m_useSeparateDataSource, "UseSeparateIntersectionDataSource", true, "Enable" ); + CAF_PDM_InitFieldNoDefault( &m_separateDataSource, "SeparateIntersectionDataSource", "Source" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp index f715e1a727..d81a1fe9f7 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp @@ -47,13 +47,13 @@ RimIntersectionCollection::RimIntersectionCollection() { CAF_PDM_InitObject( "Intersections", ":/CrossSections16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_intersections, "CrossSections", "Intersections", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_intersections, "CrossSections", "Intersections" ); m_intersections.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_intersectionBoxes, "IntersectionBoxes", "IntersectionBoxes", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_intersectionBoxes, "IntersectionBoxes", "IntersectionBoxes" ); m_intersectionBoxes.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &isActive, "Active", true, "Active" ); isActive.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp index e4edc62bce..e83138aad3 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp @@ -44,34 +44,34 @@ RimIntersectionResultDefinition::RimIntersectionResultDefinition() { CAF_PDM_InitObject( "Intersection Result Definition", ":/CellResult.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" ); - CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case" ); + CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step" ); - CAF_PDM_InitFieldNoDefault( &m_autoName, "IntersectionResultDefinitionDescription", "Description", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_autoName, "IntersectionResultDefinitionDescription", "Description" ); m_autoName.registerGetMethod( this, &RimIntersectionResultDefinition::autoName ); m_autoName.uiCapability()->setUiHidden( true ); m_autoName.uiCapability()->setUiReadOnly( true ); m_autoName.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "EclipseResultDef", "EclipseResultDef", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "EclipseResultDef", "EclipseResultDef" ); m_eclipseResultDefinition.uiCapability()->setUiTreeHidden( true ); m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_eclipseResultDefinition = new RimEclipseResultDefinition; - CAF_PDM_InitFieldNoDefault( &m_geomResultDefinition, "GeoMechResultDef", "GeoMechResultDef", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geomResultDefinition, "GeoMechResultDef", "GeoMechResultDef" ); m_geomResultDefinition.uiCapability()->setUiTreeHidden( true ); m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_geomResultDefinition = new RimGeoMechResultDefinition; - CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "Legend" ); m_legendConfig.uiCapability()->setUiTreeHidden( true ); m_legendConfig.uiCapability()->setUiTreeChildrenHidden( false ); m_legendConfig = new RimRegularLegendConfig; - CAF_PDM_InitFieldNoDefault( &m_ternaryLegendConfig, "TernaryLegendConfig", "Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ternaryLegendConfig, "TernaryLegendConfig", "Legend" ); m_ternaryLegendConfig.uiCapability()->setUiTreeHidden( true ); m_ternaryLegendConfig.uiCapability()->setUiTreeChildrenHidden( false ); m_ternaryLegendConfig = new RimTernaryLegendConfig; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp index 157b1b26b2..3af6d88be4 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp @@ -32,10 +32,10 @@ RimIntersectionResultsDefinitionCollection::RimIntersectionResultsDefinitionColl { CAF_PDM_InitObject( "Intersection Results", ":/CrossSections16x16.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "isActive", false, "Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "isActive", false, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_intersectionResultsDefs, "IntersectionResultDefinitions", "Data Sources", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_intersectionResultsDefs, "IntersectionResultDefinitions", "Data Sources" ); m_intersectionResultsDefs.uiCapability()->setUiTreeHidden( true ); m_intersectionResultsDefs.push_back( new RimIntersectionResultDefinition ); // Add the default result definition diff --git a/ApplicationLibCode/ProjectDataModel/Parameters/RimDoubleParameter.cpp b/ApplicationLibCode/ProjectDataModel/Parameters/RimDoubleParameter.cpp index b0d0fdbae8..9c74f2f12f 100644 --- a/ApplicationLibCode/ProjectDataModel/Parameters/RimDoubleParameter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Parameters/RimDoubleParameter.cpp @@ -32,7 +32,7 @@ CAF_PDM_SOURCE_INIT( RimDoubleParameter, "DoubleParameter" ); //-------------------------------------------------------------------------------------------------- RimDoubleParameter::RimDoubleParameter() { - CAF_PDM_InitField( &m_value, "Value", 0.0, "Value", "", "", "" ); + CAF_PDM_InitField( &m_value, "Value", 0.0, "Value" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Parameters/RimGenericParameter.cpp b/ApplicationLibCode/ProjectDataModel/Parameters/RimGenericParameter.cpp index 91a24850fa..637c2608f0 100644 --- a/ApplicationLibCode/ProjectDataModel/Parameters/RimGenericParameter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Parameters/RimGenericParameter.cpp @@ -36,23 +36,23 @@ RimGenericParameter::RimGenericParameter() { CAF_PDM_InitObject( "Parameter", ":/Bullet.png", "", "" ); - CAF_PDM_InitField( &m_name, "Name", QString(), "Name", "", "", "" ); + CAF_PDM_InitField( &m_name, "Name", QString(), "Name" ); m_name.uiCapability()->setUiReadOnly( true ); m_name.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_label, "Label", QString(), "Name", "", "", "" ); + CAF_PDM_InitField( &m_label, "Label", QString(), "Name" ); m_label.uiCapability()->setUiReadOnly( true ); m_label.uiCapability()->setUiContentTextColor( RiuGuiTheme::getColorByVariableName( "textColor" ) ); - CAF_PDM_InitField( &m_description, "Description", QString(), "Description", "", "", "" ); + CAF_PDM_InitField( &m_description, "Description", QString(), "Description" ); m_description.uiCapability()->setUiReadOnly( true ); m_description.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_advanced, "Advanced", false, "Advanced", "", "", "" ); + CAF_PDM_InitField( &m_advanced, "Advanced", false, "Advanced" ); m_advanced.uiCapability()->setUiReadOnly( true ); m_advanced.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_valid, "Valid", false, "Valid", "", "", "" ); + CAF_PDM_InitField( &m_valid, "Valid", false, "Valid" ); m_valid.uiCapability()->setUiReadOnly( true ); m_valid.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Parameters/RimIntegerParameter.cpp b/ApplicationLibCode/ProjectDataModel/Parameters/RimIntegerParameter.cpp index 97c2dc1c84..90adaca711 100644 --- a/ApplicationLibCode/ProjectDataModel/Parameters/RimIntegerParameter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Parameters/RimIntegerParameter.cpp @@ -32,7 +32,7 @@ CAF_PDM_SOURCE_INIT( RimIntegerParameter, "IntegerParameter" ); //-------------------------------------------------------------------------------------------------- RimIntegerParameter::RimIntegerParameter() { - CAF_PDM_InitField( &m_value, "Value", 0, "Value", "", "", "" ); + CAF_PDM_InitField( &m_value, "Value", 0, "Value" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp index feeaadc807..a388805598 100644 --- a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp @@ -41,30 +41,30 @@ RimParameterGroup::RimParameterGroup() CAF_PDM_InitObject( "Parameter Group", ":/Bullet.png", "", "" ); uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_parameters, "Parameters", "Parameters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_parameters, "Parameters", "Parameters" ); m_parameters.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); m_parameters.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_parameters.uiCapability()->setCustomContextMenuEnabled( true ); m_parameters.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name" ); m_name.uiCapability()->setUiHidden( true ); m_name.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_label, "Label", "Label", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_label, "Label", "Label" ); m_label.uiCapability()->setUiHidden( true ); m_label.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_comment, "Comment", "Comment", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_comment, "Comment", "Comment" ); m_comment.uiCapability()->setUiHidden( true ); m_comment.uiCapability()->setUiReadOnly( true ); m_comment.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_showExpanded, "Expanded", "Expanded", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_showExpanded, "Expanded", "Expanded" ); m_showExpanded.uiCapability()->setUiHidden( true ); m_showExpanded.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_labelProxy, "LabelProxy", "Label Proxy", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_labelProxy, "LabelProxy", "Label Proxy" ); m_labelProxy.registerGetMethod( this, &RimParameterGroup::labelOrName ); m_labelProxy.uiCapability()->setUiReadOnly( true ); m_labelProxy.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Parameters/RimStringParameter.cpp b/ApplicationLibCode/ProjectDataModel/Parameters/RimStringParameter.cpp index cff206b900..5d7e1c90ea 100644 --- a/ApplicationLibCode/ProjectDataModel/Parameters/RimStringParameter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Parameters/RimStringParameter.cpp @@ -32,7 +32,7 @@ CAF_PDM_SOURCE_INIT( RimStringParameter, "StringParameter" ); //-------------------------------------------------------------------------------------------------- RimStringParameter::RimStringParameter() { - CAF_PDM_InitField( &m_value, "Value", QString(), "Value", "", "", "" ); + CAF_PDM_InitField( &m_value, "Value", QString(), "Value" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.cpp b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.cpp index 231249df9d..6f1d91aa42 100644 --- a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.cpp @@ -35,7 +35,7 @@ RimPlotTemplateFileItem::RimPlotTemplateFileItem() { CAF_PDM_InitObject( "PlotTemplateFileItem", ":/SummaryTemplate16x16.png", "Plot Template", "" ); - CAF_PDM_InitField( &m_absoluteFileName, "AbsolutePath", QString(), "Location", "", "", "" ); + CAF_PDM_InitField( &m_absoluteFileName, "AbsolutePath", QString(), "Location" ); m_absoluteFileName.uiCapability()->setUiReadOnly( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp index a5811a5e6b..9defb5d883 100644 --- a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp @@ -37,10 +37,10 @@ RimPlotTemplateFolderItem::RimPlotTemplateFolderItem() { CAF_PDM_InitObject( "PlotTemplateCollection", ":/Folder.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_folderName, "FolderName", "Folder", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_fileNames, "FileNames", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_folderName, "FolderName", "Folder" ); + CAF_PDM_InitFieldNoDefault( &m_fileNames, "FileNames", "" ); m_fileNames.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_subFolders, "SubFolders", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_subFolders, "SubFolders", "" ); m_subFolders.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp b/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp index d5f6e93dd6..83aaeb7c39 100644 --- a/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp +++ b/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp @@ -39,13 +39,13 @@ RimProcess::RimProcess() CAF_PDM_InitObject( "ResInsight Process", ":/Erase.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_command, "Command", "Command", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_command, "Command", "Command" ); m_command.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_description, "Description", "Description", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_description, "Description", "Description" ); m_description.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_id, "ID", defId, "ID", "", "", "" ); + CAF_PDM_InitField( &m_id, "ID", defId, "ID" ); m_id.uiCapability()->setUiReadOnly( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp index e47e03910f..dc77670cd8 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp @@ -68,22 +68,22 @@ Rim2dIntersectionView::Rim2dIntersectionView( void ) CAF_PDM_InitFieldNoDefault( &m_intersection, "Intersection", "Intersection", ":/CrossSection16x16.png", "", "" ); m_intersection.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend" ); m_legendConfig.uiCapability()->setUiTreeHidden( true ); m_legendConfig.uiCapability()->setUiTreeChildrenHidden( true ); m_legendConfig.xmlCapability()->disableIO(); m_legendConfig = new RimRegularLegendConfig(); - CAF_PDM_InitFieldNoDefault( &m_ternaryLegendConfig, "TernaryLegendDefinition", "Ternary Color Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ternaryLegendConfig, "TernaryLegendDefinition", "Ternary Color Legend" ); m_ternaryLegendConfig.uiCapability()->setUiTreeHidden( true ); m_ternaryLegendConfig.uiCapability()->setUiTreeChildrenHidden( true ); m_ternaryLegendConfig.xmlCapability()->disableIO(); m_ternaryLegendConfig = new RimTernaryLegendConfig(); - CAF_PDM_InitField( &m_showDefiningPoints, "ShowDefiningPoints", true, "Show Points", "", "", "" ); - CAF_PDM_InitField( &m_showAxisLines, "ShowAxisLines", false, "Show Axis Lines", "", "", "" ); + CAF_PDM_InitField( &m_showDefiningPoints, "ShowDefiningPoints", true, "Show Points" ); + CAF_PDM_InitField( &m_showAxisLines, "ShowAxisLines", false, "Show Axis Lines" ); - CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name" ); m_nameProxy.xmlCapability()->disableIO(); m_nameProxy.registerGetMethod( this, &Rim2dIntersectionView::getName ); m_nameProxy.registerSetMethod( this, &Rim2dIntersectionView::setName ); diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index c77c69eade..9120902919 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -78,24 +78,24 @@ Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig() { CAF_PDM_InitObject( "Info Box", ":/InfoBox16x16.png", "", "" ); - CAF_PDM_InitField( &m_active, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_active, "Active", true, "Active" ); m_active.uiCapability()->setUiHidden( true ); m_active = RiaPreferences::current()->showInfoBox(); - CAF_PDM_InitField( &m_showAnimProgress, "ShowAnimProgress", true, "Animation progress", "", "", "" ); - CAF_PDM_InitField( &m_showCaseInfo, "ShowInfoText", true, "Case Info", "", "", "" ); - CAF_PDM_InitField( &m_showResultInfo, "ShowResultInfo", true, "Result Info", "", "", "" ); - CAF_PDM_InitField( &m_showHistogram, "ShowHistogram", true, "Histogram", "", "", "" ); - CAF_PDM_InitField( &m_showVolumeWeightedMean, "ShowVolumeWeightedMean", true, "Mobile Volume Weighted Mean", "", "", "" ); - CAF_PDM_InitField( &m_showVersionInfo, "ShowVersionInfo", true, "Version Info", "", "", "" ); + CAF_PDM_InitField( &m_showAnimProgress, "ShowAnimProgress", true, "Animation progress" ); + CAF_PDM_InitField( &m_showCaseInfo, "ShowInfoText", true, "Case Info" ); + CAF_PDM_InitField( &m_showResultInfo, "ShowResultInfo", true, "Result Info" ); + CAF_PDM_InitField( &m_showHistogram, "ShowHistogram", true, "Histogram" ); + CAF_PDM_InitField( &m_showVolumeWeightedMean, "ShowVolumeWeightedMean", true, "Mobile Volume Weighted Mean" ); + CAF_PDM_InitField( &m_showVersionInfo, "ShowVersionInfo", true, "Version Info" ); caf::AppEnum defaultTimeRange = RimHistogramCalculator::StatisticsTimeRangeType::CURRENT_TIMESTEP; - CAF_PDM_InitField( &m_statisticsTimeRange, "StatisticsTimeRange", defaultTimeRange, "Statistics Time Range", "", "", "" ); + CAF_PDM_InitField( &m_statisticsTimeRange, "StatisticsTimeRange", defaultTimeRange, "Statistics Time Range" ); caf::AppEnum defaultCellRange = RimHistogramCalculator::StatisticsCellRangeType::VISIBLE_CELLS; - CAF_PDM_InitField( &m_statisticsCellRange, "StatisticsCellRange", defaultCellRange, "Statistics Cell Range", "", "", "" ); + CAF_PDM_InitField( &m_statisticsCellRange, "StatisticsCellRange", defaultCellRange, "Statistics Cell Range" ); m_histogramCalculator.reset( new RimHistogramCalculator ); } diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index bdf88964c9..1a8ca14ebb 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -94,25 +94,25 @@ Rim3dView::Rim3dView() RiaPreferences* preferences = RiaPreferences::current(); CVF_ASSERT( preferences ); - CAF_PDM_InitObject( "3d View", "", "", "" ); + CAF_PDM_InitObject( "3d View" ); - CAF_PDM_InitScriptableField( &m_id, "Id", -1, "View ID", "", "", "" ); + CAF_PDM_InitScriptableField( &m_id, "Id", -1, "View ID" ); m_id.registerKeywordAlias( "ViewId" ); m_id.uiCapability()->setUiReadOnly( true ); m_id.uiCapability()->setUiHidden( true ); m_id.capability()->setIOWriteable( false ); m_id.xmlCapability()->setCopyable( false ); - CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "" ); m_nameConfig = new RimViewNameConfig(); - CAF_PDM_InitField( &m_cameraPosition, "CameraPosition", cvf::Mat4d::IDENTITY, "", "", "", "" ); + CAF_PDM_InitField( &m_cameraPosition, "CameraPosition", cvf::Mat4d::IDENTITY, "" ); m_cameraPosition.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_cameraPointOfInterest, "CameraPointOfInterest", cvf::Vec3d::ZERO, "", "", "", "" ); + CAF_PDM_InitField( &m_cameraPointOfInterest, "CameraPointOfInterest", cvf::Vec3d::ZERO, "" ); m_cameraPointOfInterest.uiCapability()->setUiHidden( true ); - CAF_PDM_InitScriptableField( &isPerspectiveView, "PerspectiveProjection", true, "Perspective Projection", "", "", "" ); + CAF_PDM_InitScriptableField( &isPerspectiveView, "PerspectiveProjection", true, "Perspective Projection" ); double defaultScaleFactor = preferences->defaultScaleFactorZ(); CAF_PDM_InitScriptableField( &scaleZ, @@ -124,18 +124,18 @@ Rim3dView::Rim3dView() "" ); cvf::Color3f defBackgColor = preferences->defaultViewerBackgroundColor(); - CAF_PDM_InitScriptableField( &m_backgroundColor, "BackgroundColor", defBackgColor, "Background", "", "", "" ); + CAF_PDM_InitScriptableField( &m_backgroundColor, "BackgroundColor", defBackgColor, "Background" ); m_backgroundColor.registerKeywordAlias( "ViewBackgroundColor" ); - CAF_PDM_InitField( &maximumFrameRate, "MaximumFrameRate", 10, "Maximum Frame Rate", "", "", "" ); + CAF_PDM_InitField( &maximumFrameRate, "MaximumFrameRate", 10, "Maximum Frame Rate" ); maximumFrameRate.uiCapability()->setUiHidden( true ); - CAF_PDM_InitScriptableField( &m_currentTimeStep, "CurrentTimeStep", 0, "Current Time Step", "", "", "" ); + CAF_PDM_InitScriptableField( &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" ); CAF_PDM_InitScriptableField( &m_showGridBox, "ShowGridBox", @@ -153,11 +153,11 @@ Rim3dView::Rim3dView() "Disable light model for scalar result colors", "" ); - CAF_PDM_InitScriptableField( &m_showZScaleLabel, "ShowZScale", true, "Show Z Scale Label", "", "", "" ); + CAF_PDM_InitScriptableField( &m_showZScaleLabel, "ShowZScale", true, "Show Z Scale Label" ); - CAF_PDM_InitFieldNoDefault( &m_comparisonView, "ComparisonView", "Comparison View", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_comparisonView, "ComparisonView", "Comparison View" ); - CAF_PDM_InitFieldNoDefault( &m_fontSize, "FontSize", "Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fontSize, "FontSize", "Font Size" ); m_intersectionVizModel = new cvf::ModelBasicList; m_intersectionVizModel->setName( "CrossSectionModel" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp b/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp index 17d7dc7729..5982ea3e88 100644 --- a/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp @@ -41,17 +41,17 @@ CAF_PDM_SOURCE_INIT( RimAdvancedSnapshotExportDefinition, "MultiSnapshotDefiniti RimAdvancedSnapshotExportDefinition::RimAdvancedSnapshotExportDefinition() { // CAF_PDM_InitObject("MultiSnapshotDefinition", ":/Well.svg", "", ""); - CAF_PDM_InitObject( "MultiSnapshotDefinition", "", "", "" ); + CAF_PDM_InitObject( "MultiSnapshotDefinition" ); - CAF_PDM_InitField( &isActive, "IsActive", true, "Active", "", "", "" ); + CAF_PDM_InitField( &isActive, "IsActive", true, "Active" ); - CAF_PDM_InitFieldNoDefault( &view, "View", "View", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &view, "View", "View" ); - CAF_PDM_InitFieldNoDefault( &eclipseResultType, "EclipseResultType", "Result Type", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &selectedEclipseResults, "SelectedEclipseResults", "Properties", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &eclipseResultType, "EclipseResultType", "Result Type" ); + CAF_PDM_InitFieldNoDefault( &selectedEclipseResults, "SelectedEclipseResults", "Properties" ); - CAF_PDM_InitField( &timeStepStart, "TimeStepStart", 0, "Start Time", "", "", "" ); - CAF_PDM_InitField( &timeStepEnd, "TimeStepEnd", 0, "End Time", "", "", "" ); + CAF_PDM_InitField( &timeStepStart, "TimeStepStart", 0, "Start Time" ); + CAF_PDM_InitField( &timeStepEnd, "TimeStepEnd", 0, "End Time" ); CAF_PDM_InitField( &sliceDirection, "SnapShotDirection", @@ -61,10 +61,10 @@ RimAdvancedSnapshotExportDefinition::RimAdvancedSnapshotExportDefinition() "", "" ); - CAF_PDM_InitField( &startSliceIndex, "RangeFilterStart", 1, "Range Start", "", "", "" ); - CAF_PDM_InitField( &endSliceIndex, "RangeFilterEnd", 1, "Range End", "", "", "" ); + CAF_PDM_InitField( &startSliceIndex, "RangeFilterStart", 1, "Range Start" ); + CAF_PDM_InitField( &endSliceIndex, "RangeFilterEnd", 1, "Range End" ); - CAF_PDM_InitFieldNoDefault( &additionalCases, "AdditionalCases", "Cases", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &additionalCases, "AdditionalCases", "Cases" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimBinaryExportSettings.cpp b/ApplicationLibCode/ProjectDataModel/RimBinaryExportSettings.cpp index 6c84bf4f5f..cdcde94ed8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimBinaryExportSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimBinaryExportSettings.cpp @@ -26,12 +26,12 @@ CAF_PDM_SOURCE_INIT( RimBinaryExportSettings, "RimBinaryExportSettings" ); //-------------------------------------------------------------------------------------------------- RimBinaryExportSettings::RimBinaryExportSettings() { - CAF_PDM_InitObject( "RimBinaryExportSettings", "", "", "" ); + CAF_PDM_InitObject( "RimBinaryExportSettings" ); - CAF_PDM_InitFieldNoDefault( &fileName, "Filename", "Export Filename", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &fileName, "Filename", "Export Filename" ); fileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &eclipseKeyword, "EclipseKeyword", "Eclipse Keyword", "", "", "" ); - CAF_PDM_InitField( &undefinedValue, "UndefinedValue", 0.0, "Undefined Value", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &eclipseKeyword, "EclipseKeyword", "Eclipse Keyword" ); + CAF_PDM_InitField( &undefinedValue, "UndefinedValue", 0.0, "Undefined Value" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimCalcScript.cpp b/ApplicationLibCode/ProjectDataModel/RimCalcScript.cpp index d87393d9ae..5e44977b2a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCalcScript.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCalcScript.cpp @@ -36,7 +36,7 @@ RimCalcScript::RimCalcScript() { CAF_PDM_InitObject( "CalcScript", ":/OctaveScriptFile16x16.png", "Calc Script", "" ); - CAF_PDM_InitField( &absoluteFileName, "AbsolutePath", QString(), "Location", "", "", "" ); + CAF_PDM_InitField( &absoluteFileName, "AbsolutePath", QString(), "Location" ); absoluteFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimCase.cpp b/ApplicationLibCode/ProjectDataModel/RimCase.cpp index 138d6b0e21..ffc79c349a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCase.cpp @@ -49,24 +49,24 @@ RimCase::RimCase() { CAF_PDM_InitScriptableObjectWithNameAndComment( "Case", ":/Case48x48.png", "", "", "Case", "The ResInsight base class for Cases" ); - CAF_PDM_InitScriptableField( &caseUserDescription, "Name", QString(), "Case Name", "", "", "" ); + CAF_PDM_InitScriptableField( &caseUserDescription, "Name", QString(), "Case Name" ); caseUserDescription.registerKeywordAlias( "CaseUserDescription" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_displayNameOption, "NameSetting", "Name Setting", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_displayNameOption, "NameSetting", "Name Setting" ); - CAF_PDM_InitScriptableField( &caseId, "Id", -1, "Case ID", "", "", "" ); + CAF_PDM_InitScriptableField( &caseId, "Id", -1, "Case ID" ); caseId.registerKeywordAlias( "CaseId" ); caseId.uiCapability()->setUiReadOnly( true ); caseId.capability()->setIOWriteable( false ); - CAF_PDM_InitScriptableFieldNoDefault( &m_caseFileName, "FilePath", "Case File Name", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_caseFileName, "FilePath", "Case File Name" ); m_caseFileName.registerKeywordAlias( "CaseFileName" ); m_caseFileName.registerKeywordAlias( "GridFileName" ); m_caseFileName.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_activeFormationNames, "DefaultFormationNames", "Formation Names File", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_activeFormationNames, "DefaultFormationNames", "Formation Names File" ); - CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Time Step Filter", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Time Step Filter" ); m_timeStepFilter.uiCapability()->setUiTreeHidden( true ); m_timeStepFilter.uiCapability()->setUiTreeChildrenHidden( true ); m_timeStepFilter = new RimTimeStepFilter; diff --git a/ApplicationLibCode/ProjectDataModel/RimCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimCaseCollection.cpp index 954e08c5a5..2cf42c7fbe 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCaseCollection.cpp @@ -30,9 +30,9 @@ CAF_PDM_SOURCE_INIT( RimCaseCollection, "RimCaseCollection" ); //-------------------------------------------------------------------------------------------------- RimCaseCollection::RimCaseCollection() { - CAF_PDM_InitObject( "Derived Statistics", "", "", "" ); + CAF_PDM_InitObject( "Derived Statistics" ); - CAF_PDM_InitFieldNoDefault( &reservoirs, "Reservoirs", "Reservoirs ChildArrayField", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &reservoirs, "Reservoirs", "Reservoirs ChildArrayField" ); reservoirs.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp index 3abba416ec..9423ce05ac 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp @@ -54,14 +54,14 @@ RimCellEdgeColors::RimCellEdgeColors() { CAF_PDM_InitObject( "Cell Edge Result", ":/EdgeResult_1.png", "", "" ); - CAF_PDM_InitField( &m_enableCellEdgeColors, "EnableCellEdgeColors", true, "Enable Cell Edge Results", "", "", "" ); + CAF_PDM_InitField( &m_enableCellEdgeColors, "EnableCellEdgeColors", true, "Enable Cell Edge Results" ); - CAF_PDM_InitFieldNoDefault( &m_propertyType, "propertyType", "Property Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_propertyType, "propertyType", "Property Type" ); - CAF_PDM_InitFieldNoDefault( &m_resultVariable, "CellEdgeVariable", "Result property", "", "", "" ); - CAF_PDM_InitField( &useXVariable, "UseXVariable", true, "Use X Values", "", "", "" ); - CAF_PDM_InitField( &useYVariable, "UseYVariable", true, "Use Y Values", "", "", "" ); - CAF_PDM_InitField( &useZVariable, "UseZVariable", true, "Use Z Values", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resultVariable, "CellEdgeVariable", "Result property" ); + CAF_PDM_InitField( &useXVariable, "UseXVariable", true, "Use X Values" ); + CAF_PDM_InitField( &useYVariable, "UseYVariable", true, "Use Y Values" ); + CAF_PDM_InitField( &useZVariable, "UseZVariable", true, "Use Z Values" ); CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", ":/Legend.png", "", "" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimCheckableNamedObject.cpp b/ApplicationLibCode/ProjectDataModel/RimCheckableNamedObject.cpp index f1afe25100..367ae92fb7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCheckableNamedObject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCheckableNamedObject.cpp @@ -28,8 +28,8 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimCheckableNamedObject, "CheckableNamedObject //-------------------------------------------------------------------------------------------------- RimCheckableNamedObject::RimCheckableNamedObject( void ) { - CAF_PDM_InitScriptableObject( "Checkable object", "", "", "" ); - CAF_PDM_InitScriptableField( &m_isChecked, "IsChecked", true, "Active", "", "", "" ); + CAF_PDM_InitScriptableObject( "Checkable object" ); + CAF_PDM_InitScriptableField( &m_isChecked, "IsChecked", true, "Active" ); m_isChecked.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimCheckableObject.cpp b/ApplicationLibCode/ProjectDataModel/RimCheckableObject.cpp index c3b90cca31..ec2f6a17f7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCheckableObject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCheckableObject.cpp @@ -25,7 +25,7 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimCheckableObject, "RimCheckableObject" ); // //-------------------------------------------------------------------------------------------------- RimCheckableObject::RimCheckableObject( void ) { - CAF_PDM_InitField( &m_isChecked, "IsChecked", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_isChecked, "IsChecked", true, "Active" ); m_isChecked.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp b/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp index 004ef242b8..7942f13521 100644 --- a/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp @@ -36,9 +36,9 @@ RimColorLegend::RimColorLegend() { CAF_PDM_InitObject( "ColorLegend", ":/Legend.png", "", "" ); - CAF_PDM_InitField( &m_colorLegendName, "ColorLegendName", QString( "" ), "Color Legend Name", "", "", "" ); + CAF_PDM_InitField( &m_colorLegendName, "ColorLegendName", QString( "" ), "Color Legend Name" ); - CAF_PDM_InitFieldNoDefault( &m_colorLegendItems, "ColorLegendItems", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_colorLegendItems, "ColorLegendItems", "" ); m_colorLegendItems.uiCapability()->setUiTreeHidden( true ); setDeletable( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimColorLegendItem.cpp b/ApplicationLibCode/ProjectDataModel/RimColorLegendItem.cpp index f49a4692cc..c736bc89e5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimColorLegendItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimColorLegendItem.cpp @@ -33,17 +33,17 @@ CAF_PDM_SOURCE_INIT( RimColorLegendItem, "ColorLegendItem" ); //-------------------------------------------------------------------------------------------------- RimColorLegendItem::RimColorLegendItem() { - CAF_PDM_InitObject( "ColorLegendItem", "", "", "" ); + CAF_PDM_InitObject( "ColorLegendItem" ); - CAF_PDM_InitFieldNoDefault( &m_color, "Color", "Color", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_color, "Color", "Color" ); m_color = cvf::Color3f( cvf::Color3::ColorIdent::BLACK ); - CAF_PDM_InitField( &m_categoryValue, "CategoryValue", 0, "Category Number", "", "", "" ); + CAF_PDM_InitField( &m_categoryValue, "CategoryValue", 0, "Category Number" ); m_categoryValue.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_categoryName, "CategoryName", QString( "" ), "Category Name", "", "", "" ); + CAF_PDM_InitField( &m_categoryName, "CategoryName", QString( "" ), "Category Name" ); - CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy" ); m_nameProxy.registerGetMethod( this, &RimColorLegendItem::itemName ); m_nameProxy.uiCapability()->setUiHidden( true ); m_nameProxy.xmlCapability()->disableIO(); diff --git a/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp b/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp index c2d6a5ad3e..a9c0284551 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp @@ -55,14 +55,14 @@ RimCommandObject::~RimCommandObject() //-------------------------------------------------------------------------------------------------- RimCommandExecuteScript::RimCommandExecuteScript() { - CAF_PDM_InitFieldNoDefault( &name, "Name", "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &name, "Name", "Name" ); - CAF_PDM_InitField( &scriptText, "ScriptText", QString(), "Script Text", "", "", "" ); + CAF_PDM_InitField( &scriptText, "ScriptText", QString(), "Script Text" ); scriptText.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &isEnabled, "IsEnabled", true, "Enabled ", "", "", "" ); + CAF_PDM_InitField( &isEnabled, "IsEnabled", true, "Enabled " ); - CAF_PDM_InitField( &execute, "Execute", true, "Execute", "", "", "" ); + CAF_PDM_InitField( &execute, "Execute", true, "Execute" ); execute.xmlCapability()->disableIO(); execute.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); execute.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); @@ -193,11 +193,11 @@ void RimCommandFactory::createCommandObjects( const caf::PdmObjectGroup& se //-------------------------------------------------------------------------------------------------- RimCommandIssueFieldChanged::RimCommandIssueFieldChanged() { - CAF_PDM_InitFieldNoDefault( &commandName, "CommandName", "CommandName", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &commandName, "CommandName", "CommandName" ); - CAF_PDM_InitField( &objectName, "ObjectName", QString(), "ObjectName", "", "", "" ); - CAF_PDM_InitField( &fieldName, "FieldName", QString(), "FieldName", "", "", "" ); - CAF_PDM_InitField( &fieldValueToApply, "FieldValueToApply", QString(), "FieldValueToApply", "", "", "" ); + CAF_PDM_InitField( &objectName, "ObjectName", QString(), "ObjectName" ); + CAF_PDM_InitField( &fieldName, "FieldName", QString(), "FieldName" ); + CAF_PDM_InitField( &fieldValueToApply, "FieldValueToApply", QString(), "FieldValueToApply" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index 3dbdb1ec68..2057cb11ab 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -85,14 +85,14 @@ RimContourMapProjection::RimContourMapProjection() { CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png", "", "" ); - CAF_PDM_InitField( &m_relativeSampleSpacing, "SampleSpacing", 0.9, "Sample Spacing Factor", "", "", "" ); + CAF_PDM_InitField( &m_relativeSampleSpacing, "SampleSpacing", 0.9, "Sample Spacing Factor" ); m_relativeSampleSpacing.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_resultAggregation, "ResultAggregation", "Result Aggregation", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resultAggregation, "ResultAggregation", "Result Aggregation" ); - CAF_PDM_InitField( &m_showContourLines, "ContourLines", true, "Show Contour Lines", "", "", "" ); - CAF_PDM_InitField( &m_showContourLabels, "ContourLabels", true, "Show Contour Labels", "", "", "" ); - CAF_PDM_InitField( &m_smoothContourLines, "SmoothContourLines", true, "Smooth Contour Lines", "", "", "" ); + CAF_PDM_InitField( &m_showContourLines, "ContourLines", true, "Show Contour Lines" ); + CAF_PDM_InitField( &m_showContourLabels, "ContourLabels", true, "Show Contour Labels" ); + CAF_PDM_InitField( &m_smoothContourLines, "SmoothContourLines", true, "Smooth Contour Lines" ); setName( "Map Projection" ); nameField()->uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp index 89c44328f5..11a00f1b61 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp @@ -37,15 +37,15 @@ RimCustomObjectiveFunction::RimCustomObjectiveFunction() { CAF_PDM_InitObject( "Objective Function", ":/ObjectiveFunction.svg", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_functionTitle, "FunctionTitle", "Title", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_functionTitle, "FunctionTitle", "Title" ); m_functionTitle.registerGetMethod( this, &RimCustomObjectiveFunction::title ); m_functionTitle.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_customFunctionTitle, "CustomFunctionTitle", "Title", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_customFunctionTitle, "CustomFunctionTitle", "Title" ); - CAF_PDM_InitFieldNoDefault( &m_weights, "Weights", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_weights, "Weights", "" ); - CAF_PDM_InitFieldNoDefault( &m_objectiveFunctions, "ObjectiveFunctions", "Objective Functions", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveFunctions, "ObjectiveFunctions", "Objective Functions" ); { auto objFunc1 = new RimObjectiveFunction(); diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp index c782de6794..64b672e7a6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp @@ -32,7 +32,7 @@ RimCustomObjectiveFunctionCollection::RimCustomObjectiveFunctionCollection() { CAF_PDM_InitObject( "Custom Objective Functions", ":/ObjectiveFunctionCollection.svg", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_objectiveFunctions, "ObjectiveFunctions", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveFunctions, "ObjectiveFunctions", "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp index a08f6e2fdf..cd6caca6b8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp @@ -42,31 +42,26 @@ RimCustomObjectiveFunctionWeight::RimCustomObjectiveFunctionWeight() { CAF_PDM_InitObject( "Custom Objective Function Weight", ":/ObjectiveFunctionWeight.svg", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_title, "WeightTitle", "Title", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_title, "WeightTitle", "Title" ); m_title.registerGetMethod( this, &RimCustomObjectiveFunctionWeight::title ); - CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddressesUiField, "SelectedObjectiveSummaryVar", "Vector", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddressesUiField, "SelectedObjectiveSummaryVar", "Vector" ); m_objectiveValuesSummaryAddressesUiField.xmlCapability()->disableIO(); m_objectiveValuesSummaryAddressesUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddresses, "ObjectiveSummaryAddress", "Summary Address", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddresses, "ObjectiveSummaryAddress", "Summary Address" ); m_objectiveValuesSummaryAddresses.uiCapability()->setUiTreeHidden( true ); m_objectiveValuesSummaryAddresses.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSelectSummaryAddressPushButton, - "SelectObjectiveSummaryAddress", - "", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSelectSummaryAddressPushButton, "SelectObjectiveSummaryAddress", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_objectiveValuesSelectSummaryAddressPushButton ); m_objectiveValuesSelectSummaryAddressPushButton.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_objectiveValuesSelectSummaryAddressPushButton = false; - CAF_PDM_InitField( &m_weightValue, "WeightValue", 1.0, "Weight", "", "", "" ); + CAF_PDM_InitField( &m_weightValue, "WeightValue", 1.0, "Weight" ); m_weightValue.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_objectiveFunction, "ObjectiveFunction", "Objective Function", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveFunction, "ObjectiveFunction", "Objective Function" ); m_objectiveFunction.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); setDeletable( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index ef46fdc3a1..df5e36e92a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -96,37 +96,37 @@ RimDepthTrackPlot::RimDepthTrackPlot() m_commonDataSource.xmlCapability()->disableIO(); m_commonDataSource = new RimWellLogCurveCommonDataSource; - CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name" ); m_plotWindowTitle.xmlCapability()->setIOWritable( false ); caf::AppEnum depthType = RiaDefines::DepthTypeEnum::MEASURED_DEPTH; - CAF_PDM_InitScriptableField( &m_depthType, "DepthType", depthType, "Type", "", "", "" ); + CAF_PDM_InitScriptableField( &m_depthType, "DepthType", depthType, "Type" ); caf::AppEnum depthUnit = RiaDefines::DepthUnitType::UNIT_METER; - CAF_PDM_InitScriptableField( &m_depthUnit, "DepthUnit", depthUnit, "Unit", "", "", "" ); + CAF_PDM_InitScriptableField( &m_depthUnit, "DepthUnit", depthUnit, "Unit" ); - CAF_PDM_InitScriptableField( &m_minVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", "" ); - CAF_PDM_InitScriptableField( &m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", "" ); + CAF_PDM_InitScriptableField( &m_minVisibleDepth, "MinimumDepth", 0.0, "Min" ); + CAF_PDM_InitScriptableField( &m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max" ); m_minVisibleDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); m_maxVisibleDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableFieldNoDefault( &m_depthAxisGridVisibility, "ShowDepthGridLines", "Show Grid Lines", "", "", "" ); - CAF_PDM_InitScriptableField( &m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_depthAxisGridVisibility, "ShowDepthGridLines", "Show Grid Lines" ); + CAF_PDM_InitScriptableField( &m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale" ); m_isAutoScaleDepthEnabled.uiCapability()->setUiHidden( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_subTitleFontSize, "SubTitleFontSize", "Track Title Font Size", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_axisTitleFontSize, "AxisTitleFontSize", "Axis Title Font Size", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_axisValueFontSize, "AxisValueFontSize", "Axis Value Font Size", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_subTitleFontSize, "SubTitleFontSize", "Track Title Font Size" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_axisTitleFontSize, "AxisTitleFontSize", "Axis Title Font Size" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_axisValueFontSize, "AxisValueFontSize", "Axis Value Font Size" ); - CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "" ); m_nameConfig.uiCapability()->setUiTreeHidden( true ); m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true ); m_nameConfig = new RimWellLogPlotNameConfig(); - CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSet, "FilterEnsembleCurveSet", "Filter by Ensemble Curve Set", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_depthEqualization, "DepthEqualization", "Depth Equalization", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSet, "FilterEnsembleCurveSet", "Filter by Ensemble Curve Set" ); + CAF_PDM_InitFieldNoDefault( &m_depthEqualization, "DepthEqualization", "Depth Equalization" ); - CAF_PDM_InitFieldNoDefault( &m_plots, "Tracks", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plots, "Tracks", "" ); m_plots.uiCapability()->setUiTreeHidden( true ); auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots ); reorderability->orderChanged.connect( this, &RimDepthTrackPlot::onPlotsReordered ); diff --git a/ApplicationLibCode/ProjectDataModel/RimDialogData.cpp b/ApplicationLibCode/ProjectDataModel/RimDialogData.cpp index 9a6d6b2f05..ff9154f9e6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDialogData.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDialogData.cpp @@ -37,41 +37,38 @@ CAF_PDM_SOURCE_INIT( RimDialogData, "RimDialogData" ); //-------------------------------------------------------------------------------------------------- RimDialogData::RimDialogData() { - CAF_PDM_InitObject( "Dialog Data", "", "", "" ); + CAF_PDM_InitObject( "Dialog Data" ); - CAF_PDM_InitFieldNoDefault( &m_exportCarfin, "ExportCarfin", "Export Carfin", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_exportCarfin, "ExportCarfin", "Export Carfin" ); m_exportCarfin = new RicExportCarfinUi; - CAF_PDM_InitFieldNoDefault( &m_exportCompletionData, "ExportCompletionData", "Export Completion Data", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_exportCompletionData, "ExportCompletionData", "Export Completion Data" ); m_exportCompletionData = new RicExportCompletionDataSettingsUi(); - CAF_PDM_InitFieldNoDefault( &m_multipleFractionsData, "MultipleFractionsData", "Multiple Fractures Data", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_multipleFractionsData, "MultipleFractionsData", "Multiple Fractures Data" ); m_multipleFractionsData = new RiuCreateMultipleFractionsUi(); CAF_PDM_InitFieldNoDefault( &m_holoLenseExportToFolderData, "HoloLenseExportToFolderData", - "Holo Lens Export To Folder Data", - "", - "", - "" ); + "Holo Lens Export To Folder Data" ); m_holoLenseExportToFolderData = new RicHoloLensExportToFolderUi(); - CAF_PDM_InitFieldNoDefault( &m_exportWellPathsData, "ExportwellPathsData", "Export Well Paths Data", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_exportWellPathsData, "ExportwellPathsData", "Export Well Paths Data" ); m_exportWellPathsData = new RicExportWellPathsUi(); - CAF_PDM_InitFieldNoDefault( &m_exportLgrData, "ExportLgr", "LGR Export", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_exportLgrData, "ExportLgr", "LGR Export" ); m_exportLgrData = new RicExportLgrUi(); - CAF_PDM_InitFieldNoDefault( &m_exportSectorModelData, "ExportSectorModel", "Export Sector Model", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_exportSectorModelData, "ExportSectorModel", "Export Sector Model" ); m_exportSectorModelData = new RicExportEclipseSectorModelUi(); - CAF_PDM_InitFieldNoDefault( &m_mockModelSettings, "MockModelSettings", "Mock Model Settings", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_mockModelSettings, "MockModelSettings", "Mock Model Settings" ); m_mockModelSettings = new RimMockModelSettings(); - CAF_PDM_InitFieldNoDefault( &m_createEnsembleSurfaceUi, "CreateEnsembleSurfaceUi", "Create Ensmeble Surface Ui", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_createEnsembleSurfaceUi, "CreateEnsembleSurfaceUi", "Create Ensmeble Surface Ui" ); m_createEnsembleSurfaceUi = new RicCreateEnsembleSurfaceUi(); - CAF_PDM_InitFieldNoDefault( &m_createEnsembleWellLogUi, "CreateEnsembleWellLogUi", "Create Ensemble Well Log Ui", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_createEnsembleWellLogUi, "CreateEnsembleWellLogUi", "Create Ensemble Well Log Ui" ); m_createEnsembleWellLogUi = new RicCreateEnsembleWellLogUi(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index a9d962c6f5..5d0e147aa6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -98,23 +98,23 @@ RimEclipseCase::RimEclipseCase() "All Eclipse Views in the case" ); reservoirViews.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_matrixModelResults, "MatrixModelResults", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_matrixModelResults, "MatrixModelResults", "" ); m_matrixModelResults.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_fractureModelResults, "FractureModelResults", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fractureModelResults, "FractureModelResults", "" ); m_fractureModelResults.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_flipXAxis, "FlipXAxis", false, "Flip X Axis", "", "", "" ); - CAF_PDM_InitField( &m_flipYAxis, "FlipYAxis", false, "Flip Y Axis", "", "", "" ); + CAF_PDM_InitField( &m_flipXAxis, "FlipXAxis", false, "Flip X Axis" ); + CAF_PDM_InitField( &m_flipYAxis, "FlipYAxis", false, "Flip Y Axis" ); - CAF_PDM_InitFieldNoDefault( &m_filesContainingFaults_OBSOLETE, "CachedFileNamesContainingFaults", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filesContainingFaults_OBSOLETE, "CachedFileNamesContainingFaults", "" ); m_filesContainingFaults_OBSOLETE.uiCapability()->setUiHidden( true ); m_filesContainingFaults_OBSOLETE.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_contourMapCollection, "ContourMaps", "2d Contour Maps", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_contourMapCollection, "ContourMaps", "2d Contour Maps" ); m_contourMapCollection = new RimEclipseContourMapViewCollection; m_contourMapCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_inputPropertyCollection, "InputPropertyCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_inputPropertyCollection, "InputPropertyCollection", "" ); m_inputPropertyCollection = new RimEclipseInputPropertyCollection; m_inputPropertyCollection->parentField()->uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp index 524c453aec..ec80a5ba81 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp @@ -43,10 +43,10 @@ RimEclipseCaseCollection::RimEclipseCaseCollection( void ) { CAF_PDM_InitObject( "Grid Models", ":/Cases16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &cases, "Reservoirs", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &cases, "Reservoirs", "" ); cases.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &caseGroups, "CaseGroups", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &caseGroups, "CaseGroups", "" ); caseGroups.uiCapability()->setUiTreeHidden( true ); m_gridCollection = new RigGridManager; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp index 2073a237ae..ab85e59058 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -58,15 +58,15 @@ RimEclipseCellColors::RimEclipseCellColors() "CellColors", "Eclipse Cell Colors class" ); - CAF_PDM_InitFieldNoDefault( &obsoleteField_legendConfig, "LegendDefinition", "Color Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &obsoleteField_legendConfig, "LegendDefinition", "Color Legend" ); this->obsoleteField_legendConfig.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_legendConfigData, "ResultVarLegendDefinitionList", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfigData, "ResultVarLegendDefinitionList", "" ); - CAF_PDM_InitFieldNoDefault( &m_ternaryLegendConfig, "TernaryLegendDefinition", "Ternary Color Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ternaryLegendConfig, "TernaryLegendDefinition", "Ternary Color Legend" ); this->m_ternaryLegendConfig = new RimTernaryLegendConfig(); - CAF_PDM_InitFieldNoDefault( &m_legendConfigPtrField, "LegendDefinitionPtrField", "Color Legend PtrField", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfigPtrField, "LegendDefinitionPtrField", "Color Legend PtrField" ); // Make sure we have a created legend for the default/undefined result variable changeLegendConfig( this->resultVariable() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index 4bda551d92..0be76957e9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -64,8 +64,8 @@ RimEclipseContourMapProjection::RimEclipseContourMapProjection() { CAF_PDM_InitObject( "RimEclipseContourMapProjection", ":/2DMapProjection16x16.png", "", "" ); - CAF_PDM_InitField( &m_weightByParameter, "WeightByParameter", false, "Weight by Result Parameter", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_weightingResult, "WeightingResult", "", "", "", "" ); + CAF_PDM_InitField( &m_weightByParameter, "WeightByParameter", false, "Weight by Result Parameter" ); + CAF_PDM_InitFieldNoDefault( &m_weightingResult, "WeightingResult", "" ); m_weightingResult.uiCapability()->setUiTreeHidden( true ); m_weightingResult.uiCapability()->setUiTreeChildrenHidden( true ); m_weightingResult = new RimEclipseResultDefinition; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp index 6078b25b71..e15e27a133 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapView.cpp @@ -60,11 +60,11 @@ RimEclipseContourMapView::RimEclipseContourMapView() "EclipseContourMap", "A contour map for Eclipse cases" ); - CAF_PDM_InitFieldNoDefault( &m_contourMapProjection, "ContourMapProjection", "Contour Map Projection", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_contourMapProjection, "ContourMapProjection", "Contour Map Projection" ); m_contourMapProjection = new RimEclipseContourMapProjection(); - CAF_PDM_InitField( &m_showAxisLines, "ShowAxisLines", true, "Show Axis Lines", "", "", "" ); - CAF_PDM_InitField( &m_showScaleLegend, "ShowScaleLegend", true, "Show Scale Legend", "", "", "" ); + CAF_PDM_InitField( &m_showAxisLines, "ShowAxisLines", true, "Show Axis Lines" ); + CAF_PDM_InitField( &m_showScaleLegend, "ShowScaleLegend", true, "Show Scale Legend" ); setFaultVisParameters(); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.cpp index 5659ef0dcd..2723a57297 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.cpp @@ -37,7 +37,7 @@ RimEclipseFaultColors::RimEclipseFaultColors() { CAF_PDM_InitObject( "Fault Result", ":/draw_style_faults_24x24.png", "", "" ); - CAF_PDM_InitField( &showCustomFaultResult, "ShowCustomFaultResult", false, "Show Custom Fault Result", "", "", "" ); + CAF_PDM_InitField( &showCustomFaultResult, "ShowCustomFaultResult", false, "Show Custom Fault Result" ); showCustomFaultResult.uiCapability()->setUiHidden( true ); CAF_PDM_InitFieldNoDefault( &m_customFaultResultColors, diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseGeometrySelectionItem.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseGeometrySelectionItem.cpp index 10390aa13f..eaf7f83c60 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseGeometrySelectionItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseGeometrySelectionItem.cpp @@ -35,17 +35,12 @@ CAF_PDM_SOURCE_INIT( RimEclipseGeometrySelectionItem, "EclipseGeometrySelectionI //-------------------------------------------------------------------------------------------------- RimEclipseGeometrySelectionItem::RimEclipseGeometrySelectionItem() { - CAF_PDM_InitObject( "Eclipse Geometry Selection Item", "", "", "" ); - - CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_gridIndex, "GridIndex", "Grid Index", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_cellIndex, "CellIndex", "Cell Index", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_localIntersectionPointInDisplay, - "LocalIntersectionPoint", - "local Intersection Point", - "", - "", - "" ); + CAF_PDM_InitObject( "Eclipse Geometry Selection Item" ); + + CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" ); + CAF_PDM_InitFieldNoDefault( &m_gridIndex, "GridIndex", "Grid Index" ); + CAF_PDM_InitFieldNoDefault( &m_cellIndex, "CellIndex", "Cell Index" ); + CAF_PDM_InitFieldNoDefault( &m_localIntersectionPointInDisplay, "LocalIntersectionPoint", "local Intersection Point" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp index 5641d7641c..3c445e9082 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp @@ -56,7 +56,7 @@ RimEclipseInputCase::RimEclipseInputCase() { CAF_PDM_InitObject( "RimInputCase", ":/EclipseInput48x48.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_additionalFiles, "AdditionalFileNamesProxy", "Additional Files", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_additionalFiles, "AdditionalFileNamesProxy", "Additional Files" ); m_additionalFiles.registerGetMethod( this, &RimEclipseInputCase::additionalFiles ); m_additionalFiles.uiCapability()->setUiReadOnly( true ); m_additionalFiles.xmlCapability()->setIOWritable( false ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseInputProperty.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseInputProperty.cpp index cd1d110948..e7ae7311cd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseInputProperty.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseInputProperty.cpp @@ -54,10 +54,10 @@ RimEclipseInputProperty::RimEclipseInputProperty() { CAF_PDM_InitObject( "Input Property", ":/EclipseInput48x48.png", "", "" ); - CAF_PDM_InitField( &resultName, "ResultName", QString(), "Result Name", "", "", "" ); - CAF_PDM_InitField( &eclipseKeyword, "EclipseKeyword", QString(), "Eclipse Keyword", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &fileName, "FileName", "Filename", "", "", "" ); - CAF_PDM_InitField( &resolvedState, "ResolvedState", (ResolveStateEnum)UNKNOWN, "Data State", "", "", "" ); + CAF_PDM_InitField( &resultName, "ResultName", QString(), "Result Name" ); + CAF_PDM_InitField( &eclipseKeyword, "EclipseKeyword", QString(), "Eclipse Keyword" ); + CAF_PDM_InitFieldNoDefault( &fileName, "FileName", "Filename" ); + CAF_PDM_InitField( &resolvedState, "ResolvedState", (ResolveStateEnum)UNKNOWN, "Data State" ); resolvedState.uiCapability()->setUiReadOnly( true ); resolvedState.xmlCapability()->disableIO(); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp index 97d19a2db1..f8de3814e1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp @@ -33,7 +33,7 @@ RimEclipseInputPropertyCollection::RimEclipseInputPropertyCollection() { CAF_PDM_InitObject( "Input Properties", ":/EclipseInput48x48.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &inputProperties, "InputProperties", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &inputProperties, "InputProperties", "" ); inputProperties.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp index 47ddd6a334..5e9c980bb6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -72,11 +72,11 @@ RimEclipseResultCase::RimEclipseResultCase() { CAF_PDM_InitScriptableObject( "Eclipse Case", ":/Case48x48.png", "", "The Regular Eclipse Results Case" ); - CAF_PDM_InitFieldNoDefault( &m_unitSystem, "UnitSystem", "Unit System", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_unitSystem, "UnitSystem", "Unit System" ); m_unitSystem.registerGetMethod( RimProject::current(), &RimProject::commonUnitSystemForAllCases ); m_unitSystem.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_flowDiagSolutions, "FlowDiagSolutions", "Flow Diagnostics Solutions", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_flowDiagSolutions, "FlowDiagSolutions", "Flow Diagnostics Solutions" ); m_flowDiagSolutions.uiCapability()->setUiTreeHidden( true ); m_flowDiagSolutions.uiCapability()->setUiTreeChildrenHidden( true ); @@ -85,7 +85,7 @@ RimEclipseResultCase::RimEclipseResultCase() m_flipYAxis.xmlCapability()->setIOWritable( true ); // flipYAxis.uiCapability()->setUiHidden(true); - CAF_PDM_InitFieldNoDefault( &m_sourSimFileName, "SourSimFileName", "SourSim File Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_sourSimFileName, "SourSimFileName", "SourSim File Name" ); m_sourSimFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); #ifndef USE_HDF5 m_sourSimFileName.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp index ae47bac7df..de59e690e3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -108,10 +108,10 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe { CAF_PDM_InitScriptableObjectWithNameAndComment( "Result Definition", "", "", "", "EclipseResult", "An eclipse result definition" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_resultType, "ResultType", "Type", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_resultType, "ResultType", "Type" ); m_resultType.uiCapability()->setUiHidden( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_porosityModel, "PorosityModelType", "Porosity", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_porosityModel, "PorosityModelType", "Porosity" ); m_porosityModel.uiCapability()->setUiHidden( true ); CAF_PDM_InitScriptableField( &m_resultVariable, @@ -123,7 +123,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe "" ); m_resultVariable.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_flowSolution, "FlowDiagSolution", "Solution", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_flowSolution, "FlowDiagSolution", "Solution" ); m_flowSolution.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &m_timeLapseBaseTimestep, @@ -134,21 +134,21 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe "", "" ); - CAF_PDM_InitFieldNoDefault( &m_differenceCase, "DifferenceCase", "Difference Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_differenceCase, "DifferenceCase", "Difference Case" ); - CAF_PDM_InitField( &m_divideByCellFaceArea, "DivideByCellFaceArea", false, "Divide By Area", "", "", "" ); + CAF_PDM_InitField( &m_divideByCellFaceArea, "DivideByCellFaceArea", false, "Divide By Area" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_selectedInjectorTracers, "SelectedInjectorTracers", "Injector Tracers", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_selectedInjectorTracers, "SelectedInjectorTracers", "Injector Tracers" ); m_selectedInjectorTracers.uiCapability()->setUiHidden( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_selectedProducerTracers, "SelectedProducerTracers", "Producer Tracers", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_selectedProducerTracers, "SelectedProducerTracers", "Producer Tracers" ); m_selectedProducerTracers.uiCapability()->setUiHidden( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_selectedSouringTracers, "SelectedSouringTracers", "Tracers", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_selectedSouringTracers, "SelectedSouringTracers", "Tracers" ); m_selectedSouringTracers.uiCapability()->setUiHidden( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_flowTracerSelectionMode, "FlowTracerSelectionMode", "Tracers", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_phaseSelection, "PhaseSelection", "Phases", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_flowTracerSelectionMode, "FlowTracerSelectionMode", "Tracers" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_phaseSelection, "PhaseSelection", "Phases" ); m_phaseSelection.uiCapability()->setUiLabelPosition( m_labelPosition ); CAF_PDM_InitScriptableField( &m_showOnlyVisibleCategoriesInLegend, @@ -161,11 +161,11 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe // Ui only fields - CAF_PDM_InitFieldNoDefault( &m_resultTypeUiField, "MResultType", "Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resultTypeUiField, "MResultType", "Type" ); m_resultTypeUiField.xmlCapability()->disableIO(); m_resultTypeUiField.uiCapability()->setUiLabelPosition( m_labelPosition ); - CAF_PDM_InitFieldNoDefault( &m_porosityModelUiField, "MPorosityModelType", "Porosity", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_porosityModelUiField, "MPorosityModelType", "Porosity" ); m_porosityModelUiField.xmlCapability()->disableIO(); m_porosityModelUiField.uiCapability()->setUiLabelPosition( m_labelPosition ); @@ -180,33 +180,33 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe m_resultVariableUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); m_resultVariableUiField.uiCapability()->setUiLabelPosition( m_labelPosition ); - CAF_PDM_InitFieldNoDefault( &m_inputPropertyFileName, "InputPropertyFileName", "File Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_inputPropertyFileName, "InputPropertyFileName", "File Name" ); m_inputPropertyFileName.xmlCapability()->disableIO(); m_inputPropertyFileName.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_flowSolutionUiField, "MFlowDiagSolution", "Solution", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_flowSolutionUiField, "MFlowDiagSolution", "Solution" ); m_flowSolutionUiField.xmlCapability()->disableIO(); m_flowSolutionUiField.uiCapability()->setUiHidden( true ); // For now since there are only one to choose from - CAF_PDM_InitField( &m_syncInjectorToProducerSelection, "MSyncSelectedInjProd", false, "Add Communicators ->", "", "", "" ); + CAF_PDM_InitField( &m_syncInjectorToProducerSelection, "MSyncSelectedInjProd", false, "Add Communicators ->" ); m_syncInjectorToProducerSelection.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_syncProducerToInjectorSelection, "MSyncSelectedProdInj", false, "<- Add Communicators", "", "", "" ); + CAF_PDM_InitField( &m_syncProducerToInjectorSelection, "MSyncSelectedProdInj", false, "<- Add Communicators" ); m_syncProducerToInjectorSelection.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_selectedInjectorTracersUiField, "MSelectedInjectorTracers", "Injector Tracers", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedInjectorTracersUiField, "MSelectedInjectorTracers", "Injector Tracers" ); m_selectedInjectorTracersUiField.xmlCapability()->disableIO(); m_selectedInjectorTracersUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_selectedInjectorTracersUiField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_selectedProducerTracersUiField, "MSelectedProducerTracers", "Producer Tracers", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedProducerTracersUiField, "MSelectedProducerTracers", "Producer Tracers" ); m_selectedProducerTracersUiField.xmlCapability()->disableIO(); m_selectedProducerTracersUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_selectedProducerTracersUiField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_selectedSouringTracersUiField, "MSelectedSouringTracers", "Tracers", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedSouringTracersUiField, "MSelectedSouringTracers", "Tracers" ); m_selectedSouringTracersUiField.xmlCapability()->disableIO(); m_selectedSouringTracersUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); m_selectedSouringTracersUiField.uiCapability()->setUiLabelPosition( m_labelPosition ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index d908c7ce37..64751f2e67 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -67,25 +67,25 @@ RimEclipseStatisticsCase::RimEclipseStatisticsCase() { CAF_PDM_InitObject( "Case Group Statistics", ":/Histogram16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_calculateEditCommand, "m_editingAllowed", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_calculateEditCommand, "m_editingAllowed", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_calculateEditCommand ); m_calculateEditCommand = false; - CAF_PDM_InitField( &m_selectionSummary, "SelectionSummary", QString( "" ), "Summary of Calculation Setup", "", "", "" ); + CAF_PDM_InitField( &m_selectionSummary, "SelectionSummary", QString( "" ), "Summary of Calculation Setup" ); m_selectionSummary.xmlCapability()->disableIO(); m_selectionSummary.uiCapability()->setUiReadOnly( true ); m_selectionSummary.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); m_selectionSummary.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitScriptableFieldNoDefault( &m_resultType, "ResultType", "Result Type", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_resultType, "ResultType", "Result Type" ); m_resultType.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitScriptableFieldNoDefault( &m_porosityModel, "PorosityModel", "Porosity Model", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_porosityModel, "PorosityModel", "Porosity Model" ); m_porosityModel.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitScriptableFieldNoDefault( &m_selectedDynamicProperties, "DynamicPropertiesToCalculate", "Dyn Prop", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_selectedStaticProperties, "StaticPropertiesToCalculate", "Stat Prop", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_selectedGeneratedProperties, "GeneratedPropertiesToCalculate", "", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_selectedInputProperties, "InputPropertiesToCalculate", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_selectedDynamicProperties, "DynamicPropertiesToCalculate", "Dyn Prop" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_selectedStaticProperties, "StaticPropertiesToCalculate", "Stat Prop" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_selectedGeneratedProperties, "GeneratedPropertiesToCalculate", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_selectedInputProperties, "InputPropertiesToCalculate", "" ); CAF_PDM_InitScriptableFieldNoDefault( &m_selectedFractureDynamicProperties, "FractureDynamicPropertiesToCalculate", @@ -122,12 +122,12 @@ RimEclipseStatisticsCase::RimEclipseStatisticsCase() m_selectedFractureGeneratedProperties.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_selectedFractureInputProperties.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitScriptableField( &m_calculatePercentiles, "CalculatePercentiles", true, "Calculate Percentiles", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_percentileCalculationType, "PercentileCalculationType", "Method", "", "", "" ); + CAF_PDM_InitScriptableField( &m_calculatePercentiles, "CalculatePercentiles", true, "Calculate Percentiles" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_percentileCalculationType, "PercentileCalculationType", "Method" ); - CAF_PDM_InitScriptableField( &m_lowPercentile, "LowPercentile", 10.0, "Low", "", "", "" ); - CAF_PDM_InitScriptableField( &m_midPercentile, "MidPercentile", 50.0, "Mid", "", "", "" ); - CAF_PDM_InitScriptableField( &m_highPercentile, "HighPercentile", 90.0, "High", "", "", "" ); + CAF_PDM_InitScriptableField( &m_lowPercentile, "LowPercentile", 10.0, "Low" ); + CAF_PDM_InitScriptableField( &m_midPercentile, "MidPercentile", 50.0, "Mid" ); + CAF_PDM_InitScriptableField( &m_highPercentile, "HighPercentile", 90.0, "High" ); CAF_PDM_InitScriptableField( &m_wellDataSourceCase, "WellDataSourceCase", diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseCollection.cpp index 6281cac4cb..f414b44cf1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseCollection.cpp @@ -31,9 +31,9 @@ CAF_PDM_SOURCE_INIT( RimEclipseStatisticsCaseCollection, "RimStatisticalCollecti RimEclipseStatisticsCaseCollection::RimEclipseStatisticsCaseCollection() : PdmObject() { - CAF_PDM_InitObject( "Derived Statistics", "", "", "" ); + CAF_PDM_InitObject( "Derived Statistics" ); - CAF_PDM_InitFieldNoDefault( &cases, "Reservoirs", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &cases, "Reservoirs", "" ); cases.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index 1f4b3cf70e..12fbbd1a25 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -159,41 +159,41 @@ RimEclipseView::RimEclipseView() m_elementVectorResult = new RimElementVectorResult; m_elementVectorResult.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_faultResultSettings, "FaultResultSettings", "Fault Result", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_faultResultSettings, "FaultResultSettings", "Fault Result" ); m_faultResultSettings = new RimEclipseFaultColors(); m_faultResultSettings.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_fractureColors, "StimPlanColors", "Fracture", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fractureColors, "StimPlanColors", "Fracture" ); m_fractureColors = new RimStimPlanColors(); m_fractureColors.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_virtualPerforationResult, "VirtualPerforationResult", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_virtualPerforationResult, "VirtualPerforationResult", "" ); m_virtualPerforationResult = new RimVirtualPerforationResults(); m_virtualPerforationResult.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_wellCollection, "WellCollection", "Simulation Wells", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellCollection, "WellCollection", "Simulation Wells" ); m_wellCollection = new RimSimWellInViewCollection; m_wellCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_faultCollection, "FaultCollection", "Faults", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_faultCollection, "FaultCollection", "Faults" ); m_faultCollection = new RimFaultInViewCollection; m_faultCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_annotationCollection, "AnnotationCollection", "Annotations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_annotationCollection, "AnnotationCollection", "Annotations" ); m_annotationCollection = new RimAnnotationInViewCollection; m_annotationCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_streamlineCollection, "StreamlineCollection", "Streamlines", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_streamlineCollection, "StreamlineCollection", "Streamlines" ); m_streamlineCollection = new RimStreamlineInViewCollection(); m_streamlineCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_propertyFilterCollection, "PropertyFilters", "Property Filters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_propertyFilterCollection, "PropertyFilters", "Property Filters" ); m_propertyFilterCollection = new RimEclipsePropertyFilterCollection(); m_propertyFilterCollection.uiCapability()->setUiTreeHidden( true ); // Visualization fields - CAF_PDM_InitField( &m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells", "", "", "" ); - CAF_PDM_InitField( &m_showInvalidCells, "ShowInvalidCells", false, "Show Invalid Cells", "", "", "" ); + CAF_PDM_InitField( &m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells" ); + CAF_PDM_InitField( &m_showInvalidCells, "ShowInvalidCells", false, "Show Invalid Cells" ); CAF_PDM_InitScriptableFieldNoDefault( &m_cellResultData, "CellResultData", "", "", "", "Current Eclipse Cell Result" ); m_cellResultData.xmlCapability()->disableIO(); diff --git a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp index bdc6c455f8..b2694ad0c2 100644 --- a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp @@ -72,38 +72,35 @@ RimElementVectorResult::RimElementVectorResult() { CAF_PDM_InitObject( "Flow Vector Result", ":/CellResult.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend" ); m_legendConfig = new RimRegularLegendConfig(); m_legendConfig.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_showOil, "ShowOil", true, "Oil", "", "", "" ); - CAF_PDM_InitField( &m_showGas, "ShowGas", true, "Gas", "", "", "" ); - CAF_PDM_InitField( &m_showWater, "ShowWater", true, "Water", "", "", "" ); + CAF_PDM_InitField( &m_showOil, "ShowOil", true, "Oil" ); + CAF_PDM_InitField( &m_showGas, "ShowGas", true, "Gas" ); + CAF_PDM_InitField( &m_showWater, "ShowWater", true, "Water" ); - CAF_PDM_InitField( &m_showResult, "ShowResult", false, "", "", "", "" ); + CAF_PDM_InitField( &m_showResult, "ShowResult", false, "" ); - CAF_PDM_InitFieldNoDefault( &m_vectorView, "VectorView", "View Vectors", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_vectorView, "VectorView", "View Vectors" ); CAF_PDM_InitFieldNoDefault( &m_vectorSurfaceCrossingLocation, "VectorSurfaceCrossingLocation", - "Vectors Touching Surface", - "", - "", - "" ); + "Vectors Touching Surface" ); m_vectorSurfaceCrossingLocation.uiCapability()->setUiReadOnly( m_vectorView() == RimElementVectorResult::VectorView::CELL_CENTER_TOTAL ); - CAF_PDM_InitField( &m_showVectorI, "ShowVectorI", true, "I", "", "", "" ); - CAF_PDM_InitField( &m_showVectorJ, "ShowVectorJ", true, "J", "", "", "" ); - CAF_PDM_InitField( &m_showVectorK, "ShowVectorK", true, "K", "", "", "" ); - CAF_PDM_InitField( &m_showNncData, "ShowNncData", true, "Show NNC Data", "", "", "" ); - CAF_PDM_InitField( &m_threshold, "Threshold", 0.0f, "Threshold", "", "", "" ); + CAF_PDM_InitField( &m_showVectorI, "ShowVectorI", true, "I" ); + CAF_PDM_InitField( &m_showVectorJ, "ShowVectorJ", true, "J" ); + CAF_PDM_InitField( &m_showVectorK, "ShowVectorK", true, "K" ); + CAF_PDM_InitField( &m_showNncData, "ShowNncData", true, "Show NNC Data" ); + CAF_PDM_InitField( &m_threshold, "Threshold", 0.0f, "Threshold" ); - CAF_PDM_InitFieldNoDefault( &m_vectorColor, "VectorColor", "Color", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_vectorColor, "VectorColor", "Color" ); cvf::Color3f defaultUniformColor = cvf::Color3f::BLACK; - CAF_PDM_InitField( &m_uniformVectorColor, "UniformVectorColor", defaultUniformColor, "Uniform Vector Color", "", "", "" ); + CAF_PDM_InitField( &m_uniformVectorColor, "UniformVectorColor", defaultUniformColor, "Uniform Vector Color" ); - CAF_PDM_InitField( &m_sizeScale, "SizeScale", 1.0f, "Size Scale", "", "", "" ); + CAF_PDM_InitField( &m_sizeScale, "SizeScale", 1.0f, "Size Scale" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp index 9fa5af8421..8e3417b78c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp @@ -42,15 +42,10 @@ RimEnsembleFractureStatisticsPlot::RimEnsembleFractureStatisticsPlot() { CAF_PDM_InitObject( "Ensemble Fracture Statistics Plot", "", "", "A Plot of Ensemble Fracture Statistics" ); - CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatistics, - "EnsembleFractureStatistics", - "Ensemble Fracture Statistics", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatistics, "EnsembleFractureStatistics", "Ensemble Fracture Statistics" ); m_ensembleFractureStatistics.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_property, "Property", "Property", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_property, "Property", "Property" ); m_plotLegendsHorizontal.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp index 2d251988c2..46d758e729 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp @@ -32,7 +32,7 @@ RimEnsembleFractureStatisticsPlotCollection::RimEnsembleFractureStatisticsPlotCo { CAF_PDM_InitObject( "Ensemble Fracture Statistics Plots", ":/WellLogPlots16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatisticsPlots, "EnsembleFractureStatisticsPlots", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatisticsPlots, "EnsembleFractureStatisticsPlots", "" ); m_ensembleFractureStatisticsPlots.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp index ff71169aa7..14a879e0c8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp @@ -54,10 +54,10 @@ RimEquilibriumAxisAnnotation::RimEquilibriumAxisAnnotation() { CAF_PDM_InitObject( "Equilibrium Annotation", ":/LeftAxis16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_annotationType, "AnnotationType", "AnnotationType", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_annotationType, "AnnotationType", "AnnotationType" ); - CAF_PDM_InitFieldNoDefault( &m_sourceCase, "Associated3DCase", "Eclipse Case", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_equilNum, "m_equilNum", "equil Num", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_sourceCase, "Associated3DCase", "Eclipse Case" ); + CAF_PDM_InitFieldNoDefault( &m_equilNum, "m_equilNum", "equil Num" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimExportInputPropertySettings.cpp b/ApplicationLibCode/ProjectDataModel/RimExportInputPropertySettings.cpp index 5cebce1788..92f3445004 100644 --- a/ApplicationLibCode/ProjectDataModel/RimExportInputPropertySettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimExportInputPropertySettings.cpp @@ -26,11 +26,11 @@ CAF_PDM_SOURCE_INIT( RimExportInputSettings, "RimExportInputSettings" ); //-------------------------------------------------------------------------------------------------- RimExportInputSettings::RimExportInputSettings() { - CAF_PDM_InitObject( "RimExportInputSettings", "", "", "" ); + CAF_PDM_InitObject( "RimExportInputSettings" ); - CAF_PDM_InitFieldNoDefault( &fileName, "Filename", "Export Filename", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &fileName, "Filename", "Export Filename" ); fileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &eclipseKeyword, "Keyword", "Eclipse Keyword", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &eclipseKeyword, "Keyword", "Eclipse Keyword" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimFormationNames.cpp b/ApplicationLibCode/ProjectDataModel/RimFormationNames.cpp index 3b7aa49e9c..32f475f099 100644 --- a/ApplicationLibCode/ProjectDataModel/RimFormationNames.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimFormationNames.cpp @@ -44,7 +44,7 @@ RimFormationNames::RimFormationNames() { CAF_PDM_InitObject( "Formation Names", ":/Formations16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_formationNamesFileName, "FormationNamesFileName", "File Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_formationNamesFileName, "FormationNamesFileName", "File Name" ); m_formationNamesFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp index c9b7f26609..dea907a06f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp @@ -31,7 +31,7 @@ RimFormationNamesCollection::RimFormationNamesCollection() { CAF_PDM_InitObject( "Formations", ":/FormationCollection16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_formationNamesList, "FormationNamesList", "Formations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_formationNamesList, "FormationNamesList", "Formations" ); m_formationNamesList.uiCapability()->setUiTreeHidden( true ); setDeletable( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp index 0e3c4bfe9d..5a3b44f868 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp @@ -49,11 +49,11 @@ RimGridInfo::RimGridInfo() { CAF_PDM_InitObject( "GridInfo", ":/draw_style_meshlines_24x24.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Show Grid Cells", "", "", "" ); - CAF_PDM_InitField( &m_gridName, "GridName", QString(), "Grid Name", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Show Grid Cells" ); + CAF_PDM_InitField( &m_gridName, "GridName", QString(), "Grid Name" ); m_gridName.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_eclipseGridIndex, "GridIndex", 0, "Grid Index", "", "", "" ); + CAF_PDM_InitField( &m_eclipseGridIndex, "GridIndex", 0, "Grid Index" ); m_eclipseGridIndex.uiCapability()->setUiReadOnly( true ); } @@ -153,10 +153,10 @@ RimGridInfoCollection::RimGridInfoCollection() { CAF_PDM_InitObject( "GridInfoCollection", ":/draw_style_meshlines_24x24.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Show Grid Cells", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Show Grid Cells" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_gridInfos, "GridInfos", "Grid Infos", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_gridInfos, "GridInfos", "Grid Infos" ); m_gridInfos.uiCapability()->setUiTreeHidden( true ); } @@ -252,21 +252,21 @@ RimGridCollection::RimGridCollection() { CAF_PDM_InitObject( "Grids", ":/draw_style_meshlines_24x24.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "IsActive", true, "Show Grid Cells", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "IsActive", true, "Show Grid Cells" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_mainGrid, "MainGrid", "Main Grid", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_mainGrid, "MainGrid", "Main Grid" ); m_mainGrid = new RimGridInfo(); m_mainGrid->setUiName( "Main Grid" ); m_mainGrid->uiCapability()->setUiTreeHidden( true ); m_mainGrid->setUiIconFromResourceString( ":/MainGrid16x16.png" ); - CAF_PDM_InitFieldNoDefault( &m_persistentLgrs, "PersistentLgrs", "Persistent LGRs", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_persistentLgrs, "PersistentLgrs", "Persistent LGRs" ); m_persistentLgrs = new RimGridInfoCollection(); m_persistentLgrs->setUiName( persistentGridUiName() ); m_persistentLgrs->setUiIconFromResourceString( ":/LGR16x16.png" ); - CAF_PDM_InitFieldNoDefault( &m_temporaryLgrs, "TemporaryLgrs", "Temporary LGRs", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_temporaryLgrs, "TemporaryLgrs", "Temporary LGRs" ); m_temporaryLgrs.xmlCapability()->disableIO(); m_temporaryLgrs = new RimGridInfoCollection(); m_temporaryLgrs->setUiName( temporaryGridUiName() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp index 13a9ea8672..7195f826ba 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp @@ -53,14 +53,14 @@ RimGridStatisticsPlot::RimGridStatisticsPlot() { CAF_PDM_InitObject( "Grid Statistics Plot", ":/statistics.png", "", "A Plot of Grid Statistics" ); - CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case" ); m_case.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_timeStep, "TimeStep", -1, "Time Step", "", "", "" ); + 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_property, "Property", "Property", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_property, "Property", "Property" ); m_property = new RimEclipseResultDefinition( caf::PdmUiItemInfo::TOP ); m_property.uiCapability()->setUiTreeHidden( true ); m_property.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp index 189289375e..789e447d76 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp @@ -32,7 +32,7 @@ RimGridStatisticsPlotCollection::RimGridStatisticsPlotCollection() { CAF_PDM_InitObject( "Grid Statistics Plots", ":/WellLogPlots16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_gridStatisticsPlots, "GridStatisticsPlots", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_gridStatisticsPlots, "GridStatisticsPlots", "" ); m_gridStatisticsPlots.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp index a60e1bd5cc..8ff9fda4c0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp @@ -54,19 +54,19 @@ RimGridTimeHistoryCurve::RimGridTimeHistoryCurve() { CAF_PDM_InitObject( "Grid Time History Curve", ":/SummaryCurve16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_geometrySelectionText, "GeometrySelectionText", "Cell Reference", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geometrySelectionText, "GeometrySelectionText", "Cell Reference" ); m_geometrySelectionText.registerGetMethod( this, &RimGridTimeHistoryCurve::geometrySelectionText ); m_geometrySelectionText.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "EclipseResultDefinition", "Eclipse Result Definition", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "EclipseResultDefinition", "Eclipse Result Definition" ); m_eclipseResultDefinition.uiCapability()->setUiTreeHidden( true ); m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_geoMechResultDefinition, "GeoMechResultDefinition", "GeoMech Result Definition", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geoMechResultDefinition, "GeoMechResultDefinition", "GeoMech Result Definition" ); m_geoMechResultDefinition.uiCapability()->setUiTreeHidden( true ); m_geoMechResultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_geometrySelectionItem, "GeometrySelectionItem", "Geometry Selection", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geometrySelectionItem, "GeometrySelectionItem", "Geometry Selection" ); m_geometrySelectionItem.uiCapability()->setUiTreeHidden( true ); m_geometrySelectionItem.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridView.cpp b/ApplicationLibCode/ProjectDataModel/RimGridView.cpp index 3ee1080ac2..8f51d95cb9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridView.cpp @@ -66,53 +66,43 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimGridView, "GenericGridView" ); // Do not us //-------------------------------------------------------------------------------------------------- RimGridView::RimGridView() { - CAF_PDM_InitFieldNoDefault( &m_overrideCellFilterCollection, - "CellFiltersControlled", - "Cell Filters (controlled)", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_overrideCellFilterCollection, "CellFiltersControlled", "Cell Filters (controlled)" ); m_overrideCellFilterCollection.uiCapability()->setUiTreeHidden( true ); m_overrideCellFilterCollection.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_intersectionCollection, "CrossSections", "Intersections", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_intersectionCollection, "CrossSections", "Intersections" ); m_intersectionCollection.uiCapability()->setUiTreeHidden( true ); m_intersectionCollection = new RimIntersectionCollection(); - CAF_PDM_InitFieldNoDefault( &m_intersectionResultDefCollection, - "IntersectionResultDefColl", - "Intersection Results", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_intersectionResultDefCollection, "IntersectionResultDefColl", "Intersection Results" ); m_intersectionResultDefCollection.uiCapability()->setUiTreeHidden( true ); m_intersectionResultDefCollection = new RimIntersectionResultsDefinitionCollection; - CAF_PDM_InitFieldNoDefault( &m_surfaceResultDefCollection, "ReservoirSurfaceResultDefColl", "Surface Results", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_surfaceResultDefCollection, "ReservoirSurfaceResultDefColl", "Surface Results" ); m_surfaceResultDefCollection.uiCapability()->setUiTreeHidden( true ); m_surfaceResultDefCollection = new RimIntersectionResultsDefinitionCollection; m_surfaceResultDefCollection->uiCapability()->setUiName( "Surface Results" ); m_surfaceResultDefCollection->uiCapability()->setUiIcon( caf::IconProvider( ":/ReservoirSurface16x16.png" ) ); - CAF_PDM_InitFieldNoDefault( &m_gridCollection, "GridCollection", "GridCollection", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_gridCollection, "GridCollection", "GridCollection" ); m_gridCollection.uiCapability()->setUiTreeHidden( true ); m_gridCollection = new RimGridCollection(); m_previousGridModeMeshLinesWasFaults = false; - CAF_PDM_InitFieldNoDefault( &m_overlayInfoConfig, "OverlayInfoConfig", "Info Box", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_overlayInfoConfig, "OverlayInfoConfig", "Info Box" ); m_overlayInfoConfig = new Rim3dOverlayInfoConfig(); m_overlayInfoConfig->setReservoirView( this ); m_overlayInfoConfig.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_wellMeasurementCollection, "WellMeasurements", "Well Measurements", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellMeasurementCollection, "WellMeasurements", "Well Measurements" ); m_wellMeasurementCollection = new RimWellMeasurementInViewCollection; m_wellMeasurementCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_surfaceCollection, "SurfaceInViewCollection", "Surface Collection Field", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_surfaceCollection, "SurfaceInViewCollection", "Surface Collection Field" ); m_surfaceCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_cellFilterCollection, "RangeFilters", "Cell Filter Collection Field", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cellFilterCollection, "RangeFilters", "Cell Filter Collection Field" ); m_cellFilterCollection = new RimCellFilterCollection(); m_cellFilterCollection.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp b/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp index f497df464d..800d2b53c0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp @@ -61,21 +61,18 @@ RimIdenticalGridCaseGroup::RimIdenticalGridCaseGroup() "GridCaseGroup", "A statistics case group" ); - CAF_PDM_InitScriptableField( &name, "UserDescription", QString( "Grid Case Group" ), "Name", "", "", "" ); + CAF_PDM_InitScriptableField( &name, "UserDescription", QString( "Grid Case Group" ), "Name" ); - CAF_PDM_InitScriptableField( &groupId, "GroupId", -1, "Case Group ID", "", "", "" ); + CAF_PDM_InitScriptableField( &groupId, "GroupId", -1, "Case Group ID" ); groupId.uiCapability()->setUiReadOnly( true ); groupId.capability()->setIOWriteable( false ); CAF_PDM_InitFieldNoDefault( &statisticsCaseCollection, "StatisticsCaseCollection", - "statisticsCaseCollection ChildArrayField", - "", - "", - "" ); + "statisticsCaseCollection ChildArrayField" ); statisticsCaseCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &caseCollection, "CaseCollection", "Source Cases ChildArrayField", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &caseCollection, "CaseCollection", "Source Cases ChildArrayField" ); caseCollection.uiCapability()->setUiTreeHidden( true ); caseCollection = new RimCaseCollection; diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp index b7362f57ad..33959f1883 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp @@ -65,64 +65,56 @@ CAF_PDM_SOURCE_INIT( RimMainPlotCollection, "MainPlotCollection" ); //-------------------------------------------------------------------------------------------------- RimMainPlotCollection::RimMainPlotCollection() { - CAF_PDM_InitObject( "Plots", "", "", "" ); + CAF_PDM_InitObject( "Plots" ); - CAF_PDM_InitField( &m_show, "Show", true, "Show 2D Plot Window", "", "", "" ); + CAF_PDM_InitField( &m_show, "Show", true, "Show 2D Plot Window" ); m_show.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_wellLogPlotCollection, "WellLogPlotCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellLogPlotCollection, "WellLogPlotCollection", "" ); m_wellLogPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_rftPlotCollection, "RftPlotCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_rftPlotCollection, "RftPlotCollection", "" ); m_rftPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_pltPlotCollection, "PltPlotCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_pltPlotCollection, "PltPlotCollection", "" ); m_pltPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_summaryPlotCollection, "SummaryPlotCollection", "Summary Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryPlotCollection, "SummaryPlotCollection", "Summary Plots" ); m_summaryPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_analysisPlotCollection, "AnalysisPlotCollection", "Analysis Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_analysisPlotCollection, "AnalysisPlotCollection", "Analysis Plots" ); m_analysisPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_correlationPlotCollection, "CorrelationPlotCollection", "Correlation Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_correlationPlotCollection, "CorrelationPlotCollection", "Correlation Plots" ); m_correlationPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_summaryCrossPlotCollection, "SummaryCrossPlotCollection", "Summary Cross Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryCrossPlotCollection, "SummaryCrossPlotCollection", "Summary Cross Plots" ); m_summaryCrossPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_flowPlotCollection, "FlowPlotCollection", "Flow Diagnostics Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_flowPlotCollection, "FlowPlotCollection", "Flow Diagnostics Plots" ); m_flowPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_gridCrossPlotCollection, "Rim3dCrossPlotCollection", "3d Cross Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_gridCrossPlotCollection, "Rim3dCrossPlotCollection", "3d Cross Plots" ); m_gridCrossPlotCollection.uiCapability()->setUiTreeHidden( true ); CAF_PDM_InitFieldNoDefault( &m_saturationPressurePlotCollection, "RimSaturationPressurePlotCollection", - "Saturation Pressure Plots", - "", - "", - "" ); + "Saturation Pressure Plots" ); m_saturationPressurePlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_multiPlotCollection, "RimMultiPlotCollection", "Multi Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_multiPlotCollection, "RimMultiPlotCollection", "Multi Plots" ); m_multiPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_stimPlanModelPlotCollection, "StimPlanModelPlotCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_stimPlanModelPlotCollection, "StimPlanModelPlotCollection", "" ); m_stimPlanModelPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_vfpPlotCollection, "VfpPlotCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_vfpPlotCollection, "VfpPlotCollection", "" ); m_vfpPlotCollection.uiCapability()->setUiTreeHidden( true ); #ifdef USE_QTCHARTS - CAF_PDM_InitFieldNoDefault( &m_gridStatisticsPlotCollection, "GridStatisticsPlotCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_gridStatisticsPlotCollection, "GridStatisticsPlotCollection", "" ); m_gridStatisticsPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatisticsPlotCollection, - "EnsembleFractureStatisticsPlotCollection", - "", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatisticsPlotCollection, "EnsembleFractureStatisticsPlotCollection", "" ); m_ensembleFractureStatisticsPlotCollection.uiCapability()->setUiTreeHidden( true ); #endif diff --git a/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp index 1f17416736..3bd71ad6ff 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp @@ -32,12 +32,12 @@ CAF_PDM_XML_SOURCE_INIT( RimMdiWindowController, "MdiWindowController" ); //-------------------------------------------------------------------------------------------------- RimMdiWindowController::RimMdiWindowController() { - CAF_PDM_InitField( &m_mainWindowID, "MainWindowID", -1, "", "", "", "" ); - CAF_PDM_InitField( &m_x, "xPos", -1, "", "", "", "" ); - CAF_PDM_InitField( &m_y, "yPos", -1, "", "", "", "" ); - CAF_PDM_InitField( &m_width, "Width", -1, "", "", "", "" ); - CAF_PDM_InitField( &m_height, "Height", -1, "", "", "", "" ); - CAF_PDM_InitField( &m_isMaximized, "IsMaximized", false, "", "", "", "" ); + CAF_PDM_InitField( &m_mainWindowID, "MainWindowID", -1, "" ); + CAF_PDM_InitField( &m_x, "xPos", -1, "" ); + CAF_PDM_InitField( &m_y, "yPos", -1, "" ); + CAF_PDM_InitField( &m_width, "Width", -1, "" ); + CAF_PDM_InitField( &m_height, "Height", -1, "" ); + CAF_PDM_InitField( &m_isMaximized, "IsMaximized", false, "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMockModelSettings.cpp b/ApplicationLibCode/ProjectDataModel/RimMockModelSettings.cpp index c49bae505a..3c91978278 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMockModelSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMockModelSettings.cpp @@ -26,17 +26,17 @@ CAF_PDM_SOURCE_INIT( RimMockModelSettings, "MockModelSettings" ); //-------------------------------------------------------------------------------------------------- RimMockModelSettings::RimMockModelSettings() { - CAF_PDM_InitObject( "Mock Model Settings", "", "", "" ); + CAF_PDM_InitObject( "Mock Model Settings" ); - CAF_PDM_InitField( &cellCountX, "CellCountX", quint64( 100 ), "Cell Count X", "", "", "" ); - CAF_PDM_InitField( &cellCountY, "CellCountY", quint64( 100 ), "Cell Count Y", "", "", "" ); - CAF_PDM_InitField( &cellCountZ, "CellCountZ", quint64( 10 ), "Cell Count Z", "", "", "" ); + CAF_PDM_InitField( &cellCountX, "CellCountX", quint64( 100 ), "Cell Count X" ); + CAF_PDM_InitField( &cellCountY, "CellCountY", quint64( 100 ), "Cell Count Y" ); + CAF_PDM_InitField( &cellCountZ, "CellCountZ", quint64( 10 ), "Cell Count Z" ); - CAF_PDM_InitFieldNoDefault( &totalCellCount, "TotalCellCount", "Total Cell Count", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &totalCellCount, "TotalCellCount", "Total Cell Count" ); totalCellCount.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &resultCount, "ResultCount", quint64( 3 ), "Result Count", "", "", "" ); - CAF_PDM_InitField( &timeStepCount, "TimeStepCount", quint64( 10 ), "Time Step Count", "", "", "" ); + CAF_PDM_InitField( &resultCount, "ResultCount", quint64( 3 ), "Result Count" ); + CAF_PDM_InitField( &timeStepCount, "TimeStepCount", quint64( 10 ), "Time Step Count" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp b/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp index b0f29e0d6a..259aab97f6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp @@ -115,47 +115,47 @@ RimMudWeightWindowParameters::RimMudWeightWindowParameters( void ) caf::AppEnum defaultSourceType = RimMudWeightWindowParameters::SourceType::FIXED; - CAF_PDM_InitField( &m_wellDeviationType, "WellDeviationSourceType", defaultSourceType, "Well Deviation", "", "", "" ); - CAF_PDM_InitField( &m_wellDeviationFixed, "WellDeviationFixed", 0.0, "Fixed Well Deviation", "", "", "" ); + CAF_PDM_InitField( &m_wellDeviationType, "WellDeviationSourceType", defaultSourceType, "Well Deviation" ); + CAF_PDM_InitField( &m_wellDeviationFixed, "WellDeviationFixed", 0.0, "Fixed Well Deviation" ); m_wellDeviationFixed.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_wellDeviationAddress, "WellDeviationAddress", QString( "" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_wellDeviationAddress, "WellDeviationAddress", QString( "" ), "Value" ); m_wellDeviationAddress.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_wellAzimuthType, "WellAzimuthSourceType", defaultSourceType, "Well Azimuth", "", "", "" ); - CAF_PDM_InitField( &m_wellAzimuthFixed, "WellAzimuthFixed", 0.0, "Fixed Well Azimuth", "", "", "" ); + CAF_PDM_InitField( &m_wellAzimuthType, "WellAzimuthSourceType", defaultSourceType, "Well Azimuth" ); + CAF_PDM_InitField( &m_wellAzimuthFixed, "WellAzimuthFixed", 0.0, "Fixed Well Azimuth" ); m_wellAzimuthFixed.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_wellAzimuthAddress, "WellAzimuthAddress", QString( "" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_wellAzimuthAddress, "WellAzimuthAddress", QString( "" ), "Value" ); m_wellAzimuthAddress.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_UCSType, "UCSSourceType", defaultSourceType, "UCS [Bar]", "", "", "" ); - CAF_PDM_InitField( &m_UCSFixed, "UCSFixed", 100.0, "Fixed UCS [Bar]", "", "", "" ); + CAF_PDM_InitField( &m_UCSType, "UCSSourceType", defaultSourceType, "UCS [Bar]" ); + CAF_PDM_InitField( &m_UCSFixed, "UCSFixed", 100.0, "Fixed UCS [Bar]" ); m_UCSFixed.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_UCSAddress, "UCSAddress", QString( "" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_UCSAddress, "UCSAddress", QString( "" ), "Value" ); m_UCSAddress.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_poissonsRatioType, "PoissonsRatioSourceType", defaultSourceType, "Poisson's Ratio", "", "", "" ); - CAF_PDM_InitField( &m_poissonsRatioFixed, "PoissonsRatioFixed", 0.35, "Fixed Possion's Ratio", "", "", "" ); + CAF_PDM_InitField( &m_poissonsRatioType, "PoissonsRatioSourceType", defaultSourceType, "Poisson's Ratio" ); + CAF_PDM_InitField( &m_poissonsRatioFixed, "PoissonsRatioFixed", 0.35, "Fixed Possion's Ratio" ); m_poissonsRatioFixed.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_poissonsRatioAddress, "PoissonsRatioAddress", QString( "" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_poissonsRatioAddress, "PoissonsRatioAddress", QString( "" ), "Value" ); m_poissonsRatioAddress.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_K0_FGType, "K0_FGSourceType", defaultSourceType, "K0 FG", "", "", "" ); - CAF_PDM_InitField( &m_K0_FGFixed, "K0_FGFixed", 0.75, "Fixed K0_FG", "", "", "" ); + CAF_PDM_InitField( &m_K0_FGType, "K0_FGSourceType", defaultSourceType, "K0 FG" ); + CAF_PDM_InitField( &m_K0_FGFixed, "K0_FGFixed", 0.75, "Fixed K0_FG" ); m_K0_FGFixed.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_K0_FGAddress, "K0_FGAddress", QString( "" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_K0_FGAddress, "K0_FGAddress", QString( "" ), "Value" ); m_K0_FGAddress.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); caf::AppEnum defaultOBG0SourceType = RimMudWeightWindowParameters::SourceType::GRID; - CAF_PDM_InitField( &m_obg0Type, "obg0SourceType", defaultOBG0SourceType, "Initial Overburden Gradient", "", "", "" ); - CAF_PDM_InitField( &m_obg0Fixed, "obg0Fixed", 0.75, "Fixed Initial Overburden Gradient", "", "", "" ); + CAF_PDM_InitField( &m_obg0Type, "obg0SourceType", defaultOBG0SourceType, "Initial Overburden Gradient" ); + CAF_PDM_InitField( &m_obg0Fixed, "obg0Fixed", 0.75, "Fixed Initial Overburden Gradient" ); m_obg0Fixed.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_obg0Address, "obg0Address", QString( "" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_obg0Address, "obg0Address", QString( "" ), "Value" ); m_obg0Address.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); m_parameterFields[RimMudWeightWindowParameters::ParameterType::WELL_DEVIATION] = @@ -171,16 +171,16 @@ RimMudWeightWindowParameters::RimMudWeightWindowParameters( void ) m_parameterFields[RimMudWeightWindowParameters::ParameterType::OBG0] = std::make_tuple( &m_obg0Type, &m_obg0Fixed, &m_obg0Address ); - CAF_PDM_InitField( &m_airGap, "AirGap", 0.0, "Air Gap", "", "", "" ); + CAF_PDM_InitField( &m_airGap, "AirGap", 0.0, "Air Gap" ); - CAF_PDM_InitField( &m_shMultiplier, "SHMultiplier", 1.05, "SH Multplier for FG in Shale", "", "", "" ); + CAF_PDM_InitField( &m_shMultiplier, "SHMultiplier", 1.05, "SH Multplier for FG in Shale" ); caf::AppEnum defaultUpperLimitType = RimMudWeightWindowParameters::UpperLimitType::FG; - CAF_PDM_InitField( &m_upperLimitType, "UpperLimitType", defaultUpperLimitType, "Upper Limit Type", "", "", "" ); + CAF_PDM_InitField( &m_upperLimitType, "UpperLimitType", defaultUpperLimitType, "Upper Limit Type" ); caf::AppEnum defaultLowerLimitType = RimMudWeightWindowParameters::LowerLimitType::MAX_OF_PORE_PRESSURE_AND_SFG; - CAF_PDM_InitField( &m_lowerLimitType, "LowerLimitType", defaultLowerLimitType, "Lower Limit Type", "", "", "" ); + CAF_PDM_InitField( &m_lowerLimitType, "LowerLimitType", defaultLowerLimitType, "Lower Limit Type" ); caf::AppEnum defaultFractureGradientCalculationType = RimMudWeightWindowParameters::FractureGradientCalculationType::DERIVED_FROM_K0FG; @@ -201,11 +201,11 @@ RimMudWeightWindowParameters::RimMudWeightWindowParameters( void ) "", "Data source for Non-Reservoir Pore Pressure", "" ); - CAF_PDM_InitField( &m_userDefinedPPNonReservoir, "UserPPNonReservoir", 1.0, " Multiplier of hydrostatic PP", "", "", "" ); - CAF_PDM_InitField( &m_porePressureNonReservoirAddress, "PPNonReservoirAddress", QString( "" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_userDefinedPPNonReservoir, "UserPPNonReservoir", 1.0, " Multiplier of hydrostatic PP" ); + CAF_PDM_InitField( &m_porePressureNonReservoirAddress, "PPNonReservoirAddress", QString( "" ), "Value" ); m_porePressureNonReservoirAddress.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_referenceLayer, "ReferenceLayer", -1, "Reference Layer", "", "", "" ); + CAF_PDM_InitField( &m_referenceLayer, "ReferenceLayer", -1, "Reference Layer" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 385a7fd703..9c7c479420 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -70,24 +70,24 @@ RimMultiPlot::RimMultiPlot() { CAF_PDM_InitObject( "Multi Plot", ":/MultiPlot16x16.png", "", "" ); - CAF_PDM_InitField( &m_showPlotWindowTitle, "ShowTitleInPlot", true, "Show Title", "", "", "" ); - CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_showPlotWindowTitle, "ShowTitleInPlot", true, "Show Title" ); + CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name" ); - CAF_PDM_InitFieldNoDefault( &m_plots, "Plots", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plots, "Plots", "" ); m_plots.uiCapability()->setUiTreeHidden( true ); auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots ); reorderability->orderChanged.connect( this, &RimMultiPlot::onPlotsReordered ); - CAF_PDM_InitFieldNoDefault( &m_columnCount, "NumberOfColumns", "Number of Columns", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_rowsPerPage, "RowsPerPage", "Rows per Page", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_columnCount, "NumberOfColumns", "Number of Columns" ); + CAF_PDM_InitFieldNoDefault( &m_rowsPerPage, "RowsPerPage", "Rows per Page" ); - CAF_PDM_InitField( &m_showIndividualPlotTitles, "ShowPlotTitles", true, "Show Sub Plot Titles", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_majorTickmarkCount, "MajorTickmarkCount", "Major Tickmark Count", "", "", "" ); + CAF_PDM_InitField( &m_showIndividualPlotTitles, "ShowPlotTitles", true, "Show Sub Plot Titles" ); + CAF_PDM_InitFieldNoDefault( &m_majorTickmarkCount, "MajorTickmarkCount", "Major Tickmark Count" ); - CAF_PDM_InitFieldNoDefault( &m_subTitleFontSize, "SubTitleFontSize", "Sub Plot Title Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_subTitleFontSize, "SubTitleFontSize", "Sub Plot Title Font Size" ); m_subTitleFontSize = caf::FontTools::RelativeSize::Large; - CAF_PDM_InitField( &m_pagePreviewMode, "PagePreviewMode", false, "Page Preview Mode", "", "", "" ); + CAF_PDM_InitField( &m_pagePreviewMode, "PagePreviewMode", false, "Page Preview Mode" ); m_pagePreviewMode.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); m_pagePreviewMode.uiCapability()->setUiIconFromResourceString( ":/PagePreview16x16.png" ); m_viewer = nullptr; diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp index 100a35af56..c4142cd122 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp @@ -31,7 +31,7 @@ RimMultiPlotCollection::RimMultiPlotCollection() { CAF_PDM_InitObject( "Multi Plots", ":/MultiPlot16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_multiPlots, "MultiPlots", "Plots Reports", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_multiPlots, "MultiPlots", "Plots Reports" ); m_multiPlots.uiCapability()->setUiTreeHidden( true ); caf::PdmFieldReorderCapability::addToField( &m_multiPlots ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimMultipleLocations.cpp b/ApplicationLibCode/ProjectDataModel/RimMultipleLocations.cpp index add52a678a..b963fe023a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultipleLocations.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultipleLocations.cpp @@ -51,18 +51,18 @@ RimMultipleLocations::RimMultipleLocations() "", "", "" ); - CAF_PDM_InitField( &m_rangeStart, "RangeStart", 100.0, "Start MD", "", "", "" ); + CAF_PDM_InitField( &m_rangeStart, "RangeStart", 100.0, "Start MD" ); m_rangeStart.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_rangeEnd, "RangeEnd", 250.0, "End MD", "", "", "" ); + CAF_PDM_InitField( &m_rangeEnd, "RangeEnd", 250.0, "End MD" ); m_rangeEnd.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_rangeSpacing, "Spacing", "Spacing", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_rangeSpacing, "Spacing", "Spacing" ); m_rangeSpacing.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_rangeCount, "RangeValveCount", 10, "Number of Items", "", "", "" ); + CAF_PDM_InitField( &m_rangeCount, "RangeValveCount", 10, "Number of Items" ); - CAF_PDM_InitFieldNoDefault( &m_locations, "Locations", "Measured Depths", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_locations, "Locations", "Measured Depths" ); m_locations.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimNameConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimNameConfig.cpp index 81808817f8..fd8baa7bcf 100644 --- a/ApplicationLibCode/ProjectDataModel/RimNameConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimNameConfig.cpp @@ -33,10 +33,10 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimNameConfig, "RimCurveNameConfig" ); //-------------------------------------------------------------------------------------------------- RimNameConfig::RimNameConfig( const QString& customName ) { - CAF_PDM_InitObject( "Curve Name Generator", "", "", "" ); + CAF_PDM_InitObject( "Curve Name Generator" ); - CAF_PDM_InitFieldNoDefault( &m_customName, "CustomCurveName", "Custom Name Part", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_autoName, "AutoCurveName", "Full Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_customName, "CustomCurveName", "Custom Name Part" ); + CAF_PDM_InitFieldNoDefault( &m_autoName, "AutoCurveName", "Full Name" ); m_autoName.registerGetMethod( this, &RimNameConfig::autoName ); m_autoName.xmlCapability()->disableIO(); m_autoName.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimNamedObject.cpp b/ApplicationLibCode/ProjectDataModel/RimNamedObject.cpp index e3d06db636..46819d1939 100644 --- a/ApplicationLibCode/ProjectDataModel/RimNamedObject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimNamedObject.cpp @@ -28,8 +28,8 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimNamedObject, "NamedObject" ); // Do not use //-------------------------------------------------------------------------------------------------- RimNamedObject::RimNamedObject( void ) { - CAF_PDM_InitScriptableObject( "Named object", "", "", "" ); - CAF_PDM_InitScriptableField( &m_name, "Name", QString(), "Name", "", "", "" ); + CAF_PDM_InitScriptableObject( "Named object" ); + CAF_PDM_InitScriptableField( &m_name, "Name", QString(), "Name" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp index cad394446a..0fe12ed048 100644 --- a/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp @@ -50,8 +50,8 @@ RimObservedDataCollection::RimObservedDataCollection() { CAF_PDM_InitObject( "Observed Data", ":/Folder.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_observedDataArray, "ObservedDataArray", "", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_observedFmuRftArray, "ObservedFmuRftDataArray", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_observedDataArray, "ObservedDataArray", "" ); + CAF_PDM_InitFieldNoDefault( &m_observedFmuRftArray, "ObservedFmuRftDataArray", "" ); m_observedDataArray.uiCapability()->setUiTreeHidden( true ); m_observedFmuRftArray.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimObservedFmuRftData.cpp b/ApplicationLibCode/ProjectDataModel/RimObservedFmuRftData.cpp index 05682de84c..3b96dde244 100644 --- a/ApplicationLibCode/ProjectDataModel/RimObservedFmuRftData.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimObservedFmuRftData.cpp @@ -30,10 +30,10 @@ CAF_PDM_SOURCE_INIT( RimObservedFmuRftData, "ObservedFmuRftData" ); RimObservedFmuRftData::RimObservedFmuRftData() { CAF_PDM_InitObject( "Observed FMU Data", ":/ObservedRFTDataFile16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_directoryPath, "Directory", "Directory", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_directoryPath, "Directory", "Directory" ); m_directoryPath.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_wells, "Wells", "Wells", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wells, "Wells", "Wells" ); m_wells.xmlCapability()->disableIO(); m_wells.uiCapability()->setUiReadOnly( true ); m_wells.registerGetMethod( this, &RimObservedFmuRftData::wells ); diff --git a/ApplicationLibCode/ProjectDataModel/RimOilField.cpp b/ApplicationLibCode/ProjectDataModel/RimOilField.cpp index 73ac144baf..28671a5c03 100644 --- a/ApplicationLibCode/ProjectDataModel/RimOilField.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimOilField.cpp @@ -39,33 +39,30 @@ CAF_PDM_SOURCE_INIT( RimOilField, "ResInsightOilField" ); //-------------------------------------------------------------------------------------------------- RimOilField::RimOilField( void ) { - CAF_PDM_InitObject( "Oil Field", "", "", "" ); + CAF_PDM_InitObject( "Oil Field" ); CAF_PDM_InitFieldNoDefault( &analysisModels, "AnalysisModels", "Grid Models", ":/GridModels.png", "", "" ); CAF_PDM_InitFieldNoDefault( &geoMechModels, "GeoMechModels", "Geo Mech Models", ":/GridModels.png", "", "" ); CAF_PDM_InitFieldNoDefault( &wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &completionTemplateCollection, "CompletionTemplateCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &completionTemplateCollection, "CompletionTemplateCollection", "" ); CAF_PDM_InitFieldNoDefault( &summaryCaseMainCollection, "SummaryCaseCollection", "Summary Cases", ":/GridModels.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &formationNamesCollection, "FormationNamesCollection", "Formations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &formationNamesCollection, "FormationNamesCollection", "Formations" ); CAF_PDM_InitFieldNoDefault( &observedDataCollection, "ObservedDataCollection", "Observed Data", ":/Cases16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &annotationCollection, "AnnotationCollection", "Annotations", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &ensembleWellLogsCollection, "EnsembleWellLogsCollection", "Ensemble Well Logs", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &annotationCollection, "AnnotationCollection", "Annotations" ); + CAF_PDM_InitFieldNoDefault( &ensembleWellLogsCollection, "EnsembleWellLogsCollection", "Ensemble Well Logs" ); CAF_PDM_InitFieldNoDefault( &m_fractureTemplateCollection_OBSOLETE, "FractureDefinitionCollection", - "Defenition of Fractures", - "", - "", - "" ); + "Defenition of Fractures" ); - CAF_PDM_InitFieldNoDefault( &measurement, "Measurement", "Measurement", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &measurement, "Measurement", "Measurement" ); measurement = new RimMeasurement(); measurement.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &surfaceCollection, "SurfaceCollection", "Surfaces", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &surfaceCollection, "SurfaceCollection", "Surfaces" ); surfaceCollection = new RimSurfaceCollection(); surfaceCollection->setAsTopmostFolder(); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index f581360da8..2407194abe 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -57,8 +57,8 @@ RimPlot::RimPlot() { CAF_PDM_InitScriptableObjectWithNameAndComment( "Plot", "", "", "", "Plot", "The Abstract Base Class for all Plot Objects" ); - CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span" ); + CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisAnnotation.cpp index 1fc49e0e27..394a08ec60 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisAnnotation.cpp @@ -38,14 +38,14 @@ RimPlotAxisAnnotation::RimPlotAxisAnnotation() m_annotationType = AnnotationType::LINE; CAF_PDM_InitObject( "Plot Axis Annotation", ":/LeftAxis16x16.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_value, "Value", "Value", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name" ); + CAF_PDM_InitFieldNoDefault( &m_value, "Value", "Value" ); - CAF_PDM_InitFieldNoDefault( &m_rangeStart, "RangeStart", "Range Start", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_rangeEnd, "RangeEnd", "Range End", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_rangeStart, "RangeStart", "Range Start" ); + CAF_PDM_InitFieldNoDefault( &m_rangeEnd, "RangeEnd", "Range End" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index 1956fceb95..ecd19337be 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -62,40 +62,40 @@ RimPlotCurve::RimPlotCurve() { CAF_PDM_InitObject( "Curve", ":/WellLogCurve16x16.png", "", "" ); - CAF_PDM_InitField( &m_showCurve, "Show", true, "Show curve", "", "", "" ); + CAF_PDM_InitField( &m_showCurve, "Show", true, "Show curve" ); m_showCurve.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_curveName, "CurveName", "Curve Name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_customCurveName, "CurveDescription", "Custom Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveName, "CurveName", "Curve Name" ); + CAF_PDM_InitFieldNoDefault( &m_customCurveName, "CurveDescription", "Custom Name" ); m_customCurveName.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_legendEntryText, "LegendDescription", "Legend Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendEntryText, "LegendDescription", "Legend Name" ); m_legendEntryText.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "" ); - CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Contribute To Legend", "", "", "" ); - CAF_PDM_InitField( &m_showErrorBars, "ShowErrorBars", true, "Show Error Bars", "", "", "" ); + CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name" ); + CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Contribute To Legend" ); + CAF_PDM_InitField( &m_showErrorBars, "ShowErrorBars", true, "Show Error Bars" ); // Obsolete field: appearance configuration is moved to RimPlotCurveAppearance - CAF_PDM_InitField( &m_curveColor_OBSOLETE, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" ); + CAF_PDM_InitField( &m_curveColor_OBSOLETE, "Color", RiaColorTools::textColor3f(), "Color" ); m_curveColor_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_fillColor_OBSOLETE, "FillColor", cvf::Color3f( -1.0, -1.0, -1.0 ), "Fill Color", "", "", "" ); + CAF_PDM_InitField( &m_fillColor_OBSOLETE, "FillColor", cvf::Color3f( -1.0, -1.0, -1.0 ), "Fill Color" ); m_fillColor_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_curveThickness_OBSOLETE, "Thickness", 1, "Line Thickness", "", "", "" ); + CAF_PDM_InitField( &m_curveThickness_OBSOLETE, "Thickness", 1, "Line Thickness" ); m_curveThickness_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_curveInterpolation_OBSOLETE, "CurveInterpolation", "Interpolation", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveInterpolation_OBSOLETE, "CurveInterpolation", "Interpolation" ); m_curveInterpolation_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_lineStyle_OBSOLETE, "LineStyle", "Line Style", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_lineStyle_OBSOLETE, "LineStyle", "Line Style" ); m_lineStyle_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_fillStyle_OBSOLETE, "FillStyle", "Area Fill Style", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fillStyle_OBSOLETE, "FillStyle", "Area Fill Style" ); m_fillStyle_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_pointSymbol_OBSOLETE, "PointSymbol", "Symbol", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_pointSymbol_OBSOLETE, "PointSymbol", "Symbol" ); m_pointSymbol_OBSOLETE.xmlCapability()->setIOWritable( false ); CAF_PDM_InitField( &m_symbolEdgeColor_OBSOLETE, @@ -116,16 +116,16 @@ RimPlotCurve::RimPlotCurve() "" ); m_symbolSkipPixelDistance_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_symbolLabel_OBSOLETE, "SymbolLabel", "Symbol Label", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_symbolLabel_OBSOLETE, "SymbolLabel", "Symbol Label" ); m_symbolLabel_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_symbolSize_OBSOLETE, "SymbolSize", 6, "Symbol Size", "", "", "" ); + CAF_PDM_InitField( &m_symbolSize_OBSOLETE, "SymbolSize", 6, "Symbol Size" ); m_symbolSize_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_symbolLabelPosition_OBSOLETE, "SymbolLabelPosition", "Symbol Label Position", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_symbolLabelPosition_OBSOLETE, "SymbolLabelPosition", "Symbol Label Position" ); m_symbolLabelPosition_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_curveAppearance, "PlotCurveAppearance", "PlotCurveAppearance", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveAppearance, "PlotCurveAppearance", "PlotCurveAppearance" ); m_curveAppearance = new RimPlotCurveAppearance; m_curveAppearance.uiCapability()->setUiTreeHidden( true ); m_curveAppearance.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp index 104c9165fa..2739bb1186 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp @@ -83,19 +83,19 @@ RimPlotCurveAppearance::RimPlotCurveAppearance() , m_interpolationVisible( true ) , m_fillOptionsVisible( true ) { - CAF_PDM_InitObject( "Curve Apperance", "", "", "" ); + CAF_PDM_InitObject( "Curve Apperance" ); - CAF_PDM_InitField( &m_curveColor, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" ); - CAF_PDM_InitField( &m_fillColor, "FillColor", cvf::Color3f( -1.0, -1.0, -1.0 ), "Fill Color", "", "", "" ); + CAF_PDM_InitField( &m_curveColor, "Color", RiaColorTools::textColor3f(), "Color" ); + CAF_PDM_InitField( &m_fillColor, "FillColor", cvf::Color3f( -1.0, -1.0, -1.0 ), "Fill Color" ); - CAF_PDM_InitField( &m_curveThickness, "Thickness", 1, "Line Thickness", "", "", "" ); + CAF_PDM_InitField( &m_curveThickness, "Thickness", 1, "Line Thickness" ); m_curveThickness.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_curveInterpolation, "CurveInterpolation", "Interpolation", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_lineStyle, "LineStyle", "Line Style", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_fillStyle, "FillStyle", "Area Fill Style", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_pointSymbol, "PointSymbol", "Symbol", "", "", "" ); - CAF_PDM_InitField( &m_symbolEdgeColor, "SymbolEdgeColor", RiaColorTools::textColor3f(), "Symbol Edge Color", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveInterpolation, "CurveInterpolation", "Interpolation" ); + CAF_PDM_InitFieldNoDefault( &m_lineStyle, "LineStyle", "Line Style" ); + CAF_PDM_InitFieldNoDefault( &m_fillStyle, "FillStyle", "Area Fill Style" ); + CAF_PDM_InitFieldNoDefault( &m_pointSymbol, "PointSymbol", "Symbol" ); + CAF_PDM_InitField( &m_symbolEdgeColor, "SymbolEdgeColor", RiaColorTools::textColor3f(), "Symbol Edge Color" ); CAF_PDM_InitField( &m_symbolSkipPixelDistance, "SymbolSkipPxDist", @@ -105,10 +105,10 @@ RimPlotCurveAppearance::RimPlotCurveAppearance() "Minimum pixel distance between symbols", "" ); - CAF_PDM_InitFieldNoDefault( &m_symbolLabel, "SymbolLabel", "Symbol Label", "", "", "" ); - CAF_PDM_InitField( &m_symbolSize, "SymbolSize", 6, "Symbol Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_symbolLabel, "SymbolLabel", "Symbol Label" ); + CAF_PDM_InitField( &m_symbolSize, "SymbolSize", 6, "Symbol Size" ); - CAF_PDM_InitFieldNoDefault( &m_symbolLabelPosition, "SymbolLabelPosition", "Symbol Label Position", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_symbolLabelPosition, "SymbolLabelPosition", "Symbol Label Position" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp index 6eac612696..5b2fdac363 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp @@ -45,20 +45,20 @@ RimPlotWindow::RimPlotWindow() "PlotWindow", "The Abstract base class for all MDI Windows in the Plot Window" ); - CAF_PDM_InitScriptableField( &m_id, "Id", -1, "View ID", "", "", "" ); + CAF_PDM_InitScriptableField( &m_id, "Id", -1, "View ID" ); m_id.registerKeywordAlias( "ViewId" ); m_id.uiCapability()->setUiReadOnly( true ); m_id.uiCapability()->setUiHidden( true ); m_id.capability()->setIOWriteable( false ); m_id.xmlCapability()->setCopyable( false ); - CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" ); - CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" ); - CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", true, "Legend Orientation", "", "", "" ); + CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title" ); + CAF_PDM_InitField( &m_showPlotLegends, "ShowTrackLegends", true, "Show Legends" ); + CAF_PDM_InitField( &m_plotLegendsHorizontal, "TrackLegendsHorizontal", true, "Legend Orientation" ); m_plotLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_titleFontSize, "TitleFontSize", "Title Font Size", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_legendFontSize, "LegendDeltaFontSize", "Legend Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_titleFontSize, "TitleFontSize", "Title Font Size" ); + CAF_PDM_InitFieldNoDefault( &m_legendFontSize, "LegendDeltaFontSize", "Legend Font Size" ); m_titleFontSize = caf::FontTools::RelativeSize::XXLarge; m_legendFontSize = caf::FontTools::RelativeSize::Large; diff --git a/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp index 83e1a32c62..00f0a50efa 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp @@ -41,7 +41,7 @@ RimPltPlotCollection::RimPltPlotCollection() { CAF_PDM_InitObject( "PLT Plots", ":/WellAllocPlots16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_pltPlots, "PltPlots", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_pltPlots, "PltPlots", "" ); m_pltPlots.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index f664695598..21b9252e69 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -131,16 +131,16 @@ RimProject::RimProject( void ) { CAF_PDM_InitScriptableObjectWithNameAndComment( "Project", "", "", "", "Project", "The ResInsight Project" ); - CAF_PDM_InitField( &m_projectFileVersionString, "ProjectFileVersionString", QString( STRPRODUCTVER ), "", "", "", "" ); + CAF_PDM_InitField( &m_projectFileVersionString, "ProjectFileVersionString", QString( STRPRODUCTVER ), "" ); m_projectFileVersionString.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_globalPathList, "ReferencedExternalFiles", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_globalPathList, "ReferencedExternalFiles", "" ); m_globalPathList.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &oilFields, "OilFields", "Oil Fields", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &oilFields, "OilFields", "Oil Fields" ); oilFields.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &colorLegendCollection, "ColorLegendCollection", "Color Legend Collection", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &colorLegendCollection, "ColorLegendCollection", "Color Legend Collection" ); colorLegendCollection = new RimColorLegendCollection(); colorLegendCollection->createStandardColorLegends(); @@ -148,12 +148,12 @@ RimProject::RimProject( void ) scriptCollection.uiCapability()->setUiTreeHidden( true ); scriptCollection.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &wellPathImport, "WellPathImport", "WellPathImport", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &wellPathImport, "WellPathImport", "WellPathImport" ); wellPathImport = new RimWellPathImport(); wellPathImport.uiCapability()->setUiTreeHidden( true ); wellPathImport.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &mainPlotCollection, "MainPlotCollection", "Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &mainPlotCollection, "MainPlotCollection", "Plots" ); mainPlotCollection.uiCapability()->setUiTreeHidden( true ); CAF_PDM_InitFieldNoDefault( &viewLinkerCollection, @@ -165,46 +165,46 @@ RimProject::RimProject( void ) viewLinkerCollection.uiCapability()->setUiTreeHidden( true ); viewLinkerCollection = new RimViewLinkerCollection; - CAF_PDM_InitFieldNoDefault( &calculationCollection, "CalculationCollection", "Calculation Collection", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &calculationCollection, "CalculationCollection", "Calculation Collection" ); calculationCollection = new RimSummaryCalculationCollection; - CAF_PDM_InitFieldNoDefault( &commandObjects, "CommandObjects", "Command Objects", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &commandObjects, "CommandObjects", "Command Objects" ); // wellPathImport.uiCapability()->setUiHidden(true); - CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions" ); - CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewState, "TreeViewState", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewState, "TreeViewState", "" ); mainWindowTreeViewState.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &mainWindowCurrentModelIndexPath, "TreeViewCurrentModelIndexPath", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &mainWindowCurrentModelIndexPath, "TreeViewCurrentModelIndexPath", "" ); mainWindowCurrentModelIndexPath.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &plotWindowTreeViewState, "PlotWindowTreeViewState", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &plotWindowTreeViewState, "PlotWindowTreeViewState", "" ); plotWindowTreeViewState.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &plotWindowCurrentModelIndexPath, "PlotWindowTreeViewCurrentModelIndexPath", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &plotWindowCurrentModelIndexPath, "PlotWindowTreeViewCurrentModelIndexPath", "" ); plotWindowCurrentModelIndexPath.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_show3DWindow, "show3DWindow", true, "Show 3D Window", "", "", "" ); + CAF_PDM_InitField( &m_show3DWindow, "show3DWindow", true, "Show 3D Window" ); m_show3DWindow.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_showPlotWindow, "showPlotWindow", false, "Show Plot Window", "", "", "" ); + CAF_PDM_InitField( &m_showPlotWindow, "showPlotWindow", false, "Show Plot Window" ); m_showPlotWindow.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_subWindowsTiled3DWindow, "tiled3DWindow", false, "Tile 3D Window", "", "", "" ); + CAF_PDM_InitField( &m_subWindowsTiled3DWindow, "tiled3DWindow", false, "Tile 3D Window" ); m_subWindowsTiled3DWindow.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_subWindowsTiledPlotWindow, "tiledPlotWindow", false, "Tile Plot Window", "", "", "" ); + CAF_PDM_InitField( &m_subWindowsTiledPlotWindow, "tiledPlotWindow", false, "Tile Plot Window" ); m_subWindowsTiledPlotWindow.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_dialogData, "DialogData", "DialogData", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_dialogData, "DialogData", "DialogData" ); m_dialogData = new RimDialogData(); m_dialogData.uiCapability()->setUiTreeHidden( true ); m_dialogData.uiCapability()->setUiTreeChildrenHidden( true ); // Obsolete fields. The content is moved to OilFields and friends - CAF_PDM_InitFieldNoDefault( &casesObsolete, "Reservoirs", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &casesObsolete, "Reservoirs", "" ); RiaFieldhandleTools::disableWriteAndSetFieldHidden( &casesObsolete ); - CAF_PDM_InitFieldNoDefault( &caseGroupsObsolete, "CaseGroups", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &caseGroupsObsolete, "CaseGroups", "" ); RiaFieldhandleTools::disableWriteAndSetFieldHidden( &caseGroupsObsolete ); // Initialization @@ -216,7 +216,7 @@ RimProject::RimProject( void ) mainPlotCollection = new RimMainPlotCollection(); - CAF_PDM_InitFieldNoDefault( &m_plotTemplateFolderItem, "PlotTemplateCollection", "Plot Templates", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plotTemplateFolderItem, "PlotTemplateCollection", "Plot Templates" ); m_plotTemplateFolderItem = new RimPlotTemplateFolderItem(); m_plotTemplateFolderItem.xmlCapability()->disableIO(); diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp index d4d2d722a4..ad7161e60e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp @@ -146,7 +146,7 @@ RimRegularLegendConfig::RimRegularLegendConfig() , m_resetUserDefinedValues( false ) { CAF_PDM_InitObject( "Color Legend", ":/Legend.png", "", "" ); - CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Show Legend", "", "", "" ); + CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Show Legend" ); m_showLegend.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &m_numLevels, "NumberOfLevels", 8, "Number of Levels", "", "A hint on how many tick marks you whish.", "" ); CAF_PDM_InitField( &m_precision, @@ -175,14 +175,14 @@ RimRegularLegendConfig::RimRegularLegendConfig() m_colorRangeMode_OBSOLETE.uiCapability()->setUiHidden( true ); m_colorRangeMode_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault( &m_colorLegend, "ColorLegend", "Colors", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_colorLegend, "ColorLegend", "Colors" ); m_colorLegend = mapToColorLegend( ColorRangeEnum( ColorRangesType::NORMAL ) ); - CAF_PDM_InitField( &m_selectColorLegendButton, "selectColorLegendButton", false, "Edit", "", "", "" ); + CAF_PDM_InitField( &m_selectColorLegendButton, "selectColorLegendButton", false, "Edit" ); m_selectColorLegendButton.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); m_selectColorLegendButton.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_selectColorLegendButton.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_mappingMode, "MappingMode", MappingEnum( MappingType::LINEAR_CONTINUOUS ), "Mapping", "", "", "" ); + CAF_PDM_InitField( &m_mappingMode, "MappingMode", MappingEnum( MappingType::LINEAR_CONTINUOUS ), "Mapping" ); CAF_PDM_InitField( &m_rangeMode, "RangeType", RangeModeEnum( RangeModeType::AUTOMATIC_ALLTIMESTEPS ), @@ -199,9 +199,9 @@ RimRegularLegendConfig::RimRegularLegendConfig() "Min value of the legend (if mapping is logarithmic only positive values are valid)", "" ); - CAF_PDM_InitFieldNoDefault( &m_categoryColorMode, "CategoryColorMode", "Category Mode", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_categoryColorMode, "CategoryColorMode", "Category Mode" ); - CAF_PDM_InitField( &resultVariableName, "ResultVariableUsage", QString( "" ), "", "", "", "" ); + CAF_PDM_InitField( &resultVariableName, "ResultVariableUsage", QString( "" ), "" ); resultVariableName.uiCapability()->setUiHidden( true ); m_linDiscreteScalarMapper = new cvf::ScalarMapperDiscreteLinear; @@ -217,7 +217,7 @@ RimRegularLegendConfig::RimRegularLegendConfig() m_scalarMapperLegend = new caf::OverlayScalarMapperLegend( standardFont ); m_categoryLegend = new caf::CategoryLegend( standardFont, m_categoryMapper.p() ); - CAF_PDM_InitField( &m_resetUserDefinedValuesButton, "ResetDefaultValues", false, "Reset Default Values", "", "", "" ); + CAF_PDM_InitField( &m_resetUserDefinedValuesButton, "ResetDefaultValues", false, "Reset Default Values" ); m_resetUserDefinedValuesButton.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_resetUserDefinedValuesButton.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); diff --git a/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp b/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp index e323ea17f7..2309ac1bdb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp @@ -51,11 +51,11 @@ CAF_PDM_SOURCE_INIT( RimReservoirCellResultsStorage, "ReservoirCellResultStorage RimReservoirCellResultsStorage::RimReservoirCellResultsStorage() : m_cellResults( nullptr ) { - CAF_PDM_InitObject( "Cacher", "", "", "" ); + CAF_PDM_InitObject( "Cacher" ); - CAF_PDM_InitField( &m_resultCacheFileName, "ResultCacheFileName", QString(), "UiDummyname", "", "", "" ); + CAF_PDM_InitField( &m_resultCacheFileName, "ResultCacheFileName", QString(), "UiDummyname" ); m_resultCacheFileName.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_resultCacheMetaData, "ResultCacheEntries", "UiDummyname", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resultCacheMetaData, "ResultCacheEntries", "UiDummyname" ); m_resultCacheMetaData.uiCapability()->setUiTreeHidden( true ); } @@ -317,7 +317,7 @@ CAF_PDM_SOURCE_INIT( RimReservoirCellResultsStorageEntryInfo, "ResultStorageEntr //-------------------------------------------------------------------------------------------------- RimReservoirCellResultsStorageEntryInfo::RimReservoirCellResultsStorageEntryInfo() { - CAF_PDM_InitObject( "Cache Entry", "", "", "" ); + CAF_PDM_InitObject( "Cache Entry" ); CAF_PDM_InitField( &m_resultType, "ResultType", @@ -326,10 +326,10 @@ RimReservoirCellResultsStorageEntryInfo::RimReservoirCellResultsStorageEntryInfo "", "", "" ); - CAF_PDM_InitField( &m_resultName, "ResultName", QString(), "ResultName", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_timeStepDates, "TimeSteps", "TimeSteps", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_daysSinceSimulationStart, "DaysSinceSimulationStart", "DaysSinceSimulationStart", "", "", "" ); - CAF_PDM_InitField( &m_filePosition, "FilePositionDataStart", qint64( -1 ), "FilePositionDataStart", "", "", "" ); + CAF_PDM_InitField( &m_resultName, "ResultName", QString(), "ResultName" ); + CAF_PDM_InitFieldNoDefault( &m_timeStepDates, "TimeSteps", "TimeSteps" ); + CAF_PDM_InitFieldNoDefault( &m_daysSinceSimulationStart, "DaysSinceSimulationStart", "DaysSinceSimulationStart" ); + CAF_PDM_InitField( &m_filePosition, "FilePositionDataStart", qint64( -1 ), "FilePositionDataStart" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp index 4031611248..ee2abc3244 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp @@ -41,7 +41,7 @@ RimRftPlotCollection::RimRftPlotCollection() { CAF_PDM_InitObject( "RFT Plots", ":/RFTPlots16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_rftPlots, "RftPlots", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_rftPlots, "RftPlots", "" ); m_rftPlots.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp index 12d1f15695..9ba2ef9435 100644 --- a/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp @@ -37,13 +37,13 @@ RimScriptCollection::RimScriptCollection() { CAF_PDM_InitObject( "ScriptLocation", ":/Folder.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &directory, "ScriptDirectory", "Folder", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &calcScripts, "CalcScripts", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &directory, "ScriptDirectory", "Folder" ); + CAF_PDM_InitFieldNoDefault( &calcScripts, "CalcScripts", "" ); calcScripts.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &subDirectories, "SubDirectories", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &subDirectories, "SubDirectories", "" ); subDirectories.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_searchSubFolders, "SearchSubFolders", false, "Add Subfolders", "", "", "" ); + CAF_PDM_InitField( &m_searchSubFolders, "SearchSubFolders", false, "Add Subfolders" ); directory.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp index 6e4305cdc9..caa6eda0aa 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInView.cpp @@ -70,28 +70,28 @@ RimSimWellInView::RimSimWellInView() "SimulationWell", "An Eclipse Simulation Well" ); - CAF_PDM_InitScriptableFieldNoDefault( &name, "Name", "Name", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &name, "Name", "Name" ); name.registerKeywordAlias( "WellName" ); - CAF_PDM_InitField( &showWell, "ShowWell", true, "Show well ", "", "", "" ); + CAF_PDM_InitField( &showWell, "ShowWell", true, "Show well " ); - CAF_PDM_InitField( &showWellLabel, "ShowWellLabel", true, "Label", "", "", "" ); - CAF_PDM_InitField( &showWellHead, "ShowWellHead", true, "Well Head", "", "", "" ); - CAF_PDM_InitField( &showWellPipe, "ShowWellPipe", true, "Pipe", "", "", "" ); - CAF_PDM_InitField( &showWellSpheres, "ShowWellSpheres", false, "Spheres", "", "", "" ); - CAF_PDM_InitField( &showWellDisks, "ShowWellDisks", false, "Disks", "", "", "" ); + CAF_PDM_InitField( &showWellLabel, "ShowWellLabel", true, "Label" ); + CAF_PDM_InitField( &showWellHead, "ShowWellHead", true, "Well Head" ); + CAF_PDM_InitField( &showWellPipe, "ShowWellPipe", true, "Pipe" ); + CAF_PDM_InitField( &showWellSpheres, "ShowWellSpheres", false, "Spheres" ); + CAF_PDM_InitField( &showWellDisks, "ShowWellDisks", false, "Disks" ); - CAF_PDM_InitField( &wellHeadScaleFactor, "WellHeadScaleFactor", 1.0, "Well Head Scale", "", "", "" ); - CAF_PDM_InitField( &pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Pipe Radius Scale", "", "", "" ); - CAF_PDM_InitField( &wellPipeColor, "WellPipeColor", cvf::Color3f( 0.588f, 0.588f, 0.804f ), "Pipe Color", "", "", "" ); + CAF_PDM_InitField( &wellHeadScaleFactor, "WellHeadScaleFactor", 1.0, "Well Head Scale" ); + CAF_PDM_InitField( &pipeScaleFactor, "WellPipeRadiusScale", 1.0, "Pipe Radius Scale" ); + CAF_PDM_InitField( &wellPipeColor, "WellPipeColor", cvf::Color3f( 0.588f, 0.588f, 0.804f ), "Pipe Color" ); cvf::Color3f defaultWellDiskColor = cvf::Color3::OLIVE; - CAF_PDM_InitField( &wellDiskColor, "WellDiskColor", defaultWellDiskColor, "Disk Color", "", "", "" ); + CAF_PDM_InitField( &wellDiskColor, "WellDiskColor", defaultWellDiskColor, "Disk Color" ); - CAF_PDM_InitField( &showWellCells, "ShowWellCells", false, "Well Cells", "", "", "" ); - CAF_PDM_InitField( &showWellCellFence, "ShowWellCellFence", false, "Well Cell Fence", "", "", "" ); + CAF_PDM_InitField( &showWellCells, "ShowWellCells", false, "Well Cells" ); + CAF_PDM_InitField( &showWellCellFence, "ShowWellCellFence", false, "Well Cell Fence" ); - CAF_PDM_InitFieldNoDefault( &simwellFractureCollection, "FractureCollection", "Fractures", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &simwellFractureCollection, "FractureCollection", "Fractures" ); name.uiCapability()->setUiHidden( true ); name.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp index 86b01ca493..a1be64ed8b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -140,7 +140,7 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() { CAF_PDM_InitObject( "Simulation Wells", ":/WellCollection.png", "", "" ); - CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &isActive, "Active", true, "Active" ); isActive.uiCapability()->setUiHidden( true ); // CAF_PDM_InitField(&showWellsIntersectingVisibleCells, "ShowWellsIntersectingVisibleCells", false, "Hide Wells Not @@ -156,11 +156,11 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() // Missing Visible Cells", "", "", ""); // Appearance - CAF_PDM_InitFieldNoDefault( &m_showWellHead, "ShowWellHeadTristate", "Well Head", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_showWellLabel, "ShowWellLabelTristate", "Label", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_showWellPipe, "ShowWellPipe", "Pipe", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_showWellSpheres, "ShowWellSpheres", "Spheres", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_showWellDisks, "ShowWellDisks", "Disks", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_showWellHead, "ShowWellHeadTristate", "Well Head" ); + CAF_PDM_InitFieldNoDefault( &m_showWellLabel, "ShowWellLabelTristate", "Label" ); + CAF_PDM_InitFieldNoDefault( &m_showWellPipe, "ShowWellPipe", "Pipe" ); + CAF_PDM_InitFieldNoDefault( &m_showWellSpheres, "ShowWellSpheres", "Spheres" ); + CAF_PDM_InitFieldNoDefault( &m_showWellDisks, "ShowWellDisks", "Disks" ); m_showWellHead.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() ); m_showWellHead.xmlCapability()->disableIO(); @@ -178,25 +178,25 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() m_showWellDisks.xmlCapability()->disableIO(); // Scaling - CAF_PDM_InitField( &wellHeadScaleFactor, "WellHeadScale", 1.0, "Well Head Scale", "", "", "" ); - CAF_PDM_InitField( &pipeScaleFactor, "WellPipeRadiusScale", 0.1, "Pipe Radius Scale ", "", "", "" ); - CAF_PDM_InitField( &spheresScaleFactor, "CellCenterSphereScale", 0.2, "Sphere Radius Scale", "", "", "" ); + CAF_PDM_InitField( &wellHeadScaleFactor, "WellHeadScale", 1.0, "Well Head Scale" ); + CAF_PDM_InitField( &pipeScaleFactor, "WellPipeRadiusScale", 0.1, "Pipe Radius Scale " ); + CAF_PDM_InitField( &spheresScaleFactor, "CellCenterSphereScale", 0.2, "Sphere Radius Scale" ); // Color cvf::Color3f defWellLabelColor = RiaPreferences::current()->defaultWellLabelColor(); - CAF_PDM_InitField( &wellLabelColor, "WellLabelColor", defWellLabelColor, "Label Color", "", "", "" ); + CAF_PDM_InitField( &wellLabelColor, "WellLabelColor", defWellLabelColor, "Label Color" ); - CAF_PDM_InitField( &showConnectionStatusColors, "ShowConnectionStatusColors", true, "Color Pipe Connections", "", "", "" ); + CAF_PDM_InitField( &showConnectionStatusColors, "ShowConnectionStatusColors", true, "Color Pipe Connections" ); cvf::Color3f defaultApplyColor = cvf::Color3f::YELLOW; - CAF_PDM_InitField( &m_defaultWellPipeColor, "WellColorForApply", defaultApplyColor, "Uniform Well Color", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellPipeColors, "WellPipeColors", "Individual Pipe Colors", "", "", "" ); + CAF_PDM_InitField( &m_defaultWellPipeColor, "WellColorForApply", defaultApplyColor, "Uniform Well Color" ); + CAF_PDM_InitFieldNoDefault( &m_wellPipeColors, "WellPipeColors", "Individual Pipe Colors" ); - CAF_PDM_InitField( &pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe Vertex Count", "", "", "" ); + CAF_PDM_InitField( &pipeCrossSectionVertexCount, "WellPipeVertexCount", 12, "Pipe Vertex Count" ); pipeCrossSectionVertexCount.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum( WELLPIPE_INTERPOLATED ), "Type", "", "", "" ); + CAF_PDM_InitField( &wellPipeCoordType, "WellPipeCoordType", WellPipeCoordEnum( WELLPIPE_INTERPOLATED ), "Type" ); - CAF_PDM_InitFieldNoDefault( &m_showWellCells, "ShowWellCellsTristate", "Show Well Cells", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_showWellCells, "ShowWellCellsTristate", "Show Well Cells" ); m_showWellCells.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() ); m_showWellCells.xmlCapability()->disableIO(); @@ -208,7 +208,7 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() "", "" ); - CAF_PDM_InitField( &wellCellTransparencyLevel, "WellCellTransparency", 0.5, "Well Cell Transparency", "", "", "" ); + CAF_PDM_InitField( &wellCellTransparencyLevel, "WellCellTransparency", 0.5, "Well Cell Transparency" ); CAF_PDM_InitField( &isAutoDetectingBranches, "IsAutoDetectingBranches", true, @@ -225,23 +225,23 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() "", "" ); - CAF_PDM_InitFieldNoDefault( &wells, "Wells", "Wells", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &wells, "Wells", "Wells" ); wells.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_showWellCellFence, "ShowWellCellFenceTristate", "Show Well Cell Fence", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_showWellCellFence, "ShowWellCellFenceTristate", "Show Well Cell Fence" ); m_showWellCellFence.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() ); m_showWellCellFence.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_wellDiskSummaryCase, "WellDiskSummaryCase", "Summary Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellDiskSummaryCase, "WellDiskSummaryCase", "Summary Case" ); - CAF_PDM_InitField( &m_wellDiskQuantity, "WellDiskQuantity", QString( "WOPT" ), "Disk Quantity", "", "", "" ); + CAF_PDM_InitField( &m_wellDiskQuantity, "WellDiskQuantity", QString( "WOPT" ), "Disk Quantity" ); m_wellDiskQuantity.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); m_wellDiskQuantity.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault( &m_wellDiskPropertyType, "WellDiskPropertyType", "Property Type", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellDiskPropertyConfigType, "WellDiskPropertyConfigType", "Property Config Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellDiskPropertyType, "WellDiskPropertyType", "Property Type" ); + CAF_PDM_InitFieldNoDefault( &m_wellDiskPropertyConfigType, "WellDiskPropertyConfigType", "Property Config Type" ); - CAF_PDM_InitField( &m_wellDiskShowQuantityLabels, "WellDiskShowQuantityLabels", true, "Show Quantity Labels", "", "", "" ); + CAF_PDM_InitField( &m_wellDiskShowQuantityLabels, "WellDiskShowQuantityLabels", true, "Show Quantity Labels" ); CAF_PDM_InitField( &m_wellDiskshowLabelsBackground, "WellDiskShowLabelsBackground", false, @@ -249,11 +249,11 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() "", "", "" ); - CAF_PDM_InitField( &m_wellDiskScaleFactor, "WellDiskScaleFactor", 1.0, "Scale Factor", "", "", "" ); + CAF_PDM_InitField( &m_wellDiskScaleFactor, "WellDiskScaleFactor", 1.0, "Scale Factor" ); cvf::Color3f defaultWellDiskColor = cvf::Color3::OLIVE; - CAF_PDM_InitField( &wellDiskColor, "WellDiskColor", defaultWellDiskColor, "Well Disk Color", "", "", "" ); + CAF_PDM_InitField( &wellDiskColor, "WellDiskColor", defaultWellDiskColor, "Well Disk Color" ); - CAF_PDM_InitField( &m_showWellCommunicationLines, "ShowWellCommunicationLines", false, "Communication Lines", "", "", "" ); + CAF_PDM_InitField( &m_showWellCommunicationLines, "ShowWellCommunicationLines", false, "Communication Lines" ); m_reservoirView = nullptr; } diff --git a/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp index c63229c8fe..ca893d5786 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp @@ -30,8 +30,8 @@ RimStackablePlotCurve::RimStackablePlotCurve() { CAF_PDM_InitObject( "StackableCurve", ":/WellLogCurve16x16.png", "", "" ); - CAF_PDM_InitField( &m_isStacked, "StackCurve", false, "Stack Curve", "", "", "" ); - CAF_PDM_InitField( &m_isStackedWithPhaseColors, "StackPhaseColors", false, " with Phase Colors", "", "", "" ); + CAF_PDM_InitField( &m_isStacked, "StackCurve", false, "Stack Curve" ); + CAF_PDM_InitField( &m_isStackedWithPhaseColors, "StackPhaseColors", false, " with Phase Colors" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp index 2092f656dd..88b51cec62 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp @@ -80,18 +80,18 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimStatisticsPlot, "StatisticsPlot" ); //-------------------------------------------------------------------------------------------------- RimStatisticsPlot::RimStatisticsPlot() { - CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name" ); m_plotWindowTitle.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_numHistogramBins, "NumHistogramBins", 50, "Number of Bins", "", "", "" ); + CAF_PDM_InitField( &m_numHistogramBins, "NumHistogramBins", 50, "Number of Bins" ); m_numHistogramBins.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_histogramBarColor, "HistogramBarColor", cvf::Color3f( cvf::Color3f::SKY_BLUE ), "Color", "", "", "" ); + CAF_PDM_InitField( &m_histogramBarColor, "HistogramBarColor", cvf::Color3f( cvf::Color3f::SKY_BLUE ), "Color" ); - CAF_PDM_InitField( &m_histogramGapWidth, "HistogramGapWidth", 0.0, "Gap Width [%]", "", "", "" ); + CAF_PDM_InitField( &m_histogramGapWidth, "HistogramGapWidth", 0.0, "Gap Width [%]" ); m_histogramGapWidth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_histogramFrequencyType, "HistogramFrequencyType", "Frequency", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_histogramFrequencyType, "HistogramFrequencyType", "Frequency" ); CAF_PDM_InitField( &m_precision, "Precision", @@ -108,7 +108,7 @@ RimStatisticsPlot::RimStatisticsPlot() "", "" ); - CAF_PDM_InitFieldNoDefault( &m_graphType, "GraphType", "Graph Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_graphType, "GraphType", "Graph Type" ); m_plotLegendsHorizontal.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp index 848eb4d79e..65f9cd87a6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp @@ -64,16 +64,16 @@ RimStimPlanColors::RimStimPlanColors() { CAF_PDM_InitObject( "Fractures", ":/FractureSymbol16x16.png", "", "" ); - CAF_PDM_InitField( &m_resultNameAndUnit, "ResultName", QString( "" ), "Result Variable", "", "", "" ); + CAF_PDM_InitField( &m_resultNameAndUnit, "ResultName", QString( "" ), "Result Variable" ); - CAF_PDM_InitField( &m_defaultColor, "DefaultColor", cvf::Color3f( cvf::Color3::BROWN ), "Default Color", "", "", "" ); + CAF_PDM_InitField( &m_defaultColor, "DefaultColor", cvf::Color3f( cvf::Color3::BROWN ), "Default Color" ); - CAF_PDM_InitFieldNoDefault( &m_legendConfigurations, "LegendConfigurations", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfigurations, "LegendConfigurations", "" ); m_legendConfigurations.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_showStimPlanMesh, "ShowStimPlanMesh", true, "Show Mesh", "", "", "" ); + CAF_PDM_InitField( &m_showStimPlanMesh, "ShowStimPlanMesh", true, "Show Mesh" ); - CAF_PDM_InitFieldNoDefault( &m_stimPlanCellVizMode, "StimPlanCellVizMode", "Color Interpolation", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_stimPlanCellVizMode, "StimPlanCellVizMode", "Color Interpolation" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.cpp index 147c683c91..ee7f8ab13e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.cpp @@ -32,10 +32,10 @@ RimStimPlanLegendConfig::RimStimPlanLegendConfig() { CAF_PDM_InitObject( "StimPlan Color Legend", ":/Legend.png", "", "" ); - CAF_PDM_InitField( &m_name, "Name", QString( "StimPlan Legend" ), "Name", "", "", "" ); + CAF_PDM_InitField( &m_name, "Name", QString( "StimPlan Legend" ), "Name" ); m_name.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_legend, "Legend", "Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legend, "Legend", "Legend" ); m_legend = new RimRegularLegendConfig; } diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp index 9f0ff3c035..629ff23e71 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp @@ -49,20 +49,20 @@ RimSummaryCalculation::RimSummaryCalculation() { CAF_PDM_InitObject( "RimSummaryCalculation", ":/octave.png", "Calculation", "" ); - CAF_PDM_InitFieldNoDefault( &m_description, "Description", "Description", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_description, "Description", "Description" ); m_description.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_expression, "Expression", QString( "" ), "Expression", "", "", "" ); + CAF_PDM_InitField( &m_expression, "Expression", QString( "" ), "Expression" ); m_expression.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_unit, "Unit", QString( "" ), "Unit", "", "", "" ); + CAF_PDM_InitField( &m_unit, "Unit", QString( "" ), "Unit" ); m_unit.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_variables, "Variables", "Variables", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_calculatedValues, "CalculatedValues", "Calculated Values", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_variables, "Variables", "Variables" ); + CAF_PDM_InitFieldNoDefault( &m_calculatedValues, "CalculatedValues", "Calculated Values" ); - CAF_PDM_InitFieldNoDefault( &m_timesteps, "TimeSteps", "Time Steps", "", "", "" ); - CAF_PDM_InitField( &m_id, "Id", -1, "Id", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timesteps, "TimeSteps", "Time Steps" ); + CAF_PDM_InitField( &m_id, "Id", -1, "Id" ); m_id.uiCapability()->setUiHidden( true ); m_exprContextMenuMgr = std::unique_ptr( new RiuExpressionContextMenuManager() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp index 9eea83a04d..a5da0c5009 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp @@ -33,10 +33,10 @@ RimSummaryCalculationCollection::RimSummaryCalculationCollection() { CAF_PDM_InitObject( "Calculation Collection", ":/chain.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_calculations, "Calculations", "Calculations", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_calculations, "Calculations", "Calculations" ); m_calculations.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_calcuationSummaryCase, "CalculationsSummaryCase", "Calculations Summary Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_calcuationSummaryCase, "CalculationsSummaryCase", "Calculations Summary Case" ); m_calcuationSummaryCase.xmlCapability()->disableIO(); m_calcuationSummaryCase = new RimCalculatedSummaryCase; } diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp index 4edc08575e..f780bdc06a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp @@ -43,20 +43,20 @@ RimSummaryCalculationVariable::RimSummaryCalculationVariable() { CAF_PDM_InitObject( "RimSummaryCalculationVariable", ":/octave.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_name, "VariableName", "Variable Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_name, "VariableName", "Variable Name" ); m_name.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_button, "PushButton", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_button, "PushButton", "" ); m_button.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_button.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_summaryAddressUi, "SummaryAddressUi", "Summary Address", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryAddressUi, "SummaryAddressUi", "Summary Address" ); m_summaryAddressUi.registerGetMethod( this, &RimSummaryCalculationVariable::summaryAddressDisplayString ); m_summaryAddressUi.xmlCapability()->disableIO(); m_summaryAddressUi.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_case, "SummaryCase", "Summary Case", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_summaryAddress, "SummaryAddress", "Summary Address", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "SummaryCase", "Summary Case" ); + CAF_PDM_InitFieldNoDefault( &m_summaryAddress, "SummaryAddress", "Summary Address" ); m_summaryAddress = new RimSummaryAddress; } diff --git a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp index 9aea996cff..4deb4e8a1b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp @@ -46,13 +46,13 @@ RimSurfaceIntersectionBand::RimSurfaceIntersectionBand() { CAF_PDM_InitObject( "SurfaceIntersectionBand", ":/ReservoirSurface16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_lineAppearance, "LineAppearance", "Line Appearance", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_lineAppearance, "LineAppearance", "Line Appearance" ); m_lineAppearance = new RimAnnotationLineAppearance; m_lineAppearance->objectChanged.connect( this, &RimSurfaceIntersectionBand::onObjectChanged ); uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_bandColor, "BandColor", cvf::Color3f( cvf::Color3f::BLACK ), "Band Color", "", "", "" ); - CAF_PDM_InitField( &m_bandOpacity, "BandOpacity", 0.8, "Band Opacity", "", "", "" ); + CAF_PDM_InitField( &m_bandColor, "BandColor", cvf::Color3f( cvf::Color3f::BLACK ), "Band Color" ); + CAF_PDM_InitField( &m_bandOpacity, "BandOpacity", 0.8, "Band Opacity" ); m_bandOpacity.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); CAF_PDM_InitField( &m_bandPolygonOffsetUnit, @@ -64,10 +64,10 @@ RimSurfaceIntersectionBand::RimSurfaceIntersectionBand() "" ); m_bandPolygonOffsetUnit.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_surfaces, "Surfaces", "Band Surfaces", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_surfaces, "Surfaces", "Band Surfaces" ); m_surfaces.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name" ); m_nameProxy.registerGetMethod( this, &RimSurfaceIntersectionBand::objectName ); m_nameProxy.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCollection.cpp index a81d302369..87f2c06d56 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCollection.cpp @@ -29,10 +29,10 @@ CAF_PDM_SOURCE_INIT( RimSurfaceIntersectionCollection, "RimSurfaceIntersectionCo RimSurfaceIntersectionCollection::RimSurfaceIntersectionCollection() : objectChanged( this ) { - CAF_PDM_InitObject( "SurfaceIntersectionCollection_msj", "", "", "" ); + CAF_PDM_InitObject( "SurfaceIntersectionCollection_msj" ); - CAF_PDM_InitFieldNoDefault( &m_intersectionBands, "IntersectionBands", "Intersection Bands", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_intersectionCurves, "IntersectionCurves", "Intersection Curves", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_intersectionBands, "IntersectionBands", "Intersection Bands" ); + CAF_PDM_InitFieldNoDefault( &m_intersectionCurves, "IntersectionCurves", "Intersection Curves" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp index b9e9b1db83..7ba8174bdf 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp @@ -37,15 +37,15 @@ RimSurfaceIntersectionCurve::RimSurfaceIntersectionCurve() { CAF_PDM_InitObject( "SurfaceIntersectionCurve", ":/SummaryCurve16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_lineAppearance, "LineAppearance", "Line Appearance", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_lineAppearance, "LineAppearance", "Line Appearance" ); m_lineAppearance = new RimAnnotationLineAppearance; m_lineAppearance->objectChanged.connect( this, &RimSurfaceIntersectionCurve::onObjectChanged ); uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_surface1, "Surface1", "Surface 1", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_surface1, "Surface1", "Surface 1" ); m_surface1.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name" ); m_nameProxy.registerGetMethod( this, &RimSurfaceIntersectionCurve::objectName ); m_nameProxy.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp b/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp index b03276b12d..6ada731680 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp @@ -62,27 +62,27 @@ RimTensorResults::RimTensorResults() { CAF_PDM_InitObject( "Element Tensor Results", ":/CellResult.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &arrowColorLegendConfig, "LegendDefinition", "Color Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &arrowColorLegendConfig, "LegendDefinition", "Color Legend" ); this->arrowColorLegendConfig = new RimRegularLegendConfig(); arrowColorLegendConfig.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_resultFieldName, "ResultVariable", QString( "ST" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_resultFieldName, "ResultVariable", QString( "ST" ), "Value" ); m_resultFieldName.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_resultFieldNameUiField, "ResultVariableUI", QString( "ST" ), "Value", "", "", "" ); + CAF_PDM_InitField( &m_resultFieldNameUiField, "ResultVariableUI", QString( "ST" ), "Value" ); m_resultFieldNameUiField.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_showTensors, "ShowTensors", false, "", "", "", "" ); + CAF_PDM_InitField( &m_showTensors, "ShowTensors", false, "" ); - CAF_PDM_InitField( &m_principal1, "Principal1", true, "Principal 1", "", "", "" ); - CAF_PDM_InitField( &m_principal2, "Principal2", true, "Principal 2", "", "", "" ); - CAF_PDM_InitField( &m_principal3, "Principal3", true, "Principal 3", "", "", "" ); + CAF_PDM_InitField( &m_principal1, "Principal1", true, "Principal 1" ); + CAF_PDM_InitField( &m_principal2, "Principal2", true, "Principal 2" ); + CAF_PDM_InitField( &m_principal3, "Principal3", true, "Principal 3" ); - CAF_PDM_InitField( &m_threshold, "Threshold", 0.0f, "Threshold", "", "", "" ); + CAF_PDM_InitField( &m_threshold, "Threshold", 0.0f, "Threshold" ); - CAF_PDM_InitFieldNoDefault( &m_vectorColor, "VectorColor", "Color", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_scaleMethod, "ScaleMethod", "Scale Method", "", "", "" ); - CAF_PDM_InitField( &m_sizeScale, "SizeScale", 1.0f, "Size Scale", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_vectorColor, "VectorColor", "Color" ); + CAF_PDM_InitFieldNoDefault( &m_scaleMethod, "ScaleMethod", "Scale Method" ); + CAF_PDM_InitField( &m_sizeScale, "SizeScale", 1.0f, "Size Scale" ); CAF_PDM_InitField( &m_rangeMode, "RangeType", RimRegularLegendConfig::RangeModeEnum( RimRegularLegendConfig::RangeModeType::AUTOMATIC_ALLTIMESTEPS ), diff --git a/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp index 029c394caf..95610246ea 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -45,7 +45,7 @@ CAF_PDM_SOURCE_INIT( RimTernaryLegendConfig, "RimTernaryLegendConfig" ); RimTernaryLegendConfig::RimTernaryLegendConfig() { CAF_PDM_InitObject( "Ternary Color Legend", ":/Legend.png", "", "" ); - CAF_PDM_InitField( &m_showLegend, "ShowTernaryLegend", true, "Show Ternary Legend", "", "", "" ); + CAF_PDM_InitField( &m_showLegend, "ShowTernaryLegend", true, "Show Ternary Legend" ); m_showLegend.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &precision, "Precision", @@ -62,19 +62,19 @@ RimTernaryLegendConfig::RimTernaryLegendConfig() "Switches between automatic and user defined range on the legend", "" ); - CAF_PDM_InitFieldNoDefault( &applyLocalMinMax, "m_applyLocalMinMax", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &applyLocalMinMax, "m_applyLocalMinMax", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &applyLocalMinMax ); applyLocalMinMax = false; - CAF_PDM_InitFieldNoDefault( &applyGlobalMinMax, "m_applyGlobalMinMax", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &applyGlobalMinMax, "m_applyGlobalMinMax", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &applyGlobalMinMax ); applyGlobalMinMax = false; - CAF_PDM_InitFieldNoDefault( &applyFullRangeMinMax, "m_applyFullRangeMinMax", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &applyFullRangeMinMax, "m_applyFullRangeMinMax", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &applyFullRangeMinMax ); applyFullRangeMinMax = false; - CAF_PDM_InitFieldNoDefault( &ternaryRangeSummary, "ternaryRangeSummary", "Range summary", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &ternaryRangeSummary, "ternaryRangeSummary", "Range summary" ); ternaryRangeSummary.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); ternaryRangeSummary.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); diff --git a/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.cpp b/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.cpp index de724c9923..43cb02e531 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.cpp @@ -61,30 +61,30 @@ CAF_PDM_SOURCE_INIT( RimTimeStepFilter, "RimTimeStepFilter" ); //-------------------------------------------------------------------------------------------------- RimTimeStepFilter::RimTimeStepFilter() { - CAF_PDM_InitObject( "Time Step Filter", "", "", "" ); + CAF_PDM_InitObject( "Time Step Filter" ); caf::AppEnum filterType = TS_ALL; - CAF_PDM_InitField( &m_filterType, "FilterType", filterType, "Filter Type", "", "", "" ); + CAF_PDM_InitField( &m_filterType, "FilterType", filterType, "Filter Type" ); - CAF_PDM_InitField( &m_firstTimeStep, "FirstTimeStep", 0, "First Time Step", "", "", "" ); - CAF_PDM_InitField( &m_lastTimeStep, "LastTimeStep", 0, "Last Time Step", "", "", "" ); + CAF_PDM_InitField( &m_firstTimeStep, "FirstTimeStep", 0, "First Time Step" ); + CAF_PDM_InitField( &m_lastTimeStep, "LastTimeStep", 0, "Last Time Step" ); - CAF_PDM_InitField( &m_interval, "Interval", 1, "Interval", "", "", "" ); + CAF_PDM_InitField( &m_interval, "Interval", 1, "Interval" ); m_interval.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_timeStepNamesFromFile, "TimeStepsFromFile", std::vector(), "TimeSteps From File", "", "", "" ); + CAF_PDM_InitField( &m_timeStepNamesFromFile, "TimeStepsFromFile", std::vector(), "TimeSteps From File" ); m_timeStepNamesFromFile.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_dateFormat, "DateFormat", QString( "yyyy-MM-dd" ), "Date Format", "", "", "" ); + CAF_PDM_InitField( &m_dateFormat, "DateFormat", QString( "yyyy-MM-dd" ), "Date Format" ); - CAF_PDM_InitFieldNoDefault( &m_filteredTimeSteps, "TimeStepIndicesToImport", "Select From Time Steps", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filteredTimeSteps, "TimeStepIndicesToImport", "Select From Time Steps" ); m_filteredTimeSteps.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_filteredTimeStepsUi, "TimeStepIndicesUi", "Select From TimeSteps", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filteredTimeStepsUi, "TimeStepIndicesUi", "Select From TimeSteps" ); m_filteredTimeStepsUi.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_filteredTimeStepsUi.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); m_filteredTimeStepsUi.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_applyReloadOfCase, "ApplyReloadOfCase", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_applyReloadOfCase, "ApplyReloadOfCase", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_applyReloadOfCase ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp index 224324052c..75f146d85f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp @@ -90,29 +90,29 @@ RimVfpPlot::RimVfpPlot() // TODO: add icon CAF_PDM_InitObject( "VFP Plot", ":/VfpPlot.svg", "", "" ); - CAF_PDM_InitField( &m_plotTitle, "PlotTitle", QString( "VFP Plot" ), "Plot Title", "", "", "" ); + CAF_PDM_InitField( &m_plotTitle, "PlotTitle", QString( "VFP Plot" ), "Plot Title" ); m_plotTitle.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" ); caf::AppEnum defaultTableType = RimVfpDefines::TableType::INJECTION; - CAF_PDM_InitField( &m_tableType, "TableType", defaultTableType, "Table Type", "", "", "" ); + CAF_PDM_InitField( &m_tableType, "TableType", defaultTableType, "Table Type" ); m_tableType.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_tableNumber, "TableNumber", -1, "Table Number", "", "", "" ); + CAF_PDM_InitField( &m_tableNumber, "TableNumber", -1, "Table Number" ); m_tableNumber.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepth", 0.0, "Reference Depth", "", "", "" ); + CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepth", 0.0, "Reference Depth" ); m_referenceDepth.uiCapability()->setUiReadOnly( true ); caf::AppEnum defaultFlowingPhase = RimVfpDefines::FlowingPhaseType::WATER; - CAF_PDM_InitField( &m_flowingPhase, "FlowingPhase", defaultFlowingPhase, "Flowing Phase", "", "", "" ); + CAF_PDM_InitField( &m_flowingPhase, "FlowingPhase", defaultFlowingPhase, "Flowing Phase" ); m_flowingPhase.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_flowingWaterFraction, "FlowingWaterFraction", "Flowing Water Fraction", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_flowingWaterFraction, "FlowingWaterFraction", "Flowing Water Fraction" ); m_flowingWaterFraction.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_flowingGasFraction, "FlowingGasFraction", "Flowing Gas Fraction", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_flowingGasFraction, "FlowingGasFraction", "Flowing Gas Fraction" ); m_flowingGasFraction.uiCapability()->setUiReadOnly( true ); caf::AppEnum defaultInterpolatedVariable = @@ -127,24 +127,24 @@ RimVfpPlot::RimVfpPlot() caf::AppEnum defaultPrimaryVariable = RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE; - CAF_PDM_InitField( &m_primaryVariable, "PrimaryVariable", defaultPrimaryVariable, "Primary Variable", "", "", "" ); + CAF_PDM_InitField( &m_primaryVariable, "PrimaryVariable", defaultPrimaryVariable, "Primary Variable" ); caf::AppEnum defaultFamilyVariable = RimVfpDefines::ProductionVariableType::THP; - CAF_PDM_InitField( &m_familyVariable, "FamilyVariable", defaultFamilyVariable, "Family Variable", "", "", "" ); + CAF_PDM_InitField( &m_familyVariable, "FamilyVariable", defaultFamilyVariable, "Family Variable" ); - CAF_PDM_InitField( &m_liquidFlowRateIdx, "LiquidFlowRateIdx", 0, "Liquid Flow Rate", "", "", "" ); + CAF_PDM_InitField( &m_liquidFlowRateIdx, "LiquidFlowRateIdx", 0, "Liquid Flow Rate" ); m_liquidFlowRateIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_thpIdx, "THPIdx", 0, "THP", "", "", "" ); + CAF_PDM_InitField( &m_thpIdx, "THPIdx", 0, "THP" ); m_thpIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_articifialLiftQuantityIdx, "ArtificialLiftQuantityIdx", 0, "Artificial Lift Quantity", "", "", "" ); + CAF_PDM_InitField( &m_articifialLiftQuantityIdx, "ArtificialLiftQuantityIdx", 0, "Artificial Lift Quantity" ); m_articifialLiftQuantityIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_waterCutIdx, "WaterCutIdx", 0, "Water Cut", "", "", "" ); + CAF_PDM_InitField( &m_waterCutIdx, "WaterCutIdx", 0, "Water Cut" ); m_waterCutIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_gasLiquidRatioIdx, "GasLiquidRatioIdx", 0, "Gas Liquid Ratio", "", "", "" ); + CAF_PDM_InitField( &m_gasLiquidRatioIdx, "GasLiquidRatioIdx", 0, "Gas Liquid Ratio" ); m_gasLiquidRatioIdx.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); m_showWindow = true; diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp index aa01154ee4..dd58369952 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp @@ -38,7 +38,7 @@ RimVfpPlotCollection::RimVfpPlotCollection() { CAF_PDM_InitObject( "VFP Plots", ":/VfpPlotCollection.svg", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_vfpPlots, "VfpPlots", "Vertical Flow Performance Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_vfpPlots, "VfpPlots", "Vertical Flow Performance Plots" ); m_vfpPlots.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp index 4996ab89ba..4323f0c0c7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp @@ -33,10 +33,10 @@ RimViewLinkerCollection::RimViewLinkerCollection( void ) { CAF_PDM_InitObject( "Linked Views", ":/LinkView16x16.png", "", "" ); - CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &isActive, "Active", true, "Active" ); isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &viewLinker, "ViewLinkers", "View Linkers", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &viewLinker, "ViewLinkers", "View Linkers" ); viewLinker.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewNameConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimViewNameConfig.cpp index b3f7378496..3b0b97fae0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewNameConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewNameConfig.cpp @@ -35,12 +35,12 @@ RimViewNameConfig::RimViewNameConfig() , 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" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index d0c05bb239..1c6e03d842 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -48,15 +48,15 @@ RimViewWindow::RimViewWindow( void ) "ViewWindow", "The Base Class for all Views and Plots in ResInsight" ); - CAF_PDM_InitFieldNoDefault( &m_windowController, "WindowController", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_windowController, "WindowController", "" ); m_windowController.uiCapability()->setUiTreeHidden( true ); m_windowController.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_showWindow, "ShowWindow", true, "Show Window", "", "", "" ); + CAF_PDM_InitField( &m_showWindow, "ShowWindow", true, "Show Window" ); m_showWindow.uiCapability()->setUiHidden( true ); // Obsolete field - CAF_PDM_InitFieldNoDefault( &obsoleteField_windowGeometry, "WindowGeometry", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &obsoleteField_windowGeometry, "WindowGeometry", "" ); RiaFieldhandleTools::disableWriteAndSetFieldHidden( &obsoleteField_windowGeometry ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimVirtualPerforationResults.cpp b/ApplicationLibCode/ProjectDataModel/RimVirtualPerforationResults.cpp index b1f4499e98..a9f70fabcd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVirtualPerforationResults.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVirtualPerforationResults.cpp @@ -31,11 +31,11 @@ RimVirtualPerforationResults::RimVirtualPerforationResults() { CAF_PDM_InitObject( "Well Connection Factors", ":/WellCF16x16.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "ShowConnectionFactors", false, "", "", "", "" ); - CAF_PDM_InitField( &m_showClosedConnections, "ShowClosedConnections", true, "Show On Closed Connections", "", "", "" ); - CAF_PDM_InitField( &m_geometryScaleFactor, "GeometryScaleFactor", 2.0, "Geometry Scale Factor", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "ShowConnectionFactors", false, "" ); + CAF_PDM_InitField( &m_showClosedConnections, "ShowClosedConnections", true, "Show On Closed Connections" ); + CAF_PDM_InitField( &m_geometryScaleFactor, "GeometryScaleFactor", 2.0, "Geometry Scale Factor" ); - CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend" ); m_legendConfig.uiCapability()->setUiTreeHidden( true ); m_legendConfig = new RimRegularLegendConfig(); diff --git a/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp b/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp index c3d5097ef1..4db3e8934f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp @@ -50,7 +50,7 @@ RimWbsParameters::RimWbsParameters() "", "Data source for Non-Reservoir Pore Pressure", "" ); - CAF_PDM_InitScriptableField( &m_userDefinedPPShale, "UserPPNonReservoir", 1.0, " Multiplier of hydrostatic PP", "", "", "" ); + CAF_PDM_InitScriptableField( &m_userDefinedPPShale, "UserPPNonReservoir", 1.0, " Multiplier of hydrostatic PP" ); CAF_PDM_InitScriptableFieldNoDefault( &m_poissonRatioSource, "PoissionRatioSource", @@ -88,7 +88,7 @@ RimWbsParameters::RimWbsParameters() "(SH - PP)/(OBG-PP)", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_FGShaleSource, "FGShaleSource", "FG in Shale Calculation", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_FGShaleSource, "FGShaleSource", "FG in Shale Calculation" ); CAF_PDM_InitScriptableFieldNoDefault( &m_K0FGSource, "K0FGSource", "K0_FG", @@ -96,7 +96,7 @@ RimWbsParameters::RimWbsParameters() "FG in shale = K0_FG * (OBG0-PP0)\nK0_FG = (FG-PP)/(OBG-PP)", "" ); - CAF_PDM_InitFieldNoDefault( &m_waterDensitySource, "WaterDensitySource", "Water Density", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_waterDensitySource, "WaterDensitySource", "Water Density" ); m_waterDensitySource.uiCapability()->setUiHidden( true ); CAF_PDM_InitScriptableField( &m_userDefinedPoissionRatio, @@ -111,8 +111,8 @@ RimWbsParameters::RimWbsParameters() CAF_PDM_InitScriptableField( &m_userDefinedUcs, "UserUcs", 100.0, "User Defined UCS [bar]", "", "User Defined UCS [bar]", "" ); CAF_PDM_InitScriptableField( &m_userDefinedDF, "UserDF", 0.7, "User Defined DF", "", "User Defined Depletion Factor", "" ); - CAF_PDM_InitScriptableField( &m_userDefinedK0FG, "UserK0FG", 0.75, "User Defined K0_FG", "", "", "" ); - CAF_PDM_InitScriptableField( &m_userDefinedK0SH, "UserK0SH", 0.65, "User Defined K0_SH", "", "", "" ); + CAF_PDM_InitScriptableField( &m_userDefinedK0FG, "UserK0FG", 0.75, "User Defined K0_FG" ); + CAF_PDM_InitScriptableField( &m_userDefinedK0SH, "UserK0SH", 0.65, "User Defined K0_SH" ); CAF_PDM_InitScriptableField( &m_FGShaleMultiplier, "FGMultiplier", 1.05, @@ -129,11 +129,11 @@ RimWbsParameters::RimWbsParameters() "Units: g/cm^3", "" ); - CAF_PDM_InitFieldNoDefault( &m_geoMechCase, "GeoMechCase", "GeoMechCase", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geoMechCase, "GeoMechCase", "GeoMechCase" ); m_geoMechCase.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "WellPath", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "WellPath" ); m_wellPath.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_timeStep, "TimeStep", -1, "TimeStep", "", "", "" ); + CAF_PDM_InitField( &m_timeStep, "TimeStep", -1, "TimeStep" ); m_timeStep.uiCapability()->setUiHidden( true ); m_parameterSourceFields = { { RigWbsParameter::PP_Reservoir(), &m_porePressureSource }, diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.cpp index 7c4699e2b7..f465226a80 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticProperties.cpp @@ -36,21 +36,21 @@ CAF_PDM_SOURCE_INIT( RimElasticProperties, "ElasticProperties" ); RimElasticProperties::RimElasticProperties() : changed( this ) { - CAF_PDM_InitScriptableObject( "RimElasticProperties", "", "", "" ); + CAF_PDM_InitScriptableObject( "RimElasticProperties" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_filePath, "FilePath", "File Path", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_filePath, "FilePath", "File Path" ); m_filePath.uiCapability()->setUiReadOnly( true ); m_filePath.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableFieldNoDefault( &m_propertiesTable, "PropertiesTable", "Properties Table", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_propertiesTable, "PropertiesTable", "Properties Table" ); m_propertiesTable.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); m_propertiesTable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_propertiesTable.uiCapability()->setUiReadOnly( true ); m_propertiesTable.xmlCapability()->disableIO(); - CAF_PDM_InitScriptableField( &m_showScaledProperties, "ShowScaledProperties", true, "Show Scaled Properties", "", "", "" ); + CAF_PDM_InitScriptableField( &m_showScaledProperties, "ShowScaledProperties", true, "Show Scaled Properties" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_scalings, "PropertyScalingCollection", "PropertyScalingCollection", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_scalings, "PropertyScalingCollection", "PropertyScalingCollection" ); m_scalings.uiCapability()->setUiTreeHidden( true ); m_scalings = new RimElasticPropertyScalingCollection; m_scalings->changed.connect( this, &RimElasticProperties::elasticPropertyScalingCollectionChanged ); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.cpp index ffcca93033..3559a49c40 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.cpp @@ -40,13 +40,13 @@ CAF_PDM_SOURCE_INIT( RimElasticPropertyScaling, "ElasticPropertyScaling" ); RimElasticPropertyScaling::RimElasticPropertyScaling() : changed( this ) { - CAF_PDM_InitScriptableObject( "ElasticPropertyScaling", "", "", "" ); + CAF_PDM_InitScriptableObject( "ElasticPropertyScaling" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_formation, "Formation", "Formation", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_facies, "Facies", "Facies", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_formation, "Formation", "Formation" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_facies, "Facies", "Facies" ); caf::AppEnum defaultProperty = RiaDefines::CurveProperty::YOUNGS_MODULUS; - CAF_PDM_InitScriptableField( &m_property, "Property", defaultProperty, "Property", "", "", "" ); - CAF_PDM_InitScriptableField( &m_scale, "Scale", 1.0, "Scale", "", "", "" ); + CAF_PDM_InitScriptableField( &m_property, "Property", defaultProperty, "Property" ); + CAF_PDM_InitScriptableField( &m_scale, "Scale", 1.0, "Scale" ); nameField()->uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp index 0a01f64e6d..6907fb0c2d 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp @@ -32,7 +32,7 @@ CAF_PDM_SOURCE_INIT( RimElasticPropertyScalingCollection, "ElasticPropertyScalin RimElasticPropertyScalingCollection::RimElasticPropertyScalingCollection() : changed( this ) { - CAF_PDM_InitScriptableObject( "Elastic Property Scalings", "", "", "" ); + CAF_PDM_InitScriptableObject( "Elastic Property Scalings" ); CAF_PDM_InitScriptableFieldNoDefault( &m_elasticPropertyScalings, "ElasticPropertyScalings", diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesInitialPressureConfig.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesInitialPressureConfig.cpp index 2e509aaed8..c61850f65b 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesInitialPressureConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesInitialPressureConfig.cpp @@ -31,14 +31,14 @@ CAF_PDM_SOURCE_INIT( RimFaciesInitialPressureConfig, "FaciesInitialPressureConfi RimFaciesInitialPressureConfig::RimFaciesInitialPressureConfig() : changed( this ) { - CAF_PDM_InitScriptableObject( "Facies Initial Pressure Config", "", "", "" ); + CAF_PDM_InitScriptableObject( "Facies Initial Pressure Config" ); m_isChecked.uiCapability()->setUiHidden( false ); - CAF_PDM_InitScriptableFieldNoDefault( &m_faciesName, "FaciesName", "Facies", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_faciesName, "FaciesName", "Facies" ); m_faciesName.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitScriptableField( &m_faciesValue, "FaciesValue", -1, "Value", "", "", "" ); + CAF_PDM_InitScriptableField( &m_faciesValue, "FaciesValue", -1, "Value" ); m_faciesValue.uiCapability()->setUiHidden( true ); // Use unicode for delta letter @@ -48,7 +48,7 @@ RimFaciesInitialPressureConfig::RimFaciesInitialPressureConfig() QString deltaPressureFractionString = QString::fromUtf8( "\u0394 Pressure Fraction" ); #endif - CAF_PDM_InitScriptableField( &m_fraction, "Fraction", 0.0, deltaPressureFractionString, "", "", "" ); + CAF_PDM_InitScriptableField( &m_fraction, "Fraction", 0.0, deltaPressureFractionString ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.cpp index 36aa36aad8..c0b6c79107 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.cpp @@ -40,25 +40,25 @@ CAF_PDM_SOURCE_INIT( RimFaciesProperties, "FaciesProperties" ); RimFaciesProperties::RimFaciesProperties() : changed( this ) { - CAF_PDM_InitScriptableObject( "RimFaciesProperties", "", "", "" ); + CAF_PDM_InitScriptableObject( "RimFaciesProperties" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_filePath, "FilePath", "File Path", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_filePath, "FilePath", "File Path" ); m_filePath.uiCapability()->setUiReadOnly( true ); m_filePath.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableFieldNoDefault( &m_propertiesTable, "PropertiesTable", "Properties Table", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_propertiesTable, "PropertiesTable", "Properties Table" ); m_propertiesTable.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); m_propertiesTable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_propertiesTable.uiCapability()->setUiReadOnly( true ); m_propertiesTable.xmlCapability()->disableIO(); - CAF_PDM_InitScriptableFieldNoDefault( &m_faciesDefinition, "FaciesDefinition", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_faciesDefinition, "FaciesDefinition", "" ); m_faciesDefinition.uiCapability()->setUiTreeHidden( true ); m_faciesDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_faciesDefinition = new RimEclipseResultDefinition; m_faciesDefinition->findField( "MResultType" )->uiCapability()->setUiName( "Facies Definiton" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_colorLegend, "ColorLegend", "Colors", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_colorLegend, "ColorLegend", "Colors" ); m_colorLegend = RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::ColorRangesType::NORMAL ); setUiName( "Facies Properties" ); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.cpp index 2b6f89982a..206a266e1a 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.cpp @@ -42,14 +42,14 @@ CAF_PDM_SOURCE_INIT( RimNonNetLayers, "NonNetLayers" ); RimNonNetLayers::RimNonNetLayers() : changed( this ) { - CAF_PDM_InitScriptableObject( "RimNonNetLayers", "", "", "" ); + CAF_PDM_InitScriptableObject( "RimNonNetLayers" ); - CAF_PDM_InitScriptableField( &m_cutOff, "Cutoff", 0.0, "Cutoff", "", "", "" ); + CAF_PDM_InitScriptableField( &m_cutOff, "Cutoff", 0.0, "Cutoff" ); m_cutOff.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableFieldNoDefault( &m_facies, "Facies", "Facies", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_facies, "Facies", "Facies" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_resultDefinition, "FaciesDefinition", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_resultDefinition, "FaciesDefinition", "" ); m_resultDefinition.uiCapability()->setUiTreeHidden( true ); m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_resultDefinition = new RimEclipseResultDefinition; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp index af8a836048..cac250edf3 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp @@ -34,14 +34,14 @@ CAF_PDM_SOURCE_INIT( RimPressureTable, "PressureTable" ); RimPressureTable::RimPressureTable() : changed( this ) { - CAF_PDM_InitScriptableObject( "Pressure Table", "", "", "" ); + CAF_PDM_InitScriptableObject( "Pressure Table" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_pressureTableItems, "Items", "Pressure Table Items", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_pressureTableItems, "Items", "Pressure Table Items" ); m_pressureTableItems.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); m_pressureTableItems.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_pressureTableItems.uiCapability()->setCustomContextMenuEnabled( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_pressureDate, "PressureDate", "Pressure Date", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_pressureDate, "PressureDate", "Pressure Date" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTableItem.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTableItem.cpp index 7b7b3ca71b..4dfaace373 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTableItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTableItem.cpp @@ -31,11 +31,11 @@ CAF_PDM_SOURCE_INIT( RimPressureTableItem, "PressureTableItem" ); RimPressureTableItem::RimPressureTableItem() : changed( this ) { - CAF_PDM_InitScriptableObject( "Pressure Table Item", "", "", "" ); + CAF_PDM_InitScriptableObject( "Pressure Table Item" ); - CAF_PDM_InitScriptableField( &m_depth, "Depth", 0.0, "Depth TVDMSL [m]", "", "", "" ); - CAF_PDM_InitScriptableField( &m_initialPressure, "InitialPressure", 0.0, "Initial Pressure [Bar]", "", "", "" ); - CAF_PDM_InitScriptableField( &m_pressure, "Pressure", 0.0, "Pressure [Bar]", "", "", "" ); + CAF_PDM_InitScriptableField( &m_depth, "Depth", 0.0, "Depth TVDMSL [m]" ); + CAF_PDM_InitScriptableField( &m_initialPressure, "InitialPressure", 0.0, "Initial Pressure [Bar]" ); + CAF_PDM_InitScriptableField( &m_pressure, "Pressure", 0.0, "Pressure [Bar]" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp index 9e2607eae4..0aa3100640 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp @@ -134,17 +134,17 @@ void caf::AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RimStimPlanModel::RimStimPlanModel() { - CAF_PDM_InitScriptableObject( "StimPlanModel", "", "", "" ); + CAF_PDM_InitScriptableObject( "StimPlanModel" ); - CAF_PDM_InitFieldNoDefault( &m_stimPlanModelTemplate, "StimPlanModelTemplate", "StimPlan Model Template", "", "", "" ); - CAF_PDM_InitField( &m_editStimPlanModelTemplate, "EditModelTemplate", false, "Edit", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_stimPlanModelTemplate, "StimPlanModelTemplate", "StimPlan Model Template" ); + CAF_PDM_InitField( &m_editStimPlanModelTemplate, "EditModelTemplate", false, "Edit" ); m_editStimPlanModelTemplate.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); m_editStimPlanModelTemplate.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "Dynamic Case", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "Dynamic Case" ); m_eclipseCase.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitScriptableField( &m_timeStep, "TimeStep", 0, "Time Step", "", "", "" ); + CAF_PDM_InitScriptableField( &m_timeStep, "TimeStep", 0, "Time Step" ); m_timeStep.uiCapability()->setUiReadOnly( true ); CAF_PDM_InitScriptableFieldNoDefault( &m_initialPressureEclipseCase, @@ -155,23 +155,23 @@ RimStimPlanModel::RimStimPlanModel() "" ); m_initialPressureEclipseCase.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_staticEclipseCase, "StaticEclipseCase", "Static Case", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_staticEclipseCase, "StaticEclipseCase", "Static Case" ); m_staticEclipseCase.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitScriptableField( &m_MD, "MeasuredDepth", 0.0, "Measured Depth", "", "", "" ); + CAF_PDM_InitScriptableField( &m_MD, "MeasuredDepth", 0.0, "Measured Depth" ); m_MD.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableField( &m_extractionOffsetTop, "ExtractionOffsetTop", -1.0, "Top Offset", "", "", "" ); + CAF_PDM_InitScriptableField( &m_extractionOffsetTop, "ExtractionOffsetTop", -1.0, "Top Offset" ); m_extractionOffsetTop.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableField( &m_extractionOffsetBottom, "ExtractionOffsetBottom", -1.0, "Bottom Offset", "", "", "" ); + CAF_PDM_InitScriptableField( &m_extractionOffsetBottom, "ExtractionOffsetBottom", -1.0, "Bottom Offset" ); m_extractionOffsetBottom.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableField( &m_extractionDepthTop, "ExtractionDepthTop", -1.0, "Depth", "", "", "" ); + CAF_PDM_InitScriptableField( &m_extractionDepthTop, "ExtractionDepthTop", -1.0, "Depth" ); m_extractionDepthTop.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); m_extractionDepthTop.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitScriptableField( &m_extractionDepthBottom, "ExtractionDepthBottom", -1.0, "Depth", "", "", "" ); + CAF_PDM_InitScriptableField( &m_extractionDepthBottom, "ExtractionDepthBottom", -1.0, "Depth" ); m_extractionDepthBottom.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); m_extractionDepthBottom.uiCapability()->setUiReadOnly( true ); @@ -183,16 +183,16 @@ RimStimPlanModel::RimStimPlanModel() "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_anchorPosition, "AnchorPosition", "Anchor Position", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_anchorPosition, "AnchorPosition", "Anchor Position" ); m_anchorPosition.uiCapability()->setUiReadOnly( true ); m_anchorPosition.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_anchorPositionForUi, "AnchorPositionForUi", "Anchor Position", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_anchorPositionForUi, "AnchorPositionForUi", "Anchor Position" ); m_anchorPositionForUi.registerGetMethod( this, &RimStimPlanModel::anchorPositionForUi ); m_anchorPositionForUi.uiCapability()->setUiReadOnly( true ); m_anchorPositionForUi.xmlCapability()->disableIO(); - CAF_PDM_InitScriptableFieldNoDefault( &m_thicknessDirection, "ThicknessDirection", "Thickness Direction", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_thicknessDirection, "ThicknessDirection", "Thickness Direction" ); m_thicknessDirection.uiCapability()->setUiReadOnly( true ); m_thicknessDirection.xmlCapability()->disableIO(); @@ -203,10 +203,10 @@ RimStimPlanModel::RimStimPlanModel() "", "" ); - CAF_PDM_InitScriptableField( &m_boundingBoxHorizontal, "BoundingBoxHorizontal", 50.0, "Bounding Box Horizontal", "", "", "" ); - CAF_PDM_InitScriptableField( &m_boundingBoxVertical, "BoundingBoxVertical", 100.0, "Bounding Box Vertical", "", "", "" ); + CAF_PDM_InitScriptableField( &m_boundingBoxHorizontal, "BoundingBoxHorizontal", 50.0, "Bounding Box Horizontal" ); + CAF_PDM_InitScriptableField( &m_boundingBoxVertical, "BoundingBoxVertical", 100.0, "Bounding Box Vertical" ); - CAF_PDM_InitScriptableField( &m_useDetailedFluidLoss, "UseDetailedFluidLoss", true, "Use Detailed Fluid Loss", "", "", "" ); + CAF_PDM_InitScriptableField( &m_useDetailedFluidLoss, "UseDetailedFluidLoss", true, "Use Detailed Fluid Loss" ); CAF_PDM_InitScriptableField( &m_relativePermeabilityFactorDefault, "RelativePermeabilityFactor", @@ -215,7 +215,7 @@ RimStimPlanModel::RimStimPlanModel() "", "", "" ); - CAF_PDM_InitScriptableField( &m_poroElasticConstantDefault, "PoroElasticConstant", 0.0, "Poro-Elastic Constant", "", "", "" ); + CAF_PDM_InitScriptableField( &m_poroElasticConstantDefault, "PoroElasticConstant", 0.0, "Poro-Elastic Constant" ); CAF_PDM_InitScriptableField( &m_thermalExpansionCoeffientDefault, "ThermalExpansionCoefficient", 0.0, @@ -224,7 +224,7 @@ RimStimPlanModel::RimStimPlanModel() "", "" ); - CAF_PDM_InitScriptableField( &m_perforationLength, "PerforationLength", 10.0, "Perforation Length [m]", "", "", "" ); + CAF_PDM_InitScriptableField( &m_perforationLength, "PerforationLength", 10.0, "Perforation Length [m]" ); CAF_PDM_InitScriptableField( &m_fractureOrientation, "FractureOrientation", caf::AppEnum( FractureOrientation::ALONG_WELL_PATH ), @@ -232,29 +232,29 @@ RimStimPlanModel::RimStimPlanModel() "", "", "" ); - CAF_PDM_InitScriptableField( &m_azimuthAngle, "AzimuthAngle", 0.0, "Azimuth Angle", "", "", "" ); + CAF_PDM_InitScriptableField( &m_azimuthAngle, "AzimuthAngle", 0.0, "Azimuth Angle" ); - CAF_PDM_InitScriptableField( &m_formationDip, "FormationDip", 0.0, "Formation Dip", "", "", "" ); + CAF_PDM_InitScriptableField( &m_formationDip, "FormationDip", 0.0, "Formation Dip" ); m_formationDip.uiCapability()->setUiReadOnly( true ); m_formationDip.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableField( &m_autoComputeBarrier, "AutoComputeBarrier", true, "Auto Compute Barrier", "", "", "" ); - CAF_PDM_InitScriptableField( &m_hasBarrier, "Barrier", true, "Barrier", "", "", "" ); - CAF_PDM_InitScriptableField( &m_distanceToBarrier, "DistanceToBarrier", 0.0, "Distance To Barrier [m]", "", "", "" ); + CAF_PDM_InitScriptableField( &m_autoComputeBarrier, "AutoComputeBarrier", true, "Auto Compute Barrier" ); + CAF_PDM_InitScriptableField( &m_hasBarrier, "Barrier", true, "Barrier" ); + CAF_PDM_InitScriptableField( &m_distanceToBarrier, "DistanceToBarrier", 0.0, "Distance To Barrier [m]" ); m_distanceToBarrier.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); m_distanceToBarrier.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitScriptableField( &m_barrierDip, "BarrierDip", 0.0, "Barrier Dip", "", "", "" ); + CAF_PDM_InitScriptableField( &m_barrierDip, "BarrierDip", 0.0, "Barrier Dip" ); m_barrierDip.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); m_barrierDip.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitScriptableField( &m_wellPenetrationLayer, "WellPenetrationLayer", 2, "Well Penetration Layer", "", "", "" ); + CAF_PDM_InitScriptableField( &m_wellPenetrationLayer, "WellPenetrationLayer", 2, "Well Penetration Layer" ); - CAF_PDM_InitScriptableField( &m_showOnlyBarrierFault, "ShowOnlyBarrierFault", false, "Show Only Barrier Fault", "", "", "" ); - CAF_PDM_InitScriptableField( &m_showAllFaults, "ShowAllFaults", false, "Show All Faults", "", "", "" ); + CAF_PDM_InitScriptableField( &m_showOnlyBarrierFault, "ShowOnlyBarrierFault", false, "Show Only Barrier Fault" ); + CAF_PDM_InitScriptableField( &m_showAllFaults, "ShowAllFaults", false, "Show All Faults" ); m_showAllFaults.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); m_showAllFaults.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitScriptableField( &m_barrierFaultName, "BarrierFaultName", QString( "" ), "Barrier Fault", "", "", "" ); + CAF_PDM_InitScriptableField( &m_barrierFaultName, "BarrierFaultName", QString( "" ), "Barrier Fault" ); m_barrierFaultName.uiCapability()->setUiReadOnly( true ); CAF_PDM_InitScriptableFieldNoDefault( &m_barrierTextAnnotation, @@ -264,7 +264,7 @@ RimStimPlanModel::RimStimPlanModel() "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_perforationInterval, "PerforationInterval", "Perforation Interval", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_perforationInterval, "PerforationInterval", "Perforation Interval" ); m_calculator = std::shared_ptr( new RimStimPlanModelCalculator ); m_calculator->setStimPlanModel( this ); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCollection.cpp index e45625c461..742bfdf81b 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCollection.cpp @@ -32,9 +32,9 @@ CAF_PDM_SOURCE_INIT( RimStimPlanModelCollection, "StimPlanModelCollection" ); //-------------------------------------------------------------------------------------------------- RimStimPlanModelCollection::RimStimPlanModelCollection( void ) { - CAF_PDM_InitScriptableObject( "StimPlan Models", "", "", "" ); + CAF_PDM_InitScriptableObject( "StimPlan Models" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModels, "StimPlanModels", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModels, "StimPlanModels", "" ); m_stimPlanModels.uiCapability()->setUiTreeHidden( true ); setName( "StimPlan Models" ); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCurve.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCurve.cpp index e73891f001..0ed60b1d52 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCurve.cpp @@ -46,13 +46,13 @@ CAF_PDM_SOURCE_INIT( RimStimPlanModelCurve, "StimPlanModelCurve" ); //-------------------------------------------------------------------------------------------------- RimStimPlanModelCurve::RimStimPlanModelCurve() { - CAF_PDM_InitObject( "StimPlan Model Curve", "", "", "" ); + CAF_PDM_InitObject( "StimPlan Model Curve" ); - CAF_PDM_InitFieldNoDefault( &m_stimPlanModel, "StimPlanModel", "StimPlan Model", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_stimPlanModel, "StimPlanModel", "StimPlan Model" ); m_stimPlanModel.uiCapability()->setUiTreeChildrenHidden( true ); m_stimPlanModel.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_curveProperty, "CurveProperty", "Curve Property", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveProperty, "CurveProperty", "Curve Property" ); m_curveProperty.uiCapability()->setUiHidden( true ); m_wellPath = nullptr; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp index 8dd6551cef..f1e809631f 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp @@ -45,15 +45,15 @@ RimStimPlanModelPlot::RimStimPlanModelPlot() { CAF_PDM_InitScriptableObject( "StimPlan Model Plot", "", "", "A fracture model plot" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModel, "StimPlanModel", "StimPlan Model", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModel, "StimPlanModel", "StimPlan Model" ); m_stimPlanModel.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_editStimPlanModel, "EditModel", false, "Edit", "", "", "" ); + CAF_PDM_InitField( &m_editStimPlanModel, "EditModel", false, "Edit" ); m_editStimPlanModel.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); m_editStimPlanModel.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "Case", "", "", "" ); - CAF_PDM_InitScriptableField( &m_timeStep, "TimeStep", 0, "Time Step", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "Case" ); + CAF_PDM_InitScriptableField( &m_timeStep, "TimeStep", 0, "Time Step" ); setLegendsVisible( true ); setDeletable( true ); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp index ed7db855b1..e4b4838d68 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp @@ -32,7 +32,7 @@ RimStimPlanModelPlotCollection::RimStimPlanModelPlotCollection() { CAF_PDM_InitScriptableObject( "StimPlan Model Plots", ":/WellLogPlots16x16.png", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModelPlots, "StimPlanModelPlots", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModelPlots, "StimPlanModelPlots", "" ); m_stimPlanModelPlots.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp index 31ef5343b6..3fb05ca736 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp @@ -67,13 +67,13 @@ CAF_PDM_SOURCE_INIT( RimStimPlanModelTemplate, "StimPlanModelTemplate" ); RimStimPlanModelTemplate::RimStimPlanModelTemplate() : changed( this ) { - CAF_PDM_InitScriptableObject( "StimPlanModelTemplate", "", "", "" ); + CAF_PDM_InitScriptableObject( "StimPlanModelTemplate" ); - CAF_PDM_InitScriptableField( &m_id, "Id", -1, "ID", "", "", "" ); + CAF_PDM_InitScriptableField( &m_id, "Id", -1, "ID" ); m_id.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_dynamicEclipseCase, "DynamicEclipseCase", "Dynamic Case", "", "", "" ); - CAF_PDM_InitScriptableField( &m_timeStep, "TimeStep", 0, "Time Step", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_dynamicEclipseCase, "DynamicEclipseCase", "Dynamic Case" ); + CAF_PDM_InitScriptableField( &m_timeStep, "TimeStep", 0, "Time Step" ); CAF_PDM_InitScriptableFieldNoDefault( &m_initialPressureEclipseCase, "InitialPressureEclipseCase", @@ -88,12 +88,12 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate() "", "", "" ); - CAF_PDM_InitField( &m_useTableForPressure, "UseForPressure", false, "Use Pressure Table For Pressure", "", "", "" ); - CAF_PDM_InitField( &m_editPressureTable, "EditPressureTable", false, "Edit", "", "", "" ); + CAF_PDM_InitField( &m_useTableForPressure, "UseForPressure", false, "Use Pressure Table For Pressure" ); + CAF_PDM_InitField( &m_editPressureTable, "EditPressureTable", false, "Edit" ); m_editPressureTable.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); m_editPressureTable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitScriptableFieldNoDefault( &m_staticEclipseCase, "StaticEclipseCase", "Static Case", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_staticEclipseCase, "StaticEclipseCase", "Static Case" ); CAF_PDM_InitField( &m_useEqlnumForPressureInterpolation, "UseEqlNumForPressureInterpolation", @@ -125,7 +125,7 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate() double defaultStressDepth = computeDefaultStressDepth(); double defaultStress = defaultStressDepth * defaultStressGradient; - CAF_PDM_InitScriptableField( &m_verticalStress, "VerticalStress", defaultStress, "Vertical Stress", "", "", "" ); + CAF_PDM_InitScriptableField( &m_verticalStress, "VerticalStress", defaultStress, "Vertical Stress" ); m_verticalStress.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); CAF_PDM_InitScriptableField( &m_verticalStressGradient, "VerticalStressGradient", @@ -134,10 +134,10 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate() "", "", "" ); - CAF_PDM_InitScriptableField( &m_stressDepth, "StressDepth", defaultStressDepth, "Stress Depth", "", "", "" ); + CAF_PDM_InitScriptableField( &m_stressDepth, "StressDepth", defaultStressDepth, "Stress Depth" ); m_stressDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableField( &m_referenceTemperature, "ReferenceTemperature", 70.0, "Temperature [C]", "", "", "" ); + CAF_PDM_InitScriptableField( &m_referenceTemperature, "ReferenceTemperature", 70.0, "Temperature [C]" ); CAF_PDM_InitScriptableField( &m_referenceTemperatureGradient, "ReferenceTemperatureGradient", 0.025, @@ -153,10 +153,10 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate() "", "" ); - CAF_PDM_InitScriptableField( &m_overburdenHeight, "OverburdenHeight", 50.0, "Overburden Height", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_overburdenFormation, "OverburdenFormation", "Overburden Formation", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_overburdenFacies, "OverburdenFacies", "Overburden Facies", "", "", "" ); - CAF_PDM_InitScriptableField( &m_overburdenPorosity, "OverburdenPorosity", 0.0, "Overburden Porosity", "", "", "" ); + CAF_PDM_InitScriptableField( &m_overburdenHeight, "OverburdenHeight", 50.0, "Overburden Height" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_overburdenFormation, "OverburdenFormation", "Overburden Formation" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_overburdenFacies, "OverburdenFacies", "Overburden Facies" ); + CAF_PDM_InitScriptableField( &m_overburdenPorosity, "OverburdenPorosity", 0.0, "Overburden Porosity" ); CAF_PDM_InitScriptableField( &m_overburdenPermeability, "OverburdenPermeability", 10.0e-6, @@ -172,10 +172,10 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate() "", "" ); - CAF_PDM_InitScriptableField( &m_underburdenHeight, "UnderburdenHeight", 50.0, "Underburden Height", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_underburdenFormation, "UnderburdenFormation", "Underburden Formation", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_underburdenFacies, "UnderburdenFacies", "Underburden Facies", "", "", "" ); - CAF_PDM_InitScriptableField( &m_underburdenPorosity, "UnderburdenPorosity", 0.0, "Underburden Porosity", "", "", "" ); + CAF_PDM_InitScriptableField( &m_underburdenHeight, "UnderburdenHeight", 50.0, "Underburden Height" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_underburdenFormation, "UnderburdenFormation", "Underburden Formation" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_underburdenFacies, "UnderburdenFacies", "Underburden Facies" ); + CAF_PDM_InitScriptableField( &m_underburdenPorosity, "UnderburdenPorosity", 0.0, "Underburden Porosity" ); CAF_PDM_InitScriptableField( &m_underburdenPermeability, "UnderburdenPermeability", 10.0e-6, @@ -201,17 +201,17 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate() m_faciesInitialPressureConfigs.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_faciesInitialPressureConfigs.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_pressureTable, "PressureTable", "Pressure Table", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_pressureTable, "PressureTable", "Pressure Table" ); m_pressureTable.uiCapability()->setUiTreeHidden( true ); setPressureTable( new RimPressureTable ); - CAF_PDM_InitScriptableFieldNoDefault( &m_elasticProperties, "ElasticProperties", "Elastic Properties", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_elasticProperties, "ElasticProperties", "Elastic Properties" ); m_elasticProperties.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_faciesProperties, "FaciesProperties", "Facies Properties", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_faciesProperties, "FaciesProperties", "Facies Properties" ); m_faciesProperties.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_nonNetLayers, "NonNetLayers", "Non-Net Layers", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_nonNetLayers, "NonNetLayers", "Non-Net Layers" ); m_nonNetLayers.uiCapability()->setUiTreeHidden( true ); setNonNetLayers( new RimNonNetLayers ); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp index b2d24160aa..97ca077151 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp @@ -46,7 +46,7 @@ RimStimPlanModelTemplateCollection::RimStimPlanModelTemplateCollection() "" ); m_stimPlanModelTemplates.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_nextValidId, "NextValidId", 0, "", "", "", "" ); + CAF_PDM_InitField( &m_nextValidId, "NextValidId", 0, "" ); m_nextValidId.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamline.cpp b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamline.cpp index 0bb14ef628..03ac48398f 100644 --- a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamline.cpp +++ b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamline.cpp @@ -30,7 +30,7 @@ RimStreamline::RimStreamline( QString simWellName ) { CAF_PDM_InitScriptableObject( "Streamline", ":/Erase.png", "", "" ); - CAF_PDM_InitScriptableField( &m_simWellName, "Name", simWellName, "Name", "", "", "" ); + CAF_PDM_InitScriptableField( &m_simWellName, "Name", simWellName, "Name" ); m_simWellName.uiCapability()->setUiReadOnly( true ); m_simWellName.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp index 90f7a1b382..ba5ed584b4 100644 --- a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp @@ -97,59 +97,59 @@ RimStreamlineInViewCollection::RimStreamlineInViewCollection() { CAF_PDM_InitObject( "Streamlines", ":/Erase.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend" ); m_legendConfig = new RimRegularLegendConfig(); m_legendConfig->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_CONTINUOUS ); m_legendConfig.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_collectionName, "Name", "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_collectionName, "Name", "Name" ); m_collectionName = "Streamlines"; m_collectionName.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_flowThreshold, "FlowThreshold", "Flow Threshold [m/day]", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_flowThreshold, "FlowThreshold", "Flow Threshold [m/day]" ); m_flowThreshold = 0.01; - CAF_PDM_InitFieldNoDefault( &m_lengthThreshold, "LengthThreshold", "Minimum Length [m]", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_lengthThreshold, "LengthThreshold", "Minimum Length [m]" ); m_lengthThreshold = 100.0; - CAF_PDM_InitFieldNoDefault( &m_resolution, "Resolution", "Resolution [days]", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resolution, "Resolution", "Resolution [days]" ); m_resolution = 20.0; - CAF_PDM_InitFieldNoDefault( &m_maxDays, "MaxDays", "Max Days", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_maxDays, "MaxDays", "Max Days" ); m_maxDays = 5000; - CAF_PDM_InitFieldNoDefault( &m_useProducers, "UseProducers", "Producer Wells", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_useProducers, "UseProducers", "Producer Wells" ); m_useProducers = true; - CAF_PDM_InitFieldNoDefault( &m_useInjectors, "UseInjectors", "Injector Wells", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_useInjectors, "UseInjectors", "Injector Wells" ); m_useInjectors = true; - CAF_PDM_InitFieldNoDefault( &m_phases, "Phase", "Phase", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_phases, "Phase", "Phase" ); - CAF_PDM_InitField( &m_isActive, "isActive", false, "Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "isActive", false, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_visualizationMode, "VisualizationMode", "Visualization Mode", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_colorMode, "ColorMode", "Colors", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_visualizationMode, "VisualizationMode", "Visualization Mode" ); + CAF_PDM_InitFieldNoDefault( &m_colorMode, "ColorMode", "Colors" ); - CAF_PDM_InitFieldNoDefault( &m_animationSpeed, "AnimationSpeed", "Animation Speed", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_animationSpeed, "AnimationSpeed", "Animation Speed" ); m_animationSpeed.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); m_animationSpeed = 10; - CAF_PDM_InitFieldNoDefault( &m_animationIndex, "AnimationIndex", "Animation Index", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_animationIndex, "AnimationIndex", "Animation Index" ); m_animationIndex.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); m_animationIndex = 0; m_maxAnimationIndex = 0; - CAF_PDM_InitFieldNoDefault( &m_scaleFactor, "ScaleFactor", "Scale Factor", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_scaleFactor, "ScaleFactor", "Scale Factor" ); m_scaleFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); m_scaleFactor = 100.0; - CAF_PDM_InitFieldNoDefault( &m_tracerLength, "TracerLength", "Tracer Length", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_tracerLength, "TracerLength", "Tracer Length" ); m_tracerLength.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); m_tracerLength = 100; - CAF_PDM_InitFieldNoDefault( &m_streamlines, "Streamlines", "Streamlines", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_streamlines, "Streamlines", "Streamlines" ); m_streamlines.uiCapability()->setUiTreeHidden( true ); m_streamlines.xmlCapability()->disableIO(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp index e54a0d5c3b..1c5e3e36a7 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp @@ -44,10 +44,10 @@ RimAsciiDataCurve::RimAsciiDataCurve() { CAF_PDM_InitObject( "ASCII Data Curve", ":/SummaryCurve16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_timeSteps, "TimeSteps", "Time Steps", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_values, "Values", "Values", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_title, "Title", "Title", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis" ); + CAF_PDM_InitFieldNoDefault( &m_timeSteps, "TimeSteps", "Time Steps" ); + CAF_PDM_InitFieldNoDefault( &m_values, "Values", "Values" ); + CAF_PDM_InitFieldNoDefault( &m_title, "Title", "Title" ); setSymbolSkipDistance( 10.0f ); setLineThickness( 2 ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimCsvUserData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimCsvUserData.cpp index 3e20111ae2..56a5e2831c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimCsvUserData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimCsvUserData.cpp @@ -39,7 +39,7 @@ RimCsvUserData::RimCsvUserData() CAF_PDM_InitObject( "Observed CSV Data File", ":/ObservedCSVDataFile16x16.png", "", "" ); m_summaryHeaderFilename.uiCapability()->setUiName( "File" ); - CAF_PDM_InitFieldNoDefault( &m_parseOptions, "ParseOptions", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_parseOptions, "ParseOptions", "" ); m_parseOptions = new RicPasteAsciiDataToSummaryPlotFeatureUi(); m_parseOptions.uiCapability()->setUiTreeChildrenHidden( true ); m_parseOptions.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp index bbdf392470..9612b1ab75 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp @@ -58,28 +58,28 @@ RimDerivedEnsembleCaseCollection::RimDerivedEnsembleCaseCollection() { CAF_PDM_InitObject( "Delta Ensemble", ":/SummaryEnsemble.svg", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_ensemble1, "Ensemble1", "Ensemble 1", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensemble1, "Ensemble1", "Ensemble 1" ); m_ensemble1.uiCapability()->setUiTreeChildrenHidden( true ); m_ensemble1.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault( &m_ensemble2, "Ensemble2", "Ensemble 2", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensemble2, "Ensemble2", "Ensemble 2" ); m_ensemble1.uiCapability()->setUiTreeChildrenHidden( true ); m_ensemble2.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault( &m_operator, "Operator", "Operator", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_operator, "Operator", "Operator" ); - CAF_PDM_InitField( &m_swapEnsemblesButton, "SwapEnsembles", false, "SwapEnsembles", "", "", "" ); + CAF_PDM_InitField( &m_swapEnsemblesButton, "SwapEnsembles", false, "SwapEnsembles" ); m_swapEnsemblesButton.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_swapEnsemblesButton.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_swapEnsemblesButton.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_caseCount, "CaseCount", QString( "" ), "Matching Cases", "", "", "" ); + CAF_PDM_InitField( &m_caseCount, "CaseCount", QString( "" ), "Matching Cases" ); m_caseCount.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_matchOnParameters, "MatchOnParameters", false, "Match On Parameters", "", "", "" ); + CAF_PDM_InitField( &m_matchOnParameters, "MatchOnParameters", false, "Match On Parameters" ); - CAF_PDM_InitFieldNoDefault( &m_useFixedTimeStep, "UseFixedTimeStep", "Use Fixed Time Step", "", "", "" ); - CAF_PDM_InitField( &m_fixedTimeStepIndex, "FixedTimeStepIndex", 0, "Time Step", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_useFixedTimeStep, "UseFixedTimeStep", "Use Fixed Time Step" ); + CAF_PDM_InitField( &m_fixedTimeStepIndex, "FixedTimeStepIndex", 0, "Time Step" ); m_fixedTimeStepIndex.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_fixedTimeStepIndex.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp index e64cab9f84..9594e74a6b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp @@ -63,15 +63,15 @@ RimDerivedSummaryCase::RimDerivedSummaryCase() , m_summaryCase2( nullptr ) { CAF_PDM_InitObject( "Summary Case", ":/SummaryCase.svg", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_summaryCase1, "SummaryCase1", "Summary Case 1", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryCase1, "SummaryCase1", "Summary Case 1" ); - CAF_PDM_InitFieldNoDefault( &m_operator, "Operator", "Operator", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_operator, "Operator", "Operator" ); - CAF_PDM_InitFieldNoDefault( &m_summaryCase2, "SummaryCase2", "Summary Case 2", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryCase2, "SummaryCase2", "Summary Case 2" ); - CAF_PDM_InitFieldNoDefault( &m_useFixedTimeStep, "UseFixedTimeStep", "Use Fixed Time Step", "", "", "" ); - CAF_PDM_InitField( &m_fixedTimeStepIndex, "FixedTimeStepIndex", 0, "Time Step", "", "", "" ); - CAF_PDM_InitField( &m_inUse, "InUse", false, "In Use", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_useFixedTimeStep, "UseFixedTimeStep", "Use Fixed Time Step" ); + CAF_PDM_InitField( &m_fixedTimeStepIndex, "FixedTimeStepIndex", 0, "Time Step" ); + CAF_PDM_InitField( &m_inUse, "InUse", false, "In Use" ); m_fixedTimeStepIndex.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_fixedTimeStepIndex.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp index 629eae46db..08344993cc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp @@ -68,52 +68,47 @@ RimEnsembleCurveFilter::RimEnsembleCurveFilter() { CAF_PDM_InitObject( "Ensemble Curve Filter", ":/Filter.svg", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_filterTitle, "FilterTitle", "Title", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filterTitle, "FilterTitle", "Title" ); m_filterTitle.registerGetMethod( this, &RimEnsembleCurveFilter::description ); m_filterTitle.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_active, "Active", "Active", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_active, "Active", "Active" ); m_active = true; - CAF_PDM_InitFieldNoDefault( &m_filterMode, "FilterMode", "Filter Mode", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filterMode, "FilterMode", "Filter Mode" ); - CAF_PDM_InitFieldNoDefault( &m_ensembleParameterName, "EnsembleParameter", "Ensemble Parameter", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleParameterName, "EnsembleParameter", "Ensemble Parameter" ); m_ensembleParameterName.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddressesUiField, "SelectedObjectiveSummaryVar", "Vector", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddressesUiField, "SelectedObjectiveSummaryVar", "Vector" ); m_objectiveValuesSummaryAddressesUiField.xmlCapability()->disableIO(); m_objectiveValuesSummaryAddressesUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddresses, "ObjectiveSummaryAddress", "Summary Address", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddresses, "ObjectiveSummaryAddress", "Summary Address" ); m_objectiveValuesSummaryAddresses.uiCapability()->setUiTreeHidden( true ); m_objectiveValuesSummaryAddresses.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSelectSummaryAddressPushButton, - "SelectObjectiveSummaryAddress", - "", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSelectSummaryAddressPushButton, "SelectObjectiveSummaryAddress", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_objectiveValuesSelectSummaryAddressPushButton ); m_objectiveValuesSelectSummaryAddressPushButton.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_objectiveValuesSelectSummaryAddressPushButton = false; - CAF_PDM_InitFieldNoDefault( &m_objectiveFunction, "ObjectiveFunction", "Objective Function", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveFunction, "ObjectiveFunction", "Objective Function" ); m_objectiveFunction = new RimObjectiveFunction(); m_objectiveFunction.uiCapability()->setUiTreeHidden( true ); m_objectiveFunction.uiCapability()->setUiTreeChildrenHidden( true ); m_objectiveFunction->changed.connect( this, &RimEnsembleCurveFilter::onObjectionFunctionChanged ); - CAF_PDM_InitFieldNoDefault( &m_customObjectiveFunction, "CustomObjectiveFunction", "Custom Objective Function", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_customObjectiveFunction, "CustomObjectiveFunction", "Custom Objective Function" ); m_customObjectiveFunction.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_minValue, "MinValue", m_lowerLimit, "Min", "", "", "" ); + CAF_PDM_InitField( &m_minValue, "MinValue", m_lowerLimit, "Min" ); m_minValue.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_maxValue, "MaxValue", m_upperLimit, "Max", "", "", "" ); + CAF_PDM_InitField( &m_maxValue, "MaxValue", m_upperLimit, "Max" ); m_maxValue.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_categories, "Categories", "Categories", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_categories, "Categories", "Categories" ); setDeletable( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp index 4fe1d65411..f508796dfe 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp @@ -39,14 +39,14 @@ RimEnsembleCurveFilterCollection::RimEnsembleCurveFilterCollection() { CAF_PDM_InitObject( "Curve Filters", ":/FilterCollection.svg", "", "" ); - CAF_PDM_InitField( &m_active, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_active, "Active", true, "Active" ); - CAF_PDM_InitFieldNoDefault( &m_filters, "CurveFilters", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filters, "CurveFilters", "" ); m_filters.uiCapability()->setUiTreeChildrenHidden( true ); // m_filters.uiCapability()->setUiEditorTypeName(caf::PdmUiTableViewEditor::uiEditorTypeName()); m_filters.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_newFilterButton, "NewEnsembleFilter", "New Filter", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_newFilterButton, "NewEnsembleFilter", "New Filter" ); m_newFilterButton = false; m_newFilterButton.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_newFilterButton.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 0b7d7573e8..308dcdc0dc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -100,122 +100,112 @@ RimEnsembleCurveSet::RimEnsembleCurveSet() { CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_curves, "EnsembleCurveSet", "Ensemble Curve Set", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curves, "EnsembleCurveSet", "Ensemble Curve Set" ); m_curves.uiCapability()->setUiTreeHidden( true ); m_curves.uiCapability()->setUiTreeChildrenHidden( false ); - CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves", "", "", "" ); + CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves" ); m_showCurves.uiCapability()->setUiHidden( true ); // Y Values - CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryCaseCollection, "SummaryGroup", "Ensemble", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryCaseCollection, "SummaryGroup", "Ensemble" ); m_yValuesSummaryCaseCollection.uiCapability()->setUiTreeChildrenHidden( true ); m_yValuesSummaryCaseCollection.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddressUiField, "SelectedVariableDisplayVar", "Vector", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddressUiField, "SelectedVariableDisplayVar", "Vector" ); m_yValuesSummaryAddressUiField.xmlCapability()->disableIO(); m_yValuesSummaryAddressUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddress, "SummaryAddress", "Summary Address", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddress, "SummaryAddress", "Summary Address" ); m_yValuesSummaryAddress.uiCapability()->setUiTreeHidden( true ); m_yValuesSummaryAddress.uiCapability()->setUiTreeChildrenHidden( true ); m_yValuesSummaryAddress = new RimSummaryAddress; - CAF_PDM_InitFieldNoDefault( &m_yPushButtonSelectSummaryAddress, "SelectAddress", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yPushButtonSelectSummaryAddress, "SelectAddress", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_yPushButtonSelectSummaryAddress ); m_yPushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_yPushButtonSelectSummaryAddress = false; - CAF_PDM_InitFieldNoDefault( &m_resampling, "Resampling", "Resampling", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resampling, "Resampling", "Resampling" ); - CAF_PDM_InitField( &m_colorMode, "ColorMode", caf::AppEnum( ColorMode::SINGLE_COLOR ), "Coloring Mode", "", "", "" ); + CAF_PDM_InitField( &m_colorMode, "ColorMode", caf::AppEnum( ColorMode::SINGLE_COLOR ), "Coloring Mode" ); - CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" ); + CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color" ); - CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter", "", "", "" ); + CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter" ); m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddressesUiField, "SelectedObjectiveSummaryVar", "Vector", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddressesUiField, "SelectedObjectiveSummaryVar", "Vector" ); m_objectiveValuesSummaryAddressesUiField.xmlCapability()->disableIO(); m_objectiveValuesSummaryAddressesUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddresses, "ObjectiveSummaryAddress", "Summary Address", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSummaryAddresses, "ObjectiveSummaryAddress", "Summary Address" ); m_objectiveValuesSummaryAddresses.uiCapability()->setUiTreeHidden( true ); m_objectiveValuesSummaryAddresses.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSelectSummaryAddressPushButton, - "SelectObjectiveSummaryAddress", - "", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveValuesSelectSummaryAddressPushButton, "SelectObjectiveSummaryAddress", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_objectiveValuesSelectSummaryAddressPushButton ); m_objectiveValuesSelectSummaryAddressPushButton.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_objectiveValuesSelectSummaryAddressPushButton = false; - CAF_PDM_InitFieldNoDefault( &m_customObjectiveFunction, "CustomObjectiveFunction", "Objective Function", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_customObjectiveFunction, "CustomObjectiveFunction", "Objective Function" ); m_customObjectiveFunction.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_showObjectiveFunctionFormula, "ShowObjectiveFunctionFormula", true, "Show Text Box in Plot", "", "", "" ); + CAF_PDM_InitField( &m_showObjectiveFunctionFormula, "ShowObjectiveFunctionFormula", true, "Show Text Box in Plot" ); - CAF_PDM_InitFieldNoDefault( &m_minDateRange, "MinDateRange", "From", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_minDateRange, "MinDateRange", "From" ); m_minDateRange.uiCapability()->setUiEditorTypeName( caf::PdmUiDateEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_minTimeStep, "MinTimeStep", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_minTimeStep, "MinTimeStep", "" ); m_minTimeStep.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_maxDateRange, "MaxDateRange", "To", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_maxDateRange, "MaxDateRange", "To" ); m_maxDateRange.uiCapability()->setUiEditorTypeName( caf::PdmUiDateEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_maxTimeStep, "MaxTimeStep", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_maxTimeStep, "MaxTimeStep", "" ); m_maxTimeStep.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); // Time Step Selection - CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Available Time Steps", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "Select Time Steps", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timeStepFilter, "TimeStepFilter", "Available Time Steps" ); + CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "Select Time Steps" ); m_selectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_selectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis" ); - CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "" ); m_legendConfig = new RimRegularLegendConfig(); m_legendConfig->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimEnsembleCurveSetColorManager::DEFAULT_ENSEMBLE_COLOR_RANGE ) ); - CAF_PDM_InitFieldNoDefault( &m_curveFilters, "CurveFilters", "Curve Filters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveFilters, "CurveFilters", "Curve Filters" ); m_curveFilters = new RimEnsembleCurveFilterCollection(); m_curveFilters->setUiTreeHidden( true ); m_curveFilters->uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_customObjectiveFunctions, - "CustomObjectiveFunctions", - "Custom Objective Functions", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_customObjectiveFunctions, "CustomObjectiveFunctions", "Custom Objective Functions" ); m_customObjectiveFunctions = new RimCustomObjectiveFunctionCollection(); m_customObjectiveFunctions->objectiveFunctionChanged.connect( this, &RimEnsembleCurveSet::onCustomObjectiveFunctionChanged ); - CAF_PDM_InitFieldNoDefault( &m_objectiveFunction, "ObjectiveFunction", "Objective Function", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_objectiveFunction, "ObjectiveFunction", "Objective Function" ); m_objectiveFunction = new RimObjectiveFunction(); m_objectiveFunction.uiCapability()->setUiTreeHidden( true ); m_objectiveFunction->changed.connect( this, &RimEnsembleCurveSet::onObjectiveFunctionChanged ); - CAF_PDM_InitFieldNoDefault( &m_statistics, "Statistics", "Statistics", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_statistics, "Statistics", "Statistics" ); m_statistics = new RimEnsembleStatistics( this ); m_statistics.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_userDefinedName, "UserDefinedName", QString( "Ensemble Curve Set" ), "Curve Set Name", "", "", "" ); + CAF_PDM_InitField( &m_userDefinedName, "UserDefinedName", QString( "Ensemble Curve Set" ), "Curve Set Name" ); - CAF_PDM_InitFieldNoDefault( &m_autoGeneratedName, "AutoGeneratedName", "Curve Set Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_autoGeneratedName, "AutoGeneratedName", "Curve Set Name" ); m_autoGeneratedName.registerGetMethod( this, &RimEnsembleCurveSet::createAutoName ); m_autoGeneratedName.uiCapability()->setUiReadOnly( true ); m_autoGeneratedName.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_summaryAddressNameTools, "SummaryAddressNameTools", "SummaryAddressNameTools", "", "", "" ); + CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name" ); + CAF_PDM_InitFieldNoDefault( &m_summaryAddressNameTools, "SummaryAddressNameTools", "SummaryAddressNameTools" ); m_summaryAddressNameTools.uiCapability()->setUiTreeHidden( true ); m_summaryAddressNameTools.uiCapability()->setUiTreeChildrenHidden( true ); @@ -233,7 +223,7 @@ RimEnsembleCurveSet::RimEnsembleCurveSet() // Obsolete fields - CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter" ); m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true ); m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeHidden( true ); m_yValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable( false ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp index c192a531d9..6846f86b72 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp @@ -42,14 +42,14 @@ RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection() { CAF_PDM_InitObject( "Ensemble Curve Sets", ":/EnsembleCurveSets16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_curveSets, "EnsembleCurveSets", "Ensemble Curve Sets", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveSets, "EnsembleCurveSets", "Ensemble Curve Sets" ); m_curveSets.uiCapability()->setUiTreeHidden( true ); m_curveSets.uiCapability()->setUiTreeChildrenHidden( false ); - CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves", "", "", "" ); + CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves" ); m_showCurves.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_ySourceStepping, "YSourceStepping", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ySourceStepping, "YSourceStepping", "" ); m_ySourceStepping = new RimSummaryPlotSourceStepping; m_ySourceStepping->setSourceSteppingType( RimSummaryPlotSourceStepping::Y_AXIS ); m_ySourceStepping.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp index 76b04bc47b..785fa1631d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp @@ -34,19 +34,19 @@ RimEnsembleStatistics::RimEnsembleStatistics( RimEnsembleCurveSetInterface* pare m_parentCurveSet = parentCurveSet; - CAF_PDM_InitField( &m_active, "Active", true, "Show Statistics Curves", "", "", "" ); - CAF_PDM_InitField( &m_hideEnsembleCurves, "HideEnsembleCurves", false, "Hide Ensemble Curves", "", "", "" ); - CAF_PDM_InitField( &m_basedOnFilteredCases, "BasedOnFilteredCases", false, "Based on Filtered Cases", "", "", "" ); - CAF_PDM_InitField( &m_showP10Curve, "ShowP10Curve", true, "P10", "", "", "" ); - CAF_PDM_InitField( &m_showP50Curve, "ShowP50Curve", false, "P50", "", "", "" ); - CAF_PDM_InitField( &m_showP90Curve, "ShowP90Curve", true, "P90", "", "", "" ); - CAF_PDM_InitField( &m_showMeanCurve, "ShowMeanCurve", true, "Mean", "", "", "" ); - CAF_PDM_InitField( &m_showCurveLabels, "ShowCurveLabels", true, "Show Curve Labels", "", "", "" ); - CAF_PDM_InitField( &m_includeIncompleteCurves, "IncludeIncompleteCurves", false, "Include Incomplete Curves", "", "", "" ); - - CAF_PDM_InitField( &m_warningLabel, "WarningLabel", QString( "Warning: Ensemble time range mismatch" ), "", "", "", "" ); - - CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" ); + CAF_PDM_InitField( &m_active, "Active", true, "Show Statistics Curves" ); + CAF_PDM_InitField( &m_hideEnsembleCurves, "HideEnsembleCurves", false, "Hide Ensemble Curves" ); + CAF_PDM_InitField( &m_basedOnFilteredCases, "BasedOnFilteredCases", false, "Based on Filtered Cases" ); + CAF_PDM_InitField( &m_showP10Curve, "ShowP10Curve", true, "P10" ); + CAF_PDM_InitField( &m_showP50Curve, "ShowP50Curve", false, "P50" ); + CAF_PDM_InitField( &m_showP90Curve, "ShowP90Curve", true, "P90" ); + CAF_PDM_InitField( &m_showMeanCurve, "ShowMeanCurve", true, "Mean" ); + CAF_PDM_InitField( &m_showCurveLabels, "ShowCurveLabels", true, "Show Curve Labels" ); + CAF_PDM_InitField( &m_includeIncompleteCurves, "IncludeIncompleteCurves", false, "Include Incomplete Curves" ); + + CAF_PDM_InitField( &m_warningLabel, "WarningLabel", QString( "Warning: Ensemble time range mismatch" ), "" ); + + CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color" ); m_warningLabel.xmlCapability()->disableIO(); m_warningLabel.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp index 04dcec64d0..4644b9fab3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp @@ -47,7 +47,7 @@ CAF_PDM_SOURCE_INIT( RimFileSummaryCase, "FileSummaryCase" ); RimFileSummaryCase::RimFileSummaryCase() { CAF_PDM_InitScriptableObject( "File Summary Case ", ":/SummaryCases16x16.png", "", "A Summary Case based on SMSPEC files" ); - CAF_PDM_InitScriptableField( &m_includeRestartFiles, "IncludeRestartFiles", false, "Include Restart Files", "", "", "" ); + CAF_PDM_InitScriptableField( &m_includeRestartFiles, "IncludeRestartFiles", false, "Include Restart Files" ); m_includeRestartFiles.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp index 8b2adcbee9..df309c42f4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp @@ -47,18 +47,18 @@ RimGridSummaryCase::RimGridSummaryCase() ":/SummaryCases16x16.png", "", "A Summary Case based on extracting grid data." ); - CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "Associated3DCase", "Eclipse Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "Associated3DCase", "Eclipse Case" ); m_eclipseCase.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_cachedCaseName, "CachedCasename", "Case Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cachedCaseName, "CachedCasename", "Case Name" ); m_cachedCaseName.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_eclipseGridFileName, "Associated3DCaseGridFileName", "Grid File Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseGridFileName, "Associated3DCaseGridFileName", "Grid File Name" ); m_eclipseGridFileName.registerGetMethod( this, &RimGridSummaryCase::eclipseGridFileName ); m_eclipseGridFileName.uiCapability()->setUiReadOnly( true ); m_eclipseGridFileName.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_includeRestartFiles, "IncludeRestartFiles", false, "Include Restart Files", "", "", "" ); + CAF_PDM_InitField( &m_includeRestartFiles, "IncludeRestartFiles", false, "Include Restart Files" ); m_includeRestartFiles.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp index 869157c923..a73998edb2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp @@ -53,9 +53,9 @@ RimObjectiveFunction::RimObjectiveFunction() : changed( this ) { - CAF_PDM_InitObject( "Objective Function", "", "", "" ); + CAF_PDM_InitObject( "Objective Function" ); - CAF_PDM_InitFieldNoDefault( &m_functionType, "FunctionType", "Function Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_functionType, "FunctionType", "Function Type" ); CAF_PDM_InitField( &m_normalizeByNumberOfObservations, "NormalizeByNumberOfObservations", @@ -73,9 +73,9 @@ RimObjectiveFunction::RimObjectiveFunction() "", "" ); - CAF_PDM_InitField( &m_errorEstimatePercentage, "ErrorEstimatePercentage", 100.0, "Error Estimate [0..100 %]", "", "", "" ); + CAF_PDM_InitField( &m_errorEstimatePercentage, "ErrorEstimatePercentage", 100.0, "Error Estimate [0..100 %]" ); - CAF_PDM_InitField( &m_useSquaredError, "UseSquaredError", true, "Use Squared Error Term", "", "", "" ); + CAF_PDM_InitField( &m_useSquaredError, "UseSquaredError", true, "Use Squared Error Term" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp index bd402becd1..72b0f7f88e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp @@ -34,12 +34,12 @@ RimObservedSummaryData::RimObservedSummaryData() { m_isObservedData = true; - CAF_PDM_InitFieldNoDefault( &m_importedSummaryData, "ImportedSummaryData", "Imported Summary Data", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_importedSummaryData, "ImportedSummaryData", "Imported Summary Data" ); m_importedSummaryData.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); m_importedSummaryData.uiCapability()->setUiReadOnly( true ); m_importedSummaryData.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_useCustomIdentifier, "UseCustomIdentifier", false, "Use Custom Identifier", "", "", "" ); + CAF_PDM_InitField( &m_useCustomIdentifier, "UseCustomIdentifier", false, "Use Custom Identifier" ); m_useCustomIdentifier.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &m_summaryCategory, "SummaryType", @@ -49,7 +49,7 @@ RimObservedSummaryData::RimObservedSummaryData() "", "" ); m_summaryCategory.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_identifierName, "IdentifierName", "Identifier Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_identifierName, "IdentifierName", "Identifier Name" ); m_identifierName.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp index 4fd02de976..cea2e0e94a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp @@ -58,20 +58,20 @@ CAF_PDM_SOURCE_INIT( RimSummaryAddress, "SummaryAddress" ); //-------------------------------------------------------------------------------------------------- RimSummaryAddress::RimSummaryAddress() { - CAF_PDM_InitFieldNoDefault( &m_category, "SummaryVarType", "Type", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_quantityName, "SummaryQuantityName", "Quantity", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_regionNumber, "SummaryRegion", "Region", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_regionNumber2, "SummaryRegion2", "Region2", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellGroupName, "SummaryWellGroup", "Group", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellName, "SummaryWell", "Well", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellSegmentNumber, "SummaryWellSegment", "Well Segment", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_lgrName, "SummaryLgr", "Grid", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_cellI, "SummaryCellI", "I", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_cellJ, "SummaryCellJ", "J", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_cellK, "SummaryCellK", "K", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_aquiferNumber, "SummaryAquifer", "Aquifer", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_isErrorResult, "IsErrorResult", "Is Error Result", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_calculationId, "CalculationId", "Calculation Id", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_category, "SummaryVarType", "Type" ); + CAF_PDM_InitFieldNoDefault( &m_quantityName, "SummaryQuantityName", "Quantity" ); + CAF_PDM_InitFieldNoDefault( &m_regionNumber, "SummaryRegion", "Region" ); + CAF_PDM_InitFieldNoDefault( &m_regionNumber2, "SummaryRegion2", "Region2" ); + CAF_PDM_InitFieldNoDefault( &m_wellGroupName, "SummaryWellGroup", "Group" ); + CAF_PDM_InitFieldNoDefault( &m_wellName, "SummaryWell", "Well" ); + CAF_PDM_InitFieldNoDefault( &m_wellSegmentNumber, "SummaryWellSegment", "Well Segment" ); + CAF_PDM_InitFieldNoDefault( &m_lgrName, "SummaryLgr", "Grid" ); + CAF_PDM_InitFieldNoDefault( &m_cellI, "SummaryCellI", "I" ); + CAF_PDM_InitFieldNoDefault( &m_cellJ, "SummaryCellJ", "J" ); + CAF_PDM_InitFieldNoDefault( &m_cellK, "SummaryCellK", "K" ); + CAF_PDM_InitFieldNoDefault( &m_aquiferNumber, "SummaryAquifer", "Aquifer" ); + CAF_PDM_InitFieldNoDefault( &m_isErrorResult, "IsErrorResult", "Is Error Result" ); + CAF_PDM_InitFieldNoDefault( &m_calculationId, "CalculationId", "Calculation Id" ); m_category = RifEclipseSummaryAddress::SUMMARY_INVALID; m_regionNumber = -1; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp index 7a544f8564..86f3e451a6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp @@ -47,17 +47,17 @@ RimSummaryCase::RimSummaryCase() { CAF_PDM_InitScriptableObject( "Summary Case", ":/SummaryCase.svg", "", "The Base Class for all Summary Cases" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_displayName, "ShortName", "Display Name", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_displayNameOption, "NameSetting", "Name Setting", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_displayName, "ShortName", "Display Name" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_displayNameOption, "NameSetting", "Name Setting" ); - CAF_PDM_InitScriptableField( &m_useAutoShortName_OBSOLETE, "AutoShortyName", false, "Use Auto Display Name", "", "", "" ); + CAF_PDM_InitScriptableField( &m_useAutoShortName_OBSOLETE, "AutoShortyName", false, "Use Auto Display Name" ); m_useAutoShortName_OBSOLETE.xmlCapability()->setIOWritable( false ); m_useAutoShortName_OBSOLETE.uiCapability()->setUiHidden( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_summaryHeaderFilename, "SummaryHeaderFilename", "Summary Header File", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_summaryHeaderFilename, "SummaryHeaderFilename", "Summary Header File" ); m_summaryHeaderFilename.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitScriptableField( &m_caseId, "Id", -1, "Case ID", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "Id", -1, "Case ID" ); m_caseId.registerKeywordAlias( "CaseId" ); m_caseId.uiCapability()->setUiReadOnly( true ); m_caseId.capability()->setIOWriteable( false ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index 879c99fa7d..46bcbdf9f1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -107,19 +107,19 @@ RimSummaryCaseCollection::RimSummaryCaseCollection() { CAF_PDM_InitScriptableObject( "Summary Case Group", ":/SummaryGroup16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_cases, "SummaryCases", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cases, "SummaryCases", "" ); m_cases.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitScriptableField( &m_name, "SummaryCollectionName", QString( "Group" ), "Name", "", "", "" ); + CAF_PDM_InitScriptableField( &m_name, "SummaryCollectionName", QString( "Group" ), "Name" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_nameAndItemCount, "NameCount", "Name", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_nameAndItemCount, "NameCount", "Name" ); m_nameAndItemCount.registerGetMethod( this, &RimSummaryCaseCollection::nameAndItemCount ); RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_nameAndItemCount ); - CAF_PDM_InitScriptableField( &m_isEnsemble, "IsEnsemble", false, "Is Ensemble", "", "", "" ); + CAF_PDM_InitScriptableField( &m_isEnsemble, "IsEnsemble", false, "Is Ensemble" ); m_isEnsemble.uiCapability()->setUiHidden( true ); - CAF_PDM_InitScriptableField( &m_ensembleId, "Id", -1, "Ensemble ID", "", "", "" ); + CAF_PDM_InitScriptableField( &m_ensembleId, "Id", -1, "Ensemble ID" ); m_ensembleId.registerKeywordAlias( "EnsembleId" ); m_ensembleId.uiCapability()->setUiReadOnly( true ); m_ensembleId.capability()->setIOWriteable( false ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index d351bb20f1..5db2ba0b98 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -97,8 +97,8 @@ RimSummaryCaseMainCollection::RimSummaryCaseMainCollection() { CAF_PDM_InitObject( "Summary Cases", ":/SummaryCases16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_cases, "SummaryCases", "", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_caseCollections, "SummaryCaseCollections", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cases, "SummaryCases", "" ); + CAF_PDM_InitFieldNoDefault( &m_caseCollections, "SummaryCaseCollections", "" ); m_cases.uiCapability()->setUiTreeHidden( true ); m_caseCollections.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp index 0f5fb8842a..ddedbd407f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp @@ -33,7 +33,7 @@ RimSummaryCrossPlotCollection::RimSummaryCrossPlotCollection() { CAF_PDM_InitObject( "Summary Cross Plots", ":/SummaryXPlotsLight16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_summaryCrossPlots, "SummaryCrossPlots", "Summary Cross Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryCrossPlots, "SummaryCrossPlots", "Summary Cross Plots" ); m_summaryCrossPlots.uiCapability()->setUiTreeHidden( true ); caf::PdmFieldReorderCapability::addToField( &m_summaryCrossPlots ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index f2db0bec13..3232b054c5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -68,41 +68,41 @@ RimSummaryCurve::RimSummaryCurve() CAF_PDM_InitObject( "Summary Curve", ":/SummaryCurve16x16.png", "", "" ); // Y Values - CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryCase, "SummaryCase", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryCase, "SummaryCase", "Case" ); m_yValuesSummaryCase.uiCapability()->setUiTreeChildrenHidden( true ); m_yValuesSummaryCase.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddressUiField, "SelectedVariableDisplayVar", "Vector", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddressUiField, "SelectedVariableDisplayVar", "Vector" ); m_yValuesSummaryAddressUiField.xmlCapability()->disableIO(); m_yValuesSummaryAddressUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddress, "SummaryAddress", "Summary Address", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryAddress, "SummaryAddress", "Summary Address" ); m_yValuesSummaryAddress.uiCapability()->setUiTreeHidden( true ); m_yValuesSummaryAddress.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_yPushButtonSelectSummaryAddress, "SelectAddress", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yPushButtonSelectSummaryAddress, "SelectAddress", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_yPushButtonSelectSummaryAddress ); m_yPushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_yPushButtonSelectSummaryAddress = false; m_yValuesSummaryAddress = new RimSummaryAddress; - CAF_PDM_InitFieldNoDefault( &m_resampling, "Resampling", "Resampling", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resampling, "Resampling", "Resampling" ); // X Values - CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryCase, "SummaryCaseX", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryCase, "SummaryCaseX", "Case" ); m_xValuesSummaryCase.uiCapability()->setUiTreeChildrenHidden( true ); m_xValuesSummaryCase.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryAddressUiField, "SelectedVariableDisplayVarX", "Vector", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryAddressUiField, "SelectedVariableDisplayVarX", "Vector" ); m_xValuesSummaryAddressUiField.xmlCapability()->disableIO(); m_xValuesSummaryAddressUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryAddress, "SummaryAddressX", "Summary Address", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryAddress, "SummaryAddressX", "Summary Address" ); m_xValuesSummaryAddress.uiCapability()->setUiTreeHidden( true ); m_xValuesSummaryAddress.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_xPushButtonSelectSummaryAddress, "SelectAddressX", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_xPushButtonSelectSummaryAddress, "SelectAddressX", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_xPushButtonSelectSummaryAddress ); m_xPushButtonSelectSummaryAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); @@ -111,30 +111,30 @@ RimSummaryCurve::RimSummaryCurve() m_xValuesSummaryAddress = new RimSummaryAddress; // Other members - CAF_PDM_InitFieldNoDefault( &m_isEnsembleCurve, "IsEnsembleCurve", "Ensemble Curve", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_isEnsembleCurve, "IsEnsembleCurve", "Ensemble Curve" ); m_isEnsembleCurve.v() = caf::Tristate::State::PartiallyTrue; - CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis" ); - CAF_PDM_InitFieldNoDefault( &m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig" ); m_curveNameConfig.uiCapability()->setUiTreeHidden( true ); m_curveNameConfig.uiCapability()->setUiTreeChildrenHidden( true ); m_curveNameConfig = new RimSummaryCurveAutoName; - CAF_PDM_InitField( &m_isTopZWithinCategory, "isTopZWithinCategory", false, "", "", "", "" ); + CAF_PDM_InitField( &m_isTopZWithinCategory, "isTopZWithinCategory", false, "" ); m_isTopZWithinCategory.uiCapability()->setUiHidden( true ); setSymbolSkipDistance( 10.0f ); setLineThickness( 2 ); - CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter" ); m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true ); m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeHidden( true ); m_yValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable( false ); m_yValuesSummaryFilter_OBSOLETE = new RimSummaryFilter_OBSOLETE; - CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryFilter_OBSOLETE, "VarListFilterX", "Filter", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryFilter_OBSOLETE, "VarListFilterX", "Filter" ); m_xValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true ); m_xValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeHidden( true ); m_xValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable( false ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index 531d7e7800..4080ee8ed5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -50,34 +50,34 @@ RimSummaryCurveCollection::RimSummaryCurveCollection() { CAF_PDM_InitObject( "Summary Curves", ":/SummaryCurveFilter16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_curves, "CollectionCurves", "Collection Curves", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curves, "CollectionCurves", "Collection Curves" ); m_curves.uiCapability()->setUiTreeHidden( true ); m_curves.uiCapability()->setUiTreeChildrenHidden( false ); caf::PdmFieldReorderCapability::addToFieldWithCallback( &m_curves, this, &RimSummaryCurveCollection::onCurvesReordered ); - CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves", "", "", "" ); + CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves" ); m_showCurves.uiCapability()->setUiHidden( true ); m_showCurves.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_editPlot, "EditPlot", false, "", "", "", "" ); + CAF_PDM_InitField( &m_editPlot, "EditPlot", false, "" ); m_editPlot.xmlCapability()->disableIO(); m_editPlot.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_ySourceStepping, "YSourceStepping", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ySourceStepping, "YSourceStepping", "" ); m_ySourceStepping = new RimSummaryPlotSourceStepping; m_ySourceStepping->setSourceSteppingType( RimSummaryPlotSourceStepping::Y_AXIS ); m_ySourceStepping.uiCapability()->setUiTreeHidden( true ); m_ySourceStepping.uiCapability()->setUiTreeChildrenHidden( true ); m_ySourceStepping.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_xSourceStepping, "XSourceStepping", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_xSourceStepping, "XSourceStepping", "" ); m_xSourceStepping = new RimSummaryPlotSourceStepping; m_xSourceStepping->setSourceSteppingType( RimSummaryPlotSourceStepping::X_AXIS ); m_xSourceStepping.uiCapability()->setUiTreeHidden( true ); m_xSourceStepping.uiCapability()->setUiTreeChildrenHidden( true ); m_xSourceStepping.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_unionSourceStepping, "UnionSourceStepping", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_unionSourceStepping, "UnionSourceStepping", "" ); m_unionSourceStepping = new RimSummaryPlotSourceStepping; m_unionSourceStepping->setSourceSteppingType( RimSummaryPlotSourceStepping::UNION_X_Y_AXIS ); m_unionSourceStepping.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp index 3f0f094ef1..35969f6add 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp @@ -48,14 +48,14 @@ RimSummaryCurveFilter_OBSOLETE::RimSummaryCurveFilter_OBSOLETE() { CAF_PDM_InitObject( "Curve Filter", ":/SummaryCurveFilter16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_selectedSummaryCases, "SummaryCases", "Cases", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedSummaryCases, "SummaryCases", "Cases" ); m_selectedSummaryCases.uiCapability()->setUiTreeChildrenHidden( true ); m_selectedSummaryCases.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); m_selectedSummaryCases.uiCapability()->setAutoAddingOptionFromValue( false ); m_selectedSummaryCases.xmlCapability()->disableIO(); m_selectedSummaryCases.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_summaryFilter, "VarListFilter", "Filter", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryFilter, "VarListFilter", "Filter" ); m_summaryFilter.uiCapability()->setUiTreeChildrenHidden( true ); m_summaryFilter.uiCapability()->setUiTreeHidden( true ); @@ -72,33 +72,33 @@ RimSummaryCurveFilter_OBSOLETE::RimSummaryCurveFilter_OBSOLETE() m_uiFilterResultMultiSelection.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_uiFilterResultMultiSelection.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault( &m_curves, "FilteredCurves", "Filtered Curves", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curves, "FilteredCurves", "Filtered Curves" ); m_curves.uiCapability()->setUiTreeHidden( true ); m_curves.uiCapability()->setUiTreeChildrenHidden( false ); - CAF_PDM_InitFieldNoDefault( &m_applyButtonField, "ApplySelection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_applyButtonField, "ApplySelection", "" ); m_applyButtonField.xmlCapability()->disableIO(); m_applyButtonField = false; m_applyButtonField.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_applyButtonField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LEFT ); - CAF_PDM_InitField( &m_autoApplyChangesToPlot, "AutoApplyFilterChanges", true, "Auto Apply Changes", "", "", "" ); + CAF_PDM_InitField( &m_autoApplyChangesToPlot, "AutoApplyFilterChanges", true, "Auto Apply Changes" ); - CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves", "", "", "" ); + CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves" ); m_showCurves.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_useAutoAppearanceAssignment, "UseAutoAppearanceAssignment", true, "Auto", "", "", "" ); + CAF_PDM_InitField( &m_useAutoAppearanceAssignment, "UseAutoAppearanceAssignment", true, "Auto" ); - CAF_PDM_InitFieldNoDefault( &m_caseAppearanceType, "CaseAppearanceType", "Case", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_variableAppearanceType, "VariableAppearanceType", "Vector", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellAppearanceType, "WellAppearanceType", "Well", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_groupAppearanceType, "GroupAppearanceType", "Group", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_regionAppearanceType, "RegionAppearanceType", "Region", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_caseAppearanceType, "CaseAppearanceType", "Case" ); + CAF_PDM_InitFieldNoDefault( &m_variableAppearanceType, "VariableAppearanceType", "Vector" ); + CAF_PDM_InitFieldNoDefault( &m_wellAppearanceType, "WellAppearanceType", "Well" ); + CAF_PDM_InitFieldNoDefault( &m_groupAppearanceType, "GroupAppearanceType", "Group" ); + CAF_PDM_InitFieldNoDefault( &m_regionAppearanceType, "RegionAppearanceType", "Region" ); - CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis", "", "", "" ); - CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Contribute To Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis" ); + CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Contribute To Legend" ); - CAF_PDM_InitFieldNoDefault( &m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig" ); m_curveNameConfig.uiCapability()->setUiTreeHidden( true ); m_curveNameConfig.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.cpp index 7f13056a00..6c7c5ee246 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.cpp @@ -54,18 +54,18 @@ CAF_PDM_SOURCE_INIT( RimSummaryFilter_OBSOLETE, "SummaryFilterSettings" ); //-------------------------------------------------------------------------------------------------- RimSummaryFilter_OBSOLETE::RimSummaryFilter_OBSOLETE() { - CAF_PDM_InitObject( "Summary Filter", "", "", "" ); - - CAF_PDM_InitFieldNoDefault( &m_filterType, "SummaryFilterType", "Search", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_completeVarStringFilter, "SummaryCompleteVarStringFilter", "Filter", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_filterQuantityName, "SummaryVarQuantityFilter", "Vector name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_regionNumberFilter, "SummaryRegionNumberFilter", "Region number", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_regionNumber2Filter, "SummaryRegionNumber2Filter", "2. Region number", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellGroupNameFilter, "SummaryWellGroupNameFilter", "Group name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellNameFilter, "SummaryWellNameFilter", "Well name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellSegmentNumberFilter, "SummaryWellSegmentNumberFilter", "Segment number", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_lgrNameFilter, "SummaryLgrNameFilter", "LGR Name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_cellIJKFilter, "SummaryCellIJKFilter", "I, J, K", "", "", "" ); + CAF_PDM_InitObject( "Summary Filter" ); + + CAF_PDM_InitFieldNoDefault( &m_filterType, "SummaryFilterType", "Search" ); + CAF_PDM_InitFieldNoDefault( &m_completeVarStringFilter, "SummaryCompleteVarStringFilter", "Filter" ); + CAF_PDM_InitFieldNoDefault( &m_filterQuantityName, "SummaryVarQuantityFilter", "Vector name" ); + CAF_PDM_InitFieldNoDefault( &m_regionNumberFilter, "SummaryRegionNumberFilter", "Region number" ); + CAF_PDM_InitFieldNoDefault( &m_regionNumber2Filter, "SummaryRegionNumber2Filter", "2. Region number" ); + CAF_PDM_InitFieldNoDefault( &m_wellGroupNameFilter, "SummaryWellGroupNameFilter", "Group name" ); + CAF_PDM_InitFieldNoDefault( &m_wellNameFilter, "SummaryWellNameFilter", "Well name" ); + CAF_PDM_InitFieldNoDefault( &m_wellSegmentNumberFilter, "SummaryWellSegmentNumberFilter", "Segment number" ); + CAF_PDM_InitFieldNoDefault( &m_lgrNameFilter, "SummaryLgrNameFilter", "LGR Name" ); + CAF_PDM_InitFieldNoDefault( &m_cellIJKFilter, "SummaryCellIJKFilter", "I, J, K" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 23ce5e6053..9c6699bca1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -201,36 +201,36 @@ RimSummaryPlot::RimSummaryPlot() { CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" ); - CAF_PDM_InitScriptableField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto Title", "", "", "" ); - CAF_PDM_InitScriptableField( &m_description, "PlotDescription", QString( "Summary Plot" ), "Name", "", "", "" ); - CAF_PDM_InitScriptableField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "" ); + CAF_PDM_InitScriptableField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto Title" ); + CAF_PDM_InitScriptableField( &m_description, "PlotDescription", QString( "Summary Plot" ), "Name" ); + CAF_PDM_InitScriptableField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves" ); - CAF_PDM_InitFieldNoDefault( &m_summaryCurveCollection, "SummaryCurveCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryCurveCollection, "SummaryCurveCollection", "" ); m_summaryCurveCollection.uiCapability()->setUiTreeHidden( true ); m_summaryCurveCollection = new RimSummaryCurveCollection; m_summaryCurveCollection->curvesChanged.connect( this, &RimSummaryPlot::onCurveCollectionChanged ); - CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSetCollection, "EnsembleCurveSetCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSetCollection, "EnsembleCurveSetCollection", "" ); m_ensembleCurveSetCollection.uiCapability()->setUiTreeHidden( true ); m_ensembleCurveSetCollection = new RimEnsembleCurveSetCollection(); - CAF_PDM_InitFieldNoDefault( &m_gridTimeHistoryCurves, "GridTimeHistoryCurves", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_gridTimeHistoryCurves, "GridTimeHistoryCurves", "" ); m_gridTimeHistoryCurves.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_asciiDataCurves, "AsciiDataCurves", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_asciiDataCurves, "AsciiDataCurves", "" ); m_asciiDataCurves.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_leftYAxisProperties, "LeftYAxisProperties", "Left Y Axis", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_leftYAxisProperties, "LeftYAxisProperties", "Left Y Axis" ); m_leftYAxisProperties.uiCapability()->setUiTreeHidden( true ); m_leftYAxisProperties = new RimPlotAxisProperties; m_leftYAxisProperties->setNameAndAxis( "Left Y-Axis", QwtPlot::yLeft ); - CAF_PDM_InitFieldNoDefault( &m_rightYAxisProperties, "RightYAxisProperties", "Right Y Axis", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_rightYAxisProperties, "RightYAxisProperties", "Right Y Axis" ); m_rightYAxisProperties.uiCapability()->setUiTreeHidden( true ); m_rightYAxisProperties = new RimPlotAxisProperties; m_rightYAxisProperties->setNameAndAxis( "Right Y-Axis", QwtPlot::yRight ); - CAF_PDM_InitFieldNoDefault( &m_bottomAxisProperties, "BottomAxisProperties", "Bottom X Axis", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_bottomAxisProperties, "BottomAxisProperties", "Bottom X Axis" ); m_bottomAxisProperties.uiCapability()->setUiTreeHidden( true ); m_bottomAxisProperties = new RimPlotAxisProperties; m_bottomAxisProperties->setNameAndAxis( "Bottom X-Axis", QwtPlot::xBottom ); @@ -239,16 +239,11 @@ RimSummaryPlot::RimSummaryPlot() connectAxisSignals( m_rightYAxisProperties() ); connectAxisSignals( m_bottomAxisProperties() ); - CAF_PDM_InitFieldNoDefault( &m_timeAxisProperties, "TimeAxisProperties", "Time Axis", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timeAxisProperties, "TimeAxisProperties", "Time Axis" ); m_timeAxisProperties.uiCapability()->setUiTreeHidden( true ); m_timeAxisProperties = new RimSummaryTimeAxisProperties; - CAF_PDM_InitFieldNoDefault( &m_textCurveSetEditor, - "SummaryPlotFilterTextCurveSetEditor", - "Text Filter Curve Creator", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_textCurveSetEditor, "SummaryPlotFilterTextCurveSetEditor", "Text Filter Curve Creator" ); m_textCurveSetEditor.uiCapability()->setUiTreeHidden( true ); m_textCurveSetEditor = new RimSummaryPlotFilterTextCurveSetEditor; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp index c34ba3b365..bb4dec0089 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp @@ -39,7 +39,7 @@ RimSummaryPlotCollection::RimSummaryPlotCollection() { CAF_PDM_InitScriptableObject( "Summary Plots", ":/SummaryPlotsLight16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_summaryPlots, "SummaryPlots", "Summary Plots", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryPlots, "SummaryPlots", "Summary Plots" ); m_summaryPlots.uiCapability()->setUiTreeHidden( true ); caf::PdmFieldReorderCapability::addToField( &m_summaryPlots ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp index 937f223403..64c89fae9a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp @@ -68,7 +68,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryPlotFilterTextCurveSetEditor, "SummaryPlotFilterT RimSummaryPlotFilterTextCurveSetEditor::RimSummaryPlotFilterTextCurveSetEditor() : m_isFieldRecentlyChangedFromGui( false ) { - CAF_PDM_InitObject( "Curve Set Filter Text", "", "", "" ); + CAF_PDM_InitObject( "Curve Set Filter Text" ); // clang-format off QString filterTextHeading = "Create Summary Curves from Text"; @@ -85,7 +85,7 @@ RimSummaryPlotFilterTextCurveSetEditor::RimSummaryPlotFilterTextCurveSetEditor() QString toolTipPropertyEditor = filterTextHeading + "\n\n" + filterTextToolTip; QString toolTipToolbar = filterTextHeading + filterTextShortcut + "\n\n" + filterTextToolTip; - CAF_PDM_InitFieldNoDefault( &m_curveFilterLabelText, "Summary", "Summary", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveFilterLabelText, "Summary", "Summary" ); m_curveFilterLabelText.uiCapability()->setUiEditorTypeName( caf::PdmUiLabelEditor::uiEditorTypeName() ); m_curveFilterLabelText.xmlCapability()->disableIO(); @@ -96,7 +96,7 @@ RimSummaryPlotFilterTextCurveSetEditor::RimSummaryPlotFilterTextCurveSetEditor() // Special tool tip for toolbar m_curveFilterText.uiCapability()->setUiToolTip( toolTipToolbar, caf::PdmUiToolBarEditor::uiEditorConfigName() ); - CAF_PDM_InitFieldNoDefault( &m_selectedSources, "SummaryCases", "Sources", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedSources, "SummaryCases", "Sources" ); m_selectedSources.uiCapability()->setAutoAddingOptionFromValue( false ); m_selectedSources.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_selectedSources.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index c56ced5314..524ae6358b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -51,9 +51,9 @@ CAF_PDM_SOURCE_INIT( RimSummaryPlotSourceStepping, "RimSummaryCurveCollectionMod RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() : m_sourceSteppingType( Y_AXIS ) { - CAF_PDM_InitObject( "Summary Curves Modifier", "", "", "" ); + CAF_PDM_InitObject( "Summary Curves Modifier" ); - CAF_PDM_InitFieldNoDefault( &m_summaryCase, "CurveCase", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryCase, "CurveCase", "Case" ); CAF_PDM_InitField( &m_includeEnsembleCasesForCaseStepping, "IncludeEnsembleCasesForCaseStepping", @@ -63,19 +63,19 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellGroupName, "GroupName", "Group Name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_region, "Region", "Region", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_quantity, "Quantities", "Quantity", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name" ); + CAF_PDM_InitFieldNoDefault( &m_wellGroupName, "GroupName", "Group Name" ); + CAF_PDM_InitFieldNoDefault( &m_region, "Region", "Region" ); + CAF_PDM_InitFieldNoDefault( &m_quantity, "Quantities", "Quantity" ); - CAF_PDM_InitFieldNoDefault( &m_cellBlock, "CellBlock", "Block", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_segment, "Segment", "Segment", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_completion, "Completion", "Completion", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_aquifer, "Aquifer", "Aquifer", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cellBlock, "CellBlock", "Block" ); + CAF_PDM_InitFieldNoDefault( &m_segment, "Segment", "Segment" ); + CAF_PDM_InitFieldNoDefault( &m_completion, "Completion", "Completion" ); + CAF_PDM_InitFieldNoDefault( &m_aquifer, "Aquifer", "Aquifer" ); - CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble" ); - CAF_PDM_InitFieldNoDefault( &m_placeholderForLabel, "Placeholder", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_placeholderForLabel, "Placeholder", "" ); m_placeholderForLabel = "No common identifiers detected"; m_placeholderForLabel.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_placeholderForLabel.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index 44f3305d12..842aa44c24 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -70,54 +70,54 @@ RimSummaryTimeAxisProperties::RimSummaryTimeAxisProperties() { CAF_PDM_InitObject( "Time Axis", ":/BottomAxis16x16.png", "", "" ); - CAF_PDM_InitField( &m_isActive, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &showTitle, "ShowTitle", false, "Show Title ", "", "", "" ); - CAF_PDM_InitField( &title, "Title", QString( "Time" ), "Title ", "", "", "" ); + CAF_PDM_InitField( &showTitle, "ShowTitle", false, "Show Title " ); + CAF_PDM_InitField( &title, "Title", QString( "Time" ), "Title " ); - CAF_PDM_InitField( &m_isAutoZoom, "AutoZoom", true, "Set Range Automatically", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_timeMode, "TimeMode", "Time Mode", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_timeUnit, "TimeUnit", "Time Unit", "", "", "" ); + CAF_PDM_InitField( &m_isAutoZoom, "AutoZoom", true, "Set Range Automatically" ); + CAF_PDM_InitFieldNoDefault( &m_timeMode, "TimeMode", "Time Mode" ); + CAF_PDM_InitFieldNoDefault( &m_timeUnit, "TimeUnit", "Time Unit" ); - CAF_PDM_InitFieldNoDefault( &m_visibleDateRangeMax, "VisibleDateRangeMax", "Max Date", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_visibleDateRangeMax, "VisibleDateRangeMax", "Max Date" ); m_visibleDateRangeMax.uiCapability()->setUiEditorTypeName( caf::PdmUiDateEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_visibleDateRangeMin, "VisibleDateRangeMin", "Min Date", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_visibleDateRangeMin, "VisibleDateRangeMin", "Min Date" ); m_visibleDateRangeMin.uiCapability()->setUiEditorTypeName( caf::PdmUiDateEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_visibleTimeRangeMax, "VisibleTimeRangeMax", "MaxTime", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_visibleTimeRangeMax, "VisibleTimeRangeMax", "MaxTime" ); m_visibleTimeRangeMax.uiCapability()->setUiEditorTypeName( caf::PdmUiTimeEditor::uiEditorTypeName() ); m_visibleTimeRangeMax.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_visibleTimeRangeMin, "VisibleTimeRangeMin", "Min Time", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_visibleTimeRangeMin, "VisibleTimeRangeMin", "Min Time" ); m_visibleTimeRangeMin.uiCapability()->setUiEditorTypeName( caf::PdmUiTimeEditor::uiEditorTypeName() ); m_visibleTimeRangeMin.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitFieldNoDefault( &m_visibleTimeSinceStartRangeMax, "VisibleTimeModeRangeMax", "Max", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_visibleTimeSinceStartRangeMax, "VisibleTimeModeRangeMax", "Max" ); m_visibleTimeSinceStartRangeMax.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_visibleTimeSinceStartRangeMin, "VisibleTimeModeRangeMin", "Min", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_visibleTimeSinceStartRangeMin, "VisibleTimeModeRangeMin", "Min" ); m_visibleTimeSinceStartRangeMin.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_titlePositionEnum, "TitlePosition", "Title Position", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_titleFontSize, "FontSize", "Font Size", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_valuesFontSize, "ValuesFontSize", "Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_titlePositionEnum, "TitlePosition", "Title Position" ); + CAF_PDM_InitFieldNoDefault( &m_titleFontSize, "FontSize", "Font Size" ); + CAF_PDM_InitFieldNoDefault( &m_valuesFontSize, "ValuesFontSize", "Font Size" ); - CAF_PDM_InitField( &m_automaticDateComponents, "AutoDate", true, "Automatic Date/Time Labels", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_dateComponents, "DateComponents", "Set Date Label", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_timeComponents, "TimeComponents", "Set Time Label", "", "", "" ); + CAF_PDM_InitField( &m_automaticDateComponents, "AutoDate", true, "Automatic Date/Time Labels" ); + CAF_PDM_InitFieldNoDefault( &m_dateComponents, "DateComponents", "Set Date Label" ); + CAF_PDM_InitFieldNoDefault( &m_timeComponents, "TimeComponents", "Set Time Label" ); - CAF_PDM_InitFieldNoDefault( &m_dateFormat, "DateFormat", "Date Label Format", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_dateFormat, "DateFormat", "Date Label Format" ); m_dateFormat.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); m_dateFormat = RiaPreferences::current()->dateFormat(); - CAF_PDM_InitFieldNoDefault( &m_timeFormat, "TimeFormat", "Time Label Format", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timeFormat, "TimeFormat", "Time Label Format" ); m_timeFormat.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); m_timeFormat = RiaPreferences::current()->timeFormat(); - CAF_PDM_InitFieldNoDefault( &m_majorTickmarkCount, "MajorTickmarkCount", "Major Tickmark Count", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_majorTickmarkCount, "MajorTickmarkCount", "Major Tickmark Count" ); - CAF_PDM_InitFieldNoDefault( &m_annotations, "Annotations", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_annotations, "Annotations", "" ); m_annotations.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleStatisticsSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleStatisticsSurface.cpp index d7f45e9301..e17a89afea 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleStatisticsSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleStatisticsSurface.cpp @@ -37,7 +37,7 @@ RimEnsembleStatisticsSurface::RimEnsembleStatisticsSurface() { CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_statisticsType, "StatisticsType", "StatisticsType", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_statisticsType, "StatisticsType", "StatisticsType" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp index 9c0d73058c..09a632a5a4 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp @@ -44,7 +44,7 @@ RimEnsembleSurface::RimEnsembleSurface() { CAF_PDM_InitScriptableObject( "Ensemble Surface", ":/ReservoirSurfaces16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSet, "FilterEnsembleCurveSet", "Filter by Ensemble Curve Set", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSet, "FilterEnsembleCurveSet", "Filter by Ensemble Curve Set" ); std::vector statisticsTypes = { RigSurfaceStatisticsCalculator::StatisticsType::MIN, diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp index 19cff0309f..ffbe787495 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp @@ -40,7 +40,7 @@ RimFileSurface::RimFileSurface() { CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_surfaceDefinitionFilePath, "SurfaceFilePath", "File", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_surfaceDefinitionFilePath, "SurfaceFilePath", "File" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp index 6f8d1da5c4..d4bfe3ca3d 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp @@ -42,12 +42,12 @@ RimGridCaseSurface::RimGridCaseSurface() { CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_case, "SourceCase", "Source Case", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_case, "SourceCase", "Source Case" ); - CAF_PDM_InitScriptableField( &m_oneBasedSliceIndex, "SliceIndex", 1, "Slice Index (K)", "", "", "" ); + CAF_PDM_InitScriptableField( &m_oneBasedSliceIndex, "SliceIndex", 1, "Slice Index (K)" ); m_oneBasedSliceIndex.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableField( &m_watertight, "Watertight", false, "Watertight Surface (fill gaps)", "", "", "" ); + CAF_PDM_InitScriptableField( &m_watertight, "Watertight", false, "Watertight Surface (fill gaps)" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurface.cpp index cc1bea4c4f..85a2ae5ae3 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurface.cpp @@ -55,14 +55,14 @@ RimSurface::RimSurface() { CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_userDescription, "SurfaceUserDecription", "Name", "", "", "" ); - CAF_PDM_InitField( &m_color, "SurfaceColor", cvf::Color3f( 0.5f, 0.3f, 0.2f ), "Color", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_userDescription, "SurfaceUserDecription", "Name" ); + CAF_PDM_InitField( &m_color, "SurfaceColor", cvf::Color3f( 0.5f, 0.3f, 0.2f ), "Color" ); - CAF_PDM_InitScriptableField( &m_depthOffset, "DepthOffset", 0.0, "Depth Offset", "", "", "" ); + CAF_PDM_InitScriptableField( &m_depthOffset, "DepthOffset", 0.0, "Depth Offset" ); m_depthOffset.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); m_depthOffset.capability()->setIOWriteable( true ); - CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy" ); m_nameProxy.registerGetMethod( this, &RimSurface::fullName ); m_nameProxy.uiCapability()->setUiReadOnly( true ); m_nameProxy.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp index 26b2734666..9898fc3903 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp @@ -51,15 +51,15 @@ RimSurfaceCollection::RimSurfaceCollection() { CAF_PDM_InitScriptableObject( "Surfaces", ":/ReservoirSurfaces16x16.png", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_collectionName, "SurfaceUserDecription", "Name", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_collectionName, "SurfaceUserDecription", "Name" ); m_collectionName = "Surfaces"; - CAF_PDM_InitScriptableFieldNoDefault( &m_subCollections, "SubCollections", "Surfaces", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_subCollections, "SubCollections", "Surfaces" ); m_subCollections.uiCapability()->setUiTreeHidden( true ); auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_subCollections ); reorderability->orderChanged.connect( this, &RimSurfaceCollection::orderChanged ); - CAF_PDM_InitScriptableFieldNoDefault( &m_surfaces, "SurfacesField", "Surfaces", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_surfaces, "SurfacesField", "Surfaces" ); m_surfaces.uiCapability()->setUiTreeHidden( true ); setDeletable( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp index 6086bcbd72..d6e7c3d024 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp @@ -43,15 +43,15 @@ RimSurfaceInView::RimSurfaceInView() { CAF_PDM_InitObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name" ); m_name.registerGetMethod( this, &RimSurfaceInView::name ); m_name.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_surface, "SurfaceRef", "Surface", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_surface, "SurfaceRef", "Surface" ); m_surface.uiCapability()->setUiHidden( true ); m_surface.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition" ); m_resultDefinition.uiCapability()->setUiTreeHidden( true ); m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_resultDefinition = new RimSurfaceResultDefinition; diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp index 96e5ba59d1..db4bbc3a15 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp @@ -43,23 +43,18 @@ RimSurfaceInViewCollection::RimSurfaceInViewCollection() { CAF_PDM_InitObject( "Surfaces", ":/ReservoirSurfaces16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_collectionName, "CollectionName", "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_collectionName, "CollectionName", "Name" ); m_collectionName.registerGetMethod( this, &RimSurfaceInViewCollection::name ); m_collectionName.uiCapability()->setUiReadOnly( true ); m_collectionName.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_collectionsInView, - "SurfacesInViewFieldCollections", - "SurfacesInViewFieldCollections", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_collectionsInView, "SurfacesInViewFieldCollections", "SurfacesInViewFieldCollections" ); m_collectionsInView.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_surfacesInView, "SurfacesInViewField", "SurfacesInViewField", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_surfacesInView, "SurfacesInViewField", "SurfacesInViewField" ); m_surfacesInView.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_surfaceCollection, "SurfaceCollectionRef", "SurfaceCollection", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_surfaceCollection, "SurfaceCollectionRef", "SurfaceCollection" ); m_surfaceCollection.uiCapability()->setUiHidden( true ); nameField()->uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp index 6ecd9154db..da6dffff1e 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp @@ -38,16 +38,16 @@ RimSurfaceResultDefinition::RimSurfaceResultDefinition() { CAF_PDM_InitObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_propertyName, "PropertyName", "Property Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_propertyName, "PropertyName", "Property Name" ); - CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "Legend" ); m_legendConfig.uiCapability()->setUiTreeHidden( true ); m_legendConfig.uiCapability()->setUiTreeChildrenHidden( false ); m_legendConfig = new RimRegularLegendConfig; setName( "Surface Result" ); - CAF_PDM_InitFieldNoDefault( &m_surfaceInView, "SurfaceInView", "Surface In View", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_surfaceInView, "SurfaceInView", "Surface In View" ); m_surfaceInView.uiCapability()->setUiHidden( true ); m_surfaceInView.uiCapability()->setUiTreeChildrenHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.cpp index e8b57132ef..63fee94e9d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.cpp @@ -62,7 +62,7 @@ Rim3dWellLogCurve::Rim3dWellLogCurve() { CAF_PDM_InitObject( "3d Well Log Curve", ":/WellLogCurve16x16.png", "", "" ); - CAF_PDM_InitField( &m_showCurve, "Show3dWellLogCurve", true, "Show 3d Well Log Curve", "", "", "" ); + CAF_PDM_InitField( &m_showCurve, "Show3dWellLogCurve", true, "Show 3d Well Log Curve" ); m_showCurve.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &m_minCurveUIValue, "MinCurveValue", @@ -79,8 +79,8 @@ Rim3dWellLogCurve::Rim3dWellLogCurve() "Clip curve values above this.", "" ); - CAF_PDM_InitField( &m_drawPlane, "DrawPlane", DrawPlaneEnum( VERTICAL_ABOVE ), "Draw Plane", "", "", "" ); - CAF_PDM_InitField( &m_color, "CurveColor", cvf::Color3f( 0.0f, 0.0f, 0.0f ), "Curve Color", "", "", "" ); + CAF_PDM_InitField( &m_drawPlane, "DrawPlane", DrawPlaneEnum( VERTICAL_ABOVE ), "Draw Plane" ); + CAF_PDM_InitField( &m_color, "CurveColor", cvf::Color3f( 0.0f, 0.0f, 0.0f ), "Curve Color" ); this->uiCapability()->setUiTreeChildrenHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp index 679b21743d..5671f05a75 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp @@ -66,25 +66,25 @@ Rim3dWellLogExtractionCurve::Rim3dWellLogExtractionCurve() { CAF_PDM_InitObject( "3d Well Log Extraction Curve", ":/WellLogCurve16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case" ); m_case.uiCapability()->setUiTreeChildrenHidden( true ); m_case = nullptr; - CAF_PDM_InitField( &m_timeStep, "CurveTimeStep", -1, "Time Step", "", "", "" ); + CAF_PDM_InitField( &m_timeStep, "CurveTimeStep", -1, "Time Step" ); - CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "CurveEclipseResult", "" ); m_eclipseResultDefinition.uiCapability()->setUiTreeHidden( true ); m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_eclipseResultDefinition = new RimEclipseResultDefinition; m_eclipseResultDefinition->findField( "MResultType" )->uiCapability()->setUiName( "Result Type" ); - CAF_PDM_InitFieldNoDefault( &m_geomResultDefinition, "CurveGeomechResult", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geomResultDefinition, "CurveGeomechResult", "" ); m_geomResultDefinition.uiCapability()->setUiTreeHidden( true ); m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_geomResultDefinition = new RimGeoMechResultDefinition; m_geomResultDefinition->setAddWellPathDerivedResults( true ); - CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "" ); m_nameConfig = new RimWellLogExtractionCurveNameConfig(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp index 7111dbd879..b23d74ad94 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp @@ -41,11 +41,11 @@ Rim3dWellLogFileCurve::Rim3dWellLogFileCurve() { 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(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp index fb67f8bdea..2a8f5785ac 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp @@ -44,17 +44,17 @@ Rim3dWellLogRftCurve::Rim3dWellLogRftCurve() { 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(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp index 82b8524397..bf33dd0a44 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp @@ -96,39 +96,39 @@ RimEnsembleWellLogCurveSet::RimEnsembleWellLogCurveSet() { CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_curves, "EnsembleCurveSet", "Ensemble Curve Set", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curves, "EnsembleCurveSet", "Ensemble Curve Set" ); m_curves.uiCapability()->setUiHidden( true ); m_curves.uiCapability()->setUiTreeChildrenHidden( false ); - CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves", "", "", "" ); + CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves" ); m_showCurves.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_ensembleWellLogs, "EnsembleWellLogs", "Ensemble Well Logs", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleWellLogs, "EnsembleWellLogs", "Ensemble Well Logs" ); m_ensembleWellLogs.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_wellLogChannelName, "WellLogChannelName", QString( "None" ), "Well Log Channel Name", "", "", "" ); + CAF_PDM_InitField( &m_wellLogChannelName, "WellLogChannelName", QString( "None" ), "Well Log Channel Name" ); - CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSet, "FilterEnsembleCurveSet", "Filter by Ensemble Curve Set", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_depthEqualization, "DepthEqualization", "Depth Equalization", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSet, "FilterEnsembleCurveSet", "Filter by Ensemble Curve Set" ); + CAF_PDM_InitFieldNoDefault( &m_depthEqualization, "DepthEqualization", "Depth Equalization" ); - CAF_PDM_InitField( &m_colorMode, "ColorMode", caf::AppEnum( ColorMode::SINGLE_COLOR ), "Coloring Mode", "", "", "" ); + CAF_PDM_InitField( &m_colorMode, "ColorMode", caf::AppEnum( ColorMode::SINGLE_COLOR ), "Coloring Mode" ); - CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color", "", "", "" ); + CAF_PDM_InitField( &m_color, "Color", RiaColorTools::textColor3f(), "Color" ); - CAF_PDM_InitFieldNoDefault( &m_statistics, "Statistics", "Statistics", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_statistics, "Statistics", "Statistics" ); m_statistics = new RimEnsembleStatistics( this ); m_statistics.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_userDefinedName, "UserDefinedName", QString( "Ensemble Curve Set" ), "Curve Set Name", "", "", "" ); + CAF_PDM_InitField( &m_userDefinedName, "UserDefinedName", QString( "Ensemble Curve Set" ), "Curve Set Name" ); - CAF_PDM_InitFieldNoDefault( &m_autoGeneratedName, "AutoGeneratedName", "Curve Set Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_autoGeneratedName, "AutoGeneratedName", "Curve Set Name" ); m_autoGeneratedName.registerGetMethod( this, &RimEnsembleWellLogCurveSet::createAutoName ); m_autoGeneratedName.uiCapability()->setUiReadOnly( true ); m_autoGeneratedName.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name", "", "", "" ); + CAF_PDM_InitField( &m_isUsingAutoName, "AutoName", true, "Auto Name" ); - CAF_PDM_InitFieldNoDefault( &m_curveAppearance, "PlotCurveAppearance", "PlotCurveAppearance", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curveAppearance, "PlotCurveAppearance", "PlotCurveAppearance" ); m_curveAppearance = new RimPlotCurveAppearance; m_curveAppearance.uiCapability()->setUiTreeHidden( true ); m_curveAppearance->setInterpolationVisible( false ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatisticsCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatisticsCurve.cpp index ca1b996876..27d3932da5 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatisticsCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatisticsCurve.cpp @@ -39,13 +39,13 @@ CAF_PDM_SOURCE_INIT( RimEnsembleWellLogStatisticsCurve, "EnsembleWellLogStatisti //-------------------------------------------------------------------------------------------------- RimEnsembleWellLogStatisticsCurve::RimEnsembleWellLogStatisticsCurve() { - CAF_PDM_InitObject( "Ensemble Well Log Statistics Curve", "", "", "" ); + CAF_PDM_InitObject( "Ensemble Well Log Statistics Curve" ); - CAF_PDM_InitFieldNoDefault( &m_ensembleWellLogCurveSet, "EnsembleWellLogCurveSet", "Ensemble Well Log Curve Set", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleWellLogCurveSet, "EnsembleWellLogCurveSet", "Ensemble Well Log Curve Set" ); m_ensembleWellLogCurveSet.uiCapability()->setUiTreeChildrenHidden( true ); m_ensembleWellLogCurveSet.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_statisticsType, "StatisticsType", "Statistics Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_statisticsType, "StatisticsType", "Statistics Type" ); m_statisticsType.uiCapability()->setUiHidden( true ); m_wellPath = nullptr; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogs.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogs.cpp index 8e13ad98ff..6601de125f 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogs.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogs.cpp @@ -32,9 +32,9 @@ CAF_PDM_SOURCE_INIT( RimEnsembleWellLogs, "EnsembleWellLogs" ); //-------------------------------------------------------------------------------------------------- RimEnsembleWellLogs::RimEnsembleWellLogs() { - CAF_PDM_InitScriptableObject( "Ensemble Well Logs", "", "", "" ); + CAF_PDM_InitScriptableObject( "Ensemble Well Logs" ); - CAF_PDM_InitFieldNoDefault( &m_wellLogFiles, "WellLogFiles", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellLogFiles, "WellLogFiles", "" ); m_wellLogFiles.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp index 4d350cedd7..fd3547d02e 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp @@ -31,7 +31,7 @@ RimEnsembleWellLogsCollection::RimEnsembleWellLogsCollection() { CAF_PDM_InitObject( "Ensemble Well Logs", ":/LasFile16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_ensembleWellLogs, "EnsembleWellLogsCollection", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleWellLogs, "EnsembleWellLogsCollection", "" ); m_ensembleWellLogs.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp index 7a0a2da962..710bb28041 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp @@ -70,14 +70,14 @@ bool RimWellLogCurveCommonDataSource::DoubleComparator::operator()( const double RimWellLogCurveCommonDataSource::RimWellLogCurveCommonDataSource() : m_caseType( RiaDefines::CaseType::UNDEFINED_CASE ) { - CAF_PDM_InitObject( "Change Data Source", "", "", "" ); + CAF_PDM_InitObject( "Change Data Source" ); - CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_trajectoryType, "TrajectoryType", "Trajectory Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case" ); + CAF_PDM_InitFieldNoDefault( &m_trajectoryType, "TrajectoryType", "Trajectory Type" ); - CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name" ); - CAF_PDM_InitFieldNoDefault( &m_simWellName, "SimulationWellName", "Well Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_simWellName, "SimulationWellName", "Well Name" ); CAF_PDM_InitFieldNoDefault( &m_branchDetection, "BranchDetection", "Branch Detection", @@ -86,15 +86,15 @@ RimWellLogCurveCommonDataSource::RimWellLogCurveCommonDataSource() "" ); m_branchDetection.v() = caf::Tristate::State::PartiallyTrue; m_branchDetection.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_branchIndex, "Branch", -1, "Branch Index", "", "", "" ); + CAF_PDM_InitField( &m_branchIndex, "Branch", -1, "Branch Index" ); - CAF_PDM_InitField( &m_timeStep, "CurveTimeStep", -1, "Time Step", "", "", "" ); + CAF_PDM_InitField( &m_timeStep, "CurveTimeStep", -1, "Time Step" ); - CAF_PDM_InitFieldNoDefault( &m_wbsSmoothing, "WBSSmoothing", "Smooth Curves", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wbsSmoothing, "WBSSmoothing", "Smooth Curves" ); m_wbsSmoothing.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() ); m_wbsSmoothing.v() = caf::Tristate::State::PartiallyTrue; - CAF_PDM_InitField( &m_wbsSmoothingThreshold, "WBSSmoothingThreshold", -1.0, "Smoothing Threshold", "", "", "" ); + CAF_PDM_InitField( &m_wbsSmoothingThreshold, "WBSSmoothingThreshold", -1.0, "Smoothing Threshold" ); m_case = nullptr; m_wellPath = nullptr; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 271dfb91a5..279cc56609 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -96,12 +96,12 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve() { CAF_PDM_InitScriptableObject( "Well Log Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" ); - CAF_PDM_InitFieldNoDefault( &m_trajectoryType, "TrajectoryType", "Trajectory Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_trajectoryType, "TrajectoryType", "Trajectory Type" ); - CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name" ); m_wellPath.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_simWellName, "SimulationWellName", QString( "" ), "Well Name", "", "", "" ); + CAF_PDM_InitField( &m_simWellName, "SimulationWellName", QString( "" ), "Well Name" ); CAF_PDM_InitField( &m_branchDetection, "BranchDetection", true, @@ -109,31 +109,31 @@ RimWellLogExtractionCurve::RimWellLogExtractionCurve() "", "Compute branches based on how simulation well cells are organized", "" ); - CAF_PDM_InitField( &m_branchIndex, "Branch", 0, "Branch Index", "", "", "" ); + CAF_PDM_InitField( &m_branchIndex, "Branch", 0, "Branch Index" ); - CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case" ); m_case.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "CurveEclipseResult", "" ); m_eclipseResultDefinition.uiCapability()->setUiTreeHidden( true ); m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_eclipseResultDefinition = new RimEclipseResultDefinition; m_eclipseResultDefinition->findField( "MResultType" )->uiCapability()->setUiName( "Result Type" ); - CAF_PDM_InitFieldNoDefault( &m_geomResultDefinition, "CurveGeomechResult", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geomResultDefinition, "CurveGeomechResult", "" ); m_geomResultDefinition.uiCapability()->setUiTreeHidden( true ); m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_geomResultDefinition = new RimGeoMechResultDefinition; m_geomResultDefinition->setAddWellPathDerivedResults( true ); - CAF_PDM_InitField( &m_timeStep, "CurveTimeStep", 0, "Time Step", "", "", "" ); + CAF_PDM_InitField( &m_timeStep, "CurveTimeStep", 0, "Time Step" ); // Add some space before name to indicate these belong to the Auto Name field - CAF_PDM_InitField( &m_addCaseNameToCurveName, "AddCaseNameToCurveName", true, " Case Name", "", "", "" ); - CAF_PDM_InitField( &m_addPropertyToCurveName, "AddPropertyToCurveName", true, " Property", "", "", "" ); - CAF_PDM_InitField( &m_addWellNameToCurveName, "AddWellNameToCurveName", true, " Well Name", "", "", "" ); - CAF_PDM_InitField( &m_addTimestepToCurveName, "AddTimestepToCurveName", false, " Timestep", "", "", "" ); - CAF_PDM_InitField( &m_addDateToCurveName, "AddDateToCurveName", true, " Date", "", "", "" ); + CAF_PDM_InitField( &m_addCaseNameToCurveName, "AddCaseNameToCurveName", true, " Case Name" ); + CAF_PDM_InitField( &m_addPropertyToCurveName, "AddPropertyToCurveName", true, " Property" ); + CAF_PDM_InitField( &m_addWellNameToCurveName, "AddWellNameToCurveName", true, " Well Name" ); + CAF_PDM_InitField( &m_addTimestepToCurveName, "AddTimestepToCurveName", false, " Timestep" ); + CAF_PDM_InitField( &m_addDateToCurveName, "AddDateToCurveName", true, " Date" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurveNameConfig.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurveNameConfig.cpp index 903fbf0ff3..d5027af8c3 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurveNameConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurveNameConfig.cpp @@ -31,13 +31,13 @@ CAF_PDM_SOURCE_INIT( RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionC RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig() : RimNameConfig( "Log Extraction" ) { - 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" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp index c2547c3aff..48151afadc 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp @@ -66,21 +66,21 @@ RimWellLogFile::RimWellLogFile() { CAF_PDM_InitObject( "Well LAS File Info", ":/LasFile16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "" ); m_wellName.uiCapability()->setUiReadOnly( true ); RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_wellName ); - CAF_PDM_InitFieldNoDefault( &m_date, "Date", "Date", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_date, "Date", "Date" ); m_date.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_fileName, "FileName", "Filename", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_fileName, "FileName", "Filename" ); m_fileName.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_name, "Name", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_name, "Name", "" ); m_name.uiCapability()->setUiReadOnly( true ); RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_name ); - CAF_PDM_InitFieldNoDefault( &m_wellLogChannelNames, "WellLogFileChannels", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellLogChannelNames, "WellLogFileChannels", "" ); RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_wellLogChannelNames ); CAF_PDM_InitField( &m_wellFlowCondition, @@ -91,7 +91,7 @@ RimWellLogFile::RimWellLogFile() "", "" ); - CAF_PDM_InitField( &m_invalidDateMessage, "InvalidDateMessage", QString( "Invalid or no date" ), "", "", "", "" ); + CAF_PDM_InitField( &m_invalidDateMessage, "InvalidDateMessage", QString( "Invalid or no date" ), "" ); m_invalidDateMessage.uiCapability()->setUiReadOnly( true ); m_invalidDateMessage.xmlCapability()->disableIO(); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileChannel.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileChannel.cpp index c1ea680c0e..c5d6bd779d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileChannel.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileChannel.cpp @@ -30,9 +30,9 @@ CAF_PDM_SOURCE_INIT( RimWellLogFileChannel, "WellLogFileChannel" ); //-------------------------------------------------------------------------------------------------- RimWellLogFileChannel::RimWellLogFileChannel() { - CAF_PDM_InitObject( "Well Log File Channel", "", "", "" ); + CAF_PDM_InitObject( "Well Log File Channel" ); - CAF_PDM_InitFieldNoDefault( &m_name, "Name", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_name, "Name", "" ); RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_name ); } @@ -42,4 +42,4 @@ RimWellLogFileChannel::RimWellLogFileChannel() void RimWellLogFileChannel::setName( const QString& name ) { m_name = name; -} \ No newline at end of file +} diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp index df7daccfe2..9f09c4a36d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp @@ -54,12 +54,12 @@ RimWellLogFileCurve::RimWellLogFileCurve() { CAF_PDM_InitObject( "Well Log File Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Path", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Path" ); m_wellPath.uiCapability()->setUiTreeChildrenHidden( true ); - 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" ); m_wellPath = nullptr; } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurveNameConfig.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurveNameConfig.cpp index bf0a78fed6..0196e579c2 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurveNameConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurveNameConfig.cpp @@ -31,7 +31,7 @@ CAF_PDM_SOURCE_INIT( RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConf RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig() : RimNameConfig( "Las Curve" ) { - CAF_PDM_InitObject( "Well Log File Curve Name Generator", "", "", "" ); + CAF_PDM_InitObject( "Well Log File Curve Name Generator" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp index 0be5aad571..78c917d5f8 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp @@ -48,7 +48,7 @@ RimWellLogPlotCollection::RimWellLogPlotCollection() { CAF_PDM_InitScriptableObject( "Well Log Plots", ":/WellLogPlots16x16.png", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_wellLogPlots, "WellLogPlots", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_wellLogPlots, "WellLogPlots", "" ); m_wellLogPlots.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotNameConfig.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotNameConfig.cpp index 65bb5e2523..b41cc6dadb 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotNameConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotNameConfig.cpp @@ -31,13 +31,13 @@ CAF_PDM_SOURCE_INIT( RimWellLogPlotNameConfig, "RimWellLogPlotNameConfig" ); RimWellLogPlotNameConfig::RimWellLogPlotNameConfig() : RimNameConfig( "Well Log Plot" ) { - CAF_PDM_InitObject( "Well Log Plot Name Generator", "", "", "" ); + CAF_PDM_InitObject( "Well Log Plot Name Generator" ); - CAF_PDM_InitField( &m_addCaseName, "AddCaseName", false, "Show Case Name", "", "", "" ); - CAF_PDM_InitField( &m_addWellName, "AddWellName", false, "Show Well Name", "", "", "" ); - CAF_PDM_InitField( &m_addTimestep, "AddTimeStep", false, "Show Time Step", "", "", "" ); - CAF_PDM_InitField( &m_addAirGap, "AddAirGap", false, "Show Air Gap", "", "", "" ); - CAF_PDM_InitField( &m_addWaterDepth, "AddWaterDepth", false, "Show Water Depth", "", "", "" ); + CAF_PDM_InitField( &m_addCaseName, "AddCaseName", false, "Show Case Name" ); + CAF_PDM_InitField( &m_addWellName, "AddWellName", false, "Show Well Name" ); + CAF_PDM_InitField( &m_addTimestep, "AddTimeStep", false, "Show Time Step" ); + CAF_PDM_InitField( &m_addAirGap, "AddAirGap", false, "Show Air Gap" ); + CAF_PDM_InitField( &m_addWaterDepth, "AddWaterDepth", false, "Show Water Depth" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index 491e77398b..491eb8875b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -96,22 +96,22 @@ RimWellLogRftCurve::RimWellLogRftCurve() { CAF_PDM_InitObject( "Well Log RFT Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" ); - CAF_PDM_InitFieldNoDefault( &m_eclipseResultCase, "CurveEclipseResultCase", "Eclipse Result Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseResultCase, "CurveEclipseResultCase", "Eclipse Result Case" ); m_eclipseResultCase.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_summaryCase, "CurveSummaryCase", "Summary Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_summaryCase, "CurveSummaryCase", "Summary Case" ); m_summaryCase.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_ensemble, "CurveEnsemble", "Ensemble", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_ensemble, "CurveEnsemble", "Ensemble" ); m_ensemble.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_observedFmuRftData, "ObservedFmuRftData", "Observed FMU RFT Data", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_observedFmuRftData, "ObservedFmuRftData", "Observed FMU RFT Data" ); m_observedFmuRftData.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStep", "Time Step", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStep", "Time Step" ); - CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name", "", "", "" ); - CAF_PDM_InitField( &m_branchIndex, "BranchIndex", 0, "Branch Index", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name" ); + CAF_PDM_InitField( &m_branchIndex, "BranchIndex", 0, "Branch Index" ); CAF_PDM_InitField( &m_branchDetection, "BranchDetection", true, @@ -120,7 +120,7 @@ RimWellLogRftCurve::RimWellLogRftCurve() "Compute branches based on how simulation well cells are organized", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "WellLogChannelName", "Well Property", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "WellLogChannelName", "Well Property" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurveNameConfig.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurveNameConfig.cpp index cabb7ceeab..338885cab1 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurveNameConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurveNameConfig.cpp @@ -31,7 +31,7 @@ CAF_PDM_SOURCE_INIT( RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig RimWellLogRftCurveNameConfig::RimWellLogRftCurveNameConfig() : RimNameConfig( "Rft Curve" ) { - CAF_PDM_InitObject( "Well Log Rft Curve Name Generator", "", "", "" ); + CAF_PDM_InitObject( "Well Log Rft Curve Name Generator" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 9b8eac313d..30c2c9bf60 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -176,71 +176,66 @@ RimWellLogTrack::RimWellLogTrack() { CAF_PDM_InitScriptableObject( "Track", ":/WellLogTrack16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_description, "TrackDescription", "Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_description, "TrackDescription", "Name" ); m_description.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_curves, "Curves", "", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_curves, "Curves", "" ); m_curves.uiCapability()->setUiTreeHidden( true ); auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_curves ); reorderability->orderChanged.connect( this, &RimWellLogTrack::curveDataChanged ); - CAF_PDM_InitField( &m_visibleXRangeMin, "VisibleXRangeMin", RI_LOGPLOTTRACK_MINX_DEFAULT, "Min", "", "", "" ); - CAF_PDM_InitField( &m_visibleXRangeMax, "VisibleXRangeMax", RI_LOGPLOTTRACK_MAXX_DEFAULT, "Max", "", "", "" ); - CAF_PDM_InitField( &m_visibleDepthRangeMin, "VisibleYRangeMin", RI_LOGPLOTTRACK_MINX_DEFAULT, "Min", "", "", "" ); - CAF_PDM_InitField( &m_visibleDepthRangeMax, "VisibleYRangeMax", RI_LOGPLOTTRACK_MAXX_DEFAULT, "Max", "", "", "" ); + CAF_PDM_InitField( &m_visibleXRangeMin, "VisibleXRangeMin", RI_LOGPLOTTRACK_MINX_DEFAULT, "Min" ); + CAF_PDM_InitField( &m_visibleXRangeMax, "VisibleXRangeMax", RI_LOGPLOTTRACK_MAXX_DEFAULT, "Max" ); + CAF_PDM_InitField( &m_visibleDepthRangeMin, "VisibleYRangeMin", RI_LOGPLOTTRACK_MINX_DEFAULT, "Min" ); + CAF_PDM_InitField( &m_visibleDepthRangeMax, "VisibleYRangeMax", RI_LOGPLOTTRACK_MAXX_DEFAULT, "Max" ); m_visibleDepthRangeMin.uiCapability()->setUiHidden( true ); m_visibleDepthRangeMin.xmlCapability()->disableIO(); m_visibleDepthRangeMax.uiCapability()->setUiHidden( true ); m_visibleDepthRangeMax.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_isAutoScaleXEnabled, "AutoScaleX", true, "Auto Scale", "", "", "" ); + CAF_PDM_InitField( &m_isAutoScaleXEnabled, "AutoScaleX", true, "Auto Scale" ); m_isAutoScaleXEnabled.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_isLogarithmicScaleEnabled, "LogarithmicScaleX", false, "Logarithmic Scale", "", "", "" ); + CAF_PDM_InitField( &m_isLogarithmicScaleEnabled, "LogarithmicScaleX", false, "Logarithmic Scale" ); - CAF_PDM_InitFieldNoDefault( &m_xAxisGridVisibility, "ShowXGridLines", "Show Grid Lines", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_xAxisGridVisibility, "ShowXGridLines", "Show Grid Lines" ); - CAF_PDM_InitField( &m_explicitTickIntervals, "ExplicitTickIntervals", false, "Manually Set Tick Intervals", "", "", "" ); - CAF_PDM_InitField( &m_minAndMaxTicksOnly, "MinAndMaxTicksOnly", false, "Show Ticks at Min and Max", "", "", "" ); - CAF_PDM_InitField( &m_majorTickInterval, "MajorTickIntervals", 0.0, "Major Tick Interval", "", "", "" ); - CAF_PDM_InitField( &m_minorTickInterval, "MinorTickIntervals", 0.0, "Minor Tick Interval", "", "", "" ); + CAF_PDM_InitField( &m_explicitTickIntervals, "ExplicitTickIntervals", false, "Manually Set Tick Intervals" ); + CAF_PDM_InitField( &m_minAndMaxTicksOnly, "MinAndMaxTicksOnly", false, "Show Ticks at Min and Max" ); + CAF_PDM_InitField( &m_majorTickInterval, "MajorTickIntervals", 0.0, "Major Tick Interval" ); + CAF_PDM_InitField( &m_minorTickInterval, "MinorTickIntervals", 0.0, "Minor Tick Interval" ); m_majorTickInterval.uiCapability()->setUiHidden( true ); m_minorTickInterval.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_axisFontSize, "AxisFontSize", "Axis Font Size", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_axisFontSize, "AxisFontSize", "Axis Font Size" ); - CAF_PDM_InitFieldNoDefault( &m_regionAnnotationType, "AnnotationType", "Region Annotations", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_regionAnnotationDisplay, "RegionDisplay", "Region Display", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_regionAnnotationType, "AnnotationType", "Region Annotations" ); + CAF_PDM_InitFieldNoDefault( &m_regionAnnotationDisplay, "RegionDisplay", "Region Display" ); - CAF_PDM_InitFieldNoDefault( &m_colorShadingLegend, "ColorShadingLegend", "Colors", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_colorShadingLegend, "ColorShadingLegend", "Colors" ); m_colorShadingLegend = RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::ColorRangesType::NORMAL ); - CAF_PDM_InitField( &m_colorShadingTransparency, "ColorShadingTransparency", 50, "Color Transparency", "", "", "" ); + CAF_PDM_InitField( &m_colorShadingTransparency, "ColorShadingTransparency", 50, "Color Transparency" ); m_colorShadingTransparency.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_showRegionLabels, "ShowFormationLabels", true, "Show Labels", "", "", "" ); + CAF_PDM_InitField( &m_showRegionLabels, "ShowFormationLabels", true, "Show Labels" ); caf::FontTools::RelativeSizeEnum regionLabelFontSizeDefault = caf::FontTools::RelativeSize::XSmall; - CAF_PDM_InitField( &m_regionLabelFontSize, "RegionLabelFontSize", regionLabelFontSizeDefault, "Font Size", "", "", "" ); + CAF_PDM_InitField( &m_regionLabelFontSize, "RegionLabelFontSize", regionLabelFontSizeDefault, "Font Size" ); - CAF_PDM_InitFieldNoDefault( &m_formationSource, "FormationSource", "Source", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_formationSource, "FormationSource", "Source" ); - CAF_PDM_InitFieldNoDefault( &m_formationTrajectoryType, "FormationTrajectoryType", "Trajectory", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_formationTrajectoryType, "FormationTrajectoryType", "Trajectory" ); - CAF_PDM_InitFieldNoDefault( &m_formationWellPathForSourceCase, "FormationWellPath", "Well Path", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_formationWellPathForSourceCase, "FormationWellPath", "Well Path" ); m_formationWellPathForSourceCase.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_formationWellPathForSourceWellPath, - "FormationWellPathForSourceWellPath", - "Well Path", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_formationWellPathForSourceWellPath, "FormationWellPathForSourceWellPath", "Well Path" ); m_formationWellPathForSourceWellPath.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_formationSimWellName, "FormationSimulationWellName", QString( "None" ), "Simulation Well", "", "", "" ); - CAF_PDM_InitField( &m_formationBranchIndex, "FormationBranchIndex", 0, " ", "", "", "" ); + CAF_PDM_InitField( &m_formationSimWellName, "FormationSimulationWellName", QString( "None" ), "Simulation Well" ); + CAF_PDM_InitField( &m_formationBranchIndex, "FormationBranchIndex", 0, " " ); CAF_PDM_InitField( &m_formationBranchDetection, "FormationBranchDetection", true, @@ -249,38 +244,33 @@ RimWellLogTrack::RimWellLogTrack() "Compute branches based on how simulation well cells are organized", "" ); - CAF_PDM_InitFieldNoDefault( &m_formationCase, "FormationCase", "Formation Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_formationCase, "FormationCase", "Formation Case" ); m_formationCase.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_formationLevel, "FormationLevel", "Well Pick Filter", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_formationLevel, "FormationLevel", "Well Pick Filter" ); - CAF_PDM_InitField( &m_showformationFluids, "ShowFormationFluids", false, "Show Fluids", "", "", "" ); + CAF_PDM_InitField( &m_showformationFluids, "ShowFormationFluids", false, "Show Fluids" ); - CAF_PDM_InitField( &m_showWellPathAttributes, "ShowWellPathAttributes", false, "Show Well Attributes", "", "", "" ); - CAF_PDM_InitField( &m_wellPathAttributesInLegend, "WellPathAttributesInLegend", true, "Attributes in Legend", "", "", "" ); - CAF_PDM_InitField( &m_showWellPathCompletions, "ShowWellPathCompletions", true, "Show Well Completions", "", "", "" ); - CAF_PDM_InitField( &m_wellPathCompletionsInLegend, "WellPathCompletionsInLegend", true, "Completions in Legend", "", "", "" ); - CAF_PDM_InitField( &m_showWellPathComponentsBothSides, "ShowWellPathAttrBothSides", true, "Show Both Sides", "", "", "" ); - CAF_PDM_InitField( &m_showWellPathComponentLabels, "ShowWellPathAttrLabels", false, "Show Labels", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellPathComponentSource, "AttributesWellPathSource", "Well Path", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellPathAttributeCollection, "AttributesCollection", "Well Attributes", "", "", "" ); + CAF_PDM_InitField( &m_showWellPathAttributes, "ShowWellPathAttributes", false, "Show Well Attributes" ); + CAF_PDM_InitField( &m_wellPathAttributesInLegend, "WellPathAttributesInLegend", true, "Attributes in Legend" ); + CAF_PDM_InitField( &m_showWellPathCompletions, "ShowWellPathCompletions", true, "Show Well Completions" ); + CAF_PDM_InitField( &m_wellPathCompletionsInLegend, "WellPathCompletionsInLegend", true, "Completions in Legend" ); + CAF_PDM_InitField( &m_showWellPathComponentsBothSides, "ShowWellPathAttrBothSides", true, "Show Both Sides" ); + CAF_PDM_InitField( &m_showWellPathComponentLabels, "ShowWellPathAttrLabels", false, "Show Labels" ); + CAF_PDM_InitFieldNoDefault( &m_wellPathComponentSource, "AttributesWellPathSource", "Well Path" ); + CAF_PDM_InitFieldNoDefault( &m_wellPathAttributeCollection, "AttributesCollection", "Well Attributes" ); - CAF_PDM_InitField( &m_overburdenHeight, "OverburdenHeight", 0.0, "Overburden Height", "", "", "" ); + CAF_PDM_InitField( &m_overburdenHeight, "OverburdenHeight", 0.0, "Overburden Height" ); m_overburdenHeight.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_underburdenHeight, "UnderburdenHeight", 0.0, "Underburden Height", "", "", "" ); + CAF_PDM_InitField( &m_underburdenHeight, "UnderburdenHeight", 0.0, "Underburden Height" ); m_underburdenHeight.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition" ); m_resultDefinition.uiCapability()->setUiTreeHidden( true ); m_resultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_resultDefinition = new RimEclipseResultDefinition; - CAF_PDM_InitFieldNoDefault( &m_ensembleWellLogCurveSet, - "EnsembleWellLogCurveSet", - "Ensemble Well Logs Curve Set", - "", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_ensembleWellLogCurveSet, "EnsembleWellLogCurveSet", "Ensemble Well Logs Curve Set" ); m_ensembleWellLogCurveSet.uiCapability()->setUiTreeHidden( true ); m_formationsForCaseWithSimWellOnly = false; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogWbsCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogWbsCurve.cpp index 59fe90554d..ec3b6f13c0 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogWbsCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogWbsCurve.cpp @@ -14,8 +14,8 @@ RimWellLogWbsCurve::RimWellLogWbsCurve() { CAF_PDM_InitObject( "Well Bore Stability Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" ); - CAF_PDM_InitField( &m_smoothCurve, "SmoothCurve", false, "Smooth Curve", "", "", "" ); - CAF_PDM_InitField( &m_smoothingThreshold, "SmoothingThreshold", 0.002, "Smoothing Threshold", "", "", "" ); + CAF_PDM_InitField( &m_smoothCurve, "SmoothCurve", false, "Smooth Curve" ); + CAF_PDM_InitField( &m_smoothingThreshold, "SmoothingThreshold", 0.002, "Smoothing Threshold" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurement.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurement.cpp index d0c6a849b0..d61ec04dca 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurement.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurement.cpp @@ -31,14 +31,14 @@ RimWellMeasurement::RimWellMeasurement() { CAF_PDM_InitObject( "RimWellMeasurement", ":/WellMeasurement16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name", "", "", "" ); - CAF_PDM_InitField( &m_MD, "Depth", -1.0, "MD", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_date, "Date", "Date", "", "", "" ); - CAF_PDM_InitField( &m_value, "Value", 0.0, "Value", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_kind, "Kind", "Kind", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_quality, "Quality", "Quality", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_remark, "Remark", "Remark", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name" ); + CAF_PDM_InitField( &m_MD, "Depth", -1.0, "MD" ); + CAF_PDM_InitFieldNoDefault( &m_date, "Date", "Date" ); + CAF_PDM_InitField( &m_value, "Value", 0.0, "Value" ); + CAF_PDM_InitFieldNoDefault( &m_kind, "Kind", "Kind" ); + CAF_PDM_InitFieldNoDefault( &m_quality, "Quality", "Quality" ); + CAF_PDM_InitFieldNoDefault( &m_remark, "Remark", "Remark" ); + CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp index a8d626d839..2a486a3890 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp @@ -39,12 +39,12 @@ RimWellMeasurementCollection::RimWellMeasurementCollection() { CAF_PDM_InitObject( "Well Measurements", ":/WellMeasurement16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_measurements, "Measurements", "Well Measurements", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_measurements, "Measurements", "Well Measurements" ); m_measurements.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); m_measurements.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_measurements.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_importedFiles, "ImportedFiles", "Imported Files", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_importedFiles, "ImportedFiles", "Imported Files" ); m_importedFiles.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp index d8766e549d..435c19fb7f 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp @@ -52,10 +52,10 @@ RimWellMeasurementCurve::RimWellMeasurementCurve() { CAF_PDM_InitObject( "Well Measurement Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Path", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Path" ); m_wellPath.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_measurementKind, "CurveMeasurementKind", "Measurement Kind", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_measurementKind, "CurveMeasurementKind", "Measurement Kind" ); m_measurementKind.uiCapability()->setUiTreeChildrenHidden( true ); m_wellPath = nullptr; diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementFilePath.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementFilePath.cpp index 21ac554355..32ba0ff0f2 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementFilePath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementFilePath.cpp @@ -31,8 +31,8 @@ RimWellMeasurementFilePath::RimWellMeasurementFilePath() { CAF_PDM_InitObject( "RimWellMeasurementFilePath", ":/WellMeasurement16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_userDescription, "UserDecription", "Name", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_userDescription, "UserDecription", "Name" ); + CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" ); m_filePath.uiCapability()->setUiReadOnly( true ); m_filePath.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp index b9dac31c47..16e1af635c 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp @@ -50,39 +50,39 @@ RimWellMeasurementInView::RimWellMeasurementInView() { CAF_PDM_InitObject( "Well Measurement", ":/WellMeasurement16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_measurementKind, "MeasurementKind", "Measurement Kind", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_measurementKind, "MeasurementKind", "Measurement Kind" ); m_measurementKind.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend" ); m_legendConfig = new RimRegularLegendConfig(); m_legendConfig.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_wells, "Wells", "Wells", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wells, "Wells", "Wells" ); m_wells.uiCapability()->setAutoAddingOptionFromValue( false ); m_wells.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_wells.xmlCapability()->disableIO(); // The m_wells field does not serialize in a suitable format, so we work around it by // serializing to a pipe-delimited string. - CAF_PDM_InitFieldNoDefault( &m_wellsSerialized, "WellsSerialized", "WellsSerialized", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellsSerialized, "WellsSerialized", "WellsSerialized" ); m_wellsSerialized.uiCapability()->setUiHidden( true ); // Keep track of the wells which has a given measurement in order to automatically select // new wells when they appear in new measurements - CAF_PDM_InitFieldNoDefault( &m_availableWellsSerialized, "AvailableWellsSerialized", "AvailableWellsSerialized", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_availableWellsSerialized, "AvailableWellsSerialized", "AvailableWellsSerialized" ); // m_availableWellsSerialized.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_lowerBound, "LowerBound", -HUGE_VAL, "Min", "", "", "" ); + CAF_PDM_InitField( &m_lowerBound, "LowerBound", -HUGE_VAL, "Min" ); m_lowerBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_upperBound, "UpperBound", HUGE_VAL, "Max", "", "", "" ); + CAF_PDM_InitField( &m_upperBound, "UpperBound", HUGE_VAL, "Max" ); m_upperBound.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_qualityFilter, "QualityFilter", "Quality Filter", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_qualityFilter, "QualityFilter", "Quality Filter" ); m_qualityFilter.uiCapability()->setAutoAddingOptionFromValue( false ); m_qualityFilter.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_radiusScaleFactor, "RadiusScaleFactor", 2.5, "Radius Scale", "", "", "" ); + CAF_PDM_InitField( &m_radiusScaleFactor, "RadiusScaleFactor", 2.5, "Radius Scale" ); m_radiusScaleFactor.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); this->setName( "Well Measurement" ); diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInViewCollection.cpp index de0fb11e97..affdcf921e 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInViewCollection.cpp @@ -45,7 +45,7 @@ RimWellMeasurementInViewCollection::RimWellMeasurementInViewCollection() { CAF_PDM_InitObject( "Well Measurements", ":/WellMeasurement16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_measurementsInView, "MeasurementKinds", "Measurement Kinds", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_measurementsInView, "MeasurementKinds", "Measurement Kinds" ); m_measurementsInView.uiCapability()->setUiTreeHidden( true ); m_isChecked = false; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPath.cpp index 5d6c2799c0..632f47fa15 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPath.cpp @@ -26,31 +26,31 @@ RimFileWellPath::RimFileWellPath() "FileWellPath", "Well Paths Loaded From File" ); - CAF_PDM_InitFieldNoDefault( &id, "WellPathId", "Id", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &id, "WellPathId", "Id" ); id.uiCapability()->setUiReadOnly( true ); id.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &sourceSystem, "SourceSystem", "Source System", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &sourceSystem, "SourceSystem", "Source System" ); sourceSystem.uiCapability()->setUiReadOnly( true ); sourceSystem.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &utmZone, "UTMZone", "UTM Zone", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &utmZone, "UTMZone", "UTM Zone" ); utmZone.uiCapability()->setUiReadOnly( true ); utmZone.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &updateDate, "WellPathUpdateDate", "Update Date", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &updateDate, "WellPathUpdateDate", "Update Date" ); updateDate.uiCapability()->setUiReadOnly( true ); updateDate.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &updateUser, "WellPathUpdateUser", "Update User", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &updateUser, "WellPathUpdateUser", "Update User" ); updateUser.uiCapability()->setUiReadOnly( true ); updateUser.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_surveyType, "WellPathSurveyType", "Survey Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_surveyType, "WellPathSurveyType", "Survey Type" ); m_surveyType.uiCapability()->setUiReadOnly( true ); m_surveyType.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_filePath, "WellPathFilepath", "File Path", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filePath, "WellPathFilepath", "File Path" ); m_filePath.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_filePathInCache, "WellPathFilePathInCache", "File Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_filePathInCache, "WellPathFilePathInCache", "File Name" ); m_filePathInCache.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_wellPathIndexInFile, "WellPathNumberInFile", -1, "Well Number in File", "", "", "" ); + CAF_PDM_InitField( &m_wellPathIndexInFile, "WellPathNumberInFile", -1, "Well Number in File" ); m_wellPathIndexInFile.uiCapability()->setUiReadOnly( true ); CAF_PDM_InitField( &m_useAutoGeneratedPointAtSeaLevel, diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp index 9edaf5651b..d9d9b24241 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp @@ -63,13 +63,13 @@ RimWellIASettings::RimWellIASettings() setName( "Model" ); - CAF_PDM_InitFieldNoDefault( &m_geomechCase, "GeomechCase", "GeoMech Case", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geomechCase, "GeomechCase", "GeoMech Case" ); - CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDir", "Working Directory", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_baseDir, "BaseDir", "Working Directory" ); m_baseDir.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_startMD, "StartMeasuredDepth", 0.0, "Start MD", "", "", "" ); - CAF_PDM_InitField( &m_endMD, "EndMeasuredDepth", 0.0, "End MD", "", "", "" ); + CAF_PDM_InitField( &m_startMD, "StartMeasuredDepth", 0.0, "Start MD" ); + CAF_PDM_InitField( &m_endMD, "EndMeasuredDepth", 0.0, "End MD" ); m_startMD.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); m_endMD.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); @@ -79,17 +79,17 @@ RimWellIASettings::RimWellIASettings() CAF_PDM_InitFieldNoDefault( &m_csvParameters, "TimeStepParameters", "Time Step Parameters", ":/Bullet.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy" ); m_nameProxy.registerGetMethod( this, &RimWellIASettings::fullName ); m_nameProxy.uiCapability()->setUiReadOnly( true ); m_nameProxy.uiCapability()->setUiHidden( true ); m_nameProxy.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_showBox, "showBox", false, "Show model box", "", "", "" ); + CAF_PDM_InitField( &m_showBox, "showBox", false, "Show model box" ); - CAF_PDM_InitFieldNoDefault( &m_geostaticDate, "startDate", "Start Date (geostatic):", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_geostaticDate, "startDate", "Start Date (geostatic):" ); - CAF_PDM_InitField( &m_boxValid, "boxValid", false, "Model box is valid", "", "", "" ); + CAF_PDM_InitField( &m_boxValid, "boxValid", false, "Model box is valid" ); m_boxValid.uiCapability()->setUiHidden( true ); this->setDeletable( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp index fa8042fbf7..1548253415 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp @@ -40,7 +40,7 @@ RimWellIASettingsCollection::RimWellIASettingsCollection() { CAF_PDM_InitObject( "Integrity Analysis Models", ":/WellIntAnalysis.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_wellIASettings, "WellIASettings", "Settings", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellIASettings, "WellIASettings", "Settings" ); m_wellIASettings.uiCapability()->setUiHidden( true ); m_wellIASettings.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp index c84d6c8ee0..a52b4916db 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp @@ -83,63 +83,63 @@ RimWellPath::RimWellPath() { CAF_PDM_InitScriptableObjectWithNameAndComment( "WellPath", ":/Well.svg", "", "", "WellPath", "A ResInsight Well Path" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_name, "Name", "Name", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_name, "Name", "Name" ); m_name.registerKeywordAlias( "WellPathName" ); m_name.uiCapability()->setUiReadOnly( true ); m_name.uiCapability()->setUiHidden( true ); m_name.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_airGap, "AirGap", "Air Gap", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_airGap, "AirGap", "Air Gap" ); m_airGap.registerGetMethod( this, &RimWellPath::airGap ); m_airGap.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_datumElevation, "DatumElevation", "Datum Elevation", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_datumElevation, "DatumElevation", "Datum Elevation" ); m_datumElevation.registerGetMethod( this, &RimWellPath::datumElevation ); m_datumElevation.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_unitSystem, "UnitSystem", "Unit System", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_unitSystem, "UnitSystem", "Unit System" ); m_unitSystem.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitField( &m_simWellName, "SimWellName", QString( "" ), "Well", "", "", "" ); - CAF_PDM_InitField( &m_branchIndex, "SimBranchIndex", 0, "Branch", "", "", "" ); + CAF_PDM_InitField( &m_simWellName, "SimWellName", QString( "" ), "Well" ); + CAF_PDM_InitField( &m_branchIndex, "SimBranchIndex", 0, "Branch" ); - CAF_PDM_InitField( &m_showWellPathLabel, "ShowWellPathLabel", true, "Show Well Path Label", "", "", "" ); + CAF_PDM_InitField( &m_showWellPathLabel, "ShowWellPathLabel", true, "Show Well Path Label" ); - CAF_PDM_InitField( &m_showWellPath, "ShowWellPath", true, "Show Well Path", "", "", "" ); + CAF_PDM_InitField( &m_showWellPath, "ShowWellPath", true, "Show Well Path" ); m_showWellPath.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_wellPathRadiusScaleFactor, "WellPathRadiusScale", 1.0, "Well Path Radius Scale", "", "", "" ); - CAF_PDM_InitField( &m_wellPathColor, "WellPathColor", cvf::Color3f( 0.999f, 0.333f, 0.999f ), "Well Path Color", "", "", "" ); + CAF_PDM_InitField( &m_wellPathRadiusScaleFactor, "WellPathRadiusScale", 1.0, "Well Path Radius Scale" ); + CAF_PDM_InitField( &m_wellPathColor, "WellPathColor", cvf::Color3f( 0.999f, 0.333f, 0.999f ), "Well Path Color" ); - CAF_PDM_InitFieldNoDefault( &m_completions, "Completions", "Completions", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_completions, "Completions", "Completions" ); m_completions = new RimWellPathCompletions; m_completions.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_completionSettings, "CompletionSettings", "Completion Settings", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_completionSettings, "CompletionSettings", "Completion Settings" ); m_completionSettings = new RimWellPathCompletionSettings; - CAF_PDM_InitFieldNoDefault( &m_wellLogFiles, "WellLogFiles", "Well Log Files", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellLogFiles, "WellLogFiles", "Well Log Files" ); m_wellLogFiles.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_3dWellLogCurves, "CollectionOf3dWellLogCurves", "3D Track", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_3dWellLogCurves, "CollectionOf3dWellLogCurves", "3D Track" ); m_3dWellLogCurves = new Rim3dWellLogCurveCollection; m_3dWellLogCurves.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField( &m_formationKeyInFile, "WellPathFormationKeyInFile", QString( "" ), "Key in File", "", "", "" ); + CAF_PDM_InitField( &m_formationKeyInFile, "WellPathFormationKeyInFile", QString( "" ), "Key in File" ); m_formationKeyInFile.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_wellPathFormationFilePath, "WellPathFormationFilePath", "File Path", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellPathFormationFilePath, "WellPathFormationFilePath", "File Path" ); m_wellPathFormationFilePath.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_wellPathAttributes, "WellPathAttributes", "Casing Design Rubbish", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellPathAttributes, "WellPathAttributes", "Casing Design Rubbish" ); m_wellPathAttributes = new RimWellPathAttributeCollection; m_wellPathAttributes->uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_wellPathTieIn, "WellPathTieIn", "well Path Tie-In", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellPathTieIn, "WellPathTieIn", "well Path Tie-In" ); m_wellPathTieIn = new RimWellPathTieIn; m_wellPathTieIn->connectWellPaths( nullptr, this, 0.0 ); - CAF_PDM_InitFieldNoDefault( &m_wellIASettingsCollection, "WellIASettings", "Integrity Analysis Settings", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellIASettingsCollection, "WellIASettings", "Integrity Analysis Settings" ); m_wellIASettingsCollection = new RimWellIASettingsCollection(); this->setDeletable( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp index 90bb5711d5..93f480b9a7 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp @@ -38,11 +38,11 @@ double RimWellPathAttribute::MIN_DIAMETER_IN_INCHES = 7.0; //-------------------------------------------------------------------------------------------------- RimWellPathAttribute::RimWellPathAttribute() { - CAF_PDM_InitObject( "RimWellPathAttribute", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_type, "CompletionType", "Type ", "", "", "" ); - CAF_PDM_InitField( &m_startMD, "DepthStart", -1.0, "Start MD", "", "", "" ); - CAF_PDM_InitField( &m_endMD, "DepthEnd", -1.0, "End MD", "", "", "" ); - CAF_PDM_InitField( &m_diameterInInches, "DiameterInInches", MAX_DIAMETER_IN_INCHES, "Diameter", "", "", "" ); + CAF_PDM_InitObject( "RimWellPathAttribute" ); + CAF_PDM_InitFieldNoDefault( &m_type, "CompletionType", "Type " ); + CAF_PDM_InitField( &m_startMD, "DepthStart", -1.0, "Start MD" ); + CAF_PDM_InitField( &m_endMD, "DepthEnd", -1.0, "End MD" ); + CAF_PDM_InitField( &m_diameterInInches, "DiameterInInches", MAX_DIAMETER_IN_INCHES, "Diameter" ); m_type = RiaDefines::WellPathComponentType::CASING; m_diameterInInches.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp index 61bac96986..e31b36280d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp @@ -34,7 +34,7 @@ RimWellPathAttributeCollection::RimWellPathAttributeCollection() { CAF_PDM_InitObject( "Casing Design", ":/CasingDesign16x16", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_attributes, "Attributes", "Casing Design Attributes", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_attributes, "Attributes", "Casing Design Attributes" ); m_attributes.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); m_attributes.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_attributes.uiCapability()->setCustomContextMenuEnabled( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp index aa2b59d153..0c563fffa0 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp @@ -93,13 +93,13 @@ RimWellPathCollection::RimWellPathCollection() "WellPathCollection", "Collection of Well Paths" ); - CAF_PDM_InitField( &isActive, "Active", true, "Active", "", "", "" ); + CAF_PDM_InitField( &isActive, "Active", true, "Active" ); isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &showWellPathLabel, "ShowWellPathLabel", true, "Show Well Path Labels", "", "", "" ); + CAF_PDM_InitField( &showWellPathLabel, "ShowWellPathLabel", true, "Show Well Path Labels" ); cvf::Color3f defWellLabelColor = RiaPreferences::current()->defaultWellLabelColor(); - CAF_PDM_InitField( &wellPathLabelColor, "WellPathLabelColor", defWellLabelColor, "Well label color", "", "", "" ); + CAF_PDM_InitField( &wellPathLabelColor, "WellPathLabelColor", defWellLabelColor, "Well label color" ); CAF_PDM_InitField( &wellPathVisibility, "GlobalWellPathVisibility", @@ -109,23 +109,23 @@ RimWellPathCollection::RimWellPathCollection() "", "" ); - CAF_PDM_InitField( &wellPathRadiusScaleFactor, "WellPathRadiusScale", 0.1, "Well Path Radius Scale", "", "", "" ); - CAF_PDM_InitField( &wellPathCrossSectionVertexCount, "WellPathVertexCount", 12, "Well Path Vertex Count", "", "", "" ); + CAF_PDM_InitField( &wellPathRadiusScaleFactor, "WellPathRadiusScale", 0.1, "Well Path Radius Scale" ); + CAF_PDM_InitField( &wellPathCrossSectionVertexCount, "WellPathVertexCount", 12, "Well Path Vertex Count" ); wellPathCrossSectionVertexCount.xmlCapability()->disableIO(); wellPathCrossSectionVertexCount.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &wellPathClip, "WellPathClip", true, "Clip Well Paths", "", "", "" ); - CAF_PDM_InitField( &wellPathClipZDistance, "WellPathClipZDistance", 100, "Well Path Clipping Depth Distance", "", "", "" ); + CAF_PDM_InitField( &wellPathClip, "WellPathClip", true, "Clip Well Paths" ); + CAF_PDM_InitField( &wellPathClipZDistance, "WellPathClipZDistance", 100, "Well Path Clipping Depth Distance" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_wellPaths, "WellPaths", "Well Paths", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_wellPaths, "WellPaths", "Well Paths" ); m_wellPaths.uiCapability()->setUiTreeHidden( true ); m_wellPaths.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_wellMeasurements, "WellMeasurements", "Measurements", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellMeasurements, "WellMeasurements", "Measurements" ); m_wellMeasurements = new RimWellMeasurementCollection; m_wellMeasurements.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_wellPathNodes, "WellPathNodes", "Well Path Nodes", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_wellPathNodes, "WellPathNodes", "Well Path Nodes" ); m_wellPathNodes.xmlCapability()->disableIO(); m_wellPathImporter = std::make_unique(); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp index 1ea4923911..7a4471d9e2 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp @@ -73,19 +73,19 @@ RimWellPathGeometryDef::RimWellPathGeometryDef() "", "" ); - CAF_PDM_InitScriptableField( &m_airGap, "AirGap", 0.0, "Air Gap", "", "", "" ); + CAF_PDM_InitScriptableField( &m_airGap, "AirGap", 0.0, "Air Gap" ); m_airGap.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableField( &m_mdAtFirstTarget, "MdAtFirstTarget", 0.0, "MD at First Target", "", "", "" ); + CAF_PDM_InitScriptableField( &m_mdAtFirstTarget, "MdAtFirstTarget", 0.0, "MD at First Target" ); m_mdAtFirstTarget.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); - CAF_PDM_InitScriptableFieldNoDefault( &m_wellTargets, "WellPathTargets", "Well Targets", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_wellTargets, "WellPathTargets", "Well Targets" ); m_wellTargets.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); m_wellTargets.uiCapability()->setUiTreeChildrenHidden( true ); m_wellTargets.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_wellTargets.uiCapability()->setCustomContextMenuEnabled( true ); - CAF_PDM_InitField( &m_showAbsolutePosForWellTargets, "ShowAbsolutePosForWellTargets", false, "Show UTM Coords", "", "", "" ); + CAF_PDM_InitField( &m_showAbsolutePosForWellTargets, "ShowAbsolutePosForWellTargets", false, "Show UTM Coords" ); CAF_PDM_InitField( &m_useTopLevelWellReferencePoint, "UseTopLevelWellReferencePoint", false, @@ -110,20 +110,20 @@ RimWellPathGeometryDef::RimWellPathGeometryDef() "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_autoTargetAtSeaLevel, "AutoGeneratedTarget", "Auto Generated Target", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_autoTargetAtSeaLevel, "AutoGeneratedTarget", "Auto Generated Target" ); m_autoTargetAtSeaLevel = new RimWellPathTarget; m_autoTargetAtSeaLevel->setEnabled( false ); - CAF_PDM_InitScriptableField( &m_isAttachedToParentWell, "AttachedToParentWell", false, "Attached to Parent Well", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_fixedWellPathPoints, "FixedWellPathPoints", "", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_fixedMeasuredDepths, "FixedMeasuredDepths", "", "", "", "" ); + CAF_PDM_InitScriptableField( &m_isAttachedToParentWell, "AttachedToParentWell", false, "Attached to Parent Well" ); + CAF_PDM_InitFieldNoDefault( &m_fixedWellPathPoints, "FixedWellPathPoints", "" ); + CAF_PDM_InitFieldNoDefault( &m_fixedMeasuredDepths, "FixedMeasuredDepths", "" ); - CAF_PDM_InitField( &m_pickPointsEnabled, "m_pickPointsEnabled", false, "", "", "", "" ); + CAF_PDM_InitField( &m_pickPointsEnabled, "m_pickPointsEnabled", false, "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_pickPointsEnabled ); - CAF_PDM_InitScriptableField( &m_showSpheres, "ShowSpheres", true, "Spheres", "", "", "" ); - CAF_PDM_InitField( &m_sphereColor, "SphereColor", cvf::Color3f( cvf::Color3f::CEETRON ), "Sphere Color", "", "", "" ); - CAF_PDM_InitField( &m_sphereRadiusFactor, "SphereRadiusFactor", 0.15, "Sphere Radius Factor", "", "", "" ); + CAF_PDM_InitScriptableField( &m_showSpheres, "ShowSpheres", true, "Spheres" ); + CAF_PDM_InitField( &m_sphereColor, "SphereColor", cvf::Color3f( cvf::Color3f::CEETRON ), "Sphere Color" ); + CAF_PDM_InitField( &m_sphereRadiusFactor, "SphereRadiusFactor", 0.15, "Sphere Radius Factor" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp index f1afeb8997..a0eb9a2088 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp @@ -38,8 +38,8 @@ CAF_PDM_SOURCE_INIT( RimWellPathGroup, "WellPathGroup" ); RimWellPathGroup::RimWellPathGroup() { CAF_PDM_InitObject( "Well Path Group", ":/WellPathGroup.svg", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_childWellPaths, "ChildWellPaths", "Child Well Paths", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_groupName, "GroupName", "Group Name", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_childWellPaths, "ChildWellPaths", "Child Well Paths" ); + CAF_PDM_InitFieldNoDefault( &m_groupName, "GroupName", "Group Name" ); CAF_PDM_InitField( &m_addValveAtConnection, "AddValveAtConnection", @@ -48,7 +48,7 @@ RimWellPathGroup::RimWellPathGroup() "", "Should an outlet valve be added to branches for MSW export?", "" ); - CAF_PDM_InitFieldNoDefault( &m_valve, "Valve", "Branch Outlet Valve", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_valve, "Valve", "Branch Outlet Valve" ); m_valve = new RimWellPathValve; m_groupName.registerGetMethod( this, &RimWellPathGroup::createGroupName ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp index 9087b479a4..a38ca15cfa 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp @@ -64,28 +64,28 @@ RimWellPathTarget::RimWellPathTarget() "WellPathTarget", "Class containing the Well Target definition" ); - CAF_PDM_InitField( &m_isEnabled, "IsEnabled", true, "", "", "", "" ); - CAF_PDM_InitField( &m_isLocked, "IsLocked", false, "", "", "", "" ); + CAF_PDM_InitField( &m_isEnabled, "IsEnabled", true, "" ); + CAF_PDM_InitField( &m_isLocked, "IsLocked", false, "" ); m_isLocked.uiCapability()->setUiHidden( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_targetPointXYD, "TargetPoint", "Relative Coord", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_targetPointForDisplay, "TargetPointForDisplay", "UTM Coord", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_targetPointXYD, "TargetPoint", "Relative Coord" ); + CAF_PDM_InitFieldNoDefault( &m_targetPointForDisplay, "TargetPointForDisplay", "UTM Coord" ); m_targetPointForDisplay.registerGetMethod( this, &RimWellPathTarget::targetPointForDisplayXYD ); m_targetPointForDisplay.registerSetMethod( this, &RimWellPathTarget::setTargetPointFromDisplayCoord ); - CAF_PDM_InitScriptableFieldNoDefault( &m_targetMeasuredDepth, "TargetMeasuredDepth", "MD", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_targetMeasuredDepth, "TargetMeasuredDepth", "MD" ); m_targetMeasuredDepth.registerGetMethod( this, &RimWellPathTarget::measuredDepth ); CAF_PDM_InitScriptableField( &m_dogleg1, "Dogleg1", 3.0, "DL in", "", "[deg/30m]", "" ); CAF_PDM_InitScriptableField( &m_dogleg2, "Dogleg2", 3.0, "DL out", "", "[deg/30m]", "" ); - CAF_PDM_InitFieldNoDefault( &m_targetType, "TargetType", "Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_targetType, "TargetType", "Type" ); m_targetType.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_hasTangentConstraintUiField, "HasTangentConstraint", false, "Dir", "", "", "" ); + CAF_PDM_InitField( &m_hasTangentConstraintUiField, "HasTangentConstraint", false, "Dir" ); m_hasTangentConstraintUiField.xmlCapability()->disableIO(); - CAF_PDM_InitScriptableField( &m_azimuth, "Azimuth", 0.0, "Azi(deg)", "", "", "" ); - CAF_PDM_InitScriptableField( &m_inclination, "Inclination", 0.0, "Inc(deg)", "", "", "" ); + CAF_PDM_InitScriptableField( &m_azimuth, "Azimuth", 0.0, "Azi(deg)" ); + CAF_PDM_InitScriptableField( &m_inclination, "Inclination", 0.0, "Inc(deg)" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp index cd9352efd3..1dde40d4af 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp @@ -42,14 +42,14 @@ RimWellPathTieIn::RimWellPathTieIn() { CAF_PDM_InitObject( "Well Path Tie In", ":/NotDefined.png", "", "Well Path Tie In description" ); - CAF_PDM_InitFieldNoDefault( &m_parentWell, "ParentWellPath", "Parent Well Path", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_childWell, "ChildWellPath", "ChildWellPath", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_tieInMeasuredDepth, "TieInMeasuredDepth", "Tie In Measured Depth", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_parentWell, "ParentWellPath", "Parent Well Path" ); + CAF_PDM_InitFieldNoDefault( &m_childWell, "ChildWellPath", "ChildWellPath" ); + CAF_PDM_InitFieldNoDefault( &m_tieInMeasuredDepth, "TieInMeasuredDepth", "Tie In Measured Depth" ); m_tieInMeasuredDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_addValveAtConnection, "AddValveAtConnection", false, "Add Outlet Valve for Branches", "", "", "" ); + CAF_PDM_InitField( &m_addValveAtConnection, "AddValveAtConnection", false, "Add Outlet Valve for Branches" ); - CAF_PDM_InitFieldNoDefault( &m_valve, "Valve", "Branch Outlet Valve", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_valve, "Valve", "Branch Outlet Valve" ); m_valve = new RimWellPathValve; } diff --git a/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp b/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp index 1031c14372..8698d7389c 100644 --- a/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp +++ b/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp @@ -29,7 +29,7 @@ cafTreeNode::cafTreeNode() { CAF_PDM_InitObject( "WellPath", ":/Folder.svg", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_childNodes, "ChildNodes", "ChildNodes", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_childNodes, "ChildNodes", "ChildNodes" ); } //-------------------------------------------------------------------------------------------------- @@ -106,10 +106,10 @@ cafNamedTreeNode::cafNamedTreeNode() { CAF_PDM_InitObject( "Node", ":/Folder.svg", "", "" ); - CAF_PDM_InitField( &m_name, "Name", QString(), "Name", "", "", "" ); + CAF_PDM_InitField( &m_name, "Name", QString(), "Name" ); m_name.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_isChecked, "IsChecked", true, "Active", "", "", "" ); + CAF_PDM_InitField( &m_isChecked, "IsChecked", true, "Active" ); m_isChecked.uiCapability()->setUiHidden( true ); } @@ -192,7 +192,7 @@ cafObjectReferenceTreeNode::cafObjectReferenceTreeNode() { CAF_PDM_InitObject( "cafObjectReferenceTreeNode", ":/Folder.svg", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_referencedObject, "ReferencedObject", "Referenced Object", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_referencedObject, "ReferencedObject", "Referenced Object" ); m_childNodes.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModelCommands/CommandRouter/RimcExtractSurfaces.cpp b/ApplicationLibCode/ProjectDataModelCommands/CommandRouter/RimcExtractSurfaces.cpp index 248422020c..43be85f5af 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/CommandRouter/RimcExtractSurfaces.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/CommandRouter/RimcExtractSurfaces.cpp @@ -43,12 +43,12 @@ RimcCommandRouter_extractSurfaces::RimcCommandRouter_extractSurfaces( caf::PdmOb { CAF_PDM_InitObject( "Extract Layer Surface", "", "", "Extract Layer Surface" ); - CAF_PDM_InitScriptableField( &m_gridModelFilename, "GridModelFilename", QString(), "Grid Model Case Filename", "", "", "" ); - CAF_PDM_InitScriptableField( &m_layers, "Layers", std::vector(), "Layers", "", "", "" ); - CAF_PDM_InitScriptableField( &m_minimumI, "MinimumI", -1, "Minimum I", "", "", "" ); - CAF_PDM_InitScriptableField( &m_maximumI, "MaximumI", -1, "Maximum I", "", "", "" ); - CAF_PDM_InitScriptableField( &m_minimumJ, "MinimumJ", -1, "Minimum J", "", "", "" ); - CAF_PDM_InitScriptableField( &m_maximumJ, "MaximumJ", -1, "Maximum J", "", "", "" ); + CAF_PDM_InitScriptableField( &m_gridModelFilename, "GridModelFilename", QString(), "Grid Model Case Filename" ); + CAF_PDM_InitScriptableField( &m_layers, "Layers", std::vector(), "Layers" ); + CAF_PDM_InitScriptableField( &m_minimumI, "MinimumI", -1, "Minimum I" ); + CAF_PDM_InitScriptableField( &m_maximumI, "MaximumI", -1, "Maximum I" ); + CAF_PDM_InitScriptableField( &m_minimumJ, "MinimumJ", -1, "Minimum J" ); + CAF_PDM_InitScriptableField( &m_maximumJ, "MaximumJ", -1, "Maximum J" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.cpp index af38543062..0627fb5239 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.cpp @@ -29,6 +29,6 @@ CAF_PDM_SOURCE_INIT( RimcDataContainerDouble, "DataContainerFloat" ); //-------------------------------------------------------------------------------------------------- RimcDataContainerDouble::RimcDataContainerDouble() { - CAF_PDM_InitScriptableObject( "Data Container Float", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_doubleValues, "values", "Float Values", "", "", "" ); + CAF_PDM_InitScriptableObject( "Data Container Float" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_doubleValues, "values", "Float Values" ); } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerString.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerString.cpp index 5910d6103f..c8127da08e 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerString.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerString.cpp @@ -29,6 +29,6 @@ CAF_PDM_SOURCE_INIT( RimcDataContainerString, "DataContainerString" ); //-------------------------------------------------------------------------------------------------- RimcDataContainerString::RimcDataContainerString() { - CAF_PDM_InitScriptableObject( "Data Container String", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_stringValues, "values", "String Values", "", "", "" ); + CAF_PDM_InitScriptableObject( "Data Container String" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_stringValues, "values", "String Values" ); } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerTime.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerTime.cpp index 877aec9978..cce355fc72 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerTime.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerTime.cpp @@ -29,6 +29,6 @@ CAF_PDM_SOURCE_INIT( RimcDataContainerTime, "DataContainerTime" ); //-------------------------------------------------------------------------------------------------- RimcDataContainerTime::RimcDataContainerTime() { - CAF_PDM_InitScriptableObject( "Data Container Time", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_timeValues, "values", "Time Values", "", "", "" ); + CAF_PDM_InitScriptableObject( "Data Container Time" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_timeValues, "values", "Time Values" ); } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp index ac971634e3..761b62e297 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp @@ -46,7 +46,7 @@ RimProject_importSummaryCase::RimProject_importSummaryCase( caf::PdmObjectHandle : caf::PdmObjectMethod( self ) { CAF_PDM_InitObject( "Import Summary Case", "", "", "Import Summary Case" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_fileName, "FileName", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_fileName, "FileName", "" ); } //-------------------------------------------------------------------------------------------------- @@ -122,7 +122,7 @@ RimProject_summaryCase::RimProject_summaryCase( caf::PdmObjectHandle* self ) : caf::PdmObjectMethod( self ) { CAF_PDM_InitObject( "Find Summary Case", "", "", "Find Summary Case" ); - CAF_PDM_InitScriptableField( &m_caseId, "CaseId", -1, "", "", "", "" ); + CAF_PDM_InitScriptableField( &m_caseId, "CaseId", -1, "" ); } //-------------------------------------------------------------------------------------------------- @@ -174,7 +174,7 @@ RimProject_surfaceFolder::RimProject_surfaceFolder( caf::PdmObjectHandle* self ) : caf::PdmObjectMethod( self ) { CAF_PDM_InitObject( "Get Surface Folder", "", "", "Get Surface Folder" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_folderName, "FolderName", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_folderName, "FolderName", "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcStimPlanModelCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcStimPlanModelCollection.cpp index a4e85ae916..6e8dfac619 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcStimPlanModelCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcStimPlanModelCollection.cpp @@ -43,7 +43,7 @@ RimcStimPlanModelCollection_appendStimPlanModel::RimcStimPlanModelCollection_app { CAF_PDM_InitObject( "Create StimPlan Model", "", "", "Create a new StimPlan Model" ); CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "", "", "", "Well Path" ); - CAF_PDM_InitScriptableField( &m_md, "MeasuredDepth", 0.0, "Measured Depth", "", "", "" ); + CAF_PDM_InitScriptableField( &m_md, "MeasuredDepth", 0.0, "Measured Depth" ); CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModelTemplate, "StimPlanModelTemplate", "", "", "", "StimPlan Model Template" ); } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp index 56af273041..76dbd4322d 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp @@ -94,7 +94,7 @@ CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryCase, RimSummaryCase_availableAddre RimSummaryCase_availableAddresses::RimSummaryCase_availableAddresses( caf::PdmObjectHandle* self ) : caf::PdmObjectMethod( self ) { - CAF_PDM_InitObject( "Available Addresses", "", "", "" ); + CAF_PDM_InitObject( "Available Addresses" ); } //-------------------------------------------------------------------------------------------------- @@ -146,7 +146,7 @@ CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryCase, RimSummaryCase_availableTimeS RimSummaryCase_availableTimeSteps::RimSummaryCase_availableTimeSteps( caf::PdmObjectHandle* self ) : caf::PdmObjectMethod( self ) { - CAF_PDM_InitObject( "Available TimeSteps", "", "", "" ); + CAF_PDM_InitObject( "Available TimeSteps" ); } //-------------------------------------------------------------------------------------------------- @@ -191,7 +191,7 @@ CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryCase, RimSummaryCase_resampleValues RimSummaryCase_resampleValues::RimSummaryCase_resampleValues( caf::PdmObjectHandle* self ) : caf::PdmObjectMethod( self ) { - CAF_PDM_InitObject( "Resample Values", "", "", "" ); + CAF_PDM_InitObject( "Resample Values" ); CAF_PDM_InitScriptableFieldNoDefault( &m_addressString, "Address", "", "", "", "Formatted address specifying the summary vector" ); CAF_PDM_InitScriptableFieldNoDefault( &m_resamplingPeriod, "ResamplingPeriod", "", "", "", "Resampling Period" ); diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryResampleData.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryResampleData.cpp index 32db4cc80b..f4ba9c34f2 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryResampleData.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryResampleData.cpp @@ -29,7 +29,7 @@ CAF_PDM_SOURCE_INIT( RimcSummaryResampleData, "ResampleData" ); //-------------------------------------------------------------------------------------------------- RimcSummaryResampleData::RimcSummaryResampleData() { - CAF_PDM_InitScriptableObject( "Resample Data", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_timeValues, "TimeSteps", "Time Steps", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_doubleValues, "Values", "Values", "", "", "" ); + CAF_PDM_InitScriptableObject( "Resample Data" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_timeValues, "TimeSteps", "Time Steps" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_doubleValues, "Values", "Values" ); } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSurfaceCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSurfaceCollection.cpp index 16985c5482..237dcf061d 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSurfaceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSurfaceCollection.cpp @@ -141,8 +141,8 @@ RimcSurfaceCollection_newSurface::RimcSurfaceCollection_newSurface( caf::PdmObje : caf::PdmObjectMethod( self ) { CAF_PDM_InitObject( "New Surface", "", "", "Create a new surface" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_case, "Case", "", "", "", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_kIndex, "KIndex", "", "", "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_case, "Case", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_kIndex, "KIndex", "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp index 5fa296d9b9..85e09af2a9 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp @@ -41,7 +41,7 @@ RimcWellPath_addFracture::RimcWellPath_addFracture( caf::PdmObjectHandle* self ) { CAF_PDM_InitObject( "Add StimPlan Fracture", "", "", "Add StimPlan Fracture" ); - CAF_PDM_InitScriptableField( &m_md, "MeasuredDepth", 0.0, "Measured Depth", "", "", "" ); + CAF_PDM_InitScriptableField( &m_md, "MeasuredDepth", 0.0, "Measured Depth" ); CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanFractureTemplate, "StimPlanFractureTemplate", "", diff --git a/ApplicationLibCode/UnitTests/RifcCommandCore-Test.cpp b/ApplicationLibCode/UnitTests/RifcCommandCore-Test.cpp index ced25e6cb3..66a31cd1af 100644 --- a/ApplicationLibCode/UnitTests/RifcCommandCore-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifcCommandCore-Test.cpp @@ -15,10 +15,10 @@ class TestCommand1 : public RicfCommandObject public: TestCommand1() { - CAF_PDM_InitScriptableField( &m_textArgument, "TextArgument", QString(), "TextArgument", "", "", "" ); - CAF_PDM_InitScriptableField( &m_doubleArgument, "DoubleArgument", 0.0, "DoubleArgument", "", "", "" ); - CAF_PDM_InitScriptableField( &m_intArgument, "IntArgument", 0, "IntArgument", "", "", "" ); - CAF_PDM_InitScriptableField( &m_boolArgument, "BoolArgument", false, "BoolArgument", "", "", "" ); + CAF_PDM_InitScriptableField( &m_textArgument, "TextArgument", QString(), "TextArgument" ); + CAF_PDM_InitScriptableField( &m_doubleArgument, "DoubleArgument", 0.0, "DoubleArgument" ); + CAF_PDM_InitScriptableField( &m_intArgument, "IntArgument", 0, "IntArgument" ); + CAF_PDM_InitScriptableField( &m_boolArgument, "BoolArgument", false, "BoolArgument" ); } caf::PdmScriptResponse execute() override @@ -44,10 +44,10 @@ class TC2 : public RicfCommandObject public: TC2() { - CAF_PDM_InitScriptableField( &m_textArgument, "ta", QString(), "TextArgument", "", "", "" ); - CAF_PDM_InitScriptableField( &m_doubleArgument, "da", 0.0, "DoubleArgument", "", "", "" ); - CAF_PDM_InitScriptableField( &m_intArgument, "ia", 0, "IntArgument", "", "", "" ); - CAF_PDM_InitScriptableField( &m_boolArgument, "ba", false, "BoolArgument", "", "", "" ); + CAF_PDM_InitScriptableField( &m_textArgument, "ta", QString(), "TextArgument" ); + CAF_PDM_InitScriptableField( &m_doubleArgument, "da", 0.0, "DoubleArgument" ); + CAF_PDM_InitScriptableField( &m_intArgument, "ia", 0, "IntArgument" ); + CAF_PDM_InitScriptableField( &m_boolArgument, "ba", false, "BoolArgument" ); } caf::PdmScriptResponse execute() override diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp index 3c570386bf..e0ef615776 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp @@ -138,225 +138,126 @@ RiuSummaryVectorSelectionUi::RiuSummaryVectorSelectionUi() } ) , m_showIndividualEnsembleCases( false ) { - CAF_PDM_InitFieldNoDefault( &m_selectedSources, "SummaryCases", "Cases", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_selectedSources, "SummaryCases", "Cases" ); m_selectedSources.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault( &m_currentSummaryCategory, "CurrentSummaryCategory", "Current Summary Category", "", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_selectedSummaryCategories, "SelectedSummaryCategories", "Summary Categories", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_currentSummaryCategory, "CurrentSummaryCategory", "Current Summary Category" ); + CAF_PDM_InitFieldNoDefault( &m_selectedSummaryCategories, "SelectedSummaryCategories", "Summary Categories" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_FIELD][0]->pdmField(), "FieldVectors", - "Field vectors", - "", - "", - "" ); + "Field vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_AQUIFER][0]->pdmField(), "Aquifers", - "Aquifers", - "", - "", - "" ); + "Aquifers" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_AQUIFER][1]->pdmField(), "AquiferVectors", - "Aquifer Vectors", - "", - "", - "" ); + "Aquifer Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_NETWORK][0]->pdmField(), "NetworkVectors", - "Network Vectors", - "", - "", - "" ); + "Network Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_MISC][0]->pdmField(), "MiscVectors", - "Misc Vectors", - "", - "", - "" ); + "Misc Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION][0]->pdmField(), "Regions", - "Regions", - "", - "", - "" ); + "Regions" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION][1]->pdmField(), "RegionsVectors", - "Regions Vectors", - "", - "", - "" ); + "Regions Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION][0]->pdmField(), "Region2RegionRegions", - "Regions", - "", - "", - "" ); + "Regions" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION][1]->pdmField(), "Region2RegionVectors", - "Region2s Vectors", - "", - "", - "" ); + "Region2s Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_GROUP][0]->pdmField(), "WellGroupWellGroupNames", - "Well groups", - "", - "", - "" ); + "Well groups" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_GROUP][1]->pdmField(), "WellGroupVectors", - "Well Group Vectors", - "", - "", - "" ); + "Well Group Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL][0]->pdmField(), "WellWellName", - "Wells", - "", - "", - "" ); + "Wells" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL][1]->pdmField(), "WellVectors", - "Well Vectors", - "", - "", - "" ); + "Well Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION][0]->pdmField(), "WellCompletionWellName", - "Wells", - "", - "", - "" ); + "Wells" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION][1]->pdmField(), "WellCompletionIjk", - "Cell IJK", - "", - "", - "" ); + "Cell IJK" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION][2]->pdmField(), "WellCompletionVectors", - "Well Completion Vectors", - "", - "", - "" ); + "Well Completion Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][0]->pdmField(), "WellCompletionLgrLgrName", - "LGR Names", - "", - "", - "" ); + "LGR Names" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][1]->pdmField(), "WellCompletionLgrWellName", - "Wells", - "", - "", - "" ); + "Wells" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][2]->pdmField(), "WellCompletionLgrIjk", - "Cell IJK", - "", - "", - "" ); + "Cell IJK" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR][3]->pdmField(), "WellCompletionLgrVectors", - "Well Completion Vectors", - "", - "", - "" ); + "Well Completion Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_LGR][0]->pdmField(), "WellLgrLgrName", - "LGR Names", - "", - "", - "" ); + "LGR Names" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_LGR][1]->pdmField(), "WellLgrWellName", - "Wells", - "", - "", - "" ); + "Wells" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_LGR][2]->pdmField(), "WellLgrVectors", - "Vectors", - "", - "", - "" ); + "Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT][0]->pdmField(), "WellSegmentWellName", - "Wells", - "", - "", - "" ); + "Wells" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT][1]->pdmField(), "WellSegmentNumber", - "Segments", - "", - "", - "" ); + "Segments" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT][2]->pdmField(), "WellSegmentVectors", - "Vectors", - "", - "", - "" ); + "Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK][0]->pdmField(), "BlockIjk", - "Cell IJK", - "", - "", - "" ); + "Cell IJK" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK][1]->pdmField(), "BlockVectors", - "Block Vectors", - "", - "", - "" ); + "Block Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][0]->pdmField(), "BlockLgrLgrName", - "LGR Names", - "", - "", - "" ); + "LGR Names" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][1]->pdmField(), "BlockLgrIjk", - "Cell IJK", - "", - "", - "" ); + "Cell IJK" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR][2]->pdmField(), "BlockLgrVectors", - "Block Vectors", - "", - "", - "" ); + "Block Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_CALCULATED][0]->pdmField(), "CalculatedVectors", - "Calculated Vectors", - "", - "", - "" ); + "Calculated Vectors" ); CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_IMPORTED][0]->pdmField(), "ImportedVectors", - "Imported vectors", - "", - "", - "" ); + "Imported vectors" ); for ( const auto& itemTypes : m_identifierFieldsMap ) { From 89af752fa9b583025e0226c8469e57abb288a47b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 16 Nov 2021 14:31:49 +0100 Subject: [PATCH 007/406] #8295 Guard null pointer access --- .../RimStimPlanFractureTemplate.cpp | 235 +++++++++--------- 1 file changed, 115 insertions(+), 120 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index 3a4cc43b07..a62af329fc 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -486,167 +486,162 @@ std::vector WellFractureIntersectionData RimStimPlanFractureTemplate::wellFractureIntersectionData( const RimFracture* fractureInstance ) const { + if ( !fractureInstance || !fractureInstance->fractureGrid() ) return {}; + WellFractureIntersectionData values; const RigFractureGrid* fractureGrid = fractureInstance->fractureGrid(); - if ( fractureGrid ) + if ( orientationType() == ALONG_WELL_PATH ) { - if ( orientationType() == ALONG_WELL_PATH ) - { - CVF_ASSERT( fractureInstance ); + RimWellPath* rimWellPath = nullptr; + fractureInstance->firstAncestorOrThisOfType( rimWellPath ); - RimWellPath* rimWellPath = nullptr; - fractureInstance->firstAncestorOrThisOfType( rimWellPath ); + if ( rimWellPath && rimWellPath->wellPathGeometry() ) + { + double totalLength = 0.0; + double weightedConductivity = 0.0; + double weightedWidth = 0.0; + double weightedBetaFactorOnFile = 0.0; - if ( rimWellPath && rimWellPath->wellPathGeometry() ) { - double totalLength = 0.0; - double weightedConductivity = 0.0; - double weightedWidth = 0.0; - double weightedBetaFactorOnFile = 0.0; + std::vector widthResultValues; + { + auto nameUnit = widthParameterNameAndUnit(); + widthResultValues = fractureGridResultsForUnitSystem( nameUnit.first, + nameUnit.second, + m_activeTimeStepIndex, + fractureTemplateUnit() ); + } + std::vector conductivityResultValues; { - std::vector widthResultValues; - { - auto nameUnit = widthParameterNameAndUnit(); - widthResultValues = fractureGridResultsForUnitSystem( nameUnit.first, - nameUnit.second, - m_activeTimeStepIndex, - fractureTemplateUnit() ); - } + auto nameUnit = conductivityParameterNameAndUnit(); + conductivityResultValues = fractureGridResultsForUnitSystem( nameUnit.first, + nameUnit.second, + m_activeTimeStepIndex, + fractureTemplateUnit() ); + } - std::vector conductivityResultValues; + std::vector betaFactorResultValues; + { + auto nameUnit = betaFactorParameterNameAndUnit(); + betaFactorResultValues = m_stimPlanFractureDefinitionData->fractureGridResults( nameUnit.first, + nameUnit.second, + m_activeTimeStepIndex ); + } + + RiaWeightedMeanCalculator widthCalc; + RiaWeightedMeanCalculator conductivityCalc; + RiaWeightedGeometricMeanCalculator betaFactorCalc; + + RigWellPathStimplanIntersector intersector( rimWellPath->wellPathGeometry(), fractureInstance ); + for ( const auto& v : intersector.intersections() ) + { + size_t fractureGlobalCellIndex = v.first; + double intersectionLength = v.second.computeLength(); + + if ( fractureGlobalCellIndex < widthResultValues.size() ) { - auto nameUnit = conductivityParameterNameAndUnit(); - conductivityResultValues = fractureGridResultsForUnitSystem( nameUnit.first, - nameUnit.second, - m_activeTimeStepIndex, - fractureTemplateUnit() ); + widthCalc.addValueAndWeight( widthResultValues[fractureGlobalCellIndex], intersectionLength ); } - std::vector betaFactorResultValues; + if ( fractureGlobalCellIndex < conductivityResultValues.size() ) { - auto nameUnit = betaFactorParameterNameAndUnit(); - betaFactorResultValues = - m_stimPlanFractureDefinitionData->fractureGridResults( nameUnit.first, - nameUnit.second, - m_activeTimeStepIndex ); + conductivityCalc.addValueAndWeight( conductivityResultValues[fractureGlobalCellIndex], + intersectionLength ); } - RiaWeightedMeanCalculator widthCalc; - RiaWeightedMeanCalculator conductivityCalc; - RiaWeightedGeometricMeanCalculator betaFactorCalc; - - RigWellPathStimplanIntersector intersector( rimWellPath->wellPathGeometry(), fractureInstance ); - for ( const auto& v : intersector.intersections() ) + if ( fractureGlobalCellIndex < betaFactorResultValues.size() ) { - size_t fractureGlobalCellIndex = v.first; - double intersectionLength = v.second.computeLength(); + double nativeBetaFactor = betaFactorResultValues[fractureGlobalCellIndex]; - if ( fractureGlobalCellIndex < widthResultValues.size() ) + // Guard against zero beta values, as these values will set the geometric mean to zero + // Consider using the conductivity threshold instead of a local beta threshold + const double threshold = 1e-6; + if ( fabs( nativeBetaFactor ) > threshold ) { - widthCalc.addValueAndWeight( widthResultValues[fractureGlobalCellIndex], intersectionLength ); + betaFactorCalc.addValueAndWeight( nativeBetaFactor, intersectionLength ); } - - if ( fractureGlobalCellIndex < conductivityResultValues.size() ) - { - conductivityCalc.addValueAndWeight( conductivityResultValues[fractureGlobalCellIndex], - intersectionLength ); - } - - if ( fractureGlobalCellIndex < betaFactorResultValues.size() ) - { - double nativeBetaFactor = betaFactorResultValues[fractureGlobalCellIndex]; - - // Guard against zero beta values, as these values will set the geometric mean to zero - // Consider using the conductivity threshold instead of a local beta threshold - const double threshold = 1e-6; - if ( fabs( nativeBetaFactor ) > threshold ) - { - betaFactorCalc.addValueAndWeight( nativeBetaFactor, intersectionLength ); - } - } - } - if ( conductivityCalc.validAggregatedWeight() ) - { - weightedConductivity = conductivityCalc.weightedMean(); - } - if ( widthCalc.validAggregatedWeight() ) - { - weightedWidth = widthCalc.weightedMean(); - totalLength = widthCalc.aggregatedWeight(); - } - if ( betaFactorCalc.validAggregatedWeight() ) - { - weightedBetaFactorOnFile = betaFactorCalc.weightedMean(); } } - - if ( totalLength > 1e-7 ) + if ( conductivityCalc.validAggregatedWeight() ) { - values.m_width = weightedWidth; - values.m_conductivity = weightedConductivity; + weightedConductivity = conductivityCalc.weightedMean(); + } + if ( widthCalc.validAggregatedWeight() ) + { + weightedWidth = widthCalc.weightedMean(); + totalLength = widthCalc.aggregatedWeight(); + } + if ( betaFactorCalc.validAggregatedWeight() ) + { + weightedBetaFactorOnFile = betaFactorCalc.weightedMean(); + } + } - double conversionFactorForBeta = conversionFactorForBetaValues(); - double betaFactorForcheimer = weightedBetaFactorOnFile / conversionFactorForBeta; + if ( totalLength > 1e-7 ) + { + values.m_width = weightedWidth; + values.m_conductivity = weightedConductivity; - values.m_betaFactorInForcheimerUnits = betaFactorForcheimer; - } + double conversionFactorForBeta = conversionFactorForBetaValues(); + double betaFactorForcheimer = weightedBetaFactorOnFile / conversionFactorForBeta; - values.m_permeability = RigTransmissibilityEquations::permeability( weightedConductivity, weightedWidth ); + values.m_betaFactorInForcheimerUnits = betaFactorForcheimer; } + + values.m_permeability = RigTransmissibilityEquations::permeability( weightedConductivity, weightedWidth ); } - else - { - std::pair wellCellIJ = fractureGrid->fractureCellAtWellCenter(); - size_t wellCellIndex = fractureGrid->getGlobalIndexFromIJ( wellCellIJ.first, wellCellIJ.second ); - const RigFractureCell& wellCell = fractureGrid->cellFromIndex( wellCellIndex ); + } + else + { + std::pair wellCellIJ = fractureGrid->fractureCellAtWellCenter(); + size_t wellCellIndex = fractureGrid->getGlobalIndexFromIJ( wellCellIJ.first, wellCellIJ.second ); + const RigFractureCell& wellCell = fractureGrid->cellFromIndex( wellCellIndex ); - double conductivity = wellCell.getConductivityValue(); - values.m_conductivity = conductivity; + double conductivity = wellCell.getConductivityValue(); + values.m_conductivity = conductivity; + { + auto nameUnit = widthParameterNameAndUnit(); + if ( !nameUnit.first.isEmpty() ) { - auto nameUnit = widthParameterNameAndUnit(); - if ( !nameUnit.first.isEmpty() ) + double widthInRequiredUnit = HUGE_VAL; { - double widthInRequiredUnit = HUGE_VAL; - { - auto resultValues = fractureGridResultsForUnitSystem( nameUnit.first, - nameUnit.second, - m_activeTimeStepIndex, - fractureTemplateUnit() ); + auto resultValues = fractureGridResultsForUnitSystem( nameUnit.first, + nameUnit.second, + m_activeTimeStepIndex, + fractureTemplateUnit() ); - if ( wellCellIndex < resultValues.size() ) - { - widthInRequiredUnit = resultValues[wellCellIndex]; - } - } - - if ( widthInRequiredUnit != HUGE_VAL && fabs( widthInRequiredUnit ) > 1e-20 ) + if ( wellCellIndex < resultValues.size() ) { - values.m_width = widthInRequiredUnit; - values.m_permeability = - RigTransmissibilityEquations::permeability( conductivity, widthInRequiredUnit ); + widthInRequiredUnit = resultValues[wellCellIndex]; } } + + if ( widthInRequiredUnit != HUGE_VAL && fabs( widthInRequiredUnit ) > 1e-20 ) + { + values.m_width = widthInRequiredUnit; + values.m_permeability = RigTransmissibilityEquations::permeability( conductivity, widthInRequiredUnit ); + } } + } - { - auto nameUnit = betaFactorParameterNameAndUnit(); - std::vector betaFactorResultValues = - m_stimPlanFractureDefinitionData->fractureGridResults( nameUnit.first, - nameUnit.second, - m_activeTimeStepIndex ); + { + auto nameUnit = betaFactorParameterNameAndUnit(); + std::vector betaFactorResultValues = + m_stimPlanFractureDefinitionData->fractureGridResults( nameUnit.first, + nameUnit.second, + m_activeTimeStepIndex ); - if ( wellCellIndex < betaFactorResultValues.size() ) - { - double nativeBetaValue = betaFactorResultValues[wellCellIndex]; + if ( wellCellIndex < betaFactorResultValues.size() ) + { + double nativeBetaValue = betaFactorResultValues[wellCellIndex]; - double conversionFactorForBeta = conversionFactorForBetaValues(); - double betaFactorForcheimer = nativeBetaValue / conversionFactorForBeta; + double conversionFactorForBeta = conversionFactorForBetaValues(); + double betaFactorForcheimer = nativeBetaValue / conversionFactorForBeta; - values.m_betaFactorInForcheimerUnits = betaFactorForcheimer; - } + values.m_betaFactorInForcheimerUnits = betaFactorForcheimer; } } } From 7dfa84b0d9f65ee9e4ac74616322e8dd27aa6cef Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 16 Nov 2021 09:13:35 +0100 Subject: [PATCH 008/406] AppFwk : Support notification when key is pressed in Line/ComboBox editors --- .../cafTestApplication/CMakeLists.txt | 2 + .../LineEditAndPushButtons.cpp | 188 ++++++++++++++++++ .../LineEditAndPushButtons.h | 38 ++++ .../cafTestApplication/MainWindow.cpp | 8 +- .../cafPdmUiComboBoxEditor.cpp | 35 ++++ .../cafUserInterface/cafPdmUiComboBoxEditor.h | 9 +- .../cafUserInterface/cafPdmUiLineEditor.cpp | 10 +- .../cafUserInterface/cafPdmUiLineEditor.h | 2 + 8 files changed, 287 insertions(+), 5 deletions(-) create mode 100644 Fwk/AppFwk/cafTests/cafTestApplication/LineEditAndPushButtons.cpp create mode 100644 Fwk/AppFwk/cafTests/cafTestApplication/LineEditAndPushButtons.h diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt b/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt index 88102d6e33..89c306b8d4 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt +++ b/Fwk/AppFwk/cafTests/cafTestApplication/CMakeLists.txt @@ -45,6 +45,8 @@ set(PROJECT_FILES MenuItemProducer.h TamComboBox.h TamComboBox.cpp + LineEditAndPushButtons.h + LineEditAndPushButtons.cpp ) # add the executable diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/LineEditAndPushButtons.cpp b/Fwk/AppFwk/cafTests/cafTestApplication/LineEditAndPushButtons.cpp new file mode 100644 index 0000000000..32059e1f39 --- /dev/null +++ b/Fwk/AppFwk/cafTests/cafTestApplication/LineEditAndPushButtons.cpp @@ -0,0 +1,188 @@ + +#include "LineEditAndPushButtons.h" + +#include "cafPdmUiLineEditor.h" +#include "cafPdmUiListEditor.h" +#include "cafPdmUiPushButtonEditor.h" +#include "cafPdmUiTreeSelectionEditor.h" + +CAF_PDM_SOURCE_INIT(LineEditAndPushButtons, "LineEditAndPushButtons"); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +LineEditAndPushButtons::LineEditAndPushButtons() +{ + CAF_PDM_InitObject("Line Edit And Push Buttons", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_statusTextField, "StatusTextField", "Status Text", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_textField, "TextField", "Text", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_textListField, "TextListField", "Text List Field", "", "", ""); + + CAF_PDM_InitFieldNoDefault(&m_pushButton_a, "PushButtonA", "Rotate", "", "", ""); + m_pushButton_a.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName()); + m_pushButton_a.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); + + CAF_PDM_InitFieldNoDefault(&m_pushButtonReplace, "PushButtonB", "Replace (CTRL + Enter)", "", "", ""); + m_pushButtonReplace.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName()); + m_pushButtonReplace.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); + + CAF_PDM_InitFieldNoDefault(&m_pushButtonClear, "PushButtonC", "Clear (Alt + Enter)", "", "", ""); + m_pushButtonClear.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName()); + m_pushButtonClear.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); + + CAF_PDM_InitFieldNoDefault(&m_pushButtonAppend, "PushButtonD", "Append (Shift + Enter)", "", "", ""); + m_pushButtonAppend.uiCapability()->setUiEditorTypeName(caf::PdmUiPushButtonEditor::uiEditorTypeName()); + m_pushButtonAppend.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); + + std::vector items; + items.push_back("sldkfj"); + items.push_back("annet sldkfj"); + items.push_back("kort"); + items.push_back("veldig langt"); + items.push_back("kort"); + + m_textListField = items; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void LineEditAndPushButtons::fieldChangedByUi(const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue) +{ + if (changedField == &m_pushButton_a) + { + rotateContent(); + } + + if (changedField == &m_textField) + { + auto mods = QGuiApplication::keyboardModifiers(); + + // Use global keyboard modifiers to trigger different events when content is changed in editor changes + + if (mods & Qt::ShiftModifier) + appendText(); + else if (mods & Qt::ControlModifier) + replaceText(); + else if (mods & Qt::AltModifier) + clearText(); + else + { + m_statusTextField = m_textField; + } + } + + if (changedField == &m_pushButtonReplace) + { + replaceText(); + } + if (changedField == &m_pushButtonClear) + { + clearText(); + } + if (changedField == &m_pushButtonAppend) + { + appendText(); + } + + m_pushButton_a = false; + m_pushButtonReplace = false; + m_pushButtonClear = false; + m_pushButtonAppend = false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void LineEditAndPushButtons::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) {} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void LineEditAndPushButtons::defineEditorAttribute(const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute) +{ + if (field == &m_textField) + { + auto myAttr = dynamic_cast(attribute); + if (myAttr) + { + myAttr->notifyWhenTextIsEdited = true; + } + } + + { + auto myAttr = dynamic_cast(attribute); + if (myAttr) + { + if (field == &m_pushButton_a) + { + myAttr->m_buttonText = "&Push Me"; + } + if (field == &m_pushButtonReplace) + { + myAttr->m_buttonText = "Replace (Ctrl + Enter)"; + } + if (field == &m_pushButtonClear) + { + myAttr->m_buttonText = "Clear (Alt + Enter)"; + } + if (field == &m_pushButtonAppend) + { + myAttr->m_buttonText = "Append (Shift + Enter)"; + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void LineEditAndPushButtons::rotateContent() +{ + auto original = m_textListField.value(); + + std::list newContent; + newContent.insert(newContent.begin(), original.begin(), original.end()); + + auto firstItem = newContent.front(); + newContent.pop_front(); + newContent.push_back(firstItem); + + std::vector tmp; + tmp.insert(tmp.begin(), newContent.begin(), newContent.end()); + + m_textListField = tmp; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void LineEditAndPushButtons::appendText() +{ + auto original = m_textListField.value(); + original.push_back(m_textField); + + m_textListField = original; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void LineEditAndPushButtons::replaceText() +{ + clearText(); + appendText(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void LineEditAndPushButtons::clearText() +{ + m_textListField = std::vector(); +} diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/LineEditAndPushButtons.h b/Fwk/AppFwk/cafTests/cafTestApplication/LineEditAndPushButtons.h new file mode 100644 index 0000000000..f3cb5e3008 --- /dev/null +++ b/Fwk/AppFwk/cafTests/cafTestApplication/LineEditAndPushButtons.h @@ -0,0 +1,38 @@ +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmProxyValueField.h" + +class LineEditAndPushButtons : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + LineEditAndPushButtons(); + + void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; + +private: + void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + + void defineEditorAttribute(const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute) override; + + void rotateContent(); + void appendText(); + void replaceText(); + void clearText(); + +private: + caf::PdmField m_textField; + caf::PdmField m_statusTextField; + caf::PdmField> m_textListField; + + caf::PdmField m_pushButton_a; + + caf::PdmField m_pushButtonReplace; + caf::PdmField m_pushButtonClear; + caf::PdmField m_pushButtonAppend; +}; diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp index 90c752ba2c..640e9facd0 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp +++ b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp @@ -4,6 +4,7 @@ #include "MainWindow.h" #include "CustomObjectEditor.h" +#include "LineEditAndPushButtons.h" #include "ManyGroups.h" #include "MenuItemProducer.h" #include "TamComboBox.h" @@ -54,10 +55,9 @@ class DemoPdmObjectGroup : public caf::PdmDocument public: DemoPdmObjectGroup() { - CAF_PDM_InitFieldNoDefault(&objects, "PdmObjects", "", "", "", "") + CAF_PDM_InitFieldNoDefault(&objects, "PdmObjects", "MyRootObject", "", "", ""); - objects.uiCapability() - ->setUiHidden(true); + objects.uiCapability()->setUiHidden(true); } public: @@ -1200,6 +1200,8 @@ void MainWindow::buildTestModel() SingleEditorPdmObject* singleEditorObj = new SingleEditorPdmObject; m_testRoot->objects.push_back(singleEditorObj); + m_testRoot->objects.push_back(new LineEditAndPushButtons); + auto tamComboBox = new TamComboBox; m_testRoot->objects.push_back(tamComboBox); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp index f491f3bf10..3206094a52 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp @@ -284,6 +284,20 @@ void PdmUiComboBoxEditor::configureAndUpdateUi( const QString& uiConfigName ) m_comboBox->lineEdit()->setPlaceholderText( m_attributes.placeholderText ); } + if ( m_attributes.notifyWhenTextIsEdited ) + { + connect( m_comboBox, + SIGNAL( editTextChanged( const QString& ) ), + this, + SLOT( slotEditTextChanged( const QString& ) ) ); + + if ( m_interactiveEditText == m_comboBox->lineEdit()->text() && m_interactiveEditCursorPosition > -1 ) + { + m_comboBox->lineEdit()->setCursorPosition( m_interactiveEditCursorPosition ); + m_comboBox->lineEdit()->deselect(); + } + } + if ( m_attributes.minimumWidth != -1 ) { m_comboBox->setMinimumWidth( m_attributes.minimumWidth ); @@ -455,6 +469,14 @@ class CustomQComboBox : public QComboBox } }; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +PdmUiComboBoxEditor::PdmUiComboBoxEditor() + : m_interactiveEditCursorPosition( -1 ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -509,6 +531,19 @@ void PdmUiComboBoxEditor::slotIndexActivated( int index ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiComboBoxEditor::slotEditTextChanged( const QString& text ) +{ + if ( text == m_interactiveEditText ) return; + + m_interactiveEditText = text; + m_interactiveEditCursorPosition = m_comboBox->lineEdit()->cursorPosition(); + + this->setValueToField( text ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h index f83a3d7f9e..c48fcc0a95 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h @@ -63,6 +63,7 @@ class PdmUiComboBoxEditorAttribute : public PdmUiEditorAttribute enableEditableContent = false; minimumWidth = -1; iconSize = QSize( 14, 14 ); + notifyWhenTextIsEdited = false; } public: @@ -80,6 +81,8 @@ class PdmUiComboBoxEditorAttribute : public PdmUiEditorAttribute QSize iconSize; QIcon nextIcon; QIcon previousIcon; + + bool notifyWhenTextIsEdited; }; //================================================================================================== @@ -91,7 +94,7 @@ class PdmUiComboBoxEditor : public PdmUiFieldEditorHandle CAF_PDM_UI_FIELD_EDITOR_HEADER_INIT; public: - PdmUiComboBoxEditor() {} + PdmUiComboBoxEditor(); ~PdmUiComboBoxEditor() override {} protected: @@ -102,6 +105,7 @@ class PdmUiComboBoxEditor : public PdmUiFieldEditorHandle protected slots: void slotIndexActivated( int index ); + void slotEditTextChanged( const QString& ); void slotNextButtonPressed(); void slotPreviousButtonPressed(); @@ -116,6 +120,9 @@ protected slots: QPointer m_placeholder; PdmUiComboBoxEditorAttribute m_attributes; + + QString m_interactiveEditText; + int m_interactiveEditCursorPosition; }; } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp index fe9f9942d6..00d08e3bb7 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp @@ -141,6 +141,11 @@ void PdmUiLineEditor::configureAndUpdateUi( const QString& uiConfigName ) { m_lineEdit->setPlaceholderText( leab.placeholderText ); } + + if ( leab.notifyWhenTextIsEdited ) + { + connect( m_lineEdit, SIGNAL( textEdited( const QString& ) ), this, SLOT( slotEditingFinished() ) ); + } } bool fromMenuOnly = true; @@ -220,7 +225,10 @@ void PdmUiLineEditor::configureAndUpdateUi( const QString& uiConfigName ) displayString = displayStringAttrib.m_displayString; } - m_lineEdit->setText( displayString ); + if ( displayString != m_lineEdit->text() ) + { + m_lineEdit->setText( displayString ); + } } } } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h index 229f831595..d512e107bb 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.h @@ -65,6 +65,7 @@ class PdmUiLineEditorAttribute : public PdmUiEditorAttribute maximumWidth = -1; selectAllOnFocusEvent = false; placeholderText = ""; + notifyWhenTextIsEdited = false; } public: @@ -77,6 +78,7 @@ class PdmUiLineEditorAttribute : public PdmUiEditorAttribute int maximumWidth; bool selectAllOnFocusEvent; QString placeholderText; + bool notifyWhenTextIsEdited; }; //-------------------------------------------------------------------------------------------------- From bc906f737c3c63aa69d21a7383333e69e2f75f6f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 16 Nov 2021 09:15:52 +0100 Subject: [PATCH 009/406] Variadic macro updates --- .../ProjectDataModel/Parameters/RimParameterGroup.cpp | 2 +- .../ProjectDataModel/Parameters/RimParameterList.cpp | 6 +++--- .../ProjectDataModel/WellPath/RimWellIASettings.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp index a388805598..a2e51185df 100644 --- a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp @@ -70,7 +70,7 @@ RimParameterGroup::RimParameterGroup() m_labelProxy.uiCapability()->setUiHidden( true ); m_labelProxy.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_lists, "ParameterLists", "Parameter Lists", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_lists, "ParameterLists", "Parameter Lists" ); m_lists.uiCapability()->setUiHidden( true ); m_lists.uiCapability()->setUiTreeHidden( true ); m_lists.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterList.cpp b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterList.cpp index 1b3a0d9560..70e2622344 100644 --- a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterList.cpp +++ b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterList.cpp @@ -32,15 +32,15 @@ RimParameterList::RimParameterList() CAF_PDM_InitObject( "Parameter List", ":/Bullet.png", "", "" ); uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_parameterNames, "ParameterNames", "Parameters", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_parameterNames, "ParameterNames", "Parameters" ); m_parameterNames.uiCapability()->setUiHidden( true ); m_parameterNames.uiCapability()->setUiTreeHidden( true ); m_parameterNames.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_name, "Name", QString(), "Name", "", "", "" ); + CAF_PDM_InitField( &m_name, "Name", QString(), "Name" ); m_name.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_label, "Label", QString(), "Name", "", "", "" ); + CAF_PDM_InitField( &m_label, "Label", QString(), "Name" ); m_label.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp index d9d9b24241..7499a5a170 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp @@ -73,7 +73,7 @@ RimWellIASettings::RimWellIASettings() m_startMD.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); m_endMD.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_bufferXY, "BufferXY", 5.0, "Model Size (XY)", "", "", "" ); + CAF_PDM_InitField( &m_bufferXY, "BufferXY", 5.0, "Model Size (XY)" ); CAF_PDM_InitFieldNoDefault( &m_parameters, "ModelingParameters", "Modeling Parameters", ":/Bullet.png", "", "" ); From 21fd4f74b530194397fd25faf7df07d2afb1d597 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 16 Nov 2021 09:23:45 +0100 Subject: [PATCH 010/406] Refactor code --- .../RicSummaryPlotFeatureImpl.cpp | 256 +++++----- .../RicSummaryPlotFeatureImpl.h | 44 +- ...RimSummaryPlotFilterTextCurveSetEditor.cpp | 468 ++++++++++-------- .../RimSummaryPlotFilterTextCurveSetEditor.h | 14 +- .../RimcSummaryPlotCollection.cpp | 15 +- 5 files changed, 422 insertions(+), 375 deletions(-) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index 6fdfb61890..dc46551c93 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -60,58 +60,6 @@ #include #include -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryCurve* RicSummaryPlotFeatureImpl::addDefaultCurveToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase ) -{ - if ( plot && summaryCase && summaryCase->summaryReader() ) - { - RifEclipseSummaryAddress defaultAddressToUse; - - RiaPreferencesSummary* prefs = RiaPreferencesSummary::current(); - - QString curvesTextFilter = prefs->defaultSummaryCurvesTextFilter(); - QStringList curveFilters = curvesTextFilter.split( ";", QString::SkipEmptyParts ); - - if ( curveFilters.size() ) - { - const std::set& addrs = summaryCase->summaryReader()->allResultAddresses(); - - for ( const auto& addr : addrs ) - { - const QString& filter = curveFilters[0]; - { - if ( addr.isUiTextMatchingFilterText( filter ) ) - { - defaultAddressToUse = addr; - } - } - } - } - - RimSummaryCurve* newCurve = new RimSummaryCurve(); - - // Use same counting as RicNewSummaryEnsembleCurveSetFeature::onActionTriggered - cvf::Color3f curveColor = - RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( plot->singleColorCurveCount() ); - newCurve->setColor( curveColor ); - - plot->addCurveNoUpdate( newCurve ); - - if ( summaryCase ) - { - newCurve->setSummaryCaseY( summaryCase ); - } - - newCurve->setSummaryAddressYAndApplyInterpolation( defaultAddressToUse ); - - return newCurve; - } - - return nullptr; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -183,16 +131,17 @@ caf::PdmObject* RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( RimSummaryC return itemToSelect; } -RimSummaryCurve* createHistoryCurve( const RifEclipseSummaryAddress& addr, RimSummaryCase* summaryCasesToUse ) +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCurve* RicSummaryPlotFeatureImpl::createHistoryCurve( const RifEclipseSummaryAddress& addr, + RimSummaryCase* summaryCasesToUse ) { RifEclipseSummaryAddress historyAddr = addr; historyAddr.setQuantityName( historyAddr.quantityName() + "H" ); if ( summaryCasesToUse->summaryReader()->allResultAddresses().count( historyAddr ) ) { - RimSummaryCurve* historyCurve = new RimSummaryCurve(); - historyCurve->setSummaryCaseY( summaryCasesToUse ); - historyCurve->setSummaryAddressYAndApplyInterpolation( historyAddr ); - return historyCurve; + return createCurve( summaryCasesToUse, historyAddr ); } return nullptr; @@ -418,13 +367,22 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin if ( isSinglePlot ) { - RimSummaryPlot* newPlot = createSummaryPlotFromAddresses( sumPlotColl, - summaryCasesToUse, - ensemble, - summaryAddressFilters, - addHistoryCurves, - ensembleColoringStyle, - ensembleColoringParameter ); + RimSummaryPlot* newPlot = nullptr; + if ( ensemble ) + { + newPlot = createSummaryPlotForEnsemble( sumPlotColl, + summaryCasesToUse, + ensemble, + summaryAddressFilters, + addHistoryCurves, + ensembleColoringStyle, + ensembleColoringParameter ); + } + else + { + newPlot = + createSummaryPlotForCases( sumPlotColl, summaryCasesToUse, summaryAddressFilters, addHistoryCurves ); + } lastPlotCreated = newPlot; @@ -597,14 +555,13 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin } } -RimSummaryPlot* - RicSummaryPlotFeatureImpl::createSummaryPlotFromAddresses( RimSummaryPlotCollection* sumPlotColl, - const std::vector& summaryCasesToUse, - RimSummaryCaseCollection* ensemble, - QStringList summaryAddressFilters, - bool addHistoryCurves, - EnsembleColoringType ensembleColoringStyle, - QString ensembleColoringParameter ) +RimSummaryPlot* RicSummaryPlotFeatureImpl::createSummaryPlotForEnsemble( RimSummaryPlotCollection* sumPlotColl, + const std::vector& summaryCasesToUse, + RimSummaryCaseCollection* ensemble, + QStringList summaryAddressFilters, + bool addHistoryCurves, + EnsembleColoringType ensembleColoringStyle, + QString ensembleColoringParameter ) { RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle(); @@ -615,25 +572,10 @@ RimSummaryPlot* for ( const auto& addr : filteredAdressesFromCases ) { - RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet(); - curveSet->setSummaryCaseCollection( ensemble ); - curveSet->setSummaryAddress( addr ); - - if ( ensembleColoringStyle == EnsembleColoringType::PARAMETER || - ensembleColoringStyle == EnsembleColoringType::LOG_PARAMETER ) - { - curveSet->setColorMode( RimEnsembleCurveSet::ColorMode::BY_ENSEMBLE_PARAM ); - curveSet->setEnsembleParameter( ensembleColoringParameter ); - - if ( ensembleColoringStyle == EnsembleColoringType::LOG_PARAMETER ) - { - curveSet->legendConfig()->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_CONTINUOUS ); - } - } - + auto curveSet = createCurveSet( ensemble, addr, ensembleColoringStyle, ensembleColoringParameter ); newPlot->ensembleCurveSetCollection()->addCurveSet( curveSet ); - if ( addHistoryCurves ) + if ( addHistoryCurves && !summaryCasesToUse.empty() ) { RimSummaryCurve* historyCurve = createHistoryCurve( addr, summaryCasesToUse[0] ); @@ -641,18 +583,54 @@ RimSummaryPlot* } } } - else + newPlot->applyDefaultCurveAppearances(); + + return newPlot; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEnsembleCurveSet* RicSummaryPlotFeatureImpl::createCurveSet( RimSummaryCaseCollection* ensemble, + const RifEclipseSummaryAddress& addr, + EnsembleColoringType ensembleColoringStyle, + QString ensembleColoringParameter ) +{ + auto curveSet = new RimEnsembleCurveSet(); + + curveSet->setSummaryCaseCollection( ensemble ); + curveSet->setSummaryAddress( addr ); + + if ( ensembleColoringStyle == EnsembleColoringType::PARAMETER || + ensembleColoringStyle == EnsembleColoringType::LOG_PARAMETER ) { - for ( RimSummaryCase* sumCase : summaryCasesToUse ) + curveSet->setColorMode( RimEnsembleCurveSet::ColorMode::BY_ENSEMBLE_PARAM ); + curveSet->setEnsembleParameter( ensembleColoringParameter ); + + if ( ensembleColoringStyle == EnsembleColoringType::LOG_PARAMETER ) { - RicSummaryPlotFeatureImpl::addCurvesFromAddressFiltersToPlot( summaryAddressFilters, - newPlot, - sumCase, - addHistoryCurves ); - addHistoryCurves = false; + curveSet->legendConfig()->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_CONTINUOUS ); } } + return curveSet; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryPlot* RicSummaryPlotFeatureImpl::createSummaryPlotForCases( RimSummaryPlotCollection* sumPlotColl, + const std::vector& summaryCasesToUse, + QStringList summaryAddressFilters, + bool addHistoryCurves /*= false */ ) +{ + RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle(); + + for ( RimSummaryCase* sumCase : summaryCasesToUse ) + { + RicSummaryPlotFeatureImpl::addCurvesFromAddressFiltersToPlot( summaryAddressFilters, newPlot, sumCase, addHistoryCurves ); + } + newPlot->applyDefaultCurveAppearances(); return newPlot; @@ -681,20 +659,7 @@ std::vector RicSummaryPlotFeatureImpl::createMultipleSummaryPlo std::vector createdEnsembleCurveSets; if ( ensemble ) { - RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet(); - - curveSet->setSummaryCaseCollection( ensemble ); - curveSet->setSummaryAddress( addr ); - if ( ensembleColoringStyle == EnsembleColoringType::PARAMETER || - ensembleColoringStyle == EnsembleColoringType::LOG_PARAMETER ) - { - curveSet->setColorMode( RimEnsembleCurveSet::ColorMode::BY_ENSEMBLE_PARAM ); - curveSet->setEnsembleParameter( ensembleColoringParameter ); - if ( ensembleColoringStyle == EnsembleColoringType::LOG_PARAMETER ) - { - curveSet->legendConfig()->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_CONTINUOUS ); - } - } + auto curveSet = createCurveSet( ensemble, addr, ensembleColoringStyle, ensembleColoringParameter ); createdEnsembleCurveSets.push_back( curveSet ); } else @@ -704,9 +669,7 @@ std::vector RicSummaryPlotFeatureImpl::createMultipleSummaryPlo const std::set& allAddrsInCase = sumCase->summaryReader()->allResultAddresses(); if ( allAddrsInCase.count( addr ) ) { - RimSummaryCurve* newCurve = new RimSummaryCurve(); - newCurve->setSummaryCaseY( sumCase ); - newCurve->setSummaryAddressYAndApplyInterpolation( addr ); + auto* newCurve = createCurve( sumCase, addr ); createdCurves.push_back( newCurve ); } } @@ -742,24 +705,21 @@ std::vector RicSummaryPlotFeatureImpl::createMultipleSummaryPlo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicSummaryPlotFeatureImpl::splitAddressFiltersInGridAndSummary( RimSummaryCase* summaryBaseCases, - const QStringList& allCurveAddressFilters, +void RicSummaryPlotFeatureImpl::splitAddressFiltersInGridAndSummary( RimSummaryCase* summaryCase, + const QStringList& addressFilters, QStringList* summaryAddressFilters, QStringList* gridResultAddressFilters ) { - if ( summaryBaseCases ) + if ( summaryCase ) { - const std::set& addrs = summaryBaseCases->summaryReader()->allResultAddresses(); - std::vector usedFilters; - std::set setToInsertFilteredAddressesIn; - filteredSummaryAdressesFromCase( allCurveAddressFilters, addrs, &setToInsertFilteredAddressesIn, &usedFilters ); + const std::set& addrs = summaryCase->summaryReader()->allResultAddresses(); QRegularExpression gridAddressPattern( "^[A-Z]+:[0-9]+,[0-9]+,[0-9]+$" ); - for ( int filterIdx = 0; filterIdx < allCurveAddressFilters.size(); ++filterIdx ) + for ( int filterIdx = 0; filterIdx < addressFilters.size(); ++filterIdx ) { - const QString& address = allCurveAddressFilters[filterIdx]; - if ( usedFilters[filterIdx] ) + const QString& address = addressFilters[filterIdx]; + if ( hasFilterAnyMatch( address, addrs ) ) { summaryAddressFilters->push_back( address ); } @@ -791,7 +751,7 @@ std::set const std::set& addrs = sumCase->summaryReader()->allResultAddresses(); std::vector usedFilters; - filteredSummaryAdressesFromCase( summaryAddressFilters, addrs, &filteredAdressesFromCases, &usedFilters ); + insertFilteredAddressesInSet( summaryAddressFilters, addrs, &filteredAdressesFromCases, &usedFilters ); for ( size_t cfIdx = 0; cfIdx < usedFilters.size(); ++cfIdx ) { @@ -805,6 +765,33 @@ std::set return filteredAdressesFromCases; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSummaryPlotFeatureImpl::hasFilterAnyMatch( const QString& curveFilter, + const std::set& summaryAddresses ) +{ + for ( const auto& addr : summaryAddresses ) + { + if ( addr.isUiTextMatchingFilterText( curveFilter ) ) return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCurve* RicSummaryPlotFeatureImpl::createCurve( RimSummaryCase* summaryCase, + const RifEclipseSummaryAddress& address ) +{ + auto curve = new RimSummaryCurve(); + curve->setSummaryCaseY( summaryCase ); + curve->setSummaryAddressYAndApplyInterpolation( address ); + + return curve; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -823,7 +810,7 @@ std::vector RicSummaryPlotFeatureImpl::addCurvesFromAddressFil const std::set& addrs = summaryCase->summaryReader()->allResultAddresses(); std::vector usedFilters; - filteredSummaryAdressesFromCase( curveFilters, addrs, &curveAddressesToUse, &usedFilters ); + insertFilteredAddressesInSet( curveFilters, addrs, &curveAddressesToUse, &usedFilters ); for ( size_t cfIdx = 0; cfIdx < usedFilters.size(); ++cfIdx ) { @@ -857,14 +844,10 @@ std::vector RicSummaryPlotFeatureImpl::addCurvesFromAddressFil for ( const auto& addr : curveAddressesToUse ) { - RimSummaryCurve* newCurve = new RimSummaryCurve(); - plot->addCurveNoUpdate( newCurve ); - if ( summaryCase ) - { - newCurve->setSummaryCaseY( summaryCase ); - } - newCurve->setSummaryAddressYAndApplyInterpolation( addr ); + auto* newCurve = createCurve( summaryCase, addr ); + createdCurves.push_back( newCurve ); + plot->addCurveNoUpdate( newCurve ); } return createdCurves; @@ -873,11 +856,10 @@ std::vector RicSummaryPlotFeatureImpl::addCurvesFromAddressFil //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicSummaryPlotFeatureImpl::filteredSummaryAdressesFromCase( - const QStringList& curveFilters, - const std::set& allAddressesInCase, - std::set* setToInsertFilteredAddressesIn, - std::vector* usedFilters ) +void RicSummaryPlotFeatureImpl::insertFilteredAddressesInSet( const QStringList& curveFilters, + const std::set& allAddressesInCase, + std::set* setToInsertFilteredAddressesIn, + std::vector* usedFilters ) { int curveFilterCount = curveFilters.size(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h index aedd52e82f..c5f307787f 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h @@ -34,6 +34,7 @@ class RimSummaryPlot; class RimSummaryCase; class RimSummaryCaseCollection; class RimSummaryPlotCollection; +class RimEnsembleCurveSet; class QStringList; @@ -48,7 +49,6 @@ class RicSummaryPlotFeatureImpl NONE }; - static RimSummaryCurve* addDefaultCurveToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase ); static std::vector addDefaultCurvesToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase ); static void ensureAtLeastOnePlot( RimSummaryPlotCollection* summaryPlotCollection, RimSummaryCase* summaryCase ); static caf::PdmObject* createDefaultSummaryPlot( RimSummaryCase* summaryCase ); @@ -56,13 +56,18 @@ class RicSummaryPlotFeatureImpl static void createSummaryPlotsFromArgumentLine( const QStringList& arguments ); static RimSummaryPlot* - createSummaryPlotFromAddresses( RimSummaryPlotCollection* sumPlotColl, - const std::vector& summaryCasesToUse, - RimSummaryCaseCollection* ensemble, - QStringList summaryAddressFilters, - bool addHistoryCurves = false, - EnsembleColoringType ensembleColoringStyle = EnsembleColoringType::NONE, - QString ensembleColoringParameter = "" ); + createSummaryPlotForEnsemble( RimSummaryPlotCollection* sumPlotColl, + const std::vector& summaryCasesToUse, + RimSummaryCaseCollection* ensemble, + QStringList summaryAddressFilters, + bool addHistoryCurves = false, + EnsembleColoringType ensembleColoringStyle = EnsembleColoringType::NONE, + QString ensembleColoringParameter = "" ); + + static RimSummaryPlot* createSummaryPlotForCases( RimSummaryPlotCollection* sumPlotColl, + const std::vector& summaryCasesToUse, + QStringList summaryAddressFilters, + bool addHistoryCurves = false ); static std::vector createMultipleSummaryPlotsFromAddresses( RimSummaryPlotCollection* sumPlotColl, @@ -73,14 +78,25 @@ class RicSummaryPlotFeatureImpl EnsembleColoringType ensembleColoringStyle = EnsembleColoringType::NONE, QString ensembleColoringParameter = "" ); - static void filteredSummaryAdressesFromCase( const QStringList& curveFilters, - const std::set& allAddressesInCase, - std::set* setToInsertFilteredAddressesIn, - std::vector* usedFilters ); + static void insertFilteredAddressesInSet( const QStringList& curveFilters, + const std::set& allAddressesInCase, + std::set* setToInsertFilteredAddressesIn, + std::vector* usedFilters ); static QString summaryPlotCommandLineHelpText(); private: + static RimEnsembleCurveSet* createCurveSet( RimSummaryCaseCollection* ensemble, + const RifEclipseSummaryAddress& addr, + EnsembleColoringType ensembleColoringStyle, + QString ensembleColoringParameter ); + + static RimSummaryCurve* createCurve( RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& address ); + + static bool hasFilterAnyMatch( const QString& curveFilter, const std::set& summaryAddresses ); + + static RimSummaryCurve* createHistoryCurve( const RifEclipseSummaryAddress& addr, RimSummaryCase* summaryCasesToUse ); + static std::vector addCurvesFromAddressFiltersToPlot( const QStringList& curveFilters, RimSummaryPlot* plot, RimSummaryCase* summaryCase, @@ -90,8 +106,8 @@ class RicSummaryPlotFeatureImpl applySummaryAddressFiltersToCases( const std::vector& summaryCasesToUse, const QStringList& summaryAddressFilters ); - static void splitAddressFiltersInGridAndSummary( RimSummaryCase* summaryBaseCases, - const QStringList& allCurveAddressFilters, + static void splitAddressFiltersInGridAndSummary( RimSummaryCase* summaryCase, + const QStringList& addressFilters, QStringList* summaryAddressFilters, QStringList* gridResultAddressFilters ); }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp index 64c89fae9a..022944f91b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp @@ -20,9 +20,11 @@ #include "RiaGuiApplication.h" #include "RiaLogging.h" +#include "RiaStdStringTools.h" #include "RiaStringListSerializer.h" #include "RiaSummaryCurveDefinition.h" +#include "RifReaderEclipseSummary.h" #include "RifSummaryReaderInterface.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" @@ -185,10 +187,10 @@ void RimSummaryPlotFilterTextCurveSetEditor::updateTextFilter() std::vector usedFilters; std::set filteredAddressesFromSource; - RicSummaryPlotFeatureImpl::filteredSummaryAdressesFromCase( allCurveAddressFilters, - addressesInUse, - &filteredAddressesFromSource, - &usedFilters ); + RicSummaryPlotFeatureImpl::insertFilteredAddressesInSet( allCurveAddressFilters, + addressesInUse, + &filteredAddressesFromSource, + &usedFilters ); if ( filteredAddressesFromSource != addressesInUse ) { @@ -209,6 +211,220 @@ void RimSummaryPlotFilterTextCurveSetEditor::updateTextFilter() void RimSummaryPlotFilterTextCurveSetEditor::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) +{ + updateParentPlot(); + + if ( changedField == &m_curveFilterText ) + { + m_curveFilterText = curveFilterTextWithoutOutdatedLabel(); + + { + RiaStringListSerializer stringListSerializer( curveFilterRecentlyUsedRegistryKey() ); + + int maxItemCount = 10; + stringListSerializer.addString( m_curveFilterText, maxItemCount ); + } + + m_curveFilterText.uiCapability()->updateConnectedEditors(); + } + + m_isFieldRecentlyChangedFromGui = true; + + if ( RiaGuiApplication::isRunning() ) + { + RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); + if ( mainPlotWindow ) + { + mainPlotWindow->updateSummaryPlotToolBar(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotFilterTextCurveSetEditor::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + uiOrdering.add( &m_curveFilterText ); + uiOrdering.add( &m_selectedSources ); + uiOrdering.skipRemainingFields(); + + if ( !m_isFieldRecentlyChangedFromGui ) + { + updateTextFilter(); + } + + m_isFieldRecentlyChangedFromGui = false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotFilterTextCurveSetEditor::setupBeforeSave() +{ + m_curveFilterText = curveFilterTextWithoutOutdatedLabel(); + + // If a source case has been deleted, make sure null pointers are removed + m_selectedSources.removePtr( nullptr ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotFilterTextCurveSetEditor::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + if ( field == &m_curveFilterText ) + { + auto attr = dynamic_cast( attribute ); + if ( attr ) + { + attr->enableEditableContent = true; + attr->adjustWidthToContents = true; + attr->placeholderText = "Click to edit curves"; + + if ( uiConfigName == caf::PdmUiToolBarEditor::uiEditorConfigName() ) + { + attr->minimumWidth = 140; + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList + RimSummaryPlotFilterTextCurveSetEditor::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) +{ + QList options; + if ( fieldNeedingOptions == &m_selectedSources ) + { + appendOptionItemsForSources( options ); + } + + if ( fieldNeedingOptions == &m_curveFilterText ) + { + RiaStringListSerializer stringListSerializer( curveFilterRecentlyUsedRegistryKey() ); + + for ( const auto& s : stringListSerializer.textStrings() ) + { + options.push_back( caf::PdmOptionItemInfo( s, s ) ); + } + } + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotFilterTextCurveSetEditor::appendOptionItemsForSources( QList& options ) +{ + RimProject* proj = RimProject::current(); + + std::vector oilFields; + + proj->allOilFields( oilFields ); + for ( RimOilField* oilField : oilFields ) + { + RimSummaryCaseMainCollection* sumCaseMainColl = oilField->summaryCaseMainCollection(); + if ( sumCaseMainColl ) + { + // Top level cases + for ( const auto& sumCase : sumCaseMainColl->topLevelSummaryCases() ) + { + options.push_back( caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ) ); + } + + // Ensembles + bool ensembleHeaderCreated = false; + for ( const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections() ) + { + if ( !sumCaseColl->isEnsemble() ) continue; + + if ( !ensembleHeaderCreated ) + { + options.push_back( caf::PdmOptionItemInfo::createHeader( "Ensembles", true ) ); + ensembleHeaderCreated = true; + } + + auto optionItem = caf::PdmOptionItemInfo( sumCaseColl->name(), sumCaseColl ); + optionItem.setLevel( 1 ); + options.push_back( optionItem ); + } + + // Grouped cases + for ( const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections() ) + { + if ( sumCaseColl->isEnsemble() ) continue; + + options.push_back( caf::PdmOptionItemInfo::createHeader( sumCaseColl->name(), true ) ); + + for ( const auto& sumCase : sumCaseColl->allSummaryCases() ) + { + auto optionItem = caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ); + optionItem.setLevel( 1 ); + options.push_back( optionItem ); + } + } + + // Observed data + auto observedDataColl = oilField->observedDataCollection(); + if ( observedDataColl->allObservedSummaryData().size() > 0 ) + { + options.push_back( caf::PdmOptionItemInfo::createHeader( "Observed Data", true ) ); + + for ( const auto& obsData : observedDataColl->allObservedSummaryData() ) + { + auto optionItem = caf::PdmOptionItemInfo( obsData->caseName(), obsData ); + optionItem.setLevel( 1 ); + options.push_back( optionItem ); + } + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryPlotFilterTextCurveSetEditor::selectedSummarySources() const +{ + std::vector sources; + + for ( const auto& source : m_selectedSources ) + { + sources.push_back( source ); + } + + // Always add the summary case for calculated curves as this case is not displayed in UI + sources.push_back( RimProject::current()->calculationCollection()->calculationSummaryCase() ); + + return sources; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryPlotFilterTextCurveSetEditor::curveFilterTextWithoutOutdatedLabel() const +{ + QString filterText = m_curveFilterText(); + + if ( filterText.startsWith( FILTER_TEXT_OUTDATED_TEXT ) ) + { + return filterText.right( filterText.length() - QString( FILTER_TEXT_OUTDATED_TEXT ).length() ); + } + + return filterText; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotFilterTextCurveSetEditor::updateParentPlot() { RimSummaryPlot* parentPlot; this->firstAncestorOrThisOfType( parentPlot ); @@ -229,38 +445,23 @@ void RimSummaryPlotFilterTextCurveSetEditor::fieldChangedByUi( const caf::PdmFie for ( SummarySource* currSource : selectedSummarySources() ) { - RimSummaryCaseCollection* ensemble = dynamic_cast( currSource ); - RimSummaryCase* sumCase = dynamic_cast( currSource ); - - std::set allAddressesFromSource; - - if ( ensemble ) - { - auto addresses = ensemble->ensembleSummaryAddresses(); - allAddressesFromSource.insert( addresses.begin(), addresses.end() ); - } - else if ( sumCase ) - { - RifSummaryReaderInterface* reader = sumCase ? sumCase->summaryReader() : nullptr; - if ( reader ) - { - allAddressesFromSource.insert( reader->allResultAddresses().begin(), - reader->allResultAddresses().end() ); - } - } + std::set allAddressesFromSource = addressesForSource( currSource ); std::vector usedFilters; std::set filteredAddressesFromSource; - RicSummaryPlotFeatureImpl::filteredSummaryAdressesFromCase( allCurveAddressFilters, - allAddressesFromSource, - &filteredAddressesFromSource, - &usedFilters ); + insertFilteredAddressesInSet( allCurveAddressFilters, + allAddressesFromSource, + &filteredAddressesFromSource, + &usedFilters ); for ( size_t fIdx = 0; fIdx < accumulatedUsedFilters.size(); ++fIdx ) { accumulatedUsedFilters[fIdx] = accumulatedUsedFilters[fIdx] || usedFilters[fIdx]; } + auto sumCase = dynamic_cast( currSource ); + auto ensemble = dynamic_cast( currSource ); + for ( const auto& filteredAddress : filteredAddressesFromSource ) { if ( sumCase ) @@ -386,223 +587,62 @@ void RimSummaryPlotFilterTextCurveSetEditor::fieldChangedByUi( const caf::PdmFie parentPlot->updateConnectedEditors(); } - - if ( changedField == &m_curveFilterText ) - { - m_curveFilterText = curveFilterTextWithoutOutdatedLabel(); - - { - RiaStringListSerializer stringListSerializer( curveFilterRecentlyUsedRegistryKey() ); - - int maxItemCount = 10; - stringListSerializer.addString( m_curveFilterText, maxItemCount ); - } - - m_curveFilterText.uiCapability()->updateConnectedEditors(); - } - - m_isFieldRecentlyChangedFromGui = true; - - if ( RiaGuiApplication::isRunning() ) - { - RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - if ( mainPlotWindow ) - { - mainPlotWindow->updateSummaryPlotToolBar(); - } - } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlotFilterTextCurveSetEditor::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +std::set RimSummaryPlotFilterTextCurveSetEditor::addressesForSource( SummarySource* summarySource ) { - uiOrdering.add( &m_curveFilterText ); - uiOrdering.add( &m_selectedSources ); - uiOrdering.skipRemainingFields(); - - if ( !m_isFieldRecentlyChangedFromGui ) + auto* ensemble = dynamic_cast( summarySource ); + if ( ensemble ) { - updateTextFilter(); + return ensemble->ensembleSummaryAddresses(); } - m_isFieldRecentlyChangedFromGui = false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryPlotFilterTextCurveSetEditor::setupBeforeSave() -{ - m_curveFilterText = curveFilterTextWithoutOutdatedLabel(); + auto* sumCase = dynamic_cast( summarySource ); - // If a source case has been deleted, make sure null pointers are removed - m_selectedSources.removePtr( nullptr ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryPlotFilterTextCurveSetEditor::defineEditorAttribute( const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute ) -{ - if ( field == &m_curveFilterText ) + if ( sumCase ) { - auto attr = dynamic_cast( attribute ); - if ( attr ) + RifSummaryReaderInterface* reader = sumCase ? sumCase->summaryReader() : nullptr; + if ( reader ) { - attr->enableEditableContent = true; - attr->adjustWidthToContents = true; - attr->placeholderText = "Click to edit curves"; - - if ( uiConfigName == caf::PdmUiToolBarEditor::uiEditorConfigName() ) - { - attr->minimumWidth = 140; - } + return reader->allResultAddresses(); } } -} -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QList - RimSummaryPlotFilterTextCurveSetEditor::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) -{ - QList options; - if ( fieldNeedingOptions == &m_selectedSources ) - { - appendOptionItemsForSources( options, false, false ); - } - - if ( fieldNeedingOptions == &m_curveFilterText ) - { - RiaStringListSerializer stringListSerializer( curveFilterRecentlyUsedRegistryKey() ); - - for ( const auto& s : stringListSerializer.textStrings() ) - { - options.push_back( caf::PdmOptionItemInfo( s, s ) ); - } - } - - return options; + return {}; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlotFilterTextCurveSetEditor::appendOptionItemsForSources( QList& options, - bool hideSummaryCases, - bool hideEnsembles ) +void RimSummaryPlotFilterTextCurveSetEditor::insertFilteredAddressesInSet( + const QStringList& curveFilters, + const std::set& allAddressesInCase, + std::set* setToInsertFilteredAddressesIn, + std::vector* usedFilters ) { - RimProject* proj = RimProject::current(); - - std::vector oilFields; + std::set candidateAddresses; + RicSummaryPlotFeatureImpl::insertFilteredAddressesInSet( curveFilters, allAddressesInCase, &candidateAddresses, usedFilters ); - proj->allOilFields( oilFields ); - for ( RimOilField* oilField : oilFields ) + if ( !m_includeDiffCurves ) { - RimSummaryCaseMainCollection* sumCaseMainColl = oilField->summaryCaseMainCollection(); - if ( sumCaseMainColl ) - { - if ( !hideSummaryCases ) - { - // Top level cases - for ( const auto& sumCase : sumCaseMainColl->topLevelSummaryCases() ) - { - options.push_back( caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ) ); - } - } - - // Ensembles - if ( !hideEnsembles ) - { - bool ensembleHeaderCreated = false; - for ( const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections() ) - { - if ( !sumCaseColl->isEnsemble() ) continue; + std::set tmp; - if ( !ensembleHeaderCreated ) - { - options.push_back( caf::PdmOptionItemInfo::createHeader( "Ensembles", true ) ); - ensembleHeaderCreated = true; - } + const auto diffText = RifReaderEclipseSummary::differenceIdentifier(); - auto optionItem = caf::PdmOptionItemInfo( sumCaseColl->name(), sumCaseColl ); - optionItem.setLevel( 1 ); - options.push_back( optionItem ); - } - } - - if ( !hideSummaryCases ) - { - // Grouped cases - for ( const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections() ) - { - if ( sumCaseColl->isEnsemble() ) continue; - - options.push_back( caf::PdmOptionItemInfo::createHeader( sumCaseColl->name(), true ) ); - - for ( const auto& sumCase : sumCaseColl->allSummaryCases() ) - { - auto optionItem = caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ); - optionItem.setLevel( 1 ); - options.push_back( optionItem ); - } - } - - // Observed data - auto observedDataColl = oilField->observedDataCollection(); - if ( observedDataColl->allObservedSummaryData().size() > 0 ) - { - options.push_back( caf::PdmOptionItemInfo::createHeader( "Observed Data", true ) ); + for ( const auto& adr : candidateAddresses ) + { + if ( RiaStdStringTools::endsWith( adr.quantityName(), diffText ) ) continue; - for ( const auto& obsData : observedDataColl->allObservedSummaryData() ) - { - auto optionItem = caf::PdmOptionItemInfo( obsData->caseName(), obsData ); - optionItem.setLevel( 1 ); - options.push_back( optionItem ); - } - } - } + tmp.insert( adr ); } - } -} -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimSummaryPlotFilterTextCurveSetEditor::selectedSummarySources() const -{ - std::vector sources; - - for ( const auto& source : m_selectedSources ) - { - sources.push_back( source ); + std::swap( tmp, candidateAddresses ); } - // Always add the summary case for calculated curves as this case is not displayed in UI - sources.push_back( RimProject::current()->calculationCollection()->calculationSummaryCase() ); - - return sources; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryPlotFilterTextCurveSetEditor::curveFilterTextWithoutOutdatedLabel() const -{ - QString filterText = m_curveFilterText(); - - if ( filterText.startsWith( FILTER_TEXT_OUTDATED_TEXT ) ) - { - return filterText.right( filterText.length() - QString( FILTER_TEXT_OUTDATED_TEXT ).length() ); - } - - return filterText; + setToInsertFilteredAddressesIn->insert( candidateAddresses.begin(), candidateAddresses.end() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.h index 794e5d2d2d..5835f6cacf 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.h @@ -21,6 +21,7 @@ #include "cafPdmPtrArrayField.h" using SummarySource = caf::PdmObject; +class RifEclipseSummaryAddress; class RimSummaryPlotFilterTextCurveSetEditor : public caf::PdmObject { @@ -47,12 +48,20 @@ class RimSummaryPlotFilterTextCurveSetEditor : public caf::PdmObject caf::PdmUiEditorAttribute* attribute ) override; private: - static void - appendOptionItemsForSources( QList& options, bool hideSummaryCases, bool hideEnsembles ); + static void appendOptionItemsForSources( QList& options ); std::vector selectedSummarySources() const; QString curveFilterTextWithoutOutdatedLabel() const; + void updateParentPlot(); + + static std::set addressesForSource( SummarySource* summarySource ); + + void insertFilteredAddressesInSet( const QStringList& curveFilters, + const std::set& allAddressesInCase, + std::set* setToInsertFilteredAddressesIn, + std::vector* usedFilters ); + static QString curveFilterRecentlyUsedRegistryKey(); private: @@ -60,6 +69,7 @@ class RimSummaryPlotFilterTextCurveSetEditor : public caf::PdmObject caf::PdmField m_curveFilterLabelText; caf::PdmField m_curveFilterText; + caf::PdmField m_includeDiffCurves; bool m_isFieldRecentlyChangedFromGui; }; diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp index 8caa9c5f3c..a42e0a7fca 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp @@ -63,10 +63,10 @@ caf::PdmObjectHandle* RimcSummaryPlotCollection_newSummaryPlot::execute() { if ( !addressStrings.empty() ) { - newPlot = RicSummaryPlotFeatureImpl::createSummaryPlotFromAddresses( self(), - std::vector(), - m_ensemble, - addressStrings ); + newPlot = RicSummaryPlotFeatureImpl::createSummaryPlotForEnsemble( self(), + std::vector(), + m_ensemble, + addressStrings ); } else { @@ -78,10 +78,9 @@ caf::PdmObjectHandle* RimcSummaryPlotCollection_newSummaryPlot::execute() std::vector summaryCases = m_summaryCases.ptrReferencedObjects(); if ( !addressStrings.empty() ) { - newPlot = RicSummaryPlotFeatureImpl::createSummaryPlotFromAddresses( self(), - summaryCases, - nullptr, - addressStrings ); + newPlot = RicSummaryPlotFeatureImpl::createSummaryPlotForCases( self(), + summaryCases, + addressStrings ); } else { From 7b1c780a77e56db8664428e005b8ca171f087bf3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 16 Nov 2021 09:32:53 +0100 Subject: [PATCH 011/406] AppFwk : Do not use deprecated feature in Qt 5.15 --- Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp index 3206094a52..9953ce71d8 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp @@ -254,7 +254,7 @@ void PdmUiComboBoxEditor::configureAndUpdateUi( const QString& uiConfigName ) } else if ( m_attributes.minimumContentsLength > 0 ) { - m_comboBox->setSizeAdjustPolicy( QComboBox::AdjustToMinimumContentsLength ); + m_comboBox->setSizeAdjustPolicy( QComboBox::AdjustToContents ); m_comboBox->setMinimumContentsLength( m_attributes.minimumContentsLength ); // Make sure the popup adjusts to the content even if the widget itself doesn't QFont font = m_comboBox->view()->font(); @@ -359,7 +359,7 @@ void PdmUiComboBoxEditor::configureAndUpdateUi( const QString& uiConfigName ) } else { - toolButtonIcon = stepUpIcon(); + toolButtonIcon = stepDownIcon(); } if ( m_comboBox->count() == 0 || m_comboBox->currentIndex() >= m_comboBox->count() - 1 ) { From 640b7406ece21c2eee5ee3229070ee6bad09c288 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 17 Nov 2021 09:58:10 +0100 Subject: [PATCH 012/406] #8292 Add docking widget used to manage summary plots --- .../Summary/CMakeLists_files.cmake | 6 +- .../Summary/RimSummaryPlotManager.cpp | 474 ++++++++++++++++++ .../Summary/RimSummaryPlotManager.h | 100 ++++ .../UserInterface/RiuDockWidgetTools.cpp | 8 + .../UserInterface/RiuDockWidgetTools.h | 1 + .../UserInterface/RiuPlotMainWindow.cpp | 18 + .../UserInterface/RiuPlotMainWindow.h | 2 + 7 files changed, 608 insertions(+), 1 deletion(-) create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h diff --git a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake index a3d2865cd9..a3b076b15f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -38,6 +38,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotFilterTextCurveSetEditor.h ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunction.h ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunctionTools.h + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotManager.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -80,13 +81,16 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotFilterTextCurveSetEditor.cpp ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunction.cpp ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunctionTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotManager.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES}) -list(APPEND QT_MOC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlot.h) +list(APPEND QT_MOC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlot.h + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotManager.h +) source_group( "ProjectDataModel\\Summary" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp new file mode 100644 index 0000000000..c71f5d4bb4 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -0,0 +1,474 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimSummaryPlotManager.h" + +#include "RiaStdStringTools.h" +#include "RiaSummaryTools.h" + +#include "RifReaderEclipseSummary.h" +#include "RifSummaryReaderInterface.h" + +#include "RimEnsembleCurveSet.h" +#include "RimEnsembleCurveSetCollection.h" +#include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" +#include "RimSummaryCaseMainCollection.h" +#include "RimSummaryCurve.h" +#include "RimSummaryPlot.h" +#include "RimSummaryPlotCollection.h" + +#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" + +#include "cafPdmObjectHandle.h" +#include "cafPdmUiCheckBoxEditor.h" +#include "cafPdmUiLabelEditor.h" +#include "cafPdmUiPushButtonEditor.h" +#include "cafSelectionManager.h" + +#include + +CAF_PDM_SOURCE_INIT( RimSummaryPlotManager, "RimSummaryPlotManager" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryPlotManager::RimSummaryPlotManager() +{ + CAF_PDM_InitObject( "Summary Plot Manager" ); + + CAF_PDM_InitFieldNoDefault( &m_summaryPlot, "SummaryPlot", "Summary Plot" ); + CAF_PDM_InitFieldNoDefault( &m_curveFilterText, "CurveFilterText", "Curve Filter Text" ); + CAF_PDM_InitFieldNoDefault( &m_curveCandidates, "CurveCandidates", "Candidates" ); + + CAF_PDM_InitField( &m_includeDiffCurves, + "IncludeDiffCurves", + true, + "Include Difference Curves", + "", + "Difference between simulated and observed(history) curve", + "" ); + m_includeDiffCurves.uiCapability()->setUiEditorTypeName( caf::PdmUiNativeCheckBoxEditor::uiEditorTypeName() ); + + CAF_PDM_InitFieldNoDefault( &m_pushButtonReplace, "PushButtonReplace", "Replace (CTRL + Enter)" ); + m_pushButtonReplace.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + m_pushButtonReplace.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); + + CAF_PDM_InitFieldNoDefault( &m_pushButtonNewPlot, "PushButtonNewPlot", "New (Alt + Enter)" ); + m_pushButtonNewPlot.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + m_pushButtonNewPlot.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); + + CAF_PDM_InitFieldNoDefault( &m_pushButtonAppend, "PushButtonAppend", "Append (Shift + Enter)" ); + m_pushButtonAppend.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + m_pushButtonAppend.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); + + CAF_PDM_InitFieldNoDefault( &m_labelA, "LabelA", "" ); + m_labelA.uiCapability()->setUiEditorTypeName( caf::PdmUiLabelEditor::uiEditorTypeName() ); + m_labelA.xmlCapability()->disableIO(); + m_labelA.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); + + CAF_PDM_InitFieldNoDefault( &m_labelB, "LabelB", "" ); + m_labelB.uiCapability()->setUiEditorTypeName( caf::PdmUiLabelEditor::uiEditorTypeName() ); + m_labelB.xmlCapability()->disableIO(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::onSelectionManagerSelectionChanged( const std::set& changedSelectionLevels ) +{ + updateUiFromSelection(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) +{ + if ( changedField == &m_curveFilterText || changedField == &m_includeDiffCurves ) + { + updateCurveCandidates(); + } + else if ( changedField == &m_pushButtonReplace ) + { + replaceCurves(); + m_pushButtonReplace = false; + } + else if ( changedField == &m_pushButtonNewPlot ) + { + createNewPlot(); + m_pushButtonNewPlot = false; + } + else if ( changedField == &m_pushButtonAppend ) + { + appendCurves(); + m_pushButtonAppend = false; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList + RimSummaryPlotManager::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +{ + QList options; + if ( fieldNeedingOptions == &m_summaryPlot ) + { + auto coll = RiaSummaryTools::summaryPlotCollection(); + coll->summaryPlotItemInfos( &options ); + } + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::updateCurveCandidates() +{ + m_curveCandidates.value().clear(); + + if ( !m_summaryPlot ) return; + + auto curves = m_summaryPlot->summaryAndEnsembleCurves(); + if ( curves.empty() ) return; + + auto firstSource = curves.front()->summaryCaseY(); + if ( !firstSource ) return; + + std::set addressesFromSources = addressesForSource( firstSource ); + QStringList addressFilters = m_curveFilterText().split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); + + auto addresses = computeFilteredAddresses( addressFilters, addressesFromSources ); + + std::vector curveCandidates; + for ( const auto& adr : addresses ) + { + curveCandidates.push_back( QString::fromStdString( adr.uiText() ) ); + } + + m_curveCandidates = curveCandidates; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set + RimSummaryPlotManager::computeFilteredAddresses( const QStringList& textFilters, + const std::set& sourceAddresses ) +{ + std::set addresses; + + std::vector usedFilters; + RicSummaryPlotFeatureImpl::insertFilteredAddressesInSet( textFilters, sourceAddresses, &addresses, &usedFilters ); + + if ( m_includeDiffCurves ) return addresses; + + const auto diffText = RifReaderEclipseSummary::differenceIdentifier(); + + std::set addressesWithoutDiffVectors; + for ( const auto& adr : addresses ) + { + if ( RiaStdStringTools::endsWith( adr.quantityName(), diffText ) ) continue; + + addressesWithoutDiffVectors.insert( adr ); + } + + return addressesWithoutDiffVectors; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + { + auto myAttr = dynamic_cast( attribute ); + if ( myAttr ) + { + if ( field == &m_pushButtonReplace ) + { + myAttr->m_buttonText = "Replace Curves \n(Ctrl + Enter)"; + } + if ( field == &m_pushButtonNewPlot ) + { + myAttr->m_buttonText = "Create New Plot \n(Alt + Enter)"; + } + if ( field == &m_pushButtonAppend ) + { + myAttr->m_buttonText = "Append Curves \n(Shift + Enter)"; + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + uiOrdering.add( &m_summaryPlot ); + + // uiOrdering.add( &m_labelA ); + uiOrdering.add( &m_includeDiffCurves ); + + uiOrdering.add( &m_curveFilterText ); + uiOrdering.add( &m_curveCandidates ); + + uiOrdering.add( &m_labelB ); + uiOrdering.add( &m_pushButtonAppend, { false } ); + uiOrdering.add( &m_pushButtonReplace, { false } ); + uiOrdering.add( &m_pushButtonNewPlot, { false } ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::appendCurves() +{ + RimSummaryPlot* destinationPlot = m_summaryPlot; + + appendCurvesToPlot( destinationPlot ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::replaceCurves() +{ + RimSummaryPlot* destinationPlot = m_summaryPlot; + destinationPlot->deleteAllSummaryCurves(); + destinationPlot->ensembleCurveSetCollection()->deleteAllCurveSets(); + + appendCurvesToPlot( destinationPlot ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::createNewPlot() +{ + RimSummaryPlot* destinationPlot = RiaSummaryTools::summaryPlotCollection()->createSummaryPlotWithAutoTitle(); + + appendCurvesToPlot( destinationPlot ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryPlotManager::eventFilter( QObject* obj, QEvent* event ) +{ + if ( event->type() == QEvent::KeyPress ) + { + QKeyEvent* keyEvent = static_cast( event ); + + if ( keyEvent && ( keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return ) ) + { + auto mods = keyEvent->modifiers(); + + if ( mods & Qt::ShiftModifier ) + appendCurves(); + else if ( mods & Qt::ControlModifier ) + replaceCurves(); + else if ( mods & Qt::AltModifier ) + createNewPlot(); + } + } + + return QObject::eventFilter( obj, event ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair, std::vector> RimSummaryPlotManager::dataSources() const +{ + auto sumCaseMainColl = RiaSummaryTools::summaryCaseMainCollection(); + + auto summaryCases = sumCaseMainColl->topLevelSummaryCases(); + auto ensembles = sumCaseMainColl->summaryCaseCollections(); + + return { summaryCases, ensembles }; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::updateUiFromSelection() +{ + auto destinationObject = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + + RimSummaryPlot* summaryPlot = nullptr; + if ( destinationObject ) destinationObject->firstAncestorOrThisOfType( summaryPlot ); + + if ( m_summaryPlot != summaryPlot ) + { + m_summaryPlot = summaryPlot; + updateConnectedEditors(); + updateCurveCandidates(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RimSummaryPlotManager::filteredAddresses() +{ + auto [summaryCases, ensembles] = dataSources(); + + std::set allAddressesFromSource; + + if ( !summaryCases.empty() ) + { + allAddressesFromSource = addressesForSource( summaryCases.front() ); + } + else if ( !ensembles.empty() ) + { + allAddressesFromSource = addressesForSource( ensembles.front() ); + } + + if ( allAddressesFromSource.empty() ) return {}; + + QStringList allCurveAddressFilters = m_curveFilterText().split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); + + return computeFilteredAddresses( allCurveAddressFilters, allAddressesFromSource ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RimSummaryPlotManager::addressesForSource( caf::PdmObject* summarySource ) +{ + auto ensemble = dynamic_cast( summarySource ); + if ( ensemble ) + { + return ensemble->ensembleSummaryAddresses(); + } + + auto sumCase = dynamic_cast( summarySource ); + if ( sumCase ) + { + auto reader = sumCase ? sumCase->summaryReader() : nullptr; + if ( reader ) + { + return reader->allResultAddresses(); + } + } + + return {}; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEnsembleCurveSet* RimSummaryPlotManager::createCurveSet( RimSummaryCaseCollection* ensemble, + const RifEclipseSummaryAddress& addr ) +{ + auto curveSet = new RimEnsembleCurveSet(); + + curveSet->setSummaryCaseCollection( ensemble ); + curveSet->setSummaryAddress( addr ); + + return curveSet; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCurve* RimSummaryPlotManager::createCurve( RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& addr ) +{ + auto curve = new RimSummaryCurve(); + + curve->setSummaryCaseY( summaryCase ); + curve->setSummaryAddressY( addr ); + + return curve; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::appendCurvesToPlot( RimSummaryPlot* summaryPlot, + const std::set& addresses, + const std::vector& summaryCases, + const std::vector& ensembles ) +{ + for ( const auto& addr : addresses ) + { + for ( const auto ensemble : ensembles ) + { + auto curveSet = createCurveSet( ensemble, addr ); + summaryPlot->ensembleCurveSetCollection()->addCurveSet( curveSet ); + } + + for ( const auto summaryCase : summaryCases ) + { + auto curve = createCurve( summaryCase, addr ); + + summaryPlot->addCurveNoUpdate( curve ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::appendCurvesToPlot( RimSummaryPlot* destinationPlot ) +{ + CAF_ASSERT( destinationPlot ); + + auto [summaryCases, ensembles] = dataSources(); + + std::set filteredAddressesFromSource = filteredAddresses(); + appendCurvesToPlot( destinationPlot, filteredAddressesFromSource, summaryCases, ensembles ); + + destinationPlot->applyDefaultCurveAppearances(); + destinationPlot->loadDataAndUpdate(); + + RiaSummaryTools::summaryPlotCollection()->updateConnectedEditors(); + + setFocusToEditorWidget( m_curveFilterText.uiCapability() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::setFocusToEditorWidget( caf::PdmUiFieldHandle* uiFieldHandle ) +{ + CAF_ASSERT( uiFieldHandle ); + + auto editors = uiFieldHandle->connectedEditors(); + if ( !editors.empty() ) + { + auto fieldEditorHandle = dynamic_cast( editors.front() ); + if ( fieldEditorHandle && fieldEditorHandle->editorWidget() ) + { + auto widget = fieldEditorHandle->editorWidget(); + + // If the dock widget is floating, activateWindow() must be called to make sure the top level widget has + // focus before the editor widget is given focus + widget->activateWindow(); + widget->setFocus(); + } + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h new file mode 100644 index 0000000000..cbf21c6add --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h @@ -0,0 +1,100 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPtrField.h" +#include "cafSelectionChangedReceiver.h" + +class RifEclipseSummaryAddress; +class RimSummaryPlot; +class RimSummaryCase; +class RimSummaryCaseCollection; +class RimEnsembleCurveSet; +class RimSummaryCurve; + +class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf::SelectionChangedReceiver + +{ + Q_OBJECT; + CAF_PDM_HEADER_INIT; + +public: + RimSummaryPlotManager(); + +private: + void appendCurves(); + void replaceCurves(); + void createNewPlot(); + + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) override; + + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; + + void onSelectionManagerSelectionChanged( const std::set& changedSelectionLevels ) override; + + // Override eventFilter to be able to track key events from QDockWidget + bool eventFilter( QObject* obj, QEvent* event ) override; + + void updateCurveCandidates(); + + std::set computeFilteredAddresses( const QStringList& textFilters, + const std::set& sourceAddresses ); + + std::pair, std::vector> dataSources() const; + + void updateUiFromSelection(); + std::set filteredAddresses(); + void appendCurvesToPlot( RimSummaryPlot* destinationPlot ); + + // Static helper functions + static std::set addressesForSource( caf::PdmObject* summarySource ); + + static RimEnsembleCurveSet* createCurveSet( RimSummaryCaseCollection* ensemble, const RifEclipseSummaryAddress& addr ); + static RimSummaryCurve* createCurve( RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& addr ); + + static void appendCurvesToPlot( RimSummaryPlot* summaryPlot, + const std::set& addresses, + const std::vector& summaryCases, + const std::vector& ensembles ); + + static void setFocusToEditorWidget( caf::PdmUiFieldHandle* uiFieldHandle ); + +private: + caf::PdmPtrField m_summaryPlot; + + caf::PdmField m_curveFilterText; + caf::PdmField> m_curveCandidates; + + caf::PdmField m_includeDiffCurves; + + caf::PdmField m_pushButtonReplace; + caf::PdmField m_pushButtonNewPlot; + caf::PdmField m_pushButtonAppend; + + caf::PdmField m_labelA; + caf::PdmField m_labelB; +}; diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index cdc88c47c6..fff0b9649c 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -100,6 +100,14 @@ QString RiuDockWidgetTools::undoStackName() return "dockUndoStack"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::summaryCurveManagerName() +{ + return "dockSummaryCurveManager"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index 61fd0d8da5..1a87b80aeb 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -46,6 +46,7 @@ class RiuDockWidgetTools static QString messagesName(); static QString mohrsCirclePlotName(); static QString undoStackName(); + static QString summaryCurveManagerName(); static QString plotMainWindowProjectTreeName(); static QString plotMainWindowPropertyEditorName(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index b489e32637..1102d4fc3d 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -34,6 +34,7 @@ #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" #include "RimSummaryPlotFilterTextCurveSetEditor.h" +#include "RimSummaryPlotManager.h" #include "RimViewWindow.h" #include "RimWellAllocationPlot.h" #include "RimWellLogCurveCommonDataSource.h" @@ -105,6 +106,7 @@ RiuPlotMainWindow::RiuPlotMainWindow() //-------------------------------------------------------------------------------------------------- RiuPlotMainWindow::~RiuPlotMainWindow() { + m_summaryCurveManagerView->showProperties( nullptr ); setPdmRoot( nullptr ); } @@ -499,6 +501,22 @@ void RiuPlotMainWindow::createDockPanels() dockWidget->hide(); } + { + QDockWidget* dockWidget = new QDockWidget( "Curve Manager", this ); + dockWidget->setObjectName( RiuDockWidgetTools::summaryCurveManagerName() ); + + m_summaryCurveManagerView = new caf::PdmUiPropertyView( dockWidget ); + + auto curveManager = std::make_unique(); + m_summaryCurveManagerView->showProperties( curveManager.get() ); + m_summaryCurveManagerView->installEventFilter( curveManager.get() ); + m_summaryCurveManager = std::move( curveManager ); + + dockWidget->setWidget( m_summaryCurveManagerView ); + addDockWidget( Qt::BottomDockWidgetArea, dockWidget ); + dockWidget->hide(); + } + if ( m_undoView && RiaPreferences::current()->useUndoRedo() ) { QDockWidget* dockWidget = new QDockWidget( "Undo Stack", this ); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 8d33de1fcf..9e29310fa2 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -137,9 +137,11 @@ private slots: std::unique_ptr m_dragDropInterface; caf::PdmUiPropertyView* m_pdmUiPropertyView; + caf::PdmUiPropertyView* m_summaryCurveManagerView; QPointer m_summaryCurveCreatorDialog; QPointer m_summaryCurveCalculatorDialog; + std::unique_ptr m_summaryCurveManager; std::vector m_temporaryWidgets; }; From 4c2a70fa40c806003780d4569d6d6127d21b9531 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 18 Nov 2021 12:24:49 +0100 Subject: [PATCH 013/406] #8297 Python : Do not modify result container when reading grid result data Avoid resize if data is already present Improve functions for getting grid data and accessing single cell values Add example for read and write of grid data --- .../PythonExamples/set_grid_properties.py | 35 ++++++++++++++--- GrpcInterface/Python/rips/case.py | 2 +- GrpcInterface/Python/rips/grid.py | 39 +++++++++++++++++-- GrpcInterface/Python/rips/tests/test_grids.py | 3 ++ GrpcInterface/RiaGrpcPropertiesService.cpp | 5 ++- 5 files changed, 73 insertions(+), 11 deletions(-) diff --git a/GrpcInterface/Python/rips/PythonExamples/set_grid_properties.py b/GrpcInterface/Python/rips/PythonExamples/set_grid_properties.py index 216cb173c2..3ee412a893 100644 --- a/GrpcInterface/Python/rips/PythonExamples/set_grid_properties.py +++ b/GrpcInterface/Python/rips/PythonExamples/set_grid_properties.py @@ -1,16 +1,41 @@ ###################################################################### -# This script sets values for SOIL for all grid cells in the first case in the project +# This script sets values for all grid cells in the first case in the project +# The script is intended to be used for TEST10K_FLT_LGR_NNC.EGRID +# This grid case contains one LGR ###################################################################### import rips resinsight = rips.Instance.find() case = resinsight.project.case(case_id=0) -total_cell_count = case.cell_count().reservoir_cell_count +grid = case.grid() +grid_cell_count = grid.cell_count() +print("total cell count : " + str(grid_cell_count)) values = [] -for i in range(0, total_cell_count): +for i in range(0, grid_cell_count): values.append(i % 2 * 0.75) -print("Applying values to full grid") -case.set_grid_property(values, "DYNAMIC_NATIVE", "SOIL", 0) +# Assign value to IJK grid cell at (31, 53, 21) +grid = case.grid() +property_data_index = grid.property_data_index_from_ijk(31, 53, 21) +values[property_data_index] = 1.5 + +print("Applying values to main grid") +case.set_grid_property(values, "STATIC_NATIVE", "MY_DATA", 0) + +values_from_ri = case.grid_property("STATIC_NATIVE", "MY_DATA", 0) +assert values[property_data_index] == values_from_ri[property_data_index] + +# Get LGR grid as grid index 1 +grid = case.grid(1) +grid_cell_count = grid.cell_count() +print("lgr cell count : " + str(grid_cell_count)) + +values = [] +for i in range(0, grid_cell_count): + values.append(i % 3 * 0.75) + +print("Applying values to LGR grid") +case.set_grid_property(values, "STATIC_NATIVE", "MY_DATA", 0, 1) +values_from_ri = case.grid_property("STATIC_NATIVE", "MY_DATA", 0, 1) diff --git a/GrpcInterface/Python/rips/case.py b/GrpcInterface/Python/rips/case.py index 9962a9b7e9..d97dcd504c 100644 --- a/GrpcInterface/Python/rips/case.py +++ b/GrpcInterface/Python/rips/case.py @@ -125,7 +125,7 @@ def __generate_property_input_chunks(self, array, parameters): @add_method(Case) -def grid(self, index): +def grid(self, index=0): """Get Grid of a given index Arguments: diff --git a/GrpcInterface/Python/rips/grid.py b/GrpcInterface/Python/rips/grid.py index a040065651..41317718a7 100644 --- a/GrpcInterface/Python/rips/grid.py +++ b/GrpcInterface/Python/rips/grid.py @@ -22,6 +22,7 @@ def __init__(self, index, case, channel): self.case = case self.index = index + self.cached_dimensions = None def dimensions(self): """The dimensions in i, j, k direction @@ -30,9 +31,13 @@ def dimensions(self): Vec3i: class with integer attributes i, j, k giving extent in all three dimensions. """ case_request = Case_pb2.CaseRequest(id=self.case.id) - return self.__stub.GetDimensions( - Grid_pb2.GridRequest(case_request=case_request, grid_index=self.index) - ).dimensions + + if self.cached_dimensions is None: + self.cached_dimensions = self.__stub.GetDimensions( + Grid_pb2.GridRequest(case_request=case_request, grid_index=self.index) + ).dimensions + + return self.cached_dimensions def cell_centers_async(self): """The cells center for all cells in given grid async. @@ -86,3 +91,31 @@ def cell_corners(self): for center in chunk.cells: corners.append(center) return corners + + def property_data_index_from_ijk(self, i, j, k): + """Compute property index from 1-based IJK cell address. Cell Property Result data is organized by I, J and K. + + property_data_index = dims.i * dims.j * (k - 1) + dims.i * (j - 1) + (i - 1) + + Returns: + int: Cell property result index from IJK + """ + + dims = self.dimensions() + + property_data_index = dims.i * dims.j * (k - 1) + dims.i * (j - 1) + (i - 1) + + return property_data_index + + def cell_count(self): + """Cell count in grid + + Returns: + int: Cell count in grid + """ + + dims = self.dimensions() + + count = dims.i * dims.j * dims.k + + return count diff --git a/GrpcInterface/Python/rips/tests/test_grids.py b/GrpcInterface/Python/rips/tests/test_grids.py index c910d950fd..002c9b342f 100644 --- a/GrpcInterface/Python/rips/tests/test_grids.py +++ b/GrpcInterface/Python/rips/tests/test_grids.py @@ -27,6 +27,9 @@ def test_10k(rips_instance, initialize_test): cell_centers = grid.cell_centers() assert len(cell_centers) == (dimensions.i * dimensions.j * dimensions.k) + property_data_index = grid.property_data_index_from_ijk(31, 53, 21) + assert property_data_index == 177510 + # Test a specific cell (results from ResInsight UI) cell_index = 168143 assert math.isclose(3627.17, cell_centers[cell_index].x, abs_tol=0.1) diff --git a/GrpcInterface/RiaGrpcPropertiesService.cpp b/GrpcInterface/RiaGrpcPropertiesService.cpp index 84fb304db3..b4aab850c1 100644 --- a/GrpcInterface/RiaGrpcPropertiesService.cpp +++ b/GrpcInterface/RiaGrpcPropertiesService.cpp @@ -351,9 +351,10 @@ class RiaGridCellResultsStateHandler : public RiaCellResultsStateHandler { m_cellCount = caseData->grid( gridIndex )->cellCount(); auto resultValues = caseData->results( porosityModel )->modifiableCellScalarResult( resVarAddr, timeStepIndex ); - if ( resultValues && m_cellCount > 0 ) + if ( resultValues && resultValues->empty() && m_cellCount > 0 ) { - resultValues->resize( m_cellCount ); + auto totalCellCount = caseData->mainGrid()->globalCellArray().size(); + resultValues->resize( totalCellCount ); } m_resultAccessor = From c945166e810d0b1e9e45ac82fe9c1b2fe3bfe8e3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 16 Nov 2021 11:52:40 +0100 Subject: [PATCH 014/406] Janitor : Remove obsolete code --- .../Tools/RiaImportEclipseCaseTools.cpp | 1 - .../RicCopyReferencesToClipboardFeature.cpp | 1 - .../RicNewDefaultSummaryPlotFeature.cpp | 1 - .../RicNewSummaryCrossPlotFeature.cpp | 1 - .../RicNewSummaryPlotFeature.cpp | 1 - .../RicPasteSummaryCrossPlotCurveFeature.cpp | 1 - .../RicPasteSummaryCurveFeature.cpp | 1 - .../ProjectDataModel/RimPlotCurve.cpp | 1 - .../Summary/CMakeLists_files.cmake | 4 - .../Summary/RimAsciiDataCurve.cpp | 1 - .../Summary/RimEnsembleCurveSet.cpp | 9 - .../Summary/RimEnsembleCurveSet.h | 4 - .../Summary/RimSummaryCurve.cpp | 13 - .../Summary/RimSummaryCurve.h | 5 - .../Summary/RimSummaryCurveFilter.cpp | 136 ----- .../Summary/RimSummaryCurveFilter.h | 82 --- .../Summary/RimSummaryFilter.cpp | 519 ------------------ .../Summary/RimSummaryFilter.h | 80 --- .../Summary/RimSummaryPlot.cpp | 1 - 19 files changed, 862 deletions(-) delete mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp delete mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.h delete mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.cpp delete mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.h diff --git a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp index 22b8dd29dd..929df52f96 100644 --- a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp @@ -52,7 +52,6 @@ #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" -#include "RimSummaryCurveFilter.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" #include "RimWellLogRftCurve.h" diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp index 5354c46ef8..0813a8acbc 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp @@ -30,7 +30,6 @@ #include "RimGridCrossPlotDataSet.h" #include "RimMimeData.h" #include "RimModeledWellPath.h" -#include "RimSummaryCurveFilter.h" #include "RimSummaryPlot.h" #include "RimWellAllocationPlot.h" #include "RimWellLogPlot.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp index 765f60595f..25b78cc2df 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp @@ -36,7 +36,6 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" -#include "RimSummaryCurveFilter.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.cpp index 7c41764cca..213fc8e49c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.cpp @@ -29,7 +29,6 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCrossPlotCollection.h" -#include "RimSummaryCurveFilter.h" #include "RimSummaryPlot.h" #include "RiuPlotMainWindowTools.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp index 75bbcc129d..b98205a959 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp @@ -34,7 +34,6 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" -#include "RimSummaryCurveFilter.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.cpp index 9487ee44df..93bf7ebb2d 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.cpp @@ -24,7 +24,6 @@ #include "RimSummaryCrossPlot.h" #include "RimSummaryCurve.h" -#include "RimSummaryCurveFilter.h" #include "cafPdmDefaultObjectFactory.h" #include "cafPdmDocument.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp index 16c3069f95..cfec2ab6a2 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp @@ -24,7 +24,6 @@ #include "RimSummaryCrossPlot.h" #include "RimSummaryCurve.h" -#include "RimSummaryCurveFilter.h" #include "RimSummaryPlot.h" #include "cafPdmDefaultObjectFactory.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index ecd19337be..1c43ad6cbc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -31,7 +31,6 @@ #include "RimSummaryCrossPlot.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" -#include "RimSummaryCurveFilter.h" #include "RimSummaryPlot.h" #include "RiuPlotMainWindowTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake index a3b076b15f..e1e1828fac 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -8,9 +8,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveAppearanceCalculator.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveAutoName.h - ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveFilter.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotAxisFormatter.h - ${CMAKE_CURRENT_LIST_DIR}/RimSummaryFilter.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlot.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotCollection.h @@ -51,9 +49,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveAppearanceCalculator.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveAutoName.cpp - ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveFilter.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotAxisFormatter.cpp - ${CMAKE_CURRENT_LIST_DIR}/RimSummaryFilter.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlot.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotCollection.cpp diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp index 1c5e3e36a7..127de81278 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp @@ -22,7 +22,6 @@ #include "RimEclipseResultCase.h" #include "RimProject.h" #include "RimSummaryCase.h" -#include "RimSummaryFilter.h" #include "RimSummaryPlot.h" #include "RimSummaryTimeAxisProperties.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 308dcdc0dc..f36ab3a916 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -48,7 +48,6 @@ #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveAutoName.h" -#include "RimSummaryFilter.h" #include "RimSummaryPlot.h" #include "RimTimeStepFilter.h" @@ -221,14 +220,6 @@ RimEnsembleCurveSet::RimEnsembleCurveSet() m_disableStatisticCurves = false; m_isCurveSetFiltered = false; - // Obsolete fields - - CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter" ); - m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true ); - m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeHidden( true ); - m_yValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable( false ); - m_yValuesSummaryFilter_OBSOLETE = new RimSummaryFilter_OBSOLETE; - setDeletable( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index ace38eb714..10d35df05f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -51,7 +51,6 @@ class RimSummaryCase; class RimSummaryCaseCollection; class RimSummaryCurve; class RimSummaryAddress; -class RimSummaryFilter_OBSOLETE; class RimSummaryPlotSourceStepping; class RimSummaryCurveAutoName; class RimEnsembleCurveFilterCollection; @@ -254,7 +253,4 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt bool m_disableStatisticCurves; bool m_isCurveSetFiltered; - - // Obsolete fields - caf::PdmChildField m_yValuesSummaryFilter_OBSOLETE; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 3232b054c5..10532f00e4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -38,7 +38,6 @@ #include "RimSummaryCrossPlot.h" #include "RimSummaryCurveAutoName.h" #include "RimSummaryCurveCollection.h" -#include "RimSummaryFilter.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" #include "RimSummaryTimeAxisProperties.h" @@ -128,18 +127,6 @@ RimSummaryCurve::RimSummaryCurve() setSymbolSkipDistance( 10.0f ); setLineThickness( 2 ); - CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryFilter_OBSOLETE, "VarListFilter", "Filter" ); - m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true ); - m_yValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeHidden( true ); - m_yValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable( false ); - m_yValuesSummaryFilter_OBSOLETE = new RimSummaryFilter_OBSOLETE; - - CAF_PDM_InitFieldNoDefault( &m_xValuesSummaryFilter_OBSOLETE, "VarListFilterX", "Filter" ); - m_xValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeChildrenHidden( true ); - m_xValuesSummaryFilter_OBSOLETE.uiCapability()->setUiTreeHidden( true ); - m_xValuesSummaryFilter_OBSOLETE.xmlCapability()->setIOWritable( false ); - m_xValuesSummaryFilter_OBSOLETE = new RimSummaryFilter_OBSOLETE; - setDeletable( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h index 8c6c2bbd04..4558b6c149 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -35,7 +35,6 @@ class RifSummaryReaderInterface; class RimSummaryCase; -class RimSummaryFilter_OBSOLETE; class RiuQwtPlotCurve; class RimSummaryCurveAutoName; class RimSummaryAddress; @@ -148,8 +147,4 @@ class RimSummaryCurve : public RimStackablePlotCurve caf::PdmChildField m_curveNameConfig; caf::PdmField> m_plotAxis; caf::PdmField m_isTopZWithinCategory; - - // Obsolete fields - caf::PdmChildField m_yValuesSummaryFilter_OBSOLETE; - caf::PdmChildField m_xValuesSummaryFilter_OBSOLETE; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp deleted file mode 100644 index 35969f6add..0000000000 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.cpp +++ /dev/null @@ -1,136 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016 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 -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RimSummaryCurveFilter.h" - -#include "RimSummaryCase.h" -#include "RimSummaryCurve.h" -#include "RimSummaryCurveAutoName.h" -#include "RimSummaryFilter.h" -#include "cafPdmUiListEditor.h" -#include "cafPdmUiPushButtonEditor.h" - -// See also corresponding fake implementations in RimSummaryCurve - -QTextStream& operator<<( QTextStream& str, const std::vector& sobj ) -{ - CVF_ASSERT( false ); - return str; -} - -QTextStream& operator>>( QTextStream& str, std::vector& sobj ) -{ - CVF_ASSERT( false ); - return str; -} - -CAF_PDM_SOURCE_INIT( RimSummaryCurveFilter_OBSOLETE, "SummaryCurveFilter" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryCurveFilter_OBSOLETE::RimSummaryCurveFilter_OBSOLETE() -{ - CAF_PDM_InitObject( "Curve Filter", ":/SummaryCurveFilter16x16.png", "", "" ); - - CAF_PDM_InitFieldNoDefault( &m_selectedSummaryCases, "SummaryCases", "Cases" ); - m_selectedSummaryCases.uiCapability()->setUiTreeChildrenHidden( true ); - m_selectedSummaryCases.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - m_selectedSummaryCases.uiCapability()->setAutoAddingOptionFromValue( false ); - m_selectedSummaryCases.xmlCapability()->disableIO(); - m_selectedSummaryCases.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - - CAF_PDM_InitFieldNoDefault( &m_summaryFilter, "VarListFilter", "Filter" ); - m_summaryFilter.uiCapability()->setUiTreeChildrenHidden( true ); - m_summaryFilter.uiCapability()->setUiTreeHidden( true ); - - m_summaryFilter = new RimSummaryFilter_OBSOLETE; - - CAF_PDM_InitFieldNoDefault( &m_uiFilterResultMultiSelection, - "FilterResultSelection", - "Filter Result", - "", - "Ctrl-A : Select All", - "" ); - m_uiFilterResultMultiSelection.xmlCapability()->disableIO(); - m_uiFilterResultMultiSelection.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - m_uiFilterResultMultiSelection.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - m_uiFilterResultMultiSelection.uiCapability()->setAutoAddingOptionFromValue( false ); - - CAF_PDM_InitFieldNoDefault( &m_curves, "FilteredCurves", "Filtered Curves" ); - m_curves.uiCapability()->setUiTreeHidden( true ); - m_curves.uiCapability()->setUiTreeChildrenHidden( false ); - - CAF_PDM_InitFieldNoDefault( &m_applyButtonField, "ApplySelection", "" ); - m_applyButtonField.xmlCapability()->disableIO(); - m_applyButtonField = false; - m_applyButtonField.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); - m_applyButtonField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::LEFT ); - - CAF_PDM_InitField( &m_autoApplyChangesToPlot, "AutoApplyFilterChanges", true, "Auto Apply Changes" ); - - CAF_PDM_InitField( &m_showCurves, "IsActive", true, "Show Curves" ); - m_showCurves.uiCapability()->setUiHidden( true ); - - CAF_PDM_InitField( &m_useAutoAppearanceAssignment, "UseAutoAppearanceAssignment", true, "Auto" ); - - CAF_PDM_InitFieldNoDefault( &m_caseAppearanceType, "CaseAppearanceType", "Case" ); - CAF_PDM_InitFieldNoDefault( &m_variableAppearanceType, "VariableAppearanceType", "Vector" ); - CAF_PDM_InitFieldNoDefault( &m_wellAppearanceType, "WellAppearanceType", "Well" ); - CAF_PDM_InitFieldNoDefault( &m_groupAppearanceType, "GroupAppearanceType", "Group" ); - CAF_PDM_InitFieldNoDefault( &m_regionAppearanceType, "RegionAppearanceType", "Region" ); - - CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis" ); - CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Contribute To Legend" ); - - CAF_PDM_InitFieldNoDefault( &m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig" ); - m_curveNameConfig.uiCapability()->setUiTreeHidden( true ); - m_curveNameConfig.uiCapability()->setUiTreeChildrenHidden( true ); - - m_curveNameConfig = new RimSummaryCurveAutoName; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryCurveFilter_OBSOLETE::~RimSummaryCurveFilter_OBSOLETE() -{ - m_curves.deleteAllChildObjects(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimSummaryCurveFilter_OBSOLETE::curves() -{ - std::vector myCurves; - for ( RimSummaryCurve* curve : m_curves ) - { - myCurves.push_back( curve ); - } - - return myCurves; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCurveFilter_OBSOLETE::clearCurvesWithoutDelete() -{ - m_curves.clear(); -} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.h deleted file mode 100644 index 7ce6a75e54..0000000000 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveFilter.h +++ /dev/null @@ -1,82 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016 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 -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "cafAppEnum.h" -#include "cafPdmChildArrayField.h" -#include "cafPdmChildField.h" -#include "cafPdmField.h" -#include "cafPdmObject.h" -#include "cafPdmPointer.h" -#include "cafPdmPtrArrayField.h" -#include "cafPdmPtrField.h" - -#include "RifEclipseSummaryAddressQMetaType.h" - -#include "RiaDefines.h" -#include "RimSummaryCurveAppearanceCalculator.h" - -class RimSummaryFilter_OBSOLETE; -class RimSummaryCurveAutoName; - -//================================================================================================== -/// -/// -//================================================================================================== -class RimSummaryCurveFilter_OBSOLETE : public caf::PdmObject -{ - CAF_PDM_HEADER_INIT; - -public: - RimSummaryCurveFilter_OBSOLETE(); - ~RimSummaryCurveFilter_OBSOLETE() override; - - std::vector curves(); - void clearCurvesWithoutDelete(); - -private: - // QPointer m_parentQwtPlot; - - // Fields - caf::PdmField m_showCurves; - caf::PdmPtrArrayField m_selectedSummaryCases; - caf::PdmChildArrayField m_curves; - - caf::PdmField> m_plotAxis; - caf::PdmField m_showLegend; - - // Filter fields - caf::PdmChildField m_summaryFilter; - caf::PdmField> m_uiFilterResultMultiSelection; - - caf::PdmChildField m_curveNameConfig; - - caf::PdmField m_autoApplyChangesToPlot; - caf::PdmField m_applyButtonField; - - caf::PdmField m_useAutoAppearanceAssignment; - typedef caf::AppEnum AppearanceTypeAppEnum; - caf::PdmField m_caseAppearanceType; - caf::PdmField m_variableAppearanceType; - caf::PdmField m_wellAppearanceType; - caf::PdmField m_groupAppearanceType; - caf::PdmField m_regionAppearanceType; - - std::vector> m_selectionCache; -}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.cpp deleted file mode 100644 index 6c7c5ee246..0000000000 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.cpp +++ /dev/null @@ -1,519 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016 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 -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RimSummaryFilter.h" - -#include "RimSummaryCurve.h" -#include "RimSummaryCurveFilter.h" - -namespace caf -{ -template <> -void caf::AppEnum::setUp() -{ - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_VAR_STRING, "SUM_FILTER_VAR_STRING", "All" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_FIELD, "SUM_FILTER_FIELD", "Field" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_WELL, "SUM_FILTER_WELL", "Well" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_WELL_GROUP, "SUM_FILTER_WELL_GROUP", "Group" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_WELL_COMPLETION, "SUM_FILTER_WELL_COMPLETION", "Completion" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_WELL_SEGMENT, "SUM_FILTER_SEGMENT", "Segment" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_BLOCK, "SUM_FILTER_BLOCK", "Block" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_REGION, "SUM_FILTER_REGION", "Region" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_REGION_2_REGION, "SUM_FILTER_REGION_2_REGION", "Region-Region" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_WELL_LGR, "SUM_FILTER_WELL_LGR", "Lgr-Well" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_WELL_COMPLETION_LGR, "SUM_FILTER_WELL_COMPLETION_LGR", "Lgr-Completion" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_BLOCK_LGR, "SUM_FILTER_BLOCK_LGR", "Lgr-Block" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_MISC, "SUM_FILTER_MISC", "Misc" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_AQUIFER, "SUM_FILTER_AQUIFER", "Aquifer" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_NETWORK, "SUM_FILTER_NETWORK", "Network" ); - addItem( RimSummaryFilter_OBSOLETE::SUM_FILTER_ANY, "SUM_FILTER_ANY", "All (Advanced)" ); - setDefault( RimSummaryFilter_OBSOLETE::SUM_FILTER_VAR_STRING ); -} - -} // namespace caf - -CAF_PDM_SOURCE_INIT( RimSummaryFilter_OBSOLETE, "SummaryFilterSettings" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryFilter_OBSOLETE::RimSummaryFilter_OBSOLETE() -{ - CAF_PDM_InitObject( "Summary Filter" ); - - CAF_PDM_InitFieldNoDefault( &m_filterType, "SummaryFilterType", "Search" ); - CAF_PDM_InitFieldNoDefault( &m_completeVarStringFilter, "SummaryCompleteVarStringFilter", "Filter" ); - CAF_PDM_InitFieldNoDefault( &m_filterQuantityName, "SummaryVarQuantityFilter", "Vector name" ); - CAF_PDM_InitFieldNoDefault( &m_regionNumberFilter, "SummaryRegionNumberFilter", "Region number" ); - CAF_PDM_InitFieldNoDefault( &m_regionNumber2Filter, "SummaryRegionNumber2Filter", "2. Region number" ); - CAF_PDM_InitFieldNoDefault( &m_wellGroupNameFilter, "SummaryWellGroupNameFilter", "Group name" ); - CAF_PDM_InitFieldNoDefault( &m_wellNameFilter, "SummaryWellNameFilter", "Well name" ); - CAF_PDM_InitFieldNoDefault( &m_wellSegmentNumberFilter, "SummaryWellSegmentNumberFilter", "Segment number" ); - CAF_PDM_InitFieldNoDefault( &m_lgrNameFilter, "SummaryLgrNameFilter", "LGR Name" ); - CAF_PDM_InitFieldNoDefault( &m_cellIJKFilter, "SummaryCellIJKFilter", "I, J, K" ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryFilter_OBSOLETE::~RimSummaryFilter_OBSOLETE() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString cellIJKString( int cellI, int cellJ, int cellK ) -{ - QString ijkString; - if ( cellI >= 0 && cellJ >= 0 && cellK >= 0 ) - { - ijkString = QString::number( cellI ) + ", " + QString::number( cellJ ) + ", " + QString::number( cellK ); - } - - return ijkString; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryFilter_OBSOLETE::updateFromAddress( const RifEclipseSummaryAddress& address ) -{ - RifEclipseSummaryAddress::SummaryVarCategory category = address.category(); - - m_filterQuantityName = QString::fromStdString( address.quantityName() ); - - switch ( category ) - { - case RifEclipseSummaryAddress::SUMMARY_INVALID: - m_filterType = SUM_FILTER_VAR_STRING; - break; - - case RifEclipseSummaryAddress::SUMMARY_FIELD: - m_filterType = SUM_FILTER_FIELD; - break; - - case RifEclipseSummaryAddress::SUMMARY_AQUIFER: - m_filterType = SUM_FILTER_AQUIFER; - break; - - case RifEclipseSummaryAddress::SUMMARY_NETWORK: - m_filterType = SUM_FILTER_NETWORK; - break; - - case RifEclipseSummaryAddress::SUMMARY_MISC: - m_filterType = SUM_FILTER_MISC; - break; - - case RifEclipseSummaryAddress::SUMMARY_REGION: - m_filterType = SUM_FILTER_REGION; - m_regionNumberFilter = QString( "%1" ).arg( address.regionNumber() ); - break; - - case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION: - m_filterType = SUM_FILTER_REGION_2_REGION; - m_regionNumberFilter = QString( "%1" ).arg( address.regionNumber() ); - m_regionNumber2Filter = QString( "%1" ).arg( address.regionNumber2() ); - break; - - case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP: - m_filterType = SUM_FILTER_WELL_GROUP; - m_wellGroupNameFilter = QString::fromStdString( address.wellGroupName() ); - break; - - case RifEclipseSummaryAddress::SUMMARY_WELL: - m_filterType = SUM_FILTER_WELL; - m_wellNameFilter = QString::fromStdString( address.wellName() ); - break; - - case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION: - m_filterType = SUM_FILTER_WELL_COMPLETION; - m_wellNameFilter = QString::fromStdString( address.wellName() ); - m_cellIJKFilter = cellIJKString( address.cellI(), address.cellJ(), address.cellK() ); - break; - - case RifEclipseSummaryAddress::SUMMARY_WELL_LGR: - m_filterType = SUM_FILTER_WELL_LGR; - m_wellNameFilter = QString::fromStdString( address.wellName() ); - m_lgrNameFilter = QString::fromStdString( address.lgrName() ); - break; - - case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR: - m_filterType = SUM_FILTER_WELL_COMPLETION_LGR; - m_wellNameFilter = QString::fromStdString( address.wellName() ); - m_lgrNameFilter = QString::fromStdString( address.lgrName() ); - m_cellIJKFilter = cellIJKString( address.cellI(), address.cellJ(), address.cellK() ); - break; - - case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT: - m_filterType = SUM_FILTER_WELL_SEGMENT; - m_wellNameFilter = QString::fromStdString( address.wellName() ); - m_wellSegmentNumberFilter = QString( "%1" ).arg( address.wellSegmentNumber() ); - break; - - case RifEclipseSummaryAddress::SUMMARY_BLOCK: - m_filterType = SUM_FILTER_BLOCK; - m_cellIJKFilter = cellIJKString( address.cellI(), address.cellJ(), address.cellK() ); - break; - - case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR: - m_filterType = SUM_FILTER_BLOCK_LGR; - m_lgrNameFilter = QString::fromStdString( address.lgrName() ); - m_cellIJKFilter = cellIJKString( address.cellI(), address.cellJ(), address.cellK() ); - break; - - default: - break; - } -} - -bool isNumberMatch( QString numericalFilterString, int number ) -{ - if ( numericalFilterString.isEmpty() ) return true; - - if ( numericalFilterString.trimmed() == "*" ) - { - if ( number >= 0 ) - return true; - else - return false; - } - - // Todo: Ranges, and lists - int filterNumber = numericalFilterString.toInt(); - return number == filterNumber; -} - -bool isStringMatch( QString filterString, std::string value ) -{ - if ( filterString.isEmpty() ) return true; - if ( filterString.trimmed() == "*" ) - { - if ( !value.empty() ) - return true; - else - return false; - } - - QRegExp searcher( filterString, Qt::CaseInsensitive, QRegExp::WildcardUnix ); - QString qstrValue = QString::fromStdString( value ); - return searcher.exactMatch( qstrValue ); -} - -bool isIJKMatch( QString filterString, int cellI, int cellJ, int cellK ) -{ - if ( filterString.isEmpty() ) return true; - if ( filterString.trimmed() == "*" ) - { - if ( cellI >= 0 && cellJ >= 0 && cellK >= 0 ) - return true; - else - return false; - } - - QString ijkString = cellIJKString( cellI, cellJ, cellK ); - - // Todo: Ranges, and lists - QRegExp searcher( filterString, Qt::CaseInsensitive, QRegExp::WildcardUnix ); - - return searcher.exactMatch( ijkString ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimSummaryFilter_OBSOLETE::isIncludedByFilter( const RifEclipseSummaryAddress& addr ) const -{ - if ( !isSumVarTypeMatchingFilterType( m_filterType(), addr.category() ) ) return false; - - if ( m_filterType() == SUM_FILTER_VAR_STRING ) - { - return addr.isUiTextMatchingFilterText( m_completeVarStringFilter() ); - } - - if ( !isStringMatch( m_filterQuantityName(), addr.quantityName() ) ) return false; - - if ( m_filterType() == SUM_FILTER_ANY ) - { - return ( isNumberMatch( m_regionNumberFilter(), addr.regionNumber() ) && - isNumberMatch( m_regionNumber2Filter(), addr.regionNumber2() ) && - isStringMatch( m_wellGroupNameFilter(), addr.wellGroupName() ) && - isStringMatch( m_wellNameFilter(), addr.wellName() ) && - isStringMatch( m_lgrNameFilter(), addr.lgrName() ) && - isNumberMatch( m_wellSegmentNumberFilter(), addr.wellSegmentNumber() ) && - isIJKMatch( m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK() ) ); - } - - switch ( addr.category() ) - { - case RifEclipseSummaryAddress::SUMMARY_REGION: - { - return isNumberMatch( m_regionNumberFilter(), addr.regionNumber() ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION: - { - return isNumberMatch( m_regionNumberFilter(), addr.regionNumber() ) && - isNumberMatch( m_regionNumber2Filter(), addr.regionNumber2() ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP: - { - return isStringMatch( m_wellGroupNameFilter(), addr.wellGroupName() ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_WELL: - { - return isStringMatch( m_wellNameFilter(), addr.wellName() ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION: - { - return isStringMatch( m_wellNameFilter(), addr.wellName() ) && - isIJKMatch( m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK() ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_WELL_LGR: - { - return isStringMatch( m_wellNameFilter(), addr.wellName() ) && - isStringMatch( m_lgrNameFilter(), addr.lgrName() ); - } - break; - - case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR: - { - return isStringMatch( m_wellNameFilter(), addr.wellName() ) && - isStringMatch( m_lgrNameFilter(), addr.lgrName() ) && - isIJKMatch( m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK() ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT: - { - return isStringMatch( m_wellNameFilter(), addr.wellName() ) && - isNumberMatch( m_wellSegmentNumberFilter(), addr.wellSegmentNumber() ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_BLOCK: - { - return isIJKMatch( m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK() ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR: - { - return isStringMatch( m_lgrNameFilter(), addr.lgrName() ) && - isIJKMatch( m_cellIJKFilter(), addr.cellI(), addr.cellJ(), addr.cellK() ); - } - break; - } - - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimSummaryFilter_OBSOLETE::isSumVarTypeMatchingFilterType( SummaryFilterType sumFilterType, - RifEclipseSummaryAddress::SummaryVarCategory sumVarType ) -{ - if ( sumVarType == RifEclipseSummaryAddress::SUMMARY_INVALID ) return false; - if ( sumFilterType == SUM_FILTER_ANY || sumFilterType == SUM_FILTER_VAR_STRING ) return true; - - switch ( sumVarType ) - { - case RifEclipseSummaryAddress::SUMMARY_FIELD: - { - return ( sumFilterType == SUM_FILTER_FIELD ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_AQUIFER: - { - return ( sumFilterType == SUM_FILTER_AQUIFER ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_NETWORK: - { - return ( sumFilterType == SUM_FILTER_NETWORK ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_MISC: - { - return ( sumFilterType == SUM_FILTER_MISC ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_REGION: - { - return ( sumFilterType == SUM_FILTER_REGION ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION: - { - return ( sumFilterType == SUM_FILTER_REGION_2_REGION ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP: - { - return ( sumFilterType == SUM_FILTER_WELL_GROUP ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_WELL: - { - return ( sumFilterType == SUM_FILTER_WELL ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION: - { - return ( sumFilterType == SUM_FILTER_WELL_COMPLETION ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_WELL_LGR: - { - return ( sumFilterType == SUM_FILTER_WELL_LGR ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR: - { - return ( sumFilterType == SUM_FILTER_WELL_COMPLETION_LGR ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT: - { - return ( sumFilterType == SUM_FILTER_WELL_SEGMENT ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_BLOCK: - { - return ( sumFilterType == SUM_FILTER_BLOCK ); - } - break; - case RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR: - { - return ( sumFilterType == SUM_FILTER_BLOCK_LGR ); - } - break; - } - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryFilter_OBSOLETE::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) -{ - uiOrdering.add( &m_filterType ); - - if ( m_filterType() == SUM_FILTER_VAR_STRING ) - { - uiOrdering.add( &m_completeVarStringFilter ); - } - else - { - caf::PdmUiOrdering* curveVarFilterGroup = &uiOrdering; // uiOrdering.addNewGroup("Search Options"); - - curveVarFilterGroup->add( &m_filterQuantityName ); - - switch ( m_filterType() ) - { - case SUM_FILTER_ANY: - { - curveVarFilterGroup->add( &m_wellNameFilter ); - curveVarFilterGroup->add( &m_wellGroupNameFilter ); - curveVarFilterGroup->add( &m_regionNumberFilter ); - curveVarFilterGroup->add( &m_regionNumber2Filter ); - curveVarFilterGroup->add( &m_wellSegmentNumberFilter ); - curveVarFilterGroup->add( &m_lgrNameFilter ); - curveVarFilterGroup->add( &m_cellIJKFilter ); - } - break; - case SUM_FILTER_REGION: - { - curveVarFilterGroup->add( &m_regionNumberFilter ); - } - break; - case SUM_FILTER_REGION_2_REGION: - { - curveVarFilterGroup->add( &m_regionNumberFilter ); - curveVarFilterGroup->add( &m_regionNumber2Filter ); - } - break; - case SUM_FILTER_WELL_GROUP: - { - curveVarFilterGroup->add( &m_wellGroupNameFilter ); - } - break; - case SUM_FILTER_WELL: - { - curveVarFilterGroup->add( &m_wellNameFilter ); - } - break; - case SUM_FILTER_WELL_COMPLETION: - { - curveVarFilterGroup->add( &m_wellNameFilter ); - curveVarFilterGroup->add( &m_cellIJKFilter ); - } - break; - case SUM_FILTER_WELL_LGR: - { - curveVarFilterGroup->add( &m_wellNameFilter ); - curveVarFilterGroup->add( &m_lgrNameFilter ); - } - break; - case SUM_FILTER_WELL_COMPLETION_LGR: - { - curveVarFilterGroup->add( &m_wellNameFilter ); - curveVarFilterGroup->add( &m_lgrNameFilter ); - curveVarFilterGroup->add( &m_cellIJKFilter ); - } - break; - case SUM_FILTER_WELL_SEGMENT: - { - curveVarFilterGroup->add( &m_wellNameFilter ); - curveVarFilterGroup->add( &m_wellSegmentNumberFilter ); - } - break; - case SUM_FILTER_BLOCK: - { - curveVarFilterGroup->add( &m_cellIJKFilter ); - } - break; - case SUM_FILTER_BLOCK_LGR: - { - curveVarFilterGroup->add( &m_lgrNameFilter ); - curveVarFilterGroup->add( &m_cellIJKFilter ); - } - break; - } - } - - uiOrdering.skipRemainingFields(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryFilter_OBSOLETE::fieldChangedByUi( const caf::PdmFieldHandle* changedField, - const QVariant& oldValue, - const QVariant& newValue ) -{ - caf::PdmObject* parent = dynamic_cast( this->parentField()->ownerObject() ); - - if ( parent ) - { - parent->updateConnectedEditors(); - } -} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.h deleted file mode 100644 index 2acea02749..0000000000 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryFilter.h +++ /dev/null @@ -1,80 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016 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 -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "RifEclipseSummaryAddress.h" - -#include "cafPdmField.h" -#include "cafPdmObject.h" - -class RimSummaryFilter_OBSOLETE : public caf::PdmObject -{ - CAF_PDM_HEADER_INIT; - -public: - enum SummaryFilterType - { - SUM_FILTER_VAR_STRING, - SUM_FILTER_ANY, - SUM_FILTER_FIELD, - SUM_FILTER_AQUIFER, - SUM_FILTER_NETWORK, - SUM_FILTER_MISC, - SUM_FILTER_REGION, - SUM_FILTER_REGION_2_REGION, - SUM_FILTER_WELL_GROUP, - SUM_FILTER_WELL, - SUM_FILTER_WELL_COMPLETION, - SUM_FILTER_WELL_COMPLETION_LGR, - SUM_FILTER_WELL_LGR, - SUM_FILTER_WELL_SEGMENT, - SUM_FILTER_BLOCK, - SUM_FILTER_BLOCK_LGR, - }; - - RimSummaryFilter_OBSOLETE(); - ~RimSummaryFilter_OBSOLETE() override; - - void updateFromAddress( const RifEclipseSummaryAddress& address ); - - bool isIncludedByFilter( const RifEclipseSummaryAddress& addr ) const; - - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - -private: - friend class RimSummaryCurve; - - static bool isSumVarTypeMatchingFilterType( SummaryFilterType sumFilterType, - RifEclipseSummaryAddress::SummaryVarCategory sumVarType ); - - void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - -private: - caf::PdmField> m_filterType; - caf::PdmField m_completeVarStringFilter; - - caf::PdmField m_filterQuantityName; - caf::PdmField m_regionNumberFilter; - caf::PdmField m_regionNumber2Filter; - caf::PdmField m_wellGroupNameFilter; - caf::PdmField m_wellNameFilter; - caf::PdmField m_wellSegmentNumberFilter; - caf::PdmField m_lgrNameFilter; - caf::PdmField m_cellIJKFilter; -}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 9c6699bca1..0a0e87199a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -40,7 +40,6 @@ #include "RimSummaryCase.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" -#include "RimSummaryCurveFilter.h" #include "RimSummaryPlotAxisFormatter.h" #include "RimSummaryPlotCollection.h" #include "RimSummaryPlotFilterTextCurveSetEditor.h" From 5fcb81980dc3f8e73556339c8092d0d107328966 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 19 Nov 2021 14:53:01 +0100 Subject: [PATCH 015/406] #8310 Summary Plot Manager : Add data source filtering --- .../Application/Tools/CMakeLists_files.cmake | 2 + .../Tools/RiaSummaryStringTools.cpp | 110 +++++++ .../Application/Tools/RiaSummaryStringTools.h | 46 +++ .../CMakeLists_files.cmake | 2 + .../RicShowSummaryPlotManagerFeature.cpp | 55 ++++ .../RicShowSummaryPlotManagerFeature.h | 34 +++ .../RicSummaryPlotFeatureImpl.cpp | 59 +--- .../RicSummaryPlotFeatureImpl.h | 7 - .../Summary/RimSummaryPlotManager.cpp | 286 +++++++++++++++--- .../Summary/RimSummaryPlotManager.h | 19 +- .../UnitTests/CMakeLists_files.cmake | 1 + .../UnitTests/RiaSummaryStringTools-Test.cpp | 52 ++++ .../UserInterface/RiuDockWidgetTools.cpp | 4 +- .../UserInterface/RiuDockWidgetTools.h | 6 +- .../UserInterface/RiuPlotMainWindow.cpp | 36 ++- .../UserInterface/RiuPlotMainWindow.h | 6 +- .../cafPdmUiComboBoxEditor.cpp | 3 + 17 files changed, 608 insertions(+), 120 deletions(-) create mode 100644 ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp create mode 100644 ApplicationLibCode/Application/Tools/RiaSummaryStringTools.h create mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryPlotManagerFeature.cpp create mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryPlotManagerFeature.h create mode 100644 ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp diff --git a/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake b/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake index ea3b07a223..1078162056 100644 --- a/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake @@ -48,6 +48,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaValidRegExpValidator.h ${CMAKE_CURRENT_LIST_DIR}/RiaVec3Tools.h ${CMAKE_CURRENT_LIST_DIR}/RiaEnsembleNameTools.h + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryStringTools.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -93,6 +94,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaValidRegExpValidator.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaEnsembleNameTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaVec3Tools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryStringTools.cpp ) list(APPEND CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES}) diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp new file mode 100644 index 0000000000..f6aa146cb7 --- /dev/null +++ b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp @@ -0,0 +1,110 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiaSummaryStringTools.h" + +#include "RiaLogging.h" +#include "RifEclipseSummaryAddress.h" +#include "RifSummaryReaderInterface.h" +#include "RimSummaryCase.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaSummaryStringTools::splitAddressFiltersInGridAndSummary( RimSummaryCase* summaryCase, + const QStringList& addressFilters, + QStringList* summaryAddressFilters, + QStringList* gridResultAddressFilters ) +{ + if ( summaryCase ) + { + const std::set& addrs = summaryCase->summaryReader()->allResultAddresses(); + + QRegularExpression gridAddressPattern( "^[A-Z]+:[0-9]+,[0-9]+,[0-9]+$" ); + + for ( int filterIdx = 0; filterIdx < addressFilters.size(); ++filterIdx ) + { + const QString& address = addressFilters[filterIdx]; + if ( hasFilterAnyMatch( address, addrs ) ) + { + summaryAddressFilters->push_back( address ); + } + else + { + if ( gridAddressPattern.match( address ).hasMatch() ) + { + gridResultAddressFilters->push_back( address ); + } + else + { + RiaLogging::warning( "No summary or restart vectors matched \"" + address + "\"" ); + } + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaSummaryStringTools::hasFilterAnyMatch( const QString& curveFilter, + const std::set& summaryAddresses ) +{ + for ( const auto& addr : summaryAddresses ) + { + if ( addr.isUiTextMatchingFilterText( curveFilter ) ) return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// Sort filters into curve and data source filters +//-------------------------------------------------------------------------------------------------- +void RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( const QStringList& filters, + const QStringList& dataSourceNames, + QStringList& addressFilters, + QStringList& dataSourceFilters ) +{ + for ( const auto& s : filters ) + { + // Strip off realization filter from ensemble search string + + QString pureDataSourceCandidate = s.left( s.indexOf( ':' ) ); + + bool foundDataSource = false; + + QRegExp searcher( pureDataSourceCandidate, Qt::CaseInsensitive, QRegExp::WildcardUnix ); + + for ( const auto& ds : dataSourceNames ) + { + if ( !foundDataSource && searcher.exactMatch( ds ) ) + { + dataSourceFilters.push_back( s ); + foundDataSource = true; + } + } + + if ( !foundDataSource ) + { + addressFilters.push_back( s ); + } + } +} diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.h b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.h new file mode 100644 index 0000000000..7f61965798 --- /dev/null +++ b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include + +class RimSummaryCase; +class RifEclipseSummaryAddress; + +class QString; +class QStringList; + +//================================================================================================== +// +//================================================================================================== +class RiaSummaryStringTools +{ +public: + static void splitAddressFiltersInGridAndSummary( RimSummaryCase* summaryCase, + const QStringList& addressFilters, + QStringList* summaryAddressFilters, + QStringList* gridResultAddressFilters ); + + static bool hasFilterAnyMatch( const QString& curveFilter, const std::set& summaryAddresses ); + + static void splitIntoAddressAndDataSourceFilters( const QStringList& filters, + const QStringList& dataSourceNames, + QStringList& addressFilters, + QStringList& dataSourceFilters ); +}; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index 96ff126b96..e3e05f508d 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -43,6 +43,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -90,6 +91,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryPlotManagerFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryPlotManagerFeature.cpp new file mode 100644 index 0000000000..5a85dc6da4 --- /dev/null +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryPlotManagerFeature.cpp @@ -0,0 +1,55 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicShowSummaryPlotManagerFeature.h" + +#include "RiaGuiApplication.h" +#include "RiuPlotMainWindow.h" + +#include + +CAF_CMD_SOURCE_INIT( RicShowSummaryPlotManagerFeature, "RicShowSummaryPlotManagerFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicShowSummaryPlotManagerFeature::isCommandEnabled() +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicShowSummaryPlotManagerFeature::onActionTriggered( bool isChecked ) +{ + RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); + if ( mpw ) + { + mpw->showAndSetKeyboardFocusToSummaryPlotManager(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicShowSummaryPlotManagerFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Show Summary Plot Manager" ); + applyShortcutWithHintToAction( actionToSetup, QKeySequence( tr( "Ctrl+K" ) ) ); +} diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryPlotManagerFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryPlotManagerFeature.h new file mode 100644 index 0000000000..20c91489da --- /dev/null +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryPlotManagerFeature.h @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicShowSummaryPlotManagerFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index dc46551c93..7c71deba0c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -26,6 +26,7 @@ #include "RiaImportEclipseCaseTools.h" #include "RiaLogging.h" #include "RiaPreferencesSummary.h" +#include "RiaSummaryStringTools.h" #include "RicCreateSummaryCaseCollectionFeature.h" #include "RicImportGeneralDataFeature.h" @@ -351,10 +352,10 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin RimSummaryPlotCollection* sumPlotColl = RimProject::current()->mainPlotCollection()->summaryPlotCollection(); - splitAddressFiltersInGridAndSummary( summaryCasesToUse[0], - allCurveAddressFilters, - &summaryAddressFilters, - &gridResultAddressFilters ); + RiaSummaryStringTools::splitAddressFiltersInGridAndSummary( summaryCasesToUse[0], + allCurveAddressFilters, + &summaryAddressFilters, + &gridResultAddressFilters ); if ( summaryAddressFilters.size() ) { @@ -702,42 +703,6 @@ std::vector RicSummaryPlotFeatureImpl::createMultipleSummaryPlo return newSummaryPlots; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicSummaryPlotFeatureImpl::splitAddressFiltersInGridAndSummary( RimSummaryCase* summaryCase, - const QStringList& addressFilters, - QStringList* summaryAddressFilters, - QStringList* gridResultAddressFilters ) -{ - if ( summaryCase ) - { - const std::set& addrs = summaryCase->summaryReader()->allResultAddresses(); - - QRegularExpression gridAddressPattern( "^[A-Z]+:[0-9]+,[0-9]+,[0-9]+$" ); - - for ( int filterIdx = 0; filterIdx < addressFilters.size(); ++filterIdx ) - { - const QString& address = addressFilters[filterIdx]; - if ( hasFilterAnyMatch( address, addrs ) ) - { - summaryAddressFilters->push_back( address ); - } - else - { - if ( gridAddressPattern.match( address ).hasMatch() ) - { - gridResultAddressFilters->push_back( address ); - } - else - { - RiaLogging::warning( "No summary or restart vectors matched \"" + address + "\"" ); - } - } - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -765,20 +730,6 @@ std::set return filteredAdressesFromCases; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicSummaryPlotFeatureImpl::hasFilterAnyMatch( const QString& curveFilter, - const std::set& summaryAddresses ) -{ - for ( const auto& addr : summaryAddresses ) - { - if ( addr.isUiTextMatchingFilterText( curveFilter ) ) return true; - } - - return false; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h index c5f307787f..21fdb66a35 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h @@ -93,8 +93,6 @@ class RicSummaryPlotFeatureImpl static RimSummaryCurve* createCurve( RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& address ); - static bool hasFilterAnyMatch( const QString& curveFilter, const std::set& summaryAddresses ); - static RimSummaryCurve* createHistoryCurve( const RifEclipseSummaryAddress& addr, RimSummaryCase* summaryCasesToUse ); static std::vector addCurvesFromAddressFiltersToPlot( const QStringList& curveFilters, @@ -105,11 +103,6 @@ class RicSummaryPlotFeatureImpl static std::set applySummaryAddressFiltersToCases( const std::vector& summaryCasesToUse, const QStringList& summaryAddressFilters ); - - static void splitAddressFiltersInGridAndSummary( RimSummaryCase* summaryCase, - const QStringList& addressFilters, - QStringList* summaryAddressFilters, - QStringList* gridResultAddressFilters ); }; #include "RigEclipseResultAddress.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index c71f5d4bb4..2eb11bc9a3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -19,6 +19,8 @@ #include "RimSummaryPlotManager.h" #include "RiaStdStringTools.h" +#include "RiaStringListSerializer.h" +#include "RiaSummaryStringTools.h" #include "RiaSummaryTools.h" #include "RifReaderEclipseSummary.h" @@ -35,9 +37,13 @@ #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" +#include "RiuPlotMainWindowTools.h" + #include "cafPdmObjectHandle.h" #include "cafPdmUiCheckBoxEditor.h" +#include "cafPdmUiComboBoxEditor.h" #include "cafPdmUiLabelEditor.h" +#include "cafPdmUiLineEditor.h" #include "cafPdmUiPushButtonEditor.h" #include "cafSelectionManager.h" @@ -53,13 +59,18 @@ RimSummaryPlotManager::RimSummaryPlotManager() CAF_PDM_InitObject( "Summary Plot Manager" ); CAF_PDM_InitFieldNoDefault( &m_summaryPlot, "SummaryPlot", "Summary Plot" ); - CAF_PDM_InitFieldNoDefault( &m_curveFilterText, "CurveFilterText", "Curve Filter Text" ); - CAF_PDM_InitFieldNoDefault( &m_curveCandidates, "CurveCandidates", "Candidates" ); + CAF_PDM_InitFieldNoDefault( &m_filterText, "FilterText", "Filter Text" ); + m_filterText.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); + + CAF_PDM_InitFieldNoDefault( &m_addressCandidates, "AddressCandidates", "Vectors" ); + m_addressCandidates.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); + CAF_PDM_InitFieldNoDefault( &m_dataSourceCandidates, "DataSourceCandidates", "Data Sources" ); + m_dataSourceCandidates.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); CAF_PDM_InitField( &m_includeDiffCurves, "IncludeDiffCurves", - true, - "Include Difference Curves", + false, + "Include Difference Vectors", "", "Difference between simulated and observed(history) curve", "" ); @@ -87,6 +98,14 @@ RimSummaryPlotManager::RimSummaryPlotManager() m_labelB.xmlCapability()->disableIO(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::setFocusToFilterText() +{ + setFocusToEditorWidget( m_filterText.uiCapability() ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -102,24 +121,28 @@ void RimSummaryPlotManager::fieldChangedByUi( const caf::PdmFieldHandle* changed const QVariant& oldValue, const QVariant& newValue ) { - if ( changedField == &m_curveFilterText || changedField == &m_includeDiffCurves ) + if ( changedField == &m_summaryPlot || changedField == &m_filterText || changedField == &m_includeDiffCurves ) { updateCurveCandidates(); + updateDataSourceCandidates(); } else if ( changedField == &m_pushButtonReplace ) { replaceCurves(); m_pushButtonReplace = false; + updateFilterTextHistory(); } else if ( changedField == &m_pushButtonNewPlot ) { createNewPlot(); m_pushButtonNewPlot = false; + updateFilterTextHistory(); } else if ( changedField == &m_pushButtonAppend ) { appendCurves(); m_pushButtonAppend = false; + updateFilterTextHistory(); } } @@ -136,6 +159,16 @@ QList coll->summaryPlotItemInfos( &options ); } + if ( fieldNeedingOptions == &m_filterText ) + { + RiaStringListSerializer stringListSerializer( curveFilterRecentlyUsedRegistryKey() ); + + for ( const auto& s : stringListSerializer.textStrings() ) + { + options.push_back( caf::PdmOptionItemInfo( s, s ) ); + } + } + return options; } @@ -144,28 +177,97 @@ QList //-------------------------------------------------------------------------------------------------- void RimSummaryPlotManager::updateCurveCandidates() { - m_curveCandidates.value().clear(); + std::vector curveCandidates; + + auto addresses = filteredAddresses(); + + for ( const auto& adr : addresses ) + { + curveCandidates.push_back( QString::fromStdString( adr.uiText() ) ); + } + + m_addressCandidates = curveCandidates; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::updateDataSourceCandidates() +{ + std::vector dataSourceDisplayNames; - if ( !m_summaryPlot ) return; + std::vector> dataSourceCandidates = findDataSourceCandidates(); + for ( const auto& candidate : dataSourceCandidates ) + { + dataSourceDisplayNames.push_back( candidate.first ); + } - auto curves = m_summaryPlot->summaryAndEnsembleCurves(); - if ( curves.empty() ) return; + m_dataSourceCandidates = dataSourceDisplayNames; +} - auto firstSource = curves.front()->summaryCaseY(); - if ( !firstSource ) return; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector> RimSummaryPlotManager::findDataSourceCandidates() const +{ + std::vector> candidates; - std::set addressesFromSources = addressesForSource( firstSource ); - QStringList addressFilters = m_curveFilterText().split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); + QStringList addressFilters; + QStringList dataSourceFilters; + splitIntoAddressAndDataSourceFilters( addressFilters, dataSourceFilters ); - auto addresses = computeFilteredAddresses( addressFilters, addressesFromSources ); + // If no filter on data source is specified, use wildcard to match all + if ( dataSourceFilters.empty() ) dataSourceFilters.push_back( "*" ); - std::vector curveCandidates; - for ( const auto& adr : addresses ) + auto [summaryCases, ensembles] = allDataSourcesInProject(); + + for ( const auto& dsFilter : dataSourceFilters ) { - curveCandidates.push_back( QString::fromStdString( adr.uiText() ) ); + QString searchString = dsFilter.left( dsFilter.indexOf( ':' ) ); + QRegExp searcher( searchString, Qt::CaseInsensitive, QRegExp::WildcardUnix ); + + for ( const auto& ensemble : ensembles ) + { + auto ensembleName = ensemble->name(); + if ( searcher.exactMatch( ensembleName ) ) + { + if ( searchString == dsFilter ) + { + // Match on ensemble name without realization filter + + candidates.push_back( std::make_pair( ensembleName, ensemble ) ); + } + else + { + // Match on subset of realisations in ensemble + + QString realizationSearchString = dsFilter.right( dsFilter.size() - dsFilter.indexOf( ':' ) - 1 ); + QRegExp realizationSearcher( realizationSearchString, Qt::CaseInsensitive, QRegExp::WildcardUnix ); + + for ( const auto& summaryCase : ensemble->allSummaryCases() ) + { + auto realizationName = summaryCase->displayCaseName(); + if ( realizationSearcher.exactMatch( realizationName ) ) + { + QString displayName = ensembleName + ":" + realizationName; + candidates.push_back( std::make_pair( displayName, summaryCase ) ); + } + } + } + } + } + + for ( const auto& summaryCase : summaryCases ) + { + auto summaryCaseName = summaryCase->displayCaseName(); + if ( searcher.exactMatch( summaryCaseName ) ) + { + candidates.push_back( std::make_pair( summaryCase->displayCaseName(), summaryCase ) ); + } + } } - m_curveCandidates = curveCandidates; + return candidates; } //-------------------------------------------------------------------------------------------------- @@ -203,23 +305,34 @@ void RimSummaryPlotManager::defineEditorAttribute( const caf::PdmFieldHandle* fi caf::PdmUiEditorAttribute* attribute ) { { - auto myAttr = dynamic_cast( attribute ); - if ( myAttr ) + auto attr = dynamic_cast( attribute ); + if ( attr ) { if ( field == &m_pushButtonReplace ) { - myAttr->m_buttonText = "Replace Curves \n(Ctrl + Enter)"; + attr->m_buttonText = "Replace Curves \n(Ctrl + Enter)"; } if ( field == &m_pushButtonNewPlot ) { - myAttr->m_buttonText = "Create New Plot \n(Alt + Enter)"; + attr->m_buttonText = "Create New Plot \n(Alt + Enter)"; } if ( field == &m_pushButtonAppend ) { - myAttr->m_buttonText = "Append Curves \n(Shift + Enter)"; + attr->m_buttonText = "Append Curves \n(Shift + Enter)"; } } } + + if ( field == &m_filterText ) + { + auto attr = dynamic_cast( attribute ); + if ( attr ) + { + attr->enableEditableContent = true; + attr->adjustWidthToContents = true; + attr->notifyWhenTextIsEdited = true; + } + } } //-------------------------------------------------------------------------------------------------- @@ -229,15 +342,15 @@ void RimSummaryPlotManager::defineUiOrdering( QString uiConfigName, caf::PdmUiOr { uiOrdering.add( &m_summaryPlot ); - // uiOrdering.add( &m_labelA ); uiOrdering.add( &m_includeDiffCurves ); - uiOrdering.add( &m_curveFilterText ); - uiOrdering.add( &m_curveCandidates ); + uiOrdering.add( &m_filterText ); + uiOrdering.add( &m_addressCandidates ); + uiOrdering.add( &m_dataSourceCandidates, false ); - uiOrdering.add( &m_labelB ); - uiOrdering.add( &m_pushButtonAppend, { false } ); + uiOrdering.add( &m_pushButtonAppend ); uiOrdering.add( &m_pushButtonReplace, { false } ); + uiOrdering.add( &m_labelB, { false } ); uiOrdering.add( &m_pushButtonNewPlot, { false } ); } @@ -260,6 +373,8 @@ void RimSummaryPlotManager::replaceCurves() destinationPlot->deleteAllSummaryCurves(); destinationPlot->ensembleCurveSetCollection()->deleteAllCurveSets(); + RiuPlotMainWindowTools::selectAsCurrentItem( destinationPlot ); + appendCurvesToPlot( destinationPlot ); } @@ -292,6 +407,11 @@ bool RimSummaryPlotManager::eventFilter( QObject* obj, QEvent* event ) replaceCurves(); else if ( mods & Qt::AltModifier ) createNewPlot(); + else if ( mods == Qt::NoModifier ) + { + updateCurveCandidates(); + updateDataSourceCandidates(); + } } } @@ -301,7 +421,8 @@ bool RimSummaryPlotManager::eventFilter( QObject* obj, QEvent* event ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::pair, std::vector> RimSummaryPlotManager::dataSources() const +std::pair, std::vector> + RimSummaryPlotManager::allDataSourcesInProject() const { auto sumCaseMainColl = RiaSummaryTools::summaryCaseMainCollection(); @@ -324,8 +445,18 @@ void RimSummaryPlotManager::updateUiFromSelection() if ( m_summaryPlot != summaryPlot ) { m_summaryPlot = summaryPlot; + if ( summaryPlot ) + { + updateCurveCandidates(); + updateDataSourceCandidates(); + } + else + { + std::vector tmp; + m_addressCandidates = tmp; + m_dataSourceCandidates = tmp; + } updateConnectedEditors(); - updateCurveCandidates(); } } @@ -334,24 +465,25 @@ void RimSummaryPlotManager::updateUiFromSelection() //-------------------------------------------------------------------------------------------------- std::set RimSummaryPlotManager::filteredAddresses() { - auto [summaryCases, ensembles] = dataSources(); - - std::set allAddressesFromSource; + std::vector summaryCases; + std::vector ensembles; + findFilteredSummaryCasesAndEnsembles( summaryCases, ensembles ); + std::set nativeAddresses; if ( !summaryCases.empty() ) { - allAddressesFromSource = addressesForSource( summaryCases.front() ); + nativeAddresses = addressesForSource( summaryCases.front() ); } else if ( !ensembles.empty() ) { - allAddressesFromSource = addressesForSource( ensembles.front() ); + nativeAddresses = addressesForSource( ensembles.front() ); } - if ( allAddressesFromSource.empty() ) return {}; + if ( nativeAddresses.empty() ) return {}; - QStringList allCurveAddressFilters = m_curveFilterText().split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); + QStringList allCurveAddressFilters = m_filterText().split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); - return computeFilteredAddresses( allCurveAddressFilters, allAddressesFromSource ); + return computeFilteredAddresses( allCurveAddressFilters, nativeAddresses ); } //-------------------------------------------------------------------------------------------------- @@ -437,7 +569,9 @@ void RimSummaryPlotManager::appendCurvesToPlot( RimSummaryPlot* destinationPlot { CAF_ASSERT( destinationPlot ); - auto [summaryCases, ensembles] = dataSources(); + std::vector summaryCases; + std::vector ensembles; + findFilteredSummaryCasesAndEnsembles( summaryCases, ensembles ); std::set filteredAddressesFromSource = filteredAddresses(); appendCurvesToPlot( destinationPlot, filteredAddressesFromSource, summaryCases, ensembles ); @@ -447,7 +581,21 @@ void RimSummaryPlotManager::appendCurvesToPlot( RimSummaryPlot* destinationPlot RiaSummaryTools::summaryPlotCollection()->updateConnectedEditors(); - setFocusToEditorWidget( m_curveFilterText.uiCapability() ); + updateFilterTextHistory(); + m_filterText.uiCapability()->updateConnectedEditors(); + + setFocusToFilterText(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::updateFilterTextHistory() +{ + RiaStringListSerializer stringListSerializer( curveFilterRecentlyUsedRegistryKey() ); + + int maxItemCount = 10; + stringListSerializer.addString( m_filterText, maxItemCount ); } //-------------------------------------------------------------------------------------------------- @@ -472,3 +620,61 @@ void RimSummaryPlotManager::setFocusToEditorWidget( caf::PdmUiFieldHandle* uiFie } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::splitIntoAddressAndDataSourceFilters( QStringList& addressFilters, + QStringList& dataSourceFilters ) const +{ + QStringList filterItems = m_filterText().split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); + + auto [summaryCases, ensembles] = allDataSourcesInProject(); + + QStringList dataSourceNames; + for ( const auto& summaryCase : summaryCases ) + { + dataSourceNames.push_back( summaryCase->displayCaseName() ); + } + + for ( const auto& ensemble : ensembles ) + { + dataSourceNames.push_back( ensemble->name() ); + } + + RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( filterItems, + dataSourceNames, + addressFilters, + dataSourceFilters ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::findFilteredSummaryCasesAndEnsembles( std::vector& summaryCases, + std::vector& ensembles ) const +{ + auto filteredDataSources = findDataSourceCandidates(); + for ( const auto& ds : filteredDataSources ) + { + auto summaryCase = dynamic_cast( ds.second ); + if ( summaryCase ) + { + summaryCases.push_back( summaryCase ); + } + + auto ensemble = dynamic_cast( ds.second ); + if ( ensemble ) + { + ensembles.push_back( ensemble ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryPlotManager::curveFilterRecentlyUsedRegistryKey() +{ + return "SummaryPlotManagerCurveFilterStrings"; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h index cbf21c6add..870aac4aff 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h @@ -39,6 +39,8 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: public: RimSummaryPlotManager(); + void setFocusToFilterText(); + private: void appendCurves(); void replaceCurves(); @@ -60,15 +62,19 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: bool eventFilter( QObject* obj, QEvent* event ) override; void updateCurveCandidates(); + void updateDataSourceCandidates(); + + std::vector> findDataSourceCandidates() const; std::set computeFilteredAddresses( const QStringList& textFilters, const std::set& sourceAddresses ); - std::pair, std::vector> dataSources() const; + std::pair, std::vector> allDataSourcesInProject() const; void updateUiFromSelection(); std::set filteredAddresses(); void appendCurvesToPlot( RimSummaryPlot* destinationPlot ); + void updateFilterTextHistory(); // Static helper functions static std::set addressesForSource( caf::PdmObject* summarySource ); @@ -83,11 +89,18 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: static void setFocusToEditorWidget( caf::PdmUiFieldHandle* uiFieldHandle ); + void splitIntoAddressAndDataSourceFilters( QStringList& addressFilters, QStringList& dataSourceFilters ) const; + void findFilteredSummaryCasesAndEnsembles( std::vector& summaryCases, + std::vector& ensembles ) const; + + static QString curveFilterRecentlyUsedRegistryKey(); + private: caf::PdmPtrField m_summaryPlot; - caf::PdmField m_curveFilterText; - caf::PdmField> m_curveCandidates; + caf::PdmField m_filterText; + caf::PdmField> m_addressCandidates; + caf::PdmField> m_dataSourceCandidates; caf::PdmField m_includeDiffCurves; diff --git a/ApplicationLibCode/UnitTests/CMakeLists_files.cmake b/ApplicationLibCode/UnitTests/CMakeLists_files.cmake index 7ab65025b3..0ab5ec9bc5 100644 --- a/ApplicationLibCode/UnitTests/CMakeLists_files.cmake +++ b/ApplicationLibCode/UnitTests/CMakeLists_files.cmake @@ -81,6 +81,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/StructGridInterface-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/opm-summary-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RifEclipseTextFileReader-Test.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryStringTools-Test.cpp ) if(RESINSIGHT_ENABLE_GRPC) diff --git a/ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp b/ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp new file mode 100644 index 0000000000..983cfdcad2 --- /dev/null +++ b/ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp @@ -0,0 +1,52 @@ +#include "gtest/gtest.h" + +#include "RiaSummaryStringTools.h" + +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( RiaSummaryStringToolsTest, ParseNumbers ) +{ + QString wellFilter = "wopt:op_*"; + QString fieldFilter = "fopt"; + QStringList dataSourceNames = { "iter-1", "iter-22", "real-10", "real-11" }; + + { + QString dataSourceFilter = "iter-1"; + QStringList arguments = { wellFilter, fieldFilter, dataSourceFilter }; + + QStringList addressFilters; + QStringList dataSourceFilters; + + RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( arguments, + dataSourceNames, + addressFilters, + dataSourceFilters ); + + EXPECT_TRUE( addressFilters[0] == wellFilter ); + EXPECT_TRUE( addressFilters[1] == fieldFilter ); + + EXPECT_TRUE( dataSourceFilters[0] == dataSourceFilter ); + } + + { + QString dataSourceFilter = "iter-22:real-2*"; + QStringList arguments = { wellFilter, fieldFilter, dataSourceFilter }; + + QStringList addressFilters; + QStringList dataSourceFilters; + + RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( arguments, + dataSourceNames, + addressFilters, + dataSourceFilters ); + + EXPECT_TRUE( addressFilters[0] == wellFilter ); + EXPECT_TRUE( addressFilters[1] == fieldFilter ); + + EXPECT_TRUE( dataSourceFilters[0] == dataSourceFilter ); + } +} diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index fff0b9649c..f53a356257 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -103,9 +103,9 @@ QString RiuDockWidgetTools::undoStackName() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiuDockWidgetTools::summaryCurveManagerName() +QString RiuDockWidgetTools::summaryPlotManagerName() { - return "dockSummaryCurveManager"; + return "dockSummaryPlotManager"; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index 1a87b80aeb..b7a58c1084 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -46,7 +46,7 @@ class RiuDockWidgetTools static QString messagesName(); static QString mohrsCirclePlotName(); static QString undoStackName(); - static QString summaryCurveManagerName(); + static QString summaryPlotManagerName(); static QString plotMainWindowProjectTreeName(); static QString plotMainWindowPropertyEditorName(); @@ -66,9 +66,9 @@ class RiuDockWidgetTools static void setDockWidgetVisibility( const QObject* parent, const QString& dockWidgetName, bool isVisible ); static void applyDockWidgetVisibilities( const QObject* parent, const QMap& visibilityMap ); + static QDockWidget* findDockWidget( const QObject* parent, const QString& dockWidgetName ); + private: static QMap widgetVisibilitiesForEclipse(); static QMap widgetVisibilitiesForGeoMech(); - - static QDockWidget* findDockWidget( const QObject* parent, const QString& dockWidgetName ); }; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 1102d4fc3d..f1bbe2b991 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -106,7 +106,7 @@ RiuPlotMainWindow::RiuPlotMainWindow() //-------------------------------------------------------------------------------------------------- RiuPlotMainWindow::~RiuPlotMainWindow() { - m_summaryCurveManagerView->showProperties( nullptr ); + m_summaryPlotManagerView->showProperties( nullptr ); setPdmRoot( nullptr ); } @@ -502,17 +502,17 @@ void RiuPlotMainWindow::createDockPanels() } { - QDockWidget* dockWidget = new QDockWidget( "Curve Manager", this ); - dockWidget->setObjectName( RiuDockWidgetTools::summaryCurveManagerName() ); + QDockWidget* dockWidget = new QDockWidget( "Plot Manager", this ); + dockWidget->setObjectName( RiuDockWidgetTools::summaryPlotManagerName() ); - m_summaryCurveManagerView = new caf::PdmUiPropertyView( dockWidget ); + m_summaryPlotManagerView = new caf::PdmUiPropertyView( dockWidget ); - auto curveManager = std::make_unique(); - m_summaryCurveManagerView->showProperties( curveManager.get() ); - m_summaryCurveManagerView->installEventFilter( curveManager.get() ); - m_summaryCurveManager = std::move( curveManager ); + auto plotManager = std::make_unique(); + m_summaryPlotManagerView->showProperties( plotManager.get() ); + m_summaryPlotManagerView->installEventFilter( plotManager.get() ); + m_summaryPlotManager = std::move( plotManager ); - dockWidget->setWidget( m_summaryCurveManagerView ); + dockWidget->setWidget( m_summaryPlotManagerView ); addDockWidget( Qt::BottomDockWidgetArea, dockWidget ); dockWidget->hide(); } @@ -751,6 +751,24 @@ RiuMessagePanel* RiuPlotMainWindow::messagePanel() return m_messagePanel; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindow::showAndSetKeyboardFocusToSummaryPlotManager() +{ + auto dockWidget = RiuDockWidgetTools::findDockWidget( this, RiuDockWidgetTools::summaryPlotManagerName() ); + if ( dockWidget ) + { + dockWidget->setVisible( true ); + + auto sumPlotManager = dynamic_cast( m_summaryPlotManager.get() ); + if ( sumPlotManager ) + { + sumPlotManager->setFocusToFilterText(); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 9e29310fa2..046ebc6599 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -94,6 +94,8 @@ class RiuPlotMainWindow : public RiuMainWindowBase RiuMessagePanel* messagePanel(); + void showAndSetKeyboardFocusToSummaryPlotManager(); + protected: void closeEvent( QCloseEvent* event ) override; void keyPressEvent( QKeyEvent* ) override; @@ -137,11 +139,11 @@ private slots: std::unique_ptr m_dragDropInterface; caf::PdmUiPropertyView* m_pdmUiPropertyView; - caf::PdmUiPropertyView* m_summaryCurveManagerView; + caf::PdmUiPropertyView* m_summaryPlotManagerView; QPointer m_summaryCurveCreatorDialog; QPointer m_summaryCurveCalculatorDialog; - std::unique_ptr m_summaryCurveManager; + std::unique_ptr m_summaryPlotManager; std::vector m_temporaryWidgets; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp index 9953ce71d8..bc3d3a7f93 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp @@ -494,6 +494,9 @@ QWidget* PdmUiComboBoxEditor::createEditorWidget( QWidget* parent ) connect( m_comboBox, SIGNAL( activated( int ) ), this, SLOT( slotIndexActivated( int ) ) ); + // Forward focus event to combo box editor + m_placeholder->setFocusProxy( m_comboBox ); + return m_placeholder; } From 79058fe122ae6688375b695a606ff0f6b4b193d7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 24 Nov 2021 08:53:33 +0100 Subject: [PATCH 016/406] #8313 Ensemble import: Avoid log message when no h5-file is found --- .../FileInterface/RifReaderEclipseSummary.cpp | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp index c4cdf56630..d27eaf034c 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp @@ -85,15 +85,11 @@ bool RifReaderEclipseSummary::open( const QString& headerFileName, RiaThreadSafe if ( prefSummary->summaryDataReader() == RiaPreferencesSummary::SummaryReaderMode::HDF5_OPM_COMMON || prefSummary->summaryDataReader() == RiaPreferencesSummary::SummaryReaderMode::OPM_COMMON ) { - bool h5FileFound = false; - { - QFileInfo fi( headerFileName ); - QString basenameNoExtension = fi.absolutePath() + "/" + fi.baseName(); - - QString h5FileName = basenameNoExtension + ".h5"; + QFileInfo fi( headerFileName ); + QString basenameNoExtension = fi.absolutePath() + "/" + fi.baseName(); + QString h5FileName = basenameNoExtension + ".h5"; - h5FileFound = QFile::exists( h5FileName ); - } + bool h5FileFound = QFile::exists( h5FileName ); if ( h5FileFound || ( prefSummary->summaryDataReader() == RiaPreferencesSummary::SummaryReaderMode::HDF5_OPM_COMMON ) ) @@ -101,27 +97,28 @@ bool RifReaderEclipseSummary::open( const QString& headerFileName, RiaThreadSafe #ifdef USE_HDF5 if ( prefSummary->createH5SummaryDataFiles() ) { - QFileInfo fi( headerFileName ); - QString h5FilenameCandidate = fi.absolutePath() + "/" + fi.baseName() + ".h5"; - size_t createdH5FileCount = 0; RifHdf5SummaryExporter::ensureHdf5FileIsCreated( headerFileName.toStdString(), - h5FilenameCandidate.toStdString(), + h5FileName.toStdString(), createdH5FileCount ); if ( createdH5FileCount > 0 ) { - QString txt = QString( "Created %1 " ).arg( h5FilenameCandidate ); + QString txt = QString( "Created %1 " ).arg( h5FileName ); if ( threadSafeLogger ) threadSafeLogger->info( txt ); } + h5FileFound = QFile::exists( h5FileName ); } - auto hdfReader = std::make_unique(); - - isValid = hdfReader->open( headerFileName, false, threadSafeLogger ); - if ( isValid ) + if ( h5FileFound ) { - m_summaryReader = std::move( hdfReader ); + auto hdfReader = std::make_unique(); + + isValid = hdfReader->open( headerFileName, false, threadSafeLogger ); + if ( isValid ) + { + m_summaryReader = std::move( hdfReader ); + } } #endif } From 14ae17264766515095355da072f7bb1637062dc1 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 23 Nov 2021 08:52:23 +0100 Subject: [PATCH 017/406] #8237 Make sure fracture location is recomputed during copy/paste --- .../RicPasteModeledWellPathFeature.cpp | 52 +++++++++++++------ .../RicPasteModeledWellPathFeature.h | 4 +- 2 files changed, 38 insertions(+), 18 deletions(-) diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp index 0d1e758b53..5dd78516c3 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.cpp @@ -27,6 +27,7 @@ CAF_CMD_SOURCE_INIT( RicPasteModeledWellPathFeature, "RicPasteModeledWellPathFea #include "RimProject.h" #include "RimTools.h" #include "RimWellPathCollection.h" +#include "RimWellPathFracture.h" #include "RimWellPathTieIn.h" #include "Riu3DMainWindowTools.h" @@ -73,16 +74,9 @@ void RicPasteModeledWellPathFeature::onActionTriggered( bool isChecked ) RimModeledWellPath* wellPathToSelect = nullptr; for ( auto sourceWellPath : modeledWellPathsFromClipboard() ) { - RimModeledWellPath* destinationWellPath = dynamic_cast( - sourceWellPath->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + auto destinationWellPath = duplicateAndInitializeWellPath( sourceWellPath ); - QString name = sourceWellPath->name() + " (copy)"; - destinationWellPath->setName( name ); - - wellPathCollection->addWellPath( destinationWellPath, false ); wellPathToSelect = destinationWellPath; - - duplicateLaterals( sourceWellPath, destinationWellPath ); } RimTools::wellPathCollection()->rebuildWellPathNodes(); @@ -128,7 +122,7 @@ std::vector RicPasteModeledWellPathFeature::modeledWellPath //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicPasteModeledWellPathFeature::duplicateLaterals( RimModeledWellPath* source, RimModeledWellPath* destination ) +void RicPasteModeledWellPathFeature::duplicateLaterals( const RimModeledWellPath* source, RimModeledWellPath* destination ) { auto wpc = RimTools::wellPathCollection(); @@ -140,16 +134,42 @@ void RicPasteModeledWellPathFeature::duplicateLaterals( RimModeledWellPath* sour auto sourceLateral = dynamic_cast( lateral ); if ( !sourceLateral ) continue; - auto* destinationLateral = dynamic_cast( - sourceLateral->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + auto destinationLateral = duplicateAndInitializeWellPath( sourceLateral ); - QString name = sourceLateral->name() + " (copy)"; - destinationLateral->setName( name ); + destinationLateral->connectWellPaths( destination, sourceLateral->wellPathTieIn()->tieInMeasuredDepth() ); + } +} - wpc->addWellPath( destinationLateral, false ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimModeledWellPath* RicPasteModeledWellPathFeature::duplicateAndInitializeWellPath( const RimModeledWellPath* sourceWellPath ) +{ + if ( !sourceWellPath ) return nullptr; - destinationLateral->connectWellPaths( destination, sourceLateral->wellPathTieIn()->tieInMeasuredDepth() ); + auto wpc = RimTools::wellPathCollection(); + + auto* destinationWellPath = dynamic_cast( + sourceWellPath->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + + QString name = sourceWellPath->name() + " (copy)"; + destinationWellPath->setName( name ); + + wpc->addWellPath( destinationWellPath, false ); + + // Resolve references, will connect to the fracture template + destinationWellPath->resolveReferencesRecursively(); - duplicateLaterals( sourceLateral, destinationLateral ); + std::vector wellPathFractures; + destinationWellPath->descendantsIncludingThisOfType( wellPathFractures ); + destinationWellPath->createWellPathGeometry(); + + for ( auto fracture : wellPathFractures ) + { + fracture->loadDataAndUpdate(); } + + duplicateLaterals( sourceWellPath, destinationWellPath ); + + return destinationWellPath; } diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.h b/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.h index ce6e553365..d3bbba774e 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicPasteModeledWellPathFeature.h @@ -35,6 +35,6 @@ class RicPasteModeledWellPathFeature : public caf::CmdFeature private: static std::vector modeledWellPathsFromClipboard(); - - void duplicateLaterals( RimModeledWellPath* source, RimModeledWellPath* destination ); + static void duplicateLaterals( const RimModeledWellPath* source, RimModeledWellPath* destination ); + static RimModeledWellPath* duplicateAndInitializeWellPath( const RimModeledWellPath* source ); }; From 9b42bf7cfca7c143133caa7365d6be9ee6b2d979 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 23 Nov 2021 09:40:54 +0100 Subject: [PATCH 018/406] #8314 Ensemble import: Perform file search only on "Find" button Automatic search when input changes can be time consuming and confusing. --- ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp b/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp index f3a251f36f..9bfdc8968f 100644 --- a/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp +++ b/ApplicationLibCode/Commands/RicRecursiveFileSearchDialog.cpp @@ -208,8 +208,6 @@ RicRecursiveFileSearchDialog::RicRecursiveFileSearchDialog( QWidget* parent, con connect( m_browseButton, SIGNAL( clicked() ), this, SLOT( slotBrowseButtonClicked() ) ); - connect( m_ensembleGroupingMode, SIGNAL( currentIndexChanged( int ) ), this, SLOT( slotFindOrCancelButtonClicked() ) ); - connect( m_findOrCancelButton, SIGNAL( clicked() ), this, SLOT( slotFindOrCancelButtonClicked() ) ); connect( m_buttons, SIGNAL( accepted() ), this, SLOT( slotDialogOkClicked() ) ); @@ -725,8 +723,6 @@ void RicRecursiveFileSearchDialog::slotPathFilterChanged( const QString& text ) updateEffectiveFilter(); warningIfInvalidCharacters(); m_findOrCancelButton->setDefault( true ); - - slotFindOrCancelButtonClicked(); } //-------------------------------------------------------------------------------------------------- From 2b6767c328b946dedf2f8d63bc5e26ec5bb2717c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 23 Nov 2021 10:19:15 +0100 Subject: [PATCH 019/406] #8312 2D/3D Intersections: Fix missing display of polyline --- .../RivExtrudedCurveIntersectionGeometryGenerator.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp index 0fcd42c618..95f8b403a7 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp @@ -149,13 +149,15 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateTransformedPolyline for ( size_t lineIdx = 0; lineIdx < m_polylines.size(); ++lineIdx ) { - auto flatPolyline = m_transformedPolyLines.emplace_back(); - const auto& polyline = m_polylines[lineIdx]; + std::vector flatPolyline; + const auto& polyline = m_polylines[lineIdx]; for ( size_t index = 0; index < polyline.size(); ++index ) { flatPolyline.push_back( transformPointByPolylineSegmentIndex( polyline[index], lineIdx, index ) ); } + + m_transformedPolyLines.emplace_back( flatPolyline ); } } From 917748e1a4e40c4efcf83543f9ece8fb1efdf719 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 23 Nov 2021 14:30:46 +0100 Subject: [PATCH 020/406] #8294 Export Well Path: Error in MD description For file well paths, always use text MDRKB For modeled well paths use MDMSL if airgap is zero, otherwise MDRKB --- .../RigWellPathGeometryExporter.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.cpp index 83f0edfe3e..872b8b177d 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.cpp @@ -20,6 +20,7 @@ #include "RigWellPath.h" +#include "RimFileWellPath.h" #include "RimModeledWellPath.h" #include "RimWellPath.h" #include "RimWellPathGeometryDef.h" @@ -40,21 +41,28 @@ void RigWellPathGeometryExporter::exportWellPathGeometry( gsl::not_nulltopLevelWellPath(); - const RimModeledWellPath* modeledWellPath = - dynamic_cast( wellPath.get()->topLevelWellPath() ); + // Always use top level modeled well path for definitions MD at first coordinate + const RimModeledWellPath* modeledWellPath = dynamic_cast( topLevelWellPath ); if ( modeledWellPath ) { - useMdRkb = true; if ( modeledWellPath->geometryDefinition()->airGap() != 0.0 ) { + useMdRkb = true; rkbOffset = modeledWellPath->geometryDefinition()->airGap(); } } + + if ( dynamic_cast( topLevelWellPath ) ) + { + useMdRkb = true; + } } + exportWellPathGeometry( *wellPathGeom, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues ); } From 88ca478babc0b1f824776836e19447585df0e7ae Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 23 Nov 2021 14:55:54 +0100 Subject: [PATCH 021/406] Janitor : Rename variable and function names --- .../RicExportSelectedWellPathsFeature.cpp | 30 ++++++++++----- .../RicExportSelectedWellPathsFeature.h | 4 +- .../RifStimPlanModelDeviationFrkExporter.cpp | 12 ++++-- .../RigWellPathGeometryExporter.cpp | 38 +++++++++---------- .../RigWellPathGeometryExporter.h | 28 +++++++------- .../RigWellPathGeometryExporter-Test.cpp | 8 +++- 6 files changed, 72 insertions(+), 48 deletions(-) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp index 18cd995f7b..47bf6e2bbd 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.cpp @@ -65,10 +65,16 @@ void RicExportSelectedWellPathsFeature::exportWellPath( gsl::not_null tvdValues; std::vector mdValues; - bool useMdRkb = false; - RigWellPathGeometryExporter::exportWellPathGeometry( wellPath, mdStepSize, xValues, yValues, tvdValues, mdValues, useMdRkb ); - - writeWellPathGeometryToStream( *stream, wellPath->name(), xValues, yValues, tvdValues, mdValues, useMdRkb, writeProjectInfo ); + bool showTextMdRkb = false; + RigWellPathGeometryExporter::computeWellPathDataForExport( wellPath, + mdStepSize, + xValues, + yValues, + tvdValues, + mdValues, + showTextMdRkb ); + + writeWellPathGeometryToStream( *stream, wellPath->name(), xValues, yValues, tvdValues, mdValues, showTextMdRkb, writeProjectInfo ); filePtr->close(); RiaLogging::info( QString( "Exported well geometry to %1" ).arg( filePtr->fileName() ) ); @@ -81,7 +87,7 @@ void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream( QTextStre const RigWellPath& wellPathGeom, const QString& exportName, double mdStepSize, - bool useMdRkb, + bool showTextMdRkb, double rkbOffset, bool writeProjectInfo ) { @@ -90,8 +96,14 @@ void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream( QTextStre std::vector tvdValues; std::vector mdValues; - RigWellPathGeometryExporter::exportWellPathGeometry( wellPathGeom, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues ); - writeWellPathGeometryToStream( stream, exportName, xValues, yValues, tvdValues, mdValues, useMdRkb, writeProjectInfo ); + RigWellPathGeometryExporter::computeWellPathDataForExport( wellPathGeom, + mdStepSize, + rkbOffset, + xValues, + yValues, + tvdValues, + mdValues ); + writeWellPathGeometryToStream( stream, exportName, xValues, yValues, tvdValues, mdValues, showTextMdRkb, writeProjectInfo ); } //-------------------------------------------------------------------------------------------------- @@ -103,7 +115,7 @@ void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream( QTextStre const std::vector& yValues, const std::vector& tvdValues, const std::vector& mdValues, - bool useMdRkb, + bool showTextMdRkb, bool writeProjectInfo ) { RifTextDataTableFormatter formatter( stream ); @@ -124,7 +136,7 @@ void RicExportSelectedWellPathsFeature::writeWellPathGeometryToStream( QTextStre formatter.header( { { "X", numberFormat, RIGHT }, { "Y", numberFormat, RIGHT }, { "TVDMSL", numberFormat, RIGHT }, - { useMdRkb ? "MDRKB" : "MDMSL", numberFormat, RIGHT } } ); + { showTextMdRkb ? "MDRKB" : "MDMSL", numberFormat, RIGHT } } ); for ( size_t i = 0; i < xValues.size(); i++ ) { diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h index c169cebf2b..985a25fd5d 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportSelectedWellPathsFeature.h @@ -65,7 +65,7 @@ class RicExportSelectedWellPathsFeature : public caf::CmdFeature const RigWellPath& wellPath, const QString& exportName, double mdStepSize, - bool useMdRkb, + bool showTextMdRkb, double rkbOffset, bool writeProjectInfo ); @@ -76,7 +76,7 @@ class RicExportSelectedWellPathsFeature : public caf::CmdFeature const std::vector& yValues, const std::vector& tvdValues, const std::vector& mdValues, - bool useMdRkb, + bool showTextMdRkb, bool writeProjectInfo ); bool isCommandEnabled() override; diff --git a/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp b/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp index a1120f8f8e..d22e3416ce 100644 --- a/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp +++ b/ApplicationLibCode/FileInterface/RifStimPlanModelDeviationFrkExporter.cpp @@ -48,13 +48,19 @@ bool RifStimPlanModelDeviationFrkExporter::writeToFile( RimStimPlanModel* stimPl QTextStream stream( &data ); appendHeaderToStream( stream ); - bool useMdRkb = false; - double mdStepSize = 5.0; + bool showTextMdRkb = false; + double mdStepSize = 5.0; std::vector xValues; std::vector yValues; std::vector tvdValues; std::vector mdValues; - RigWellPathGeometryExporter::exportWellPathGeometry( wellPath, mdStepSize, xValues, yValues, tvdValues, mdValues, useMdRkb ); + RigWellPathGeometryExporter::computeWellPathDataForExport( wellPath, + mdStepSize, + xValues, + yValues, + tvdValues, + mdValues, + showTextMdRkb ); convertFromMeterToFeet( mdValues ); convertFromMeterToFeet( tvdValues ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.cpp index 872b8b177d..313500285a 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.cpp @@ -28,18 +28,18 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigWellPathGeometryExporter::exportWellPathGeometry( gsl::not_null wellPath, - double mdStepSize, - std::vector& xValues, - std::vector& yValues, - std::vector& tvdValues, - std::vector& mdValues, - bool& useMdRkb ) +void RigWellPathGeometryExporter::computeWellPathDataForExport( gsl::not_null wellPath, + double mdStepSize, + std::vector& xValues, + std::vector& yValues, + std::vector& tvdValues, + std::vector& mdValues, + bool& showTextMdRkb ) { auto wellPathGeom = wellPath->wellPathGeometry(); if ( !wellPathGeom ) return; - useMdRkb = false; + showTextMdRkb = false; double rkbOffset = 0.0; { @@ -52,30 +52,30 @@ void RigWellPathGeometryExporter::exportWellPathGeometry( gsl::not_nullgeometryDefinition()->airGap() != 0.0 ) { - useMdRkb = true; - rkbOffset = modeledWellPath->geometryDefinition()->airGap(); + showTextMdRkb = true; + rkbOffset = modeledWellPath->geometryDefinition()->airGap(); } } if ( dynamic_cast( topLevelWellPath ) ) { - useMdRkb = true; + showTextMdRkb = true; } } - exportWellPathGeometry( *wellPathGeom, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues ); + computeWellPathDataForExport( *wellPathGeom, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigWellPathGeometryExporter::exportWellPathGeometry( const RigWellPath& wellPathGeom, - double mdStepSize, - double rkbOffset, - std::vector& xValues, - std::vector& yValues, - std::vector& tvdValues, - std::vector& mdValues ) +void RigWellPathGeometryExporter::computeWellPathDataForExport( const RigWellPath& wellPathGeom, + double mdStepSize, + double rkbOffset, + std::vector& xValues, + std::vector& yValues, + std::vector& tvdValues, + std::vector& mdValues ) { double currMd = wellPathGeom.measuredDepths().front() - mdStepSize; double endMd = wellPathGeom.measuredDepths().back(); diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.h b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.h index f367924c70..25637bf69e 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.h +++ b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryExporter.h @@ -31,19 +31,19 @@ class RigWellPath; class RigWellPathGeometryExporter { public: - static void exportWellPathGeometry( gsl::not_null wellPath, - double mdStepSize, - std::vector& xValues, - std::vector& yValues, - std::vector& tvdValues, - std::vector& mdValues, - bool& useMdRkb ); + static void computeWellPathDataForExport( gsl::not_null wellPath, + double mdStepSize, + std::vector& xValues, + std::vector& yValues, + std::vector& tvdValues, + std::vector& mdValues, + bool& showTextMdRkb ); - static void exportWellPathGeometry( const RigWellPath& wellPath, - double mdStepSize, - double rkbOffset, - std::vector& xValues, - std::vector& yValues, - std::vector& tvdValues, - std::vector& mdValues ); + static void computeWellPathDataForExport( const RigWellPath& wellPath, + double mdStepSize, + double rkbOffset, + std::vector& xValues, + std::vector& yValues, + std::vector& tvdValues, + std::vector& mdValues ); }; diff --git a/ApplicationLibCode/UnitTests/RigWellPathGeometryExporter-Test.cpp b/ApplicationLibCode/UnitTests/RigWellPathGeometryExporter-Test.cpp index c293643933..c3d9ea5932 100644 --- a/ApplicationLibCode/UnitTests/RigWellPathGeometryExporter-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigWellPathGeometryExporter-Test.cpp @@ -49,7 +49,13 @@ TEST( RigWellPathGeometryExporter, VerticalPath ) std::vector yValues; std::vector tvdValues; std::vector mdValues; - RigWellPathGeometryExporter::exportWellPathGeometry( rigWellPath, mdStepSize, rkbOffset, xValues, yValues, tvdValues, mdValues ); + RigWellPathGeometryExporter::computeWellPathDataForExport( rigWellPath, + mdStepSize, + rkbOffset, + xValues, + yValues, + tvdValues, + mdValues ); double firstMd = inputMds.front(); double lastMd = inputMds.back(); From 34ff98d2fa980cdd44d1a9ee94a236df90d500e6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 25 Nov 2021 09:00:59 +0100 Subject: [PATCH 022/406] #8290 commandFile: Crash for scaleFractureTemplate Make sure closeProject() is called before application exit. If not, some field editors will remain open an cause assert and crash on shutdown. --- ApplicationExeCode/RiaMain.cpp | 6 ++++++ ApplicationLibCode/Application/RiaGuiApplication.cpp | 2 -- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ApplicationExeCode/RiaMain.cpp b/ApplicationExeCode/RiaMain.cpp index 2a05d22679..7e158905aa 100644 --- a/ApplicationExeCode/RiaMain.cpp +++ b/ApplicationExeCode/RiaMain.cpp @@ -109,10 +109,16 @@ int main( int argc, char* argv[] ) if ( status == RiaApplication::ApplicationStatus::EXIT_COMPLETED ) { + // Make sure project is closed to avoid assert and crash in destruction of widgets + app->closeProject(); + return 0; } else if ( status == RiaApplication::ApplicationStatus::EXIT_WITH_ERROR ) { + // Make sure project is closed to avoid assert and crash in destruction of widgets + app->closeProject(); + return 2; } else if ( status == RiaApplication::ApplicationStatus::KEEP_GOING ) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 0d2ce98f96..f14eb7da0e 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -776,8 +776,6 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n RiuMainWindow::instance()->loadWinGeoAndDockToolBarLayout(); - closeProject(); - return ApplicationStatus::EXIT_COMPLETED; } From 6b7916be8a7013fd455ec15499c7dbbfbf3e2981 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 25 Nov 2021 17:39:16 +0100 Subject: [PATCH 023/406] #8316 Summary vector names: Fix wrong category for several keywords --- .../RiuSummaryQuantityNameInfoProvider.cpp | 69 ++++++++++--------- 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp index f9c0590276..968efe5a72 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp @@ -906,14 +906,14 @@ std::unordered_map Date: Thu, 25 Nov 2021 17:42:03 +0100 Subject: [PATCH 024/406] #8316 Summary vector names: Use stripped quantity name to find category --- .../RifEclipseSummaryAddress.cpp | 24 ++++++++++--------- .../FileInterface/RifEclipseSummaryAddress.h | 2 +- .../FileInterface/RifOpmCommonSummary.cpp | 18 ++++++++++++++ .../RifEclipseSummaryAddress-Test.cpp | 10 ++++---- .../Python/rips/tests/test_summary_cases.py | 4 ++-- 5 files changed, 39 insertions(+), 19 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index b862af5a0b..c512389c25 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -160,18 +160,20 @@ RifEclipseSummaryAddress::SummaryVarCategory RifEclipseSummaryAddress::identifyC { if ( quantityName.size() < 3 || quantityName.size() > 8 ) return SUMMARY_INVALID; + auto strippedQuantityName = baseQuantityName( quantityName ); + // First, try to lookup vector in vector table - auto category = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( quantityName ); + auto category = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( strippedQuantityName ); if ( category != SUMMARY_INVALID ) return category; // Then check LGR categories - std::string firstTwoLetters = quantityName.substr( 0, 2 ); + std::string firstTwoLetters = strippedQuantityName.substr( 0, 2 ); if ( firstTwoLetters == "LB" ) return SUMMARY_BLOCK_LGR; if ( firstTwoLetters == "LC" ) return SUMMARY_WELL_COMPLETION_LGR; if ( firstTwoLetters == "LW" ) return SUMMARY_WELL_LGR; - if ( quantityName[0] == 'N' ) return SUMMARY_NETWORK; + if ( strippedQuantityName[0] == 'N' ) return SUMMARY_NETWORK; return SUMMARY_INVALID; } @@ -721,7 +723,7 @@ bool RifEclipseSummaryAddress::hasAccumulatedData() const quantityForInspection = quantityForInspection.mid( quantityForInspection.indexOf( ":" ) + 1 ); } - QString qBaseName = baseQuantityName( quantityForInspection ); + QString qBaseName = QString::fromStdString( baseQuantityName( quantityForInspection.toStdString() ) ); if ( qBaseName.endsWith( "WCT" ) || qBaseName.endsWith( "WCTH" ) ) { @@ -904,19 +906,19 @@ bool RifEclipseSummaryAddress::isValidEclipseCategory() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RifEclipseSummaryAddress::baseQuantityName( const QString& quantityName ) +std::string RifEclipseSummaryAddress::baseQuantityName( const std::string& quantityName ) { - QString qBaseName = quantityName; + auto tmpString = quantityName; - if ( qBaseName.size() == 8 ) qBaseName.chop( 3 ); + if ( tmpString.size() == 8 ) tmpString = tmpString.substr( 0, 5 ); - auto indexToUnderScore = qBaseName.indexOf( "_" ); - if ( indexToUnderScore > 0 ) + auto indexToUnderscore = tmpString.find_first_of( '_' ); + if ( indexToUnderscore > 0 ) { - qBaseName = qBaseName.left( indexToUnderScore ); + tmpString = tmpString.substr( 0, indexToUnderscore ); } - return qBaseName; + return tmpString; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h index 719aa9b9b4..b26940c641 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h @@ -208,7 +208,7 @@ class RifEclipseSummaryAddress bool hasAccumulatedData() const; - static QString baseQuantityName( const QString& quantityName ); + static std::string baseQuantityName( const std::string& quantityName ); private: static RifEclipseSummaryAddress fromTokens( const std::vector& tokens ); diff --git a/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp b/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp index 9d11b2f4ec..e58a1495fb 100644 --- a/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp +++ b/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp @@ -392,9 +392,18 @@ std::pair, std::map addresses; std::map addressToNodeIndexMap; + std::vector invalidKeywords; + for ( const auto& keyword : keywords ) { auto eclAdr = RifEclipseSummaryAddress::fromEclipseTextAddress( keyword ); + if ( !eclAdr.isValid() ) + { + invalidKeywords.push_back( keyword ); + + // If a category is not found, use the MISC category + eclAdr = RifEclipseSummaryAddress::miscAddress( keyword ); + } if ( eclAdr.isValid() ) { @@ -403,5 +412,14 @@ std::pair, std::map Date: Fri, 26 Nov 2021 09:52:16 +0100 Subject: [PATCH 025/406] #8284 Well Log Plot: Avoid depth shift due to long title Fixes #8284. --- ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 7ed5a5efc8..cbbdabcde0 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -688,6 +688,7 @@ void RiuQwtPlotWidget::applyPlotTitleToQwt() { QString plotTitleToApply = m_plotTitleEnabled ? m_plotTitle : QString( "" ); QwtText plotTitle = this->title(); + plotTitle.setRenderFlags( Qt::AlignHCenter | Qt::TextSingleLine ); if ( plotTitleToApply != plotTitle.text() ) { plotTitle.setText( plotTitleToApply ); From b3bd62cc18468585b414fe556081520ded2c0fba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20H=C3=A6gland?= Date: Fri, 26 Nov 2021 17:12:39 +0100 Subject: [PATCH 026/406] Add missing limits header in SummaryNode.hpp This fixes issue #8328. --- .../custom-opm-common/opm-common/opm/io/eclipse/SummaryNode.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ThirdParty/custom-opm-common/opm-common/opm/io/eclipse/SummaryNode.hpp b/ThirdParty/custom-opm-common/opm-common/opm/io/eclipse/SummaryNode.hpp index 82f16e4baf..a26dcb4445 100644 --- a/ThirdParty/custom-opm-common/opm-common/opm/io/eclipse/SummaryNode.hpp +++ b/ThirdParty/custom-opm-common/opm-common/opm/io/eclipse/SummaryNode.hpp @@ -24,6 +24,7 @@ #include #include #include +#include namespace Opm { namespace EclIO { From 254e8a52a041b59df1b432bb565769013d29a533 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20H=C3=A6gland?= Date: Fri, 26 Nov 2021 20:49:44 +0100 Subject: [PATCH 027/406] Add missing limits header in RiuGroupedBarChartBuilder.h This fixes issue #8330 --- .../UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.h b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.h index c3c28ad5ee..aef1a82714 100644 --- a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.h +++ b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.h @@ -24,6 +24,7 @@ #include #include +#include class QwtPlot; class QColor; From 64bb841d1cd07c6690253fdbaffe2d9d2fa20753 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 29 Nov 2021 11:54:06 +0100 Subject: [PATCH 028/406] GHA: Use source branch name as branch-suffix for generated branches --- .github/workflows/clang-format.yml | 1 + .github/workflows/clang-tidy.yml | 3 ++- .github/workflows/cmake-format.yml | 1 + .github/workflows/python-linting.yml | 2 +- .github/workflows/spell-check.yml | 2 ++ 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index c5a66835e8..3ed1f215b7 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -32,5 +32,6 @@ jobs: commit-message: 'Fixes by clang-format' title: 'Fixes by clang-format' branch: clang-format-patches + branch-suffix: ${{ github.ref }} \ No newline at end of file diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 6eac8e6293..2a12f1f4f7 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -94,4 +94,5 @@ jobs: token: ${{ secrets.GITHUB_TOKEN }} commit-message: 'Fixes by clang-tidy' title: 'Fixes by clang-tidy' - branch: clang-tidy-patches \ No newline at end of file + branch: clang-tidy-patches + branch-suffix: ${{ github.ref }} diff --git a/.github/workflows/cmake-format.yml b/.github/workflows/cmake-format.yml index 9b137d1700..79515bd106 100644 --- a/.github/workflows/cmake-format.yml +++ b/.github/workflows/cmake-format.yml @@ -34,3 +34,4 @@ jobs: commit-message: 'Fixes by cmake-format' title: 'Fixes by cmake-format' branch: cmake-format-patches + branch-suffix: ${{ github.ref }} diff --git a/.github/workflows/python-linting.yml b/.github/workflows/python-linting.yml index a22ab561e9..c7afa0110c 100644 --- a/.github/workflows/python-linting.yml +++ b/.github/workflows/python-linting.yml @@ -19,4 +19,4 @@ jobs: commit-message: 'Python code linting changes detected by black' title: 'Fixes by black (Python)' branch: python-black-patches - base: ${{ github.head_ref }} + branch-suffix: ${{ github.ref }} diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index b896391f3c..3ad9d6d6ba 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -19,4 +19,6 @@ jobs: commit-message: 'Fixes by misspell-fixer' title: 'Typos fix by misspell-fixer' branch: spell-check-patches + branch-suffix: ${{ github.ref }} + From 95f1b63ddf1dfe33668d84e22997ff096ce47313 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 29 Nov 2021 12:33:38 +0100 Subject: [PATCH 029/406] Merge pull request #8332 from OPM/gha-improve-PR-names --- .github/workflows/clang-format.yml | 2 +- .github/workflows/clang-tidy.yml | 2 +- .github/workflows/cmake-format.yml | 2 +- .github/workflows/python-linting.yml | 2 +- .github/workflows/spell-check.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/clang-format.yml b/.github/workflows/clang-format.yml index 3ed1f215b7..1437d42268 100644 --- a/.github/workflows/clang-format.yml +++ b/.github/workflows/clang-format.yml @@ -32,6 +32,6 @@ jobs: commit-message: 'Fixes by clang-format' title: 'Fixes by clang-format' branch: clang-format-patches - branch-suffix: ${{ github.ref }} + branch-suffix: random \ No newline at end of file diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 2a12f1f4f7..aab8d4e566 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -95,4 +95,4 @@ jobs: commit-message: 'Fixes by clang-tidy' title: 'Fixes by clang-tidy' branch: clang-tidy-patches - branch-suffix: ${{ github.ref }} + branch-suffix: random diff --git a/.github/workflows/cmake-format.yml b/.github/workflows/cmake-format.yml index 79515bd106..ceff186c2a 100644 --- a/.github/workflows/cmake-format.yml +++ b/.github/workflows/cmake-format.yml @@ -34,4 +34,4 @@ jobs: commit-message: 'Fixes by cmake-format' title: 'Fixes by cmake-format' branch: cmake-format-patches - branch-suffix: ${{ github.ref }} + branch-suffix: random diff --git a/.github/workflows/python-linting.yml b/.github/workflows/python-linting.yml index c7afa0110c..52d6416f26 100644 --- a/.github/workflows/python-linting.yml +++ b/.github/workflows/python-linting.yml @@ -19,4 +19,4 @@ jobs: commit-message: 'Python code linting changes detected by black' title: 'Fixes by black (Python)' branch: python-black-patches - branch-suffix: ${{ github.ref }} + branch-suffix: random diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index 3ad9d6d6ba..4f2451d074 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -19,6 +19,6 @@ jobs: commit-message: 'Fixes by misspell-fixer' title: 'Typos fix by misspell-fixer' branch: spell-check-patches - branch-suffix: ${{ github.ref }} + branch-suffix: random From fc7c935b06d20d82694550f9a993e942d0d1e42c Mon Sep 17 00:00:00 2001 From: magnesj Date: Wed, 1 Dec 2021 15:33:32 +0000 Subject: [PATCH 030/406] Fixes by clang-format --- ApplicationLibCode/Application/RiaPreferencesSummary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp index 4f4526948f..2f9bab865d 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp @@ -142,7 +142,7 @@ RiaPreferencesSummary::RiaPreferencesSummary() "", "" ); - CAF_PDM_InitFieldNoDefault( &m_summaryReader, "summaryReaderType_v01", "File Format"); + CAF_PDM_InitFieldNoDefault( &m_summaryReader, "summaryReaderType_v01", "File Format" ); CAF_PDM_InitField( &m_showSummaryTimeAsLongString, "showSummaryTimeAsLongString", From 9edb0385d556106096fb70571c60b9376e82eed5 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Mon, 6 Dec 2021 20:29:02 +0100 Subject: [PATCH 031/406] Support pausing before running abaqus script to allow input file modifications. Add option in preferences to enable/disable pause. --- .../Application/RiaPreferencesGeoMech.cpp | 23 +++++++++++++------ .../Application/RiaPreferencesGeoMech.h | 2 ++ .../RicRunWellIntegrityAnalysisFeature.cpp | 13 +++++++++++ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPreferencesGeoMech.cpp b/ApplicationLibCode/Application/RiaPreferencesGeoMech.cpp index f890f836ed..899e568ed8 100644 --- a/ApplicationLibCode/Application/RiaPreferencesGeoMech.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesGeoMech.cpp @@ -64,14 +64,14 @@ RiaPreferencesGeoMech::RiaPreferencesGeoMech() m_geomechWIACommand.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_geomechWIACommand.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitField( &m_keepTemporaryFiles, - "keepTemporaryFile", - false, - "Keep temporary parameter files (for debugging)", - "", - "", - "" ); + CAF_PDM_InitField( &m_keepTemporaryFiles, "keepTemporaryFile", false, "Keep temporary parameter files (for debugging)" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_keepTemporaryFiles ); + + CAF_PDM_InitField( &m_waitForInputFileEdit, + "waitForInputFileEdit", + true, + "Pause to allow modification of input files before running modeling." ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_waitForInputFileEdit ); } //-------------------------------------------------------------------------------------------------- @@ -101,6 +101,7 @@ void RiaPreferencesGeoMech::appendItems( caf::PdmUiOrdering& uiOrdering ) const caf::PdmUiGroup* wellIAGroup = uiOrdering.addNewGroup( "Well Integrity Analysis" ); wellIAGroup->add( &m_geomechWIACommand ); wellIAGroup->add( &m_geomechWIADefaultXML ); + wellIAGroup->add( &m_waitForInputFileEdit ); caf::PdmUiGroup* commonGroup = uiOrdering.addNewGroup( "Common Settings" ); commonGroup->add( &m_keepTemporaryFiles ); @@ -177,6 +178,14 @@ bool RiaPreferencesGeoMech::keepTemporaryFiles() const return m_keepTemporaryFiles; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaPreferencesGeoMech::waitBeforeRunWIA() const +{ + return m_waitForInputFileEdit; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferencesGeoMech.h b/ApplicationLibCode/Application/RiaPreferencesGeoMech.h index 267fb77068..97ffb176dd 100644 --- a/ApplicationLibCode/Application/RiaPreferencesGeoMech.h +++ b/ApplicationLibCode/Application/RiaPreferencesGeoMech.h @@ -48,6 +48,7 @@ class RiaPreferencesGeoMech : public caf::PdmObject QString geomechWIADefaultXML() const; QString geomechWIACommand() const; + bool waitBeforeRunWIA() const; bool keepTemporaryFiles() const; @@ -65,6 +66,7 @@ class RiaPreferencesGeoMech : public caf::PdmObject caf::PdmField m_geomechWIADefaultXML; caf::PdmField m_geomechWIACommand; + caf::PdmField m_waitForInputFileEdit; caf::PdmField m_keepTemporaryFiles; }; diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp b/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp index b118aecd5c..b0cc93ba4f 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp @@ -87,6 +87,19 @@ void RicRunWellIntegrityAnalysisFeature::onActionTriggered( bool isChecked ) return; } + if ( RiaPreferencesGeoMech::current()->waitBeforeRunWIA() ) + { + runProgress.setProgressDescription( "Waiting for input file modifications." ); + + QString infoText = "Input parameter files can now be found in the working folder:"; + infoText += " \"" + modelSettings->outputBaseDirectory() + "\"\n"; + infoText += "\nClick OK to start the Abaqus modeling or Cancel to stop."; + + auto reply = QMessageBox::information( nullptr, wiaTitle, infoText, QMessageBox::Ok | QMessageBox::Cancel ); + + if ( reply != QMessageBox::Ok ) return; + } + runProgress.incrementProgress(); runProgress.setProgressDescription( "Running Abaqus modeling." ); From e4357a9ab3fa3c86f7d633d26f326a5760430fdf Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 3 Dec 2021 14:27:29 +0100 Subject: [PATCH 032/406] #8348 Theme : Changing theme when maximized plot window causes crash --- .../RicSnapshotViewToFileFeature.cpp | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp index a45dfee013..63bd9e1d94 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp @@ -87,9 +87,21 @@ void RicSnapshotViewToFileFeature::saveSnapshotAs( const QString& fileName, cons //-------------------------------------------------------------------------------------------------- void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, RimPlotWindow* plot ) { + if ( !plot || !plot->viewWidget() ) return; + + auto viewWidget = plot->viewWidget(); + + // For some reason, the application crashes (seen on Windows 11) if the theme is changed when a plot window is + // maximized. Make sure the MDI windows are displayed as normal, and restore the maximized state + bool maximizedState = viewWidget->isMaximized(); + if ( maximizedState ) viewWidget->showNormal(); + auto currentTheme = RiuGuiTheme::currentGuiTheme(); + if ( currentTheme != RiaDefines::ThemeEnum::LIGHT ) + { + RiuGuiTheme::updateGuiTheme( RiaDefines::ThemeEnum::LIGHT ); + } - RiuGuiTheme::updateGuiTheme( RiaDefines::ThemeEnum::LIGHT ); RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots(); QCoreApplication::processEvents(); QFile pdfFile( fileName ); @@ -97,7 +109,7 @@ void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, { int resolution = RiaGuiApplication::applicationResolution(); int pageWidth = plot->pageLayout().fullRectPixels( resolution ).width(); - int widgetWidth = plot->viewWidget()->width(); + int widgetWidth = viewWidget->width(); int deltaWidth = widgetWidth - pageWidth; while ( std::abs( deltaWidth ) > 1 ) @@ -114,29 +126,35 @@ void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, pdfPrinter.setPageLayout( plot->pageLayout() ); pdfPrinter.setCreator( QCoreApplication::applicationName() ); pdfPrinter.setResolution( resolution ); - QRect widgetRect = plot->viewWidget()->contentsRect(); + QRect widgetRect = viewWidget->contentsRect(); RimMultiPlot* multiPlot = dynamic_cast( plot ); if ( multiPlot && multiPlot->previewModeEnabled() ) { QRect pageRect = pdfPrinter.pageLayout().fullRectPixels( resolution ); - plot->viewWidget()->resize( pageRect.size() ); + viewWidget->resize( pageRect.size() ); plot->renderWindowContent( &pdfPrinter ); - plot->viewWidget()->resize( widgetRect.size() ); + viewWidget->resize( widgetRect.size() ); } else { QRect pageRect = pdfPrinter.pageLayout().paintRectPixels( resolution ); - plot->viewWidget()->resize( pageRect.size() ); + viewWidget->resize( pageRect.size() ); plot->renderWindowContent( &pdfPrinter ); - plot->viewWidget()->resize( widgetRect.size() ); + viewWidget->resize( widgetRect.size() ); } } else { RiaLogging::error( QString( "Could not write PDF to %1" ).arg( fileName ) ); } - RiuGuiTheme::updateGuiTheme( currentTheme ); + + if ( currentTheme != RiaDefines::ThemeEnum::LIGHT ) + { + RiuGuiTheme::updateGuiTheme( currentTheme ); + } + + if ( maximizedState ) viewWidget->showMaximized(); } //-------------------------------------------------------------------------------------------------- From 178a5ab58343c352c87bf43937e176bc630067d3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 3 Dec 2021 14:29:07 +0100 Subject: [PATCH 033/406] Rename to Data Sources --- ApplicationLibCode/ProjectDataModel/RimProject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 21b9252e69..f33befda5d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -1401,7 +1401,7 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q if ( uiConfigName == "PlotWindow" ) { { - auto itemCollection = uiTreeOrdering.add( "Cases and Data", ":/Folder.png" ); + auto itemCollection = uiTreeOrdering.add( "Data Sources", ":/Folder.png" ); RimOilField* oilField = activeOilField(); if ( oilField ) From 34fb7d7e8421fc3f35775426e82379d937922f2b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 3 Dec 2021 14:32:58 +0100 Subject: [PATCH 034/406] #8345 Summary Plot Manager : Several improvements Add checkboxes for individual plots for vectors/addresses and creation of multiplots. Moved code into RicSummaryPlotBuilder. Allow UiComboBoxEditor to disable autocomplete. Create plot using Enter key without modifiers. --- ApplicationLibCode/Commands/CMakeLists.txt | 1 + .../Commands/CMakeLists_files.cmake | 2 - .../CMakeLists_files.cmake | 20 ++ .../RicNewMultiPlotFeature.cpp | 52 +--- .../RicNewMultiPlotFeature.h | 0 .../RicSummaryPlotBuilder.cpp | 293 ++++++++++++++++++ .../RicSummaryPlotBuilder.h | 81 +++++ .../Summary/RimSummaryPlotManager.cpp | 261 ++++++++-------- .../Summary/RimSummaryPlotManager.h | 31 +- .../UserInterface/RiuPlotMainWindow.cpp | 6 + .../cafPdmUiComboBoxEditor.cpp | 5 + .../cafUserInterface/cafPdmUiComboBoxEditor.h | 2 + 12 files changed, 555 insertions(+), 199 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake rename ApplicationLibCode/Commands/{ => PlotBuilderCommands}/RicNewMultiPlotFeature.cpp (68%) rename ApplicationLibCode/Commands/{ => PlotBuilderCommands}/RicNewMultiPlotFeature.h (100%) create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h diff --git a/ApplicationLibCode/Commands/CMakeLists.txt b/ApplicationLibCode/Commands/CMakeLists.txt index 104491fae3..a4ad719315 100644 --- a/ApplicationLibCode/Commands/CMakeLists.txt +++ b/ApplicationLibCode/Commands/CMakeLists.txt @@ -41,6 +41,7 @@ set(COMMAND_REFERENCED_CMAKE_FILES WellPathCommands/CMakeLists_files.cmake PlotTemplateCommands/CMakeLists_files.cmake FractureCommands/CMakeLists_files.cmake + PlotBuilderCommands/CMakeLists_files.cmake ) # Include source file lists from *.cmake files diff --git a/ApplicationLibCode/Commands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/CMakeLists_files.cmake index a5a02c5e38..a0f73e60a7 100644 --- a/ApplicationLibCode/Commands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/CMakeLists_files.cmake @@ -61,7 +61,6 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextUi.h - ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicExportStimPlanModelToFileFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicStackSelectedCurvesFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicUnstackSelectedCurvesFeature.h @@ -143,7 +142,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicDeleteTemporaryLgrsFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicExportContourMapToTextUi.cpp - ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicExportStimPlanModelToFileFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicStackSelectedCurvesFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicUnstackSelectedCurvesFeature.cpp diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake new file mode 100644 index 0000000000..632d18b049 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake @@ -0,0 +1,20 @@ +set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotBuilder.h +) + +set(SOURCE_GROUP_SOURCE_FILES + ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotBuilder.cpp +) + +list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) + +list(APPEND COMMAND_CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES}) + +list(APPEND COMMAND_QT_MOC_HEADERS) + +source_group( + "CommandFeature\\PlotBuilder" + FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} + ${CMAKE_CURRENT_LIST_DIR}/CMakeLists_files.cmake +) diff --git a/ApplicationLibCode/Commands/RicNewMultiPlotFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewMultiPlotFeature.cpp similarity index 68% rename from ApplicationLibCode/Commands/RicNewMultiPlotFeature.cpp rename to ApplicationLibCode/Commands/PlotBuilderCommands/RicNewMultiPlotFeature.cpp index 435223fb45..598c0cf606 100644 --- a/ApplicationLibCode/Commands/RicNewMultiPlotFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewMultiPlotFeature.cpp @@ -19,21 +19,18 @@ #include "RicNewMultiPlotFeature.h" -#include "RimMainPlotCollection.h" -#include "RimMultiPlot.h" -#include "RimMultiPlotCollection.h" +#include "RicSummaryPlotBuilder.h" + #include "RimPlot.h" -#include "RimProject.h" -#include "RimSaturationPressurePlot.h" #include "RimWellLogTrack.h" #include "RiuPlotMainWindowTools.h" -#include #include "cafSelectionManager.h" - #include "cvfAssert.h" +#include + RICF_SOURCE_INIT( RicNewMultiPlotFeature, "RicNewMultiPlotFeature", "createMultiPlot" ); //-------------------------------------------------------------------------------------------------- @@ -49,14 +46,6 @@ RicNewMultiPlotFeature::RicNewMultiPlotFeature() //-------------------------------------------------------------------------------------------------- caf::PdmScriptResponse RicNewMultiPlotFeature::execute() { - RimProject* project = RimProject::current(); - RimMultiPlotCollection* plotCollection = project->mainPlotCollection()->multiPlotCollection(); - - RimMultiPlot* plotWindow = new RimMultiPlot; - plotWindow->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) ); - plotWindow->setAsPlotMdiWindow(); - plotCollection->addMultiPlot( plotWindow ); - if ( !m_plots().empty() ) { std::vector plots; @@ -65,40 +54,11 @@ caf::PdmScriptResponse RicNewMultiPlotFeature::execute() plots.push_back( reinterpret_cast( ptr ) ); } - for ( auto plot : plots ) - { - auto copy = dynamic_cast( plot->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + auto copyOfPlots = RicSummaryPlotBuilder::duplicatePlots( plots ); - { - // TODO: Workaround for fixing the PdmPointer in RimEclipseResultDefinition - // caf::PdmPointer m_eclipseCase; - // This pdmpointer must be changed to a ptrField - - auto saturationPressurePlotOriginal = dynamic_cast( plot ); - auto saturationPressurePlotCopy = dynamic_cast( copy ); - if ( saturationPressurePlotCopy && saturationPressurePlotOriginal ) - { - RimSaturationPressurePlot::fixPointersAfterCopy( saturationPressurePlotOriginal, - saturationPressurePlotCopy ); - } - } - - plotWindow->addPlot( copy ); - - copy->resolveReferencesRecursively(); - copy->revokeMdiWindowStatus(); - copy->setShowWindow( true ); - - copy->loadDataAndUpdate(); - } + RicSummaryPlotBuilder::createAndAppendMultiPlot( copyOfPlots ); } - project->updateAllRequiredEditors(); - plotWindow->loadDataAndUpdate(); - - RiuPlotMainWindowTools::setExpanded( plotCollection, true ); - RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); - return caf::PdmScriptResponse(); } diff --git a/ApplicationLibCode/Commands/RicNewMultiPlotFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewMultiPlotFeature.h similarity index 100% rename from ApplicationLibCode/Commands/RicNewMultiPlotFeature.h rename to ApplicationLibCode/Commands/PlotBuilderCommands/RicNewMultiPlotFeature.h diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp new file mode 100644 index 0000000000..cf45535b41 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -0,0 +1,293 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicSummaryPlotBuilder.h" + +#include "RiaSummaryTools.h" + +#include "RifEclipseSummaryAddress.h" +#include "RifReaderEclipseSummary.h" +#include "RifSummaryReaderInterface.h" + +#include "RimEnsembleCurveSet.h" +#include "RimEnsembleCurveSetCollection.h" +#include "RimMainPlotCollection.h" +#include "RimMultiPlot.h" +#include "RimMultiPlotCollection.h" +#include "RimPlot.h" +#include "RimProject.h" +#include "RimSaturationPressurePlot.h" +#include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" +#include "RimSummaryCurve.h" +#include "RimSummaryPlotCollection.h" + +#include "RiuPlotMainWindowTools.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicSummaryPlotBuilder::RicSummaryPlotBuilder() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotBuilder::setDataSources( const std::vector& summaryCases, + const std::vector& ensembles ) +{ + m_summaryCases = summaryCases; + m_ensembles = ensembles; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotBuilder::setAddresses( const std::set& addresses ) +{ + m_addresses = addresses; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotBuilder::setIndividualPlotPerAddress( bool enable ) +{ + m_individualPlotPerAddress = enable; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotBuilder::setIndividualPlotPerDataSource( bool enable ) +{ + m_individualPlotPerDataSource = enable; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicSummaryPlotBuilder::createPlots() const +{ + std::vector plots; + + if ( m_individualPlotPerDataSource && m_individualPlotPerAddress ) + { + for ( auto adr : m_addresses ) + { + for ( auto summaryCase : m_summaryCases ) + { + auto plot = createPlot( { adr }, { summaryCase }, {} ); + plots.push_back( plot ); + } + + for ( auto ensemble : m_ensembles ) + { + auto plot = createPlot( { adr }, {}, { ensemble } ); + plots.push_back( plot ); + } + } + } + else if ( m_individualPlotPerAddress ) + { + for ( auto adr : m_addresses ) + { + auto plot = createPlot( { adr }, m_summaryCases, m_ensembles ); + plots.push_back( plot ); + } + } + else if ( m_individualPlotPerDataSource ) + { + for ( auto summaryCase : m_summaryCases ) + { + auto plot = createPlot( m_addresses, { summaryCase }, {} ); + plots.push_back( plot ); + } + + for ( auto ensemble : m_ensembles ) + { + auto plot = createPlot( m_addresses, {}, { ensemble } ); + plots.push_back( plot ); + } + } + else + { + auto plot = createPlot( m_addresses, m_summaryCases, m_ensembles ); + plots.push_back( plot ); + } + + return plots; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RicSummaryPlotBuilder::addressesForSource( caf::PdmObject* summarySource ) +{ + auto ensemble = dynamic_cast( summarySource ); + if ( ensemble ) + { + return ensemble->ensembleSummaryAddresses(); + } + + auto sumCase = dynamic_cast( summarySource ); + if ( sumCase ) + { + auto reader = sumCase ? sumCase->summaryReader() : nullptr; + if ( reader ) + { + return reader->allResultAddresses(); + } + } + + return {}; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEnsembleCurveSet* RicSummaryPlotBuilder::createCurveSet( RimSummaryCaseCollection* ensemble, + const RifEclipseSummaryAddress& addr ) +{ + auto curveSet = new RimEnsembleCurveSet(); + + curveSet->setSummaryCaseCollection( ensemble ); + curveSet->setSummaryAddress( addr ); + + return curveSet; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCurve* RicSummaryPlotBuilder::createCurve( RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& addr ) +{ + auto curve = new RimSummaryCurve(); + + curve->setSummaryCaseY( summaryCase ); + curve->setSummaryAddressY( addr ); + + return curve; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicSummaryPlotBuilder::duplicatePlots( const std::vector& sourcePlots ) +{ + std::vector plots; + + for ( auto plot : sourcePlots ) + { + auto copy = dynamic_cast( plot->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + + { + // TODO: Workaround for fixing the PdmPointer in RimEclipseResultDefinition + // caf::PdmPointer m_eclipseCase; + // This pdmpointer must be changed to a ptrField + + auto saturationPressurePlotOriginal = dynamic_cast( plot ); + auto saturationPressurePlotCopy = dynamic_cast( copy ); + if ( saturationPressurePlotCopy && saturationPressurePlotOriginal ) + { + RimSaturationPressurePlot::fixPointersAfterCopy( saturationPressurePlotOriginal, + saturationPressurePlotCopy ); + } + } + + plots.push_back( copy ); + } + + return plots; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimMultiPlot* RicSummaryPlotBuilder::createAndAppendMultiPlot( const std::vector& plots ) +{ + RimProject* project = RimProject::current(); + RimMultiPlotCollection* plotCollection = project->mainPlotCollection()->multiPlotCollection(); + + RimMultiPlot* plotWindow = new RimMultiPlot; + plotWindow->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) ); + plotWindow->setAsPlotMdiWindow(); + plotCollection->addMultiPlot( plotWindow ); + + for ( auto plot : plots ) + { + plotWindow->addPlot( plot ); + + plot->resolveReferencesRecursively(); + plot->revokeMdiWindowStatus(); + plot->setShowWindow( true ); + + plot->loadDataAndUpdate(); + } + + project->updateAllRequiredEditors(); + plotWindow->loadDataAndUpdate(); + + RiuPlotMainWindowTools::setExpanded( plotCollection, true ); + RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); + + return plotWindow; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryPlot* RicSummaryPlotBuilder::createPlot( const std::set& addresses, + const std::vector& summaryCases, + const std::vector& ensembles ) +{ + RimSummaryPlot* plot = new RimSummaryPlot(); + plot->enableAutoPlotTitle( true ); + + appendCurvesToPlot( plot, addresses, summaryCases, ensembles ); + + plot->applyDefaultCurveAppearances(); + + return plot; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotBuilder::appendCurvesToPlot( RimSummaryPlot* summaryPlot, + const std::set& addresses, + const std::vector& summaryCases, + const std::vector& ensembles ) +{ + for ( const auto& addr : addresses ) + { + for ( const auto ensemble : ensembles ) + { + auto curveSet = createCurveSet( ensemble, addr ); + summaryPlot->ensembleCurveSetCollection()->addCurveSet( curveSet ); + } + + for ( const auto summaryCase : summaryCases ) + { + auto curve = createCurve( summaryCase, addr ); + + summaryPlot->addCurveNoUpdate( curve ); + } + } +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h new file mode 100644 index 0000000000..530e0f7ae8 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h @@ -0,0 +1,81 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +class RimPlot; +class RimMultiPlot; +class RifEclipseSummaryAddress; +class RimSummaryCase; +class RimSummaryCaseCollection; +class RimSummaryPlot; +class RimEnsembleCurveSet; +class RimSummaryCurve; + +namespace caf +{ +class PdmObject; +} + +#include +#include + +//================================================================================================== +/// +//================================================================================================== +class RicSummaryPlotBuilder +{ +public: + RicSummaryPlotBuilder(); + + void setDataSources( const std::vector& summaryCases, + const std::vector& ensembles ); + + void setAddresses( const std::set& addresses ); + + void setIndividualPlotPerAddress( bool enable ); + void setIndividualPlotPerDataSource( bool enable ); + + std::vector createPlots() const; + + // Static helper functions + static std::set addressesForSource( caf::PdmObject* summarySource ); + + static RimEnsembleCurveSet* createCurveSet( RimSummaryCaseCollection* ensemble, const RifEclipseSummaryAddress& addr ); + static RimSummaryCurve* createCurve( RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& addr ); + + static std::vector duplicatePlots( const std::vector& plots ); + static RimMultiPlot* createAndAppendMultiPlot( const std::vector& plots ); + + static RimSummaryPlot* createPlot( const std::set& addresses, + const std::vector& summaryCases, + const std::vector& ensembles ); + + static void appendCurvesToPlot( RimSummaryPlot* summaryPlot, + const std::set& addresses, + const std::vector& summaryCases, + const std::vector& ensembles ); + +private: + std::set m_addresses; + std::vector m_summaryCases; + std::vector m_ensembles; + + bool m_individualPlotPerAddress; + bool m_individualPlotPerDataSource; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index 2eb11bc9a3..f78350215a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -35,6 +35,7 @@ #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" #include "RiuPlotMainWindowTools.h" @@ -45,6 +46,7 @@ #include "cafPdmUiLabelEditor.h" #include "cafPdmUiLineEditor.h" #include "cafPdmUiPushButtonEditor.h" +#include "cafPdmUiTreeSelectionEditor.h" #include "cafSelectionManager.h" #include @@ -64,8 +66,9 @@ RimSummaryPlotManager::RimSummaryPlotManager() CAF_PDM_InitFieldNoDefault( &m_addressCandidates, "AddressCandidates", "Vectors" ); m_addressCandidates.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitFieldNoDefault( &m_dataSourceCandidates, "DataSourceCandidates", "Data Sources" ); - m_dataSourceCandidates.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); + CAF_PDM_InitFieldNoDefault( &m_selectedDataSources, "SelectedDataSources", "Data Sources" ); + m_selectedDataSources.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); + m_selectedDataSources.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); CAF_PDM_InitField( &m_includeDiffCurves, "IncludeDiffCurves", @@ -96,6 +99,10 @@ RimSummaryPlotManager::RimSummaryPlotManager() CAF_PDM_InitFieldNoDefault( &m_labelB, "LabelB", "" ); m_labelB.uiCapability()->setUiEditorTypeName( caf::PdmUiLabelEditor::uiEditorTypeName() ); m_labelB.xmlCapability()->disableIO(); + + CAF_PDM_InitField( &m_individualPlotPerVector, "IndividualPlotPerVector", false, "One plot per Vector" ); + CAF_PDM_InitField( &m_individualPlotPerDataSource, "IndividualPlotPerDataSource", false, "One plot per Data Source" ); + CAF_PDM_InitField( &m_createMultiPlot, "CreateMultiPlot", false, "Create Multiple Plots in One Window" ); } //-------------------------------------------------------------------------------------------------- @@ -124,7 +131,6 @@ void RimSummaryPlotManager::fieldChangedByUi( const caf::PdmFieldHandle* changed if ( changedField == &m_summaryPlot || changedField == &m_filterText || changedField == &m_includeDiffCurves ) { updateCurveCandidates(); - updateDataSourceCandidates(); } else if ( changedField == &m_pushButtonReplace ) { @@ -158,8 +164,7 @@ QList auto coll = RiaSummaryTools::summaryPlotCollection(); coll->summaryPlotItemInfos( &options ); } - - if ( fieldNeedingOptions == &m_filterText ) + else if ( fieldNeedingOptions == &m_filterText ) { RiaStringListSerializer stringListSerializer( curveFilterRecentlyUsedRegistryKey() ); @@ -168,6 +173,35 @@ QList options.push_back( caf::PdmOptionItemInfo( s, s ) ); } } + else if ( fieldNeedingOptions == &m_selectedDataSources ) + { + auto [summaryCases, ensembles] = allDataSourcesInProject(); + + std::vector dataSourceDisplayNames; + + bool resetCheckedItems = false; + + std::vector> dataSources = findDataSourceCandidates(); + for ( const auto& dataSource : dataSources ) + { + auto displayName = dataSource.first; + dataSourceDisplayNames.push_back( displayName ); + options.push_back( caf::PdmOptionItemInfo( displayName, displayName ) ); + + if ( m_previousDataSourceSelection.count( displayName ) == 0 ) resetCheckedItems = true; + } + + if ( m_previousDataSourceSelection.size() != dataSourceDisplayNames.size() ) resetCheckedItems = true; + + if ( resetCheckedItems ) + { + // By default select all available data sources + m_selectedDataSources = dataSourceDisplayNames; + } + + m_previousDataSourceSelection.clear(); + m_previousDataSourceSelection.insert( dataSourceDisplayNames.begin(), dataSourceDisplayNames.end() ); + } return options; } @@ -189,22 +223,6 @@ void RimSummaryPlotManager::updateCurveCandidates() m_addressCandidates = curveCandidates; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryPlotManager::updateDataSourceCandidates() -{ - std::vector dataSourceDisplayNames; - - std::vector> dataSourceCandidates = findDataSourceCandidates(); - for ( const auto& candidate : dataSourceCandidates ) - { - dataSourceDisplayNames.push_back( candidate.first ); - } - - m_dataSourceCandidates = dataSourceDisplayNames; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -314,7 +332,7 @@ void RimSummaryPlotManager::defineEditorAttribute( const caf::PdmFieldHandle* fi } if ( field == &m_pushButtonNewPlot ) { - attr->m_buttonText = "Create New Plot \n(Alt + Enter)"; + attr->m_buttonText = "Create New Plot \n(Enter)"; } if ( field == &m_pushButtonAppend ) { @@ -329,6 +347,7 @@ void RimSummaryPlotManager::defineEditorAttribute( const caf::PdmFieldHandle* fi if ( attr ) { attr->enableEditableContent = true; + attr->enableAutoComplete = false; attr->adjustWidthToContents = true; attr->notifyWhenTextIsEdited = true; } @@ -346,7 +365,11 @@ void RimSummaryPlotManager::defineUiOrdering( QString uiConfigName, caf::PdmUiOr uiOrdering.add( &m_filterText ); uiOrdering.add( &m_addressCandidates ); - uiOrdering.add( &m_dataSourceCandidates, false ); + uiOrdering.add( &m_selectedDataSources, false ); + + uiOrdering.add( &m_individualPlotPerVector ); + uiOrdering.add( &m_individualPlotPerDataSource ); + uiOrdering.add( &m_createMultiPlot ); uiOrdering.add( &m_pushButtonAppend ); uiOrdering.add( &m_pushButtonReplace, { false } ); @@ -359,9 +382,9 @@ void RimSummaryPlotManager::defineUiOrdering( QString uiConfigName, caf::PdmUiOr //-------------------------------------------------------------------------------------------------- void RimSummaryPlotManager::appendCurves() { - RimSummaryPlot* destinationPlot = m_summaryPlot; + if ( !m_summaryPlot ) return; - appendCurvesToPlot( destinationPlot ); + appendCurvesToPlot( m_summaryPlot ); } //-------------------------------------------------------------------------------------------------- @@ -369,6 +392,8 @@ void RimSummaryPlotManager::appendCurves() //-------------------------------------------------------------------------------------------------- void RimSummaryPlotManager::replaceCurves() { + if ( !m_summaryPlot ) return; + RimSummaryPlot* destinationPlot = m_summaryPlot; destinationPlot->deleteAllSummaryCurves(); destinationPlot->ensembleCurveSetCollection()->deleteAllCurveSets(); @@ -383,9 +408,43 @@ void RimSummaryPlotManager::replaceCurves() //-------------------------------------------------------------------------------------------------- void RimSummaryPlotManager::createNewPlot() { - RimSummaryPlot* destinationPlot = RiaSummaryTools::summaryPlotCollection()->createSummaryPlotWithAutoTitle(); + std::vector summaryCases; + std::vector ensembles; + findFilteredSummaryCasesAndEnsembles( summaryCases, ensembles ); - appendCurvesToPlot( destinationPlot ); + std::set filteredAddressesFromSource = filteredAddresses(); + + RicSummaryPlotBuilder plotBuilder; + plotBuilder.setAddresses( filteredAddressesFromSource ); + plotBuilder.setDataSources( summaryCases, ensembles ); + plotBuilder.setIndividualPlotPerAddress( m_individualPlotPerVector ); + plotBuilder.setIndividualPlotPerDataSource( m_individualPlotPerDataSource ); + + auto plots = plotBuilder.createPlots(); + if ( m_createMultiPlot ) + { + std::vector plotsForMultiPlot; + for ( auto p : plots ) + { + p->loadDataAndUpdate(); + plotsForMultiPlot.push_back( dynamic_cast( p ) ); + } + RicSummaryPlotBuilder::createAndAppendMultiPlot( plotsForMultiPlot ); + } + else + { + auto plotCollection = RiaSummaryTools::summaryPlotCollection(); + for ( auto plot : plots ) + { + plot->setAsPlotMdiWindow(); + + plotCollection->addPlot( plot ); + + plot->loadDataAndUpdate(); + } + } + + updateProjectTreeAndRefresUi(); } //-------------------------------------------------------------------------------------------------- @@ -405,13 +464,8 @@ bool RimSummaryPlotManager::eventFilter( QObject* obj, QEvent* event ) appendCurves(); else if ( mods & Qt::ControlModifier ) replaceCurves(); - else if ( mods & Qt::AltModifier ) - createNewPlot(); else if ( mods == Qt::NoModifier ) - { - updateCurveCandidates(); - updateDataSourceCandidates(); - } + createNewPlot(); } } @@ -442,22 +496,23 @@ void RimSummaryPlotManager::updateUiFromSelection() RimSummaryPlot* summaryPlot = nullptr; if ( destinationObject ) destinationObject->firstAncestorOrThisOfType( summaryPlot ); - if ( m_summaryPlot != summaryPlot ) + if ( summaryPlot && ( m_summaryPlot() != summaryPlot ) ) { m_summaryPlot = summaryPlot; - if ( summaryPlot ) - { - updateCurveCandidates(); - updateDataSourceCandidates(); - } - else - { - std::vector tmp; - m_addressCandidates = tmp; - m_dataSourceCandidates = tmp; - } - updateConnectedEditors(); + + updateCurveCandidates(); } + + if ( !summaryPlot ) + { + m_summaryPlot = nullptr; + + std::vector tmp; + m_addressCandidates = tmp; + m_selectedDataSources = tmp; + } + + updateConnectedEditors(); } //-------------------------------------------------------------------------------------------------- @@ -472,11 +527,11 @@ std::set RimSummaryPlotManager::filteredAddresses() std::set nativeAddresses; if ( !summaryCases.empty() ) { - nativeAddresses = addressesForSource( summaryCases.front() ); + nativeAddresses = RicSummaryPlotBuilder::addressesForSource( summaryCases.front() ); } else if ( !ensembles.empty() ) { - nativeAddresses = addressesForSource( ensembles.front() ); + nativeAddresses = RicSummaryPlotBuilder::addressesForSource( ensembles.front() ); } if ( nativeAddresses.empty() ) return {}; @@ -486,82 +541,6 @@ std::set RimSummaryPlotManager::filteredAddresses() return computeFilteredAddresses( allCurveAddressFilters, nativeAddresses ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::set RimSummaryPlotManager::addressesForSource( caf::PdmObject* summarySource ) -{ - auto ensemble = dynamic_cast( summarySource ); - if ( ensemble ) - { - return ensemble->ensembleSummaryAddresses(); - } - - auto sumCase = dynamic_cast( summarySource ); - if ( sumCase ) - { - auto reader = sumCase ? sumCase->summaryReader() : nullptr; - if ( reader ) - { - return reader->allResultAddresses(); - } - } - - return {}; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimEnsembleCurveSet* RimSummaryPlotManager::createCurveSet( RimSummaryCaseCollection* ensemble, - const RifEclipseSummaryAddress& addr ) -{ - auto curveSet = new RimEnsembleCurveSet(); - - curveSet->setSummaryCaseCollection( ensemble ); - curveSet->setSummaryAddress( addr ); - - return curveSet; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryCurve* RimSummaryPlotManager::createCurve( RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& addr ) -{ - auto curve = new RimSummaryCurve(); - - curve->setSummaryCaseY( summaryCase ); - curve->setSummaryAddressY( addr ); - - return curve; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryPlotManager::appendCurvesToPlot( RimSummaryPlot* summaryPlot, - const std::set& addresses, - const std::vector& summaryCases, - const std::vector& ensembles ) -{ - for ( const auto& addr : addresses ) - { - for ( const auto ensemble : ensembles ) - { - auto curveSet = createCurveSet( ensemble, addr ); - summaryPlot->ensembleCurveSetCollection()->addCurveSet( curveSet ); - } - - for ( const auto summaryCase : summaryCases ) - { - auto curve = createCurve( summaryCase, addr ); - - summaryPlot->addCurveNoUpdate( curve ); - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -574,17 +553,12 @@ void RimSummaryPlotManager::appendCurvesToPlot( RimSummaryPlot* destinationPlot findFilteredSummaryCasesAndEnsembles( summaryCases, ensembles ); std::set filteredAddressesFromSource = filteredAddresses(); - appendCurvesToPlot( destinationPlot, filteredAddressesFromSource, summaryCases, ensembles ); + RicSummaryPlotBuilder::appendCurvesToPlot( destinationPlot, filteredAddressesFromSource, summaryCases, ensembles ); destinationPlot->applyDefaultCurveAppearances(); destinationPlot->loadDataAndUpdate(); - RiaSummaryTools::summaryPlotCollection()->updateConnectedEditors(); - - updateFilterTextHistory(); - m_filterText.uiCapability()->updateConnectedEditors(); - - setFocusToFilterText(); + updateProjectTreeAndRefresUi(); } //-------------------------------------------------------------------------------------------------- @@ -598,6 +572,19 @@ void RimSummaryPlotManager::updateFilterTextHistory() stringListSerializer.addString( m_filterText, maxItemCount ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::updateProjectTreeAndRefresUi() +{ + RiaSummaryTools::summaryPlotCollection()->updateConnectedEditors(); + + updateFilterTextHistory(); + m_filterText.uiCapability()->updateConnectedEditors(); + + setFocusToFilterText(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -655,15 +642,21 @@ void RimSummaryPlotManager::findFilteredSummaryCasesAndEnsembles( std::vector& ensembles ) const { auto filteredDataSources = findDataSourceCandidates(); - for ( const auto& ds : filteredDataSources ) + for ( const auto& [dataSourceName, dataSource] : filteredDataSources ) { - auto summaryCase = dynamic_cast( ds.second ); + auto selectedDataSources = m_selectedDataSources(); + + if ( std::find( selectedDataSources.begin(), selectedDataSources.end(), dataSourceName ) == + std::end( selectedDataSources ) ) + continue; + + auto summaryCase = dynamic_cast( dataSource ); if ( summaryCase ) { summaryCases.push_back( summaryCase ); } - auto ensemble = dynamic_cast( ds.second ); + auto ensemble = dynamic_cast( dataSource ); if ( ensemble ) { ensembles.push_back( ensemble ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h index 870aac4aff..4493f9364c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h @@ -29,6 +29,8 @@ class RimSummaryCase; class RimSummaryCaseCollection; class RimEnsembleCurveSet; class RimSummaryCurve; +class RimMultiPlot; +class RimPlot; class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf::SelectionChangedReceiver @@ -62,7 +64,6 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: bool eventFilter( QObject* obj, QEvent* event ) override; void updateCurveCandidates(); - void updateDataSourceCandidates(); std::vector> findDataSourceCandidates() const; @@ -71,28 +72,18 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: std::pair, std::vector> allDataSourcesInProject() const; - void updateUiFromSelection(); std::set filteredAddresses(); - void appendCurvesToPlot( RimSummaryPlot* destinationPlot ); - void updateFilterTextHistory(); - // Static helper functions - static std::set addressesForSource( caf::PdmObject* summarySource ); - - static RimEnsembleCurveSet* createCurveSet( RimSummaryCaseCollection* ensemble, const RifEclipseSummaryAddress& addr ); - static RimSummaryCurve* createCurve( RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& addr ); - - static void appendCurvesToPlot( RimSummaryPlot* summaryPlot, - const std::set& addresses, - const std::vector& summaryCases, - const std::vector& ensembles ); - - static void setFocusToEditorWidget( caf::PdmUiFieldHandle* uiFieldHandle ); + void updateUiFromSelection(); + void appendCurvesToPlot( RimSummaryPlot* destinationPlot ); + void updateFilterTextHistory(); + void updateProjectTreeAndRefresUi(); void splitIntoAddressAndDataSourceFilters( QStringList& addressFilters, QStringList& dataSourceFilters ) const; void findFilteredSummaryCasesAndEnsembles( std::vector& summaryCases, std::vector& ensembles ) const; + static void setFocusToEditorWidget( caf::PdmUiFieldHandle* uiFieldHandle ); static QString curveFilterRecentlyUsedRegistryKey(); private: @@ -100,7 +91,7 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: caf::PdmField m_filterText; caf::PdmField> m_addressCandidates; - caf::PdmField> m_dataSourceCandidates; + caf::PdmField> m_selectedDataSources; caf::PdmField m_includeDiffCurves; @@ -108,6 +99,12 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: caf::PdmField m_pushButtonNewPlot; caf::PdmField m_pushButtonAppend; + caf::PdmField m_individualPlotPerVector; + caf::PdmField m_individualPlotPerDataSource; + caf::PdmField m_createMultiPlot; + caf::PdmField m_labelA; caf::PdmField m_labelB; + + std::set m_previousDataSourceSelection; }; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index f1bbe2b991..021ff041a0 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -131,6 +131,12 @@ void RiuPlotMainWindow::initializeGuiNewProjectLoaded() m_pdmUiPropertyView->currentObject()->uiCapability()->updateConnectedEditors(); } + auto sumPlotManager = dynamic_cast( m_summaryPlotManager.get() ); + if ( sumPlotManager ) + { + sumPlotManager->updateConnectedEditors(); + } + { auto* obj = RiaSummaryTools::summaryCaseMainCollection(); if ( obj ) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp index bc3d3a7f93..83045b7465 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp @@ -281,6 +281,11 @@ void PdmUiComboBoxEditor::configureAndUpdateUi( const QString& uiConfigName ) { m_comboBox->setEditable( true ); + if ( !m_attributes.enableAutoComplete ) + { + m_comboBox->setCompleter( nullptr ); + } + m_comboBox->lineEdit()->setPlaceholderText( m_attributes.placeholderText ); } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h index c48fcc0a95..4dbb3b1f63 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.h @@ -61,6 +61,7 @@ class PdmUiComboBoxEditorAttribute : public PdmUiEditorAttribute minimumContentsLength = 8; maximumMenuContentsLength = 40; enableEditableContent = false; + enableAutoComplete = true; minimumWidth = -1; iconSize = QSize( 14, 14 ); notifyWhenTextIsEdited = false; @@ -73,6 +74,7 @@ class PdmUiComboBoxEditorAttribute : public PdmUiEditorAttribute // Set to <= 0 to ignore and use AdjustToContentsOnFirstShow instead int maximumMenuContentsLength; bool enableEditableContent; + bool enableAutoComplete; int minimumWidth; QString placeholderText; QString nextButtonText; From 29db2bc0127c4ef5fcbdc749128812e39126e3e7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 9 Dec 2021 09:46:08 +0100 Subject: [PATCH 035/406] Fix error in Python linting --- .github/workflows/python-linting.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/python-linting.yml b/.github/workflows/python-linting.yml index 52d6416f26..29d727d62a 100644 --- a/.github/workflows/python-linting.yml +++ b/.github/workflows/python-linting.yml @@ -20,3 +20,4 @@ jobs: title: 'Fixes by black (Python)' branch: python-black-patches branch-suffix: random + base: ${{ github.head_ref }} From 48843c50f65f67758599d4cc56a583deddf064f4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 9 Dec 2021 09:16:41 +0100 Subject: [PATCH 036/406] #8354 RFT file open : Inconsistent data might lead to crash Use try/catch to avoid crash from RFT file reader. Avoid reading data when considering if menu items should be visible. --- .../Commands/RicWellLogTools.cpp | 25 ++++++++++++++++++- ApplicationLibCode/Commands/RicWellLogTools.h | 3 ++- .../RicAdd3dWellLogRftCurveFeature.cpp | 4 ++- .../RicNewWellLogRftCurveFeature.cpp | 2 +- .../FileInterface/RifReaderEclipseRft.cpp | 12 +++++++-- 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/Commands/RicWellLogTools.cpp b/ApplicationLibCode/Commands/RicWellLogTools.cpp index a280b1c2c9..02ce78e04e 100644 --- a/ApplicationLibCode/Commands/RicWellLogTools.cpp +++ b/ApplicationLibCode/Commands/RicWellLogTools.cpp @@ -73,7 +73,30 @@ RimSimWellInView* RicWellLogTools::selectedSimulationWell( int* branchIndex ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RicWellLogTools::wellHasRftData( const QString& wellName ) +bool RicWellLogTools::hasRftData() +{ + RimEclipseResultCase* resultCase; + std::vector cases; + RimProject::current()->allCases( cases ); + + for ( RimCase* rimCase : cases ) + { + if ( ( resultCase = dynamic_cast( rimCase ) ) ) + { + if ( resultCase->rftReader() ) + { + return true; + } + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicWellLogTools::hasRftDataForWell( const QString& wellName ) { RimEclipseResultCase* resultCase; std::vector cases; diff --git a/ApplicationLibCode/Commands/RicWellLogTools.h b/ApplicationLibCode/Commands/RicWellLogTools.h index 791d423be5..540e514478 100644 --- a/ApplicationLibCode/Commands/RicWellLogTools.h +++ b/ApplicationLibCode/Commands/RicWellLogTools.h @@ -42,7 +42,8 @@ class RicWellLogTools { public: static RimSimWellInView* selectedSimulationWell( int* branchIndex ); - static bool wellHasRftData( const QString& wellName ); + static bool hasRftData(); + static bool hasRftDataForWell( const QString& wellName ); static bool isWellPathOrSimWellSelectedInView(); static void addWellLogChannelsToPlotTrack( RimWellLogTrack* plotTrack, const std::vector& wellLogFileChannels ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogRftCurveFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogRftCurveFeature.cpp index 6f9b4d46ea..dea217328d 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogRftCurveFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogRftCurveFeature.cpp @@ -44,7 +44,7 @@ bool RicAdd3dWellLogRftCurveFeature::isCommandEnabled() RimWellPath* wellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType(); if ( wellPath ) { - return RicWellLogTools::wellHasRftData( wellPath->name() ); + return RicWellLogTools::hasRftData(); } return false; } @@ -57,6 +57,8 @@ void RicAdd3dWellLogRftCurveFeature::onActionTriggered( bool isChecked ) RimWellPath* selectedWellPath = caf::SelectionManager::instance()->selectedItemAncestorOfType(); if ( !selectedWellPath ) return; + if ( !RicWellLogTools::hasRftDataForWell( selectedWellPath->name() ) ) return; + Rim3dWellLogRftCurve* rim3dWellLogRftCurve = new Rim3dWellLogRftCurve(); selectedWellPath->add3dWellLogCurve( rim3dWellLogRftCurve ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogRftCurveFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogRftCurveFeature.cpp index 2c74d231c6..6742f2a261 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogRftCurveFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogRftCurveFeature.cpp @@ -59,7 +59,7 @@ bool RicNewWellLogRftCurveFeature::isCommandEnabled() if ( simulationWell != nullptr ) { - return RicWellLogTools::wellHasRftData( simulationWell->name() ); + return RicWellLogTools::hasRftData(); } return false; diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp index 6b03502827..152e43c26b 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp @@ -56,11 +56,19 @@ void RifReaderEclipseRft::open() RiaLogging::info( QString( "Opening file '%1'" ).arg( m_fileName ) ); - m_ecl_rft_file = ecl_rft_file_alloc_case( RiaStringEncodingTools::toNativeEncoded( m_fileName ).data() ); + try + { + // Use try/catch, as inconsistent RFT data might lead to exceptions + // https://github.com/OPM/ResInsight/issues/8354 + m_ecl_rft_file = ecl_rft_file_alloc_case( RiaStringEncodingTools::toNativeEncoded( m_fileName ).data() ); + } + catch ( ... ) + { + } if ( m_ecl_rft_file == nullptr ) { - RiaLogging::warning( QString( "Libecl could not find/open file '%'" ).arg( m_fileName ) ); + RiaLogging::warning( QString( "Libecl could not find/open file '%1" ).arg( m_fileName ) ); return; } From 3938e9e6001ee9e7d3e4eb636a7309237804acfc Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 9 Dec 2021 14:11:48 +0100 Subject: [PATCH 037/406] #8359 Plot Project Tree : Always show multi plot collection If no multi plots was present, the top level collection was not visible. This caused the project tree to collapse when a new plot was created. --- .../Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp | 3 +-- ApplicationLibCode/ProjectDataModel/RimProject.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index cf45535b41..dd40aea3bc 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -241,10 +241,9 @@ RimMultiPlot* RicSummaryPlotBuilder::createAndAppendMultiPlot( const std::vector plot->loadDataAndUpdate(); } - project->updateAllRequiredEditors(); + plotCollection->updateAllRequiredEditors(); plotWindow->loadDataAndUpdate(); - RiuPlotMainWindowTools::setExpanded( plotCollection, true ); RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); return plotWindow; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index f33befda5d..32f4de1f93 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -1474,8 +1474,7 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q itemCollection->add( mainPlotCollection->saturationPressurePlotCollection() ); } - if ( mainPlotCollection->multiPlotCollection() && - !mainPlotCollection->multiPlotCollection()->multiPlots().empty() ) + if ( mainPlotCollection->multiPlotCollection() ) { itemCollection->add( mainPlotCollection->multiPlotCollection() ); } From 033cc4f1b74c7dee0985bc176bcc5bcc6c188274 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 9 Dec 2021 14:44:47 +0100 Subject: [PATCH 038/406] #8359 Plot Project Tree : Avoid update of plot if possible --- .../SummaryPlotCommands/RicNewSummaryCurveFeature.cpp | 3 ++- .../RicNewSummaryEnsembleCurveSetFeature.cpp | 2 +- .../SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp | 3 ++- .../ProjectDataModel/Summary/RimEnsembleCurveSet.cpp | 4 ---- .../Summary/RimEnsembleCurveSetCollection.cpp | 4 ---- .../ProjectDataModel/Summary/RimSummaryCurve.cpp | 1 - 6 files changed, 5 insertions(+), 12 deletions(-) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp index d77449b522..234422fa28 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp @@ -29,6 +29,7 @@ #include "RimProject.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCurve.h" +#include "RimSummaryCurveCollection.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" @@ -102,7 +103,7 @@ void RicNewSummaryCurveFeature::onActionTriggered( bool isChecked ) newCurve->setSummaryCaseY( defaultCase ); plot->loadDataAndUpdate(); - plot->updateConnectedEditors(); + plot->summaryCurveCollection()->updateAllRequiredEditors(); app->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem( newCurve ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp index bd3053fdf5..634f49d33f 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp @@ -172,7 +172,7 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered( bool isChecked ) if ( !curveSets.empty() ) firstCurveSet = curveSets.front(); } plot->loadDataAndUpdate(); - plot->updateConnectedEditors(); + plot->ensembleCurveSetCollection()->updateAllRequiredEditors(); RiaGuiApplication* app = RiaGuiApplication::instance(); RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp index cfec2ab6a2..7b55d07c38 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp @@ -24,6 +24,7 @@ #include "RimSummaryCrossPlot.h" #include "RimSummaryCurve.h" +#include "RimSummaryCurveCollection.h" #include "RimSummaryPlot.h" #include "cafPdmDefaultObjectFactory.h" @@ -62,7 +63,7 @@ RimSummaryCurve* RicPasteSummaryCurveFeature::copyCurveAndAddToPlot( RimSummaryC newCurve->loadDataAndUpdate( true ); newCurve->updateConnectedEditors(); - summaryPlot->updateConnectedEditors(); + summaryPlot->summaryCurveCollection()->updateAllRequiredEditors(); return newCurve; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index f36ab3a916..f5d5b7cad3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -623,10 +623,6 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi updateConnectedEditors(); - RimSummaryPlot* summaryPlot = nullptr; - this->firstAncestorOrThisOfTypeAsserted( summaryPlot ); - summaryPlot->updateConnectedEditors(); - updateTextInPlot = true; } else if ( changedField == &m_yValuesSummaryAddressUiField ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp index 6846f86b72..79ecf274a6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp @@ -309,10 +309,6 @@ void RimEnsembleCurveSetCollection::fieldChangedByUi( const caf::PdmFieldHandle* if ( changedField == &m_showCurves ) { loadDataAndUpdate( true ); - - RimSummaryPlot* summaryPlot = nullptr; - this->firstAncestorOrThisOfTypeAsserted( summaryPlot ); - summaryPlot->updateConnectedEditors(); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 10532f00e4..7843ed4c11 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -1037,7 +1037,6 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { plot->updateAxes(); plot->updatePlotTitle(); - plot->updateConnectedEditors(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); mainPlotWindow->updateSummaryPlotToolBar(); From bf7917ab7c7d416c11eaa18d2c7f3a50d561c3ba Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 8 Dec 2021 10:58:15 +0100 Subject: [PATCH 039/406] Janitor: Remove obsolete code --- ApplicationLibCode/ProjectDataModel/RimProject.cpp | 9 --------- .../Summary/RimCalculatedSummaryCase.cpp | 8 -------- .../Summary/RimCalculatedSummaryCase.h | 1 - .../Summary/RimDerivedSummaryCase.cpp | 8 -------- .../ProjectDataModel/Summary/RimDerivedSummaryCase.h | 1 - .../Summary/RimEnsembleStatisticsCase.h | 2 -- .../ProjectDataModel/Summary/RimFileSummaryCase.cpp | 9 --------- .../ProjectDataModel/Summary/RimFileSummaryCase.h | 1 - .../ProjectDataModel/Summary/RimGridSummaryCase.cpp | 8 -------- .../ProjectDataModel/Summary/RimGridSummaryCase.h | 1 - .../Summary/RimObservedSummaryData.cpp | 9 --------- .../Summary/RimObservedSummaryData.h | 1 - .../ProjectDataModel/Summary/RimSummaryCase.h | 2 -- .../Summary/RimSummaryCaseMainCollection.cpp | 12 ------------ .../Summary/RimSummaryCaseMainCollection.h | 2 -- 15 files changed, 74 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 32f4de1f93..fff5b9d129 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -477,11 +477,6 @@ void RimProject::setProjectFileNameAndUpdateDependencies( const QString& project cases[i]->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath ); } - for ( RimSummaryCase* summaryCase : allSummaryCases() ) - { - summaryCase->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath ); - } - // Update path to well path file cache for ( RimOilField* oilField : oilFields ) { @@ -494,10 +489,6 @@ void RimProject::setProjectFileNameAndUpdateDependencies( const QString& project { oilField->formationNamesCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath ); } - if ( oilField->summaryCaseMainCollection() != nullptr ) - { - oilField->summaryCaseMainCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath ); - } CVF_ASSERT( oilField->fractureDefinitionCollection() ); oilField->fractureDefinitionCollection()->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.cpp index 4123054e31..28f6ecbf88 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.cpp @@ -75,14 +75,6 @@ RifSummaryReaderInterface* RimCalculatedSummaryCase::summaryReader() return m_calculatedCurveReader.get(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimCalculatedSummaryCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) -{ - // Nothing to do here -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.h index 955e127a6f..613f115d49 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.h @@ -42,7 +42,6 @@ class RimCalculatedSummaryCase : public RimSummaryCase QString caseName() const override; void createSummaryReaderInterface() override; RifSummaryReaderInterface* summaryReader() override; - void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override; void buildMetaData(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp index 9594e74a6b..f19e340d4b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp @@ -320,14 +320,6 @@ RifSummaryReaderInterface* RimDerivedSummaryCase::summaryReader() return m_reader.get(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimDerivedSummaryCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) -{ - // NOP -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.h index 41bf519121..81c31360a6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.h @@ -79,7 +79,6 @@ class RimDerivedSummaryCase : public RimSummaryCase void createSummaryReaderInterface() override; RifSummaryReaderInterface* summaryReader() override; - void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override; void updateDisplayNameFromCases(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h index e5579e8257..20b53581ac 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h @@ -49,8 +49,6 @@ class RimEnsembleStatisticsCase : public RimSummaryCase void createSummaryReaderInterface() override; RifSummaryReaderInterface* summaryReader() override; - void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override {} - const RimEnsembleCurveSet* curveSet() const; void calculate( const std::vector& sumCases, bool includeIncompleteCurves ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp index 4644b9fab3..8aa453d33b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp @@ -77,15 +77,6 @@ QString RimFileSummaryCase::caseName() const return caseFileName.completeBaseName(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimFileSummaryCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) -{ - // m_summaryHeaderFilename = - // RimTools::relocateFile( m_summaryHeaderFilename().path(), newProjectPath, oldProjectPath, nullptr, nullptr ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h index 4dcd212aa7..b5e719923d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h @@ -42,7 +42,6 @@ class RimFileSummaryCase : public RimSummaryCase QString summaryHeaderFilename() const override; QString caseName() const override; - void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override; void createSummaryReaderInterfaceThreadSafe( RiaThreadSafeLogger* threadSafeLogger ); void createSummaryReaderInterface() override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp index df309c42f4..473a106470 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.cpp @@ -174,14 +174,6 @@ QString RimGridSummaryCase::eclipseGridFileName() const return m_eclipseCase()->gridFileName(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimGridSummaryCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) -{ - // Shouldn't have to do anything -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.h index 355a3996fd..8787af8f8a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimGridSummaryCase.h @@ -47,7 +47,6 @@ class RimGridSummaryCase : public RimSummaryCase QString summaryHeaderFilename() const override; QString caseName() const override; - void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override; void createSummaryReaderInterface() override; RifSummaryReaderInterface* summaryReader() override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp index 72b0f7f88e..411898405e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp @@ -63,15 +63,6 @@ QString RimObservedSummaryData::caseName() const return caseFileName.completeBaseName(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimObservedSummaryData::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) -{ - // m_summaryHeaderFilename = - // RimTools::relocateFile( m_summaryHeaderFilename(), newProjectPath, oldProjectPath, nullptr, nullptr ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h index fbdf69e977..30343a37df 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h @@ -37,7 +37,6 @@ class RimObservedSummaryData : public RimSummaryCase RimObservedSummaryData(); QString caseName() const override; - void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override; QString identifierName() const; RifEclipseSummaryAddress::SummaryVarCategory summaryCategory() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h index 4101956284..999d30a4ee 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h @@ -69,8 +69,6 @@ class RimSummaryCase : public caf::PdmObject virtual RifReaderRftInterface* rftReader(); virtual QString errorMessagesFromReader(); - virtual void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) = 0; - void setSummaryHeaderFileName( const QString& fileName ); bool isObservedData() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index 5db2ba0b98..efe398cdff 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -712,18 +712,6 @@ QString RimSummaryCaseMainCollection::uniqueShortNameForCase( RimSummaryCase* su return shortName; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCaseMainCollection::updateFilePathsFromProjectPath( const QString& newProjectPath, - const QString& oldProjectPath ) -{ - for ( auto summaryCase : m_cases ) - { - summaryCase->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath ); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h index cb6e559fe4..e80617713f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h @@ -70,8 +70,6 @@ class RimSummaryCaseMainCollection : public caf::PdmObject QString uniqueShortNameForCase( RimSummaryCase* summaryCase ); - void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ); - void updateAutoShortName(); private: From 2d5313772e7e856e8f3735e94422fe7b39e4b64f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 7 Dec 2021 14:45:50 +0100 Subject: [PATCH 040/406] Janitor : Support import of stand alone ESMRY files All import of summary data was previously started from a SMSPEC file. As the ESMRY file is completely independent, it is useful to import these files directly. --- ApplicationLibCode/Application/RiaDefines.cpp | 4 ++++ .../ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/Application/RiaDefines.cpp b/ApplicationLibCode/Application/RiaDefines.cpp index 9a5b39f07f..fcac9ae01f 100644 --- a/ApplicationLibCode/Application/RiaDefines.cpp +++ b/ApplicationLibCode/Application/RiaDefines.cpp @@ -285,6 +285,10 @@ RiaDefines::ImportFileType RiaDefines::obtainFileTypeFromFileName( const QString { return ImportFileType::ECLIPSE_SUMMARY_FILE; } + else if ( fileName.endsWith( "ESMRY", Qt::CaseInsensitive ) ) + { + return ImportFileType::ECLIPSE_SUMMARY_FILE; + } else if ( fileName.endsWith( "ODB", Qt::CaseInsensitive ) ) { return ImportFileType::GEOMECH_ODB_FILE; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index efe398cdff..813bafd5b0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -625,8 +625,9 @@ std::vector RimSummaryCaseMainCollection::createSummaryCasesFro { const QString& smspecFileName = fileInfo.summaryFileName(); + bool isEsmryFile = smspecFileName.endsWith( "ESMRY" ); bool foundDataFile = RiaEclipseFileNameTools::isSummaryDataFilePresent( smspecFileName ); - if ( foundDataFile ) + if ( foundDataFile || isEsmryFile ) { RimFileSummaryCase* newSumCase = new RimFileSummaryCase(); From 562be98e63ce7a1caf5c525495394856b8c65fa3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 8 Dec 2021 13:27:05 +0100 Subject: [PATCH 041/406] Janitor: Add type cast --- .../custom-opm-common/opm-common/opm/io/eclipse/EclOutput.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ThirdParty/custom-opm-common/opm-common/opm/io/eclipse/EclOutput.hpp b/ThirdParty/custom-opm-common/opm-common/opm/io/eclipse/EclOutput.hpp index a20c4d0dd2..74628ce416 100644 --- a/ThirdParty/custom-opm-common/opm-common/opm/io/eclipse/EclOutput.hpp +++ b/ThirdParty/custom-opm-common/opm-common/opm/io/eclipse/EclOutput.hpp @@ -63,13 +63,13 @@ class EclOutput if (isFormatted) { - writeFormattedHeader(name, data.size(), arrType, element_size); + writeFormattedHeader(name, static_cast(data.size()), arrType, element_size); if (arrType != MESS) writeFormattedArray(data); } else { - writeBinaryHeader(name, data.size(), arrType, element_size); + writeBinaryHeader(name, static_cast(data.size()), arrType, element_size); if (arrType != MESS) writeBinaryArray(data); } From 4090e7050788f512a1762708cac1da282a560939 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 14 Dec 2021 11:10:19 +0100 Subject: [PATCH 042/406] #8356 Summary Data : Add support for use of summary summary data from Python --- .../Application/RiaGuiApplication.cpp | 3 + .../FileInterface/CMakeLists_files.cmake | 4 + .../RifMultipleSummaryReaders.cpp | 121 ++++++++++ .../FileInterface/RifMultipleSummaryReaders.h | 47 ++++ .../RifProjectSummaryDataWriter.cpp | 220 ++++++++++++++++++ .../RifProjectSummaryDataWriter.h | 67 ++++++ .../Summary/RimFileSummaryCase.cpp | 200 +++++++++++++++- .../Summary/RimFileSummaryCase.h | 22 +- .../Summary/RimSummaryCaseMainCollection.cpp | 16 ++ .../Summary/RimSummaryCaseMainCollection.h | 1 + .../RimcSummaryCase.cpp | 56 +++++ .../RimcSummaryCase.h | 21 ++ .../rips/PythonExamples/summary_vectors.py | 5 + .../Python/rips/tests/test_summary_cases.py | 32 +++ 14 files changed, 809 insertions(+), 6 deletions(-) create mode 100644 ApplicationLibCode/FileInterface/RifMultipleSummaryReaders.cpp create mode 100644 ApplicationLibCode/FileInterface/RifMultipleSummaryReaders.h create mode 100644 ApplicationLibCode/FileInterface/RifProjectSummaryDataWriter.cpp create mode 100644 ApplicationLibCode/FileInterface/RifProjectSummaryDataWriter.h diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index f14eb7da0e..449a2578d3 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -32,6 +32,7 @@ #include "RiaProjectModifier.h" #include "RiaRegressionTestRunner.h" #include "RiaSocketServer.h" +#include "RiaSummaryTools.h" #include "RiaVersionInfo.h" #include "RiaViewRedrawScheduler.h" @@ -1338,6 +1339,8 @@ void RiaGuiApplication::onProjectBeingSaved() { setLastUsedDialogDirectory( "BINARY_GRID", QFileInfo( m_project->fileName() ).absolutePath() ); storeTreeViewState(); + + RiaSummaryTools::summaryCaseMainCollection()->onProjectBeingSaved(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/CMakeLists_files.cmake b/ApplicationLibCode/FileInterface/CMakeLists_files.cmake index a9f5eb43d4..a45e86fc81 100644 --- a/ApplicationLibCode/FileInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/FileInterface/CMakeLists_files.cmake @@ -69,6 +69,8 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RifWellIAFileWriter.h ${CMAKE_CURRENT_LIST_DIR}/RifEclipseTextFileReader.h ${CMAKE_CURRENT_LIST_DIR}/RifEclipseKeywordContent.h + ${CMAKE_CURRENT_LIST_DIR}/RifMultipleSummaryReaders.h + ${CMAKE_CURRENT_LIST_DIR}/RifProjectSummaryDataWriter.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -139,6 +141,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RifEclEclipseSummary.cpp ${CMAKE_CURRENT_LIST_DIR}/RifWellIAFileWriter.cpp ${CMAKE_CURRENT_LIST_DIR}/RifEclipseTextFileReader.cpp + ${CMAKE_CURRENT_LIST_DIR}/RifMultipleSummaryReaders.cpp + ${CMAKE_CURRENT_LIST_DIR}/RifProjectSummaryDataWriter.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/FileInterface/RifMultipleSummaryReaders.cpp b/ApplicationLibCode/FileInterface/RifMultipleSummaryReaders.cpp new file mode 100644 index 0000000000..0f630033e6 --- /dev/null +++ b/ApplicationLibCode/FileInterface/RifMultipleSummaryReaders.cpp @@ -0,0 +1,121 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RifMultipleSummaryReaders.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifMultipleSummaryReaders::RifMultipleSummaryReaders() = default; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifMultipleSummaryReaders::addReader( RifSummaryReaderInterface* reader ) +{ + for ( auto existingReader : m_readers ) + { + if ( existingReader.p() == reader ) return; + } + + m_readers.push_back( reader ); + + rebuildMetaData(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifMultipleSummaryReaders::removeReader( RifSummaryReaderInterface* reader ) +{ + m_readers.erase( reader ); + rebuildMetaData(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& RifMultipleSummaryReaders::timeSteps( const RifEclipseSummaryAddress& resultAddress ) const +{ + for ( const auto& r : m_readers ) + { + if ( r->hasAddress( resultAddress ) ) return r->timeSteps( resultAddress ); + } + + static std::vector empty; + + return empty; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RifMultipleSummaryReaders::values( const RifEclipseSummaryAddress& resultAddress, std::vector* values ) const +{ + for ( const auto& r : m_readers ) + { + if ( r->hasAddress( resultAddress ) ) return r->values( resultAddress, values ); + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RifMultipleSummaryReaders::unitName( const RifEclipseSummaryAddress& resultAddress ) const +{ + for ( const auto& r : m_readers ) + { + if ( r->hasAddress( resultAddress ) ) return r->unitName( resultAddress ); + } + + return {}; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::EclipseUnitSystem RifMultipleSummaryReaders::unitSystem() const +{ + CVF_ASSERT( !m_readers.empty() ); + + return m_readers.at( 0 )->unitSystem(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifMultipleSummaryReaders::rebuildMetaData() +{ + m_allErrorAddresses.clear(); + m_allResultAddresses.clear(); + + for ( const auto& reader : m_readers ) + { + { + auto resultAddresses = reader->allResultAddresses(); + m_allResultAddresses.insert( resultAddresses.begin(), resultAddresses.end() ); + } + + { + auto errorResultAddresses = reader->allErrorAddresses(); + m_allErrorAddresses.insert( errorResultAddresses.begin(), errorResultAddresses.end() ); + } + } +} diff --git a/ApplicationLibCode/FileInterface/RifMultipleSummaryReaders.h b/ApplicationLibCode/FileInterface/RifMultipleSummaryReaders.h new file mode 100644 index 0000000000..4adddef029 --- /dev/null +++ b/ApplicationLibCode/FileInterface/RifMultipleSummaryReaders.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RifSummaryReaderInterface.h" + +#include "cvfCollection.h" + +#include + +//================================================================================================== +/// +//================================================================================================== +class RifMultipleSummaryReaders : public RifSummaryReaderInterface +{ +public: + RifMultipleSummaryReaders(); + + void addReader( RifSummaryReaderInterface* reader ); + void removeReader( RifSummaryReaderInterface* reader ); + + const std::vector& timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override; + bool values( const RifEclipseSummaryAddress& resultAddress, std::vector* values ) const override; + std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override; + RiaDefines::EclipseUnitSystem unitSystem() const override; + + void rebuildMetaData(); + +private: + cvf::Collection m_readers; +}; diff --git a/ApplicationLibCode/FileInterface/RifProjectSummaryDataWriter.cpp b/ApplicationLibCode/FileInterface/RifProjectSummaryDataWriter.cpp new file mode 100644 index 0000000000..967c78fca2 --- /dev/null +++ b/ApplicationLibCode/FileInterface/RifProjectSummaryDataWriter.cpp @@ -0,0 +1,220 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RifProjectSummaryDataWriter.h" + +#include "RifSummaryReaderInterface.h" + +#include "opm/common/utility/TimeService.hpp" +#include "opm/io/eclipse/EclOutput.hpp" +#include "opm/io/eclipse/ExtESmry.hpp" + +#include "cafAssert.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifProjectSummaryDataWriter::RifProjectSummaryDataWriter() + : m_timeStepCount( 0 ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifProjectSummaryDataWriter::importFromSourceSummaryReader( const RifSummaryReaderInterface* reader ) +{ + if ( !reader ) return; + + std::string keyword = "TIME"; + auto summaryAddress = RifEclipseSummaryAddress::miscAddress( keyword ); + if ( reader->hasAddress( summaryAddress ) ) + { + auto timeSteps = reader->timeSteps( summaryAddress ); + if ( !timeSteps.empty() ) + { + Opm::TimeStampUTC ts( timeSteps.front() ); + m_startTime = { ts.day(), ts.month(), ts.year(), ts.hour(), ts.minutes(), ts.seconds(), 0 }; + } + + std::vector values; + reader->values( summaryAddress, &values ); + + const auto& unitString = reader->unitName( summaryAddress ); + + m_keywords.push_back( keyword ); + m_units.push_back( unitString ); + + std::vector floatValues; + floatValues.reserve( values.size() ); + for ( const auto& v : values ) + { + floatValues.push_back( v ); + } + + m_values.push_back( floatValues ); + + m_timeStepCount = values.size(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifProjectSummaryDataWriter::importFromProjectSummaryFile( const std::string& projectSummaryFileName ) +{ + try + { + Opm::EclIO::ExtESmry sourceSummary( projectSummaryFileName ); + + Opm::TimeStampUTC ts( std::chrono::system_clock::to_time_t( sourceSummary.startdate() ) ); + m_startTime = { ts.day(), ts.month(), ts.year(), ts.hour(), ts.minutes(), ts.seconds(), 0 }; + + auto keywords = sourceSummary.keywordList(); + for ( const auto& keyword : keywords ) + { + const auto& values = sourceSummary.get( keyword ); + const auto& unitString = sourceSummary.get_unit( keyword ); + + m_keywords.push_back( keyword ); + m_units.push_back( unitString ); + m_values.push_back( values ); + + if ( m_timeStepCount == 0 ) + { + m_timeStepCount = values.size(); + } + } + } + catch ( ... ) + { + std::string txt = "Error detected during import of data from " + projectSummaryFileName; + m_errorMessages.push_back( txt ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifProjectSummaryDataWriter::setData( const std::vector& keywords, + const std::vector& units, + const std::vector>& values ) +{ + if ( keywords.empty() ) return; + + CAF_ASSERT( keywords.size() == units.size() ); + CAF_ASSERT( keywords.size() == values.size() ); + + for ( size_t i = 0; i < keywords.size(); i++ ) + { + auto existingIndex = indexForKeyword( keywords[i] ); + if ( existingIndex == -1 ) + { + m_keywords.push_back( keywords[i] ); + m_units.push_back( units[i] ); + m_values.push_back( values[i] ); + } + else + { + // Overwrite existing data + + m_keywords[existingIndex] = keywords[i]; + m_units[existingIndex] = units[i]; + m_values[existingIndex] = values[i]; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifProjectSummaryDataWriter::writeDataToFile( const std::string& fileName ) +{ + // Reference to other locations writing to ESMRY files + // ESmry::make_esmry_file() + // ExtSmryOutput::write() + + try + { + // The ExtESmry reader supports only binary mode, set formatted to false + bool formatted = false; + Opm::EclIO::EclOutput outFile( fileName, formatted, std::ios::out ); + + outFile.write( "START", m_startTime ); + outFile.write( "KEYCHECK", m_keywords ); + outFile.write( "UNITS", m_units ); + + { + // Bool array 1 means RSTEP, 0 means no RSTEP + // Dummy values, but required by the reader + std::vector intValues( m_timeStepCount, 1 ); + outFile.write( "RSTEP", intValues ); + } + + { + // TSTEP represents time steps + // Dummy values, but required by the reader + std::vector intValues; + intValues.resize( m_timeStepCount ); + std::iota( intValues.begin(), intValues.end(), 0 ); + outFile.write( "TSTEP", intValues ); + } + + for ( size_t i = 0; i < static_cast( m_keywords.size() ); i++ ) + { + std::string vect_name = "V" + std::to_string( i ); + outFile.write( vect_name, m_values[i] ); + } + } + catch ( ... ) + { + std::string txt = "Error detected during export of data to " + fileName; + m_errorMessages.push_back( txt ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifProjectSummaryDataWriter::errorMessages() const +{ + return m_errorMessages; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifProjectSummaryDataWriter::clearErrorMessages() +{ + m_errorMessages.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifProjectSummaryDataWriter::indexForKeyword( const std::string& keyword ) const +{ + for ( int i = 0; i < static_cast( m_keywords.size() ); i++ ) + { + if ( m_keywords[i] == keyword ) return i; + } + + return -1; +} diff --git a/ApplicationLibCode/FileInterface/RifProjectSummaryDataWriter.h b/ApplicationLibCode/FileInterface/RifProjectSummaryDataWriter.h new file mode 100644 index 0000000000..c1ec6e3373 --- /dev/null +++ b/ApplicationLibCode/FileInterface/RifProjectSummaryDataWriter.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include + +class RifEclipseSummaryAddress; +class RifSummaryReaderInterface; + +//================================================================================================== +// +// +//================================================================================================== +class RifProjectSummaryDataWriter +{ +public: + RifProjectSummaryDataWriter(); + + // Import start time, time values, and time step count from a source summary case + void importFromSourceSummaryReader( const RifSummaryReaderInterface* reader ); + + // Import all data from project summary file. This file can than be overwritten using writeDataToFile() + void importFromProjectSummaryFile( const std::string& projectSummaryFileName ); + + // Set data for a list of keyword/unit/values. If a keyword exist, the data will be overwritten + void setData( const std::vector& keywords, + const std::vector& units, + const std::vector>& values ); + + void writeDataToFile( const std::string& fileName ); + + std::vector errorMessages() const; + void clearErrorMessages(); + +private: + int indexForKeyword( const std::string& keyword ) const; + +private: + // Structure used to represent start time defined in the following order + // [DAY, MONTH, YEAR, HOUR, MINUTE, SECOND, MILLI_SEC] + std::vector m_startTime; + + std::vector m_keywords; + std::vector m_units; + std::vector> m_values; + + size_t m_timeStepCount; + + std::vector m_errorMessages; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp index 8aa453d33b..97299d57fe 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp @@ -18,21 +18,29 @@ #include "RimFileSummaryCase.h" +#include "RiaApplication.h" #include "RiaLogging.h" #include "RicfCommandObject.h" + #include "RifEclipseSummaryTools.h" +#include "RifMultipleSummaryReaders.h" +#include "RifOpmCommonSummary.h" +#include "RifProjectSummaryDataWriter.h" #include "RifReaderEclipseRft.h" #include "RifReaderEclipseSummary.h" #include "RifSummaryReaderMultipleFiles.h" +#include "RimProject.h" #include "RimTools.h" #include "cafPdmFieldScriptingCapability.h" #include "cafPdmObjectScriptingCapability.h" +#include "cafPdmUiFilePathEditor.h" #include #include +#include //================================================================================================== // @@ -48,8 +56,12 @@ RimFileSummaryCase::RimFileSummaryCase() { CAF_PDM_InitScriptableObject( "File Summary Case ", ":/SummaryCases16x16.png", "", "A Summary Case based on SMSPEC files" ); CAF_PDM_InitScriptableField( &m_includeRestartFiles, "IncludeRestartFiles", false, "Include Restart Files" ); - m_includeRestartFiles.uiCapability()->setUiHidden( true ); + + CAF_PDM_InitFieldNoDefault( &m_additionalSummaryFilePath, + "AdditionalSummaryFilePath", + "Additional File Path (set invisible when ready)" ); + m_additionalSummaryFilePath.uiCapability()->setUiHidden( true ); } //-------------------------------------------------------------------------------------------------- @@ -82,9 +94,14 @@ QString RimFileSummaryCase::caseName() const //-------------------------------------------------------------------------------------------------- void RimFileSummaryCase::createSummaryReaderInterfaceThreadSafe( RiaThreadSafeLogger* threadSafeLogger ) { - m_summaryFileReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(), + m_fileSummaryReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(), m_includeRestartFiles, threadSafeLogger ); + + m_multiSummaryReader = new RifMultipleSummaryReaders; + m_multiSummaryReader->addReader( m_fileSummaryReader.p() ); + + openAndAttachAdditionalReader(); } //-------------------------------------------------------------------------------------------------- @@ -93,9 +110,13 @@ void RimFileSummaryCase::createSummaryReaderInterfaceThreadSafe( RiaThreadSafeLo void RimFileSummaryCase::createSummaryReaderInterface() { RiaThreadSafeLogger threadSafeLogger; - m_summaryFileReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(), + m_fileSummaryReader = RimFileSummaryCase::findRelatedFilesAndCreateReader( this->summaryHeaderFilename(), m_includeRestartFiles, &threadSafeLogger ); + m_multiSummaryReader = new RifMultipleSummaryReaders; + m_multiSummaryReader->addReader( m_fileSummaryReader.p() ); + + openAndAttachAdditionalReader(); auto messages = threadSafeLogger.messages(); for ( const auto& m : messages ) @@ -181,16 +202,52 @@ RifReaderEclipseRft* RimFileSummaryCase::findRftDataAndCreateReader( const QStri return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFileSummaryCase::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + if ( field == &m_additionalSummaryFilePath ) + { + caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast( attribute ); + if ( myAttr ) + { + myAttr->m_selectSaveFileName = true; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFileSummaryCase::openAndAttachAdditionalReader() +{ + QString additionalSummaryFilePath = m_additionalSummaryFilePath().path(); + + cvf::ref opmCommonReader = new RifOpmCommonEclipseSummary; + opmCommonReader->useEnhancedSummaryFiles( true ); + + bool includeRestartFiles = false; + auto isValid = opmCommonReader->open( additionalSummaryFilePath, includeRestartFiles, nullptr ); + if ( isValid ) + { + m_multiSummaryReader->addReader( opmCommonReader.p() ); + m_additionalSummaryFileReader = opmCommonReader; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RifSummaryReaderInterface* RimFileSummaryCase::summaryReader() { - if ( m_summaryFileReader.isNull() ) + if ( m_multiSummaryReader.isNull() ) { createSummaryReaderInterface(); } - return m_summaryFileReader.p(); + return m_multiSummaryReader.p(); } //-------------------------------------------------------------------------------------------------- @@ -212,3 +269,136 @@ void RimFileSummaryCase::setIncludeRestartFiles( bool includeRestartFiles ) { m_includeRestartFiles = includeRestartFiles; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFileSummaryCase::setSummaryData( const std::string& keyword, const std::string& unit, const std::vector& values ) +{ + size_t mainSummaryFileValueCount = m_fileSummaryReader->timeSteps( RifEclipseSummaryAddress() ).size(); + if ( values.size() != mainSummaryFileValueCount ) + { + QString txt = QString( "Wrong size of summary data for keyword %1. Expected %2 values, received %3 values" ) + .arg( QString::fromStdString( keyword ) ) + .arg( mainSummaryFileValueCount ) + .arg( values.size() ); + RiaLogging::error( txt ); + + return; + } + + // Remove existing reader to be able to write to the summary file + m_multiSummaryReader->removeReader( m_additionalSummaryFileReader.p() ); + m_additionalSummaryFileReader = nullptr; + + RifProjectSummaryDataWriter projectSummaryDataWriter; + + QString tmpAdditionalSummaryFilePath = m_additionalSummaryFilePath().path(); + QFileInfo fi( tmpAdditionalSummaryFilePath ); + if ( fi.exists() ) + { + projectSummaryDataWriter.importFromProjectSummaryFile( tmpAdditionalSummaryFilePath.toStdString() ); + } + else + { + projectSummaryDataWriter.importFromSourceSummaryReader( m_fileSummaryReader.p() ); + + auto tempFilePath = additionalSummaryDataFilePath(); + + m_additionalSummaryFilePath = tempFilePath; + tmpAdditionalSummaryFilePath = tempFilePath; + } + + projectSummaryDataWriter.setData( { keyword }, { unit }, { values } ); + + std::string outputFilePath = tmpAdditionalSummaryFilePath.toStdString(); + projectSummaryDataWriter.writeDataToFile( outputFilePath ); + + for ( const auto& txt : projectSummaryDataWriter.errorMessages() ) + { + RiaLogging::error( QString::fromStdString( txt ) ); + } + projectSummaryDataWriter.clearErrorMessages(); + + openAndAttachAdditionalReader(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFileSummaryCase::onProjectBeingSaved() +{ + // If additional data is stored in temp folder, copy to project folder and remove file in temp folder + + auto existingFilePath = m_additionalSummaryFilePath().path(); + if ( QFile::exists( existingFilePath ) ) + { + auto currentFilePath = additionalSummaryDataFilePath(); + if ( existingFilePath != currentFilePath ) + { + if ( QFile::copy( existingFilePath, currentFilePath ) ) + { + QFile::remove( existingFilePath ); + m_additionalSummaryFilePath = currentFilePath; + + openAndAttachAdditionalReader(); + } + else + { + QString txt = "Error when copying temporary file to " + currentFilePath; + RiaLogging::error( txt ); + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimFileSummaryCase::createAdditionalSummaryFileName() +{ + QUuid uuid = QUuid::createUuid(); + QString uuidString = uuid.toString(); + uuidString.remove( '{' ).remove( '}' ); + + auto filePath = "RI_SUMMARY_DATA_" + uuidString + ".ESMRY"; + + return filePath; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimFileSummaryCase::additionalSummaryDataFilePath() const +{ + QDir storageDir; + RiaApplication* app = RiaApplication::instance(); + if ( app->isProjectSavedToDisc() ) + { + QString projectFileName = RimProject::current()->fileName(); + + QFileInfo fileInfo( projectFileName ); + storageDir = fileInfo.dir(); + } + else + { + // If project is not saved, use the temp folder + storageDir = QDir::temp(); + } + + QString fileName; + auto cacheSummaryFilePath = m_additionalSummaryFilePath().path(); + if ( cacheSummaryFilePath.isEmpty() ) + { + fileName = createAdditionalSummaryFileName(); + } + else + { + QFileInfo fi( cacheSummaryFilePath ); + fileName = fi.fileName(); + } + + auto filePath = storageDir.absoluteFilePath( fileName ); + + return filePath; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h index b5e719923d..7ae8e94092 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h @@ -26,6 +26,9 @@ class RifReaderRftInterface; class RifReaderEclipseRft; class RifReaderEclipseSummary; class RiaThreadSafeLogger; +class RifOpmCommonEclipseSummary; +class RifEclipseSummaryAddress; +class RifMultipleSummaryReaders; //================================================================================================== // @@ -51,14 +54,31 @@ class RimFileSummaryCase : public RimSummaryCase void setIncludeRestartFiles( bool includeRestartFiles ); + void setSummaryData( const std::string& keyword, const std::string& unit, const std::vector& values ); + void onProjectBeingSaved(); + static RifSummaryReaderInterface* findRelatedFilesAndCreateReader( const QString& headerFileName, bool includeRestartFiles, RiaThreadSafeLogger* threadSafeLogger ); static RifReaderEclipseRft* findRftDataAndCreateReader( const QString& headerFileName ); +protected: + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; + private: - cvf::ref m_summaryFileReader; + void openAndAttachAdditionalReader(); + QString additionalSummaryDataFilePath() const; + static QString createAdditionalSummaryFileName(); + +private: + cvf::ref m_fileSummaryReader; + cvf::ref m_multiSummaryReader; cvf::ref m_summaryEclipseRftReader; caf::PdmField m_includeRestartFiles; + + caf::PdmField m_additionalSummaryFilePath; + cvf::ref m_additionalSummaryFileReader; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index 813bafd5b0..8a6aef6718 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -728,3 +728,19 @@ void RimSummaryCaseMainCollection::updateAutoShortName() s->updateAutoShortName(); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCaseMainCollection::onProjectBeingSaved() +{ + auto sumCases = allSummaryCases(); + for ( auto s : sumCases ) + { + auto fileSumCase = dynamic_cast( s ); + if ( fileSumCase ) + { + fileSumCase->onProjectBeingSaved(); + } + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h index e80617713f..786357b733 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h @@ -71,6 +71,7 @@ class RimSummaryCaseMainCollection : public caf::PdmObject QString uniqueShortNameForCase( RimSummaryCase* summaryCase ); void updateAutoShortName(); + void onProjectBeingSaved(); private: static void loadSummaryCaseData( std::vector summaryCases ); diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp index 76dbd4322d..e1fda8b2f1 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp @@ -22,6 +22,8 @@ #include "RiaSummaryTools.h" #include "RifSummaryReaderInterface.h" + +#include "RimFileSummaryCase.h" #include "RimSummaryCase.h" #include "RimcDataContainerDouble.h" @@ -257,3 +259,57 @@ std::unique_ptr RimSummaryCase_resampleValues::defaultResu { return std::unique_ptr( new RimcSummaryResampleData ); } + +CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimSummaryCase, RimSummaryCase_setSummaryVectorValues, "setSummaryValues" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCase_setSummaryVectorValues::RimSummaryCase_setSummaryVectorValues( caf::PdmObjectHandle* self ) + : caf::PdmObjectMethod( self ) +{ + CAF_PDM_InitObject( "Set Summary Values" ); + + CAF_PDM_InitScriptableFieldNoDefault( &m_addressString, "Address", "", "", "", "Formatted address specifying the summary vector" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_unitString, "Unit", "", "", "", "Unit" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_values, "Values", "", "", "", "Values" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmObjectHandle* RimSummaryCase_setSummaryVectorValues::execute() +{ + auto* summaryCase = self(); + auto* fileSummaryCase = dynamic_cast( summaryCase ); + if ( fileSummaryCase ) + { + fileSummaryCase->setSummaryData( m_addressString().toStdString(), m_unitString().toStdString(), m_values() ); + } + + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryCase_setSummaryVectorValues::resultIsPersistent() const +{ + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::unique_ptr RimSummaryCase_setSummaryVectorValues::defaultResult() const +{ + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryCase_setSummaryVectorValues::isNullptrValidResult() const +{ + return true; +} diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.h b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.h index 8109c920ee..335b4bbb6b 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.h @@ -92,3 +92,24 @@ class RimSummaryCase_resampleValues : public caf::PdmObjectMethod caf::PdmField m_addressString; caf::PdmField m_resamplingPeriod; }; + +//================================================================================================== +/// +//================================================================================================== +class RimSummaryCase_setSummaryVectorValues : public caf::PdmObjectMethod +{ + CAF_PDM_HEADER_INIT; + +public: + RimSummaryCase_setSummaryVectorValues( caf::PdmObjectHandle* self ); + + caf::PdmObjectHandle* execute() override; + bool resultIsPersistent() const override; + std::unique_ptr defaultResult() const override; + bool isNullptrValidResult() const override; + +private: + caf::PdmField m_addressString; + caf::PdmField m_unitString; + caf::PdmField> m_values; +}; diff --git a/GrpcInterface/Python/rips/PythonExamples/summary_vectors.py b/GrpcInterface/Python/rips/PythonExamples/summary_vectors.py index b55e0ebc23..04165aca13 100644 --- a/GrpcInterface/Python/rips/PythonExamples/summary_vectors.py +++ b/GrpcInterface/Python/rips/PythonExamples/summary_vectors.py @@ -29,3 +29,8 @@ for t, value in zip(summary_data_sampled.time_steps, summary_data_sampled.values): print(time.strftime("%a, %d %b %Y ", time.gmtime(t)) + " | " + str(value)) + +summary_case.set_summary_values("FOPT_M1", "myUnit", summary_data.values) +summary_case.set_summary_values("FOPT_M2", "myUnit", summary_data.values) +summary_case.set_summary_values("FOPT_M3", "myUnit", summary_data.values) +summary_case.set_summary_values("FOPT_M4", "myUnit", summary_data.values) diff --git a/GrpcInterface/Python/rips/tests/test_summary_cases.py b/GrpcInterface/Python/rips/tests/test_summary_cases.py index 38e31e78d3..2537db245f 100644 --- a/GrpcInterface/Python/rips/tests/test_summary_cases.py +++ b/GrpcInterface/Python/rips/tests/test_summary_cases.py @@ -108,3 +108,35 @@ def test_summary_no_unsmry(rips_instance, initialize_test): summary_case = rips_instance.project.import_summary_case(temp_path) assert summary_case is None + + +def test_summary_set_values(rips_instance, initialize_test): + casePath = dataroot.PATH + "/flow_diagnostics_test/SIMPLE_SUMMARY2.SMSPEC" + summary_case = rips_instance.project.import_summary_case(casePath) + assert summary_case.id == 1 + + addresses = summary_case.available_addresses() + original_keyword_count = len(addresses.values) + + summary_data = summary_case.summary_vector_values("FOPT") + assert len(summary_data.values) == 60 + + summary_case.set_summary_values("FOPT_1", "", summary_data.values) + generated_summary_data = summary_case.summary_vector_values("FOPT_1") + assert len(generated_summary_data.values) == 60 + + addresses = summary_case.available_addresses() + current_keyword_count = len(addresses.values) + assert current_keyword_count == original_keyword_count + 1 + + # Using existing keyword will overwrite existing data + summary_case.set_summary_values("FOPT_1", "", summary_data.values) + addresses = summary_case.available_addresses() + current_keyword_count = len(addresses.values) + assert current_keyword_count == original_keyword_count + 1 + + # invalid value count, check that available addresses are unchanged + summary_case.set_summary_values("FOPT_2", "", []) + addresses = summary_case.available_addresses() + current_keyword_count = len(addresses.values) + assert current_keyword_count == original_keyword_count + 1 From 1c70d9a2c5a2e12916251bb7a0cfadee14e3797e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 10 Dec 2021 14:45:20 +0100 Subject: [PATCH 043/406] Janitor : Guard null pointer access --- .../ProjectDataModel/Flow/RimWellPlotTools.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp index 2f334984b3..c52f4c1155 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp @@ -552,11 +552,12 @@ std::set RimWellPlotTools::availableSimWellTimesteps( RimEclipseCase* { std::set availebleTimeSteps; - if ( eclCase && eclCase->eclipseCaseData() ) + const RigSimWellData* simWell = eclCase->eclipseCaseData()->findSimWellData( simWellName ); + + if ( eclCase && eclCase->eclipseCaseData() && simWell ) { std::vector allTimeSteps = eclCase->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->timeStepDates(); - const RigSimWellData* simWell = eclCase->eclipseCaseData()->findSimWellData( simWellName ); for ( size_t tsIdx = 0; tsIdx < allTimeSteps.size(); ++tsIdx ) { From df37e30d8fda0ea008825cf47bbcb2e40adad858 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 15 Dec 2021 13:58:26 +0100 Subject: [PATCH 044/406] #8365 Curve Appearance: correct visibility of options Fixes #8365. --- ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp index 2739bb1186..be81f780c1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp @@ -208,6 +208,8 @@ void RimPlotCurveAppearance::defineUiOrdering( QString uiConfigName, caf::PdmUiO uiOrdering.add( &m_curveInterpolation ); m_curveInterpolation.uiCapability()->setUiHidden( !m_interpolationVisible ); + + uiOrdering.skipRemainingFields(); } //-------------------------------------------------------------------------------------------------- From 0d213e659c56df95fbe30c2a2e161cb2b593785e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 16 Dec 2021 11:52:04 +0100 Subject: [PATCH 045/406] #8371 Make sure all NNC faces are created and assigned Make sure that the first cell in RigConnection is assigned the lowest cell index. Assign the opposite face if the cell indexes are swapped. In RigCellFaceGeometryTools, test both combinations of (cellA, cellB) and (cellB, cellA) --- .../RigCellFaceGeometryTools.cpp | 14 +++++++-- .../ReservoirDataModel/RigFault.cpp | 30 +++++++++++++++++++ .../ReservoirDataModel/RigFault.h | 21 ++----------- .../ReservoirDataModel/RigNncConnection.cpp | 16 +++++++--- .../Python/rips/tests/test_nnc_properties.py | 2 +- 5 files changed, 58 insertions(+), 25 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp index b91cd3ecc4..0e33d3bce5 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp @@ -304,8 +304,18 @@ void RigCellFaceGeometryTools::extractConnectionsForFace( const RigFault::FaultF } } - std::pair candidate( static_cast( sourceReservoirCellIndex ), - static_cast( candidateCellIndex ) ); + // Test if this pair of cells already has a connection. Check both combinations of cell index ordering to avoid + // duplicate NNC geometry for the same pair of cells + + auto candidate = std::make_pair( static_cast( sourceReservoirCellIndex ), + static_cast( candidateCellIndex ) ); + + if ( nativeCellPairs.count( candidate ) > 0 ) + { + continue; + } + + std::swap( candidate.first, candidate.second ); if ( nativeCellPairs.count( candidate ) > 0 ) { diff --git a/ApplicationLibCode/ReservoirDataModel/RigFault.cpp b/ApplicationLibCode/ReservoirDataModel/RigFault.cpp index 9df8d36d34..04b9cb6b78 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigFault.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigFault.cpp @@ -203,3 +203,33 @@ void RigFault::accumulateFaultsPrCell( RigFaultsPrCellAccumulator* faultsPrCellA faultIdx ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigFaultsPrCellAccumulator::RigFaultsPrCellAccumulator( size_t reservoirCellCount ) +{ + std::array initVals = { NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT }; + m_faultIdxForCellFace.resize( reservoirCellCount, initVals ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RigFaultsPrCellAccumulator::faultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const +{ + // Ensure no crash after creating temporary LGRs + if ( reservoirCellIndex < m_faultIdxForCellFace.size() ) + { + return m_faultIdxForCellFace[reservoirCellIndex][face]; + } + return NO_FAULT; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigFaultsPrCellAccumulator::setFaultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face, int faultIdx ) +{ + m_faultIdxForCellFace[reservoirCellIndex][face] = faultIdx; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigFault.h b/ApplicationLibCode/ReservoirDataModel/RigFault.h index d498763129..a763a7bff9 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigFault.h +++ b/ApplicationLibCode/ReservoirDataModel/RigFault.h @@ -46,26 +46,11 @@ class RigFaultsPrCellAccumulator : public cvf::Object }; public: - explicit RigFaultsPrCellAccumulator( size_t reservoirCellCount ) - { - std::array initVals = {NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT, NO_FAULT}; - m_faultIdxForCellFace.resize( reservoirCellCount, initVals ); - } + explicit RigFaultsPrCellAccumulator( size_t reservoirCellCount ); - inline int faultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const - { - // Ensure no crash after creating temporary LGRs - if ( reservoirCellIndex < m_faultIdxForCellFace.size() ) - { - return m_faultIdxForCellFace[reservoirCellIndex][face]; - } - return NO_FAULT; - } + int faultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face ) const; - inline void setFaultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face, int faultIdx ) - { - m_faultIdxForCellFace[reservoirCellIndex][face] = faultIdx; - } + void setFaultIdx( size_t reservoirCellIndex, cvf::StructGridInterface::FaceType face, int faultIdx ); private: std::vector> m_faultIdxForCellFace; diff --git a/ApplicationLibCode/ReservoirDataModel/RigNncConnection.cpp b/ApplicationLibCode/ReservoirDataModel/RigNncConnection.cpp index 65ba39f922..b608ac957f 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNncConnection.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNncConnection.cpp @@ -45,10 +45,14 @@ RigConnection::RigConnection( unsigned c1GlobIdx, if ( c1GlobIdx >= c2GlobIdx ) { // Ensure the smallest cell index is the first index - // TODO : The face type is related to cell 1, so face should be changed to opposite face - // This causes visual artifacts for some models, so this change will require more investigation m_c1GlobIdx = c2GlobIdx; m_c2GlobIdx = c1GlobIdx; + + if ( c1Face != cvf::StructGridInterface::FaceType::NO_FACE ) + { + // The face type is related to cell 1, so use opposite face + m_c1Face = cvf::StructGridInterface::oppositeFace( c1Face ); + } } } @@ -69,10 +73,14 @@ RigConnection::RigConnection( size_t c1GlobIdx, if ( c1GlobIdx >= c2GlobIdx ) { // Ensure the smallest cell index is the first index - // TODO : The face type is related to cell 1, so face should be changed to opposite face - // This causes visual artifacts for some models, so this change will require more investigation m_c1GlobIdx = static_cast( c2GlobIdx ); m_c2GlobIdx = static_cast( c1GlobIdx ); + + if ( c1Face != cvf::StructGridInterface::FaceType::NO_FACE ) + { + // The face type is related to cell 1, so use opposite face + m_c1Face = cvf::StructGridInterface::oppositeFace( c1Face ); + } } } diff --git a/GrpcInterface/Python/rips/tests/test_nnc_properties.py b/GrpcInterface/Python/rips/tests/test_nnc_properties.py index e55cd1a289..b5b2fa85d9 100644 --- a/GrpcInterface/Python/rips/tests/test_nnc_properties.py +++ b/GrpcInterface/Python/rips/tests/test_nnc_properties.py @@ -25,7 +25,7 @@ def test_10kSync(rips_instance, initialize_test): ) nnc_connections = case.nnc_connections() - assert len(nnc_connections) == 3627 + assert len(nnc_connections) == 3416 connection = nnc_connections[0] assert connection.cell1.i == 33 From b495284b18fe702d488262a2a4cf074a4fcd6b3a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 16 Dec 2021 15:13:23 +0100 Subject: [PATCH 046/406] Python : Improve summary data example --- .../rips/PythonExamples/summary_vectors.py | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/GrpcInterface/Python/rips/PythonExamples/summary_vectors.py b/GrpcInterface/Python/rips/PythonExamples/summary_vectors.py index 04165aca13..69dfb915be 100644 --- a/GrpcInterface/Python/rips/PythonExamples/summary_vectors.py +++ b/GrpcInterface/Python/rips/PythonExamples/summary_vectors.py @@ -30,7 +30,22 @@ for t, value in zip(summary_data_sampled.time_steps, summary_data_sampled.values): print(time.strftime("%a, %d %b %Y ", time.gmtime(t)) + " | " + str(value)) -summary_case.set_summary_values("FOPT_M1", "myUnit", summary_data.values) -summary_case.set_summary_values("FOPT_M2", "myUnit", summary_data.values) -summary_case.set_summary_values("FOPT_M3", "myUnit", summary_data.values) -summary_case.set_summary_values("FOPT_M4", "myUnit", summary_data.values) +test_values = summary_data.values +offset = test_values[len(test_values) - 1] / 10 + +for index, item in enumerate(test_values): + test_values[index] = test_values[index] + offset + +summary_case.set_summary_values("FOPT_M1", "myUnit", test_values) + +for index, item in enumerate(test_values): + test_values[index] = test_values[index] + offset +summary_case.set_summary_values("FOPT_M2", "myUnit", test_values) + +for index, item in enumerate(test_values): + test_values[index] = test_values[index] + offset +summary_case.set_summary_values("FOPT_M3", "myUnit", test_values) + +for index, item in enumerate(test_values): + test_values[index] = test_values[index] + offset +summary_case.set_summary_values("FOPT_M4", "myUnit", test_values) From 43f298fa97c778064298dda997e180667dd53a14 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Fri, 17 Dec 2021 15:39:22 +0100 Subject: [PATCH 047/406] Merge pull request #8376 from OPM/fault_visibilityupdates Faults: Add Visibiliy mode for overlapping area --- .../EclipseCommands/CMakeLists_files.cmake | 2 + .../RicEclipseShowOnlyFaultFeature.cpp | 105 ++++++++++++++++++ .../RicEclipseShowOnlyFaultFeature.h | 34 ++++++ .../RivFaultGeometryGenerator.cpp | 43 +++++-- .../RivFaultGeometryGenerator.h | 14 ++- .../ModelVisualization/RivFaultPartMgr.cpp | 14 ++- .../ModelVisualization/RivFaultPartMgr.h | 1 + .../RivReservoirFaultsPartMgr.cpp | 2 - .../Faults/RimFaultInViewCollection.cpp | 41 +++++-- .../Faults/RimFaultInViewCollection.h | 3 + .../UserInterface/RiuViewerCommands.cpp | 6 + 11 files changed, 240 insertions(+), 25 deletions(-) create mode 100644 ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.cpp create mode 100644 ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.h diff --git a/ApplicationLibCode/Commands/EclipseCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/EclipseCommands/CMakeLists_files.cmake index f9428cf735..4fc0c3efdd 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/EclipseCommands/CMakeLists_files.cmake @@ -17,6 +17,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicImportEclipseCaseTimeStepFilterFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicEclipsePropertyFilterNewInViewFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicEclipseHideFaultFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicEclipseShowOnlyFaultFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -38,6 +39,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicImportEclipseCaseTimeStepFilterFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicEclipsePropertyFilterNewInViewFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicEclipseHideFaultFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicEclipseShowOnlyFaultFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.cpp b/ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.cpp new file mode 100644 index 0000000000..cdfaaca98c --- /dev/null +++ b/ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.cpp @@ -0,0 +1,105 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicEclipseShowOnlyFaultFeature.h" + +#include "RicEclipsePropertyFilterFeatureImpl.h" +#include "RicEclipsePropertyFilterNewExec.h" + +#include "RiaApplication.h" + +#include "Rim3dView.h" +#include "RimEclipseCellColors.h" +#include "RimEclipsePropertyFilterCollection.h" +#include "RimEclipseView.h" +#include "RimFaultInView.h" +#include "RimFaultInViewCollection.h" + +#include "RigFault.h" +#include "RigMainGrid.h" + +#include "cafCmdExecCommandManager.h" +#include "cafPdmUiObjectHandle.h" +#include "cvfStructGrid.h" + +#include + +CAF_CMD_SOURCE_INIT( RicEclipseShowOnlyFaultFeature, "RicEclipseShowOnlyFaultFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicEclipseShowOnlyFaultFeature::isCommandEnabled() +{ + Rim3dView* view = RiaApplication::instance()->activeReservoirView(); + if ( !view ) return false; + + RimEclipseView* eclView = dynamic_cast( view ); + if ( !eclView ) return false; + + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEclipseShowOnlyFaultFeature::onActionTriggered( bool isChecked ) +{ + QVariant userData = this->userData(); + if ( userData.isNull() || userData.type() != QVariant::String ) return; + + QString faultName = userData.toString(); + + Rim3dView* view = RiaApplication::instance()->activeReservoirView(); + if ( !view ) return; + + RimEclipseView* eclView = dynamic_cast( view ); + if ( !eclView ) return; + + RimFaultInViewCollection* coll = eclView->faultCollection(); + RimFaultInView* rimFault = coll->findFaultByName( faultName ); + if ( !rimFault ) return; + if ( !rimFault->parentField() ) return; + + std::vector children; + rimFault->parentField()->childObjects( &children ); + + for ( auto& child : children ) + { + caf::PdmUiObjectHandle* childUiObject = uiObj( child ); + if ( childUiObject && childUiObject->objectToggleField() ) + { + caf::PdmField* field = dynamic_cast*>( childUiObject->objectToggleField() ); + + if ( field ) field->setValueWithFieldChanged( false ); + } + } + + if ( rimFault ) + { + rimFault->showFault.setValueWithFieldChanged( true ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEclipseShowOnlyFaultFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setIcon( QIcon( ":/draw_style_faults_24x24.png" ) ); +} diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.h b/ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.h new file mode 100644 index 0000000000..d4325fee94 --- /dev/null +++ b/ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicEclipseShowOnlyFaultFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp index 2e76b81f5a..8b8a436a6b 100644 --- a/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp @@ -29,16 +29,20 @@ #include "cvfScalarMapper.h" #include "RigFault.h" +#include "RigNNCData.h" +#include "RigNncConnection.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RivFaultGeometryGenerator::RivFaultGeometryGenerator( const cvf::StructGridInterface* grid, const RigFault* fault, + RigNNCData* nncData, bool computeNativeFaultFaces ) : m_grid( grid ) , m_fault( fault ) , m_computeNativeFaultFaces( computeNativeFaultFaces ) + , m_nncData( nncData ) { m_quadMapper = new cvf::StructGridQuadToCellFaceMapper; m_triangleMapper = new cvf::StuctGridTriangleToCellFaceMapper( m_quadMapper.p() ); @@ -54,9 +58,9 @@ RivFaultGeometryGenerator::~RivFaultGeometryGenerator() //-------------------------------------------------------------------------------------------------- /// Generate surface drawable geo from the specified region //-------------------------------------------------------------------------------------------------- -cvf::ref RivFaultGeometryGenerator::generateSurface() +cvf::ref RivFaultGeometryGenerator::generateSurface( bool onlyShowFacesWithDefinedNeighbors ) { - computeArrays(); + computeArrays( onlyShowFacesWithDefinedNeighbors ); CVF_ASSERT( m_vertices.notNull() ); @@ -119,7 +123,28 @@ cvf::ref RivFaultGeometryGenerator::createOutlineMeshDrawable( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RivFaultGeometryGenerator::computeArrays() +bool RivFaultGeometryGenerator::hasConnection( size_t cellIdx, + cvf::StructGridInterface::FaceType face, + RigConnectionContainer& conns ) +{ + cvf::StructGridInterface::FaceType oppositeFace = cvf::StructGridInterface::oppositeFace( face ); + + for ( size_t i = 0; i < conns.size(); i++ ) + { + auto& r = conns[i]; + + if ( ( r.c1GlobIdx() == cellIdx ) && ( r.face() == face ) && r.hasCommonArea() ) return true; + + if ( ( r.c2GlobIdx() == cellIdx ) && ( r.face() == oppositeFace ) && r.hasCommonArea() ) return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RivFaultGeometryGenerator::computeArrays( bool onlyShowFacesWithDefinedNeighbors ) { std::vector vertices; m_quadMapper->quadToCellIndexMap().clear(); @@ -127,6 +152,8 @@ void RivFaultGeometryGenerator::computeArrays() cvf::Vec3d offset = m_grid->displayModelOffset(); + auto& connections = m_nncData->connections(); + const std::vector& faultFaces = m_fault->faultFaces(); #pragma omp parallel for @@ -135,23 +162,25 @@ void RivFaultGeometryGenerator::computeArrays() size_t cellIndex = faultFaces[fIdx].m_nativeReservoirCellIndex; cvf::StructGridInterface::FaceType face = faultFaces[fIdx].m_nativeFace; - if ( cellIndex >= m_cellVisibility->size() ) continue; - if ( !m_computeNativeFaultFaces ) { cellIndex = faultFaces[fIdx].m_oppositeReservoirCellIndex; - face = cvf::StructGridInterface::oppositeFace( faultFaces[fIdx].m_nativeFace ); + face = cvf::StructGridInterface::oppositeFace( face ); } + if ( cellIndex >= m_cellVisibility->size() ) continue; + if ( !( *m_cellVisibility )[cellIndex] ) continue; + if ( onlyShowFacesWithDefinedNeighbors && !hasConnection( cellIndex, face, connections ) ) continue; + cvf::Vec3d cornerVerts[8]; m_grid->cellCornerVertices( cellIndex, cornerVerts ); cvf::ubyte faceConn[4]; m_grid->cellFaceVertexIndices( face, faceConn ); - // Critical section to avoid two threads accessing the arrays at the same time. +// Critical section to avoid two threads accessing the arrays at the same time. #pragma omp critical( critical_section_RivFaultGeometryGenerator_computeArrays ) { int n; diff --git a/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.h b/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.h index cdf24c0688..0d4f74f5f4 100644 --- a/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.h +++ b/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.h @@ -32,6 +32,8 @@ class Transform; class Part; } // namespace cvf +class RigNNCData; +class RigConnectionContainer; class RigFault; //================================================================================================== @@ -42,7 +44,10 @@ class RigFault; class RivFaultGeometryGenerator : public cvf::Object { public: - RivFaultGeometryGenerator( const cvf::StructGridInterface* grid, const RigFault* fault, bool computeNativeFaultFaces ); + RivFaultGeometryGenerator( const cvf::StructGridInterface* grid, + const RigFault* fault, + RigNNCData* nncData, + bool computeNativeFaultFaces ); ~RivFaultGeometryGenerator() override; void setCellVisibility( const cvf::UByteArray* cellVisibilities ); @@ -53,18 +58,21 @@ class RivFaultGeometryGenerator : public cvf::Object const cvf::StuctGridTriangleToCellFaceMapper* triangleToCellFaceMapper() { return m_triangleMapper.p(); } // Generated geometry - cvf::ref generateSurface(); + cvf::ref generateSurface( bool onlyShowFacesWithDefinedNeighbors ); cvf::ref createMeshDrawable(); cvf::ref createOutlineMeshDrawable( double creaseAngle ); private: - void computeArrays(); + void computeArrays( bool onlyShowFacesWithDefinedNeighbors ); + + bool hasConnection( size_t cellIdx, cvf::StructGridInterface::FaceType face, RigConnectionContainer& conns ); private: // Input cvf::cref m_grid; cvf::cref m_fault; cvf::cref m_cellVisibility; + cvf::ref m_nncData; bool m_computeNativeFaultFaces; diff --git a/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp index f31d2e46e2..5de9277273 100644 --- a/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp @@ -24,6 +24,7 @@ #include "RigCaseCellResultsData.h" #include "RigMainGrid.h" +#include "RigNNCData.h" #include "RigResultAccessor.h" #include "RimEclipseCase.h" @@ -74,8 +75,11 @@ RivFaultPartMgr::RivFaultPartMgr( const RigGridBase* grid, cvf::ref> connIdxes = new cvf::Array; connIdxes->assign( rimFault->faultGeometry()->connectionIndices() ); - m_nativeFaultGenerator = new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), true ); - m_oppositeFaultGenerator = new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), false ); + m_nativeFaultGenerator = + new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), grid->mainGrid()->nncData(), true ); + + m_oppositeFaultGenerator = + new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), grid->mainGrid()->nncData(), false ); m_nativeFaultFacesTextureCoords = new cvf::Vec2fArray; m_oppositeFaultFacesTextureCoords = new cvf::Vec2fArray; @@ -280,7 +284,8 @@ void RivFaultPartMgr::generatePartGeometry() bool useBufferObjects = true; // Surface geometry { - cvf::ref geo = m_nativeFaultGenerator->generateSurface(); + cvf::ref geo = + m_nativeFaultGenerator->generateSurface( m_rimFaultCollection->onlyShowFacesWithDefinedNeighbor() ); if ( geo.notNull() ) { geo->computeNormals(); @@ -333,7 +338,8 @@ void RivFaultPartMgr::generatePartGeometry() // Surface geometry { - cvf::ref geo = m_oppositeFaultGenerator->generateSurface(); + cvf::ref geo = + m_oppositeFaultGenerator->generateSurface( m_rimFaultCollection->onlyShowFacesWithDefinedNeighbor() ); if ( geo.notNull() ) { geo->computeNormals(); diff --git a/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.h b/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.h index cc0519b0d9..2b3340a7a9 100644 --- a/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.h +++ b/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.h @@ -37,6 +37,7 @@ class RimEclipseCellColors; class RimCellEdgeColors; class RimFaultInViewCollection; class RigGridBase; + class RimFaultInViewCollection; class RimFaultInView; class RivFaultGeometryGenerator; diff --git a/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp index 821d112f5e..a4b6a95d2c 100644 --- a/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp @@ -118,8 +118,6 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model ) forceDisplayOfFault = true; } - // qDebug() << forceDisplayOfFault; - cvf::ModelBasicList parts; for ( size_t i = 0; i < faultCollection->faults.size(); i++ ) diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp index dafee52400..46668e5d49 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp @@ -39,6 +39,7 @@ #include "cafAppEnum.h" #include "cafPdmFieldCvfColor.h" #include "cafPdmFieldCvfMat4d.h" +#include "cafPdmUiCheckBoxEditor.h" #include "cafPdmUiTreeOrdering.h" namespace caf @@ -66,30 +67,37 @@ RimFaultInViewCollection::RimFaultInViewCollection() showFaultCollection.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &showFaultFaces, "ShowFaultFaces", true, "Show Defined faces" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showFaultFaces ); + CAF_PDM_InitField( &showOppositeFaultFaces, "ShowOppositeFaultFaces", true, "Show Opposite Faces" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showOppositeFaultFaces ); + CAF_PDM_InitField( &m_showFaultsOutsideFilters, "ShowFaultsOutsideFilters", true, "Show Faults Outside Filters" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showFaultsOutsideFilters ); + + CAF_PDM_InitField( &m_onlyShowWithNeighbor, "OnlyShowWithDefNeighbor", false, "Only Show Faces With Defined Cell Neighbor" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_onlyShowWithNeighbor ); CAF_PDM_InitField( &faultResult, "FaultFaceCulling", caf::AppEnum( RimFaultInViewCollection::FAULT_BACK_FACE_CULLING ), - "Dynamic Face Selection", - "", - "", - "" ); + "Dynamic Face Selection" ); CAF_PDM_InitField( &showFaultLabel, "ShowFaultLabel", false, "Show Labels" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showFaultLabel ); + cvf::Color3f defWellLabelColor = RiaPreferences::current()->defaultWellLabelColor(); CAF_PDM_InitField( &faultLabelColor, "FaultLabelColor", defWellLabelColor, "Label Color" ); CAF_PDM_InitField( &showNNCs, "ShowNNCs", true, "Show NNCs" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &showNNCs ); + CAF_PDM_InitField( &hideNncsWhenNoResultIsAvailable, "HideNncsWhenNoResultIsAvailable", true, - "Hide NNC Geometry if No NNC Result is Available", - "", - "", - "" ); + "Hide NNC Geometry if No NNC Result is Available" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &hideNncsWhenNoResultIsAvailable ); CAF_PDM_InitFieldNoDefault( &faults, "Faults", "Faults" ); faults.uiCapability()->setUiTreeHidden( true ); @@ -127,10 +135,16 @@ void RimFaultInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* chan parentView()->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews(); } + if ( changedField == &m_onlyShowWithNeighbor ) + { + parentView()->scheduleReservoirGridGeometryRegen(); + } + if ( &showFaultFaces == changedField || &showOppositeFaultFaces == changedField || &showFaultCollection == changedField || &showFaultLabel == changedField || &m_showFaultsOutsideFilters == changedField || &faultLabelColor == changedField || - &faultResult == changedField || &showNNCs == changedField || &hideNncsWhenNoResultIsAvailable == changedField ) + &m_onlyShowWithNeighbor == changedField || &faultResult == changedField || &showNNCs == changedField || + &hideNncsWhenNoResultIsAvailable == changedField ) { parentView()->scheduleCreateDisplayModelAndRedraw(); parentView()->intersectionCollection()->scheduleCreateDisplayModelAndRedraw2dIntersectionViews(); @@ -286,6 +300,7 @@ void RimFaultInViewCollection::uiOrderingFaults( QString uiConfigName, caf::PdmU ffviz->add( &showFaultFaces ); ffviz->add( &showOppositeFaultFaces ); ffviz->add( &faultResult ); + ffviz->add( &m_onlyShowWithNeighbor ); caf::PdmUiGroup* nncViz = uiOrdering.addNewGroup( "NNC Visibility" ); nncViz->setCollapsedByDefault( true ); @@ -368,6 +383,14 @@ void RimFaultInViewCollection::setShowFaultsOutsideFilter( bool show ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- +bool RimFaultInViewCollection::onlyShowFacesWithDefinedNeighbor() const +{ + return m_onlyShowWithNeighbor; +} + +//------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- RimFaultRASettings* RimFaultInViewCollection::faultRASettings() const { return m_faultRASettings(); diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.h b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.h index 15c3aa0e31..89ce976140 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.h @@ -62,6 +62,8 @@ class RimFaultInViewCollection : public caf::PdmObject bool isShowingFaultsAndFaultsOutsideFilters() const; void setShowFaultsOutsideFilter( bool show ); + bool onlyShowFacesWithDefinedNeighbor() const; + RimFaultRASettings* faultRASettings() const; bool faultRAEnabled() const; bool faultRAAdvancedEnabled() const; @@ -95,6 +97,7 @@ class RimFaultInViewCollection : public caf::PdmObject private: caf::PdmField m_showFaultsOutsideFilters; + caf::PdmField m_onlyShowWithNeighbor; caf::PdmChildField m_faultRASettings; caf::PdmField m_enableFaultRA; diff --git a/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp b/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp index b6634ca133..71956a5b94 100644 --- a/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp @@ -447,6 +447,12 @@ void RiuViewerCommands::displayContextMenu( QMouseEvent* event ) QString( "Hide " ) + faultName, hideFaultList ); + menuBuilder.addCmdFeatureWithUserData( "RicEclipseShowOnlyFaultFeature", + QString( "Show " ) + faultName + QString( " - Others Off" ), + QVariant( fault->name() ) ); + + menuBuilder.addSeparator(); + if ( eclipseView->faultCollection() && eclipseView->faultCollection()->faultRAEnabled() ) { menuBuilder.subMenuStart( "Reactivation Assessment" ); From 58f5c2e92b6770068003d870c5c75ac5c61a88e5 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Fri, 17 Dec 2021 16:10:24 +0100 Subject: [PATCH 048/406] Stop ResInsight from crashing when calculating cell volume (#8374) * Stop ResInsight from crashing when calculating cell volume --- .../ReservoirDataModel/RigActiveCellInfo.cpp | 32 +++------------- .../ReservoirDataModel/RigActiveCellInfo.h | 3 -- .../RigCaseCellResultsData.cpp | 6 +-- ...igNumberOfFloodedPoreVolumesCalculator.cpp | 4 +- .../RiaPropertyDataCommands.cpp | 38 +------------------ GrpcInterface/RiaGrpcPropertiesService.cpp | 2 +- 6 files changed, 13 insertions(+), 72 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp b/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp index f6cd7c597d..14df097d72 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp @@ -25,7 +25,6 @@ //-------------------------------------------------------------------------------------------------- RigActiveCellInfo::RigActiveCellInfo() : m_reservoirActiveCellCount( 0 ) - , m_reservoirCellResultCount( 0 ) , m_activeCellPositionMin( cvf::Vec3d::ZERO ) , m_activeCellPositionMax( cvf::Vec3d::ZERO ) { @@ -47,14 +46,6 @@ size_t RigActiveCellInfo::reservoirCellCount() const return m_cellIndexToResultIndex.size(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -size_t RigActiveCellInfo::reservoirCellResultCount() const -{ - return m_reservoirCellResultCount; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -75,11 +66,6 @@ bool RigActiveCellInfo::isActive( size_t reservoirCellIndex ) const //-------------------------------------------------------------------------------------------------- size_t RigActiveCellInfo::cellResultIndex( size_t reservoirCellIndex ) const { - if ( m_cellIndexToResultIndex.size() == 0 ) - { - return reservoirCellIndex; - } - CVF_TIGHT_ASSERT( reservoirCellIndex < m_cellIndexToResultIndex.size() ); return m_cellIndexToResultIndex[reservoirCellIndex]; @@ -94,11 +80,11 @@ void RigActiveCellInfo::setCellResultIndex( size_t reservoirCellIndex, size_t re m_cellIndexToResultIndex[reservoirCellIndex] = reservoirCellResultIndex; - if ( reservoirCellResultIndex >= m_reservoirCellResultCount ) - { -#pragma omp critical - m_reservoirCellResultCount = reservoirCellResultIndex + 1; - } + // if ( reservoirCellResultIndex >= m_reservoirActiveCellCount ) + // { + //#pragma omp critical + // m_reservoirActiveCellCount = reservoirCellResultIndex + 1; + // } } //-------------------------------------------------------------------------------------------------- @@ -215,14 +201,6 @@ void RigActiveCellInfo::addLgr( size_t cellCount ) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RigActiveCellInfo::isCoarseningActive() const -{ - return m_reservoirCellResultCount != m_reservoirActiveCellCount; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.h b/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.h index 9e1b36dfc7..d13c319614 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.h +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.h @@ -34,8 +34,6 @@ class RigActiveCellInfo : public cvf::Object void setReservoirCellCount( size_t reservoirCellCount ); size_t reservoirCellCount() const; size_t reservoirActiveCellCount() const; - size_t reservoirCellResultCount() const; - bool isCoarseningActive() const; bool isActive( size_t reservoirCellIndex ) const; size_t cellResultIndex( size_t reservoirCellIndex ) const; @@ -75,7 +73,6 @@ class RigActiveCellInfo : public cvf::Object std::vector m_cellIndexToResultIndex; size_t m_reservoirActiveCellCount; - size_t m_reservoirCellResultCount; cvf::Vec3st m_activeCellPositionMin; cvf::Vec3st m_activeCellPositionMax; diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 5857f71402..d3f6c0f09f 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -820,7 +820,7 @@ const std::vector* QString resultName, std::vector& activeCellsResultsTempContainer ) { - size_t resultCellCount = actCellInfo->reservoirCellResultCount(); + size_t resultCellCount = actCellInfo->reservoirActiveCellCount(); size_t reservoirCellCount = actCellInfo->reservoirCellCount(); RigEclipseResultAddress resVarAddr( RiaDefines::ResultCatType::STATIC_NATIVE, resultName ); @@ -2897,7 +2897,7 @@ void RigCaseCellResultsData::computeCellVolumes() } std::vector& cellVolumeResults = m_cellScalarResults[cellVolIdx][0]; - size_t cellResultCount = m_activeCellInfo->reservoirCellResultCount(); + size_t cellResultCount = m_activeCellInfo->reservoirActiveCellCount(); cellVolumeResults.resize( cellResultCount, std::numeric_limits::infinity() ); #pragma omp parallel for @@ -2938,7 +2938,7 @@ void RigCaseCellResultsData::computeOilVolumes() false ); m_cellScalarResults[oilVolIdx].resize( this->maxTimeStepCount() ); - size_t cellResultCount = m_activeCellInfo->reservoirCellResultCount(); + size_t cellResultCount = m_activeCellInfo->reservoirActiveCellCount(); for ( size_t timeStepIdx = 0; timeStepIdx < this->maxTimeStepCount(); timeStepIdx++ ) { const std::vector& soilResults = m_cellScalarResults[soilIdx][timeStepIdx]; diff --git a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp index 69101430c3..da7a4c45c8 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp @@ -46,7 +46,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); - size_t resultCellCount = actCellInfo->reservoirCellResultCount(); + size_t resultCellCount = actCellInfo->reservoirActiveCellCount(); size_t timeStepCount = caseToApply->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->maxTimeStepCount(); @@ -207,7 +207,7 @@ void RigNumberOfFloodedPoreVolumesCalculator::calculate( RigMainGrid* // size_t totalNumberOfCells = mainGrid->globalCellArray().size(); RigActiveCellInfo* actCellInfo = caseToApply->eclipseCaseData()->activeCellInfo( RiaDefines::PorosityModelType::MATRIX_MODEL ); - size_t resultCellCount = actCellInfo->reservoirCellResultCount(); + size_t resultCellCount = actCellInfo->reservoirActiveCellCount(); caf::ProgressInfo progress( 2 * daysSinceSimulationStart.size(), "" ); diff --git a/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp b/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp index 58192e5e3c..577253c7e3 100644 --- a/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp +++ b/ApplicationLibCode/SocketInterface/RiaPropertyDataCommands.cpp @@ -468,9 +468,6 @@ class RiaSetActiveCellProperty : public RiaSocketCommand socketStream >> m_bytesPerTimeStepToRead; } - // std::cout << "RiaSetActiveCellProperty: " << propertyName.data() << " timeStepCount " << - // m_timeStepCountToRead << " bytesPerTimeStep " << m_bytesPerTimeStepToRead; - // Create a list of all the requested timesteps m_requestedTimesteps.clear(); @@ -531,8 +528,6 @@ class RiaSetActiveCellProperty : public RiaSocketCommand bool interpretMore( RiaSocketServer* server, QTcpSocket* currentClient ) override { - // std::cout << "RiaSetActiveCellProperty, interpretMore: scalarIndex : " << m_currentScalarIndex; - if ( m_invalidActiveCellCountDetected ) return true; // If nothing should be read, or we already have read everything, do nothing @@ -555,9 +550,6 @@ class RiaSetActiveCellProperty : public RiaSocketCommand size_t activeCellCountReservoir = activeCellInfo->reservoirActiveCellCount(); size_t totalCellCount = activeCellInfo->reservoirCellCount(); - size_t reservoirCellResultCount = activeCellInfo->reservoirCellResultCount(); - - bool isCoarseningActive = reservoirCellResultCount != activeCellCountReservoir; if ( cellCountFromOctave != activeCellCountReservoir ) { @@ -602,18 +594,12 @@ class RiaSetActiveCellProperty : public RiaSocketCommand for ( size_t tIdx = 0; tIdx < m_timeStepCountToRead; ++tIdx ) { size_t tsId = m_requestedTimesteps[tIdx]; - m_scalarResultsToAdd->at( tsId ).resize( reservoirCellResultCount, HUGE_VAL ); + m_scalarResultsToAdd->at( tsId ).resize( activeCellCountReservoir, HUGE_VAL ); } std::vector readBuffer; double* internalMatrixData = nullptr; - if ( isCoarseningActive ) - { - readBuffer.resize( cellCountFromOctave, HUGE_VAL ); - internalMatrixData = readBuffer.data(); - } - QDataStream socketStream( currentClient ); socketStream.setVersion( riOctavePlugin::qtDataStreamVersion ); @@ -622,11 +608,7 @@ class RiaSetActiveCellProperty : public RiaSocketCommand while ( ( currentClient->bytesAvailable() >= (int)m_bytesPerTimeStepToRead ) && ( m_currentTimeStepNumberToRead < m_timeStepCountToRead ) ) { - if ( !isCoarseningActive ) - { - internalMatrixData = - m_scalarResultsToAdd->at( m_requestedTimesteps[m_currentTimeStepNumberToRead] ).data(); - } + internalMatrixData = m_scalarResultsToAdd->at( m_requestedTimesteps[m_currentTimeStepNumberToRead] ).data(); QStringList errorMessages; if ( !RiaSocketDataTransfer::readBlockDataFromSocket( currentClient, @@ -643,22 +625,6 @@ class RiaSetActiveCellProperty : public RiaSocketCommand return true; } - // Map data from active to result index based container ( Coarsening is active) - if ( isCoarseningActive ) - { - size_t acIdx = 0; - for ( size_t gcIdx = 0; gcIdx < totalCellCount; ++gcIdx ) - { - if ( activeCellInfo->isActive( gcIdx ) ) - { - m_scalarResultsToAdd->at( - m_requestedTimesteps[m_currentTimeStepNumberToRead] )[activeCellInfo->cellResultIndex( gcIdx )] = - readBuffer[acIdx]; - ++acIdx; - } - } - } - ++m_currentTimeStepNumberToRead; } diff --git a/GrpcInterface/RiaGrpcPropertiesService.cpp b/GrpcInterface/RiaGrpcPropertiesService.cpp index b4aab850c1..0cb7a6d6e1 100644 --- a/GrpcInterface/RiaGrpcPropertiesService.cpp +++ b/GrpcInterface/RiaGrpcPropertiesService.cpp @@ -251,7 +251,7 @@ class RiaActiveCellResultsStateHandler : public RiaCellResultsStateHandler m_resultValues = caseData->results( porosityModel )->modifiableCellScalarResult( resVarAddr, timeStepIndex ); if ( m_resultValues->empty() ) { - m_resultValues->resize( activeCellInfo->reservoirCellResultCount() ); + m_resultValues->resize( activeCellInfo->reservoirActiveCellCount() ); } m_cellCount = activeCellInfo->reservoirActiveCellCount(); } From d82fa7f72b663535b61ecca3ae6f71fd09359a5d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 17 Dec 2021 10:34:08 +0100 Subject: [PATCH 049/406] Janitor : Show warning when generated NNCs count is larger than 5M --- .../RigCellFaceGeometryTools.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp index 0e33d3bce5..ce51157d8e 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp @@ -16,6 +16,8 @@ // ///////////////////////////////////////////////////////////////////////////////// +#include "RiaLogging.h" + #include "RigCellFaceGeometryTools.h" #include "RigActiveCellInfo.h" @@ -27,8 +29,6 @@ #include "cafAssert.h" -#include - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -150,7 +150,7 @@ RigConnectionContainer RigCellFaceGeometryTools::computeOtherNncs( const RigMain QString message = QString( "Nnc connection imported from Eclipse are not unique\nNNC count : %1\nUnique : %2" ) .arg( nativeConnections.size() ) .arg( nativeCellPairs.size() ); - qDebug() << message; + RiaLogging::warning( message ); } const cvf::Collection& faults = mainGrid->faults(); @@ -199,6 +199,16 @@ RigConnectionContainer RigCellFaceGeometryTools::computeOtherNncs( const RigMain } // end parallel region } + size_t nncCountWarningThreshold = 5000000; + if ( otherConnections.size() > nncCountWarningThreshold ) + { + auto txt = QString( "Additional NNC count has reached %1, and is above the warning threshold of %2. Faults for " + "inactive cells can be managed from Preferences->Eclipse Grid->Include Inactive Cells" ) + .arg( otherConnections.size() ) + .arg( nncCountWarningThreshold ); + RiaLogging::warning( txt ); + } + otherConnections.remove_duplicates(); return otherConnections; } From 891a2e7c29d90153744ce831a074554d824853e1 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 17 Dec 2021 12:44:06 +0100 Subject: [PATCH 050/406] #8375 Flow Vectors : Avoid recomputing NNCs when accessing flow data Avoid include of RigNNCData.h in header files. --- .../FileInterface/RifReaderEclipseOutput.cpp | 3 +- .../RivElementVectorResultPartMgr.cpp | 11 +-- .../RivNNCGeometryGenerator.cpp | 6 +- .../RivReservoirFaultsPartMgr.cpp | 3 +- .../RivWellConnectionsPartMgr.cpp | 2 + .../RimFractureContainmentTools.cpp | 1 + .../ProjectDataModel/RimEclipseCase.cpp | 3 +- .../Streamlines/RimStreamlineGenerator.cpp | 2 + .../RigAccWellFlowCalculator.cpp | 2 + .../RigCaseCellResultsData.cpp | 6 +- .../RigCaseToCaseCellMapperTools.cpp | 2 + .../RigCaseToCaseRangeFilterMapper.cpp | 2 + .../RigCellFaceGeometryTools.cpp | 3 + .../ReservoirDataModel/RigMainGrid.cpp | 4 +- .../ReservoirDataModel/RigMainGrid.h | 2 +- .../ReservoirDataModel/RigNNCData.cpp | 82 ++++++++++++------- .../ReservoirDataModel/RigNNCData.h | 22 ++--- ...igNumberOfFloodedPoreVolumesCalculator.cpp | 3 +- .../RigReservoirBuilderMock.cpp | 3 +- .../SocketInterface/RiaNNCCommands.cpp | 13 +-- .../UnitTests/RigCellGeometryTools-Test.cpp | 2 + .../RiuCellAndNncPickEventHandler.cpp | 4 +- .../UserInterface/RiuResultTextBuilder.cpp | 9 +- GrpcInterface/RiaGrpcNNCPropertiesService.cpp | 7 +- 24 files changed, 124 insertions(+), 73 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp index e1dd69efa9..8ab512011f 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseOutput.cpp @@ -41,6 +41,7 @@ #include "RigEclipseResultInfo.h" #include "RigEquil.h" #include "RigMainGrid.h" +#include "RigNNCData.h" #include "RigSimWellData.h" #include "RigWellResultPoint.h" @@ -769,7 +770,7 @@ void RifReaderEclipseOutput::transferStaticNNCData( const ecl_grid_type* mainEcl transmissibilityValuesTemp.push_back( transValues[nIdx] ); } - mainGrid->nncData()->setNativeConnections( nncConnections ); + mainGrid->nncData()->setEclipseConnections( nncConnections ); mainGrid->nncData()->makeScalarResultAndSetValues( RiaDefines::propertyNameCombTrans(), transmissibilityValuesTemp ); } diff --git a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp index a8ea28a5f6..6795d3534d 100644 --- a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp @@ -29,6 +29,7 @@ #include "RigEclipseCaseData.h" #include "RigEclipseResultAddress.h" #include "RigMainGrid.h" +#include "RigNNCData.h" #include "cafDisplayCoordTransform.h" @@ -224,11 +225,11 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode } } - RigNNCData* nncData = eclipseCaseData->mainGrid()->nncData(); - size_t numNncConnections = nncData->connections().size(); - if ( result->showNncData() ) { + RigNNCData* nncData = eclipseCaseData->mainGrid()->nncData(); + nncData->buildPolygonsForEclipseConnections(); + std::vector>*> nncResultVals; std::vector combinedAddresses; result->resultAddressesCombined( combinedAddresses ); @@ -244,9 +245,9 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode } } - for ( size_t nIdx = 0; nIdx < numNncConnections; ++nIdx ) + for ( size_t nIdx = 0; nIdx < nncData->eclipseConnectionCount(); ++nIdx ) { - const RigConnection& conn = nncData->connections()[nIdx]; + const RigConnection& conn = nncData->eclipseConnections()[nIdx]; if ( conn.polygon().size() ) { double resultValue = 0.0; diff --git a/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp index c2f8f7d85d..ffba8a42df 100644 --- a/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp @@ -76,7 +76,7 @@ void RivNNCGeometryGenerator::computeArrays() const cvf::Vec3f offset( m_offset ); long long numConnections = - static_cast( m_nncIndexes.isNull() ? m_nncData->connections().size() : m_nncIndexes->size() ); + static_cast( m_nncIndexes.isNull() ? m_nncData->allConnections().size() : m_nncIndexes->size() ); bool isVisibilityCalcActive = m_cellVisibility.notNull() && m_grid.notNull(); std::vector* allCells = nullptr; @@ -90,12 +90,12 @@ void RivNNCGeometryGenerator::computeArrays() { size_t conIdx = m_nncIndexes.isNull() ? nIdx : ( *m_nncIndexes )[nIdx]; - if ( !m_includeAllanDiagramGeometry && conIdx >= m_nncData->nativeConnectionCount() ) + if ( !m_includeAllanDiagramGeometry && conIdx >= m_nncData->eclipseConnectionCount() ) { continue; } - const RigConnection& conn = m_nncData->connections()[conIdx]; + const RigConnection& conn = m_nncData->allConnections()[conIdx]; if ( conn.polygon().size() ) { diff --git a/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp index a4b6a95d2c..ef771248c3 100644 --- a/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivReservoirFaultsPartMgr.cpp @@ -20,6 +20,7 @@ #include "RivReservoirFaultsPartMgr.h" #include "RigMainGrid.h" +#include "RigNNCData.h" #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" @@ -200,7 +201,7 @@ void RivReservoirFaultsPartMgr::appendPartsToModel( cvf::ModelBasicList* model ) if ( showNncs ) { RigMainGrid* mainGrid = m_reservoirView->mainGrid(); - mainGrid->nncData()->ensureConnectionDataIsProcessed(); + mainGrid->nncData()->ensureAllConnectionDataIsProcessed(); if ( showCompleteNncGeo ) { diff --git a/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp index e0255cb3cf..3e1ac604f5 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellConnectionsPartMgr.cpp @@ -37,6 +37,8 @@ #include "cvfModelBasicList.h" #include "cvfPart.h" +#include + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainmentTools.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainmentTools.cpp index 88945b6c2a..28f4809913 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainmentTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureContainmentTools.cpp @@ -33,6 +33,7 @@ #include "cvfStructGrid.h" #include +#include //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index 5d0e147aa6..b0b183b088 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -35,6 +35,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigMainGrid.h" +#include "RigNNCData.h" #include "RigSimWellData.h" #include "RigVirtualPerforationTransmissibilities.h" #include "RigWellResultPoint.h" @@ -711,7 +712,7 @@ bool RimEclipseCase::ensureNncDataIsComputed() RigEclipseCaseData* rigEclipseCase = eclipseCaseData(); if ( rigEclipseCase && rigEclipseCase->mainGrid() ) { - computedData = rigEclipseCase->mainGrid()->nncData()->ensureConnectionDataIsProcessed(); + computedData = rigEclipseCase->mainGrid()->nncData()->ensureAllConnectionDataIsProcessed(); } return computedData; diff --git a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineGenerator.cpp b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineGenerator.cpp index 96e683edfd..0b523b1fcb 100644 --- a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineGenerator.cpp +++ b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineGenerator.cpp @@ -24,6 +24,8 @@ #include "RimStreamline.h" #include "RimStreamlineDataAccess.h" +#include + //-------------------------------------------------------------------------------------------------- /// Helper class for prioritizing streamline seed points //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp index 1aaaf08d52..545683e923 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigAccWellFlowCalculator.cpp @@ -25,6 +25,8 @@ #include "RigSimulationWellCoordsAndMD.h" #include "RigWellResultPoint.h" +#include + //================================================================================================== /// /// diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp index d3f6c0f09f..1ebb3053c4 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -2465,7 +2465,7 @@ void RigCaseCellResultsData::computeNncCombRiTrans() bool isFaceNormalsOutwards = m_ownerMainGrid->isFaceNormalsOutwards(); // NNC calculation - const RigConnectionContainer& nncConnections = m_ownerMainGrid->nncData()->connections(); + const RigConnectionContainer& nncConnections = m_ownerMainGrid->nncData()->allConnections(); for ( size_t connIdx = 0; connIdx < nncConnections.size(); connIdx++ ) { size_t nativeResvCellIndex = nncConnections[connIdx].c1GlobIdx(); @@ -2829,7 +2829,7 @@ void RigCaseCellResultsData::computeNncCombRiTRANSbyArea() if ( transResults->size() != riAreaNormTransResults.size() ) return; - const RigConnectionContainer& connections = m_ownerMainGrid->nncData()->connections(); + const RigConnectionContainer& connections = m_ownerMainGrid->nncData()->allConnections(); for ( size_t nncConIdx = 0; nncConIdx < riAreaNormTransResults.size(); ++nncConIdx ) { @@ -3299,7 +3299,7 @@ void RigCaseCellResultsData::computeAllanResults( RigCaseCellResultsData* cellRe formationCount = cellResultsData->activeFormationNames()->formationNames().size(); } - const RigConnectionContainer& nncConnections = mainGrid->nncData()->connections(); + const RigConnectionContainer& nncConnections = mainGrid->nncData()->allConnections(); std::map, int> formationCombinationToCategory; for ( size_t i = 0; i < nncConnections.size(); i++ ) diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp index c4e3f78ad6..af9e98c511 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseCellMapperTools.cpp @@ -24,6 +24,8 @@ #include "RigFemPartGrid.h" #include "RigMainGrid.h" +#include + //================================================================================================== /// //================================================================================================== diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseRangeFilterMapper.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseRangeFilterMapper.cpp index 7d7a24d572..ceab4c31d0 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseRangeFilterMapper.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseToCaseRangeFilterMapper.cpp @@ -27,6 +27,8 @@ #include "RimCellRangeFilter.h" +#include + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp index ce51157d8e..78e7d0946c 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCellFaceGeometryTools.cpp @@ -213,6 +213,9 @@ RigConnectionContainer RigCellFaceGeometryTools::computeOtherNncs( const RigMain return otherConnections; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- void RigCellFaceGeometryTools::extractConnectionsForFace( const RigFault::FaultFace& face, const RigMainGrid* mainGrid, const std::set>& nativeCellPairs, diff --git a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp index 4a49c55ceb..a7fabf8293 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.cpp @@ -22,8 +22,10 @@ #include "RiaLogging.h" #include "RiaResultNames.h" + #include "RigActiveCellInfo.h" #include "RigHexIntersectionTools.h" +#include "RigNNCData.h" #include "cvfAssert.h" #include "cvfBoundingBoxTree.h" @@ -591,7 +593,7 @@ void RigMainGrid::distributeNNCsToFaults() { if ( m_faultsPrCellAcc.isNull() ) return; - const RigConnectionContainer& nncs = this->nncData()->connections(); + const RigConnectionContainer& nncs = this->nncData()->allConnections(); for ( size_t nncIdx = 0; nncIdx < nncs.size(); ++nncIdx ) { // Find the fault for each side of the nnc diff --git a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h index b0d1ac25b9..dabed2d97f 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h +++ b/ApplicationLibCode/ReservoirDataModel/RigMainGrid.h @@ -23,7 +23,6 @@ #include "RigCell.h" #include "RigGridBase.h" #include "RigLocalGrid.h" -#include "RigNNCData.h" #include "cvfBoundingBox.h" #include "cvfCollection.h" @@ -31,6 +30,7 @@ #include class RigActiveCellInfo; +class RigNNCData; namespace cvf { diff --git a/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp b/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp index b6c811b888..e674e65b16 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp @@ -35,8 +35,9 @@ /// //-------------------------------------------------------------------------------------------------- RigNNCData::RigNNCData() - : m_nativeConnectionCount( 0 ) - , m_connectionsAreProcessed( false ) + : m_eclipseConnectionCount( 0 ) + , m_havePolygonsForEclipseConnections( false ) + , m_haveGeneratedConnections( false ) , m_mainGrid( nullptr ) , m_activeCellInfo( nullptr ) , m_computeNncForInactiveCells( false ) @@ -54,44 +55,52 @@ void RigNNCData::setSourceDataForProcessing( RigMainGrid* mainGrid, m_activeCellInfo = activeCellInfo; m_computeNncForInactiveCells = includeInactiveCells; - m_connectionsAreProcessed = false; + m_havePolygonsForEclipseConnections = false; + m_haveGeneratedConnections = false; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigNNCData::processNativeConnections( const RigMainGrid& mainGrid ) +void RigNNCData::buildPolygonsForEclipseConnections() { - // cvf::Trace::show("NNC: Total number: " + cvf::String((int)m_connections.size())); + if ( m_havePolygonsForEclipseConnections ) return; + if ( !m_mainGrid ) return; #pragma omp parallel for - for ( int cnIdx = 0; cnIdx < (int)m_connections.size(); ++cnIdx ) + for ( int cnIdx = 0; cnIdx < static_cast( eclipseConnectionCount() ); ++cnIdx ) { - const RigCell& c1 = mainGrid.globalCellArray()[m_connections[cnIdx].c1GlobIdx()]; - const RigCell& c2 = mainGrid.globalCellArray()[m_connections[cnIdx].c2GlobIdx()]; + const RigCell& c1 = m_mainGrid->globalCellArray()[m_connections[cnIdx].c1GlobIdx()]; + const RigCell& c2 = m_mainGrid->globalCellArray()[m_connections[cnIdx].c2GlobIdx()]; std::vector connectionPolygon; std::vector connectionIntersections; cvf::StructGridInterface::FaceType connectionFace = cvf::StructGridInterface::NO_FACE; - connectionFace = - RigCellFaceGeometryTools::calculateCellFaceOverlap( c1, c2, mainGrid, &connectionPolygon, &connectionIntersections ); + connectionFace = RigCellFaceGeometryTools::calculateCellFaceOverlap( c1, + c2, + *m_mainGrid, + &connectionPolygon, + &connectionIntersections ); if ( connectionFace != cvf::StructGridInterface::NO_FACE ) { m_connections[cnIdx].setFace( connectionFace ); - m_connections[cnIdx].setPolygon( - RigCellFaceGeometryTools::extractPolygon( mainGrid.nodes(), connectionPolygon, connectionIntersections ) ); + m_connections[cnIdx].setPolygon( RigCellFaceGeometryTools::extractPolygon( m_mainGrid->nodes(), + connectionPolygon, + connectionIntersections ) ); } } + + m_havePolygonsForEclipseConnections = true; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigNNCData::computeCompleteSetOfNncs( const RigMainGrid* mainGrid, - const RigActiveCellInfo* activeCellInfo, - bool includeInactiveCells ) +void RigNNCData::computeAdditionalNncs( const RigMainGrid* mainGrid, + const RigActiveCellInfo* activeCellInfo, + bool includeInactiveCells ) { RigConnectionContainer otherConnections = RigCellFaceGeometryTools::computeOtherNncs( mainGrid, m_connections, activeCellInfo, includeInactiveCells ); @@ -188,9 +197,9 @@ size_t RigNNCData::connectionsWithNoCommonArea( QStringList& connectionTextFirst //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RigNNCData::ensureConnectionDataIsProcessed() +bool RigNNCData::ensureAllConnectionDataIsProcessed() { - if ( m_connectionsAreProcessed ) return false; + if ( m_haveGeneratedConnections ) return false; if ( m_mainGrid ) { @@ -198,13 +207,13 @@ bool RigNNCData::ensureConnectionDataIsProcessed() RiaLogging::info( "NNC geometry computation - starting process" ); - processNativeConnections( *m_mainGrid ); + buildPolygonsForEclipseConnections(); progressInfo.incrementProgress(); - computeCompleteSetOfNncs( m_mainGrid, m_activeCellInfo, m_computeNncForInactiveCells ); + computeAdditionalNncs( m_mainGrid, m_activeCellInfo, m_computeNncForInactiveCells ); progressInfo.incrementProgress(); - m_connectionsAreProcessed = true; + m_haveGeneratedConnections = true; m_mainGrid->distributeNNCsToFaults(); @@ -215,7 +224,7 @@ bool RigNNCData::ensureConnectionDataIsProcessed() RiaLogging::info( "NNC geometry computation - completed process" ); - RiaLogging::info( QString( "Native NNC count : %1" ).arg( nativeConnectionCount() ) ); + RiaLogging::info( QString( "Native NNC count : %1" ).arg( eclipseConnectionCount() ) ); RiaLogging::info( QString( "Computed NNC count : %1" ).arg( m_connections.size() ) ); RiaLogging::info( QString( "NNCs with no common area count : %1" ).arg( noCommonAreaCount ) ); @@ -237,28 +246,41 @@ bool RigNNCData::ensureConnectionDataIsProcessed() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigNNCData::setNativeConnections( RigConnectionContainer& connections ) +void RigNNCData::setEclipseConnections( RigConnectionContainer& eclipseConnections ) { - m_connections = connections; - m_nativeConnectionCount = m_connections.size(); + m_connections = eclipseConnections; + m_eclipseConnectionCount = m_connections.size(); - m_connectionsAreProcessed = false; + m_haveGeneratedConnections = false; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RigNNCData::nativeConnectionCount() const +size_t RigNNCData::eclipseConnectionCount() const { - return m_nativeConnectionCount; + return m_eclipseConnectionCount; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RigConnectionContainer& RigNNCData::eclipseConnections() const +{ + // Return connections without calling ensureConnectionDataIsProcessed() to avoid potential heavy computations + // Relevant if only native connection data is required + // NB: If computeAdditionalNncs() is called before this method, the size of this collection is larger than + // nativeConnectionCount() + + return m_connections; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RigConnectionContainer& RigNNCData::connections() +RigConnectionContainer& RigNNCData::allConnections() { - ensureConnectionDataIsProcessed(); + ensureAllConnectionDataIsProcessed(); return m_connections; } @@ -268,7 +290,7 @@ RigConnectionContainer& RigNNCData::connections() //-------------------------------------------------------------------------------------------------- std::vector& RigNNCData::makeStaticConnectionScalarResult( QString nncDataType ) { - ensureConnectionDataIsProcessed(); + ensureAllConnectionDataIsProcessed(); std::vector>& results = m_connectionResults[nncDataType]; results.resize( 1 ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigNNCData.h b/ApplicationLibCode/ReservoirDataModel/RigNNCData.h index 28af4b00a2..412aea8ac8 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNNCData.h +++ b/ApplicationLibCode/ReservoirDataModel/RigNNCData.h @@ -50,15 +50,17 @@ class RigNNCData : public cvf::Object RigNNCData(); - bool ensureConnectionDataIsProcessed(); void setSourceDataForProcessing( RigMainGrid* mainGrid, const RigActiveCellInfo* activeCellInfo, bool includeInactiveCells ); - void setNativeConnections( RigConnectionContainer& connections ); - size_t nativeConnectionCount() const; + void setEclipseConnections( RigConnectionContainer& eclipseConnections ); + void buildPolygonsForEclipseConnections(); + size_t eclipseConnectionCount() const; + const RigConnectionContainer& eclipseConnections() const; - RigConnectionContainer& connections(); + bool ensureAllConnectionDataIsProcessed(); + RigConnectionContainer& allConnections(); std::vector& makeStaticConnectionScalarResult( QString nncDataType ); const std::vector* staticConnectionScalarResult( const RigEclipseResultAddress& resVarAddr ) const; @@ -95,20 +97,20 @@ class RigNNCData : public cvf::Object const QString getNNCDataTypeFromScalarResultIndex( const RigEclipseResultAddress& resVarAddr ) const; bool isNative( QString nncDataType ) const; - void processNativeConnections( const RigMainGrid& mainGrid ); - void computeCompleteSetOfNncs( const RigMainGrid* mainGrid, - const RigActiveCellInfo* activeCellInfo, - bool includeInactiveCells ); + void computeAdditionalNncs( const RigMainGrid* mainGrid, + const RigActiveCellInfo* activeCellInfo, + bool includeInactiveCells ); size_t connectionsWithNoCommonArea( QStringList& connectionTextFirstItems, size_t maxItemCount ); private: RigConnectionContainer m_connections; - size_t m_nativeConnectionCount; + size_t m_eclipseConnectionCount; std::map>> m_connectionResults; std::map m_resultAddrToNNCDataType; - bool m_connectionsAreProcessed; + bool m_havePolygonsForEclipseConnections; + bool m_haveGeneratedConnections; RigMainGrid* m_mainGrid; const RigActiveCellInfo* m_activeCellInfo; bool m_computeNncForInactiveCells; diff --git a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp index da7a4c45c8..05a9b64d41 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNumberOfFloodedPoreVolumesCalculator.cpp @@ -24,6 +24,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigMainGrid.h" +#include "RigNNCData.h" #include "RigReservoirBuilderMock.h" #include "RimEclipseCase.h" @@ -101,7 +102,7 @@ RigNumberOfFloodedPoreVolumesCalculator::RigNumberOfFloodedPoreVolumesCalculator std::vector*> flowrateKatAllTimeSteps; RigNNCData* nncData = eclipseCaseData->mainGrid()->nncData(); - const RigConnectionContainer connections = nncData->connections(); + const RigConnectionContainer connections = nncData->allConnections(); progress.incrementProgress(); diff --git a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp index 3307687f49..5f94079783 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigReservoirBuilderMock.cpp @@ -24,6 +24,7 @@ #include "RigCell.h" #include "RigEclipseCaseData.h" #include "RigMainGrid.h" +#include "RigNNCData.h" #include "RigSimWellData.h" /* rand example: guess the number */ @@ -557,7 +558,7 @@ void RigReservoirBuilderMock::addFaults( RigEclipseCaseData* eclipseCase ) addNnc( grid, i1, j1, k1, i2, j2, k2, nncConnections ); } - grid->nncData()->setNativeConnections( nncConnections ); + grid->nncData()->setEclipseConnections( nncConnections ); std::vector& tranVals = grid->nncData()->makeStaticConnectionScalarResult( RiaDefines::propertyNameCombTrans() ); diff --git a/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp b/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp index 7619cf28f4..7188ca4a34 100644 --- a/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp +++ b/ApplicationLibCode/SocketInterface/RiaNNCCommands.cpp @@ -27,6 +27,7 @@ #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigMainGrid.h" +#include "RigNNCData.h" #include "Rim3dOverlayInfoConfig.h" #include "RimCellEdgeColors.h" @@ -64,13 +65,13 @@ class RiaGetNNCConnections : public RiaSocketCommand RigMainGrid* mainGrid = rimCase->eclipseCaseData()->mainGrid(); - size_t connectionCount = mainGrid->nncData()->connections().size(); + size_t connectionCount = mainGrid->nncData()->allConnections().size(); socketStream << (quint64)connectionCount; - for ( size_t i = 0; i < mainGrid->nncData()->connections().size(); ++i ) + for ( size_t i = 0; i < mainGrid->nncData()->allConnections().size(); ++i ) { - RigConnection connection = mainGrid->nncData()->connections()[i]; + RigConnection connection = mainGrid->nncData()->allConnections()[i]; const RigCell& cell1 = mainGrid->globalCellArray()[connection.c1GlobIdx()]; const RigCell& cell2 = mainGrid->globalCellArray()[connection.c2GlobIdx()]; @@ -163,7 +164,7 @@ class RiaGetDynamicNNCValues : public RiaSocketCommand } // then the connection count and time step count. - size_t connectionCount = mainGrid->nncData()->connections().size(); + size_t connectionCount = mainGrid->nncData()->allConnections().size(); size_t timeStepCount = requestedTimeSteps.size(); socketStream << (quint64)connectionCount; @@ -216,7 +217,7 @@ class RiaGetStaticNNCValues : public RiaSocketCommand } // connection count - size_t connectionCount = mainGrid->nncData()->connections().size(); + size_t connectionCount = mainGrid->nncData()->allConnections().size(); socketStream << (quint64)connectionCount; RiaSocketTools::writeBlockData( server, @@ -479,7 +480,7 @@ class RiaSetNNCProperty : public RiaSocketCommand RigNNCData* nncData = m_currentReservoir->eclipseCaseData()->mainGrid()->nncData(); size_t connectionCountFromOctave = m_bytesPerTimeStepToRead / sizeof( double ); - size_t connectionCount = nncData->connections().size(); + size_t connectionCount = nncData->allConnections().size(); std::vector>* resultsToAdd = nncData->generatedConnectionScalarResultByName( m_currentPropertyName ); diff --git a/ApplicationLibCode/UnitTests/RigCellGeometryTools-Test.cpp b/ApplicationLibCode/UnitTests/RigCellGeometryTools-Test.cpp index 2dfb70b838..a0bdf6b4d5 100644 --- a/ApplicationLibCode/UnitTests/RigCellGeometryTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigCellGeometryTools-Test.cpp @@ -21,6 +21,8 @@ #include "RigCellGeometryTools.h" #include "RigMainGrid.h" +#include // Needed for HUGE_VAL on Linux + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuCellAndNncPickEventHandler.cpp b/ApplicationLibCode/UserInterface/RiuCellAndNncPickEventHandler.cpp index b8996af082..8e564ce488 100644 --- a/ApplicationLibCode/UserInterface/RiuCellAndNncPickEventHandler.cpp +++ b/ApplicationLibCode/UserInterface/RiuCellAndNncPickEventHandler.cpp @@ -217,7 +217,7 @@ bool RiuCellAndNncPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eve if ( eclipseView ) { RigMainGrid* mainGrid = eclipseView->eclipseCase()->eclipseCaseData()->mainGrid(); - const RigConnection& nncConn = mainGrid->nncData()->connections()[nncIndex]; + const RigConnection& nncConn = mainGrid->nncData()->allConnections()[nncIndex]; mainGrid->gridAndGridLocalIdxFromGlobalCellIdx( nncConn.c1GlobIdx(), &gridLocalCellIndex ); } @@ -308,7 +308,7 @@ bool RiuCellAndNncPickEventHandler::handle3dPickEvent( const Ric3dPickEvent& eve selectedItem->m_nncIndex == nncIndex ) { RigMainGrid* mainGrid = eclipseView->eclipseCase()->eclipseCaseData()->mainGrid(); - const RigConnection& nncConn = mainGrid->nncData()->connections()[nncIndex]; + const RigConnection& nncConn = mainGrid->nncData()->allConnections()[nncIndex]; size_t c1LocalIdx = cvf::UNDEFINED_SIZE_T; const RigGridBase* grid1 = mainGrid->gridAndGridLocalIdxFromGlobalCellIdx(nncConn.c1GlobIdx(), &c1LocalIdx); diff --git a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp index 70b9c69745..22ba2aea6c 100644 --- a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp @@ -23,6 +23,7 @@ #include "RigEclipseCaseData.h" #include "RigFormationNames.h" #include "RigMainGrid.h" +#include "RigNNCData.h" #include "RigResultAccessor.h" #include "RigResultAccessorFactory.h" #include "RigSimWellData.h" @@ -444,9 +445,9 @@ QString RiuResultTextBuilder::nncResultText() RigNNCData* nncData = grid->nncData(); CVF_ASSERT( nncData ); - if ( nncData && m_nncIndex < nncData->connections().size() ) + if ( nncData && m_nncIndex < nncData->allConnections().size() ) { - const RigConnection& conn = nncData->connections()[m_nncIndex]; + const RigConnection& conn = nncData->allConnections()[m_nncIndex]; cvf::StructGridInterface::FaceEnum face( conn.face() ); @@ -800,11 +801,11 @@ QString RiuResultTextBuilder::nncDetails() RigNNCData* nncData = grid->nncData(); CVF_ASSERT( nncData ); - if ( nncData && m_nncIndex < nncData->connections().size() ) + if ( nncData && m_nncIndex < nncData->allConnections().size() ) { text += "-- NNC details --\n"; { - const RigConnection& conn = nncData->connections()[m_nncIndex]; + const RigConnection& conn = nncData->allConnections()[m_nncIndex]; cvf::StructGridInterface::FaceEnum face( conn.face() ); // First cell of NNC diff --git a/GrpcInterface/RiaGrpcNNCPropertiesService.cpp b/GrpcInterface/RiaGrpcNNCPropertiesService.cpp index f4d0103f9f..7554d42052 100644 --- a/GrpcInterface/RiaGrpcNNCPropertiesService.cpp +++ b/GrpcInterface/RiaGrpcNNCPropertiesService.cpp @@ -25,6 +25,7 @@ #include "RigEclipseResultAddress.h" #include "RigEclipseResultInfo.h" #include "RigMainGrid.h" +#include "RigNNCData.h" #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" @@ -89,7 +90,7 @@ rips::Vec3i* createConnectionVec3i( const RigCell& cell ) grpc::Status RiaNNCConnectionsStateHandler::assignReply( rips::NNCConnections* reply ) { RigMainGrid* mainGrid = m_eclipseCase->eclipseCaseData()->mainGrid(); - const RigConnectionContainer& connections = mainGrid->nncData()->connections(); + const RigConnectionContainer& connections = mainGrid->nncData()->allConnections(); size_t connectionCount = connections.size(); const size_t packageSize = RiaGrpcServiceInterface::numberOfDataUnitsInPackage( sizeof( rips::NNCConnection ) ); @@ -189,7 +190,7 @@ const std::vector* getScalarResultByName( const RigNNCData* nncD grpc::Status RiaNNCValuesStateHandler::assignReply( rips::NNCValues* reply ) { RigMainGrid* mainGrid = m_eclipseCase->eclipseCaseData()->mainGrid(); - auto connections = mainGrid->nncData()->connections(); + auto connections = mainGrid->nncData()->allConnections(); QString propertyName = QString::fromStdString( m_request->property_name() ); RigNNCData::NNCResultType propertyType = static_cast( m_request->property_type() ); @@ -362,7 +363,7 @@ grpc::Status RiaNNCInputValuesStateHandler::init( const NNCValuesInputRequest* r m_eclipseCase->results( m_porosityModel )->ensureKnownResultLoaded( resAddr ); nncData->setEclResultAddress( m_propertyName, resAddr ); - m_cellCount = caseData->mainGrid()->nncData()->connections().size(); + m_cellCount = caseData->mainGrid()->nncData()->allConnections().size(); resultsToAdd->resize( m_cellCount, HUGE_VAL ); From 21f098849341a7d4630ddb40299b61f7a122a360 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 20 Dec 2021 08:52:22 +0100 Subject: [PATCH 051/406] #8375 NNC : Create NNC generators when NNC data is available This approach fixes an NNC visibility issue related to use of m_rimFault->faultGeometry()->connectionIndices() before any was assigned in RigMainGrid::distributeNNCsToFaults() --- .../RivElementVectorResultPartMgr.cpp | 2 +- .../RivFaultGeometryGenerator.cpp | 15 ++++--- .../RivFaultGeometryGenerator.h | 5 ++- .../ModelVisualization/RivFaultPartMgr.cpp | 45 +++++++++++++------ .../RivNNCGeometryGenerator.cpp | 12 ++--- .../RivNNCGeometryGenerator.h | 18 ++++---- .../ReservoirDataModel/RigActiveCellInfo.cpp | 6 --- .../ReservoirDataModel/RigNNCData.cpp | 2 +- .../ReservoirDataModel/RigNNCData.h | 2 +- 9 files changed, 63 insertions(+), 44 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp index 6795d3534d..ba9a37efd9 100644 --- a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp @@ -247,7 +247,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode for ( size_t nIdx = 0; nIdx < nncData->eclipseConnectionCount(); ++nIdx ) { - const RigConnection& conn = nncData->eclipseConnections()[nIdx]; + const RigConnection& conn = nncData->availableConnections()[nIdx]; if ( conn.polygon().size() ) { double resultValue = 0.0; diff --git a/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp index 8b8a436a6b..b0de47368d 100644 --- a/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp @@ -125,13 +125,16 @@ cvf::ref RivFaultGeometryGenerator::createOutlineMeshDrawable( //-------------------------------------------------------------------------------------------------- bool RivFaultGeometryGenerator::hasConnection( size_t cellIdx, cvf::StructGridInterface::FaceType face, - RigConnectionContainer& conns ) + const RigConnectionContainer& conns, + const std::vector& nncConnectionIndices ) { cvf::StructGridInterface::FaceType oppositeFace = cvf::StructGridInterface::oppositeFace( face ); - for ( size_t i = 0; i < conns.size(); i++ ) + for ( auto i : nncConnectionIndices ) { - auto& r = conns[i]; + if ( i >= conns.size() ) continue; + + const auto& r = conns[i]; if ( ( r.c1GlobIdx() == cellIdx ) && ( r.face() == face ) && r.hasCommonArea() ) return true; @@ -152,7 +155,8 @@ void RivFaultGeometryGenerator::computeArrays( bool onlyShowFacesWithDefinedNeig cvf::Vec3d offset = m_grid->displayModelOffset(); - auto& connections = m_nncData->connections(); + auto connIndices = m_fault->connectionIndices(); + auto& connections = m_nncData->availableConnections(); const std::vector& faultFaces = m_fault->faultFaces(); @@ -172,7 +176,8 @@ void RivFaultGeometryGenerator::computeArrays( bool onlyShowFacesWithDefinedNeig if ( !( *m_cellVisibility )[cellIndex] ) continue; - if ( onlyShowFacesWithDefinedNeighbors && !hasConnection( cellIndex, face, connections ) ) continue; + if ( onlyShowFacesWithDefinedNeighbors && !hasConnection( cellIndex, face, connections, connIndices ) ) + continue; cvf::Vec3d cornerVerts[8]; m_grid->cellCornerVertices( cellIndex, cornerVerts ); diff --git a/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.h b/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.h index 0d4f74f5f4..8899a359d7 100644 --- a/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.h +++ b/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.h @@ -65,7 +65,10 @@ class RivFaultGeometryGenerator : public cvf::Object private: void computeArrays( bool onlyShowFacesWithDefinedNeighbors ); - bool hasConnection( size_t cellIdx, cvf::StructGridInterface::FaceType face, RigConnectionContainer& conns ); + bool hasConnection( size_t cellIdx, + cvf::StructGridInterface::FaceType face, + const RigConnectionContainer& conns, + const std::vector& nncConnectionIndices ); private: // Input diff --git a/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp index 5de9277273..19758adfb5 100644 --- a/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivFaultPartMgr.cpp @@ -72,8 +72,6 @@ RivFaultPartMgr::RivFaultPartMgr( const RigGridBase* grid, { CVF_ASSERT( rimFault->faultGeometry() ); - cvf::ref> connIdxes = new cvf::Array; - connIdxes->assign( rimFault->faultGeometry()->connectionIndices() ); m_nativeFaultGenerator = new RivFaultGeometryGenerator( grid, rimFault->faultGeometry(), grid->mainGrid()->nncData(), true ); @@ -84,18 +82,8 @@ RivFaultPartMgr::RivFaultPartMgr( const RigGridBase* grid, m_nativeFaultFacesTextureCoords = new cvf::Vec2fArray; m_oppositeFaultFacesTextureCoords = new cvf::Vec2fArray; - m_NNCGenerator = new RivNNCGeometryGenerator( false, - grid->mainGrid()->nncData(), - grid->mainGrid()->displayModelOffset(), - connIdxes.p() ); - m_NNCTextureCoords = new cvf::Vec2fArray; - m_allanNNCGenerator = new RivNNCGeometryGenerator( true, - grid->mainGrid()->nncData(), - grid->mainGrid()->displayModelOffset(), - connIdxes.p() ); - m_allanNNCTextureCoords = new cvf::Vec2fArray; } @@ -106,8 +94,9 @@ void RivFaultPartMgr::setCellVisibility( cvf::UByteArray* cellVisibilities ) { m_nativeFaultGenerator->setCellVisibility( cellVisibilities ); m_oppositeFaultGenerator->setCellVisibility( cellVisibilities ); - m_NNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() ); - m_allanNNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() ); + + if ( m_NNCGenerator.notNull() ) m_NNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() ); + if ( m_allanNNCGenerator.notNull() ) m_allanNNCGenerator->setCellVisibility( cellVisibilities, m_grid.p() ); clearFlags(); } @@ -403,6 +392,20 @@ void RivFaultPartMgr::generatePartGeometry() //-------------------------------------------------------------------------------------------------- void RivFaultPartMgr::generateNativeNncPartGeometry() { + if ( m_NNCGenerator.isNull() ) + { + auto nncConnectionIndices = m_rimFault->faultGeometry()->connectionIndices(); + if ( !nncConnectionIndices.empty() ) + { + m_NNCGenerator = new RivNNCGeometryGenerator( false, + m_grid->mainGrid()->nncData(), + m_grid->mainGrid()->displayModelOffset(), + nncConnectionIndices ); + } + } + + if ( m_NNCGenerator.isNull() ) return; + cvf::ref geo = m_NNCGenerator->generateSurface(); if ( geo.notNull() ) { @@ -438,6 +441,20 @@ void RivFaultPartMgr::generateNativeNncPartGeometry() //-------------------------------------------------------------------------------------------------- void RivFaultPartMgr::generateAllNncPartGeometry() { + if ( m_allanNNCGenerator.isNull() ) + { + auto nncConnectionIndices = m_rimFault->faultGeometry()->connectionIndices(); + if ( !nncConnectionIndices.empty() ) + { + m_allanNNCGenerator = new RivNNCGeometryGenerator( true, + m_grid->mainGrid()->nncData(), + m_grid->mainGrid()->displayModelOffset(), + nncConnectionIndices ); + } + } + + if ( m_allanNNCGenerator.isNull() ) return; + cvf::ref geo = m_allanNNCGenerator->generateSurface(); if ( geo.notNull() ) { diff --git a/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp index ffba8a42df..97cc485f40 100644 --- a/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.cpp @@ -31,10 +31,10 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RivNNCGeometryGenerator::RivNNCGeometryGenerator( bool includeAllan, - RigNNCData* nncData, - const cvf::Vec3d& offset, - const cvf::Array* nncIndexes ) +RivNNCGeometryGenerator::RivNNCGeometryGenerator( bool includeAllan, + RigNNCData* nncData, + const cvf::Vec3d& offset, + const std::vector& nncIndexes ) : m_includeAllanDiagramGeometry( includeAllan ) , m_nncData( nncData ) , m_nncIndexes( nncIndexes ) @@ -76,7 +76,7 @@ void RivNNCGeometryGenerator::computeArrays() const cvf::Vec3f offset( m_offset ); long long numConnections = - static_cast( m_nncIndexes.isNull() ? m_nncData->allConnections().size() : m_nncIndexes->size() ); + static_cast( m_nncIndexes.empty() ? m_nncData->allConnections().size() : m_nncIndexes.size() ); bool isVisibilityCalcActive = m_cellVisibility.notNull() && m_grid.notNull(); std::vector* allCells = nullptr; @@ -88,7 +88,7 @@ void RivNNCGeometryGenerator::computeArrays() #pragma omp parallel for ordered for ( long long nIdx = 0; nIdx < numConnections; ++nIdx ) { - size_t conIdx = m_nncIndexes.isNull() ? nIdx : ( *m_nncIndexes )[nIdx]; + size_t conIdx = m_nncIndexes.empty() ? nIdx : m_nncIndexes[nIdx]; if ( !m_includeAllanDiagramGeometry && conIdx >= m_nncData->eclipseConnectionCount() ) { diff --git a/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.h b/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.h index 1919a9ffea..88f748e2a3 100644 --- a/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.h +++ b/ApplicationLibCode/ModelVisualization/RivNNCGeometryGenerator.h @@ -42,10 +42,10 @@ class RigEclipseResultAddress; class RivNNCGeometryGenerator : public cvf::Object { public: - RivNNCGeometryGenerator( bool includeAllan, - RigNNCData* nncData, - const cvf::Vec3d& offset, - const cvf::Array* nncIndexes ); + RivNNCGeometryGenerator( bool includeAllan, + RigNNCData* nncData, + const cvf::Vec3d& offset, + const std::vector& nncIndexes ); ~RivNNCGeometryGenerator() override; @@ -70,11 +70,11 @@ class RivNNCGeometryGenerator : public cvf::Object bool m_includeAllanDiagramGeometry; // Input - cvf::ref m_nncData; - cvf::cref> m_nncIndexes; - cvf::cref m_cellVisibility; - cvf::cref m_grid; - cvf::Vec3d m_offset; + cvf::ref m_nncData; + std::vector m_nncIndexes; + cvf::cref m_cellVisibility; + cvf::cref m_grid; + cvf::Vec3d m_offset; // Triangles cvf::ref m_vertices; diff --git a/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp b/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp index 14df097d72..7fffd23c2c 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigActiveCellInfo.cpp @@ -79,12 +79,6 @@ void RigActiveCellInfo::setCellResultIndex( size_t reservoirCellIndex, size_t re CVF_TIGHT_ASSERT( reservoirCellResultIndex < m_cellIndexToResultIndex.size() ); m_cellIndexToResultIndex[reservoirCellIndex] = reservoirCellResultIndex; - - // if ( reservoirCellResultIndex >= m_reservoirActiveCellCount ) - // { - //#pragma omp critical - // m_reservoirActiveCellCount = reservoirCellResultIndex + 1; - // } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp b/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp index e674e65b16..a1343f49f9 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp @@ -265,7 +265,7 @@ size_t RigNNCData::eclipseConnectionCount() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const RigConnectionContainer& RigNNCData::eclipseConnections() const +const RigConnectionContainer& RigNNCData::availableConnections() const { // Return connections without calling ensureConnectionDataIsProcessed() to avoid potential heavy computations // Relevant if only native connection data is required diff --git a/ApplicationLibCode/ReservoirDataModel/RigNNCData.h b/ApplicationLibCode/ReservoirDataModel/RigNNCData.h index 412aea8ac8..421814981d 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNNCData.h +++ b/ApplicationLibCode/ReservoirDataModel/RigNNCData.h @@ -57,7 +57,7 @@ class RigNNCData : public cvf::Object void setEclipseConnections( RigConnectionContainer& eclipseConnections ); void buildPolygonsForEclipseConnections(); size_t eclipseConnectionCount() const; - const RigConnectionContainer& eclipseConnections() const; + const RigConnectionContainer& availableConnections() const; bool ensureAllConnectionDataIsProcessed(); RigConnectionContainer& allConnections(); From 4d21f90bf9b602e3ab05fdd1a6893be002d7869e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 23 Dec 2021 09:30:36 +0100 Subject: [PATCH 052/406] Add summary multi plot Improve robustness related to update of Summary Plot Manager Add RimSummaryMultiPlot Move shared code into RiaSummaryStringTools Added "Create Summary Multi Plot" to menu of MultiPlot in project tree --- .../Tools/RiaSummaryStringTools.cpp | 169 +++++++++- .../Application/Tools/RiaSummaryStringTools.h | 30 +- .../CMakeLists_files.cmake | 7 +- .../RicNewSummaryMultiPlotFeature.cpp | 82 +++++ .../RicNewSummaryMultiPlotFeature.h | 46 +++ .../RimContextCommandBuilder.cpp | 1 + .../ProjectDataModel/RimMultiPlot.cpp | 54 +++ .../ProjectDataModel/RimMultiPlot.h | 6 + .../RimMultiPlotCollection.cpp | 19 +- .../ProjectDataModel/RimMultiPlotCollection.h | 5 +- .../Summary/CMakeLists_files.cmake | 2 + .../Summary/RimSummaryCaseMainCollection.cpp | 9 + .../Summary/RimSummaryCaseMainCollection.h | 4 + .../Summary/RimSummaryMultiPlot.cpp | 307 ++++++++++++++++++ .../Summary/RimSummaryMultiPlot.h | 76 +++++ .../Summary/RimSummaryPlotManager.cpp | 194 ++++------- .../Summary/RimSummaryPlotManager.h | 14 +- .../UnitTests/RiaSummaryStringTools-Test.cpp | 10 +- .../UserInterface/RiuPlotMainWindow.cpp | 4 + .../RiuSummaryVectorSelectionUi.cpp | 178 +++++----- .../RiuSummaryVectorSelectionUi.h | 3 + 21 files changed, 991 insertions(+), 229 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp index f6aa146cb7..313c7588fa 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp @@ -19,9 +19,19 @@ #include "RiaSummaryStringTools.h" #include "RiaLogging.h" +#include "RiaStdStringTools.h" +#include "RiaSummaryTools.h" + #include "RifEclipseSummaryAddress.h" +#include "RifReaderEclipseSummary.h" #include "RifSummaryReaderInterface.h" + +#include "RimMainPlotCollection.h" #include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" +#include "RimSummaryCaseMainCollection.h" + +#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" #include @@ -61,6 +71,26 @@ void RiaSummaryStringTools::splitAddressFiltersInGridAndSummary( RimSummaryCase* } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( const QString& filter ) +{ + auto words = RiaSummaryStringTools::splitIntoWords( filter ); + auto [summaryCases, ensembles] = RiaSummaryStringTools::allDataSourcesInProject(); + auto dataSourceNames = RiaSummaryStringTools::dataSourceNames( summaryCases, ensembles ); + + QStringList addressFilters; + QStringList dataSourceFilters; + + RiaSummaryStringTools::splitUsingDataSourceNames( words, dataSourceNames, addressFilters, dataSourceFilters ); + + // If no filter on data source is specified, use wildcard to match all + if ( dataSourceFilters.empty() ) dataSourceFilters.push_back( "*" ); + + return { addressFilters, dataSourceFilters }; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -78,10 +108,10 @@ bool RiaSummaryStringTools::hasFilterAnyMatch( const QString& //-------------------------------------------------------------------------------------------------- /// Sort filters into curve and data source filters //-------------------------------------------------------------------------------------------------- -void RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( const QStringList& filters, - const QStringList& dataSourceNames, - QStringList& addressFilters, - QStringList& dataSourceFilters ) +void RiaSummaryStringTools::splitUsingDataSourceNames( const QStringList& filters, + const QStringList& dataSourceNames, + QStringList& addressFilters, + QStringList& dataSourceFilters ) { for ( const auto& s : filters ) { @@ -108,3 +138,134 @@ void RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( const QStringL } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair, std::vector> + RiaSummaryStringTools::allDataSourcesInProject() +{ + auto sumCaseMainColl = RiaSummaryTools::summaryCaseMainCollection(); + + auto summaryCases = sumCaseMainColl->topLevelSummaryCases(); + auto ensembles = sumCaseMainColl->summaryCaseCollections(); + + return { summaryCases, ensembles }; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair, std::vector> + RiaSummaryStringTools::dataSourcesMatchingFilters( const QStringList& dataSourceFilters ) +{ + std::vector matchingSummaryCases; + std::vector matchingEnsembles; + + auto [allSummaryCases, allEnsembles] = allDataSourcesInProject(); + + for ( const auto& dsFilter : dataSourceFilters ) + { + QString searchString = dsFilter.left( dsFilter.indexOf( ':' ) ); + QRegExp searcher( searchString, Qt::CaseInsensitive, QRegExp::WildcardUnix ); + + for ( const auto& ensemble : allEnsembles ) + { + auto ensembleName = ensemble->name(); + if ( searcher.exactMatch( ensembleName ) ) + { + if ( searchString == dsFilter ) + { + // Match on ensemble name without realization filter + + matchingEnsembles.push_back( ensemble ); + } + else + { + // Match on subset of realisations in ensemble + + QString realizationSearchString = dsFilter.right( dsFilter.size() - dsFilter.indexOf( ':' ) - 1 ); + QRegExp realizationSearcher( realizationSearchString, Qt::CaseInsensitive, QRegExp::WildcardUnix ); + + for ( const auto& summaryCase : ensemble->allSummaryCases() ) + { + auto realizationName = summaryCase->displayCaseName(); + if ( realizationSearcher.exactMatch( realizationName ) ) + { + matchingSummaryCases.push_back( summaryCase ); + } + } + } + } + } + + for ( const auto& summaryCase : allSummaryCases ) + { + auto summaryCaseName = summaryCase->displayCaseName(); + if ( searcher.exactMatch( summaryCaseName ) ) + { + matchingSummaryCases.push_back( summaryCase ); + } + } + } + + return { matchingSummaryCases, matchingEnsembles }; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RiaSummaryStringTools::splitIntoWords( const QString& text ) +{ + QStringList words = text.split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); + + return words; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RiaSummaryStringTools::dataSourceNames( const std::vector& summaryCases, + const std::vector& ensembles ) +{ + QStringList names; + for ( const auto& summaryCase : summaryCases ) + { + names.push_back( summaryCase->displayCaseName() ); + } + + for ( const auto& ensemble : ensembles ) + { + names.push_back( ensemble->name() ); + } + + return names; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set + RiaSummaryStringTools::computeFilteredAddresses( const QStringList& textFilters, + const std::set& sourceAddresses, + bool includeDiffCurves ) +{ + std::set addresses; + + std::vector usedFilters; + RicSummaryPlotFeatureImpl::insertFilteredAddressesInSet( textFilters, sourceAddresses, &addresses, &usedFilters ); + + if ( includeDiffCurves ) return addresses; + + const auto diffText = RifReaderEclipseSummary::differenceIdentifier(); + + std::set addressesWithoutDiffVectors; + for ( const auto& adr : addresses ) + { + if ( RiaStdStringTools::endsWith( adr.quantityName(), diffText ) ) continue; + + addressesWithoutDiffVectors.insert( adr ); + } + + return addressesWithoutDiffVectors; +} diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.h b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.h index 7f61965798..25031059c2 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.h +++ b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.h @@ -19,9 +19,11 @@ #pragma once #include +#include class RimSummaryCase; class RifEclipseSummaryAddress; +class RimSummaryCaseCollection; class QString; class QStringList; @@ -37,10 +39,28 @@ class RiaSummaryStringTools QStringList* summaryAddressFilters, QStringList* gridResultAddressFilters ); - static bool hasFilterAnyMatch( const QString& curveFilter, const std::set& summaryAddresses ); + static std::pair splitIntoAddressAndDataSourceFilters( const QString& filter ); + + static std::pair, std::vector> allDataSourcesInProject(); + static std::pair, std::vector> + dataSourcesMatchingFilters( const QStringList& dataSourceFilters ); + + static QStringList splitIntoWords( const QString& text ); + + static QStringList dataSourceNames( const std::vector& summaryCases, + const std::vector& ensembles ); - static void splitIntoAddressAndDataSourceFilters( const QStringList& filters, - const QStringList& dataSourceNames, - QStringList& addressFilters, - QStringList& dataSourceFilters ); + static std::set + computeFilteredAddresses( const QStringList& textFilters, + const std::set& sourceAddresses, + bool includeDiffCurves ); + + // Consider private, set public to be able to test + static void splitUsingDataSourceNames( const QStringList& filters, + const QStringList& dataSourceNames, + QStringList& addressFilters, + QStringList& dataSourceFilters ); + +private: + static bool hasFilterAnyMatch( const QString& curveFilter, const std::set& summaryAddresses ); }; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake index 632d18b049..c7c7b99f48 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake @@ -1,10 +1,13 @@ -set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.h - ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotBuilder.h +set(SOURCE_GROUP_HEADER_FILES + ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotBuilder.h + ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFeature.h ) set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotBuilder.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp new file mode 100644 index 0000000000..f2df915398 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicNewSummaryMultiPlotFeature.h" + +#include "RimMultiPlotCollection.h" +#include "RimPlot.h" +#include "RimSummaryMultiPlot.h" + +#include "cafSelectionManager.h" +#include "cvfAssert.h" + +#include + +RICF_SOURCE_INIT( RicNewSummaryMultiPlotFeature, "RicNewSummaryMultiPlotFeature", "createSummaryMultiPlot" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicNewSummaryMultiPlotFeature::RicNewSummaryMultiPlotFeature() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmScriptResponse RicNewSummaryMultiPlotFeature::execute() +{ + std::vector plots; + RimSummaryMultiPlot::createAndAppendMultiPlot( plots ); + + return caf::PdmScriptResponse(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewSummaryMultiPlotFeature::isCommandEnabled() +{ + RimMultiPlotCollection* objToFind = nullptr; + + auto pdmUiItem = caf::SelectionManager::instance()->selectedItem(); + auto objHandle = dynamic_cast( pdmUiItem ); + if ( objHandle ) + { + objHandle->firstAncestorOrThisOfType( objToFind ); + } + + return ( objToFind != nullptr ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSummaryMultiPlotFeature::onActionTriggered( bool isChecked ) +{ + execute(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSummaryMultiPlotFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Create Summary Multi Plot" ); + actionToSetup->setIcon( QIcon( ":/MultiPlot16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h new file mode 100644 index 0000000000..0836072f2c --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RicfCommandObject.h" + +#include "cafCmdFeature.h" +#include "cafPdmField.h" + +#include + +class RimPlot; + +//================================================================================================== +/// +//================================================================================================== +class RicNewSummaryMultiPlotFeature : public caf::CmdFeature, public RicfCommandObject +{ + RICF_HEADER_INIT; + +public: + RicNewSummaryMultiPlotFeature(); + + caf::PdmScriptResponse execute() override; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index cdebd35895..529297c594 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1102,6 +1102,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicCloseObservedDataFeature"; menuBuilder << "RicNewMultiPlotFeature"; + menuBuilder << "RicNewSummaryMultiPlotFeature"; // Work in progress -- End diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 9c7c479420..07d41d9cba 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -256,6 +256,46 @@ void RimMultiPlot::movePlotsToThis( const std::vector& plotsToMove, in this->updateAllRequiredEditors(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::insertPlots( const std::vector& plots ) +{ + for ( auto plot : plots ) + { + if ( plot ) + { + m_plots.insert( -1, plot ); + + if ( m_viewer ) + { + plot->createPlotWidget(); + m_viewer->insertPlot( plot->viewer(), -1 ); + } + plot->setShowWindow( true ); + plot->updateAfterInsertingIntoMultiPlot(); + } + } + onPlotAdditionOrRemoval(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::deleteAllPlots() +{ + for ( auto plot : m_plots() ) + { + if ( plot && m_viewer ) + { + m_viewer->removePlot( plot->viewer() ); + } + } + + m_plots.deleteAllChildObjects(); + onPlotAdditionOrRemoval(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -659,6 +699,20 @@ void RimMultiPlot::uiOrderingForMultiPlotLayout( QString uiConfigName, caf::PdmU uiOrdering.add( &m_majorTickmarkCount ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::uiOrderingForSummaryMultiPlot( caf::PdmUiOrdering& uiOrdering ) const +{ + uiOrdering.add( &m_showPlotWindowTitle ); + uiOrdering.add( &m_plotWindowTitle ); + uiOrdering.add( &m_showIndividualPlotTitles ); + uiOrdering.add( &m_subTitleFontSize ); + uiOrdering.add( &m_columnCount ); + uiOrdering.add( &m_rowsPerPage ); + uiOrdering.add( &m_majorTickmarkCount ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index ed420014ae..eaa093534b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -55,6 +55,8 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection; + friend class RimSummaryMultiPlot; + public: RimMultiPlot(); ~RimMultiPlot() override; @@ -74,6 +76,10 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection& plots, int insertAtPosition ); + void insertPlots( const std::vector& plots ); + void deleteAllPlots(); + void uiOrderingForSummaryMultiPlot( caf::PdmUiOrdering& uiOrdering ) const; + size_t plotCount() const override; size_t plotIndex( const RimPlot* plot ) const; diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp index c4142cd122..c7b93d3433 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp @@ -19,6 +19,7 @@ #include "RimMultiPlot.h" #include "RimProject.h" +#include "RimSummaryMultiPlot.h" #include "cafPdmFieldReorderCapability.h" @@ -34,6 +35,10 @@ RimMultiPlotCollection::RimMultiPlotCollection() CAF_PDM_InitFieldNoDefault( &m_multiPlots, "MultiPlots", "Plots Reports" ); m_multiPlots.uiCapability()->setUiTreeHidden( true ); caf::PdmFieldReorderCapability::addToField( &m_multiPlots ); + + CAF_PDM_InitFieldNoDefault( &m_multiSummaryPlots, "MultiSummaryPlots", "Multi Summary Plots" ); + m_multiSummaryPlots.uiCapability()->setUiTreeHidden( true ); + caf::PdmFieldReorderCapability::addToField( &m_multiSummaryPlots ); } //-------------------------------------------------------------------------------------------------- @@ -49,6 +54,7 @@ RimMultiPlotCollection::~RimMultiPlotCollection() void RimMultiPlotCollection::deleteAllPlots() { m_multiPlots.deleteAllChildObjects(); + m_multiSummaryPlots.deleteAllChildObjects(); } //-------------------------------------------------------------------------------------------------- @@ -79,6 +85,14 @@ void RimMultiPlotCollection::addMultiPlot( RimMultiPlot* plot ) m_multiPlots().push_back( plot ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlotCollection::addMultiSummaryPlot( RimSummaryMultiPlot* plot ) +{ + m_multiSummaryPlots().push_back( plot ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -86,6 +100,9 @@ void RimMultiPlotCollection::loadDataAndUpdateAllPlots() { for ( const auto& p : m_multiPlots.childObjects() ) p->loadDataAndUpdate(); + + for ( const auto& p : m_multiSummaryPlots.childObjects() ) + p->loadDataAndUpdate(); } //-------------------------------------------------------------------------------------------------- @@ -93,5 +110,5 @@ void RimMultiPlotCollection::loadDataAndUpdateAllPlots() //-------------------------------------------------------------------------------------------------- size_t RimMultiPlotCollection::plotCount() const { - return m_multiPlots.size(); + return m_multiPlots.size() + m_multiSummaryPlots.size(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.h index 21c60b2b5b..e159c53ea1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.h @@ -23,6 +23,7 @@ #include "cafPdmObject.h" class RimMultiPlot; +class RimSummaryMultiPlot; //================================================================================================== /// @@ -43,7 +44,9 @@ class RimMultiPlotCollection : public caf::PdmObject, public RimPlotCollection std::vector multiPlots() const; RimMultiPlot* createMultiPlot(); void addMultiPlot( RimMultiPlot* plot ); + void addMultiSummaryPlot( RimSummaryMultiPlot* plot ); private: - caf::PdmChildArrayField m_multiPlots; + caf::PdmChildArrayField m_multiPlots; + caf::PdmChildArrayField m_multiSummaryPlots; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake index e1e1828fac..89e789dd58 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -37,6 +37,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunction.h ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunctionTools.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotManager.h + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlot.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -78,6 +79,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunction.cpp ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunctionTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotManager.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlot.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index 8a6aef6718..fd64c1980d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -94,6 +94,7 @@ void addCaseRealizationParametersIfFound( RimSummaryCase& sumCase, const QString /// //-------------------------------------------------------------------------------------------------- RimSummaryCaseMainCollection::RimSummaryCaseMainCollection() + : dataSourceHasChanged( this ) { CAF_PDM_InitObject( "Summary Cases", ":/SummaryCases16x16.png", "", "" ); @@ -233,6 +234,8 @@ void RimSummaryCaseMainCollection::addCase( RimSummaryCase* summaryCase ) { m_cases.push_back( summaryCase ); summaryCase->nameChanged.connect( this, &RimSummaryCaseMainCollection::onCaseNameChanged ); + + dataSourceHasChanged.send(); } //-------------------------------------------------------------------------------------------------- @@ -267,6 +270,8 @@ void RimSummaryCaseMainCollection::removeCase( RimSummaryCase* summaryCase ) { derEnsemble->createDerivedEnsembleCases(); } + + dataSourceHasChanged.send(); } //-------------------------------------------------------------------------------------------------- @@ -313,6 +318,8 @@ RimSummaryCaseCollection* summaryCaseCollection->caseNameChanged.connect( this, &RimSummaryCaseMainCollection::onCaseNameChanged ); m_caseCollections.push_back( summaryCaseCollection ); + dataSourceHasChanged.send(); + return summaryCaseCollection; } @@ -322,6 +329,8 @@ RimSummaryCaseCollection* void RimSummaryCaseMainCollection::removeCaseCollection( RimSummaryCaseCollection* caseCollection ) { m_caseCollections.removeChildObject( caseCollection ); + + dataSourceHasChanged.send(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h index 786357b733..9e7030c58b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h @@ -19,6 +19,7 @@ #include "cafPdmChildArrayField.h" #include "cafPdmObject.h" +#include "cafSignal.h" #include #include @@ -37,6 +38,9 @@ class RimSummaryCaseMainCollection : public caf::PdmObject { CAF_PDM_HEADER_INIT; +public: + caf::Signal<> dataSourceHasChanged; + public: RimSummaryCaseMainCollection(); ~RimSummaryCaseMainCollection() override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp new file mode 100644 index 0000000000..9c837672b2 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -0,0 +1,307 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimMultiPlot.h" + +#include "RiaSummaryStringTools.h" + +#include "RimMainPlotCollection.h" +#include "RimMultiPlotCollection.h" +#include "RimProject.h" +#include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryPlot.h" + +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" +#include "RiuSummaryVectorSelectionUi.h" + +#include "cafPdmUiComboBoxEditor.h" +#include "cafPdmUiTreeOrdering.h" +#include "cafPdmUiTreeSelectionEditor.h" + +CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot::RimSummaryMultiPlot() +{ + CAF_PDM_InitObject( "Multi Summary Plot Plot", "", "", "" ); + this->setDeletable( true ); + + CAF_PDM_InitFieldNoDefault( &m_filterText, "FilterText", "Filter Text" ); + m_filterText.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); + + CAF_PDM_InitField( &m_individualPlotPerVector, "IndividualPlotPerVector", false, "One plot per Vector" ); + CAF_PDM_InitField( &m_individualPlotPerDataSource, "IndividualPlotPerDataSource", false, "One plot per Data Source" ); + + CAF_PDM_InitField( &m_showMultiPlotInProjectTree, "ShowMultiPlotInProjectTree", false, "Show Multi Plot In Project Tree" ); + + CAF_PDM_InitFieldNoDefault( &m_multiPlot, "MultiPlot", "Multi Plot" ); + m_multiPlot = new RimMultiPlot; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot::~RimSummaryMultiPlot() +{ + removeMdiWindowFromMdiArea(); + m_multiPlot->cleanupBeforeClose(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* RimSummaryMultiPlot::viewWidget() +{ + return m_multiPlot->viewWidget(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QImage RimSummaryMultiPlot::snapshotWindowContent() +{ + return m_multiPlot->snapshotWindowContent(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::zoomAll() +{ + m_multiPlot->zoomAll(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryMultiPlot::description() const +{ + return "RimMultiSummaryPlot Placeholder Text"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::addPlot( RimPlot* plot ) +{ + m_multiPlot->addPlot( plot ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot* RimSummaryMultiPlot::createAndAppendMultiPlot( const std::vector& plots ) +{ + RimProject* project = RimProject::current(); + auto* plotCollection = project->mainPlotCollection()->multiPlotCollection(); + + auto* plotWindow = new RimSummaryMultiPlot; + plotWindow->setAsPlotMdiWindow(); + plotCollection->addMultiSummaryPlot( plotWindow ); + + for ( auto plot : plots ) + { + plotWindow->addPlot( plot ); + + plot->resolveReferencesRecursively(); + plot->revokeMdiWindowStatus(); + plot->setShowWindow( true ); + + plot->loadDataAndUpdate(); + } + + plotCollection->updateAllRequiredEditors(); + plotWindow->loadDataAndUpdate(); + + return plotWindow; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* RimSummaryMultiPlot::createViewWidget( QWidget* mainWindowParent /*= nullptr*/ ) +{ + return m_multiPlot->createViewWidget( mainWindowParent ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::deleteViewWidget() +{ + m_multiPlot->deleteViewWidget(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::onLoadDataAndUpdate() +{ + updateMdiWindowVisibility(); + + m_multiPlot->onLoadDataAndUpdate(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::doRenderWindowContent( QPaintDevice* paintDevice ) +{ + m_multiPlot->doRenderWindowContent( paintDevice ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimSummaryMultiPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) +{ + QList options; + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + uiOrdering.add( &m_filterText ); + uiOrdering.add( &m_individualPlotPerVector ); + uiOrdering.add( &m_individualPlotPerDataSource ); + + auto group = uiOrdering.addNewGroup( "Multi Plot Options" ); + m_multiPlot->uiOrderingForSummaryMultiPlot( *group ); + + uiOrdering.add( &m_showMultiPlotInProjectTree ); + + uiOrdering.skipRemainingFields(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) +{ + RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue ); + + if ( changedField == &m_showWindow && m_showWindow() ) + { + // Plots contained in a RimMultiPlot will automatically be set invisible + // Restore plot visibility + + for ( auto p : m_multiPlot->plots() ) + { + p->setShowWindow( true ); + } + } + else if ( changedField == &m_filterText || changedField == &m_individualPlotPerDataSource || + changedField == &m_individualPlotPerVector ) + { + updatePlots(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + if ( field == &m_filterText ) + { + auto attr = dynamic_cast( attribute ); + if ( attr ) + { + attr->enableEditableContent = true; + attr->enableAutoComplete = false; + attr->adjustWidthToContents = true; + attr->notifyWhenTextIsEdited = true; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) +{ + uiTreeOrdering.skipRemainingChildren( !m_showMultiPlotInProjectTree ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::updatePlots() +{ + auto [addressFilters, dataSourceFilters] = + RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( m_filterText() ); + + auto [matchingSummaryCases, matchingEnsembles] = RiaSummaryStringTools::dataSourcesMatchingFilters( dataSourceFilters ); + + std::set allAddresses; + if ( !matchingSummaryCases.empty() ) + { + allAddresses = RicSummaryPlotBuilder::addressesForSource( matchingSummaryCases.front() ); + } + else if ( !matchingEnsembles.empty() ) + { + allAddresses = RicSummaryPlotBuilder::addressesForSource( matchingEnsembles.front() ); + } + + bool includeDiffCurves = false; + auto filteredAddresses = + RiaSummaryStringTools::computeFilteredAddresses( addressFilters, allAddresses, includeDiffCurves ); + + { + // Remove existing plots + + m_multiPlot->deleteAllPlots(); + + // Add new plots + RicSummaryPlotBuilder plotBuilder; + plotBuilder.setAddresses( filteredAddresses ); + plotBuilder.setDataSources( matchingSummaryCases, matchingEnsembles ); + plotBuilder.setIndividualPlotPerAddress( m_individualPlotPerVector ); + plotBuilder.setIndividualPlotPerDataSource( m_individualPlotPerDataSource ); + + auto plots = plotBuilder.createPlots(); + + std::vector plotsForMultiPlot; + for ( auto p : plots ) + { + plotsForMultiPlot.push_back( dynamic_cast( p ) ); + } + + for ( auto plot : plotsForMultiPlot ) + { + this->addPlot( plot ); + + plot->resolveReferencesRecursively(); + plot->revokeMdiWindowStatus(); + plot->setShowWindow( true ); + } + + m_multiPlot->loadDataAndUpdate(); + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h new file mode 100644 index 0000000000..e118b7f9b5 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -0,0 +1,76 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RimPlotWindow.h" + +#include "cafPdmChildField.h" +#include "cafPdmObject.h" +#include "cafPdmPtrArrayField.h" + +class RimMultiPlot; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimSummaryMultiPlot : public RimPlotWindow +{ + CAF_PDM_HEADER_INIT; + +public: + RimSummaryMultiPlot(); + ~RimSummaryMultiPlot(); + + QWidget* viewWidget() override; + QImage snapshotWindowContent() override; + void zoomAll() override; + QString description() const override; + + void addPlot( RimPlot* plot ); + + static RimSummaryMultiPlot* createAndAppendMultiPlot( const std::vector& plots ); + +private: + QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override; + void deleteViewWidget() override; + void onLoadDataAndUpdate() override; + + void doRenderWindowContent( QPaintDevice* paintDevice ) override; + + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) override; + + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; + void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override; + + void updatePlots(); + +private: + caf::PdmField m_filterText; + caf::PdmField m_individualPlotPerVector; + caf::PdmField m_individualPlotPerDataSource; + + caf::PdmField m_showMultiPlotInProjectTree; + caf::PdmChildField m_multiPlot; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index f78350215a..7055af6461 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -28,6 +28,9 @@ #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" +#include "RimMainPlotCollection.h" +#include "RimMultiPlotCollection.h" +#include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" @@ -113,6 +116,14 @@ void RimSummaryPlotManager::setFocusToFilterText() setFocusToEditorWidget( m_filterText.uiCapability() ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::resetDataSourceSelection() +{ + m_previousDataSourceText.clear(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -128,8 +139,10 @@ void RimSummaryPlotManager::fieldChangedByUi( const caf::PdmFieldHandle* changed const QVariant& oldValue, const QVariant& newValue ) { - if ( changedField == &m_summaryPlot || changedField == &m_filterText || changedField == &m_includeDiffCurves ) + if ( changedField == &m_summaryPlot || changedField == &m_filterText || changedField == &m_includeDiffCurves || + changedField == &m_selectedDataSources ) { + updateSelectionFromUiChange(); updateCurveCandidates(); } else if ( changedField == &m_pushButtonReplace ) @@ -175,32 +188,12 @@ QList } else if ( fieldNeedingOptions == &m_selectedDataSources ) { - auto [summaryCases, ensembles] = allDataSourcesInProject(); - - std::vector dataSourceDisplayNames; - - bool resetCheckedItems = false; - - std::vector> dataSources = findDataSourceCandidates(); - for ( const auto& dataSource : dataSources ) + for ( const auto& displayName : dataSourceDisplayNames() ) { - auto displayName = dataSource.first; - dataSourceDisplayNames.push_back( displayName ); options.push_back( caf::PdmOptionItemInfo( displayName, displayName ) ); - - if ( m_previousDataSourceSelection.count( displayName ) == 0 ) resetCheckedItems = true; - } - - if ( m_previousDataSourceSelection.size() != dataSourceDisplayNames.size() ) resetCheckedItems = true; - - if ( resetCheckedItems ) - { - // By default select all available data sources - m_selectedDataSources = dataSourceDisplayNames; } - m_previousDataSourceSelection.clear(); - m_previousDataSourceSelection.insert( dataSourceDisplayNames.begin(), dataSourceDisplayNames.end() ); + updateSelectionFromUiChange(); } return options; @@ -230,59 +223,33 @@ std::vector> RimSummaryPlotManager::findData { std::vector> candidates; - QStringList addressFilters; - QStringList dataSourceFilters; - splitIntoAddressAndDataSourceFilters( addressFilters, dataSourceFilters ); + QStringList dataSourceFilters = extractDataSourceFilters(); - // If no filter on data source is specified, use wildcard to match all - if ( dataSourceFilters.empty() ) dataSourceFilters.push_back( "*" ); + auto [summaryCases, ensembles] = RiaSummaryStringTools::dataSourcesMatchingFilters( dataSourceFilters ); + + for ( auto ensemble : ensembles ) + { + auto ensembleName = ensemble->name(); - auto [summaryCases, ensembles] = allDataSourcesInProject(); + candidates.push_back( std::make_pair( ensembleName, ensemble ) ); + } - for ( const auto& dsFilter : dataSourceFilters ) + for ( const auto& summaryCase : summaryCases ) { - QString searchString = dsFilter.left( dsFilter.indexOf( ':' ) ); - QRegExp searcher( searchString, Qt::CaseInsensitive, QRegExp::WildcardUnix ); + auto summaryCaseName = summaryCase->displayCaseName(); - for ( const auto& ensemble : ensembles ) + QString displayName; + auto ensemble = summaryCase->ensemble(); + if ( ensemble ) { - auto ensembleName = ensemble->name(); - if ( searcher.exactMatch( ensembleName ) ) - { - if ( searchString == dsFilter ) - { - // Match on ensemble name without realization filter - - candidates.push_back( std::make_pair( ensembleName, ensemble ) ); - } - else - { - // Match on subset of realisations in ensemble - - QString realizationSearchString = dsFilter.right( dsFilter.size() - dsFilter.indexOf( ':' ) - 1 ); - QRegExp realizationSearcher( realizationSearchString, Qt::CaseInsensitive, QRegExp::WildcardUnix ); - - for ( const auto& summaryCase : ensemble->allSummaryCases() ) - { - auto realizationName = summaryCase->displayCaseName(); - if ( realizationSearcher.exactMatch( realizationName ) ) - { - QString displayName = ensembleName + ":" + realizationName; - candidates.push_back( std::make_pair( displayName, summaryCase ) ); - } - } - } - } + displayName = ensemble->name() + ":" + summaryCaseName; } - - for ( const auto& summaryCase : summaryCases ) + else { - auto summaryCaseName = summaryCase->displayCaseName(); - if ( searcher.exactMatch( summaryCaseName ) ) - { - candidates.push_back( std::make_pair( summaryCase->displayCaseName(), summaryCase ) ); - } + displayName = summaryCaseName; } + + candidates.push_back( std::make_pair( displayName, summaryCase ) ); } return candidates; @@ -291,28 +258,17 @@ std::vector> RimSummaryPlotManager::findData //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set - RimSummaryPlotManager::computeFilteredAddresses( const QStringList& textFilters, - const std::set& sourceAddresses ) +std::vector RimSummaryPlotManager::dataSourceDisplayNames() const { - std::set addresses; - - std::vector usedFilters; - RicSummaryPlotFeatureImpl::insertFilteredAddressesInSet( textFilters, sourceAddresses, &addresses, &usedFilters ); - - if ( m_includeDiffCurves ) return addresses; - - const auto diffText = RifReaderEclipseSummary::differenceIdentifier(); - - std::set addressesWithoutDiffVectors; - for ( const auto& adr : addresses ) + std::vector displayNames; + std::vector> dataSources = findDataSourceCandidates(); + for ( const auto& dataSource : dataSources ) { - if ( RiaStdStringTools::endsWith( adr.quantityName(), diffText ) ) continue; - - addressesWithoutDiffVectors.insert( adr ); + auto displayName = dataSource.first; + displayNames.push_back( displayName ); } - return addressesWithoutDiffVectors; + return displayNames; } //-------------------------------------------------------------------------------------------------- @@ -429,6 +385,7 @@ void RimSummaryPlotManager::createNewPlot() p->loadDataAndUpdate(); plotsForMultiPlot.push_back( dynamic_cast( p ) ); } + RicSummaryPlotBuilder::createAndAppendMultiPlot( plotsForMultiPlot ); } else @@ -472,20 +429,6 @@ bool RimSummaryPlotManager::eventFilter( QObject* obj, QEvent* event ) return QObject::eventFilter( obj, event ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::pair, std::vector> - RimSummaryPlotManager::allDataSourcesInProject() const -{ - auto sumCaseMainColl = RiaSummaryTools::summaryCaseMainCollection(); - - auto summaryCases = sumCaseMainColl->topLevelSummaryCases(); - auto ensembles = sumCaseMainColl->summaryCaseCollections(); - - return { summaryCases, ensembles }; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -500,6 +443,7 @@ void RimSummaryPlotManager::updateUiFromSelection() { m_summaryPlot = summaryPlot; + updateSelectionFromUiChange(); updateCurveCandidates(); } @@ -508,8 +452,7 @@ void RimSummaryPlotManager::updateUiFromSelection() m_summaryPlot = nullptr; std::vector tmp; - m_addressCandidates = tmp; - m_selectedDataSources = tmp; + m_addressCandidates = tmp; } updateConnectedEditors(); @@ -538,7 +481,7 @@ std::set RimSummaryPlotManager::filteredAddresses() QStringList allCurveAddressFilters = m_filterText().split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); - return computeFilteredAddresses( allCurveAddressFilters, nativeAddresses ); + return RiaSummaryStringTools::computeFilteredAddresses( allCurveAddressFilters, nativeAddresses, m_includeDiffCurves ); } //-------------------------------------------------------------------------------------------------- @@ -585,6 +528,20 @@ void RimSummaryPlotManager::updateProjectTreeAndRefresUi() setFocusToFilterText(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::updateSelectionFromUiChange() +{ + QStringList dataSourceFilters = extractDataSourceFilters(); + if ( m_previousDataSourceText != dataSourceFilters ) + { + m_selectedDataSources = dataSourceDisplayNames(); + + m_previousDataSourceText = dataSourceFilters; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -611,28 +568,12 @@ void RimSummaryPlotManager::setFocusToEditorWidget( caf::PdmUiFieldHandle* uiFie //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlotManager::splitIntoAddressAndDataSourceFilters( QStringList& addressFilters, - QStringList& dataSourceFilters ) const +QStringList RimSummaryPlotManager::extractDataSourceFilters() const { - QStringList filterItems = m_filterText().split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); - - auto [summaryCases, ensembles] = allDataSourcesInProject(); - - QStringList dataSourceNames; - for ( const auto& summaryCase : summaryCases ) - { - dataSourceNames.push_back( summaryCase->displayCaseName() ); - } + auto [addressFilters, dataSourceFilters] = + RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( m_filterText() ); - for ( const auto& ensemble : ensembles ) - { - dataSourceNames.push_back( ensemble->name() ); - } - - RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( filterItems, - dataSourceNames, - addressFilters, - dataSourceFilters ); + return dataSourceFilters; } //-------------------------------------------------------------------------------------------------- @@ -671,3 +612,12 @@ QString RimSummaryPlotManager::curveFilterRecentlyUsedRegistryKey() { return "SummaryPlotManagerCurveFilterStrings"; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotManager::onSummaryDataSourceHasChanged( const caf::SignalEmitter* emitter ) +{ + resetDataSourceSelection(); + updateSelectionFromUiChange(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h index 4493f9364c..81348b207d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h @@ -42,6 +42,8 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: RimSummaryPlotManager(); void setFocusToFilterText(); + void resetDataSourceSelection(); + void onSummaryDataSourceHasChanged( const caf::SignalEmitter* emitter ); private: void appendCurves(); @@ -66,11 +68,7 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: void updateCurveCandidates(); std::vector> findDataSourceCandidates() const; - - std::set computeFilteredAddresses( const QStringList& textFilters, - const std::set& sourceAddresses ); - - std::pair, std::vector> allDataSourcesInProject() const; + std::vector dataSourceDisplayNames() const; std::set filteredAddresses(); @@ -78,8 +76,10 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: void appendCurvesToPlot( RimSummaryPlot* destinationPlot ); void updateFilterTextHistory(); void updateProjectTreeAndRefresUi(); + void updateSelectionFromUiChange(); + + QStringList extractDataSourceFilters() const; - void splitIntoAddressAndDataSourceFilters( QStringList& addressFilters, QStringList& dataSourceFilters ) const; void findFilteredSummaryCasesAndEnsembles( std::vector& summaryCases, std::vector& ensembles ) const; @@ -106,5 +106,5 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: caf::PdmField m_labelA; caf::PdmField m_labelB; - std::set m_previousDataSourceSelection; + QStringList m_previousDataSourceText; }; diff --git a/ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp b/ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp index 983cfdcad2..9735fa2404 100644 --- a/ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiaSummaryStringTools-Test.cpp @@ -21,10 +21,7 @@ TEST( RiaSummaryStringToolsTest, ParseNumbers ) QStringList addressFilters; QStringList dataSourceFilters; - RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( arguments, - dataSourceNames, - addressFilters, - dataSourceFilters ); + RiaSummaryStringTools::splitUsingDataSourceNames( arguments, dataSourceNames, addressFilters, dataSourceFilters ); EXPECT_TRUE( addressFilters[0] == wellFilter ); EXPECT_TRUE( addressFilters[1] == fieldFilter ); @@ -39,10 +36,7 @@ TEST( RiaSummaryStringToolsTest, ParseNumbers ) QStringList addressFilters; QStringList dataSourceFilters; - RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( arguments, - dataSourceNames, - addressFilters, - dataSourceFilters ); + RiaSummaryStringTools::splitUsingDataSourceNames( arguments, dataSourceNames, addressFilters, dataSourceFilters ); EXPECT_TRUE( addressFilters[0] == wellFilter ); EXPECT_TRUE( addressFilters[1] == fieldFilter ); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 021ff041a0..b142698224 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -134,6 +134,10 @@ void RiuPlotMainWindow::initializeGuiNewProjectLoaded() auto sumPlotManager = dynamic_cast( m_summaryPlotManager.get() ); if ( sumPlotManager ) { + auto* obj = RiaSummaryTools::summaryCaseMainCollection(); + obj->dataSourceHasChanged.connect( sumPlotManager, &RimSummaryPlotManager::onSummaryDataSourceHasChanged ); + + sumPlotManager->resetDataSourceSelection(); sumPlotManager->updateConnectedEditors(); } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp index e0ef615776..2de072ec59 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp @@ -539,6 +539,101 @@ void RiuSummaryVectorSelectionUi::setDefaultSelection( const std::vector RiuSummaryVectorSelectionUi::optionsForSummaryDataSource( bool hideSummaryCases, + bool hideEnsembles, + bool showIndividualEnsembleCases ) +{ + QList options; + + RimProject* proj = RimProject::current(); + std::vector oilFields; + + proj->allOilFields( oilFields ); + for ( RimOilField* oilField : oilFields ) + { + RimSummaryCaseMainCollection* sumCaseMainColl = oilField->summaryCaseMainCollection(); + if ( sumCaseMainColl ) + { + if ( !hideSummaryCases ) + { + // Top level cases + for ( const auto& sumCase : sumCaseMainColl->topLevelSummaryCases() ) + { + options.push_back( caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ) ); + } + } + + // Ensembles + if ( !hideEnsembles ) + { + bool ensembleHeaderCreated = false; + for ( const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections() ) + { + if ( !sumCaseColl->isEnsemble() ) continue; + + if ( !ensembleHeaderCreated ) + { + options.push_back( caf::PdmOptionItemInfo::createHeader( "Ensembles", true ) ); + ensembleHeaderCreated = true; + } + // Ensemble level + { + auto optionItem = caf::PdmOptionItemInfo( sumCaseColl->name(), sumCaseColl ); + optionItem.setLevel( 1 ); + options.push_back( optionItem ); + } + if ( showIndividualEnsembleCases ) + { + for ( const auto& sumCase : sumCaseColl->allSummaryCases() ) + { + auto optionItem = caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ); + optionItem.setLevel( 2 ); + options.push_back( optionItem ); + } + } + } + } + + if ( !hideSummaryCases ) + { + // Grouped cases + for ( const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections() ) + { + if ( sumCaseColl->isEnsemble() ) continue; + + options.push_back( caf::PdmOptionItemInfo::createHeader( sumCaseColl->name(), true ) ); + + for ( const auto& sumCase : sumCaseColl->allSummaryCases() ) + { + auto optionItem = caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ); + optionItem.setLevel( 1 ); + options.push_back( optionItem ); + } + } + + // Observed data + auto observedDataColl = oilField->observedDataCollection(); + if ( observedDataColl->allObservedSummaryData().size() > 0 ) + { + options.push_back( caf::PdmOptionItemInfo::createHeader( "Observed Data", true ) ); + + for ( const auto& obsData : observedDataColl->allObservedSummaryData() ) + { + auto optionItem = caf::PdmOptionItemInfo( obsData->caseName(), obsData ); + optionItem.setLevel( 1 ); + options.push_back( optionItem ); + } + } + } + } + } + + return options; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1345,87 +1440,12 @@ RimSummaryCase* RiuSummaryVectorSelectionUi::calculatedSummaryCase() //-------------------------------------------------------------------------------------------------- void RiuSummaryVectorSelectionUi::appendOptionItemsForSources( QList& options ) const { - RimProject* proj = RimProject::current(); - std::vector oilFields; + auto dataSourceOptions = + optionsForSummaryDataSource( m_hideSummaryCases, m_hideEnsembles, m_showIndividualEnsembleCases ); - proj->allOilFields( oilFields ); - for ( RimOilField* oilField : oilFields ) + for ( auto& o : dataSourceOptions ) { - RimSummaryCaseMainCollection* sumCaseMainColl = oilField->summaryCaseMainCollection(); - if ( sumCaseMainColl ) - { - if ( !m_hideSummaryCases ) - { - // Top level cases - for ( const auto& sumCase : sumCaseMainColl->topLevelSummaryCases() ) - { - options.push_back( caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ) ); - } - } - - // Ensembles - if ( !m_hideEnsembles ) - { - bool ensembleHeaderCreated = false; - for ( const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections() ) - { - if ( !sumCaseColl->isEnsemble() ) continue; - - if ( !ensembleHeaderCreated ) - { - options.push_back( caf::PdmOptionItemInfo::createHeader( "Ensembles", true ) ); - ensembleHeaderCreated = true; - } - // Ensemble level - { - auto optionItem = caf::PdmOptionItemInfo( sumCaseColl->name(), sumCaseColl ); - optionItem.setLevel( 1 ); - options.push_back( optionItem ); - } - if ( m_showIndividualEnsembleCases ) - { - for ( const auto& sumCase : sumCaseColl->allSummaryCases() ) - { - auto optionItem = caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ); - optionItem.setLevel( 2 ); - options.push_back( optionItem ); - } - } - } - } - - if ( !m_hideSummaryCases ) - { - // Grouped cases - for ( const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections() ) - { - if ( sumCaseColl->isEnsemble() ) continue; - - options.push_back( caf::PdmOptionItemInfo::createHeader( sumCaseColl->name(), true ) ); - - for ( const auto& sumCase : sumCaseColl->allSummaryCases() ) - { - auto optionItem = caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ); - optionItem.setLevel( 1 ); - options.push_back( optionItem ); - } - } - - // Observed data - auto observedDataColl = oilField->observedDataCollection(); - if ( observedDataColl->allObservedSummaryData().size() > 0 ) - { - options.push_back( caf::PdmOptionItemInfo::createHeader( "Observed Data", true ) ); - - for ( const auto& obsData : observedDataColl->allObservedSummaryData() ) - { - auto optionItem = caf::PdmOptionItemInfo( obsData->caseName(), obsData ); - optionItem.setLevel( 1 ); - options.push_back( optionItem ); - } - } - } - } + options.push_back( o ); } } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h index ebf8fe2ef1..cbd21afb53 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h @@ -71,6 +71,9 @@ class RiuSummaryVectorSelectionUi : public caf::PdmObject void setDefaultSelection( const std::vector& defaultCases ); + static QList + optionsForSummaryDataSource( bool hideSummaryCases, bool hideEnsembles, bool showIndividualEnsembleCases ); + private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, From 57e4283d267526c6f2ea17396d29309f31479199 Mon Sep 17 00:00:00 2001 From: magnesj Date: Fri, 24 Dec 2021 02:21:23 +0000 Subject: [PATCH 053/406] Fixes by clang-tidy --- ApplicationLibCode/ProjectDataModel/RimMultiPlot.h | 2 +- .../ProjectDataModel/Summary/RimSummaryMultiPlot.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index eaa093534b..6755cdccf8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -77,7 +77,7 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection& plots, int insertAtPosition ); void insertPlots( const std::vector& plots ); - void deleteAllPlots(); + void deleteAllPlots() override; void uiOrderingForSummaryMultiPlot( caf::PdmUiOrdering& uiOrdering ) const; size_t plotCount() const override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index e118b7f9b5..ec4df967a7 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -36,7 +36,7 @@ class RimSummaryMultiPlot : public RimPlotWindow public: RimSummaryMultiPlot(); - ~RimSummaryMultiPlot(); + ~RimSummaryMultiPlot() override; QWidget* viewWidget() override; QImage snapshotWindowContent() override; From 8defab9bc1c57cf204fbe45fb1d322277a9bc2a4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 4 Jan 2022 07:29:56 +0100 Subject: [PATCH 054/406] Merge pull request #8402 from OPM/8401-flow-vector-result #8401 Flow Vector Result: Handle empty results for first time step Use OpenMP for vector calculations Janitor: Use field of double instead of float to avoid rounding errors. If float is used in field, the current editor is has rounding effects that makes the text representation of 0.1 turn into 0.09999999.... --- .../RivElementVectorResultPartMgr.cpp | 22 +++++++++++++------ .../RimElementVectorResult.cpp | 8 +++---- .../ProjectDataModel/RimElementVectorResult.h | 8 +++---- .../RigCaseCellResultCalculator.cpp | 2 ++ .../RigResultModifierFactory.cpp | 2 ++ 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp index ba9a37efd9..4ab81b28ee 100644 --- a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp @@ -121,7 +121,8 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode if ( fluidIndex == 0 ) directions.push_back( cvf::StructGridInterface::POS_I ); auto candidate = addresses[0 + fluidIndex]; - if ( resultsData->hasResultEntry( candidate ) ) + if ( resultsData->hasResultEntry( candidate ) && + !resultsData->cellScalarResults( candidate, timeStepIndex ).empty() ) { resultAddresses.push_back( candidate ); } @@ -130,7 +131,8 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode { if ( fluidIndex == 0 ) directions.push_back( cvf::StructGridInterface::POS_J ); auto candidate = addresses[1 + fluidIndex]; - if ( resultsData->hasResultEntry( candidate ) ) + if ( resultsData->hasResultEntry( candidate ) && + !resultsData->cellScalarResults( candidate, timeStepIndex ).empty() ) { resultAddresses.push_back( candidate ); } @@ -139,7 +141,8 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode { if ( fluidIndex == 0 ) directions.push_back( cvf::StructGridInterface::POS_K ); auto candidate = addresses[2 + fluidIndex]; - if ( resultsData->hasResultEntry( candidate ) ) + if ( resultsData->hasResultEntry( candidate ) && + !resultsData->cellScalarResults( candidate, timeStepIndex ).empty() ) { resultAddresses.push_back( candidate ); } @@ -161,7 +164,8 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode faceNormal = ( faceCenter - cellCenter ).getNormalized() * arrowScaling; }; - for ( size_t gcIdx = 0; gcIdx < cells.size(); ++gcIdx ) +#pragma omp parallel for + for ( int gcIdx = 0; gcIdx < static_cast( cells.size() ); ++gcIdx ) { if ( !cells[gcIdx].isInvalid() && activeCellInfo->isActive( gcIdx ) ) { @@ -181,9 +185,10 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode { cvf::Vec3d faceCenter; cvf::Vec3d faceNormal; - getFaceCenterAndNormal( gcIdx, directions[dir], faceCenter, faceNormal ); + getFaceCenterAndNormal( static_cast( gcIdx ), directions[dir], faceCenter, faceNormal ); faceNormal *= std::abs( resultValue ); +#pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_1 ) tensorVisualizations.push_back( ElementVectorResultVisualization( faceCenter, faceNormal, @@ -215,6 +220,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode } if ( aggregatedResult.length() >= result->threshold() ) { +#pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_2 ) tensorVisualizations.push_back( ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cells[gcIdx].center() ), aggregatedVector, @@ -245,7 +251,8 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode } } - for ( size_t nIdx = 0; nIdx < nncData->eclipseConnectionCount(); ++nIdx ) +#pragma omp parallel for + for ( int nIdx = 0; nIdx < static_cast( nncData->eclipseConnectionCount() ); ++nIdx ) { const RigConnection& conn = nncData->availableConnections()[nIdx]; if ( conn.polygon().size() ) @@ -253,7 +260,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode double resultValue = 0.0; for ( size_t flIdx = 0; flIdx < nncResultVals.size(); flIdx++ ) { - if ( nIdx < nncResultVals.at( flIdx )->at( timeStepIndex ).size() ) + if ( nIdx < static_cast( nncResultVals.at( flIdx )->at( timeStepIndex ).size() ) ) { resultValue += nncResultVals.at( flIdx )->at( timeStepIndex )[nIdx]; } @@ -269,6 +276,7 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode if ( std::abs( resultValue ) >= result->threshold() ) { +#pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_nnc ) tensorVisualizations.push_back( ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( connCenter ), connNormal, diff --git a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp index b2694ad0c2..41a2ff7335 100644 --- a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp @@ -94,13 +94,13 @@ RimElementVectorResult::RimElementVectorResult() CAF_PDM_InitField( &m_showVectorJ, "ShowVectorJ", true, "J" ); CAF_PDM_InitField( &m_showVectorK, "ShowVectorK", true, "K" ); CAF_PDM_InitField( &m_showNncData, "ShowNncData", true, "Show NNC Data" ); - CAF_PDM_InitField( &m_threshold, "Threshold", 0.0f, "Threshold" ); + CAF_PDM_InitField( &m_threshold, "Threshold", 0.0, "Threshold" ); CAF_PDM_InitFieldNoDefault( &m_vectorColor, "VectorColor", "Color" ); cvf::Color3f defaultUniformColor = cvf::Color3f::BLACK; CAF_PDM_InitField( &m_uniformVectorColor, "UniformVectorColor", defaultUniformColor, "Uniform Vector Color" ); - CAF_PDM_InitField( &m_sizeScale, "SizeScale", 1.0f, "Size Scale" ); + CAF_PDM_InitField( &m_sizeScale, "SizeScale", 1.0, "Size Scale" ); } //-------------------------------------------------------------------------------------------------- @@ -206,7 +206,7 @@ RimElementVectorResult::VectorSurfaceCrossingLocation RimElementVectorResult::ve //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -float RimElementVectorResult::threshold() const +double RimElementVectorResult::threshold() const { return m_threshold(); } @@ -214,7 +214,7 @@ float RimElementVectorResult::threshold() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -float RimElementVectorResult::sizeScale() const +double RimElementVectorResult::sizeScale() const { return m_sizeScale(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.h b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.h index 079e67a8b7..024a347354 100644 --- a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.h +++ b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.h @@ -77,8 +77,8 @@ class RimElementVectorResult : public caf::PdmObject bool showVectorK() const; bool showNncData() const; VectorSurfaceCrossingLocation vectorSuraceCrossingLocation() const; - float threshold() const; - float sizeScale() const; + double threshold() const; + double sizeScale() const; TensorColors vectorColors() const; const cvf::Color3f& getUniformVectorColor() const; @@ -108,10 +108,10 @@ class RimElementVectorResult : public caf::PdmObject caf::PdmField m_showVectorK; caf::PdmField m_showNncData; caf::PdmField> m_vectorSurfaceCrossingLocation; - caf::PdmField m_threshold; + caf::PdmField m_threshold; caf::PdmField> m_vectorColor; caf::PdmField m_uniformVectorColor; - caf::PdmField m_sizeScale; + caf::PdmField m_sizeScale; caf::PdmField m_rangeMode; caf::PdmChildField m_legendConfig; }; diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultCalculator.cpp index 19ab6b596d..c35e6826e2 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultCalculator.cpp @@ -264,6 +264,8 @@ bool RigCaseCellResultCalculator::computeDivideByCellFaceArea( RigMainGrid* cvf::ref resultModifier = RigResultModifierFactory::createResultModifier( destination, gridIdx, porosityModel, fIdx, address ); + if ( resultModifier.isNull() ) continue; + #pragma omp parallel for for ( int localGridCellIdx = 0; localGridCellIdx < static_cast( grid->cellCount() ); localGridCellIdx++ ) { diff --git a/ApplicationLibCode/ReservoirDataModel/RigResultModifierFactory.cpp b/ApplicationLibCode/ReservoirDataModel/RigResultModifierFactory.cpp index cf63145cba..bec5e662d5 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigResultModifierFactory.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigResultModifierFactory.cpp @@ -65,6 +65,8 @@ cvf::ref RigResultModifierFactory::createResultModifier( RigE resultValues = &( scalarSetResults->at( timeStepIndex ) ); } + if ( resultValues->empty() ) return nullptr; + bool useGlobalActiveIndex = eclipseCase->results( porosityModel )->isUsingGlobalActiveIndex( resVarAddr ); if ( useGlobalActiveIndex ) { From eeb51bd8f1a0d5f1faf74d3f0409e055e8c7ecff Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 4 Jan 2022 12:01:51 +0100 Subject: [PATCH 055/406] #8403 Ensure the NNC connection polygon is created before computing area --- .../RivElementVectorResultPartMgr.cpp | 101 +++++++++--------- .../ReservoirDataModel/RigNNCData.cpp | 8 +- 2 files changed, 57 insertions(+), 52 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp index 4ab81b28ee..9238f42511 100644 --- a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp @@ -164,68 +164,71 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode faceNormal = ( faceCenter - cellCenter ).getNormalized() * arrowScaling; }; -#pragma omp parallel for - for ( int gcIdx = 0; gcIdx < static_cast( cells.size() ); ++gcIdx ) + if ( !resultAddresses.empty() && !directions.empty() ) { - if ( !cells[gcIdx].isInvalid() && activeCellInfo->isActive( gcIdx ) ) +#pragma omp parallel for + for ( int gcIdx = 0; gcIdx < static_cast( cells.size() ); ++gcIdx ) { - size_t resultIdx = activeCellInfo->cellResultIndex( gcIdx ); - if ( result->vectorView() == RimElementVectorResult::VectorView::PER_FACE ) + if ( !cells[gcIdx].isInvalid() && activeCellInfo->isActive( gcIdx ) ) { - for ( int dir = 0; dir < static_cast( directions.size() ); dir++ ) + size_t resultIdx = activeCellInfo->cellResultIndex( gcIdx ); + if ( result->vectorView() == RimElementVectorResult::VectorView::PER_FACE ) { - double resultValue = 0.0; - for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() ) + for ( int dir = 0; dir < static_cast( directions.size() ); dir++ ) { - resultValue += - resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx ); - } - - if ( std::abs( resultValue ) >= result->threshold() ) - { - cvf::Vec3d faceCenter; - cvf::Vec3d faceNormal; - getFaceCenterAndNormal( static_cast( gcIdx ), directions[dir], faceCenter, faceNormal ); - faceNormal *= std::abs( resultValue ); + double resultValue = 0.0; + for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() ) + { + resultValue += + resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx ); + } + + if ( std::abs( resultValue ) >= result->threshold() ) + { + cvf::Vec3d faceCenter; + cvf::Vec3d faceNormal; + getFaceCenterAndNormal( static_cast( gcIdx ), directions[dir], faceCenter, faceNormal ); + faceNormal *= std::abs( resultValue ); #pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_1 ) - tensorVisualizations.push_back( - ElementVectorResultVisualization( faceCenter, - faceNormal, - resultValue, - std::cbrt( cells[gcIdx].volume() / 3.0 ) ) ); + tensorVisualizations.push_back( + ElementVectorResultVisualization( faceCenter, + faceNormal, + resultValue, + std::cbrt( cells[gcIdx].volume() / 3.0 ) ) ); + } } } - } - else if ( result->vectorView() == RimElementVectorResult::VectorView::CELL_CENTER_TOTAL ) - { - cvf::Vec3d aggregatedVector; - cvf::Vec3d aggregatedResult; - for ( int dir = 0; dir < static_cast( directions.size() ); dir++ ) + else if ( result->vectorView() == RimElementVectorResult::VectorView::CELL_CENTER_TOTAL ) { - double resultValue = 0.0; - for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() ) + cvf::Vec3d aggregatedVector; + cvf::Vec3d aggregatedResult; + for ( int dir = 0; dir < static_cast( directions.size() ); dir++ ) { - resultValue += - resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx ); - } + double resultValue = 0.0; + for ( size_t flIdx = dir; flIdx < resultAddresses.size(); flIdx += directions.size() ) + { + resultValue += + resultsData->cellScalarResults( resultAddresses[flIdx], timeStepIndex ).at( resultIdx ); + } - cvf::Vec3d faceCenter; - cvf::Vec3d faceNormal; - cvf::Vec3d faceNormalScaled; - getFaceCenterAndNormal( gcIdx, directions[dir], faceCenter, faceNormal ); - faceNormalScaled = faceNormal * resultValue; - aggregatedVector += faceNormalScaled; - aggregatedResult += faceNormal.getNormalized() * resultValue; - } - if ( aggregatedResult.length() >= result->threshold() ) - { + cvf::Vec3d faceCenter; + cvf::Vec3d faceNormal; + cvf::Vec3d faceNormalScaled; + getFaceCenterAndNormal( gcIdx, directions[dir], faceCenter, faceNormal ); + faceNormalScaled = faceNormal * resultValue; + aggregatedVector += faceNormalScaled; + aggregatedResult += faceNormal.getNormalized() * resultValue; + } + if ( aggregatedResult.length() >= result->threshold() ) + { #pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_2 ) - tensorVisualizations.push_back( - ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cells[gcIdx].center() ), - aggregatedVector, - aggregatedResult.length(), - std::cbrt( cells[gcIdx].volume() / 3.0 ) ) ); + tensorVisualizations.push_back( + ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cells[gcIdx].center() ), + aggregatedVector, + aggregatedResult.length(), + std::cbrt( cells[gcIdx].volume() / 3.0 ) ) ); + } } } } diff --git a/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp b/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp index a1343f49f9..0c77da06f7 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigNNCData.cpp @@ -645,12 +645,14 @@ bool RigNNCData::generateScalarValues( const RigEclipseResultAddress& resVarAddr auto it = m_connectionResults.find( nameit->second ); if ( it == m_connectionResults.end() ) return false; - auto& srcdata = it->second; + // Connection polygons are used to compute the center for the NNC flow vectors + // If connection polygons are present, this is a no-op + buildPolygonsForEclipseConnections(); + auto& srcdata = it->second; auto& dstdata = makeDynamicConnectionScalarResult( resVarAddr.resultName(), srcdata.size() ); - const double epsilon = 1.0e-3; - + const double epsilon = 1.0e-3; std::vector areas( m_connections.size() ); for ( size_t dataIdx = 0; dataIdx < m_connections.size(); dataIdx++ ) From 55ba4bc80261796c694d9b3347cb366a914e014c Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Wed, 5 Jan 2022 15:52:04 +0100 Subject: [PATCH 056/406] Intersection depthfilter (#8408) * Implement a simple depth filter to cut all geometry below a certain level for intersections * Add option to override all curve intersection cut depths from collection. * Add support for showing intersection above or below threshold. Update label texts. --- ...udedCurveIntersectionGeometryGenerator.cpp | 156 ++++++++++++++++-- .../Intersections/CMakeLists_files.cmake | 2 + .../RimExtrudedCurveIntersection.cpp | 120 +++++++++++++- .../RimExtrudedCurveIntersection.h | 16 ++ .../Intersections/RimIntersection.cpp | 5 + .../RimIntersectionCollection.cpp | 85 ++++++++++ .../Intersections/RimIntersectionCollection.h | 14 ++ .../Intersections/RimIntersectionEnums.cpp | 34 ++++ .../Intersections/RimIntersectionEnums.h | 26 +++ Fwk/VizFwk/LibGeometry/cvfBoundingBox.cpp | 23 +++ Fwk/VizFwk/LibGeometry/cvfBoundingBox.h | 3 + 11 files changed, 463 insertions(+), 21 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.h diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp index 95f8b403a7..74567dbd98 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp @@ -145,7 +145,7 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateLineSegementTransfo //-------------------------------------------------------------------------------------------------- void RivExtrudedCurveIntersectionGeometryGenerator::calculateTransformedPolyline() { - CVF_ASSERT( m_lineSegmentTransforms.size() == m_polylines.size() ); + if ( m_lineSegmentTransforms.size() != m_polylines.size() ) return; for ( size_t lineIdx = 0; lineIdx < m_polylines.size(); ++lineIdx ) { @@ -289,6 +289,30 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays() calculateLineSegementTransforms(); calculateTransformedPolyline(); + const double gridRadius = gridBBox.radius(); + + // set up our horizontal cut planes + const double topDepth = -1.0 * m_intersection->topDepth( gridRadius ); + const double bottomDepth = -1.0 * m_intersection->bottomDepth( gridRadius ); + + std::array corners; + gridBBox.cornerVertices( corners.data() ); + + cvf::Vec3d p1_low( corners[0].x(), corners[0].y(), bottomDepth ); + cvf::Vec3d p2_low( corners[1].x(), corners[1].y(), bottomDepth ); + cvf::Vec3d p3_low( corners[2].x(), corners[2].y(), bottomDepth ); + + cvf::Plane lowPlane; + lowPlane.setFromPoints( p1_low, p2_low, p3_low ); + + cvf::Vec3d p1_high( p1_low.x(), p1_low.y(), topDepth ); + cvf::Vec3d p2_high( p2_low.x(), p2_low.y(), topDepth ); + cvf::Vec3d p3_high( p3_low.x(), p3_low.y(), topDepth ); + + cvf::Plane highPlane; + highPlane.setFromPoints( p1_high, p2_high, p3_high ); + highPlane.flip(); + for ( size_t pLineIdx = 0; pLineIdx < m_polylines.size(); ++pLineIdx ) { const std::vector& polyLine = m_polylines[pLineIdx]; @@ -345,6 +369,9 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays() sectionBBox.add( p2 - maxHeightVec ); } + sectionBBox.cutBelow( bottomDepth ); + sectionBBox.cutAbove( topDepth ); + std::vector columnCellCandidates; m_hexGrid->findIntersectingCells( sectionBBox, &columnCellCandidates ); @@ -410,16 +437,32 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays() } } - std::vector clippedTriangleVxes; - std::vector cellFaceForEachClippedTriangleEdge; + std::vector clippedTriangleVxes_stage1; + std::vector cellFaceForEachClippedTriangleEdge_stage1; caf::HexGridIntersectionTools::clipTrianglesBetweenTwoParallelPlanes( hexPlaneCutTriangleVxes, cellFaceForEachTriangleEdge, p1Plane, p2Plane, + &clippedTriangleVxes_stage1, + &cellFaceForEachClippedTriangleEdge_stage1 ); + + for ( caf::HexGridIntersectionTools::ClipVx& clvx : clippedTriangleVxes_stage1 ) + if ( !clvx.isVxIdsNative ) clvx.derivedVxLevel = 0; + + std::vector clippedTriangleVxes; + std::vector cellFaceForEachClippedTriangleEdge; + + caf::HexGridIntersectionTools::clipTrianglesBetweenTwoParallelPlanes( clippedTriangleVxes_stage1, + cellFaceForEachClippedTriangleEdge_stage1, + lowPlane, + highPlane, &clippedTriangleVxes, &cellFaceForEachClippedTriangleEdge ); + for ( caf::HexGridIntersectionTools::ClipVx& clvx : clippedTriangleVxes ) + if ( !clvx.isVxIdsNative && clvx.derivedVxLevel == -1 ) clvx.derivedVxLevel = 1; + size_t clippedTriangleCount = clippedTriangleVxes.size() / 3; for ( uint tIdx = 0; tIdx < clippedTriangleCount; ++tIdx ) @@ -427,7 +470,6 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays() uint triVxIdx = tIdx * 3; // Accumulate triangle vertices - cvf::Vec3d point0( clippedTriangleVxes[triVxIdx + 0].vx ); cvf::Vec3d point1( clippedTriangleVxes[triVxIdx + 1].vx ); cvf::Vec3d point2( clippedTriangleVxes[triVxIdx + 2].vx ); @@ -441,13 +483,11 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays() triangleVertices.emplace_back( point2 ); // Accumulate mesh lines - meshAcc.accumulateMeshLines( cellFaceForEachClippedTriangleEdge, triVxIdx + 0, globalCellIdx, point0, point1 ); meshAcc.accumulateMeshLines( cellFaceForEachClippedTriangleEdge, triVxIdx + 1, globalCellIdx, point1, point2 ); meshAcc.accumulateMeshLines( cellFaceForEachClippedTriangleEdge, triVxIdx + 2, globalCellIdx, point2, point0 ); // Mapping to cell index - m_triangleToCellIdxMap.push_back( globalCellIdx ); // Interpolation from nodes @@ -462,16 +502,100 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays() } else { - caf::HexGridIntersectionTools::ClipVx cvx1 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx1Id]; - caf::HexGridIntersectionTools::ClipVx cvx2 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx2Id]; - - m_triVxToCellCornerWeights.emplace_back( cvx1.clippedEdgeVx1Id, - cvx1.clippedEdgeVx2Id, - cvx1.normDistFromEdgeVx1, - cvx2.clippedEdgeVx1Id, - cvx2.clippedEdgeVx2Id, - cvx2.normDistFromEdgeVx1, - cvx.normDistFromEdgeVx1 ); + caf::HexGridIntersectionTools::ClipVx cvx1; + caf::HexGridIntersectionTools::ClipVx cvx2; + + if ( cvx.derivedVxLevel == 0 ) + { + cvx1 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx1Id]; + cvx2 = hexPlaneCutTriangleVxes[cvx.clippedEdgeVx2Id]; + } + else if ( cvx.derivedVxLevel == 1 ) + { + cvx1 = clippedTriangleVxes_stage1[cvx.clippedEdgeVx1Id]; + cvx2 = clippedTriangleVxes_stage1[cvx.clippedEdgeVx2Id]; + } + else + { + CVF_ASSERT( false ); + } + + if ( cvx1.isVxIdsNative && cvx2.isVxIdsNative ) + { + m_triVxToCellCornerWeights.emplace_back( cvx1.clippedEdgeVx1Id, + cvx1.clippedEdgeVx2Id, + cvx1.normDistFromEdgeVx1, + cvx2.clippedEdgeVx1Id, + cvx2.clippedEdgeVx2Id, + cvx2.normDistFromEdgeVx1, + cvx.normDistFromEdgeVx1 ); + } + else + { + caf::HexGridIntersectionTools::ClipVx cvx11; + caf::HexGridIntersectionTools::ClipVx cvx12; + caf::HexGridIntersectionTools::ClipVx cvx21; + caf::HexGridIntersectionTools::ClipVx cvx22; + + if ( cvx1.isVxIdsNative ) + { + cvx11 = cvx1; + cvx12 = cvx1; + } + else if ( cvx1.derivedVxLevel == 0 ) + { + cvx11 = hexPlaneCutTriangleVxes[cvx1.clippedEdgeVx1Id]; + cvx12 = hexPlaneCutTriangleVxes[cvx1.clippedEdgeVx2Id]; + } + else if ( cvx2.derivedVxLevel == 1 ) + { + cvx11 = clippedTriangleVxes_stage1[cvx1.clippedEdgeVx1Id]; + cvx12 = clippedTriangleVxes_stage1[cvx1.clippedEdgeVx2Id]; + } + else + { + CVF_ASSERT( false ); + } + + if ( cvx2.isVxIdsNative ) + { + cvx21 = cvx2; + cvx22 = cvx2; + } + else if ( cvx2.derivedVxLevel == 0 ) + { + cvx21 = hexPlaneCutTriangleVxes[cvx2.clippedEdgeVx1Id]; + cvx22 = hexPlaneCutTriangleVxes[cvx2.clippedEdgeVx2Id]; + } + else if ( cvx2.derivedVxLevel == 1 ) + { + cvx21 = clippedTriangleVxes_stage1[cvx2.clippedEdgeVx1Id]; + cvx22 = clippedTriangleVxes_stage1[cvx2.clippedEdgeVx2Id]; + } + else + { + CVF_ASSERT( false ); + } + + CVF_TIGHT_ASSERT( cvx11.isVxIdsNative && cvx12.isVxIdsNative && cvx21.isVxIdsNative && + cvx22.isVxIdsNative ); + + m_triVxToCellCornerWeights.emplace_back( cvx11.clippedEdgeVx1Id, + cvx11.clippedEdgeVx2Id, + cvx11.normDistFromEdgeVx1, + cvx12.clippedEdgeVx1Id, + cvx12.clippedEdgeVx2Id, + cvx2.normDistFromEdgeVx1, + cvx21.clippedEdgeVx1Id, + cvx21.clippedEdgeVx2Id, + cvx21.normDistFromEdgeVx1, + cvx22.clippedEdgeVx1Id, + cvx22.clippedEdgeVx2Id, + cvx22.normDistFromEdgeVx1, + cvx1.normDistFromEdgeVx1, + cvx2.normDistFromEdgeVx1, + cvx.normDistFromEdgeVx1 ); + } } } } diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Intersections/CMakeLists_files.cmake index 51adff8c51..35100c285e 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Intersections/CMakeLists_files.cmake @@ -5,6 +5,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimIntersectionCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultDefinition.h ${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultsDefinitionCollection.h + ${CMAKE_CURRENT_LIST_DIR}/RimIntersectionEnums.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -14,6 +15,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultDefinition.cpp ${CMAKE_CURRENT_LIST_DIR}/RimIntersectionResultsDefinitionCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimBoxIntersection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimIntersectionEnums.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp index 9ca5631d96..4dde235551 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp @@ -22,6 +22,7 @@ #include "RiaVec3Tools.h" #include "RigEclipseCaseData.h" +#include "RigMainGrid.h" #include "RigWellPath.h" #include "Rim2dIntersectionView.h" @@ -46,13 +47,16 @@ #include "RimWellPath.h" #include "RiuViewer.h" + #include "RivExtrudedCurveIntersectionPartMgr.h" #include "cafCmdFeature.h" #include "cafCmdFeatureManager.h" +#include "cafPdmUiCheckBoxEditor.h" #include "cafPdmUiDoubleSliderEditor.h" #include "cafPdmUiListEditor.h" #include "cafPdmUiPushButtonEditor.h" +#include "cafPdmUiSliderEditor.h" #include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeSelectionEditor.h" @@ -240,6 +244,26 @@ RimExtrudedCurveIntersection::RimExtrudedCurveIntersection() m_surfaceIntersections = new RimSurfaceIntersectionCollection; m_surfaceIntersections->objectChanged.connect( this, &RimExtrudedCurveIntersection::onSurfaceIntersectionsChanged ); + CAF_PDM_InitField( &m_depthThreshold, "DepthThreshold", 2000.0, "Threshold" ); + m_depthThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + + CAF_PDM_InitFieldNoDefault( &m_depthDisplayType, "DepthDisplayType", "Intersection Display Type" ); + + CAF_PDM_InitFieldNoDefault( &m_collectionDepthThreshold, "CollectionDepthThreshold", "Collection Threshold" ); + m_collectionDepthThreshold.uiCapability()->setUiHidden( true ); + + CAF_PDM_InitField( &m_depthThresholdOverridden, + "ThresholdOverridden", + false, + "Depth Threshold is Controlled by Intersection Collection" ); + m_depthThresholdOverridden.uiCapability()->setUiReadOnly( true ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_depthThresholdOverridden ); + + CAF_PDM_InitFieldNoDefault( &m_collectionDepthDisplayType, + "CollectionDepthDisplayType", + "Collection Controlled Display Type" ); + m_collectionDepthDisplayType.uiCapability()->setUiHidden( true ); + setDeletable( true ); } @@ -274,6 +298,56 @@ void RimExtrudedCurveIntersection::setName( const QString& newName ) m_name = newName; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimExtrudedCurveIntersection::topDepth( double sceneRadius ) const +{ + if ( m_depthThresholdOverridden ) + { + if ( m_collectionDepthDisplayType == RimIntersectionDepthCutEnum::INTERSECT_SHOW_BELOW ) + return m_collectionDepthThreshold; + return -sceneRadius; + } + + if ( m_depthDisplayType == RimIntersectionDepthCutEnum::INTERSECT_SHOW_BELOW ) + { + return m_depthThreshold; + } + return -sceneRadius; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimExtrudedCurveIntersection::bottomDepth( double sceneRadius ) const +{ + if ( m_depthThresholdOverridden ) + { + if ( m_collectionDepthDisplayType == RimIntersectionDepthCutEnum::INTERSECT_SHOW_ABOVE ) + return m_collectionDepthThreshold; + return sceneRadius; + } + + if ( m_depthDisplayType == RimIntersectionDepthCutEnum::INTERSECT_SHOW_ABOVE ) + { + return m_depthThreshold; + } + return sceneRadius; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimExtrudedCurveIntersection::setDepthOverride( bool collectionOverride, + double depthThreshold, + RimIntersectionDepthCutEnum displayType ) +{ + m_depthThresholdOverridden = collectionOverride; + m_collectionDepthThreshold = depthThreshold; + m_collectionDepthDisplayType = displayType; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -285,7 +359,7 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle* changedField == &m_wellPath || changedField == &m_simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength || changedField == &m_lengthUp || changedField == &m_lengthDown || changedField == &m_showInactiveCells || changedField == &m_useSeparateDataSource || - changedField == &m_separateDataSource ) + changedField == &m_separateDataSource || changedField == &m_depthThreshold || changedField == &m_depthDisplayType ) { rebuildGeometryAndScheduleCreateDisplayModel(); } @@ -421,6 +495,21 @@ void RimExtrudedCurveIntersection::defineUiOrdering( QString uiConfigName, caf:: m_extentLength.uiCapability()->setUiReadOnly( false ); } + if ( eclipseView() ) + { + if ( m_depthThresholdOverridden() ) + { + optionsGroup->add( &m_depthThresholdOverridden ); + } + else + { + optionsGroup->add( &m_depthDisplayType ); + optionsGroup->add( &m_depthThreshold ); + m_depthThreshold.uiCapability()->setUiReadOnly( m_depthDisplayType() == + RimIntersectionDepthCutEnum ::INTERSECT_SHOW_ALL ); + } + } + this->defineSeparateDataSourceUi( uiConfigName, uiOrdering ); uiOrdering.skipRemainingFields( true ); @@ -506,12 +595,11 @@ void RimExtrudedCurveIntersection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& //-------------------------------------------------------------------------------------------------- RimSimWellInViewCollection* RimExtrudedCurveIntersection::simulationWellCollection() const { - RimEclipseView* eclipseView = nullptr; - firstAncestorOrThisOfType( eclipseView ); + RimEclipseView* eclView = eclipseView(); - if ( eclipseView ) + if ( eclView ) { - return eclipseView->wellCollection(); + return eclView->wellCollection(); } return nullptr; @@ -833,6 +921,18 @@ void RimExtrudedCurveIntersection::defineEditorAttribute( const caf::PdmFieldHan doubleSliderAttrib->m_maximum = 180; doubleSliderAttrib->m_sliderTickCount = 180; } + else if ( field == &m_depthThreshold ) + { + RimEclipseView* eclView = eclipseView(); + + if ( eclView ) + { + const cvf::BoundingBox bb = eclView->mainGrid()->boundingBox(); + + doubleSliderAttrib->m_minimum = -1.0 * bb.max().z(); + doubleSliderAttrib->m_maximum = -1.0 * bb.min().z(); + } + } } else if ( field == &m_inputPolylineFromViewerEnabled ) { @@ -1149,3 +1249,13 @@ void RimExtrudedCurveIntersection::setPointsFromXYD( const std::vector pointsXYD() const; void setPointsFromXYD( const std::vector& pointsXYD ); + RimEclipseView* eclipseView() const; + private: caf::PdmField m_name; + caf::PdmField> m_depthDisplayType; + caf::PdmField m_depthThreshold; + + caf::PdmField m_depthThresholdOverridden; + caf::PdmField m_collectionDepthThreshold; + caf::PdmField> m_collectionDepthDisplayType; + caf::PdmField> m_type; caf::PdmField> m_direction; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp index 7fe0da1f15..099ec20ab7 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp @@ -33,6 +33,8 @@ #include "RivEclipseIntersectionGrid.h" #include "RivFemIntersectionGrid.h" +#include "cafPdmUiCheckBoxEditor.h" + CAF_PDM_ABSTRACT_SOURCE_INIT( RimIntersection, "RimIntersectionHandle" ); //-------------------------------------------------------------------------------------------------- @@ -42,7 +44,10 @@ RimIntersection::RimIntersection() { CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); + CAF_PDM_InitField( &m_showInactiveCells, "ShowInactiveCells", false, "Show Inactive Cells" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showInactiveCells ); + CAF_PDM_InitField( &m_useSeparateDataSource, "UseSeparateIntersectionDataSource", true, "Enable" ); CAF_PDM_InitFieldNoDefault( &m_separateDataSource, "SeparateIntersectionDataSource", "Source" ); } diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp index d81a1fe9f7..3efe1dc6ee 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp @@ -19,11 +19,14 @@ #include "RimIntersectionCollection.h" +#include "RigMainGrid.h" + #include "Rim2dIntersectionView.h" #include "Rim2dIntersectionViewCollection.h" #include "Rim3dView.h" #include "RimBoxIntersection.h" #include "RimCase.h" +#include "RimEclipseView.h" #include "RimExtrudedCurveIntersection.h" #include "RimGridView.h" #include "RimIntersectionResultDefinition.h" @@ -35,6 +38,8 @@ #include "RivBoxIntersectionPartMgr.h" #include "RivExtrudedCurveIntersectionPartMgr.h" +#include "cafPdmUiCheckBoxEditor.h" +#include "cafPdmUiDoubleSliderEditor.h" #include "cafPdmUiTreeOrdering.h" #include "cvfModelBasicList.h" @@ -55,6 +60,14 @@ RimIntersectionCollection::RimIntersectionCollection() CAF_PDM_InitField( &isActive, "Active", true, "Active" ); isActive.uiCapability()->setUiHidden( true ); + + CAF_PDM_InitFieldNoDefault( &m_collectionDepthThreshold, "CollectionDepthThreshold", "Threshold" ); + m_collectionDepthThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + + CAF_PDM_InitField( &m_depthThresholdOverridden, "ThresholdOverridden", false, "Override Intersection Display Settings" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_depthThresholdOverridden ); + + CAF_PDM_InitFieldNoDefault( &m_collectionDepthDisplayType, "CollectionDepthDisplayType", "Intersection Display Type" ); } //-------------------------------------------------------------------------------------------------- @@ -267,6 +280,8 @@ void RimIntersectionCollection::appendIntersectionAndUpdate( RimExtrudedCurveInt { m_intersections.push_back( intersection ); + intersection->setDepthOverride( m_depthThresholdOverridden, m_collectionDepthThreshold, m_collectionDepthDisplayType() ); + syncronize2dIntersectionViews(); updateConnectedEditors(); @@ -285,6 +300,7 @@ void RimIntersectionCollection::appendIntersectionAndUpdate( RimExtrudedCurveInt //-------------------------------------------------------------------------------------------------- void RimIntersectionCollection::appendIntersectionNoUpdate( RimExtrudedCurveIntersection* intersection ) { + intersection->setDepthOverride( m_depthThresholdOverridden, m_collectionDepthThreshold, m_collectionDepthDisplayType() ); m_intersections.push_back( intersection ); } @@ -349,6 +365,21 @@ void RimIntersectionCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha { updateUiIconFromToggleField(); + Rim3dView* rimView = nullptr; + firstAncestorOrThisOfType( rimView ); + if ( rimView ) + { + rimView->scheduleCreateDisplayModelAndRedraw(); + } + } + if ( ( changedField == &m_collectionDepthThreshold ) || ( changedField == &m_depthThresholdOverridden ) || + ( changedField == &m_collectionDepthDisplayType ) ) + { + for ( RimExtrudedCurveIntersection* cs : m_intersections ) + { + cs->setDepthOverride( m_depthThresholdOverridden, m_collectionDepthThreshold, m_collectionDepthDisplayType() ); + } + Rim3dView* rimView = nullptr; firstAncestorOrThisOfType( rimView ); if ( rimView ) @@ -403,3 +434,57 @@ void RimIntersectionCollection::updateIntersectionBoxGeometry() intersectionBox->updateBoxManipulatorGeometry(); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIntersectionCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + if ( eclipseView() ) + { + caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup( "Curve Intersections" ); + + optionsGroup->add( &m_depthThresholdOverridden ); + optionsGroup->add( &m_collectionDepthDisplayType ); + optionsGroup->add( &m_collectionDepthThreshold ); + m_collectionDepthDisplayType.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() ); + m_collectionDepthThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() ); + } + + uiOrdering.skipRemainingFields( true ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIntersectionCollection::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + auto* doubleSliderAttrib = dynamic_cast( attribute ); + if ( doubleSliderAttrib ) + { + if ( field == &m_collectionDepthThreshold ) + { + RimEclipseView* eclView = eclipseView(); + + if ( eclView ) + { + const cvf::BoundingBox bb = eclView->mainGrid()->boundingBox(); + + doubleSliderAttrib->m_minimum = -1.0 * bb.max().z(); + doubleSliderAttrib->m_maximum = -1.0 * bb.min().z(); + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseView* RimIntersectionCollection::eclipseView() const +{ + RimEclipseView* eclipseView = nullptr; + firstAncestorOrThisOfType( eclipseView ); + return eclipseView; +} diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h index 7aa4e5f53e..5aea710d5c 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h @@ -23,7 +23,10 @@ #include "cafPdmField.h" #include "cafPdmObject.h" +#include "RimIntersectionEnums.h" + class Rim3dView; +class RimEclipseView; class RimExtrudedCurveIntersection; class RimBoxIntersection; class RimEclipseCellColors; @@ -83,9 +86,20 @@ class RimIntersectionCollection : public caf::PdmObject protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; caf::PdmFieldHandle* objectToggleField() override; + void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; private: + RimEclipseView* eclipseView() const; + caf::PdmChildArrayField m_intersections; caf::PdmChildArrayField m_intersectionBoxes; + + caf::PdmField m_depthThresholdOverridden; + caf::PdmField m_collectionDepthThreshold; + caf::PdmField> m_collectionDepthDisplayType; }; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.cpp new file mode 100644 index 0000000000..f69d7cccbc --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.cpp @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimIntersectionEnums.h" + +#include "cafAppEnum.h" + +namespace caf +{ +template <> +void caf::AppEnum::setUp() +{ + addItem( RimIntersectionDepthCutEnum::INTERSECT_SHOW_ALL, "INTERSECT_SHOW_ALL", "Show All" ); + addItem( RimIntersectionDepthCutEnum::INTERSECT_SHOW_ABOVE, "INTERSECT_SHOW_ABOVE", "Show Above Threshold" ); + addItem( RimIntersectionDepthCutEnum::INTERSECT_SHOW_BELOW, "INTERSECT_SHOW_BELOW", "Show Below Threshold" ); + setDefault( RimIntersectionDepthCutEnum::INTERSECT_SHOW_ALL ); +} + +} // namespace caf diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.h new file mode 100644 index 0000000000..40dea9f248 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.h @@ -0,0 +1,26 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +enum class RimIntersectionDepthCutEnum +{ + INTERSECT_SHOW_ALL, + INTERSECT_SHOW_BELOW, + INTERSECT_SHOW_ABOVE +}; diff --git a/Fwk/VizFwk/LibGeometry/cvfBoundingBox.cpp b/Fwk/VizFwk/LibGeometry/cvfBoundingBox.cpp index ffb61848f8..486a125401 100644 --- a/Fwk/VizFwk/LibGeometry/cvfBoundingBox.cpp +++ b/Fwk/VizFwk/LibGeometry/cvfBoundingBox.cpp @@ -428,6 +428,29 @@ String BoundingBox::debugString() const return str; } +//-------------------------------------------------------------------------------------------------- +/// Cuts the box at the given depth, to never go below the given depth +/// +/// Note: cutting is a one time operation, adding new points to the box might extend the box below the cut depth +//-------------------------------------------------------------------------------------------------- +void BoundingBox::cutBelow(double depth) +{ + if (m_min.z() < depth) m_min.z() = depth; + if (m_max.z() < depth) m_max.z() = depth; +} + +//-------------------------------------------------------------------------------------------------- +/// Cuts the box at the given depth, to never go above the given depth +/// +/// Note: cutting is a one time operation, adding new points to the box might extend the box below the cut depth +//-------------------------------------------------------------------------------------------------- +void BoundingBox::cutAbove(double depth) +{ + if (m_min.z() > depth) m_min.z() = depth; + if (m_max.z() > depth) m_max.z() = depth; +} + + } // namespace cvf diff --git a/Fwk/VizFwk/LibGeometry/cvfBoundingBox.h b/Fwk/VizFwk/LibGeometry/cvfBoundingBox.h index d007379c2e..f2b02cda05 100644 --- a/Fwk/VizFwk/LibGeometry/cvfBoundingBox.h +++ b/Fwk/VizFwk/LibGeometry/cvfBoundingBox.h @@ -86,6 +86,9 @@ class BoundingBox void transform(const Mat4d& matrix); const BoundingBox getTransformed(const Mat4d& matrix) const; + void cutBelow(double depth); + void cutAbove(double depth); + String debugString() const; private: From bca2fadc28a5d8c7cdf43c4d0e010dcee061b6f9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 5 Jan 2022 15:58:41 +0100 Subject: [PATCH 057/406] Janitor: Make sure NNC connections are computed before visibility is evaluated --- .../ModelVisualization/RivFaultGeometryGenerator.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp index b0de47368d..ef31cab7d4 100644 --- a/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/RivFaultGeometryGenerator.cpp @@ -155,6 +155,12 @@ void RivFaultGeometryGenerator::computeArrays( bool onlyShowFacesWithDefinedNeig cvf::Vec3d offset = m_grid->displayModelOffset(); + if ( onlyShowFacesWithDefinedNeighbors ) + { + // Make sure the connection polygon is computed, as this is used as criteria for visibility + m_nncData->ensureAllConnectionDataIsProcessed(); + } + auto connIndices = m_fault->connectionIndices(); auto& connections = m_nncData->availableConnections(); From 9023b01cfa0bf66595a550e5d19965dc92ccb563 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 29 Dec 2021 09:31:51 +0100 Subject: [PATCH 058/406] Janitor: Guard null pointer access --- .../UserInterface/RiuMainWindowBase.cpp | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 0b768e1fcd..ed7e4aad1b 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -318,22 +318,26 @@ void RiuMainWindowBase::removeViewerFromMdiArea( QMdiArea* mdiArea, QWidget* vie { bool wasMaximized = viewer && viewer->isMaximized(); - QMdiSubWindow* subWindowBeingClosed = findMdiSubWindow( viewer ); - bool removedSubWindowWasActive = false; - if ( subWindowBeingClosed->isActiveWindow() ) + bool removedSubWindowWasActive = false; + + QMdiSubWindow* subWindowBeingClosed = findMdiSubWindow( viewer ); + if ( subWindowBeingClosed ) { - // If we are removing the active window, we will need a new active window - // Start by making the window inactive so Qt doesn't pick the active window itself - mdiArea->setActiveSubWindow( nullptr ); - removedSubWindowWasActive = true; - } - mdiArea->removeSubWindow( subWindowBeingClosed ); + if ( subWindowBeingClosed->isActiveWindow() ) + { + // If we are removing the active window, we will need a new active window + // Start by making the window inactive so Qt doesn't pick the active window itself + mdiArea->setActiveSubWindow( nullptr ); + removedSubWindowWasActive = true; + } + mdiArea->removeSubWindow( subWindowBeingClosed ); - // These two lines had to be introduced after themes was used - // Probably related to polish/unpolish of widgets in an MDI setting - // https://github.com/OPM/ResInsight/issues/6676 - subWindowBeingClosed->hide(); - subWindowBeingClosed->deleteLater(); + // These two lines had to be introduced after themes was used + // Probably related to polish/unpolish of widgets in an MDI setting + // https://github.com/OPM/ResInsight/issues/6676 + subWindowBeingClosed->hide(); + subWindowBeingClosed->deleteLater(); + } QList subWindowList = mdiArea->subWindowList( QMdiArea::ActivationHistoryOrder ); if ( !subWindowList.empty() ) From db8209d23a466f95059a0abff90bd2290a789e24 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 29 Dec 2021 14:02:57 +0100 Subject: [PATCH 059/406] Janitor : Trim unit text for summary vectors --- .../FileInterface/RifOpmCommonSummary.cpp | 13 +++++++------ .../FileInterface/RifOpmHdf5Summary.cpp | 4 +++- .../FileInterface/RifReaderEclipseSummary.cpp | 14 +++++++++++++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp b/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp index e58a1495fb..4fb65e6061 100644 --- a/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp +++ b/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp @@ -19,6 +19,7 @@ #include "RifOpmCommonSummary.h" #include "RiaLogging.h" +#include "RiaStdStringTools.h" #include "opm/io/eclipse/ESmry.hpp" #include "opm/io/eclipse/ExtESmry.hpp" @@ -156,22 +157,22 @@ bool RifOpmCommonEclipseSummary::values( const RifEclipseSummaryAddress& resultA //-------------------------------------------------------------------------------------------------- std::string RifOpmCommonEclipseSummary::unitName( const RifEclipseSummaryAddress& resultAddress ) const { - auto it = m_summaryAddressToKeywordMap.find( resultAddress ); + std::string nameString; + auto it = m_summaryAddressToKeywordMap.find( resultAddress ); if ( it != m_summaryAddressToKeywordMap.end() ) { auto keyword = it->second; if ( m_enhancedReader ) { - return m_enhancedReader->get_unit( keyword ); + nameString = m_enhancedReader->get_unit( keyword ); } - - if ( m_standardReader ) + else if ( m_standardReader ) { - return m_standardReader->get_unit( keyword ); + nameString = m_standardReader->get_unit( keyword ); } } - return {}; + return RiaStdStringTools::trimString( nameString ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp b/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp index 369e02c351..675732ba6f 100644 --- a/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp +++ b/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp @@ -19,6 +19,7 @@ #include "RifOpmHdf5Summary.h" #include "RiaLogging.h" +#include "RiaStdStringTools.h" #include "RifHdf5SummaryReader.h" #include "RifOpmCommonSummary.h" @@ -127,7 +128,8 @@ std::string RifOpmHdf5Summary::unitName( const RifEclipseSummaryAddress& resultA if ( m_eSmry->hasKey( node.keyword ) ) { - return m_eSmry->get_unit( node ); + auto stringFromFileReader = m_eSmry->get_unit( node ); + return RiaStdStringTools::trimString( stringFromFileReader ); } } } diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp index d27eaf034c..f6029a96de 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp @@ -302,8 +302,20 @@ RifSummaryReaderInterface* RifReaderEclipseSummary::currentSummaryReader() const std::string RifReaderEclipseSummary::unitName( const RifEclipseSummaryAddress& resultAddress ) const { auto reader = currentSummaryReader(); + if ( reader ) + { + auto nativeName = resultAddress.quantityName(); + auto stringToRemove = RifReaderEclipseSummary::differenceIdentifier(); + if ( RiaStdStringTools::endsWith( nativeName, stringToRemove ) ) + { + nativeName = nativeName.substr( 0, nativeName.size() - stringToRemove.size() ); + } + + RifEclipseSummaryAddress adr( resultAddress ); + adr.setQuantityName( nativeName ); - if ( reader ) return reader->unitName( resultAddress ); + return reader->unitName( adr ); + } return ""; } From 442abfea0503ad3fd4ab657b61a9e26e0e910978 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 29 Dec 2021 14:33:37 +0100 Subject: [PATCH 060/406] Janitor : Guard empty string --- ApplicationLibCode/Application/Tools/RiaStdStringTools.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ApplicationLibCode/Application/Tools/RiaStdStringTools.cpp b/ApplicationLibCode/Application/Tools/RiaStdStringTools.cpp index 3a51395503..ba9e0473d1 100644 --- a/ApplicationLibCode/Application/Tools/RiaStdStringTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaStdStringTools.cpp @@ -28,6 +28,8 @@ //-------------------------------------------------------------------------------------------------- std::string RiaStdStringTools::trimString( const std::string& s ) { + if ( s.empty() ) return s; + auto sCopy = s.substr( 0, s.find_last_not_of( ' ' ) + 1 ); sCopy = sCopy.substr( sCopy.find_first_not_of( ' ' ) ); From 60873e54f45d6f4fdcf2b32283e095876646e850 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 29 Dec 2021 14:37:06 +0100 Subject: [PATCH 061/406] Janitor: Always report unit for summary vectors --- ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp | 7 ++----- ApplicationLibCode/FileInterface/RifOpmHdf5Summary.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp b/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp index 675732ba6f..5c9dd1b905 100644 --- a/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp +++ b/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp @@ -126,11 +126,8 @@ std::string RifOpmHdf5Summary::unitName( const RifEclipseSummaryAddress& resultA auto index = it->second; auto node = m_eSmry->summaryNodeList()[index]; - if ( m_eSmry->hasKey( node.keyword ) ) - { - auto stringFromFileReader = m_eSmry->get_unit( node ); - return RiaStdStringTools::trimString( stringFromFileReader ); - } + auto stringFromFileReader = m_eSmry->get_unit( node ); + return RiaStdStringTools::trimString( stringFromFileReader ); } } diff --git a/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.h b/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.h index 366eb78e8a..0e819d0756 100644 --- a/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.h +++ b/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.h @@ -67,7 +67,6 @@ class RifOpmHdf5Summary : public RifSummaryReaderInterface private: std::unique_ptr m_eSmry; - std::vector m_eSmryKeywords; std::map m_adrToSummaryNodeIndex; std::vector m_timeSteps; From 0fbd668569b5e2f8427739dc9f74db8973f06a2d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 29 Dec 2021 15:02:03 +0100 Subject: [PATCH 062/406] #8397 Summary Curve : Add long vector name to auto name for curves --- .../Summary/RimSummaryCurveAutoName.cpp | 38 +++++++++++++------ .../Summary/RimSummaryCurveAutoName.h | 1 + 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp index ac6459e6df..56d5d5f6ee 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp @@ -31,6 +31,8 @@ #include "SummaryPlotCommands/RicSummaryPlotEditorUi.h" +#include "RiuSummaryQuantityNameInfoProvider.h" + #include "cafPdmUiPushButtonEditor.h" CAF_PDM_SOURCE_INIT( RimSummaryCurveAutoName, "SummaryCurveAutoName" ); @@ -43,17 +45,18 @@ RimSummaryCurveAutoName::RimSummaryCurveAutoName() // clang-format off CAF_PDM_InitObject("RimSummaryCurveAutoName", "", "", ""); - CAF_PDM_InitField(&m_vectorName, "VectorName", true, "Vector Name", "", "", ""); - CAF_PDM_InitField(&m_unit, "Unit", false,"Unit", "", "", ""); - CAF_PDM_InitField(&m_regionNumber, "RegionNumber", true, "Region Number", "", "", ""); - CAF_PDM_InitField(&m_wellGroupName, "WellGroupName", true, "Group Name", "", "", ""); - CAF_PDM_InitField(&m_wellName, "WellName", true, "Well Name", "", "", ""); - CAF_PDM_InitField(&m_wellSegmentNumber, "WellSegmentNumber", true, "Well Segment Number", "", "", ""); - CAF_PDM_InitField(&m_lgrName, "LgrName", true, "Lgr Name", "", "", ""); - CAF_PDM_InitField(&m_completion, "Completion", true, "I, J, K", "", "", ""); - CAF_PDM_InitField(&m_aquiferNumber, "Aquifer", true, "Aquifer Number", "", "", ""); + CAF_PDM_InitField(&m_longVectorName, "LongVectorName", false, "Long Vector Name", "", "", ""); + CAF_PDM_InitField(&m_vectorName, "VectorName", true, "Vector Name", "", "", ""); + CAF_PDM_InitField(&m_unit, "Unit", false, "Unit", "", "", ""); + CAF_PDM_InitField(&m_regionNumber, "RegionNumber", true, "Region Number", "", "", ""); + CAF_PDM_InitField(&m_wellGroupName, "WellGroupName", true, "Group Name", "", "", ""); + CAF_PDM_InitField(&m_wellName, "WellName", true, "Well Name", "", "", ""); + CAF_PDM_InitField(&m_wellSegmentNumber, "WellSegmentNumber", true, "Well Segment Number", "", "", ""); + CAF_PDM_InitField(&m_lgrName, "LgrName", true, "Lgr Name", "", "", ""); + CAF_PDM_InitField(&m_completion, "Completion", true, "I, J, K", "", "", ""); + CAF_PDM_InitField(&m_aquiferNumber, "Aquifer", true, "Aquifer Number", "", "", ""); - CAF_PDM_InitField(&m_caseName, "CaseName", true, "Case/Ensemble Name", "", "", ""); + CAF_PDM_InitField(&m_caseName, "CaseName", true, "Case/Ensemble Name", "", "", ""); // clang-format on } @@ -135,6 +138,7 @@ void RimSummaryCurveAutoName::applySettings( const RimSummaryCurveAutoName& othe { m_caseName = other.m_caseName; m_vectorName = other.m_vectorName; + m_longVectorName = other.m_longVectorName; m_unit = other.m_unit; m_regionNumber = other.m_regionNumber; m_wellGroupName = other.m_wellGroupName; @@ -189,7 +193,18 @@ QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress& bool skipSubString = nameHelper && nameHelper->isPlotDisplayingSingleQuantity(); if ( !skipSubString ) { - text = summaryAddress.quantityName(); + if ( m_longVectorName() ) + { + auto quantityName = summaryAddress.quantityName(); + if ( summaryAddress.isHistoryQuantity() ) + quantityName = quantityName.substr( 0, quantityName.size() - 1 ); + + text = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( quantityName ); + } + else + { + text = summaryAddress.quantityName(); + } } if ( summaryAddress.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS ) @@ -424,6 +439,7 @@ void RimSummaryCurveAutoName::defineUiOrdering( QString uiConfigName, caf::PdmUi { uiOrdering.add( &m_caseName ); uiOrdering.add( &m_vectorName ); + uiOrdering.add( &m_longVectorName ); uiOrdering.add( &m_wellGroupName ); uiOrdering.add( &m_wellName ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h index d776db64cb..a84f026e17 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h @@ -57,6 +57,7 @@ class RimSummaryCurveAutoName : public caf::PdmObject private: caf::PdmField m_vectorName; + caf::PdmField m_longVectorName; caf::PdmField m_unit; caf::PdmField m_regionNumber; caf::PdmField m_wellGroupName; From 7db24e9353f7e47bee4ae788fe07e153e9615007 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 6 Jan 2022 15:18:09 +0100 Subject: [PATCH 063/406] #8405 Source Stepping on multiple graphs - add copy paste of plots into multi summary plot - improve data source stepping for multi plot - improve auto generated plot name, graph name and curve name Fixes by clang-format Improve readability --- .../RicSummaryPlotBuilder.cpp | 29 +- .../RicSummaryPlotBuilder.h | 1 + .../RicPasteSummaryPlotFeature.cpp | 22 +- .../RimDataSourceSteppingTools.cpp | 139 ++++++++ .../RimDataSourceSteppingTools.h | 15 +- .../Summary/CMakeLists_files.cmake | 6 + .../Summary/RimEnsembleCurveSetCollection.cpp | 5 +- .../RimMultipleSummaryPlotNameHelper.cpp | 237 +++++++++++++ .../RimMultipleSummaryPlotNameHelper.h | 54 +++ .../Summary/RimSummaryCrossPlot.cpp | 2 +- .../Summary/RimSummaryCurve.cpp | 30 +- .../Summary/RimSummaryCurveAutoName.cpp | 38 +- .../Summary/RimSummaryCurveAutoName.h | 12 +- .../Summary/RimSummaryCurveCollection.cpp | 53 +-- .../Summary/RimSummaryCurveCollection.h | 6 +- .../Summary/RimSummaryDataSourceStepping.cpp | 19 + .../Summary/RimSummaryDataSourceStepping.h | 41 +++ .../Summary/RimSummaryMultiPlot.cpp | 195 ++++++++++- .../Summary/RimSummaryMultiPlot.h | 24 +- .../Summary/RimSummaryNameHelper.cpp | 95 +++++ .../Summary/RimSummaryNameHelper.h | 58 ++++ .../Summary/RimSummaryPlot.cpp | 77 ++++- .../ProjectDataModel/Summary/RimSummaryPlot.h | 21 +- .../Summary/RimSummaryPlotAxisFormatter.cpp | 19 +- .../Summary/RimSummaryPlotManager.cpp | 17 + .../Summary/RimSummaryPlotNameHelper.cpp | 122 ++++--- .../Summary/RimSummaryPlotNameHelper.h | 35 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 325 ++++++------------ .../Summary/RimSummaryPlotSourceStepping.h | 34 +- 29 files changed, 1270 insertions(+), 461 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.h create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index dd40aea3bc..c60afe5b67 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -230,23 +230,34 @@ RimMultiPlot* RicSummaryPlotBuilder::createAndAppendMultiPlot( const std::vector plotWindow->setAsPlotMdiWindow(); plotCollection->addMultiPlot( plotWindow ); + appendPlotsToMultiPlot( plotWindow, plots ); + + plotCollection->updateAllRequiredEditors(); + plotWindow->loadDataAndUpdate(); + + RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); + + return plotWindow; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotBuilder::appendPlotsToMultiPlot( RimMultiPlot* multiPlot, const std::vector& plots ) +{ for ( auto plot : plots ) { - plotWindow->addPlot( plot ); + // Remove the currently window controller, as this will be managed by the multi plot + // This must be done before adding the plot to the multi plot to ensure that the viewer widget is recreated + plot->revokeMdiWindowStatus(); + + multiPlot->addPlot( plot ); plot->resolveReferencesRecursively(); - plot->revokeMdiWindowStatus(); plot->setShowWindow( true ); plot->loadDataAndUpdate(); } - - plotCollection->updateAllRequiredEditors(); - plotWindow->loadDataAndUpdate(); - - RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); - - return plotWindow; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h index 530e0f7ae8..70b5de6c17 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h @@ -61,6 +61,7 @@ class RicSummaryPlotBuilder static std::vector duplicatePlots( const std::vector& plots ); static RimMultiPlot* createAndAppendMultiPlot( const std::vector& plots ); + static void appendPlotsToMultiPlot( RimMultiPlot* multiPlot, const std::vector& plots ); static RimSummaryPlot* createPlot( const std::set& addresses, const std::vector& summaryCases, diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp index fac6d8be81..887795911c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp @@ -19,10 +19,14 @@ #include "RicPasteSummaryPlotFeature.h" #include "OperationsUsingObjReferences/RicPasteFeatureImpl.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" +#include "RimMultiPlot.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" +#include "RiuPlotMainWindowTools.h" + #include "cafPdmDefaultObjectFactory.h" #include "cafPdmDocument.h" #include "cafPdmObjectGroup.h" @@ -39,8 +43,21 @@ CAF_CMD_SOURCE_INIT( RicPasteSummaryPlotFeature, "RicPasteSummaryPlotFeature" ); //-------------------------------------------------------------------------------------------------- void RicPasteSummaryPlotFeature::copyPlotAndAddToCollection( RimSummaryPlot* sourcePlot ) { - RimSummaryPlotCollection* plotColl = caf::firstAncestorOfTypeFromSelectedObject(); + auto multiPlot = caf::firstAncestorOfTypeFromSelectedObject(); + if ( multiPlot ) + { + auto plots = RicSummaryPlotBuilder::duplicatePlots( { sourcePlot } ); + RicSummaryPlotBuilder::appendPlotsToMultiPlot( multiPlot, plots ); + + multiPlot->loadDataAndUpdate(); + + // No main window has focus after paste operation, set focus to main plot window + RiuPlotMainWindowTools::showPlotMainWindow(); + return; + } + + RimSummaryPlotCollection* plotColl = caf::firstAncestorOfTypeFromSelectedObject(); if ( plotColl ) { RimSummaryPlot* newSummaryPlot = dynamic_cast( @@ -72,6 +89,9 @@ bool RicPasteSummaryPlotFeature::isCommandEnabled() if ( !destinationObject ) return false; + auto multiPlot = caf::firstAncestorOfTypeFromSelectedObject(); + if ( multiPlot ) return true; + RimSummaryPlotCollection* plotColl = nullptr; destinationObject->firstAncestorOrThisOfType( plotColl ); if ( !plotColl ) diff --git a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp index 8289703d9a..d2d6a9b511 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp @@ -1,5 +1,27 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2016 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + #include "RimDataSourceSteppingTools.h" +#include "RiaSummaryCurveAnalyzer.h" + +#include "cafPdmUiFieldHandle.h" + #include "cvfAssert.h" //-------------------------------------------------------------------------------------------------- @@ -47,3 +69,120 @@ void RimDataSourceSteppingTools::modifyCurrentIndex( caf::PdmValueField* } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimDataSourceSteppingTools::updateAddressIfMatching( const QVariant& oldValue, + const QVariant& newValue, + RifEclipseSummaryAddress::SummaryVarCategory category, + RifEclipseSummaryAddress* adr ) +{ + if ( !adr ) return false; + + if ( category == RifEclipseSummaryAddress::SUMMARY_REGION ) + { + int oldInt = oldValue.toInt(); + int newInt = newValue.toInt(); + + if ( adr->regionNumber() == oldInt ) + { + adr->setRegion( newInt ); + + return true; + } + } + else if ( category == RifEclipseSummaryAddress::SUMMARY_AQUIFER ) + { + int oldInt = oldValue.toInt(); + int newInt = newValue.toInt(); + + if ( adr->aquiferNumber() == oldInt ) + { + adr->setAquiferNumber( newInt ); + + return true; + } + } + else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ) + { + std::string oldString = oldValue.toString().toStdString(); + std::string newString = newValue.toString().toStdString(); + + if ( adr->wellGroupName() == oldString ) + { + adr->setWellGroupName( newString ); + + return true; + } + } + else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL ) + { + std::string oldString = oldValue.toString().toStdString(); + std::string newString = newValue.toString().toStdString(); + + if ( adr->wellName() == oldString ) + { + adr->setWellName( newString ); + + return true; + } + } + else if ( category == RifEclipseSummaryAddress::SUMMARY_BLOCK || + category == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION ) + { + std::string oldString = oldValue.toString().toStdString(); + std::string newString = newValue.toString().toStdString(); + if ( adr->blockAsString() == oldString ) + { + adr->setCellIjk( newString ); + + return true; + } + } + else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT ) + { + int oldInt = oldValue.toInt(); + int newInt = newValue.toInt(); + if ( adr->wellSegmentNumber() == oldInt ) + { + adr->setWellSegmentNumber( newInt ); + + return true; + } + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( const QVariant& oldValue, + const QVariant& newValue, + RifEclipseSummaryAddress* adr ) +{ + if ( !adr ) return false; + + std::string oldString = oldValue.toString().toStdString(); + std::string newString = newValue.toString().toStdString(); + + if ( adr->quantityName() == oldString ) + { + adr->setQuantityName( newString ); + + return true; + } + + std::string correspondingOldString = RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( oldString ); + std::string correspondingNewString = RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( newString ); + + if ( adr->quantityName() == correspondingOldString ) + { + adr->setQuantityName( correspondingNewString ); + + return true; + } + + return false; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h index 8a3fbf01ff..be18ab2ca9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h +++ b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h @@ -18,8 +18,10 @@ #pragma once -#include "cafPdmField.h" -#include "cafPdmObject.h" +#include "RifEclipseSummaryAddress.h" + +#include "cafPdmUiItem.h" +#include "cafPdmValueField.h" //================================================================================================== /// @@ -30,4 +32,13 @@ class RimDataSourceSteppingTools static void modifyCurrentIndex( caf::PdmValueField* valueField, const QList& options, int indexOffset ); + + static bool updateAddressIfMatching( const QVariant& oldValue, + const QVariant& newValue, + RifEclipseSummaryAddress::SummaryVarCategory category, + RifEclipseSummaryAddress* adr ); + + static bool updateHistoryAndSummaryQuantityIfMatching( const QVariant& oldValue, + const QVariant& newValue, + RifEclipseSummaryAddress* adr ); }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake index 89e789dd58..c5b3d836f9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -38,6 +38,9 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunctionTools.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotManager.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlot.h + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryDataSourceStepping.h + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryNameHelper.h + ${CMAKE_CURRENT_LIST_DIR}/RimMultipleSummaryPlotNameHelper.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -80,6 +83,9 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimObjectiveFunctionTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotManager.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlot.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryDataSourceStepping.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryNameHelper.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimMultipleSummaryPlotNameHelper.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp index 79ecf274a6..348f4c3ff9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp @@ -51,7 +51,7 @@ RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection() CAF_PDM_InitFieldNoDefault( &m_ySourceStepping, "YSourceStepping", "" ); m_ySourceStepping = new RimSummaryPlotSourceStepping; - m_ySourceStepping->setSourceSteppingType( RimSummaryPlotSourceStepping::Y_AXIS ); + m_ySourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS ); m_ySourceStepping.uiCapability()->setUiTreeHidden( true ); m_ySourceStepping.uiCapability()->setUiTreeChildrenHidden( true ); m_ySourceStepping.xmlCapability()->disableIO(); @@ -317,9 +317,6 @@ void RimEnsembleCurveSetCollection::fieldChangedByUi( const caf::PdmFieldHandle* //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSetCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - auto group = uiOrdering.addNewGroup( "Data Source" ); - - m_ySourceStepping()->uiOrdering( uiConfigName, *group ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp new file mode 100644 index 0000000000..dc484057ed --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp @@ -0,0 +1,237 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimMultipleSummaryPlotNameHelper.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimMultiSummaryPlotNameHelper::RimMultiSummaryPlotNameHelper( std::vector nameHelpers ) + : m_nameHelpers( nameHelpers ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimMultiSummaryPlotNameHelper::plotTitle() const +{ + if ( m_nameHelpers.size() == 1 ) return m_nameHelpers.front()->plotTitle(); + + if ( m_nameHelpers.size() == 2 ) + { + auto first = m_nameHelpers[0]; + auto second = m_nameHelpers[1]; + + return first->aggregatedPlotTitle( *second ); + } + + return "Plot Title"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimMultiSummaryPlotNameHelper::isPlotDisplayingSingleQuantity() const +{ + int plotCountWithSingleQuantity = 0; + for ( auto nameHelper : m_nameHelpers ) + { + if ( nameHelper->isPlotDisplayingSingleQuantity() ) plotCountWithSingleQuantity++; + } + + if ( plotCountWithSingleQuantity == 1 ) return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimMultiSummaryPlotNameHelper::isWellNameInTitle() const +{ + return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { + return nameHelper->isWellNameInTitle(); + } ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimMultiSummaryPlotNameHelper::isWellGroupNameInTitle() const +{ + return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { + return nameHelper->isWellGroupNameInTitle(); + } ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimMultiSummaryPlotNameHelper::isRegionInTitle() const +{ + return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { + return nameHelper->isRegionInTitle(); + } ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimMultiSummaryPlotNameHelper::isCaseInTitle() const +{ + return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { + return nameHelper->isCaseInTitle(); + } ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimMultiSummaryPlotNameHelper::isBlockInTitle() const +{ + return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { + return nameHelper->isBlockInTitle(); + } ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimMultiSummaryPlotNameHelper::isSegmentInTitle() const +{ + return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { + return nameHelper->isSegmentInTitle(); + } ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimMultiSummaryPlotNameHelper::isCompletionInTitle() const +{ + return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { + return nameHelper->isCompletionInTitle(); + } ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimMultiSummaryPlotNameHelper::caseName() const +{ + for ( auto nameHelper : m_nameHelpers ) + { + if ( nameHelper->isCaseInTitle() ) return nameHelper->caseName(); + } + + return ""; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimMultiSummaryPlotNameHelper::titleQuantity() const +{ + for ( auto nameHelper : m_nameHelpers ) + { + if ( nameHelper->isPlotDisplayingSingleQuantity() ) return nameHelper->titleQuantity(); + } + + return ""; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimMultiSummaryPlotNameHelper::titleWellName() const +{ + for ( auto nameHelper : m_nameHelpers ) + { + if ( nameHelper->isWellNameInTitle() ) return nameHelper->titleWellName(); + } + + return ""; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimMultiSummaryPlotNameHelper::titleWellGroupName() const +{ + for ( auto nameHelper : m_nameHelpers ) + { + if ( nameHelper->isWellGroupNameInTitle() ) return nameHelper->titleWellGroupName(); + } + + return ""; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimMultiSummaryPlotNameHelper::titleRegion() const +{ + for ( auto nameHelper : m_nameHelpers ) + { + if ( nameHelper->isRegionInTitle() ) return nameHelper->titleRegion(); + } + + return ""; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimMultiSummaryPlotNameHelper::titleBlock() const +{ + for ( auto nameHelper : m_nameHelpers ) + { + if ( nameHelper->isBlockInTitle() ) return nameHelper->titleBlock(); + } + + return ""; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimMultiSummaryPlotNameHelper::titleSegment() const +{ + for ( auto nameHelper : m_nameHelpers ) + { + if ( nameHelper->isSegmentInTitle() ) return nameHelper->titleSegment(); + } + + return ""; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimMultiSummaryPlotNameHelper::titleCompletion() const +{ + for ( auto nameHelper : m_nameHelpers ) + { + if ( nameHelper->isCompletionInTitle() ) return nameHelper->titleCompletion(); + } + + return ""; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h new file mode 100644 index 0000000000..15057c87f1 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RimSummaryNameHelper.h" + +//================================================================================================== +// +//================================================================================================== +class RimMultiSummaryPlotNameHelper : public RimSummaryNameHelper +{ +public: + explicit RimMultiSummaryPlotNameHelper( std::vector nameHelpers ); + + QString plotTitle() const override; + + bool isPlotDisplayingSingleQuantity() const override; + bool isWellNameInTitle() const override; + bool isWellGroupNameInTitle() const override; + bool isRegionInTitle() const override; + bool isCaseInTitle() const override; + bool isBlockInTitle() const override; + bool isSegmentInTitle() const override; + bool isCompletionInTitle() const override; + + QString caseName() const override; + + std::string titleQuantity() const override; + std::string titleWellName() const override; + std::string titleWellGroupName() const override; + std::string titleRegion() const override; + std::string titleBlock() const override; + std::string titleSegment() const override; + std::string titleCompletion() const override; + +private: + std::vector m_nameHelpers; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp index f7414397fa..334c2b672e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp @@ -38,5 +38,5 @@ RimSummaryCrossPlot::RimSummaryCrossPlot() //-------------------------------------------------------------------------------------------------- RimSummaryPlotSourceStepping* RimSummaryCrossPlot::sourceSteppingObjectForKeyEventHandling() const { - return summaryCurveCollection()->sourceSteppingObject( RimSummaryPlotSourceStepping::UNION_X_Y_AXIS ); + return summaryCurveCollection()->sourceSteppingObject( RimSummaryDataSourceStepping::Axis::UNION_X_Y_AXIS ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 7843ed4c11..c097bc5cc2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -30,6 +30,7 @@ #include "RimEclipseResultCase.h" #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" +#include "RimMultipleSummaryPlotNameHelper.h" #include "RimProject.h" #include "RimSummaryAddress.h" #include "RimSummaryCalculationCollection.h" @@ -38,6 +39,7 @@ #include "RimSummaryCrossPlot.h" #include "RimSummaryCurveAutoName.h" #include "RimSummaryCurveCollection.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" #include "RimSummaryTimeAxisProperties.h" @@ -48,6 +50,7 @@ #include "RiuSummaryVectorSelectionDialog.h" #include "cafPdmUiComboBoxEditor.h" +#include "cafPdmUiLineEditor.h" #include "cafPdmUiListEditor.h" #include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiTreeOrdering.h" @@ -55,8 +58,6 @@ #include "qwt_date.h" #include "qwt_plot.h" -#include "cafPdmUiLineEditor.h" - CAF_PDM_SOURCE_INIT( RimSummaryCurve, "SummaryCurve" ); //-------------------------------------------------------------------------------------------------- @@ -502,11 +503,26 @@ QList RimSummaryCurve::calculateValueOptions( const caf: //-------------------------------------------------------------------------------------------------- QString RimSummaryCurve::createCurveAutoName() { - RimSummaryPlot* plot = nullptr; - firstAncestorOrThisOfTypeAsserted( plot ); + std::vector nameHelpers; + { + RimSummaryPlot* plot = nullptr; + firstAncestorOrThisOfTypeAsserted( plot ); + auto nameHelper = plot->plotTitleHelper(); + + if ( nameHelper ) nameHelpers.push_back( nameHelper ); + } + { + RimSummaryMultiPlot* summaryMultiPlot = nullptr; + firstAncestorOrThisOfType( summaryMultiPlot ); + if ( summaryMultiPlot ) + { + auto nameHelper = summaryMultiPlot->nameHelper(); + if ( nameHelper ) nameHelpers.push_back( nameHelper ); + } + } - const RimSummaryPlotNameHelper* nameHelper = plot->activePlotTitleHelperAllCurves(); - QString curveName = m_curveNameConfig->curveNameY( m_yValuesSummaryAddress->address(), nameHelper ); + RimMultiSummaryPlotNameHelper multiNameHelper( nameHelpers ); + QString curveName = m_curveNameConfig->curveNameY( m_yValuesSummaryAddress->address(), &multiNameHelper ); if ( curveName.isEmpty() ) { curveName = m_curveNameConfig->curveNameY( m_yValuesSummaryAddress->address(), nullptr ); @@ -514,7 +530,7 @@ QString RimSummaryCurve::createCurveAutoName() if ( isCrossPlotCurve() ) { - QString curveNameX = m_curveNameConfig->curveNameX( m_xValuesSummaryAddress->address(), nameHelper ); + QString curveNameX = m_curveNameConfig->curveNameX( m_xValuesSummaryAddress->address(), &multiNameHelper ); if ( curveNameX.isEmpty() ) { curveNameX = m_curveNameConfig->curveNameX( m_xValuesSummaryAddress->address(), nullptr ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp index 56d5d5f6ee..858d374027 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp @@ -27,7 +27,7 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" -#include "RimSummaryPlotNameHelper.h" +#include "RimSummaryNameHelper.h" #include "SummaryPlotCommands/RicSummaryPlotEditorUi.h" @@ -43,20 +43,20 @@ CAF_PDM_SOURCE_INIT( RimSummaryCurveAutoName, "SummaryCurveAutoName" ); RimSummaryCurveAutoName::RimSummaryCurveAutoName() { // clang-format off - CAF_PDM_InitObject("RimSummaryCurveAutoName", "", "", ""); - - CAF_PDM_InitField(&m_longVectorName, "LongVectorName", false, "Long Vector Name", "", "", ""); - CAF_PDM_InitField(&m_vectorName, "VectorName", true, "Vector Name", "", "", ""); - CAF_PDM_InitField(&m_unit, "Unit", false, "Unit", "", "", ""); - CAF_PDM_InitField(&m_regionNumber, "RegionNumber", true, "Region Number", "", "", ""); - CAF_PDM_InitField(&m_wellGroupName, "WellGroupName", true, "Group Name", "", "", ""); - CAF_PDM_InitField(&m_wellName, "WellName", true, "Well Name", "", "", ""); - CAF_PDM_InitField(&m_wellSegmentNumber, "WellSegmentNumber", true, "Well Segment Number", "", "", ""); - CAF_PDM_InitField(&m_lgrName, "LgrName", true, "Lgr Name", "", "", ""); - CAF_PDM_InitField(&m_completion, "Completion", true, "I, J, K", "", "", ""); - CAF_PDM_InitField(&m_aquiferNumber, "Aquifer", true, "Aquifer Number", "", "", ""); + CAF_PDM_InitObject("RimSummaryCurveAutoName"); + + CAF_PDM_InitField( &m_longVectorName, "LongVectorName", false, "Long Vector Name"); + CAF_PDM_InitField( &m_vectorName, "VectorName", true, "Vector Name"); + CAF_PDM_InitField( &m_unit, "Unit", false, "Unit"); + CAF_PDM_InitField( &m_regionNumber, "RegionNumber", true, "Region Number"); + CAF_PDM_InitField( &m_wellGroupName, "WellGroupName", true, "Group Name"); + CAF_PDM_InitField( &m_wellName, "WellName", true, "Well Name"); + CAF_PDM_InitField(&m_wellSegmentNumber, "WellSegmentNumber", true, "Well Segment Number"); + CAF_PDM_InitField( &m_lgrName, "LgrName", true, "Lgr Name"); + CAF_PDM_InitField( &m_completion, "Completion", true, "I, J, K"); + CAF_PDM_InitField( &m_aquiferNumber, "Aquifer", true, "Aquifer Number"); - CAF_PDM_InitField(&m_caseName, "CaseName", true, "Case/Ensemble Name", "", "", ""); + CAF_PDM_InitField(&m_caseName, "CaseName", true, "Case/Ensemble Name"); // clang-format on } @@ -65,7 +65,7 @@ RimSummaryCurveAutoName::RimSummaryCurveAutoName() /// //-------------------------------------------------------------------------------------------------- QString RimSummaryCurveAutoName::curveNameY( const RifEclipseSummaryAddress& summaryAddress, - const RimSummaryPlotNameHelper* nameHelper ) const + const RimSummaryNameHelper* nameHelper ) const { RimSummaryCurve* summaryCurve = nullptr; this->firstAncestorOrThisOfType( summaryCurve ); @@ -100,7 +100,7 @@ QString RimSummaryCurveAutoName::curveNameY( const RifEclipseSummaryAddress& sum /// //-------------------------------------------------------------------------------------------------- QString RimSummaryCurveAutoName::curveNameX( const RifEclipseSummaryAddress& summaryAddress, - const RimSummaryPlotNameHelper* nameHelper ) const + const RimSummaryNameHelper* nameHelper ) const { RimSummaryCurve* summaryCurve = nullptr; this->firstAncestorOrThisOfType( summaryCurve ); @@ -154,7 +154,7 @@ void RimSummaryCurveAutoName::applySettings( const RimSummaryCurveAutoName& othe //-------------------------------------------------------------------------------------------------- void RimSummaryCurveAutoName::appendWellName( std::string& text, const RifEclipseSummaryAddress& summaryAddress, - const RimSummaryPlotNameHelper* nameHelper ) const + const RimSummaryNameHelper* nameHelper ) const { bool skipSubString = nameHelper && nameHelper->isWellNameInTitle(); if ( skipSubString ) return; @@ -182,7 +182,7 @@ void RimSummaryCurveAutoName::appendLgrName( std::string& text, const RifEclipse /// //-------------------------------------------------------------------------------------------------- QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress& summaryAddress, - const RimSummaryPlotNameHelper* nameHelper, + const RimSummaryNameHelper* nameHelper, const std::string& unitText, const std::string& caseName ) const { @@ -251,7 +251,7 @@ QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress& //-------------------------------------------------------------------------------------------------- void RimSummaryCurveAutoName::appendAddressDetails( std::string& text, const RifEclipseSummaryAddress& summaryAddress, - const RimSummaryPlotNameHelper* nameHelper ) const + const RimSummaryNameHelper* nameHelper ) const { switch ( summaryAddress.category() ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h index a84f026e17..7687be16b5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h @@ -22,7 +22,7 @@ #include "cafPdmObject.h" class RifEclipseSummaryAddress; -class RimSummaryPlotNameHelper; +class RimSummaryNameHelper; class RimSummaryCurveAutoName : public caf::PdmObject { @@ -31,8 +31,8 @@ class RimSummaryCurveAutoName : public caf::PdmObject public: RimSummaryCurveAutoName(); - QString curveNameY( const RifEclipseSummaryAddress& summaryAddress, const RimSummaryPlotNameHelper* nameHelper ) const; - QString curveNameX( const RifEclipseSummaryAddress& summaryAddress, const RimSummaryPlotNameHelper* nameHelper ) const; + QString curveNameY( const RifEclipseSummaryAddress& summaryAddress, const RimSummaryNameHelper* nameHelper ) const; + QString curveNameX( const RifEclipseSummaryAddress& summaryAddress, const RimSummaryNameHelper* nameHelper ) const; void applySettings( const RimSummaryCurveAutoName& other ); @@ -44,14 +44,14 @@ class RimSummaryCurveAutoName : public caf::PdmObject void appendAddressDetails( std::string& text, const RifEclipseSummaryAddress& summaryAddress, - const RimSummaryPlotNameHelper* nameHelper ) const; + const RimSummaryNameHelper* nameHelper ) const; void appendWellName( std::string& text, const RifEclipseSummaryAddress& summaryAddress, - const RimSummaryPlotNameHelper* nameHelper ) const; + const RimSummaryNameHelper* nameHelper ) const; void appendLgrName( std::string& text, const RifEclipseSummaryAddress& summaryAddress ) const; QString buildCurveName( const RifEclipseSummaryAddress& summaryAddress, - const RimSummaryPlotNameHelper* nameHelper, + const RimSummaryNameHelper* nameHelper, const std::string& unitText, const std::string& caseName ) const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index 4080ee8ed5..4e98bf253b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -65,21 +65,21 @@ RimSummaryCurveCollection::RimSummaryCurveCollection() CAF_PDM_InitFieldNoDefault( &m_ySourceStepping, "YSourceStepping", "" ); m_ySourceStepping = new RimSummaryPlotSourceStepping; - m_ySourceStepping->setSourceSteppingType( RimSummaryPlotSourceStepping::Y_AXIS ); + m_ySourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS ); m_ySourceStepping.uiCapability()->setUiTreeHidden( true ); m_ySourceStepping.uiCapability()->setUiTreeChildrenHidden( true ); m_ySourceStepping.xmlCapability()->disableIO(); CAF_PDM_InitFieldNoDefault( &m_xSourceStepping, "XSourceStepping", "" ); m_xSourceStepping = new RimSummaryPlotSourceStepping; - m_xSourceStepping->setSourceSteppingType( RimSummaryPlotSourceStepping::X_AXIS ); + m_xSourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::X_AXIS ); m_xSourceStepping.uiCapability()->setUiTreeHidden( true ); m_xSourceStepping.uiCapability()->setUiTreeChildrenHidden( true ); m_xSourceStepping.xmlCapability()->disableIO(); CAF_PDM_InitFieldNoDefault( &m_unionSourceStepping, "UnionSourceStepping", "" ); m_unionSourceStepping = new RimSummaryPlotSourceStepping; - m_unionSourceStepping->setSourceSteppingType( RimSummaryPlotSourceStepping::UNION_X_Y_AXIS ); + m_unionSourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::UNION_X_Y_AXIS ); m_unionSourceStepping.uiCapability()->setUiTreeHidden( true ); m_unionSourceStepping.uiCapability()->setUiTreeChildrenHidden( true ); m_unionSourceStepping.xmlCapability()->disableIO(); @@ -232,7 +232,7 @@ std::vector RimSummaryCurveCollection::curves() const /// //-------------------------------------------------------------------------------------------------- std::vector - RimSummaryCurveCollection::curvesForSourceStepping( RimSummaryPlotSourceStepping::SourceSteppingType steppingType ) const + RimSummaryCurveCollection::curvesForSourceStepping( RimSummaryDataSourceStepping::Axis steppingType ) const { std::vector stepCurves; @@ -247,11 +247,11 @@ std::vector std::string quantity; - if ( steppingType == RimSummaryPlotSourceStepping::X_AXIS ) + if ( steppingType == RimSummaryDataSourceStepping::Axis::X_AXIS ) { quantity = m_curveForSourceStepping->summaryAddressX().quantityName(); } - else if ( steppingType == RimSummaryPlotSourceStepping::Y_AXIS ) + else if ( steppingType == RimSummaryDataSourceStepping::Axis::Y_AXIS ) { quantity = m_curveForSourceStepping->summaryAddressY().quantityName(); } @@ -268,7 +268,7 @@ std::vector for ( const auto& c : curves() ) { - if ( steppingType == RimSummaryPlotSourceStepping::X_AXIS ) + if ( steppingType == RimSummaryDataSourceStepping::Axis::X_AXIS ) { if ( c->summaryCaseX() == m_curveForSourceStepping->summaryCaseX() && c->summaryAddressX().quantityName() == candidateName ) @@ -276,7 +276,7 @@ std::vector stepCurves.push_back( c ); } } - else if ( steppingType == RimSummaryPlotSourceStepping::Y_AXIS ) + else if ( steppingType == RimSummaryDataSourceStepping::Axis::Y_AXIS ) { if ( c->summaryCaseY() == m_curveForSourceStepping->summaryCaseY() && c->summaryAddressY().quantityName() == candidateName ) @@ -411,17 +411,17 @@ RimSummaryCurve* RimSummaryCurveCollection::curveForSourceStepping() const /// //-------------------------------------------------------------------------------------------------- RimSummaryPlotSourceStepping* - RimSummaryCurveCollection::sourceSteppingObject( RimSummaryPlotSourceStepping::SourceSteppingType sourceSteppingType ) const + RimSummaryCurveCollection::sourceSteppingObject( RimSummaryDataSourceStepping::Axis sourceSteppingType ) const { - if ( sourceSteppingType == RimSummaryPlotSourceStepping::X_AXIS ) + if ( sourceSteppingType == RimSummaryDataSourceStepping::Axis::X_AXIS ) { return m_xSourceStepping(); } - else if ( sourceSteppingType == RimSummaryPlotSourceStepping::Y_AXIS ) + else if ( sourceSteppingType == RimSummaryDataSourceStepping::Axis::Y_AXIS ) { return m_ySourceStepping(); } - if ( sourceSteppingType == RimSummaryPlotSourceStepping::UNION_X_Y_AXIS ) + if ( sourceSteppingType == RimSummaryDataSourceStepping::Axis::UNION_X_Y_AXIS ) { return m_unionSourceStepping(); } @@ -491,35 +491,6 @@ void RimSummaryCurveCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* //-------------------------------------------------------------------------------------------------- void RimSummaryCurveCollection::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - RimSummaryCrossPlot* parentCrossPlot; - firstAncestorOrThisOfType( parentCrossPlot ); - - if ( parentCrossPlot ) - { - { - auto group = uiOrdering.addNewGroup( "Y Source Stepping" ); - - m_ySourceStepping()->uiOrdering( uiConfigName, *group ); - } - - { - auto group = uiOrdering.addNewGroup( "X Source Stepping" ); - - m_xSourceStepping()->uiOrdering( uiConfigName, *group ); - } - - { - auto group = uiOrdering.addNewGroup( "XY Union Source Stepping" ); - - m_unionSourceStepping()->uiOrdering( uiConfigName, *group ); - } - } - else - { - auto group = uiOrdering.addNewGroup( "Data Source" ); - - m_ySourceStepping()->uiOrdering( uiConfigName, *group ); - } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h index fe52f9857b..2c4c34a190 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h @@ -53,12 +53,10 @@ class RimSummaryCurveCollection : public caf::PdmObject void setCurveForSourceStepping( RimSummaryCurve* curve ); RimSummaryCurve* curveForSourceStepping() const; - RimSummaryPlotSourceStepping* - sourceSteppingObject( RimSummaryPlotSourceStepping::SourceSteppingType sourceSteppingType ) const; + RimSummaryPlotSourceStepping* sourceSteppingObject( RimSummaryDataSourceStepping::Axis sourceSteppingType ) const; std::vector curves() const; - std::vector - curvesForSourceStepping( RimSummaryPlotSourceStepping::SourceSteppingType steppingType ) const; + std::vector curvesForSourceStepping( RimSummaryDataSourceStepping::Axis steppingType ) const; void setCurveAsTopZWithinCategory( RimSummaryCurve* curve ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp new file mode 100644 index 0000000000..a40f4ed515 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp @@ -0,0 +1,19 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimSummaryDataSourceStepping.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.h new file mode 100644 index 0000000000..8b0de9a50b --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.h @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include + +class RimSummaryCurve; +class RimEnsembleCurveSet; + +class RimSummaryDataSourceStepping +{ +public: + enum class Axis + { + Y_AXIS, + X_AXIS, + UNION_X_Y_AXIS + }; + +public: + virtual std::vector availableAxes() const = 0; + virtual std::vector curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const = 0; + virtual std::vector allCurves( RimSummaryDataSourceStepping::Axis axis ) const = 0; + virtual std::vector curveSets() const = 0; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 9c837672b2..5bec5ce2a1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -20,13 +20,18 @@ #include "RiaSummaryStringTools.h" +#include "RimEnsembleCurveSet.h" #include "RimMainPlotCollection.h" #include "RimMultiPlotCollection.h" +#include "RimMultipleSummaryPlotNameHelper.h" #include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" +#include "RimSummaryCurve.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" +#include "RimSummaryPlotNameHelper.h" +#include "RimSummaryPlotSourceStepping.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RiuSummaryVectorSelectionUi.h" @@ -41,7 +46,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlot::RimSummaryMultiPlot() { - CAF_PDM_InitObject( "Multi Summary Plot Plot", "", "", "" ); + CAF_PDM_InitObject( "Multi Summary Plot", "", "", "" ); this->setDeletable( true ); CAF_PDM_InitFieldNoDefault( &m_filterText, "FilterText", "Filter Text" ); @@ -49,11 +54,24 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() CAF_PDM_InitField( &m_individualPlotPerVector, "IndividualPlotPerVector", false, "One plot per Vector" ); CAF_PDM_InitField( &m_individualPlotPerDataSource, "IndividualPlotPerDataSource", false, "One plot per Data Source" ); + CAF_PDM_InitField( &m_autoPlotTitles, "AutoPlotTitles", false, "Auto Plot Titles" ); + CAF_PDM_InitField( &m_autoPlotTitlesOnSubPlots, "AutoPlotTitlesSubPlots", false, "Auto Plot Titles Sub Plots" ); - CAF_PDM_InitField( &m_showMultiPlotInProjectTree, "ShowMultiPlotInProjectTree", false, "Show Multi Plot In Project Tree" ); + CAF_PDM_InitField( &m_showMultiPlotInProjectTree, "ShowMultiPlotInProjectTree", true, "Show Multi Plot In Project Tree" ); CAF_PDM_InitFieldNoDefault( &m_multiPlot, "MultiPlot", "Multi Plot" ); + m_multiPlot.uiCapability()->setUiTreeHidden( true ); m_multiPlot = new RimMultiPlot; + + CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); + m_sourceStepping = new RimSummaryPlotSourceStepping; + m_sourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS ); + m_sourceStepping->setSourceSteppingObject( this ); + m_sourceStepping.uiCapability()->setUiTreeHidden( true ); + m_sourceStepping.uiCapability()->setUiTreeChildrenHidden( true ); + m_sourceStepping.xmlCapability()->disableIO(); + + m_nameHelper = std::make_unique(); } //-------------------------------------------------------------------------------------------------- @@ -94,7 +112,7 @@ void RimSummaryMultiPlot::zoomAll() //-------------------------------------------------------------------------------------------------- QString RimSummaryMultiPlot::description() const { - return "RimMultiSummaryPlot Placeholder Text"; + return "RimSummaryMultiPlot Placeholder Text"; } //-------------------------------------------------------------------------------------------------- @@ -134,6 +152,96 @@ RimSummaryMultiPlot* RimSummaryMultiPlot::createAndAppendMultiPlot( const std::v return plotWindow; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryMultiPlot::availableAxes() const +{ + return { RimSummaryDataSourceStepping::Axis::X_AXIS }; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryMultiPlot::curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const +{ + std::vector curves; + + for ( auto summaryPlot : summaryPlots() ) + { + for ( auto curve : summaryPlot->curvesForStepping( axis ) ) + { + curves.push_back( curve ); + } + } + + return curves; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryMultiPlot::curveSets() const +{ + std::vector curveSets; + + for ( auto summaryPlot : summaryPlots() ) + { + for ( auto curveSet : summaryPlot->curveSets() ) + { + curveSets.push_back( curveSet ); + } + } + + return curveSets; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryMultiPlot::allCurves( RimSummaryDataSourceStepping::Axis axis ) const +{ + std::vector curves; + + for ( auto summaryPlot : summaryPlots() ) + { + for ( auto curve : summaryPlot->allCurves( axis ) ) + { + curves.push_back( curve ); + } + } + + return curves; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::populateNameHelper( RimSummaryPlotNameHelper* nameHelper ) +{ + nameHelper->clear(); + + std::vector addresses; + std::vector sumCases; + std::vector ensembleCases; + + for ( RimSummaryCurve* curve : allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) ) + { + addresses.push_back( curve->summaryAddressY() ); + sumCases.push_back( curve->summaryCaseY() ); + } + + for ( auto curveSet : curveSets() ) + { + addresses.push_back( curveSet->summaryAddress() ); + ensembleCases.push_back( curveSet->summaryCaseCollection() ); + } + + nameHelper->appendAddresses( addresses ); + nameHelper->setSummaryCases( sumCases ); + nameHelper->setEnsembleCases( ensembleCases ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -157,6 +265,11 @@ void RimSummaryMultiPlot::onLoadDataAndUpdate() { updateMdiWindowVisibility(); + if ( m_autoPlotTitles ) + { + updatePlotTitles(); + } + m_multiPlot->onLoadDataAndUpdate(); } @@ -186,10 +299,17 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde uiOrdering.add( &m_filterText ); uiOrdering.add( &m_individualPlotPerVector ); uiOrdering.add( &m_individualPlotPerDataSource ); + uiOrdering.add( &m_autoPlotTitles ); + uiOrdering.add( &m_autoPlotTitlesOnSubPlots ); auto group = uiOrdering.addNewGroup( "Multi Plot Options" ); m_multiPlot->uiOrderingForSummaryMultiPlot( *group ); + { + auto group = uiOrdering.addNewGroup( "Data Source" ); + m_sourceStepping()->uiOrdering( uiConfigName, *group ); + } + uiOrdering.add( &m_showMultiPlotInProjectTree ); uiOrdering.skipRemainingFields(); @@ -219,6 +339,11 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi { updatePlots(); } + else if ( changedField == &m_autoPlotTitles || changedField == &m_autoPlotTitlesOnSubPlots ) + { + onLoadDataAndUpdate(); + updateLayout(); + } } //-------------------------------------------------------------------------------------------------- @@ -274,11 +399,8 @@ void RimSummaryMultiPlot::updatePlots() RiaSummaryStringTools::computeFilteredAddresses( addressFilters, allAddresses, includeDiffCurves ); { - // Remove existing plots - m_multiPlot->deleteAllPlots(); - // Add new plots RicSummaryPlotBuilder plotBuilder; plotBuilder.setAddresses( filteredAddresses ); plotBuilder.setDataSources( matchingSummaryCases, matchingEnsembles ); @@ -286,14 +408,7 @@ void RimSummaryMultiPlot::updatePlots() plotBuilder.setIndividualPlotPerDataSource( m_individualPlotPerDataSource ); auto plots = plotBuilder.createPlots(); - - std::vector plotsForMultiPlot; - for ( auto p : plots ) - { - plotsForMultiPlot.push_back( dynamic_cast( p ) ); - } - - for ( auto plot : plotsForMultiPlot ) + for ( auto plot : plots ) { this->addPlot( plot ); @@ -302,6 +417,56 @@ void RimSummaryMultiPlot::updatePlots() plot->setShowWindow( true ); } - m_multiPlot->loadDataAndUpdate(); + onLoadDataAndUpdate(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::updatePlotTitles() +{ + populateNameHelper( m_nameHelper.get() ); + + auto title = m_nameHelper->plotTitle(); + m_multiPlot->setMultiPlotTitle( title ); + + if ( m_autoPlotTitlesOnSubPlots ) + { + for ( auto plot : summaryPlots() ) + { + auto subPlotNameHelper = plot->plotTitleHelper(); + + // Disable auto plot, as this is required to be able to include the information in the multi plot title + plot->enableAutoPlotTitle( false ); + + auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper.get() ); + plot->setDescription( plotName ); + plot->updatePlotTitle(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RimSummaryNameHelper* RimSummaryMultiPlot::nameHelper() const +{ + return m_nameHelper.get(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryMultiPlot::summaryPlots() const +{ + std::vector typedPlots; + + for ( auto plot : m_multiPlot->plots() ) + { + auto summaryPlot = dynamic_cast( plot ); + if ( summaryPlot ) typedPlots.push_back( summaryPlot ); } + + return typedPlots; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index ec4df967a7..ddfe43b38a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -19,18 +19,23 @@ #pragma once #include "RimPlotWindow.h" +#include "RimSummaryDataSourceStepping.h" #include "cafPdmChildField.h" #include "cafPdmObject.h" #include "cafPdmPtrArrayField.h" class RimMultiPlot; +class RimSummaryPlot; +class RimSummaryPlotSourceStepping; +class RimSummaryPlotNameHelper; +class RimSummaryNameHelper; //================================================================================================== /// /// //================================================================================================== -class RimSummaryMultiPlot : public RimPlotWindow +class RimSummaryMultiPlot : public RimPlotWindow, public RimSummaryDataSourceStepping { CAF_PDM_HEADER_INIT; @@ -45,8 +50,16 @@ class RimSummaryMultiPlot : public RimPlotWindow void addPlot( RimPlot* plot ); + void updatePlotTitles(); + const RimSummaryNameHelper* nameHelper() const; + static RimSummaryMultiPlot* createAndAppendMultiPlot( const std::vector& plots ); + std::vector availableAxes() const override; + std::vector curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const override; + std::vector curveSets() const override; + std::vector allCurves( RimSummaryDataSourceStepping::Axis axis ) const override; + private: QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override; void deleteViewWidget() override; @@ -65,12 +78,21 @@ class RimSummaryMultiPlot : public RimPlotWindow void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override; void updatePlots(); + void populateNameHelper( RimSummaryPlotNameHelper* nameHelper ); + + std::vector summaryPlots() const; private: caf::PdmField m_filterText; caf::PdmField m_individualPlotPerVector; caf::PdmField m_individualPlotPerDataSource; + caf::PdmField m_autoPlotTitles; + caf::PdmField m_autoPlotTitlesOnSubPlots; caf::PdmField m_showMultiPlotInProjectTree; caf::PdmChildField m_multiPlot; + + caf::PdmChildField m_sourceStepping; + + std::unique_ptr m_nameHelper; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp new file mode 100644 index 0000000000..38a4550894 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimSummaryNameHelper.h" + +#include "RiuSummaryQuantityNameInfoProvider.h" +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryNameHelper::aggregatedPlotTitle( const RimSummaryNameHelper& other ) const +{ + QString title; + + auto titleCaseName = this->caseName(); + if ( !other.isCaseInTitle() && !titleCaseName.isEmpty() ) + { + if ( !title.isEmpty() ) title += ", "; + + title += titleCaseName; + } + + auto wellName = this->titleWellName(); + if ( !other.isWellNameInTitle() && !wellName.empty() ) + { + if ( !title.isEmpty() ) title += ", "; + title += QString::fromStdString( wellName ); + } + + auto wellGroupName = this->titleWellGroupName(); + if ( !other.isWellGroupNameInTitle() && !wellGroupName.empty() ) + { + if ( !title.isEmpty() ) title += ", "; + title += QString::fromStdString( wellGroupName ); + } + + auto region = this->titleRegion(); + if ( !other.isRegionInTitle() && !region.empty() ) + { + if ( !title.isEmpty() ) title += ", "; + title += "Region : " + QString::fromStdString( region ); + } + + auto block = this->titleBlock(); + if ( !other.isBlockInTitle() && !block.empty() ) + { + if ( !title.isEmpty() ) title += ", "; + title += "Block : " + QString::fromStdString( block ); + } + + auto segment = this->titleSegment(); + if ( !other.isSegmentInTitle() && !segment.empty() ) + { + if ( !title.isEmpty() ) title += ", "; + title += "Segment : " + QString::fromStdString( segment ); + } + + auto completion = this->titleCompletion(); + if ( !other.isCompletionInTitle() && !completion.empty() ) + { + if ( !title.isEmpty() ) title += ", "; + title += "Completion : " + QString::fromStdString( completion ); + } + + auto quantity = this->titleQuantity(); + if ( !other.isPlotDisplayingSingleQuantity() && !quantity.empty() ) + { + if ( !title.isEmpty() ) title += ", "; + title += QString::fromStdString( + RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( quantity, true ) ); + } + + if ( title.isEmpty() ) + { + title = "Plot Title"; + } + + return title; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h new file mode 100644 index 0000000000..e4278c00e6 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h @@ -0,0 +1,58 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include + +class QString; + +class RimSummaryCase; +class RimSummaryCaseCollection; +class RifEclipseSummaryAddress; + +//================================================================================================== +// +//================================================================================================== +class RimSummaryNameHelper +{ +public: + virtual QString plotTitle() const = 0; + + QString aggregatedPlotTitle( const RimSummaryNameHelper& summaryMultiPlotNameHelper ) const; + + virtual bool isPlotDisplayingSingleQuantity() const = 0; + virtual bool isWellNameInTitle() const = 0; + virtual bool isWellGroupNameInTitle() const = 0; + virtual bool isRegionInTitle() const = 0; + virtual bool isCaseInTitle() const = 0; + virtual bool isBlockInTitle() const = 0; + virtual bool isSegmentInTitle() const = 0; + virtual bool isCompletionInTitle() const = 0; + + virtual QString caseName() const = 0; + + virtual std::string titleQuantity() const = 0; + virtual std::string titleWellName() const = 0; + virtual std::string titleWellGroupName() const = 0; + virtual std::string titleRegion() const = 0; + virtual std::string titleBlock() const = 0; + virtual std::string titleSegment() const = 0; + virtual std::string titleCompletion() const = 0; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 0a0e87199a..2a2d557b33 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -250,6 +250,14 @@ RimSummaryPlot::RimSummaryPlot() m_nameHelperAllCurves.reset( new RimSummaryPlotNameHelper ); + CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); + m_sourceStepping = new RimSummaryPlotSourceStepping; + m_sourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS ); + m_sourceStepping->setSourceSteppingObject( this ); + m_sourceStepping.uiCapability()->setUiTreeHidden( true ); + m_sourceStepping.uiCapability()->setUiTreeChildrenHidden( true ); + m_sourceStepping.xmlCapability()->disableIO(); + setPlotInfoLabel( "Filters Active" ); } @@ -534,6 +542,47 @@ void RimSummaryPlot::moveCurvesToPlot( RimSummaryPlot* plot, const std::vectorupdateStackedCurveData(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryPlot::curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const +{ + auto curveForStepping = summaryCurveCollection()->curveForSourceStepping(); + if ( curveForStepping ) + { + return { curveForStepping }; + } + + return summaryCurves(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryPlot::curveSets() const +{ + return ensembleCurveSetCollection()->curveSets(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryPlot::allCurves( RimSummaryDataSourceStepping::Axis axis ) const +{ + return summaryCurves(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryPlot::availableAxes() const +{ + if ( m_isCrossPlot ) + return { RimSummaryDataSourceStepping::Axis::X_AXIS, RimSummaryDataSourceStepping::Axis::Y_AXIS }; + + return { RimSummaryDataSourceStepping::Axis::X_AXIS }; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -607,23 +656,16 @@ std::vector RimSummaryPlot::visibleStackedSummaryCurvesForAxis return visibleStackedCurves; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimSummaryPlot::curveSets() const -{ - return ensembleCurveSetCollection()->curveSets(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updatePlotTitle() { - updateNameHelperWithCurveData( m_nameHelperAllCurves.get() ); + m_nameHelperAllCurves->clear(); if ( m_useAutoPlotTitle ) { + updateNameHelperWithCurveData( m_nameHelperAllCurves.get() ); m_description = m_nameHelperAllCurves->plotTitle(); } @@ -642,7 +684,7 @@ void RimSummaryPlot::updatePlotTitle() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const RimSummaryPlotNameHelper* RimSummaryPlot::activePlotTitleHelperAllCurves() const +const RimSummaryNameHelper* RimSummaryPlot::activePlotTitleHelperAllCurves() const { if ( m_useAutoPlotTitle() ) { @@ -652,6 +694,14 @@ const RimSummaryPlotNameHelper* RimSummaryPlot::activePlotTitleHelperAllCurves() return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RimSummaryNameHelper* RimSummaryPlot::plotTitleHelper() const +{ + return m_nameHelperAllCurves.get(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1885,10 +1935,9 @@ void RimSummaryPlot::onPlotZoomed() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - if ( !m_isCrossPlot ) { - caf::PdmUiGroup* textCurveFilterGroup = uiOrdering.addNewGroup( "Text-Based Curve Creation" ); - m_textCurveSetEditor->uiOrdering( uiConfigName, *textCurveFilterGroup ); + auto group = uiOrdering.addNewGroup( "Data Source" ); + m_sourceStepping()->uiOrdering( uiConfigName, *group ); } caf::PdmUiGroup* mainOptions = uiOrdering.addNewGroup( "General Plot Options" ); @@ -2204,7 +2253,7 @@ RimSummaryPlotSourceStepping* RimSummaryPlot::sourceSteppingObjectForKeyEventHan } } - return summaryCurveCollection()->sourceSteppingObject( RimSummaryPlotSourceStepping::Y_AXIS ); + return summaryCurveCollection()->sourceSteppingObject( RimSummaryDataSourceStepping::Axis::Y_AXIS ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 240581972c..f4817f8156 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -24,6 +24,7 @@ #include "RifEclipseSummaryAddress.h" #include "RimPlot.h" +#include "RimSummaryDataSourceStepping.h" #include "qwt_plot_textlabel.h" @@ -49,6 +50,7 @@ class RimSummaryTimeAxisProperties; class RimPlotAxisPropertiesInterface; class RimPlotAxisProperties; class RiuSummaryQwtPlot; +class RimSummaryNameHelper; class RimSummaryPlotNameHelper; class RimPlotTemplateFileItem; class RimSummaryPlotFilterTextCurveSetEditor; @@ -64,7 +66,7 @@ class QKeyEvent; /// /// //================================================================================================== -class RimSummaryPlot : public RimPlot +class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping { Q_OBJECT; CAF_PDM_HEADER_INIT; @@ -131,13 +133,12 @@ class RimSummaryPlot : public RimPlot void deleteAllSummaryCurves(); RimSummaryCurveCollection* summaryCurveCollection() const; - std::vector curveSets() const; - void updatePlotTitle(); - const RimSummaryPlotNameHelper* activePlotTitleHelperAllCurves() const; - void updateCurveNames(); - QString generatedPlotTitleFromAllCurves() const; + const RimSummaryNameHelper* activePlotTitleHelperAllCurves() const; + const RimSummaryNameHelper* plotTitleHelper() const; + void updateCurveNames(); + QString generatedPlotTitleFromAllCurves() const; void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot ); @@ -178,6 +179,11 @@ class RimSummaryPlot : public RimPlot static void moveCurvesToPlot( RimSummaryPlot* plot, const std::vector curves, int insertAtPosition ); + std::vector availableAxes() const override; + std::vector curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const override; + std::vector curveSets() const override; + std::vector allCurves( RimSummaryDataSourceStepping::Axis axis ) const override; + public: // RimViewWindow overrides void deleteViewWidget() override; @@ -274,5 +280,6 @@ private slots: bool m_isCrossPlot; - std::unique_ptr m_nameHelperAllCurves; + std::unique_ptr m_nameHelperAllCurves; + caf::PdmChildField m_sourceStepping; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index f1552e11fe..216a55144e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -181,16 +181,13 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const { std::map> unitToQuantityNameMap; - // clang-format off - auto addToUnitToQuantityMap =[&]( const std::string& unitText, - const RifEclipseSummaryAddress& sumAddress ) - { + auto addToUnitToQuantityMap = [&]( const std::string& unitText, const RifEclipseSummaryAddress& sumAddress ) { // remove any stats prefix from the quantity name - size_t cutPos = sumAddress.quantityName().find(':'); - if (cutPos == std::string::npos) cutPos = -1; + size_t cutPos = sumAddress.quantityName().find( ':' ); + if ( cutPos == std::string::npos ) cutPos = -1; std::string quantityNameForDisplay; - const std::string& quantityName = sumAddress.quantityName().substr(cutPos+1); + const std::string& quantityName = sumAddress.quantityName().substr( cutPos + 1 ); if ( sumAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED ) { @@ -200,8 +197,12 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const { if ( m_axisProperties->showDescription() ) { + auto candidateName = quantityName; + + if ( sumAddress.isHistoryQuantity() ) candidateName = quantityName.substr( 0, quantityName.size() - 1 ); + quantityNameForDisplay = - RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( quantityName ); + RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( candidateName ); } if ( m_axisProperties->showAcronym() ) @@ -223,8 +224,6 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const unitToQuantityNameMap[unitText].insert( quantityNameForDisplay ); }; - // clang-format on - for ( RimSummaryCurve* rimCurve : m_summaryCurves ) { RifEclipseSummaryAddress sumAddress; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index 7055af6461..5bf284044a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -52,6 +52,12 @@ #include "cafPdmUiTreeSelectionEditor.h" #include "cafSelectionManager.h" +// Multi plot +#include "RimMainPlotCollection.h" +#include "RimMultiPlotCollection.h" +#include "RimProject.h" +#include "RimSummaryMultiPlot.h" + #include CAF_PDM_SOURCE_INIT( RimSummaryPlotManager, "RimSummaryPlotManager" ); @@ -387,6 +393,17 @@ void RimSummaryPlotManager::createNewPlot() } RicSummaryPlotBuilder::createAndAppendMultiPlot( plotsForMultiPlot ); + + { + auto myCopyOfPlots = plotBuilder.createPlots(); + std::vector myRimPlots; + for ( auto p : myCopyOfPlots ) + { + p->loadDataAndUpdate(); + myRimPlots.push_back( dynamic_cast( p ) ); + } + RimSummaryMultiPlot::createAndAppendMultiPlot( myRimPlots ); + } } else { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp index 079c7d63b7..1859db90b3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp @@ -93,63 +93,9 @@ void RimSummaryPlotNameHelper::setEnsembleCases( const std::vectorlongNameFromQuantityName( m_titleQuantity, true ) ); - } - - if ( title.isEmpty() ) - { - title = "Composed Plot"; - } - - return title; + return aggregatedPlotTitle( empty ); } //-------------------------------------------------------------------------------------------------- @@ -216,6 +162,70 @@ bool RimSummaryPlotNameHelper::isCompletionInTitle() const return !m_titleCompletion.empty(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryPlotNameHelper::caseName() const +{ + return m_titleCaseName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimSummaryPlotNameHelper::titleQuantity() const +{ + return m_titleQuantity; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimSummaryPlotNameHelper::titleWellName() const +{ + return m_titleWellName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimSummaryPlotNameHelper::titleWellGroupName() const +{ + return m_titleWellGroupName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimSummaryPlotNameHelper::titleRegion() const +{ + return m_titleRegion; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimSummaryPlotNameHelper::titleBlock() const +{ + return m_titleBlock; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimSummaryPlotNameHelper::titleSegment() const +{ + return m_titleSegment; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RimSummaryPlotNameHelper::titleCompletion() const +{ + return m_titleCompletion; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h index 59499acdd2..cd12676265 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h @@ -18,8 +18,9 @@ #pragma once -#include "RiaSummaryCurveAnalyzer.h" +#include "RimSummaryNameHelper.h" +#include "RiaSummaryCurveAnalyzer.h" #include "RifEclipseSummaryAddress.h" #include "cafPdmPointer.h" @@ -36,7 +37,7 @@ class RimSummaryCaseCollection; //================================================================================================== // //================================================================================================== -class RimSummaryPlotNameHelper +class RimSummaryPlotNameHelper : public RimSummaryNameHelper { public: RimSummaryPlotNameHelper(); @@ -47,16 +48,26 @@ class RimSummaryPlotNameHelper void setSummaryCases( const std::vector& summaryCases ); void setEnsembleCases( const std::vector& ensembleCases ); - QString plotTitle() const; - - bool isPlotDisplayingSingleQuantity() const; - bool isWellNameInTitle() const; - bool isWellGroupNameInTitle() const; - bool isRegionInTitle() const; - bool isCaseInTitle() const; - bool isBlockInTitle() const; - bool isSegmentInTitle() const; - bool isCompletionInTitle() const; + QString plotTitle() const override; + + bool isPlotDisplayingSingleQuantity() const override; + bool isWellNameInTitle() const override; + bool isWellGroupNameInTitle() const override; + bool isRegionInTitle() const override; + bool isCaseInTitle() const override; + bool isBlockInTitle() const override; + bool isSegmentInTitle() const override; + bool isCompletionInTitle() const override; + + QString caseName() const override; + + std::string titleQuantity() const override; + std::string titleWellName() const override; + std::string titleWellGroupName() const override; + std::string titleRegion() const override; + std::string titleBlock() const override; + std::string titleSegment() const override; + std::string titleCompletion() const override; private: void clearTitleSubStrings(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 524ae6358b..b50602db11 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -23,8 +23,6 @@ #include "RiaSummaryCurveAnalyzer.h" #include "RiaSummaryCurveDefinition.h" -#include "RifSummaryReaderInterface.h" - #include "RimDataSourceSteppingTools.h" #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" @@ -34,6 +32,8 @@ #include "RimSummaryCrossPlot.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" +#include "RimSummaryDataSourceStepping.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "RiuPlotMainWindow.h" @@ -49,7 +49,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryPlotSourceStepping, "RimSummaryCurveCollectionMod /// //-------------------------------------------------------------------------------------------------- RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() - : m_sourceSteppingType( Y_AXIS ) + : m_sourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS ) { CAF_PDM_InitObject( "Summary Curves Modifier" ); @@ -84,11 +84,19 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlotSourceStepping::setSourceSteppingType( SourceSteppingType sourceSteppingType ) +void RimSummaryPlotSourceStepping::setSourceSteppingType( RimSummaryDataSourceStepping::Axis sourceSteppingType ) { m_sourceSteppingType = sourceSteppingType; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotSourceStepping::setSourceSteppingObject( caf::PdmObject* sourceObject ) +{ + m_objectForSourceStepping = sourceObject; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -353,24 +361,19 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* const QVariant& newValue ) { std::vector curves; - - RimSummaryCurveCollection* curveCollection = nullptr; - this->firstAncestorOrThisOfType( curveCollection ); - if ( curveCollection ) - { - curves = curveCollection->curves(); - } - - RimEnsembleCurveSetCollection* ensembleCurveColl = nullptr; - this->firstAncestorOrThisOfType( ensembleCurveColl ); + if ( dataSourceSteppingObject() ) curves = dataSourceSteppingObject()->allCurves( m_sourceSteppingType ); if ( changedField == &m_includeEnsembleCasesForCaseStepping ) { + RimSummaryCurveCollection* curveCollection = nullptr; + this->firstAncestorOrThisOfType( curveCollection ); if ( curveCollection ) { curveCollection->updateConnectedEditors(); } + RimEnsembleCurveSetCollection* ensembleCurveColl = nullptr; + this->firstAncestorOrThisOfType( ensembleCurveColl ); if ( ensembleCurveColl ) { ensembleCurveColl->updateConnectedEditors(); @@ -422,12 +425,12 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* } else if ( changedField == &m_ensemble ) { - if ( m_ensemble() && ensembleCurveColl ) + if ( m_ensemble() && dataSourceSteppingObject() ) { caf::PdmPointer variantHandle = oldValue.value>(); RimSummaryCaseCollection* previousCollection = dynamic_cast( variantHandle.p() ); - for ( auto curveSet : ensembleCurveColl->curveSets() ) + for ( auto curveSet : dataSourceSteppingObject()->curveSets() ) { if ( curveSet->summaryCaseCollection() == previousCollection ) { @@ -450,24 +453,24 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* if ( isYAxisStepping() ) { auto adr = curve->summaryAddressY(); - updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr ); + RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr ); curve->setSummaryAddressY( adr ); } if ( isXAxisStepping() ) { auto adr = curve->summaryAddressX(); - updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr ); + RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr ); curve->setSummaryAddressX( adr ); } } - if ( ensembleCurveColl ) + if ( dataSourceSteppingObject() ) { - for ( auto curveSet : ensembleCurveColl->curveSets() ) + for ( auto curveSet : dataSourceSteppingObject()->curveSets() ) { auto adr = curveSet->summaryAddress(); - updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr ); + RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr ); curveSet->setSummaryAddress( adr ); } } @@ -513,24 +516,24 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* if ( isYAxisStepping() ) { RifEclipseSummaryAddress adr = curve->summaryAddressY(); - updateAddressIfMatching( oldValue, newValue, summaryCategoryToModify, &adr ); + RimDataSourceSteppingTools::updateAddressIfMatching( oldValue, newValue, summaryCategoryToModify, &adr ); curve->setSummaryAddressY( adr ); } if ( isXAxisStepping() ) { RifEclipseSummaryAddress adr = curve->summaryAddressX(); - updateAddressIfMatching( oldValue, newValue, summaryCategoryToModify, &adr ); + RimDataSourceSteppingTools::updateAddressIfMatching( oldValue, newValue, summaryCategoryToModify, &adr ); curve->setSummaryAddressX( adr ); } } - if ( ensembleCurveColl ) + if ( dataSourceSteppingObject() ) { - for ( auto curveSet : ensembleCurveColl->curveSets() ) + for ( auto curveSet : dataSourceSteppingObject()->curveSets() ) { auto adr = curveSet->summaryAddress(); - updateAddressIfMatching( oldValue, newValue, summaryCategoryToModify, &adr ); + RimDataSourceSteppingTools::updateAddressIfMatching( oldValue, newValue, summaryCategoryToModify, &adr ); curveSet->setSummaryAddress( adr ); } } @@ -542,12 +545,22 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* if ( triggerLoadDataAndUpdate ) { RimSummaryPlot* summaryPlot = nullptr; - this->firstAncestorOrThisOfTypeAsserted( summaryPlot ); + this->firstAncestorOrThisOfType( summaryPlot ); + if ( summaryPlot ) + { + summaryPlot->updatePlotTitle(); + summaryPlot->loadDataAndUpdate(); + summaryPlot->updateConnectedEditors(); + } - summaryPlot->updatePlotTitle(); - summaryPlot->loadDataAndUpdate(); - summaryPlot->updateConnectedEditors(); + RimSummaryMultiPlot* summaryMultiPlot = dynamic_cast( m_objectForSourceStepping.p() ); + if ( summaryMultiPlot ) + { + summaryMultiPlot->loadDataAndUpdate(); + } + RimEnsembleCurveSetCollection* ensembleCurveColl = nullptr; + this->firstAncestorOrThisOfType( ensembleCurveColl ); if ( ensembleCurveColl ) { ensembleCurveColl->updateConnectedEditors(); @@ -558,6 +571,8 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* { // Trigger update of curve collection (and summary toolbar in main window), as the visibility of combo // boxes might have been changed due to the updates in this function + RimSummaryCurveCollection* curveCollection = nullptr; + this->firstAncestorOrThisOfType( curveCollection ); if ( curveCollection ) { curveCollection->updateConnectedEditors(); @@ -617,43 +632,35 @@ std::set RimSummaryPlotSourceStepping::adressesForSour { std::set addressSet; + if ( dataSourceSteppingObject() ) { - RimEnsembleCurveSetCollection* ensembleCollection = nullptr; - this->firstAncestorOrThisOfType( ensembleCollection ); - if ( ensembleCollection ) + for ( auto curveSet : dataSourceSteppingObject()->curveSets() ) { - auto curveSets = ensembleCollection->curveSetsForSourceStepping(); - for ( const RimEnsembleCurveSet* curveSet : curveSets ) + if ( curveSet && curveSet->summaryCaseCollection() ) { - if ( curveSet && curveSet->summaryCaseCollection() ) - { - auto addresses = curveSet->summaryCaseCollection()->ensembleSummaryAddresses(); - addressSet.insert( addresses.begin(), addresses.end() ); - } + auto addresses = curveSet->summaryCaseCollection()->ensembleSummaryAddresses(); + addressSet.insert( addresses.begin(), addresses.end() ); } } - } - { - RimSummaryCurveCollection* curveCollection = nullptr; - this->firstAncestorOrThisOfType( curveCollection ); - if ( curveCollection ) + std::vector curves; + if ( dataSourceSteppingObject() ) + curves = dataSourceSteppingObject()->curvesForStepping( m_sourceSteppingType ); + + for ( auto curve : curves ) { - for ( auto curve : curveCollection->curvesForSourceStepping( m_sourceSteppingType ) ) - { - if ( !curve ) continue; + if ( !curve ) continue; - if ( isYAxisStepping() && curve->summaryCaseY() && curve->summaryCaseY()->summaryReader() ) - { - auto addresses = curve->summaryCaseY()->summaryReader()->allResultAddresses(); - addressSet.insert( addresses.begin(), addresses.end() ); - } + if ( isYAxisStepping() && curve->summaryCaseY() && curve->summaryCaseY()->summaryReader() ) + { + auto addresses = curve->summaryCaseY()->summaryReader()->allResultAddresses(); + addressSet.insert( addresses.begin(), addresses.end() ); + } - if ( isXAxisStepping() && curve->summaryCaseX() && curve->summaryCaseX()->summaryReader() ) - { - auto addresses = curve->summaryCaseX()->summaryReader()->allResultAddresses(); - addressSet.insert( addresses.begin(), addresses.end() ); - } + if ( isXAxisStepping() && curve->summaryCaseX() && curve->summaryCaseX()->summaryReader() ) + { + auto addresses = curve->summaryCaseX()->summaryReader()->allResultAddresses(); + addressSet.insert( addresses.begin(), addresses.end() ); } } } @@ -668,32 +675,27 @@ std::set RimSummaryPlotSourceStepping::addressesForCur { std::set addresses; - RimEnsembleCurveSetCollection* ensembleCollection = nullptr; - this->firstAncestorOrThisOfType( ensembleCollection ); - if ( ensembleCollection ) + if ( dataSourceSteppingObject() ) { - auto curveSets = ensembleCollection->curveSetsForSourceStepping(); - for ( const RimEnsembleCurveSet* curveSet : curveSets ) + for ( auto curveSet : dataSourceSteppingObject()->curveSets() ) { addresses.insert( curveSet->summaryAddress() ); } - } - RimSummaryCurveCollection* curveCollection = nullptr; - this->firstAncestorOrThisOfType( curveCollection ); - if ( curveCollection ) - { - auto curves = curveCollection->curvesForSourceStepping( m_sourceSteppingType ); - for ( auto c : curves ) + std::vector curves; + if ( dataSourceSteppingObject() ) + curves = dataSourceSteppingObject()->curvesForStepping( m_sourceSteppingType ); + + for ( auto curve : curves ) { if ( isYAxisStepping() ) { - addresses.insert( c->summaryAddressY() ); + addresses.insert( curve->summaryAddressY() ); } if ( isXAxisStepping() ) { - addresses.insert( c->summaryAddressX() ); + addresses.insert( curve->summaryAddressX() ); } } } @@ -708,12 +710,8 @@ std::set RimSummaryPlotSourceStepping::summaryCasesCurveCollect { std::set sumCases; - RimSummaryCurveCollection* curveCollection = nullptr; - this->firstAncestorOrThisOfType( curveCollection ); - - if ( !curveCollection ) return sumCases; - - auto curves = curveCollection->curvesForSourceStepping( m_sourceSteppingType ); + std::vector curves; + if ( dataSourceSteppingObject() ) curves = dataSourceSteppingObject()->curvesForStepping( m_sourceSteppingType ); for ( auto c : curves ) { if ( isYAxisStepping() ) @@ -900,20 +898,20 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi //-------------------------------------------------------------------------------------------------- std::set RimSummaryPlotSourceStepping::ensembleCollection() const { - std::set sumCases; - - RimEnsembleCurveSetCollection* curveCollection = nullptr; - this->firstAncestorOrThisOfType( curveCollection ); + std::set summaryCaseCollections; - if ( !curveCollection ) return sumCases; - - auto curves = curveCollection->curveSets(); - for ( auto c : curves ) + if ( dataSourceSteppingObject() ) { - sumCases.insert( c->summaryCaseCollection() ); + for ( auto curveSet : dataSourceSteppingObject()->curveSets() ) + { + if ( curveSet && curveSet->summaryCaseCollection() ) + { + summaryCaseCollections.insert( curveSet->summaryCaseCollection() ); + } + } } - return sumCases; + return summaryCaseCollections; } //-------------------------------------------------------------------------------------------------- @@ -921,9 +919,9 @@ std::set RimSummaryPlotSourceStepping::ensembleCollec //-------------------------------------------------------------------------------------------------- bool RimSummaryPlotSourceStepping::isXAxisStepping() const { - if ( m_sourceSteppingType == UNION_X_Y_AXIS ) return true; + if ( m_sourceSteppingType == RimSummaryDataSourceStepping::Axis::UNION_X_Y_AXIS ) return true; - if ( m_sourceSteppingType == X_AXIS ) return true; + if ( m_sourceSteppingType == RimSummaryDataSourceStepping::Axis::X_AXIS ) return true; return false; } @@ -933,31 +931,13 @@ bool RimSummaryPlotSourceStepping::isXAxisStepping() const //-------------------------------------------------------------------------------------------------- bool RimSummaryPlotSourceStepping::isYAxisStepping() const { - if ( m_sourceSteppingType == UNION_X_Y_AXIS ) return true; + if ( m_sourceSteppingType == RimSummaryDataSourceStepping::Axis::UNION_X_Y_AXIS ) return true; - if ( m_sourceSteppingType == Y_AXIS ) return true; + if ( m_sourceSteppingType == RimSummaryDataSourceStepping::Axis::Y_AXIS ) return true; return false; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiaSummaryCurveAnalyzer* RimSummaryPlotSourceStepping::analyzerForReader( RifSummaryReaderInterface* reader ) -{ - if ( !reader ) return nullptr; - - if ( m_curveAnalyzerForReader.first != reader ) - { - RiaSummaryCurveAnalyzer analyzer; - m_curveAnalyzerForReader = std::make_pair( reader, analyzer ); - } - - m_curveAnalyzerForReader.second.appendAddresses( reader->allResultAddresses() ); - - return &m_curveAnalyzerForReader.second; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -968,123 +948,6 @@ void RimSummaryPlotSourceStepping::modifyCurrentIndex( caf::PdmValueField* value RimDataSourceSteppingTools::modifyCurrentIndex( valueField, options, indexOffset ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimSummaryPlotSourceStepping::updateAddressIfMatching( const QVariant& oldValue, - const QVariant& newValue, - RifEclipseSummaryAddress::SummaryVarCategory category, - RifEclipseSummaryAddress* adr ) -{ - if ( !adr ) return false; - - if ( category == RifEclipseSummaryAddress::SUMMARY_REGION ) - { - int oldInt = oldValue.toInt(); - int newInt = newValue.toInt(); - - if ( adr->regionNumber() == oldInt ) - { - adr->setRegion( newInt ); - - return true; - } - } - else if ( category == RifEclipseSummaryAddress::SUMMARY_AQUIFER ) - { - int oldInt = oldValue.toInt(); - int newInt = newValue.toInt(); - - if ( adr->aquiferNumber() == oldInt ) - { - adr->setAquiferNumber( newInt ); - - return true; - } - } - else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ) - { - std::string oldString = oldValue.toString().toStdString(); - std::string newString = newValue.toString().toStdString(); - - if ( adr->wellGroupName() == oldString ) - { - adr->setWellGroupName( newString ); - - return true; - } - } - else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL ) - { - std::string oldString = oldValue.toString().toStdString(); - std::string newString = newValue.toString().toStdString(); - - if ( adr->wellName() == oldString ) - { - adr->setWellName( newString ); - - return true; - } - } - else if ( category == RifEclipseSummaryAddress::SUMMARY_BLOCK || - category == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION ) - { - std::string oldString = oldValue.toString().toStdString(); - std::string newString = newValue.toString().toStdString(); - if ( adr->blockAsString() == oldString ) - { - adr->setCellIjk( newString ); - - return true; - } - } - else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT ) - { - int oldInt = oldValue.toInt(); - int newInt = newValue.toInt(); - if ( adr->wellSegmentNumber() == oldInt ) - { - adr->setWellSegmentNumber( newInt ); - - return true; - } - } - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimSummaryPlotSourceStepping::updateHistoryAndSummaryQuantityIfMatching( const QVariant& oldValue, - const QVariant& newValue, - RifEclipseSummaryAddress* adr ) -{ - if ( !adr ) return false; - - std::string oldString = oldValue.toString().toStdString(); - std::string newString = newValue.toString().toStdString(); - - if ( adr->quantityName() == oldString ) - { - adr->setQuantityName( newString ); - - return true; - } - - std::string correspondingOldString = RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( oldString ); - std::string correspondingNewString = RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( newString ); - - if ( adr->quantityName() == correspondingOldString ) - { - adr->setQuantityName( correspondingNewString ); - - return true; - } - - return false; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1116,6 +979,14 @@ std::vector RimSummaryPlotSourceStepping::summaryCasesForSource return cases; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryDataSourceStepping* RimSummaryPlotSourceStepping::dataSourceSteppingObject() const +{ + return dynamic_cast( m_objectForSourceStepping.p() ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index f9bde2f3c5..ea5250a512 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -18,8 +18,7 @@ #pragma once -#include "RiaSummaryCurveAnalyzer.h" -#include "RifEclipseSummaryAddress.h" +#include "RimSummaryDataSourceStepping.h" #include "cafPdmField.h" #include "cafPdmObject.h" @@ -34,6 +33,7 @@ class RimSummaryCase; class RimSummaryCurve; class RifSummaryReaderInterface; class RimSummaryCaseCollection; +class RifEclipseSummaryAddress; //================================================================================================== /// @@ -42,18 +42,11 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject { CAF_PDM_HEADER_INIT; -public: - enum SourceSteppingType - { - Y_AXIS, - X_AXIS, - UNION_X_Y_AXIS - }; - public: RimSummaryPlotSourceStepping(); - void setSourceSteppingType( SourceSteppingType sourceSteppingType ); + void setSourceSteppingType( RimSummaryDataSourceStepping::Axis sourceSteppingType ); + void setSourceSteppingObject( caf::PdmObject* sourceObject ); void applyNextCase(); void applyPrevCase(); @@ -91,22 +84,15 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject bool isXAxisStepping() const; bool isYAxisStepping() const; - RiaSummaryCurveAnalyzer* analyzerForReader( RifSummaryReaderInterface* reader ); - void modifyCurrentIndex( caf::PdmValueField* valueField, int indexOffset ); - static bool updateAddressIfMatching( const QVariant& oldValue, - const QVariant& newValue, - RifEclipseSummaryAddress::SummaryVarCategory category, - RifEclipseSummaryAddress* adr ); - - static bool updateHistoryAndSummaryQuantityIfMatching( const QVariant& oldValue, - const QVariant& newValue, - RifEclipseSummaryAddress* adr ); - std::vector summaryCasesForSourceStepping(); + RimSummaryDataSourceStepping* dataSourceSteppingObject() const; + private: + caf::PdmPointer m_objectForSourceStepping; + caf::PdmPtrField m_summaryCase; caf::PdmPtrField m_ensemble; @@ -124,7 +110,5 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject caf::PdmField m_includeEnsembleCasesForCaseStepping; - SourceSteppingType m_sourceSteppingType; - - std::pair m_curveAnalyzerForReader; + RimSummaryDataSourceStepping::Axis m_sourceSteppingType; }; From 3c35244809f695fbca14895c86a3290443105b6b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 7 Jan 2022 08:31:52 +0100 Subject: [PATCH 064/406] #8420 Janitor: Remove empty parameters in initialization macros --- .../Application/RiaMemoryCleanup.cpp | 6 +- .../Application/RiaPreferences.cpp | 38 ++------- .../Application/RiaPreferencesSummary.cpp | 38 ++------- .../Application/RiaPreferencesSystem.cpp | 23 +---- .../Application/Tools/RiaRegressionTest.cpp | 26 +----- .../RicfCreateMultipleFractures.cpp | 5 +- .../CommandFileInterface/RicfExportMsw.cpp | 8 +- .../RicfExportProperty.cpp | 12 +-- .../RicfExportSimWellFractureCompletions.cpp | 21 +---- .../RicfExportVisibleCells.cpp | 13 +-- .../RicfExportWellPathCompletions.cpp | 59 +++---------- .../RicfSetExportFolder.cpp | 6 +- .../RicExportCompletionDataSettingsUi.cpp | 8 +- .../Commands/RicCreateEnsembleSurfaceUi.cpp | 5 +- .../Commands/RicCreateEnsembleWellLogUi.cpp | 5 +- ...icPasteAsciiDataToSummaryPlotFeatureUi.cpp | 10 +-- .../ViewLink/RicLinkVisibleViewsFeatureUi.cpp | 2 +- .../FileInterface/RifReaderSettings.cpp | 5 +- .../AnalysisPlots/RimAnalysisPlot.cpp | 2 +- .../RimAnalysisPlotCollection.cpp | 2 +- .../RimPlotDataFilterCollection.cpp | 2 +- .../AnalysisPlots/RimPlotDataFilterItem.cpp | 2 +- .../Annotations/RimAnnotationCollection.cpp | 2 +- .../RimAnnotationCollectionBase.cpp | 2 +- .../RimAnnotationGroupCollection.cpp | 2 +- .../RimAnnotationInViewCollection.cpp | 2 +- .../RimAnnotationLineAppearance.cpp | 4 +- .../RimAnnotationTextAppearance.cpp | 10 +-- .../Annotations/RimPolylinesAnnotation.cpp | 2 +- .../RimPolylinesAnnotationInView.cpp | 2 +- .../RimPolylinesFromFileAnnotation.cpp | 2 +- .../RimPolylinesFromFileAnnotationInView.cpp | 4 +- .../Annotations/RimReachCircleAnnotation.cpp | 2 +- .../RimReachCircleAnnotationInView.cpp | 2 +- .../Annotations/RimTextAnnotation.cpp | 2 +- .../Annotations/RimTextAnnotationInView.cpp | 2 +- .../RimUserDefinedPolylinesAnnotation.cpp | 2 +- ...imUserDefinedPolylinesAnnotationInView.cpp | 4 +- .../CellFilters/RimCellFilterCollection.cpp | 2 +- .../CellFilters/RimCellRangeFilter.cpp | 2 +- .../CellFilters/RimEclipsePropertyFilter.cpp | 2 +- .../RimEclipsePropertyFilterCollection.cpp | 2 +- .../CellFilters/RimGeoMechPropertyFilter.cpp | 2 +- .../RimGeoMechPropertyFilterCollection.cpp | 2 +- .../CellFilters/RimPolygonFilter.cpp | 2 +- .../CellFilters/RimUserDefinedFilter.cpp | 2 +- .../Rim3dWellLogCurveCollection.cpp | 2 +- .../RimCompletionTemplateCollection.cpp | 2 +- .../RimEllipseFractureTemplate.cpp | 2 +- .../RimEnsembleFractureStatistics.cpp | 10 +-- ...imEnsembleFractureStatisticsCollection.cpp | 2 +- .../Completions/RimFishbones.cpp | 49 ++--------- .../Completions/RimFishbonesCollection.cpp | 2 +- .../Completions/RimFracture.cpp | 21 +---- .../Completions/RimFractureTemplate.cpp | 25 ++---- .../RimFractureTemplateCollection.cpp | 7 +- .../RimMswCompletionParameters.cpp | 18 +--- .../Completions/RimMultipleValveLocations.cpp | 12 +-- .../RimNonDarcyPerforationParameters.cpp | 20 +---- .../Completions/RimPerforationCollection.cpp | 2 +- .../Completions/RimPerforationInterval.cpp | 2 +- .../Completions/RimSimWellFracture.cpp | 2 +- .../RimSimWellFractureCollection.cpp | 2 +- .../RimStimPlanFractureTemplate.cpp | 12 +-- .../Completions/RimValveTemplate.cpp | 7 +- .../RimValveTemplateCollection.cpp | 2 +- .../Completions/RimWellPathAicdParameters.cpp | 50 +++-------- .../RimWellPathCompletionSettings.cpp | 2 +- .../Completions/RimWellPathCompletions.cpp | 10 +-- .../Completions/RimWellPathFracture.cpp | 2 +- .../RimWellPathFractureCollection.cpp | 2 +- .../Completions/RimWellPathValve.cpp | 2 +- .../RimAbstractCorrelationPlot.cpp | 2 +- .../RimCorrelationMatrixPlot.cpp | 7 +- .../CorrelationPlots/RimCorrelationPlot.cpp | 7 +- .../RimCorrelationPlotCollection.cpp | 2 +- .../RimCorrelationReportPlot.cpp | 2 +- .../RimParameterResultCrossPlot.cpp | 2 +- .../Faults/RimFaultInView.cpp | 2 +- .../Faults/RimFaultInViewCollection.cpp | 2 +- .../Faults/RimFaultRAPostprocSettings.cpp | 2 +- .../Faults/RimFaultRAPreprocSettings.cpp | 2 +- .../Faults/RimFaultRASettings.cpp | 11 +-- .../Flow/RimFlowCharacteristicsPlot.cpp | 2 +- .../Flow/RimFlowPlotCollection.cpp | 2 +- .../RimTofAccumulatedPhaseFractionsPlot.cpp | 2 +- .../Flow/RimTotalWellAllocationPlot.cpp | 2 +- .../Flow/RimWellAllocationPlot.cpp | 2 +- .../Flow/RimWellAllocationPlotLegend.cpp | 2 +- .../Flow/RimWellDistributionPlot.cpp | 5 +- .../RimWellDistributionPlotCollection.cpp | 15 +--- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 2 +- .../Flow/RimWellRftEnsembleCurveSet.cpp | 2 +- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 2 +- .../GeoMech/RimGeoMechCase.cpp | 13 +-- .../RimGeoMechContourMapProjection.cpp | 7 +- .../RimGeoMechContourMapViewCollection.cpp | 4 +- .../GeoMech/RimGeoMechModels.cpp | 2 +- .../GeoMech/RimGeoMechPart.cpp | 2 +- .../GeoMech/RimGeoMechPartCollection.cpp | 2 +- .../GeoMech/RimGeoMechResultDefinition.cpp | 15 +--- .../GeoMech/RimGeoMechView.cpp | 2 +- .../GridCrossPlots/RimGridCrossPlot.cpp | 2 +- .../RimGridCrossPlotCollection.cpp | 2 +- .../GridCrossPlots/RimGridCrossPlotCurve.cpp | 2 +- .../RimGridCrossPlotDataSet.cpp | 2 +- .../RimSaturationPressurePlot.cpp | 2 +- .../RimSaturationPressurePlotCollection.cpp | 2 +- .../Intersections/RimBoxIntersection.cpp | 7 +- .../RimExtrudedCurveIntersection.cpp | 2 +- .../RimIntersectionCollection.cpp | 2 +- .../RimIntersectionResultDefinition.cpp | 2 +- ...ntersectionResultsDefinitionCollection.cpp | 2 +- .../Measurement/RimMeasurement.cpp | 2 +- .../Parameters/RimGenericParameter.cpp | 2 +- .../Parameters/RimParameterGroup.cpp | 2 +- .../Parameters/RimParameterList.cpp | 2 +- .../RimPlotTemplateFolderItem.cpp | 2 +- .../ProcessControl/RimProcess.cpp | 2 +- .../Rim2dIntersectionView.cpp | 4 +- .../Rim2dIntersectionViewCollection.cpp | 11 +-- .../Rim3dOverlayInfoConfig.cpp | 2 +- .../ProjectDataModel/Rim3dView.cpp | 8 +- .../RimAdvancedSnapshotExportDefinition.cpp | 7 +- .../ProjectDataModel/RimCase.cpp | 4 +- .../ProjectDataModel/RimCellEdgeColors.cpp | 11 +-- .../ProjectDataModel/RimColorLegend.cpp | 2 +- .../RimColorLegendCollection.cpp | 13 +-- .../RimContourMapProjection.cpp | 2 +- .../RimCustomObjectiveFunction.cpp | 2 +- .../RimCustomObjectiveFunctionCollection.cpp | 2 +- .../RimCustomObjectiveFunctionWeight.cpp | 2 +- .../RimEclipseCaseCollection.cpp | 2 +- .../RimEclipseContourMapProjection.cpp | 2 +- .../RimEclipseContourMapViewCollection.cpp | 4 +- .../RimEclipseFaultColors.cpp | 9 +- .../ProjectDataModel/RimEclipseInputCase.cpp | 2 +- .../RimEclipseInputProperty.cpp | 2 +- .../RimEclipseInputPropertyCollection.cpp | 2 +- .../RimEclipseResultDefinition.cpp | 26 +----- .../RimEclipseStatisticsCase.cpp | 36 ++------ .../ProjectDataModel/RimEclipseView.cpp | 13 +-- .../RimElementVectorResult.cpp | 2 +- ...sembleFractureStatisticsPlotCollection.cpp | 2 +- .../RimEquilibriumAxisAnnotation.cpp | 2 +- .../ProjectDataModel/RimFormationNames.cpp | 2 +- .../RimFormationNamesCollection.cpp | 2 +- .../ProjectDataModel/RimGridCollection.cpp | 6 +- .../RimGridStatisticsPlotCollection.cpp | 2 +- .../RimGridTimeHistoryCurve.cpp | 7 +- .../RimMudWeightWindowParameters.cpp | 5 +- .../ProjectDataModel/RimMultiPlot.cpp | 2 +- .../RimMultiPlotCollection.cpp | 2 +- .../ProjectDataModel/RimMultipleLocations.cpp | 7 +- .../RimObservedDataCollection.cpp | 2 +- .../RimObservedFmuRftData.cpp | 2 +- .../ProjectDataModel/RimOilField.cpp | 10 +-- .../RimPlotAxisAnnotation.cpp | 2 +- .../RimPlotAxisProperties.cpp | 40 ++++----- .../ProjectDataModel/RimPlotCurve.cpp | 10 +-- .../ProjectDataModel/RimPltPlotCollection.cpp | 2 +- .../ProjectDataModel/RimProject.cpp | 6 +- .../RimRegularLegendConfig.cpp | 15 +--- .../RimReservoirCellResultsStorage.cpp | 5 +- .../ProjectDataModel/RimRftPlotCollection.cpp | 2 +- .../ProjectDataModel/RimScriptCollection.cpp | 2 +- .../RimSimWellInViewCollection.cpp | 32 ++----- .../RimStackablePlotCurve.cpp | 2 +- .../ProjectDataModel/RimStatisticsPlot.cpp | 5 +- .../ProjectDataModel/RimStimPlanColors.cpp | 2 +- .../RimStimPlanLegendConfig.cpp | 2 +- .../RimSummaryCalculationCollection.cpp | 2 +- .../RimSummaryCalculationVariable.cpp | 2 +- .../RimSurfaceIntersectionBand.cpp | 2 +- .../RimSurfaceIntersectionCurve.cpp | 2 +- .../ProjectDataModel/RimTensorResults.cpp | 2 +- .../RimTernaryLegendConfig.cpp | 2 +- .../RimTimeAxisAnnotation.cpp | 2 +- .../ProjectDataModel/RimVfpPlot.cpp | 10 +-- .../ProjectDataModel/RimVfpPlotCollection.cpp | 2 +- .../ProjectDataModel/RimViewController.cpp | 24 +++--- .../ProjectDataModel/RimViewLinker.cpp | 10 +-- .../RimViewLinkerCollection.cpp | 2 +- .../RimVirtualPerforationResults.cpp | 2 +- .../ProjectDataModel/RimWbsParameters.cpp | 2 +- .../RimWellBoreStabilityPlot.cpp | 5 +- .../RimElasticPropertyScalingCollection.cpp | 7 +- .../StimPlanModel/RimStimPlanModel.cpp | 37 ++------ .../RimStimPlanModelPlotCollection.cpp | 2 +- .../RimStimPlanModelTemplate.cpp | 85 +++---------------- .../RimStimPlanModelTemplateCollection.cpp | 11 +-- .../Streamlines/RimStreamline.cpp | 2 +- .../RimStreamlineInViewCollection.cpp | 2 +- .../Summary/RimAsciiDataCurve.cpp | 2 +- .../Summary/RimCalculatedSummaryCase.cpp | 2 +- .../Summary/RimCsvUserData.cpp | 2 +- .../RimDerivedEnsembleCaseCollection.cpp | 2 +- .../Summary/RimDerivedSummaryCase.cpp | 2 +- .../Summary/RimEnsembleCurveFilter.cpp | 2 +- .../RimEnsembleCurveFilterCollection.cpp | 2 +- .../Summary/RimEnsembleCurveSet.cpp | 2 +- .../Summary/RimEnsembleCurveSetCollection.cpp | 2 +- .../Summary/RimEnsembleStatistics.cpp | 2 +- .../Summary/RimObjectiveFunction.cpp | 13 +-- .../Summary/RimObservedEclipseUserData.cpp | 2 +- .../Summary/RimObservedSummaryData.cpp | 5 +- .../Summary/RimSummaryCaseCollection.cpp | 2 +- .../Summary/RimSummaryCaseMainCollection.cpp | 2 +- .../Summary/RimSummaryCrossPlot.cpp | 2 +- .../Summary/RimSummaryCrossPlotCollection.cpp | 2 +- .../Summary/RimSummaryCurve.cpp | 2 +- .../Summary/RimSummaryCurveCollection.cpp | 2 +- .../Summary/RimSummaryMultiPlot.cpp | 2 +- .../Summary/RimSummaryObservedDataFile.cpp | 2 +- .../Summary/RimSummaryPlotCollection.cpp | 2 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 5 +- .../Summary/RimSummaryTimeAxisProperties.cpp | 2 +- .../Surfaces/RimEnsembleStatisticsSurface.cpp | 2 +- .../Surfaces/RimEnsembleSurface.cpp | 2 +- .../Surfaces/RimFileSurface.cpp | 2 +- .../Surfaces/RimGridCaseSurface.cpp | 2 +- .../ProjectDataModel/Surfaces/RimSurface.cpp | 2 +- .../Surfaces/RimSurfaceCollection.cpp | 2 +- .../Surfaces/RimSurfaceInView.cpp | 2 +- .../Surfaces/RimSurfaceInViewCollection.cpp | 2 +- .../Surfaces/RimSurfaceResultDefinition.cpp | 2 +- .../WellLog/Rim3dWellLogCurve.cpp | 2 +- .../WellLog/Rim3dWellLogExtractionCurve.cpp | 2 +- .../WellLog/Rim3dWellLogFileCurve.cpp | 2 +- .../WellLog/Rim3dWellLogRftCurve.cpp | 2 +- .../WellLog/RimEnsembleWellLogCurveSet.cpp | 2 +- .../WellLog/RimEnsembleWellLogsCollection.cpp | 2 +- .../WellLog/RimWellLogCurve.cpp | 2 +- .../WellLog/RimWellLogExtractionCurve.cpp | 2 +- .../WellLog/RimWellLogFile.cpp | 7 +- .../WellLog/RimWellLogFileCurve.cpp | 2 +- .../WellLog/RimWellLogPlotCollection.cpp | 2 +- .../WellLog/RimWellLogRftCurve.cpp | 2 +- .../WellLog/RimWellLogTrack.cpp | 2 +- .../WellLog/RimWellLogWbsCurve.cpp | 2 +- .../WellMeasurement/RimWellMeasurement.cpp | 2 +- .../RimWellMeasurementCollection.cpp | 2 +- .../RimWellMeasurementCurve.cpp | 2 +- .../RimWellMeasurementFilePath.cpp | 2 +- .../RimWellMeasurementInView.cpp | 2 +- .../RimWellMeasurementInViewCollection.cpp | 2 +- .../WellPath/RimFileWellPath.cpp | 5 +- .../WellPath/RimModeledWellPath.cpp | 5 +- .../WellPath/RimWellIASettings.cpp | 6 +- .../WellPath/RimWellIASettingsCollection.cpp | 2 +- .../RimWellPathAttributeCollection.cpp | 2 +- .../WellPath/RimWellPathCollection.cpp | 5 +- .../WellPath/RimWellPathGeometryDef.cpp | 25 ++---- .../WellPath/RimWellPathGroup.cpp | 2 +- .../ProjectDataModel/cafTreeNode.cpp | 6 +- 255 files changed, 451 insertions(+), 1096 deletions(-) diff --git a/ApplicationLibCode/Application/RiaMemoryCleanup.cpp b/ApplicationLibCode/Application/RiaMemoryCleanup.cpp index ae2b4f0af2..ae4da45bb3 100644 --- a/ApplicationLibCode/Application/RiaMemoryCleanup.cpp +++ b/ApplicationLibCode/Application/RiaMemoryCleanup.cpp @@ -47,14 +47,14 @@ CAF_PDM_SOURCE_INIT( RiaMemoryCleanup, "RiaMemoryCleanup" ); RiaMemoryCleanup::RiaMemoryCleanup() { // clang-format off - CAF_PDM_InitFieldNoDefault(&m_case, "DataCase", "Case", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_case, "DataCase", "Case"); m_case = nullptr; - CAF_PDM_InitFieldNoDefault(&m_resultsToDelete, "ResultsToDelete", "Results In Memory", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_resultsToDelete, "ResultsToDelete", "Results In Memory"); m_resultsToDelete.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::TOP); m_resultsToDelete.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); - CAF_PDM_InitFieldNoDefault(&m_performDelete, "ClearSelectedData", "", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_performDelete, "ClearSelectedData", ""); caf::PdmUiPushButtonEditor::configureEditorForField(&m_performDelete); // clang-format on } diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index bf786e23ac..b658098346 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -81,10 +81,7 @@ RiaPreferences::RiaPreferences() CAF_PDM_InitField( &m_navigationPolicy, "navigationPolicy", caf::AppEnum( RiaDefines::RINavigationPolicy::NAVIGATION_POLICY_RMS ), - "Navigation Mode", - "", - "", - "" ); + "Navigation Mode" ); CAF_PDM_InitField( &enableGrpcServer, "enableGrpcServer", @@ -122,10 +119,7 @@ RiaPreferences::RiaPreferences() CAF_PDM_InitField( &octaveShowHeaderInfoWhenExecutingScripts, "octaveShowHeaderInfoWhenExecutingScripts", false, - "Show Text Header When Executing Scripts", - "", - "", - "" ); + "Show Text Header When Executing Scripts" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &octaveShowHeaderInfoWhenExecutingScripts ); CAF_PDM_InitField( &m_pythonExecutable, "pythonExecutable", QString( "python" ), "Python Executable Location" ); @@ -137,20 +131,11 @@ RiaPreferences::RiaPreferences() ssihubAddress.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); CAF_PDM_InitFieldNoDefault( &m_defaultMeshModeType, "defaultMeshModeType", "Show Grid Lines" ); - CAF_PDM_InitField( &defaultGridLineColors, - "defaultGridLineColors", - RiaColorTables::defaultGridLineColor(), - "Mesh Color", - "", - "", - "" ); + CAF_PDM_InitField( &defaultGridLineColors, "defaultGridLineColors", RiaColorTables::defaultGridLineColor(), "Mesh Color" ); CAF_PDM_InitField( &defaultFaultGridLineColors, "defaultFaultGridLineColors", RiaColorTables::defaultFaultLineColor(), - "Mesh Color Along Faults", - "", - "", - "" ); + "Mesh Color Along Faults" ); CAF_PDM_InitField( &defaultWellLabelColor, "defaultWellLableColor", RiaColorTables::defaultWellLabelColor(), @@ -204,19 +189,13 @@ RiaPreferences::RiaPreferences() CAF_PDM_InitField( &holoLensDisableCertificateVerification, "holoLensDisableCertificateVerification", false, - "Disable SSL Certificate Verification (HoloLens)", - "", - "", - "" ); + "Disable SSL Certificate Verification (HoloLens)" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &holoLensDisableCertificateVerification ); CAF_PDM_InitField( &csvTextExportFieldSeparator, "csvTextExportFieldSeparator", QString( "," ), - "CSV Text Export Field Separator", - "", - "", - "" ); + "CSV Text Export Field Separator" ); CAF_PDM_InitFieldNoDefault( &m_readerSettings, "readerSettings", "Reader Settings" ); m_readerSettings = new RifReaderSettings; @@ -236,10 +215,7 @@ RiaPreferences::RiaPreferences() CAF_PDM_InitField( &m_searchPlotTemplateFoldersRecursively, "SearchPlotTemplateFoldersRecursively", true, - "Search Plot Templates Recursively", - "", - "", - "" ); + "Search Plot Templates Recursively" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_searchPlotTemplateFoldersRecursively ); CAF_PDM_InitFieldNoDefault( &m_defaultPlotTemplate, "defaultPlotTemplate", "Default Plot Template" ); diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp index 2f9bab865d..c3f3ff2c9b 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp @@ -73,32 +73,20 @@ RiaPreferencesSummary::RiaPreferencesSummary() CAF_PDM_InitField( &m_summaryImportMode, "summaryImportMode", SummaryRestartFilesImportModeType( RiaPreferencesSummary::SummaryRestartFilesImportMode::IMPORT ), - "Default Summary Import Option", - "", - "", - "" ); + "Default Summary Import Option" ); CAF_PDM_InitField( &m_gridImportMode, "gridImportMode", SummaryRestartFilesImportModeType( RiaPreferencesSummary::SummaryRestartFilesImportMode::NOT_IMPORT ), - "Default Grid Import Option", - "", - "", - "" ); + "Default Grid Import Option" ); CAF_PDM_InitField( &m_summaryEnsembleImportMode, "summaryEnsembleImportMode", SummaryRestartFilesImportModeType( RiaPreferencesSummary::SummaryRestartFilesImportMode::IMPORT ), - "Default Ensemble Summary Import Option", - "", - "", - "" ); + "Default Ensemble Summary Import Option" ); CAF_PDM_InitField( &m_defaultSummaryHistoryCurveStyle, "defaultSummaryHistoryCurveStyle", SummaryHistoryCurveStyleModeType( RiaPreferencesSummary::SummaryHistoryCurveStyleMode::SYMBOLS ), - "Default Curve Style for History Vectors", - "", - "", - "" ); + "Default Curve Style for History Vectors" ); CAF_PDM_InitField( &m_defaultSummaryCurvesTextFilter, "defaultSummaryCurvesTextFilter", QString( "FOPT" ), @@ -134,32 +122,20 @@ RiaPreferencesSummary::RiaPreferencesSummary() "" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_createH5SummaryDataFile ); - CAF_PDM_InitField( &m_createH5SummaryFileThreadCount, - "createH5SummaryFileThreadCount", - 1, - "h5 Summary Export Thread Count", - "", - "", - "" ); + CAF_PDM_InitField( &m_createH5SummaryFileThreadCount, "createH5SummaryFileThreadCount", 1, "h5 Summary Export Thread Count" ); CAF_PDM_InitFieldNoDefault( &m_summaryReader, "summaryReaderType_v01", "File Format" ); CAF_PDM_InitField( &m_showSummaryTimeAsLongString, "showSummaryTimeAsLongString", false, - "Show resample time text as long time text (2010-11-21 23:15:00)", - "", - "", - "" ); + "Show resample time text as long time text (2010-11-21 23:15:00)" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showSummaryTimeAsLongString ); CAF_PDM_InitField( &m_useMultipleThreadsWhenLoadingSummaryCases, "useMultipleThreadsWhenLoadingSummaryCases", true, - "Use Multiple Threads for Import of Summary Files", - "", - "", - "" ); + "Use Multiple Threads for Import of Summary Files" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useMultipleThreadsWhenLoadingSummaryCases ); } diff --git a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp index e3c9944e07..869c532524 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp @@ -56,10 +56,7 @@ RiaPreferencesSystem::RiaPreferencesSystem() CAF_PDM_InitField( &m_appendFieldKeywordToToolTipText, "appendFieldKeywordToToolTipText", false, - "Show Field Keyword in ToolTip", - "", - "", - "" ); + "Show Field Keyword in ToolTip" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_appendFieldKeywordToToolTipText ); CAF_PDM_InitField( &m_showViewIdInProjectTree, "showViewIdInTree", false, "Show View Id in Project Tree" ); @@ -71,23 +68,14 @@ RiaPreferencesSystem::RiaPreferencesSystem() CAF_PDM_InitField( &m_includeFractureDebugInfoFile, "includeFractureDebugInfoFile", false, - "Include Fracture Debug Info for Completion Export", - "", - "", - "" ); + "Include Fracture Debug Info for Completion Export" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_includeFractureDebugInfoFile ); CAF_PDM_InitFieldNoDefault( &m_holoLensExportFolder, "holoLensExportFolder", "HoloLens Export Folder" ); m_holoLensExportFolder.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_holoLensExportFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_showProjectChangedDialog, - "showProjectChangedDialog", - true, - "Show 'Project has changed' dialog", - "", - "", - "" ); + CAF_PDM_InitField( &m_showProjectChangedDialog, "showProjectChangedDialog", true, "Show 'Project has changed' dialog" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showProjectChangedDialog ); CAF_PDM_InitField( &m_showProgressBar, "showProgressBar", true, "Show Progress Bar" ); @@ -98,10 +86,7 @@ RiaPreferencesSystem::RiaPreferencesSystem() CAF_PDM_InitField( &m_eclipseReaderMode, "eclipseReaderMode", EclipseTextFileReaderModeType( RiaPreferencesSystem::EclipseTextFileReaderMode::FILE ), - "Eclipse Text File Import mode (GRDECL)", - "", - "", - "" ); + "Eclipse Text File Import mode (GRDECL)" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp index 035cd37926..2370946cb6 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp @@ -57,13 +57,7 @@ RiaRegressionTest::RiaRegressionTest( void ) regressionTestFolder.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); CAF_PDM_InitField( &showInteractiveDiffImages, "showInteractiveDiffImages", false, "Interactive Diff Images" ); - CAF_PDM_InitField( &useOpenMPForGeometryCreation, - "useOpenMPForGeometryCreation", - true, - "Use OpenMP For Geometry Creation", - "", - "", - "" ); + CAF_PDM_InitField( &useOpenMPForGeometryCreation, "useOpenMPForGeometryCreation", true, "Use OpenMP For Geometry Creation" ); CAF_PDM_InitField( &openReportInBrowser, "openReportInBrowser", false, "Open Generated Report in Browser" ); @@ -76,21 +70,9 @@ RiaRegressionTest::RiaRegressionTest( void ) "" ); testFilter.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &appendTestsAfterTestFilter, - "appendTestsAfterTestFilter", - false, - "Append All Tests After Test Filter", - "", - "", - "" ); - - CAF_PDM_InitField( &invalidateExternalFilePaths, - "invalidateExternalFilePaths", - false, - "Invalidate External File Paths", - "", - "", - "" ); + CAF_PDM_InitField( &appendTestsAfterTestFilter, "appendTestsAfterTestFilter", false, "Append All Tests After Test Filter" ); + + CAF_PDM_InitField( &invalidateExternalFilePaths, "invalidateExternalFilePaths", false, "Invalidate External File Paths" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfCreateMultipleFractures.cpp b/ApplicationLibCode/CommandFileInterface/RicfCreateMultipleFractures.cpp index 0408c7c57a..ac5b20381e 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfCreateMultipleFractures.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfCreateMultipleFractures.cpp @@ -69,10 +69,7 @@ RicfCreateMultipleFractures::RicfCreateMultipleFractures() CAF_PDM_InitScriptableField( &m_action, "action", caf::AppEnum( MultipleFractures::Action::APPEND_FRACTURES ), - "Action", - "", - "", - "" ); + "Action" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportMsw.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportMsw.cpp index 973fb1a09e..fe7a6f9572 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportMsw.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportMsw.cpp @@ -50,13 +50,7 @@ RicfExportMsw::RicfExportMsw() CAF_PDM_InitScriptableField( &m_includePerforations, "includePerforations", true, "Include Perforations" ); CAF_PDM_InitScriptableField( &m_includeFishbones, "includeFishbones", true, "Include Fishbones" ); CAF_PDM_InitScriptableField( &m_includeFractures, "includeFractures", true, "Include Fractures" ); - CAF_PDM_InitScriptableField( &m_fileSplit, - "fileSplit", - RicExportCompletionDataSettingsUi::ExportSplitType(), - "File Split", - "", - "", - "" ); + CAF_PDM_InitScriptableField( &m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportProperty.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportProperty.cpp index 1e3902c181..778b593672 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportProperty.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportProperty.cpp @@ -47,12 +47,12 @@ CAF_PDM_SOURCE_INIT( RicfExportProperty, "exportProperty" ); RicfExportProperty::RicfExportProperty() { // clang-format off - CAF_PDM_InitScriptableField(&m_caseId, "caseId", -1, "Case ID", "", "", ""); - CAF_PDM_InitScriptableField(&m_timeStepIndex, "timeStep", -1, "Time Step Index", "", "", ""); - CAF_PDM_InitScriptableField(&m_propertyName, "property", QString(), "Property Name", "", "", ""); - CAF_PDM_InitScriptableField(&m_eclipseKeyword, "eclipseKeyword", QString(), "Eclipse Keyword", "", "", ""); - CAF_PDM_InitScriptableField(&m_undefinedValue, "undefinedValue", 0.0, "Undefined Value", "", "", ""); - CAF_PDM_InitScriptableField(&m_exportFileName, "exportFile", QString(), "Export FileName", "", "", ""); + CAF_PDM_InitScriptableField(&m_caseId, "caseId", -1, "Case ID"); + CAF_PDM_InitScriptableField(&m_timeStepIndex, "timeStep", -1, "Time Step Index"); + CAF_PDM_InitScriptableField(&m_propertyName, "property", QString(), "Property Name"); + CAF_PDM_InitScriptableField(&m_eclipseKeyword, "eclipseKeyword", QString(), "Eclipse Keyword"); + CAF_PDM_InitScriptableField(&m_undefinedValue, "undefinedValue", 0.0, "Undefined Value"); + CAF_PDM_InitScriptableField(&m_exportFileName, "exportFile", QString(), "Export FileName"); // clang-format on } diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp index 471d41d739..393605dbad 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportSimWellFractureCompletions.cpp @@ -50,27 +50,12 @@ RicfExportSimWellFractureCompletions::RicfExportSimWellFractureCompletions() CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View ID" ); CAF_PDM_InitScriptableField( &m_viewName, "viewName", QString( "" ), "View Name" ); CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", -1, "Time Step Index" ); - CAF_PDM_InitScriptableField( &m_simWellNames, - "simulationWellNames", - std::vector(), - "Simulation Well Names", - "", - "", - "" ); - CAF_PDM_InitScriptableField( &m_fileSplit, - "fileSplit", - RicExportCompletionDataSettingsUi::ExportSplitType(), - "File Split", - "", - "", - "" ); + CAF_PDM_InitScriptableField( &m_simWellNames, "simulationWellNames", std::vector(), "Simulation Well Names" ); + CAF_PDM_InitScriptableField( &m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split" ); CAF_PDM_InitScriptableField( &m_compdatExport, "compdatExport", RicExportCompletionDataSettingsUi::CompdatExportType(), - "Compdat Export", - "", - "", - "" ); + "Compdat Export" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportVisibleCells.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportVisibleCells.cpp index 7855392475..701dd7bc0e 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportVisibleCells.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportVisibleCells.cpp @@ -69,17 +69,8 @@ RicfExportVisibleCells::RicfExportVisibleCells() CAF_PDM_InitScriptableField( &m_exportKeyword, "exportKeyword", caf::AppEnum(), - "Export Keyword", - "", - "", - "" ); - CAF_PDM_InitScriptableField( &m_visibleActiveCellsValue, - "visibleActiveCellsValue", - 1, - "Visible Active Cells Value", - "", - "", - "" ); + "Export Keyword" ); + CAF_PDM_InitScriptableField( &m_visibleActiveCellsValue, "visibleActiveCellsValue", 1, "Visible Active Cells Value" ); CAF_PDM_InitScriptableField( &m_hiddenActiveCellsValue, "hiddenActiveCellsValue", 0, "Hidden Active Cells Value" ); CAF_PDM_InitScriptableField( &m_inactiveCellsValue, "inactiveCellsValue", 0, "Inactive Cells Value" ); } diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.cpp index f0f10d25f6..35f319d2d0 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportWellPathCompletions.cpp @@ -47,27 +47,15 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions() CAF_PDM_InitScriptableField( &m_timeStep, "timeStep", -1, "Time Step Index" ); CAF_PDM_InitScriptableField( &m_wellPathNames, "wellPathNames", std::vector(), "Well Path Names" ); - CAF_PDM_InitScriptableField( &m_fileSplit, - "fileSplit", - RicExportCompletionDataSettingsUi::ExportSplitType(), - "File Split", - "", - "", - "" ); + CAF_PDM_InitScriptableField( &m_fileSplit, "fileSplit", RicExportCompletionDataSettingsUi::ExportSplitType(), "File Split" ); CAF_PDM_InitScriptableField( &m_compdatExport, "compdatExport", RicExportCompletionDataSettingsUi::CompdatExportType(), - "Compdat Export", - "", - "", - "" ); + "Compdat Export" ); CAF_PDM_InitScriptableField( &m_combinationMode, "combinationMode", RicExportCompletionDataSettingsUi::CombinationModeType(), - "Combination Mode", - "", - "", - "" ); + "Combination Mode" ); CAF_PDM_InitScriptableField( &m_includeMsw, "includeMsw", true, "Export Multi Segment Well Model" ); CAF_PDM_InitScriptableField( &m_useLateralNTG, "useNtgHorizontally", false, "Use NTG Horizontally" ); @@ -78,47 +66,20 @@ RicfExportWellPathCompletions::RicfExportWellPathCompletions() CAF_PDM_InitScriptableField( &m_excludeMainBoreForFishbones, "excludeMainBoreForFishbones", false, - "Exclude Main Bore for Fishbones", - "", - "", - "" ); + "Exclude Main Bore for Fishbones" ); - CAF_PDM_InitScriptableField( &m_performTransScaling, - "performTransScaling", - false, - "Perform Transmissibility Scaling", - "", - "", - "" ); + CAF_PDM_InitScriptableField( &m_performTransScaling, "performTransScaling", false, "Perform Transmissibility Scaling" ); CAF_PDM_InitScriptableField( &m_transScalingTimeStep, "transScalingTimeStep", 0, - "Transmissibility Scaling Pressure Time Step", - "", - "", - "" ); + "Transmissibility Scaling Pressure Time Step" ); CAF_PDM_InitScriptableField( &m_transScalingInitialWBHP, "transScalingWBHPFromSummary", RicExportCompletionDataSettingsUi::TransScalingWBHPSource(), - "Transmissibility Scaling WBHP from summary", - "", - "", - "" ); - CAF_PDM_InitScriptableField( &m_transScalingWBHP, - "transScalingWBHP", - 200.0, - "Transmissibility Scaling Constant WBHP Value", - "", - "", - "" ); - - CAF_PDM_InitScriptableField( &m_exportDataSourceAsComments, - "exportComments", - true, - "Export Data Source as Comments", - "", - "", - "" ); + "Transmissibility Scaling WBHP from summary" ); + CAF_PDM_InitScriptableField( &m_transScalingWBHP, "transScalingWBHP", 200.0, "Transmissibility Scaling Constant WBHP Value" ); + + CAF_PDM_InitScriptableField( &m_exportDataSourceAsComments, "exportComments", true, "Export Data Source as Comments" ); CAF_PDM_InitScriptableField( &m_exportWelspec, "exportWelspec", true, "Export WELSPEC keyword" ); CAF_PDM_InitScriptableField( &m_customFileName, "customFileName", QString(), "Custom Filename" ); } diff --git a/ApplicationLibCode/CommandFileInterface/RicfSetExportFolder.cpp b/ApplicationLibCode/CommandFileInterface/RicfSetExportFolder.cpp index ae6c4bb72e..42eddc3eac 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfSetExportFolder.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfSetExportFolder.cpp @@ -32,9 +32,9 @@ CAF_PDM_SOURCE_INIT( RicfSetExportFolder, "setExportFolder" ); RicfSetExportFolder::RicfSetExportFolder() { // clang-format off - CAF_PDM_InitScriptableField(&m_type, "type", RicfCommandFileExecutor::ExportTypeEnum(RicfCommandFileExecutor::ExportType::COMPLETIONS), "Type", "", "", ""); - CAF_PDM_InitScriptableField(&m_path, "path", QString(), "Path", "", "", ""); - CAF_PDM_InitScriptableField(&m_createFolder, "createFolder", false, "Create Folder", "", "", ""); + CAF_PDM_InitScriptableField(&m_type, "type", RicfCommandFileExecutor::ExportTypeEnum(RicfCommandFileExecutor::ExportType::COMPLETIONS), "Type"); + CAF_PDM_InitScriptableField(&m_path, "path", QString(), "Path"); + CAF_PDM_InitScriptableField(&m_createFolder, "createFolder", false, "Create Folder"); // clang-format on } diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp index 18123f9021..b9d71f5ab8 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp @@ -109,13 +109,7 @@ RicExportCompletionDataSettingsUi::RicExportCompletionDataSettingsUi() CAF_PDM_InitField( &m_exportDataSourceAsComment, "ExportDataSourceAsComment", true, "Comments" ); CAF_PDM_InitField( &m_exportWelspec, "ExportWelspec", true, "WELSPEC keyword" ); - CAF_PDM_InitField( &m_completionWelspecAfterMainBore, - "CompletionWelspecAfterMainBore", - true, - "WELSEGS per Completion Type", - "", - "", - "" ); + CAF_PDM_InitField( &m_completionWelspecAfterMainBore, "CompletionWelspecAfterMainBore", true, "WELSEGS per Completion Type" ); CAF_PDM_InitField( &m_useCustomFileName, "UseCustomFileName", false, "Use Custom Filename" ); CAF_PDM_InitField( &m_customFileName, "CustomFileName", {}, "Custom Filename" ); diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp index b70ee36af0..6b5e5e2bf3 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp @@ -38,10 +38,7 @@ RicCreateEnsembleSurfaceUi::RicCreateEnsembleSurfaceUi() CAF_PDM_InitField( &m_autoCreateEnsembleSurfaces, "AutoCreateEnsembleSurfaces", false, - "Create Ensemble Surfaces From Exported Files", - "", - "", - "" ); + "Create Ensemble Surfaces From Exported Files" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_autoCreateEnsembleSurfaces ); CAF_PDM_InitFieldNoDefault( &m_minLayer, "MinLayer", "MinLayer" ); diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp index cda4b4d30a..7132a8f0ad 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp @@ -60,10 +60,7 @@ RicCreateEnsembleWellLogUi::RicCreateEnsembleWellLogUi() CAF_PDM_InitField( &m_autoCreateEnsembleWellLogs, "AutoCreateEnsembleWellLogs", true, - "Create Ensemble Well Logs From Exported Files", - "", - "", - "" ); + "Create Ensemble Well Logs From Exported Files" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_autoCreateEnsembleWellLogs ); CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step" ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp index 7ca773b738..05c592b166 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp @@ -196,17 +196,11 @@ RicPasteAsciiDataToSummaryPlotFeatureUi::RicPasteAsciiDataToSummaryPlotFeatureUi "LineStyle", caf::AppEnum( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ), - "Line Style", - "", - "", - "" ); + "Line Style" ); CAF_PDM_InitField( &m_curveSymbol, "Symbol", caf::AppEnum( RiuQwtSymbol::SYMBOL_ELLIPSE ), - "Symbol", - "", - "", - "" ); + "Symbol" ); CAF_PDM_InitField( &m_curveSymbolSkipDistance, "SymbolSkipDinstance", 0.0f, "Symbol Skip Distance" ); CAF_PDM_InitFieldNoDefault( &m_cellSeparator, "CellSeparator", "Cell Separator" ); diff --git a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp index b848117de0..21acad64d6 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp +++ b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp @@ -34,7 +34,7 @@ CAF_PDM_SOURCE_INIT( RicLinkVisibleViewsFeatureUi, "RicLinkVisibleViewsFeatureUi //-------------------------------------------------------------------------------------------------- RicLinkVisibleViewsFeatureUi::RicLinkVisibleViewsFeatureUi( void ) { - CAF_PDM_InitObject( "Link Visible Views Feature UI", ":/LinkView16x16.png", "", "" ); + CAF_PDM_InitObject( "Link Visible Views Feature UI", ":/LinkView16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_masterView, "MasterView", "Primary View" ); } diff --git a/ApplicationLibCode/FileInterface/RifReaderSettings.cpp b/ApplicationLibCode/FileInterface/RifReaderSettings.cpp index 15081d01f2..d2e649b660 100644 --- a/ApplicationLibCode/FileInterface/RifReaderSettings.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderSettings.cpp @@ -39,10 +39,7 @@ RifReaderSettings::RifReaderSettings() CAF_PDM_InitField( &includeInactiveCellsInFaultGeometry, "includeInactiveCellsInFaultGeometry", false, - "Include Inactive Cells", - "", - "", - "" ); + "Include Inactive Cells" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &includeInactiveCellsInFaultGeometry ); CAF_PDM_InitField( &importAdvancedMswData, "importAdvancedMswData", false, "Import Advanced MSW Data" ); diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index 437bd584f3..f430ebdc8a 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -91,7 +91,7 @@ CAF_PDM_SOURCE_INIT( RimAnalysisPlot, "AnalysisPlot" ); RimAnalysisPlot::RimAnalysisPlot() : RimPlot() { - CAF_PDM_InitObject( "Analysis Plot", ":/AnalysisPlot16x16.png", "", "" ); + CAF_PDM_InitObject( "Analysis Plot", ":/AnalysisPlot16x16.png" ); // Variable selection diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp index 582da46df4..820142afc2 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp @@ -32,7 +32,7 @@ CAF_PDM_SOURCE_INIT( RimAnalysisPlotCollection, "AnalysisPlotCollection" ); //-------------------------------------------------------------------------------------------------- RimAnalysisPlotCollection::RimAnalysisPlotCollection() { - CAF_PDM_InitObject( "Analysis Plots", ":/AnalysisPlots16x16.png", "", "" ); + CAF_PDM_InitObject( "Analysis Plots", ":/AnalysisPlots16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_analysisPlots, "AnalysisPlots", "Analysis Plots" ); m_analysisPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp index 8f3f6568d7..36495eb5a9 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp @@ -27,7 +27,7 @@ CAF_PDM_SOURCE_INIT( RimPlotDataFilterCollection, "PlotDataFilterCollection" ); RimPlotDataFilterCollection::RimPlotDataFilterCollection() : filtersChanged( this ) { - CAF_PDM_InitObject( "Plot Data Filters", ":/AnalysisPlotFilter16x16.png", "", "" ); + CAF_PDM_InitObject( "Plot Data Filters", ":/AnalysisPlotFilter16x16.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "IsActive" ); m_isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp index 676021850a..b0963b31e1 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp @@ -83,7 +83,7 @@ RimPlotDataFilterItem::RimPlotDataFilterItem() , m_upperLimit( std::numeric_limits::infinity() ) , filterChanged( this ) { - CAF_PDM_InitObject( "Plot Data Filter", ":/AnalysisPlotFilter16x16.png", "", "" ); + CAF_PDM_InitObject( "Plot Data Filter", ":/AnalysisPlotFilter16x16.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp index 3826f74d31..7361fa7ebb 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollection.cpp @@ -41,7 +41,7 @@ CAF_PDM_SOURCE_INIT( RimAnnotationCollection, "RimAnnotationCollection" ); //-------------------------------------------------------------------------------------------------- RimAnnotationCollection::RimAnnotationCollection() { - CAF_PDM_InitObject( "Annotations", ":/Annotations16x16.png", "", "" ); + CAF_PDM_InitObject( "Annotations", ":/Annotations16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_reachCircleAnnotations, "ReachCircleAnnotations", "Reach Circle Annotations" ); CAF_PDM_InitFieldNoDefault( &m_userDefinedPolylineAnnotations, diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp index 448be09074..5be5b6c3f4 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationCollectionBase.cpp @@ -36,7 +36,7 @@ CAF_PDM_SOURCE_INIT( RimAnnotationCollectionBase, "RimAnnotationCollectionBase" //-------------------------------------------------------------------------------------------------- RimAnnotationCollectionBase::RimAnnotationCollectionBase() { - CAF_PDM_InitObject( "Annotations", ":/WellCollection.png", "", "" ); + CAF_PDM_InitObject( "Annotations", ":/WellCollection.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); m_isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp index 85e8786684..2bc08140b7 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp @@ -44,7 +44,7 @@ const QString RimAnnotationGroupCollection::POLYLINE_FROM_FILE_ANNOTATION_UI_NAM //-------------------------------------------------------------------------------------------------- RimAnnotationGroupCollection::RimAnnotationGroupCollection() { - CAF_PDM_InitObject( "Annotations", ":/WellCollection.png", "", "" ); + CAF_PDM_InitObject( "Annotations", ":/WellCollection.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); CAF_PDM_InitFieldNoDefault( &m_annotations, "Annotations", "Annotations" ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.cpp index 4e403a60fc..7ac97848f7 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationInViewCollection.cpp @@ -78,7 +78,7 @@ CAF_PDM_SOURCE_INIT( RimAnnotationInViewCollection, "Annotations" ); //-------------------------------------------------------------------------------------------------- RimAnnotationInViewCollection::RimAnnotationInViewCollection() { - CAF_PDM_InitObject( "Annotations", ":/Annotations16x16.png", "", "" ); + CAF_PDM_InitObject( "Annotations", ":/Annotations16x16.png" ); CAF_PDM_InitField( &m_annotationPlaneDepth, "AnnotationPlaneDepth", 0.0, "Annotation Plane Depth" ); CAF_PDM_InitField( &m_snapAnnotations, "SnapAnnotations", false, "Snap Annotations to Plane" ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationLineAppearance.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationLineAppearance.cpp index df44ef31cc..c759ff1f57 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationLineAppearance.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationLineAppearance.cpp @@ -63,7 +63,7 @@ CAF_PDM_SOURCE_INIT( RimAnnotationLineAppearance, "RimAnnotationLineAppearance" RimAnnotationLineAppearance::RimAnnotationLineAppearance() : objectChanged( this ) { - CAF_PDM_InitObject( "AnnotationLineAppearance", ":/WellCollection.png", "", "" ); + CAF_PDM_InitObject( "AnnotationLineAppearance", ":/WellCollection.png" ); CAF_PDM_InitField( &m_lineFieldsHidden, "LineFieldsHidden", false, "Line Fields Hidden" ); CAF_PDM_InitField( &m_color, "Color", cvf::Color3f( cvf::Color3f::BLACK ), "Line Color" ); @@ -170,7 +170,7 @@ CAF_PDM_SOURCE_INIT( RimPolylineAppearance, "RimPolylineAppearance" ); //-------------------------------------------------------------------------------------------------- RimPolylineAppearance::RimPolylineAppearance() { - CAF_PDM_InitObject( "PolylineAppearance", ":/WellCollection.png", "", "" ); + CAF_PDM_InitObject( "PolylineAppearance", ":/WellCollection.png" ); CAF_PDM_InitField( &m_sphereFieldsHidden, "SphereFieldsHidden", false, "Sphere Fields Hidden" ); CAF_PDM_InitField( &m_sphereColor, "SphereColor", cvf::Color3f( cvf::Color3f::BLACK ), "Sphere Color" ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationTextAppearance.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationTextAppearance.cpp index 5f68d5a5f8..0ec4b02224 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationTextAppearance.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationTextAppearance.cpp @@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimAnnotationTextAppearance, "RimAnnotationTextAppearance" //-------------------------------------------------------------------------------------------------- RimAnnotationTextAppearance::RimAnnotationTextAppearance() { - CAF_PDM_InitObject( "TextAnnotation", ":/WellCollection.png", "", "" ); + CAF_PDM_InitObject( "TextAnnotation", ":/WellCollection.png" ); auto prefs = RiaPreferences::current(); auto defaultBackgroundColor = prefs->defaultViewerBackgroundColor(); @@ -40,13 +40,7 @@ RimAnnotationTextAppearance::RimAnnotationTextAppearance() CAF_PDM_InitField( &m_fontColor, "FontColor", cvf::Color3f( cvf::Color3f::BLACK ), "Font Color" ); CAF_PDM_InitField( &m_backgroundColor, "BackgroundColor", defaultBackgroundColor, "Background Color" ); - CAF_PDM_InitField( &m_anchorLineColor, - "AnchorLineColor", - cvf::Color3f( cvf::Color3f::BLACK ), - "Anchor Line Color", - "", - "", - "" ); + CAF_PDM_InitField( &m_anchorLineColor, "AnchorLineColor", cvf::Color3f( cvf::Color3f::BLACK ), "Anchor Line Color" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotation.cpp index 37ef0c6e59..49c5ab77ca 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotation.cpp @@ -35,7 +35,7 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimPolylinesAnnotation, "RimPolylinesAnnotation" ) //-------------------------------------------------------------------------------------------------- RimPolylinesAnnotation::RimPolylinesAnnotation() { - CAF_PDM_InitObject( "PolylineAnnotation", ":/WellCollection.png", "", "" ); + CAF_PDM_InitObject( "PolylineAnnotation", ":/WellCollection.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); m_isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotationInView.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotationInView.cpp index 0a402a10d4..53a2825a04 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotationInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesAnnotationInView.cpp @@ -31,7 +31,7 @@ CAF_PDM_SOURCE_INIT( RimPolylinesAnnotationInView, "RimPolylinesAnnotationInView //-------------------------------------------------------------------------------------------------- RimPolylinesAnnotationInView::RimPolylinesAnnotationInView() { - CAF_PDM_InitObject( "PolyLinesAnnotationInView", ":/WellCollection.png", "", "" ); + CAF_PDM_InitObject( "PolyLinesAnnotationInView", ":/WellCollection.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); CAF_PDM_InitFieldNoDefault( &m_sourceAnnotation, "SourceAnnotation", "Source Annotation" ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp index 93adb202b7..d3798411bc 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp @@ -35,7 +35,7 @@ CAF_PDM_SOURCE_INIT( RimPolylinesFromFileAnnotation, "PolylinesFromFileAnnotatio //-------------------------------------------------------------------------------------------------- RimPolylinesFromFileAnnotation::RimPolylinesFromFileAnnotation() { - CAF_PDM_InitObject( "PolyLines Annotation", ":/PolylinesFromFile16x16.png", "", "" ); + CAF_PDM_InitObject( "PolyLines Annotation", ":/PolylinesFromFile16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_polyLinesFileName, "PolyLineFilePath", "File" ); CAF_PDM_InitField( &m_userDescription, "PolyLineDescription", QString( "" ), "Name" ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotationInView.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotationInView.cpp index 16cbb8ff86..4905bd91a7 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotationInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotationInView.cpp @@ -26,7 +26,7 @@ CAF_PDM_SOURCE_INIT( RimPolylinesFromFileAnnotationInView, "RimPolylinesFromFile //-------------------------------------------------------------------------------------------------- RimPolylinesFromFileAnnotationInView::RimPolylinesFromFileAnnotationInView() { - CAF_PDM_InitObject( "PolyLines Annotation", ":/PolylinesFromFile16x16.png", "", "" ); + CAF_PDM_InitObject( "PolyLines Annotation", ":/PolylinesFromFile16x16.png" ); } //-------------------------------------------------------------------------------------------------- @@ -35,5 +35,5 @@ RimPolylinesFromFileAnnotationInView::RimPolylinesFromFileAnnotationInView() RimPolylinesFromFileAnnotationInView::RimPolylinesFromFileAnnotationInView( RimPolylinesFromFileAnnotation* sourceAnnotation ) : RimPolylinesAnnotationInView( sourceAnnotation ) { - CAF_PDM_InitObject( "PolyLines Annotation", ":/PolylinesFromFile16x16.png", "", "" ); + CAF_PDM_InitObject( "PolyLines Annotation", ":/PolylinesFromFile16x16.png" ); } diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.cpp index 0858df0128..37a9ef3d59 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotation.cpp @@ -36,7 +36,7 @@ CAF_PDM_SOURCE_INIT( RimReachCircleAnnotation, "RimReachCircleAnnotation" ); //-------------------------------------------------------------------------------------------------- RimReachCircleAnnotation::RimReachCircleAnnotation() { - CAF_PDM_InitObject( "CircleAnnotation", ":/ReachCircle16x16.png", "", "" ); + CAF_PDM_InitObject( "CircleAnnotation", ":/ReachCircle16x16.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); m_isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.cpp index 16c83c6345..b18f59782d 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimReachCircleAnnotationInView.cpp @@ -28,7 +28,7 @@ CAF_PDM_SOURCE_INIT( RimReachCircleAnnotationInView, "RimReachCircleAnnotationIn //-------------------------------------------------------------------------------------------------- RimReachCircleAnnotationInView::RimReachCircleAnnotationInView() { - CAF_PDM_InitObject( "ReachCircleAnnotationInView", ":/ReachCircle16x16.png", "", "" ); + CAF_PDM_InitObject( "ReachCircleAnnotationInView", ":/ReachCircle16x16.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); CAF_PDM_InitFieldNoDefault( &m_sourceAnnotation, "SourceAnnotation", "Source Annotation" ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.cpp index e227e25c2d..fad0366e2e 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotation.cpp @@ -44,7 +44,7 @@ CAF_PDM_SOURCE_INIT( RimTextAnnotation, "RimTextAnnotation" ); //-------------------------------------------------------------------------------------------------- RimTextAnnotation::RimTextAnnotation() { - CAF_PDM_InitObject( "TextAnnotation", ":/TextAnnotation16x16.png", "", "" ); + CAF_PDM_InitObject( "TextAnnotation", ":/TextAnnotation16x16.png" ); this->setUi3dEditorTypeName( RicTextAnnotation3dEditor::uiEditorTypeName() ); CAF_PDM_InitField( &m_anchorPointXyd, "AnchorPointXyd", Vec3d::ZERO, "Anchor Point" ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.cpp index 1a44f5406e..47a7cccf01 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimTextAnnotationInView.cpp @@ -28,7 +28,7 @@ CAF_PDM_SOURCE_INIT( RimTextAnnotationInView, "RimTextAnnotationInView" ); //-------------------------------------------------------------------------------------------------- RimTextAnnotationInView::RimTextAnnotationInView() { - CAF_PDM_InitObject( "TextAnnotationInView", ":/TextAnnotation16x16.png", "", "" ); + CAF_PDM_InitObject( "TextAnnotationInView", ":/TextAnnotation16x16.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Is Active" ); CAF_PDM_InitFieldNoDefault( &m_sourceAnnotation, "SourceAnnotation", "Source Annotation" ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp index c3e2e63e37..d2197969b9 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp @@ -44,7 +44,7 @@ CAF_PDM_SOURCE_INIT( RimUserDefinedPolylinesAnnotation, "UserDefinedPolylinesAnn RimUserDefinedPolylinesAnnotation::RimUserDefinedPolylinesAnnotation() : m_pickTargetsEventHandler( new RicPolylineTargetsPickEventHandler( this ) ) { - CAF_PDM_InitObject( "PolyLines Annotation", ":/PolylinesFromFile16x16.png", "", "" ); + CAF_PDM_InitObject( "PolyLines Annotation", ":/PolylinesFromFile16x16.png" ); CAF_PDM_InitField( &m_name, "Name", QString( "User Defined Polyline" ), "Name" ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotationInView.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotationInView.cpp index 4b99291243..cf35f05cf1 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotationInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotationInView.cpp @@ -26,7 +26,7 @@ CAF_PDM_SOURCE_INIT( RimUserDefinedPolylinesAnnotationInView, "RimUserDefinedPol //-------------------------------------------------------------------------------------------------- RimUserDefinedPolylinesAnnotationInView::RimUserDefinedPolylinesAnnotationInView() { - CAF_PDM_InitObject( "PolyLinesAnnotationInView", ":/WellCollection.png", "", "" ); + CAF_PDM_InitObject( "PolyLinesAnnotationInView", ":/WellCollection.png" ); } //-------------------------------------------------------------------------------------------------- @@ -35,5 +35,5 @@ RimUserDefinedPolylinesAnnotationInView::RimUserDefinedPolylinesAnnotationInView RimUserDefinedPolylinesAnnotationInView::RimUserDefinedPolylinesAnnotationInView( RimUserDefinedPolylinesAnnotation* sourceAnnotation ) : RimPolylinesAnnotationInView( sourceAnnotation ) { - CAF_PDM_InitObject( "PolyLinesAnnotationInView", ":/WellCollection.png", "", "" ); + CAF_PDM_InitObject( "PolyLinesAnnotationInView", ":/WellCollection.png" ); } diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp index de507eec56..6130291f9d 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp @@ -39,7 +39,7 @@ CAF_PDM_SOURCE_INIT( RimCellFilterCollection, "CellFilterCollection", "RimCellFi //-------------------------------------------------------------------------------------------------- RimCellFilterCollection::RimCellFilterCollection() { - CAF_PDM_InitScriptableObject( "Cell Filters", ":/CellFilter.png", "", "" ); + CAF_PDM_InitScriptableObject( "Cell Filters", ":/CellFilter.png" ); CAF_PDM_InitScriptableField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp index 5e3fc5bb4e..d5b1df8fd2 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellRangeFilter.cpp @@ -38,7 +38,7 @@ CAF_PDM_SOURCE_INIT( RimCellRangeFilter, "CellRangeFilter" ); //-------------------------------------------------------------------------------------------------- RimCellRangeFilter::RimCellRangeFilter() { - CAF_PDM_InitObject( "Cell Range Filter", ":/CellFilter_Range.png", "", "" ); + CAF_PDM_InitObject( "Cell Range Filter", ":/CellFilter_Range.png" ); CAF_PDM_InitField( &startIndexI, "StartIndexI", 1, "Start Index I" ); startIndexI.uiCapability()->setUiEditorTypeName( caf::PdmUiSliderEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp index 81c72fe6fe..172d9e1949 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilter.cpp @@ -52,7 +52,7 @@ CAF_PDM_SOURCE_INIT( RimEclipsePropertyFilter, "CellPropertyFilter" ); //-------------------------------------------------------------------------------------------------- RimEclipsePropertyFilter::RimEclipsePropertyFilter() { - CAF_PDM_InitObject( "Cell Property Filter", ":/CellFilter_Values.png", "", "" ); + CAF_PDM_InitObject( "Cell Property Filter", ":/CellFilter_Values.png" ); CAF_PDM_InitFieldNoDefault( &m_resultDefinition, "ResultDefinition", "Result Definition" ); m_resultDefinition = new RimEclipseResultDefinition(); diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp index db2c9f319b..9ee522722c 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp @@ -36,7 +36,7 @@ CAF_PDM_SOURCE_INIT( RimEclipsePropertyFilterCollection, "CellPropertyFilters" ) //-------------------------------------------------------------------------------------------------- RimEclipsePropertyFilterCollection::RimEclipsePropertyFilterCollection() { - CAF_PDM_InitObject( "Property Filters", ":/CellFilter_Values.png", "", "" ); + CAF_PDM_InitObject( "Property Filters", ":/CellFilter_Values.png" ); CAF_PDM_InitFieldNoDefault( &propertyFilters, "PropertyFilters", "Property Filters" ); propertyFilters.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilter.cpp index 579fddc105..3300e5651a 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilter.cpp @@ -42,7 +42,7 @@ CAF_PDM_SOURCE_INIT( RimGeoMechPropertyFilter, "GeoMechPropertyFilter" ); RimGeoMechPropertyFilter::RimGeoMechPropertyFilter() : m_parentContainer( nullptr ) { - CAF_PDM_InitObject( "Property Filter", ":/CellFilter_Values.png", "", "" ); + CAF_PDM_InitObject( "Property Filter", ":/CellFilter_Values.png" ); CAF_PDM_InitFieldNoDefault( &resultDefinition, "ResultDefinition", "Result Definition" ); resultDefinition = new RimGeoMechResultDefinition(); diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp index 25a0454096..33d7c8df4e 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp @@ -34,7 +34,7 @@ CAF_PDM_SOURCE_INIT( RimGeoMechPropertyFilterCollection, "GeoMechPropertyFilters //-------------------------------------------------------------------------------------------------- RimGeoMechPropertyFilterCollection::RimGeoMechPropertyFilterCollection() { - CAF_PDM_InitObject( "Property Filters", ":/CellFilter_Values.png", "", "" ); + CAF_PDM_InitObject( "Property Filters", ":/CellFilter_Values.png" ); CAF_PDM_InitFieldNoDefault( &propertyFilters, "PropertyFilters", "Property Filters" ); propertyFilters.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp index ca7b27ce9a..35a95fb83b 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp @@ -120,7 +120,7 @@ RimPolygonFilter::RimPolygonFilter() : m_pickTargetsEventHandler( new RicPolylineTargetsPickEventHandler( this ) ) , m_intervalTool( true ) { - CAF_PDM_InitObject( "Polyline Filter", ":/CellFilter_Polygon.png", "", "" ); + CAF_PDM_InitObject( "Polyline Filter", ":/CellFilter_Polygon.png" ); CAF_PDM_InitFieldNoDefault( &m_polyFilterMode, "PolygonFilterType", "Vertical Filter" ); diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedFilter.cpp index ee4c303716..0952512883 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimUserDefinedFilter.cpp @@ -27,7 +27,7 @@ CAF_PDM_SOURCE_INIT( RimUserDefinedFilter, "UserDefinedFilter" ); //-------------------------------------------------------------------------------------------------- RimUserDefinedFilter::RimUserDefinedFilter() { - CAF_PDM_InitObject( "User Defined Filter", ":/CellFilter_UserDefined.png", "", "" ); + CAF_PDM_InitObject( "User Defined Filter", ":/CellFilter_UserDefined.png" ); CAF_PDM_InitFieldNoDefault( &m_individualCellIndices, "IndividualCellIndices", "Cells", diff --git a/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp index cc7533fccc..cc14742fa6 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp @@ -32,7 +32,7 @@ CAF_PDM_SOURCE_INIT( Rim3dWellLogCurveCollection, "Rim3dWellLogCurveCollection" //-------------------------------------------------------------------------------------------------- Rim3dWellLogCurveCollection::Rim3dWellLogCurveCollection() { - CAF_PDM_InitObject( "3D Track", ":/WellLogCurve16x16.png", "", "" ); + CAF_PDM_InitObject( "3D Track", ":/WellLogCurve16x16.png" ); CAF_PDM_InitField( &m_showPlot, "Show3dWellLogCurves", true, "Show 3d Well Log Curves" ); m_showPlot.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionTemplateCollection.cpp index 340d10d7d7..585ef32f90 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimCompletionTemplateCollection.cpp @@ -34,7 +34,7 @@ CAF_PDM_SOURCE_INIT( RimCompletionTemplateCollection, "CompletionTemplateCollect //-------------------------------------------------------------------------------------------------- RimCompletionTemplateCollection::RimCompletionTemplateCollection() { - CAF_PDM_InitObject( "Completion Templates", ":/CompletionsSymbol16x16.png", "", "" ); + CAF_PDM_InitObject( "Completion Templates", ":/CompletionsSymbol16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_fractureTemplates, "FractureTemplates", "" ); m_fractureTemplates = new RimFractureTemplateCollection; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp index e622bf1d92..ed844111b1 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp @@ -50,7 +50,7 @@ CAF_PDM_SOURCE_INIT( RimEllipseFractureTemplate, "RimEllipseFractureTemplate" ); //-------------------------------------------------------------------------------------------------- RimEllipseFractureTemplate::RimEllipseFractureTemplate() { - CAF_PDM_InitObject( "Fracture Template", ":/FractureTemplate16x16.png", "", "" ); + CAF_PDM_InitObject( "Fracture Template", ":/FractureTemplate16x16.png" ); CAF_PDM_InitField( &m_halfLength, "HalfLength", 0.0, "Half Length Xf" ); CAF_PDM_InitField( &m_height, "Height", 0.0, "Height" ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp index d27f2cf63c..0410147eae 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp @@ -121,7 +121,7 @@ CAF_PDM_SOURCE_INIT( RimEnsembleFractureStatistics, "EnsembleFractureStatistics" //-------------------------------------------------------------------------------------------------- RimEnsembleFractureStatistics::RimEnsembleFractureStatistics() { - CAF_PDM_InitObject( "Ensemble Fracture Statistics", ":/FractureTemplate16x16.png", "", "" ); + CAF_PDM_InitObject( "Ensemble Fracture Statistics", ":/FractureTemplate16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_filePaths, "FilePaths", "" ); @@ -131,13 +131,7 @@ RimEnsembleFractureStatistics::RimEnsembleFractureStatistics() m_filePathsTable.uiCapability()->setUiReadOnly( true ); m_filePathsTable.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_excludeZeroWidthFractures, - "ExcludeZeroWidthFractures", - true, - "Exclude Zero Width Fractures", - "", - "", - "" ); + CAF_PDM_InitField( &m_excludeZeroWidthFractures, "ExcludeZeroWidthFractures", true, "Exclude Zero Width Fractures" ); CAF_PDM_InitFieldNoDefault( &m_statisticsTable, "StatisticsTable", "Statistics Table" ); m_statisticsTable.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp index 504d27475e..27b94eee6a 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp @@ -27,7 +27,7 @@ CAF_PDM_SOURCE_INIT( RimEnsembleFractureStatisticsCollection, "FractureGroupStat //-------------------------------------------------------------------------------------------------- RimEnsembleFractureStatisticsCollection::RimEnsembleFractureStatisticsCollection() { - CAF_PDM_InitObject( "Ensemble Fracture Statistics", ":/FractureTemplates16x16.png", "", "" ); + CAF_PDM_InitObject( "Ensemble Fracture Statistics", ":/FractureTemplates16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_fractureGroupStatistics, "FractureGroupStatistics", "" ); m_fractureGroupStatistics.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp index e0a2aa37cd..01b43f7bbf 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp @@ -69,7 +69,7 @@ void AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RimFishbones::RimFishbones() { - CAF_PDM_InitObject( "FishbonesMultipleSubs", ":/FishBoneGroup16x16.png", "", "" ); + CAF_PDM_InitObject( "FishbonesMultipleSubs", ":/FishBoneGroup16x16.png" ); CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); @@ -99,25 +99,10 @@ RimFishbones::RimFishbones() CAF_PDM_InitField( &m_lateralOpenHoleRoghnessFactor, "LateralOpenHoleRoghnessFactor", 0.001, - "Open Hole Roghness Factor [m]", - "", - "", - "" ); - CAF_PDM_InitField( &m_lateralTubingRoghnessFactor, - "LateralTubingRoghnessFactor", - 1e-5, - "Tubing Roghness Factor [m]", - "", - "", - "" ); + "Open Hole Roghness Factor [m]" ); + CAF_PDM_InitField( &m_lateralTubingRoghnessFactor, "LateralTubingRoghnessFactor", 1e-5, "Tubing Roghness Factor [m]" ); - CAF_PDM_InitField( &m_lateralInstallSuccessFraction, - "LateralInstallSuccessFraction", - 1.0, - "Install Success Rate [0..1]", - "", - "", - "" ); + CAF_PDM_InitField( &m_lateralInstallSuccessFraction, "LateralInstallSuccessFraction", 1.0, "Install Success Rate [0..1]" ); CAF_PDM_InitField( &m_icdCount, "IcdCount", 2, "ICDs per Sub" ); CAF_PDM_InitField( &m_icdOrificeDiameter, "IcdOrificeDiameter", 7.0, "ICD Orifice Diameter [mm]" ); @@ -133,22 +118,13 @@ RimFishbones::RimFishbones() CAF_PDM_InitField( &m_subsOrientationMode, "SubsOrientationMode", caf::AppEnum( FB_LATERAL_ORIENTATION_RANDOM ), - "Orientation", - "", - "", - "" ); + "Orientation" ); CAF_PDM_InitFieldNoDefault( &m_installationRotationAngles, "InstallationRotationAngles", "Installation Rotation Angles [deg]" ); m_installationRotationAngles.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_fixedInstallationRotationAngle, - "FixedInstallationRotationAngle", - 0.0, - " Fixed Angle [deg]", - "", - "", - "" ); + CAF_PDM_InitField( &m_fixedInstallationRotationAngle, "FixedInstallationRotationAngle", 0.0, " Fixed Angle [deg]" ); CAF_PDM_InitFieldNoDefault( &m_pipeProperties, "PipeProperties", "Pipe Properties" ); m_pipeProperties.uiCapability()->setUiTreeHidden( true ); @@ -758,10 +734,7 @@ void RimFishbones::initialiseObsoleteFields() CAF_PDM_InitField( &m_subsLocationMode_OBSOLETE, "SubsLocationMode", caf::AppEnum( FB_SUB_UNDEFINED ), - "Location Defined By", - "", - "", - "" ); + "Location Defined By" ); m_subsLocationMode_OBSOLETE.xmlCapability()->setIOWritable( false ); CAF_PDM_InitField( &m_rangeStart_OBSOLETE, "RangeStart", std::numeric_limits::infinity(), "Start MD [m]" ); @@ -770,13 +743,7 @@ void RimFishbones::initialiseObsoleteFields() CAF_PDM_InitField( &m_rangeEnd_OBSOLETE, "RangeEnd", std::numeric_limits::infinity(), "End MD [m]" ); m_rangeEnd_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_rangeSubSpacing_OBSOLETE, - "RangeSubSpacing", - std::numeric_limits::infinity(), - "Spacing [m]", - "", - "", - "" ); + CAF_PDM_InitField( &m_rangeSubSpacing_OBSOLETE, "RangeSubSpacing", std::numeric_limits::infinity(), "Spacing [m]" ); m_rangeSubSpacing_OBSOLETE.xmlCapability()->setIOWritable( false ); CAF_PDM_InitField( &m_rangeSubCount_OBSOLETE, "RangeSubCount", -1, "Number of Subs" ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp index 9a825cd481..0a33fed054 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp @@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT( RimFishbonesCollection, "FishbonesCollection" ); //-------------------------------------------------------------------------------------------------- RimFishbonesCollection::RimFishbonesCollection() { - CAF_PDM_InitObject( "Fishbones", ":/FishBones16x16.png", "", "" ); + CAF_PDM_InitObject( "Fishbones", ":/FishBones16x16.png" ); nameField()->uiCapability()->setUiHidden( true ); this->setName( "Fishbones" ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp index f4a0b523cf..6fe92e727f 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp @@ -102,13 +102,7 @@ RimFracture::RimFracture() m_editFractureTemplate.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); m_editFractureTemplate.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - CAF_PDM_InitField( &m_createEllipseFractureTemplate, - "CreateEllipseTemplate", - false, - "No Fracture Templates Found.", - "", - "", - "" ); + CAF_PDM_InitField( &m_createEllipseFractureTemplate, "CreateEllipseTemplate", false, "No Fracture Templates Found." ); m_createEllipseFractureTemplate.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_createEllipseFractureTemplate.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); @@ -119,10 +113,7 @@ RimFracture::RimFracture() CAF_PDM_InitField( &m_autoUpdateWellPathDepthAtFractureFromTemplate, "AutoUpdateWellPathDepthAtFractureFromTemplate", true, - "Auto-Update From Template", - "", - "", - "" ); + "Auto-Update From Template" ); CAF_PDM_InitField( &m_wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Well/Fracture Intersection Depth" ); m_wellPathDepthAtFracture.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); @@ -150,10 +141,7 @@ RimFracture::RimFracture() CAF_PDM_InitField( &m_fractureUnit, "FractureUnit", caf::AppEnum( RiaDefines::EclipseUnitSystem::UNITS_METRIC ), - "Fracture Unit System", - "", - "", - "" ); + "Fracture Unit System" ); m_fractureUnit.uiCapability()->setUiReadOnly( true ); CAF_PDM_InitField( &m_stimPlanTimeIndexToPlot, "TimeIndexToPlot", 0, "StimPlan Time Step" ); @@ -173,9 +161,6 @@ RimFracture::RimFracture() CAF_PDM_InitField( &m_wellFractureAzimuthAngleWarning, "WellFractureAzimithAngleWarning", QString( "Difference is below 10 degrees. Consider longitudinal fracture" ), - "", - "", - "", "" ); m_wellFractureAzimuthAngleWarning.uiCapability()->setUiReadOnly( true ); m_wellFractureAzimuthAngleWarning.xmlCapability()->disableIO(); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp index 600e0e7c33..d9947f2c6b 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplate.cpp @@ -110,7 +110,7 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimFractureTemplate, "FractureTemplate", "RimF RimFractureTemplate::RimFractureTemplate() : wellPathDepthAtFractureChanged( this ) { - CAF_PDM_InitScriptableObject( "Fracture Template", ":/FractureTemplate16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Fracture Template", ":/FractureTemplate16x16.png" ); CAF_PDM_InitField( &m_id, "Id", -1, "ID" ); m_id.uiCapability()->setUiReadOnly( true ); @@ -125,19 +125,13 @@ RimFractureTemplate::RimFractureTemplate() CAF_PDM_InitField( &m_fractureTemplateUnit, "UnitSystem", caf::AppEnum( RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN ), - "Units System", - "", - "", - "" ); + "Units System" ); m_fractureTemplateUnit.uiCapability()->setUiReadOnly( true ); CAF_PDM_InitScriptableField( &m_orientationType, "Orientation", caf::AppEnum( TRANSVERSE_WELL_PATH ), - "Fracture Orientation", - "", - "", - "" ); + "Fracture Orientation" ); CAF_PDM_InitScriptableField( &m_azimuthAngle, "AzimuthAngle", 0.0f, "Azimuth Angle" ); @@ -152,10 +146,7 @@ RimFractureTemplate::RimFractureTemplate() CAF_PDM_InitField( &m_conductivityType, "ConductivityType", caf::AppEnum( FINITE_CONDUCTIVITY ), - "Conductivity in Fracture", - "", - "", - "" ); + "Conductivity in Fracture" ); CAF_PDM_InitField( &m_wellPathDepthAtFracture, "WellPathDepthAtFracture", 0.0, "Well/Fracture Intersection Depth" ); m_wellPathDepthAtFracture.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); @@ -181,13 +172,7 @@ RimFractureTemplate::RimFractureTemplate() CAF_PDM_InitFieldNoDefault( &m_permeabilityType, "PermeabilityType", "Type" ); CAF_PDM_InitField( &m_relativePermeability, "RelativePermeability", 1.0, "Relative Permeability" ); - CAF_PDM_InitField( &m_userDefinedEffectivePermeability, - "EffectivePermeability", - 0.0, - "Effective Permeability (Ke) [mD]", - "", - "", - "" ); + CAF_PDM_InitField( &m_userDefinedEffectivePermeability, "EffectivePermeability", 0.0, "Effective Permeability (Ke) [mD]" ); CAF_PDM_InitField( &m_relativeGasDensity, "RelativeGasDensity", diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp index c83e603568..2f26e6046a 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp @@ -52,15 +52,12 @@ CAF_PDM_SOURCE_INIT( RimFractureTemplateCollection, "FractureTemplateCollection" //-------------------------------------------------------------------------------------------------- RimFractureTemplateCollection::RimFractureTemplateCollection() { - CAF_PDM_InitScriptableObject( "Fracture Templates", ":/FractureTemplates16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Fracture Templates", ":/FractureTemplates16x16.png" ); CAF_PDM_InitField( &m_defaultUnitsForFracTemplates, "DefaultUnitForTemplates", caf::AppEnum( RiaDefines::EclipseUnitSystem::UNITS_METRIC ), - "Default unit system for fracture templates", - "", - "", - "" ); + "Default unit system for fracture templates" ); CAF_PDM_InitFieldNoDefault( &m_fractureDefinitions, "FractureDefinitions", "" ); m_fractureDefinitions.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp index b12bad4991..9f31e1261b 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimMswCompletionParameters.cpp @@ -63,26 +63,14 @@ CAF_PDM_SOURCE_INIT( RimMswCompletionParameters, "RimMswCompletionParameters" ); //-------------------------------------------------------------------------------------------------- RimMswCompletionParameters::RimMswCompletionParameters() { - CAF_PDM_InitObject( "MSW Completion Parameters", ":/CompletionsSymbol16x16.png", "", "" ); + CAF_PDM_InitObject( "MSW Completion Parameters", ":/CompletionsSymbol16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_refMDType, "RefMDType", "Reference MD" ); CAF_PDM_InitField( &m_refMD, "RefMD", 0.0, "" ); CAF_PDM_InitField( &m_customValuesForLateral, "CustomValuesForLateral", false, "Custom Values for Lateral" ); - CAF_PDM_InitField( &m_linerDiameter, - "LinerDiameter", - std::numeric_limits::infinity(), - "Liner Inner Diameter", - "", - "", - "" ); - CAF_PDM_InitField( &m_roughnessFactor, - "RoughnessFactor", - std::numeric_limits::infinity(), - "Roughness Factor", - "", - "", - "" ); + CAF_PDM_InitField( &m_linerDiameter, "LinerDiameter", std::numeric_limits::infinity(), "Liner Inner Diameter" ); + CAF_PDM_InitField( &m_roughnessFactor, "RoughnessFactor", std::numeric_limits::infinity(), "Roughness Factor" ); CAF_PDM_InitFieldNoDefault( &m_pressureDrop, "PressureDrop", "Pressure Drop" ); CAF_PDM_InitFieldNoDefault( &m_lengthAndDepth, "LengthAndDepth", "Length and Depth" ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp index 841d1c1522..37f39349d6 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimMultipleValveLocations.cpp @@ -51,15 +51,9 @@ void AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RimMultipleValveLocations::RimMultipleValveLocations() { - CAF_PDM_InitObject( "RimMultipleValveLocations", ":/FishBoneGroup16x16.png", "", "" ); - - CAF_PDM_InitField( &m_locationType, - "LocationMode", - caf::AppEnum( VALVE_COUNT ), - "Location Defined By", - "", - "", - "" ); + CAF_PDM_InitObject( "RimMultipleValveLocations", ":/FishBoneGroup16x16.png" ); + + CAF_PDM_InitField( &m_locationType, "LocationMode", caf::AppEnum( VALVE_COUNT ), "Location Defined By" ); CAF_PDM_InitField( &m_rangeStart, "RangeStart", 100.0, "Start MD [m]" ); m_rangeStart.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp index 198eeba911..c0dcc45eca 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimNonDarcyPerforationParameters.cpp @@ -43,7 +43,7 @@ CAF_PDM_SOURCE_INIT( RimNonDarcyPerforationParameters, "RimNonDarcyPerforationPa //-------------------------------------------------------------------------------------------------- RimNonDarcyPerforationParameters::RimNonDarcyPerforationParameters() { - CAF_PDM_InitObject( "NonDarcyPerforationParameters", ":/CompletionsSymbol16x16.png", "", "" ); + CAF_PDM_InitObject( "NonDarcyPerforationParameters", ":/CompletionsSymbol16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_nonDarcyFlowType, "NonDarcyFlowType", "Non-Darcy Flow" ); @@ -52,10 +52,7 @@ RimNonDarcyPerforationParameters::RimNonDarcyPerforationParameters() CAF_PDM_InitField( &m_gridPermeabilityScalingFactor, "GridPermeabilityScalingFactor", 1.0, - "Grid Permeability Scaling Factor (Kr) [0..1]", - "", - "", - "" ); + "Grid Permeability Scaling Factor (Kr) [0..1]" ); CAF_PDM_InitField( &m_wellRadius, "WellRadius", 0.108, "Well Radius (rw) [m]" ); @@ -78,17 +75,8 @@ RimNonDarcyPerforationParameters::RimNonDarcyPerforationParameters() CAF_PDM_InitField( &m_inertialCoefficientBeta0, "InertialCoefficientBeta0", 883.90, - "Inertial Coefficient (β0) [Forch. unit]", - "", - "", - "" ); - CAF_PDM_InitField( &m_permeabilityScalingFactor, - "PermeabilityScalingFactor", - -1.1045, - "Permeability Scaling Factor (B)", - "", - "", - "" ); + "Inertial Coefficient (β0) [Forch. unit]" ); + CAF_PDM_InitField( &m_permeabilityScalingFactor, "PermeabilityScalingFactor", -1.1045, "Permeability Scaling Factor (B)" ); CAF_PDM_InitField( &m_porosityScalingFactor, "PorosityScalingFactor", 0.0, "Porosity Scaling Factor (C)" ); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp index 9e9942269b..3f148981e0 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp @@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT( RimPerforationCollection, "PerforationCollection" ); //-------------------------------------------------------------------------------------------------- RimPerforationCollection::RimPerforationCollection() { - CAF_PDM_InitObject( "Perforations", ":/PerforationIntervals16x16.png", "", "" ); + CAF_PDM_InitObject( "Perforations", ":/PerforationIntervals16x16.png" ); nameField()->uiCapability()->setUiHidden( true ); this->setName( "Perforations" ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp index cba31005cd..2eb0c2e460 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp @@ -41,7 +41,7 @@ CAF_PDM_SOURCE_INIT( RimPerforationInterval, "Perforation" ); //-------------------------------------------------------------------------------------------------- RimPerforationInterval::RimPerforationInterval() { - CAF_PDM_InitObject( "Perforation", ":/PerforationInterval16x16.png", "", "" ); + CAF_PDM_InitObject( "Perforation", ":/PerforationInterval16x16.png" ); CAF_PDM_InitField( &m_startMD, "StartMeasuredDepth", 0.0, "Start MD" ); CAF_PDM_InitField( &m_endMD, "EndMeasuredDepth", 0.0, "End MD" ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp index 2f1e6a41d2..2ebda0f76f 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp @@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT( RimSimWellFracture, "SimWellFracture" ); //-------------------------------------------------------------------------------------------------- RimSimWellFracture::RimSimWellFracture( void ) { - CAF_PDM_InitObject( "SimWellFracture", ":/FractureSymbol16x16.png", "", "" ); + CAF_PDM_InitObject( "SimWellFracture", ":/FractureSymbol16x16.png" ); CAF_PDM_InitField( &m_location, "MeasuredDepth", 0.0f, "Pseudo Length Location" ); m_location.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp index e4a661da37..7ad9048437 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp @@ -28,7 +28,7 @@ CAF_PDM_SOURCE_INIT( RimSimWellFractureCollection, "SimWellFractureCollection" ) //-------------------------------------------------------------------------------------------------- RimSimWellFractureCollection::RimSimWellFractureCollection( void ) { - CAF_PDM_InitObject( "Fractures", ":/FractureLayout16x16.png", "", "" ); + CAF_PDM_InitObject( "Fractures", ":/FractureLayout16x16.png" ); CAF_PDM_InitFieldNoDefault( &simwellFractures, "Fractures", "" ); simwellFractures.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index a62af329fc..c3c0d21103 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -72,7 +72,7 @@ CAF_PDM_SOURCE_INIT( RimStimPlanFractureTemplate, "StimPlanFractureTemplate", "R //-------------------------------------------------------------------------------------------------- RimStimPlanFractureTemplate::RimStimPlanFractureTemplate() { - CAF_PDM_InitScriptableObject( "Fracture Template", ":/FractureTemplate16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Fracture Template", ":/FractureTemplate16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_stimPlanFileName, "StimPlanFileName", "File Name" ); m_stimPlanFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); @@ -80,10 +80,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate() CAF_PDM_InitField( &m_userDefinedWellPathDepthAtFracture, "UserDefinedWellPathDepthAtFracture", false, - "User-Defined Well/Fracture Intersection Depth", - "", - "", - "" ); + "User-Defined Well/Fracture Intersection Depth" ); CAF_PDM_InitField( &m_borderPolygonResultName, "BorderPolygonResultName", QString( "" ), "Parameter" ); m_borderPolygonResultName.uiCapability()->setUiHidden( true ); @@ -92,10 +89,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate() CAF_PDM_InitField( &m_conductivityResultNameOnFile, "ConductivityResultName", QString( "" ), - "Active Conductivity Result Name", - "", - "", - "" ); + "Active Conductivity Result Name" ); CAF_PDM_InitFieldNoDefault( &m_propertiesTable, "PropertiesTable", "Properties Table" ); m_propertiesTable.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp index 97bf58736e..68c433b36d 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp @@ -30,15 +30,12 @@ CAF_PDM_SOURCE_INIT( RimValveTemplate, "ValveTemplate" ); //-------------------------------------------------------------------------------------------------- RimValveTemplate::RimValveTemplate() { - CAF_PDM_InitObject( "Valve Template", ":/ICDValve16x16.png", "", "" ); + CAF_PDM_InitObject( "Valve Template", ":/ICDValve16x16.png" ); CAF_PDM_InitField( &m_valveTemplateUnit, "UnitSystem", caf::AppEnum( RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN ), - "Units System", - "", - "", - "" ); + "Units System" ); m_valveTemplateUnit.uiCapability()->setUiReadOnly( true ); CAF_PDM_InitFieldNoDefault( &m_type, "CompletionType", "Type" ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp index 9241f5f244..1f5aec2f94 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp @@ -28,7 +28,7 @@ CAF_PDM_SOURCE_INIT( RimValveTemplateCollection, "ValveTemplateCollection" ); //-------------------------------------------------------------------------------------------------- RimValveTemplateCollection::RimValveTemplateCollection() { - CAF_PDM_InitObject( "Valve Templates", ":/ICDValve16x16.png", "", "" ); + CAF_PDM_InitObject( "Valve Templates", ":/ICDValve16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_valveDefinitions, "ValveDefinitions", "" ); CAF_PDM_InitFieldNoDefault( &m_defaultUnitsForValveTemplates, "ValveUnits", "Default unit system for valve templates" ); m_defaultUnitsForValveTemplates = RiaDefines::EclipseUnitSystem::UNITS_METRIC; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp index f2a7e5fa36..f1b578ab9b 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathAicdParameters.cpp @@ -56,73 +56,43 @@ RimWellPathAicdParameters::RimWellPathAicdParameters() CAF_PDM_InitField( &m_aicdParameterFields[AICD_CRITICAL_WATER_IN_LIQUID_FRAC], "CriticalWaterLiquidFractionEmul", QString( "1*" ), - "Critical Water in Liquid Fraction for emulsions", - "", - "", - "" ); + "Critical Water in Liquid Fraction for emulsions" ); CAF_PDM_InitField( &m_aicdParameterFields[AICD_EMULSION_VISC_TRANS_REGION], "ViscosityTransitionRegionEmul", QString( "1*" ), - "Emulsion Viscosity Transition Region", - "", - "", - "" ); + "Emulsion Viscosity Transition Region" ); CAF_PDM_InitField( &m_aicdParameterFields[AICD_MAX_RATIO_EMULSION_VISC], "MaxRatioOfEmulsionVisc", QString( "1*" ), - "Max Ratio of Emulsion to Continuous Viscosity", - "", - "", - "" ); + "Max Ratio of Emulsion to Continuous Viscosity" ); CAF_PDM_InitField( &m_aicdParameterFields[AICD_MAX_FLOW_RATE], "MaxFlowRate", QString( "1*" ), - "Max Flow Rate for AICD Device (m^3 / day)", - "", - "", - "" ); + "Max Flow Rate for AICD Device (m^3 / day)" ); CAF_PDM_InitField( &m_aicdParameterFields[AICD_EXP_OIL_FRAC_DENSITY], "ExponentOilDensity", QString( "1*" ), - "Density Exponent of Oil Fraction", - "", - "", - "" ); + "Density Exponent of Oil Fraction" ); CAF_PDM_InitField( &m_aicdParameterFields[AICD_EXP_WATER_FRAC_DENSITY], "ExponentWaterDensity", QString( "1*" ), - "Density Exponent of Water Fraction", - "", - "", - "" ); + "Density Exponent of Water Fraction" ); CAF_PDM_InitField( &m_aicdParameterFields[AICD_EXP_GAS_FRAC_DENSITY], "ExponentGasDensity", QString( "1*" ), - "Density Exponent of Gas Fraction", - "", - "", - "" ); + "Density Exponent of Gas Fraction" ); CAF_PDM_InitField( &m_aicdParameterFields[AICD_EXP_OIL_FRAC_VISCOSITY], "ExponentOilViscosity", QString( "1*" ), - "Viscosity Exponent of Oil Fraction", - "", - "", - "" ); + "Viscosity Exponent of Oil Fraction" ); CAF_PDM_InitField( &m_aicdParameterFields[AICD_EXP_WATER_FRAC_VISCOSITY], "ExponentWaterViscosity", QString( "1*" ), - "Viscosity Exponent of Water Fraction", - "", - "", - "" ); + "Viscosity Exponent of Water Fraction" ); CAF_PDM_InitField( &m_aicdParameterFields[AICD_EXP_GAS_FRAC_VISCOSITY], "ExponentGasViscosity", QString( "1*" ), - "Viscosity Exponent of Gas Fraction", - "", - "", - "" ); + "Viscosity Exponent of Gas Fraction" ); std::vector allFields; this->fields( allFields ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp index 81b1f61783..979cd4cd34 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp @@ -77,7 +77,7 @@ CAF_PDM_SOURCE_INIT( RimWellPathCompletionSettings, "WellPathCompletionSettings" //-------------------------------------------------------------------------------------------------- RimWellPathCompletionSettings::RimWellPathCompletionSettings() { - CAF_PDM_InitObject( "Completion Settings", ":/CompletionsSymbol16x16.png", "", "" ); + CAF_PDM_InitObject( "Completion Settings", ":/CompletionsSymbol16x16.png" ); CAF_PDM_InitField( &m_wellNameForExport, "WellNameForExport", QString(), "Well Name" ); m_wellNameForExport.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp index e7769aaca6..8ad50eb8df 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletions.cpp @@ -49,7 +49,7 @@ CAF_PDM_SOURCE_INIT( RimWellPathCompletions, "WellPathCompletions" ); //-------------------------------------------------------------------------------------------------- RimWellPathCompletions::RimWellPathCompletions() { - CAF_PDM_InitObject( "Completions", ":/CompletionsSymbol16x16.png", "", "" ); + CAF_PDM_InitObject( "Completions", ":/CompletionsSymbol16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_perforationCollection, "Perforations", "Perforations" ); m_perforationCollection = new RimPerforationCollection; @@ -75,13 +75,7 @@ RimWellPathCompletions::RimWellPathCompletions() m_referenceDepth_OBSOLETE.xmlCapability()->setIOWritable( false ); CAF_PDM_InitFieldNoDefault( &m_preferredFluidPhase_OBSOLETE, "WellTypeForExport", "Preferred Fluid Phase" ); m_preferredFluidPhase_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_drainageRadiusForPI_OBSOLETE, - "DrainageRadiusForPI", - QString( "0.0" ), - "Drainage Radius for PI", - "", - "", - "" ); + CAF_PDM_InitField( &m_drainageRadiusForPI_OBSOLETE, "DrainageRadiusForPI", QString( "0.0" ), "Drainage Radius for PI" ); m_drainageRadiusForPI_OBSOLETE.xmlCapability()->setIOWritable( false ); CAF_PDM_InitFieldNoDefault( &m_gasInflowEquation_OBSOLETE, "GasInflowEq", "Gas Inflow Equation" ); m_gasInflowEquation_OBSOLETE.xmlCapability()->setIOWritable( false ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp index 1ef4d8cf8f..feba6d6d76 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp @@ -35,7 +35,7 @@ CAF_PDM_SOURCE_INIT( RimWellPathFracture, "WellPathFracture" ); //-------------------------------------------------------------------------------------------------- RimWellPathFracture::RimWellPathFracture( void ) { - CAF_PDM_InitObject( "Fracture", ":/FractureSymbol16x16.png", "", "" ); + CAF_PDM_InitObject( "Fracture", ":/FractureSymbol16x16.png" ); CAF_PDM_InitField( &m_measuredDepth, "MeasuredDepth", 0.0f, "Measured Depth Location" ); m_measuredDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp index 00282f1ec2..16714da3ab 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp @@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimWellPathFractureCollection, "WellPathFractureCollection" //-------------------------------------------------------------------------------------------------- RimWellPathFractureCollection::RimWellPathFractureCollection( void ) { - CAF_PDM_InitObject( "Fractures", ":/FractureLayout16x16.png", "", "" ); + CAF_PDM_InitObject( "Fractures", ":/FractureLayout16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_fractures, "Fractures", "" ); m_fractures.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp index f934ab32cd..aac818612a 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp @@ -44,7 +44,7 @@ CAF_PDM_SOURCE_INIT( RimWellPathValve, "WellPathValve" ); //-------------------------------------------------------------------------------------------------- RimWellPathValve::RimWellPathValve() { - CAF_PDM_InitObject( "WellPathValve", ":/ICDValve16x16.png", "", "" ); + CAF_PDM_InitObject( "WellPathValve", ":/ICDValve16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_valveTemplate, "ValveTemplate", "Valve Template" ); CAF_PDM_InitField( &m_measuredDepth, "StartMeasuredDepth", 0.0, "Start MD" ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp index 27c565d1cc..716d572bd9 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp @@ -50,7 +50,7 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimAbstractCorrelationPlot, "AbstractCorrelationPl RimAbstractCorrelationPlot::RimAbstractCorrelationPlot() : m_selectMultipleVectors( false ) { - CAF_PDM_InitObject( "Abstract Correlation Plot", ":/CorrelationPlot16x16.png", "", "" ); + CAF_PDM_InitObject( "Abstract Correlation Plot", ":/CorrelationPlot16x16.png" ); this->setDeletable( true ); CAF_PDM_InitFieldNoDefault( &m_selectedVarsUiField, "SelectedVariableDisplayVar", "Vector" ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index 3854b390b2..0ed0e8a7b1 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -153,7 +153,7 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot() : RimAbstractCorrelationPlot() , matrixCellSelected( this ) { - CAF_PDM_InitObject( "Correlation Plot", ":/CorrelationMatrixPlot16x16.png", "", "" ); + CAF_PDM_InitObject( "Correlation Plot", ":/CorrelationMatrixPlot16x16.png" ); CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values" ); CAF_PDM_InitFieldNoDefault( &m_sortByValues, "CorrelationSorting", "Sort Matrix by Values" ); @@ -161,10 +161,7 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot() CAF_PDM_InitField( &m_excludeParametersWithoutVariation, "ExcludeParamsWithoutVariation", true, - "Exclude Parameters Without Variation", - "", - "", - "" ); + "Exclude Parameters Without Variation" ); CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", true, "Show Only Top Correlations" ); CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 20, "Number rows/columns" ); CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "" ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp index 1bd83921e4..3986a95dcc 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp @@ -55,17 +55,14 @@ RimCorrelationPlot::RimCorrelationPlot() : RimAbstractCorrelationPlot() , tornadoItemSelected( this ) { - CAF_PDM_InitObject( "Correlation Tornado Plot", ":/CorrelationTornadoPlot16x16.png", "", "" ); + CAF_PDM_InitObject( "Correlation Tornado Plot", ":/CorrelationTornadoPlot16x16.png" ); CAF_PDM_InitField( &m_showAbsoluteValues, "CorrelationAbsValues", false, "Show Absolute Values" ); CAF_PDM_InitField( &m_sortByAbsoluteValues, "CorrelationAbsSorting", true, "Sort by Absolute Values" ); CAF_PDM_InitField( &m_excludeParametersWithoutVariation, "ExcludeParamsWithoutVariation", true, - "Exclude Parameters Without Variation", - "", - "", - "" ); + "Exclude Parameters Without Variation" ); CAF_PDM_InitField( &m_showOnlyTopNCorrelations, "ShowOnlyTopNCorrelations", true, "Show Only Top Correlations" ); CAF_PDM_InitField( &m_topNFilterCount, "TopNFilterCount", 20, "Number rows/columns" ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp index aed8b5d18c..78c5ad7e40 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp @@ -34,7 +34,7 @@ CAF_PDM_SOURCE_INIT( RimCorrelationPlotCollection, "CorrelationPlotCollection" ) //-------------------------------------------------------------------------------------------------- RimCorrelationPlotCollection::RimCorrelationPlotCollection() { - CAF_PDM_InitObject( "Ensemble Correlation Plots", ":/CorrelationPlots16x16.png", "", "" ); + CAF_PDM_InitObject( "Ensemble Correlation Plots", ":/CorrelationPlots16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_correlationPlots, "CorrelationPlots", "Correlation Plots" ); CAF_PDM_InitFieldNoDefault( &m_correlationReports, "CorrelationReports", "Correlation Reports" ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp index eda2bdaaf1..7689ebaee6 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp @@ -51,7 +51,7 @@ CAF_PDM_SOURCE_INIT( RimCorrelationReportPlot, "CorrelationReportPlot" ); //-------------------------------------------------------------------------------------------------- RimCorrelationReportPlot::RimCorrelationReportPlot() { - CAF_PDM_InitObject( "Correlation Report Plot", ":/CorrelationReportPlot16x16.png", "", "" ); + CAF_PDM_InitObject( "Correlation Report Plot", ":/CorrelationReportPlot16x16.png" ); this->setDeletable( true ); CAF_PDM_InitFieldNoDefault( &m_plotWindowTitle, "PlotWindowTitle", "Title" ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp index fe5fa1c3e7..ec48fd998a 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp @@ -66,7 +66,7 @@ CAF_PDM_SOURCE_INIT( RimParameterResultCrossPlot, "ParameterResultCrossPlot" ); RimParameterResultCrossPlot::RimParameterResultCrossPlot() : RimAbstractCorrelationPlot() { - CAF_PDM_InitObject( "ParameterResultCross Plot", ":/CorrelationCrossPlot16x16.png", "", "" ); + CAF_PDM_InitObject( "ParameterResultCross Plot", ":/CorrelationCrossPlot16x16.png" ); CAF_PDM_InitField( &m_ensembleParameter, "EnsembleParameter", QString( "" ), "Ensemble Parameter" ); m_ensembleParameter.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInView.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInView.cpp index 0f35749077..264558bb7d 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInView.cpp @@ -31,7 +31,7 @@ CAF_PDM_SOURCE_INIT( RimFaultInView, "Fault" ); //-------------------------------------------------------------------------------------------------- RimFaultInView::RimFaultInView() { - CAF_PDM_InitObject( "RimFault", ":/draw_style_faults_24x24.png", "", "" ); + CAF_PDM_InitObject( "RimFault", ":/draw_style_faults_24x24.png" ); CAF_PDM_InitFieldNoDefault( &name, "FaultName", "Name" ); name.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp index 46668e5d49..0e181e9f80 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp @@ -61,7 +61,7 @@ CAF_PDM_SOURCE_INIT( RimFaultInViewCollection, "Faults" ); //-------------------------------------------------------------------------------------------------- RimFaultInViewCollection::RimFaultInViewCollection() { - CAF_PDM_InitObject( "Faults", ":/draw_style_faults_24x24.png", "", "" ); + CAF_PDM_InitObject( "Faults", ":/draw_style_faults_24x24.png" ); CAF_PDM_InitField( &showFaultCollection, "Active", true, "Active" ); showFaultCollection.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPostprocSettings.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPostprocSettings.cpp index 031c09847d..c2f1ff8d53 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPostprocSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPostprocSettings.cpp @@ -30,7 +30,7 @@ //-------------------------------------------------------------------------------------------------- RimFaultRAPostprocSettings::RimFaultRAPostprocSettings() { - CAF_PDM_InitObject( "Reactivation Assessment Postproc Settings", ":/fault_react_24x24.png", "", "" ); + CAF_PDM_InitObject( "Reactivation Assessment Postproc Settings", ":/fault_react_24x24.png" ); CAF_PDM_InitField( &m_baseDir, "BaseDir", QString( "" ), "Working Directory" ); CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step" ); diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp index cb088e1168..7678f73031 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp @@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT( RimFaultRAPreprocSettings, "RimFaultRAPreprocSettings" ); //-------------------------------------------------------------------------------------------------- RimFaultRAPreprocSettings::RimFaultRAPreprocSettings() { - CAF_PDM_InitObject( "Fault RA Preproc Settings", ":/fault_react_24x24.png", "", "" ); + CAF_PDM_InitObject( "Fault RA Preproc Settings", ":/fault_react_24x24.png" ); CAF_PDM_InitField( &m_startTimestepEclipse, "StartTimeStepEclipse", 0, "Start Time Step" ); m_startTimestepEclipse.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp index 69b28c9e5d..637e0510cd 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp @@ -53,7 +53,7 @@ CAF_PDM_SOURCE_INIT( RimFaultRASettings, "RimFaultRASettings" ); //-------------------------------------------------------------------------------------------------- RimFaultRASettings::RimFaultRASettings() { - CAF_PDM_InitObject( "Reactivation Assessment Settings", ":/fault_react_24x24.png", "", "" ); + CAF_PDM_InitObject( "Reactivation Assessment Settings", ":/fault_react_24x24.png" ); CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" ); m_eclipseCase.uiCapability()->setUiReadOnly( true ); @@ -83,13 +83,8 @@ RimFaultRASettings::RimFaultRASettings() m_endTimestepGeoMech.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); m_endTimestepGeoMech.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_basicParameters, "BasicParameters", "Basic Processing Parameters", ":/Bullet.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &m_advancedParameters, - "AdvancedParameters", - "Advanced Processing Parameters", - ":/Bullet.png", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_basicParameters, "BasicParameters", "Basic Processing Parameters", ":/Bullet.png" ); + CAF_PDM_InitFieldNoDefault( &m_advancedParameters, "AdvancedParameters", "Advanced Processing Parameters", ":/Bullet.png" ); CAF_PDM_InitFieldNoDefault( &m_basicParametersRI, "BasicParametersRI", "Basic ResInsight Parameters" ); CAF_PDM_InitFieldNoDefault( &m_advancedParametersRI, "AdvancedParametersRI", "Advanced ResInsight Parameters" ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp index fbedaf8bfa..42648cc6ad 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp @@ -68,7 +68,7 @@ CAF_PDM_SOURCE_INIT( RimFlowCharacteristicsPlot, "FlowCharacteristicsPlot" ); //-------------------------------------------------------------------------------------------------- RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot() { - CAF_PDM_InitObject( "Flow Characteristics", ":/FlowCharPlot16x16.png", "", "" ); + CAF_PDM_InitObject( "Flow Characteristics", ":/FlowCharPlot16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_case, "FlowCase", "Case" ); CAF_PDM_InitFieldNoDefault( &m_flowDiagSolution, "FlowDiagSolution", "Flow Diag Solution" ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp index f61dfb9969..e2a3390fe3 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp @@ -33,7 +33,7 @@ CAF_PDM_SOURCE_INIT( RimFlowPlotCollection, "FlowPlotCollection" ); //-------------------------------------------------------------------------------------------------- RimFlowPlotCollection::RimFlowPlotCollection() { - CAF_PDM_InitObject( "Flow Diagnostics Plots", ":/WellAllocPlots16x16.png", "", "" ); + CAF_PDM_InitObject( "Flow Diagnostics Plots", ":/WellAllocPlots16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_flowCharacteristicsPlot, "FlowCharacteristicsPlot", "" ); m_flowCharacteristicsPlot.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp index f4774a6f73..293f875dfa 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp @@ -44,7 +44,7 @@ CAF_PDM_SOURCE_INIT( RimTofAccumulatedPhaseFractionsPlot, "TofAccumulatedPhaseFr //-------------------------------------------------------------------------------------------------- RimTofAccumulatedPhaseFractionsPlot::RimTofAccumulatedPhaseFractionsPlot() { - CAF_PDM_InitObject( "Cumulative Saturation by Time of Flight", ":/TOFAccSatPlot16x16.png", "", "" ); + CAF_PDM_InitObject( "Cumulative Saturation by Time of Flight", ":/TOFAccSatPlot16x16.png" ); CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Cumulative Saturation by Time of Flight" ), "Name" ); m_userName.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp index d028fff882..6442981c97 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp @@ -42,7 +42,7 @@ CAF_PDM_SOURCE_INIT( RimTotalWellAllocationPlot, "TotalWellAllocationPlot" ); //-------------------------------------------------------------------------------------------------- RimTotalWellAllocationPlot::RimTotalWellAllocationPlot() { - CAF_PDM_InitObject( "Total Allocation", ":/WellAllocPie16x16.png", "", "" ); + CAF_PDM_InitObject( "Total Allocation", ":/WellAllocPie16x16.png" ); CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Total Allocation" ), "Name" ); m_userName.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index c00e3a3f60..6e88e85305 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -74,7 +74,7 @@ void AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RimWellAllocationPlot::RimWellAllocationPlot() { - CAF_PDM_InitObject( "Well Allocation Plot", ":/WellAllocPlot16x16.png", "", "" ); + CAF_PDM_InitObject( "Well Allocation Plot", ":/WellAllocPlot16x16.png" ); CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "Flow Diagnostics Plot" ), "Name" ); m_userName.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlotLegend.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlotLegend.cpp index d3f9faf106..ecf96e9600 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlotLegend.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlotLegend.cpp @@ -26,7 +26,7 @@ CAF_PDM_SOURCE_INIT( RimWellAllocationPlotLegend, "WellAllocationPlotLegend" ); //-------------------------------------------------------------------------------------------------- RimWellAllocationPlotLegend::RimWellAllocationPlotLegend() { - CAF_PDM_InitObject( "Legend", ":/WellAllocLegend16x16.png", "", "" ); + CAF_PDM_InitObject( "Legend", ":/WellAllocLegend16x16.png" ); CAF_PDM_InitField( &m_showLegend, "ShowPlotLegend", true, "Show Plot Legend" ); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp index a3e3e3a607..bccd8debb0 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp @@ -69,10 +69,7 @@ RimWellDistributionPlot::RimWellDistributionPlot( RiaDefines::PhaseType phase ) CAF_PDM_InitField( &m_smallContributionsRelativeThreshold, "SmallContributionsRelativeThreshold", 0.005, - "Relative Threshold [0, 1]", - "", - "", - "" ); + "Relative Threshold [0, 1]" ); CAF_PDM_InitField( &m_maximumTof, "MaximumTOF", 20.0, "Maximum Time of Flight [0, 200]" ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp index 8c6dfe99b6..47b4d156cf 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp @@ -59,7 +59,7 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection() { // cvf::Trace::show("RimWellDistributionPlotCollection::RimWellDistributionPlotCollection()"); - CAF_PDM_InitObject( "Cumulative Phase Distribution Plot", ":/CumulativePhaseDist16x16.png", "", "" ); + CAF_PDM_InitObject( "Cumulative Phase Distribution Plot", ":/CumulativePhaseDist16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case" ); CAF_PDM_InitField( &m_timeStepIndex, "TimeStepIndex", -1, "Time Step" ); @@ -68,10 +68,7 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection() CAF_PDM_InitField( &m_smallContributionsRelativeThreshold, "SmallContributionsRelativeThreshold", 0.005, - "Relative Threshold [0, 1]", - "", - "", - "" ); + "Relative Threshold [0, 1]" ); CAF_PDM_InitField( &m_maximumTof, "MaximumTOF", 20.0, "Maximum Time of Flight [0, 200]" ); @@ -83,13 +80,7 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection() CAF_PDM_InitField( &m_showGas, "ShowGas", true, "Show Gas" ); CAF_PDM_InitField( &m_showWater, "ShowWater", true, "Show Water" ); - CAF_PDM_InitField( &m_plotWindowTitle, - "PlotDescription", - QString( "Cumulative Phase Distribution Plots" ), - "Name", - "", - "", - "" ); + CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "Cumulative Phase Distribution Plots" ), "Name" ); m_showWindow = false; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 6d453c3287..6f01c57815 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -98,7 +98,7 @@ 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_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "WellLog" ); m_wellLogPlot_OBSOLETE.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp index 9dbab135f8..969d960179 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp @@ -38,7 +38,7 @@ CAF_PDM_SOURCE_INIT( RimWellRftEnsembleCurveSet, "WellRftEnsembleCurveSet" ); //-------------------------------------------------------------------------------------------------- RimWellRftEnsembleCurveSet::RimWellRftEnsembleCurveSet() { - CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png", "", "" ); + CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_ensemble, "Ensemble", "Ensemble" ); m_ensemble.uiCapability()->setUiTreeChildrenHidden( true ); m_ensemble.uiCapability()->setAutoAddingOptionFromValue( false ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index b1c48c05e3..c270833651 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -82,7 +82,7 @@ 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_showStatisticsCurves, "ShowStatisticsCurves", true, "Show Statistics Curves" ); CAF_PDM_InitField( &m_showEnsembleCurves, "ShowEnsembleCurves", true, "Show Ensemble Curves" ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp index 3ac6c28523..80fc5d7f94 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp @@ -153,17 +153,8 @@ RimGeoMechCase::RimGeoMechCase( void ) CAF_PDM_InitField( &m_initialPermeabilityType, "InitialPermeabilityType", defaultInitialPermeabilityType, - "Initial Permeability", - "", - "", - "" ); - CAF_PDM_InitField( &m_initialPermeabilityFixed, - "InitialPermeabilityFixed", - 1.0, - "Fixed Initial Permeability [mD]", - "", - "", - "" ); + "Initial Permeability" ); + CAF_PDM_InitField( &m_initialPermeabilityFixed, "InitialPermeabilityFixed", 1.0, "Fixed Initial Permeability [mD]" ); m_initialPermeabilityFixed.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); CAF_PDM_InitField( &m_initialPermeabilityResultAddress, "InitialPermeabilityAddress", QString( "" ), "Value" ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp index c288a0f957..72e7f6ed59 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp @@ -59,16 +59,13 @@ CAF_PDM_SOURCE_INIT( RimGeoMechContourMapProjection, "RimGeoMechContourMapProjec RimGeoMechContourMapProjection::RimGeoMechContourMapProjection() : m_kLayers( 0u ) { - CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png", "", "" ); + CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png" ); CAF_PDM_InitField( &m_limitToPorePressureRegions, "LimitToPorRegion", true, "Limit to Pore Pressure regions" ); CAF_PDM_InitField( &m_applyPPRegionLimitVertically, "VerticalLimit", false, "Apply Limit Vertically" ); CAF_PDM_InitField( &m_paddingAroundPorePressureRegion, "PaddingAroundPorRegion", 0.0, - "Horizontal Padding around PP regions", - "", - "", - "" ); + "Horizontal Padding around PP regions" ); m_paddingAroundPorePressureRegion.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); setName( "Map Projection" ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapViewCollection.cpp index 9a585ec95b..61974dc1b2 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapViewCollection.cpp @@ -10,9 +10,9 @@ CAF_PDM_SOURCE_INIT( RimGeoMechContourMapViewCollection, "GeoMech2dViewCollectio //-------------------------------------------------------------------------------------------------- RimGeoMechContourMapViewCollection::RimGeoMechContourMapViewCollection() { - CAF_PDM_InitObject( "GeoMech Contour Maps", ":/2DMaps16x16.png", "", "" ); + CAF_PDM_InitObject( "GeoMech Contour Maps", ":/2DMaps16x16.png" ); - CAF_PDM_InitFieldNoDefault( &m_contourMapViews, "GeoMechViews", "Contour Maps", ":/CrossSection16x16.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_contourMapViews, "GeoMechViews", "Contour Maps", ":/CrossSection16x16.png" ); m_contourMapViews.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp index cacbf602cb..1ba13b3d44 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp @@ -34,7 +34,7 @@ CAF_PDM_SOURCE_INIT( RimGeoMechModels, "ResInsightGeoMechModels" ); //-------------------------------------------------------------------------------------------------- RimGeoMechModels::RimGeoMechModels( void ) { - CAF_PDM_InitObject( "Geomechanical Models", ":/GeoMechCases48x48.png", "", "" ); + CAF_PDM_InitObject( "Geomechanical Models", ":/GeoMechCases48x48.png" ); CAF_PDM_InitFieldNoDefault( &m_cases, "Cases", "" ); m_cases.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp index bcf36365dc..677c549d97 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp @@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimGeoMechPart, "GeoMechPart" ); //-------------------------------------------------------------------------------------------------- RimGeoMechPart::RimGeoMechPart() { - CAF_PDM_InitScriptableObject( "GeoMechPart", ":/GeoMechCase24x24.png", "", "" ); + CAF_PDM_InitScriptableObject( "GeoMechPart", ":/GeoMechCase24x24.png" ); CAF_PDM_InitScriptableFieldNoDefault( &m_partId, "PartId", "Part Id" ); m_partId.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp index 4f1346e9ea..ed591abb0b 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp @@ -41,7 +41,7 @@ RimGeoMechPartCollection::RimGeoMechPartCollection() , m_currentScaleFactor( 1.0 ) , m_noDisplacements() { - CAF_PDM_InitScriptableObject( "Parts", ":/GeoMechCase24x24.png", "", "" ); + CAF_PDM_InitScriptableObject( "Parts", ":/GeoMechCase24x24.png" ); CAF_PDM_InitScriptableFieldNoDefault( &m_parts, "Parts", "Parts" ); m_parts.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp index de1650bb0b..0d37e84d2a 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp @@ -76,7 +76,7 @@ CAF_PDM_SOURCE_INIT( RimGeoMechResultDefinition, "GeoMechResultDefinition" ); //-------------------------------------------------------------------------------------------------- RimGeoMechResultDefinition::RimGeoMechResultDefinition( void ) { - CAF_PDM_InitObject( "Color Result", ":/CellResult.png", "", "" ); + CAF_PDM_InitObject( "Color Result", ":/CellResult.png" ); CAF_PDM_InitFieldNoDefault( &m_resultPositionType, "ResultPositionType", "Result Position" ); m_resultPositionType.uiCapability()->setUiHidden( true ); @@ -90,10 +90,7 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition( void ) CAF_PDM_InitField( &m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", RigFemResultAddress::noTimeLapseValue(), - "Base Time Step", - "", - "", - "" ); + "Base Time Step" ); CAF_PDM_InitField( &m_referenceTimeStep, "ReferenceTimeStep", 0, "Reference Time Step" ); CAF_PDM_InitField( &m_compactionRefLayer, "CompactionRefLayer", 0, "Compaction Ref Layer" ); @@ -108,13 +105,7 @@ RimGeoMechResultDefinition::RimGeoMechResultDefinition( void ) m_resultVariableUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); m_resultVariableUiField.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitField( &m_normalizeByHydrostaticPressure, - "NormalizeByHSP", - false, - "Normalize by Hydrostatic Pressure", - "", - "", - "" ); + CAF_PDM_InitField( &m_normalizeByHydrostaticPressure, "NormalizeByHSP", false, "Normalize by Hydrostatic Pressure" ); CAF_PDM_InitField( &m_normalizationAirGap, "NormalizationAirGap", 0.0, "Air Gap" ); m_normalizationAirGap.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp index 6f2d318683..dc0b729851 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp @@ -86,7 +86,7 @@ RimGeoMechView::RimGeoMechView( void ) { CAF_PDM_InitScriptableObject( "Geomechanical View", ":/3DViewGeoMech16x16.png", "", "The Geomechanical 3d View" ); - CAF_PDM_InitFieldNoDefault( &cellResult, "GridCellResult", "Color Result", ":/CellResult.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &cellResult, "GridCellResult", "Color Result", ":/CellResult.png" ); cellResult = new RimGeoMechCellColors(); cellResult.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index 204dda826c..8b0ad9a7f5 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -52,7 +52,7 @@ 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" ); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp index 87f4f4548e..51c3fdaeb3 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp @@ -27,7 +27,7 @@ CAF_PDM_SOURCE_INIT( RimGridCrossPlotCollection, "RimGridCrossPlotCollection" ); //-------------------------------------------------------------------------------------------------- RimGridCrossPlotCollection::RimGridCrossPlotCollection() { - CAF_PDM_InitObject( "Grid Cross Plots", ":/SummaryXPlotsLight16x16.png", "", "" ); + CAF_PDM_InitObject( "Grid Cross Plots", ":/SummaryXPlotsLight16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_gridCrossPlots, "GridCrossPlots", "Grid Cross Plots" ); m_gridCrossPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp index aa6d669828..b62f3665a9 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp @@ -50,7 +50,7 @@ RimGridCrossPlotCurve::RimGridCrossPlotCurve() : m_dataSetIndex( 0 ) , m_groupIndex( 0 ) { - CAF_PDM_InitObject( "Cross Plot Points", ":/WellLogCurve16x16.png", "", "" ); + CAF_PDM_InitObject( "Cross Plot Points", ":/WellLogCurve16x16.png" ); setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); setSymbol( RiuQwtSymbol::SYMBOL_NONE ); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp index 7e726ea1fc..c245681a57 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp @@ -84,7 +84,7 @@ 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 ); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp index b8016fa861..19c38dd986 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp @@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT( RimSaturationPressurePlot, "RimSaturationPressurePlot" ); //-------------------------------------------------------------------------------------------------- RimSaturationPressurePlot::RimSaturationPressurePlot() { - CAF_PDM_InitObject( "Saturation Pressure Plot", ":/SummaryXPlotLight16x16.png", "", "" ); + CAF_PDM_InitObject( "Saturation Pressure Plot", ":/SummaryXPlotLight16x16.png" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp index 338b756ded..7dccc1a41b 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp @@ -34,7 +34,7 @@ CAF_PDM_SOURCE_INIT( RimSaturationPressurePlotCollection, "RimSaturationPressure //-------------------------------------------------------------------------------------------------- RimSaturationPressurePlotCollection::RimSaturationPressurePlotCollection() { - CAF_PDM_InitObject( "Saturation Pressure Plots", ":/SummaryXPlotsLight16x16.png", "", "" ); + CAF_PDM_InitObject( "Saturation Pressure Plots", ":/SummaryXPlotsLight16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_saturationPressurePlots, "SaturationPressurePlots", "Saturation Pressure Plots" ); m_saturationPressurePlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimBoxIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimBoxIntersection.cpp index 0d2f999e8d..6f009a2f1c 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimBoxIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimBoxIntersection.cpp @@ -63,17 +63,14 @@ const RivIntersectionGeometryGeneratorInterface* RimBoxIntersection::intersectio //-------------------------------------------------------------------------------------------------- RimBoxIntersection::RimBoxIntersection() { - CAF_PDM_InitObject( "Intersection Box", ":/IntersectionBox16x16.png", "", "" ); + CAF_PDM_InitObject( "Intersection Box", ":/IntersectionBox16x16.png" ); CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name" ); CAF_PDM_InitField( &m_singlePlaneState, "singlePlaneState", caf::AppEnum( SinglePlaneState::PLANE_STATE_NONE ), - "Box Type", - "", - "", - "" ); + "Box Type" ); CAF_PDM_InitField( &m_minXCoord, "MinXCoord", 0.0, "Min" ); m_minXCoord.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp index 4dde235551..7397a9668d 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp @@ -196,7 +196,7 @@ void RimExtrudedCurveIntersection::configureForAzimuthLine() //-------------------------------------------------------------------------------------------------- RimExtrudedCurveIntersection::RimExtrudedCurveIntersection() { - CAF_PDM_InitObject( "Intersection", ":/CrossSection16x16.png", "", "" ); + CAF_PDM_InitObject( "Intersection", ":/CrossSection16x16.png" ); CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name" ); CAF_PDM_InitFieldNoDefault( &m_type, "Type", "Type" ); diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp index 3efe1dc6ee..7ec149ace0 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp @@ -50,7 +50,7 @@ CAF_PDM_SOURCE_INIT( RimIntersectionCollection, "CrossSectionCollection" ); //-------------------------------------------------------------------------------------------------- RimIntersectionCollection::RimIntersectionCollection() { - CAF_PDM_InitObject( "Intersections", ":/CrossSections16x16.png", "", "" ); + CAF_PDM_InitObject( "Intersections", ":/CrossSections16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_intersections, "CrossSections", "Intersections" ); m_intersections.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp index e83138aad3..c57b807dfd 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp @@ -42,7 +42,7 @@ CAF_PDM_SOURCE_INIT( RimIntersectionResultDefinition, "IntersectionResultDefinit //-------------------------------------------------------------------------------------------------- RimIntersectionResultDefinition::RimIntersectionResultDefinition() { - CAF_PDM_InitObject( "Intersection Result Definition", ":/CellResult.png", "", "" ); + CAF_PDM_InitObject( "Intersection Result Definition", ":/CellResult.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp index 3af6d88be4..ba669d4a05 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp @@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimIntersectionResultsDefinitionCollection, "RimIntersectio //-------------------------------------------------------------------------------------------------- RimIntersectionResultsDefinitionCollection::RimIntersectionResultsDefinitionCollection() { - CAF_PDM_InitObject( "Intersection Results", ":/CrossSections16x16.png", "", "" ); + CAF_PDM_InitObject( "Intersection Results", ":/CrossSections16x16.png" ); CAF_PDM_InitField( &m_isActive, "isActive", false, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Measurement/RimMeasurement.cpp b/ApplicationLibCode/ProjectDataModel/Measurement/RimMeasurement.cpp index 73bad806b1..a1c82d5f61 100644 --- a/ApplicationLibCode/ProjectDataModel/Measurement/RimMeasurement.cpp +++ b/ApplicationLibCode/ProjectDataModel/Measurement/RimMeasurement.cpp @@ -39,7 +39,7 @@ CAF_PDM_SOURCE_INIT( RimMeasurement, "RimMeasurement" ); RimMeasurement::RimMeasurement() : m_measurementMode( MEASURE_DISABLED ) { - CAF_PDM_InitObject( "Measurement", ":/TextAnnotation16x16.png", "", "" ); + CAF_PDM_InitObject( "Measurement", ":/TextAnnotation16x16.png" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Parameters/RimGenericParameter.cpp b/ApplicationLibCode/ProjectDataModel/Parameters/RimGenericParameter.cpp index 637c2608f0..8f9dd4f1a7 100644 --- a/ApplicationLibCode/ProjectDataModel/Parameters/RimGenericParameter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Parameters/RimGenericParameter.cpp @@ -34,7 +34,7 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimGenericParameter, "GenericParameter" ); //-------------------------------------------------------------------------------------------------- RimGenericParameter::RimGenericParameter() { - CAF_PDM_InitObject( "Parameter", ":/Bullet.png", "", "" ); + CAF_PDM_InitObject( "Parameter", ":/Bullet.png" ); CAF_PDM_InitField( &m_name, "Name", QString(), "Name" ); m_name.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp index a2e51185df..517384de5b 100644 --- a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp @@ -38,7 +38,7 @@ CAF_PDM_SOURCE_INIT( RimParameterGroup, "ParameterGroup" ); //-------------------------------------------------------------------------------------------------- RimParameterGroup::RimParameterGroup() { - CAF_PDM_InitObject( "Parameter Group", ":/Bullet.png", "", "" ); + CAF_PDM_InitObject( "Parameter Group", ":/Bullet.png" ); uiCapability()->setUiTreeChildrenHidden( true ); CAF_PDM_InitFieldNoDefault( &m_parameters, "Parameters", "Parameters" ); diff --git a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterList.cpp b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterList.cpp index 70e2622344..174b6012cd 100644 --- a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterList.cpp +++ b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterList.cpp @@ -29,7 +29,7 @@ CAF_PDM_SOURCE_INIT( RimParameterList, "ParameterList" ); //-------------------------------------------------------------------------------------------------- RimParameterList::RimParameterList() { - CAF_PDM_InitObject( "Parameter List", ":/Bullet.png", "", "" ); + CAF_PDM_InitObject( "Parameter List", ":/Bullet.png" ); uiCapability()->setUiTreeChildrenHidden( true ); CAF_PDM_InitFieldNoDefault( &m_parameterNames, "ParameterNames", "Parameters" ); diff --git a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp index 9defb5d883..1d964db4e6 100644 --- a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp @@ -35,7 +35,7 @@ CAF_PDM_SOURCE_INIT( RimPlotTemplateFolderItem, "PlotTemplateCollection" ); //-------------------------------------------------------------------------------------------------- RimPlotTemplateFolderItem::RimPlotTemplateFolderItem() { - CAF_PDM_InitObject( "PlotTemplateCollection", ":/Folder.png", "", "" ); + CAF_PDM_InitObject( "PlotTemplateCollection", ":/Folder.png" ); CAF_PDM_InitFieldNoDefault( &m_folderName, "FolderName", "Folder" ); CAF_PDM_InitFieldNoDefault( &m_fileNames, "FileNames", "" ); diff --git a/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp b/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp index 83aaeb7c39..6629a7fce1 100644 --- a/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp +++ b/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp @@ -37,7 +37,7 @@ RimProcess::RimProcess() int defId = m_nextProcessId++; m_monitor = new RimProcessMonitor( defId ); - CAF_PDM_InitObject( "ResInsight Process", ":/Erase.png", "", "" ); + CAF_PDM_InitObject( "ResInsight Process", ":/Erase.png" ); CAF_PDM_InitFieldNoDefault( &m_command, "Command", "Command" ); m_command.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp index dc77670cd8..1dc1deae75 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp @@ -63,9 +63,9 @@ const cvf::Mat4d Rim2dIntersectionView::sm_defaultViewMatrix = //-------------------------------------------------------------------------------------------------- Rim2dIntersectionView::Rim2dIntersectionView( void ) { - CAF_PDM_InitObject( "Intersection View", ":/CrossSection16x16.png", "", "" ); + CAF_PDM_InitObject( "Intersection View", ":/CrossSection16x16.png" ); - CAF_PDM_InitFieldNoDefault( &m_intersection, "Intersection", "Intersection", ":/CrossSection16x16.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_intersection, "Intersection", "Intersection", ":/CrossSection16x16.png" ); m_intersection.uiCapability()->setUiHidden( true ); CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend" ); diff --git a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionViewCollection.cpp index 7550347646..65aefd1f73 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionViewCollection.cpp @@ -29,14 +29,9 @@ CAF_PDM_SOURCE_INIT( Rim2dIntersectionViewCollection, "Intersection2dViewCollect //-------------------------------------------------------------------------------------------------- Rim2dIntersectionViewCollection::Rim2dIntersectionViewCollection() { - CAF_PDM_InitObject( "2D Intersection Views", ":/CrossSection16x16.png", "", "" ); - - CAF_PDM_InitFieldNoDefault( &m_intersectionViews, - "IntersectionViews", - "Intersection Views", - ":/CrossSection16x16.png", - "", - "" ); + CAF_PDM_InitObject( "2D Intersection Views", ":/CrossSection16x16.png" ); + + CAF_PDM_InitFieldNoDefault( &m_intersectionViews, "IntersectionViews", "Intersection Views", ":/CrossSection16x16.png" ); m_intersectionViews.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index 9120902919..e90f418438 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -76,7 +76,7 @@ CAF_PDM_SOURCE_INIT( Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig" ); //-------------------------------------------------------------------------------------------------- Rim3dOverlayInfoConfig::Rim3dOverlayInfoConfig() { - CAF_PDM_InitObject( "Info Box", ":/InfoBox16x16.png", "", "" ); + CAF_PDM_InitObject( "Info Box", ":/InfoBox16x16.png" ); CAF_PDM_InitField( &m_active, "Active", true, "Active" ); m_active.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 1a8ca14ebb..b444f33dc8 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -137,13 +137,7 @@ Rim3dView::Rim3dView() CAF_PDM_InitField( &meshMode, "MeshMode", defaultMeshType, "Grid Lines" ); CAF_PDM_InitFieldNoDefault( &surfaceMode, "SurfaceMode", "Grid Surface" ); - CAF_PDM_InitScriptableField( &m_showGridBox, - "ShowGridBox", - RiaPreferences::current()->showGridBox(), - "Show Grid Box", - "", - "", - "" ); + CAF_PDM_InitScriptableField( &m_showGridBox, "ShowGridBox", RiaPreferences::current()->showGridBox(), "Show Grid Box" ); CAF_PDM_InitScriptableField( &m_disableLighting, "DisableLighting", diff --git a/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp b/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp index 5982ea3e88..1105f321ed 100644 --- a/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp @@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT( RimAdvancedSnapshotExportDefinition, "MultiSnapshotDefiniti //-------------------------------------------------------------------------------------------------- RimAdvancedSnapshotExportDefinition::RimAdvancedSnapshotExportDefinition() { - // CAF_PDM_InitObject("MultiSnapshotDefinition", ":/Well.svg", "", ""); + // CAF_PDM_InitObject("MultiSnapshotDefinition", ":/Well.svg"); CAF_PDM_InitObject( "MultiSnapshotDefinition" ); CAF_PDM_InitField( &isActive, "IsActive", true, "Active" ); @@ -56,10 +56,7 @@ RimAdvancedSnapshotExportDefinition::RimAdvancedSnapshotExportDefinition() CAF_PDM_InitField( &sliceDirection, "SnapShotDirection", caf::AppEnum( RiaDefines::GridCaseAxis::UNDEFINED_AXIS ), - "Range Filter Slice", - "", - "", - "" ); + "Range Filter Slice" ); CAF_PDM_InitField( &startSliceIndex, "RangeFilterStart", 1, "Range Start" ); CAF_PDM_InitField( &endSliceIndex, "RangeFilterEnd", 1, "Range End" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimCase.cpp b/ApplicationLibCode/ProjectDataModel/RimCase.cpp index ffc79c349a..5ccb277205 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCase.cpp @@ -74,9 +74,7 @@ RimCase::RimCase() CAF_PDM_InitFieldNoDefault( &m_2dIntersectionViewCollection, "IntersectionViewCollection", "2D Intersection Views", - ":/CrossSections16x16.png", - "", - "" ); + ":/CrossSections16x16.png" ); m_2dIntersectionViewCollection.uiCapability()->setUiTreeHidden( true ); m_2dIntersectionViewCollection = new Rim2dIntersectionViewCollection(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp index 9423ce05ac..6c8d20b4e2 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp @@ -52,7 +52,7 @@ CAF_PDM_SOURCE_INIT( RimCellEdgeColors, "CellEdgeResultSlot" ); //-------------------------------------------------------------------------------------------------- RimCellEdgeColors::RimCellEdgeColors() { - CAF_PDM_InitObject( "Cell Edge Result", ":/EdgeResult_1.png", "", "" ); + CAF_PDM_InitObject( "Cell Edge Result", ":/EdgeResult_1.png" ); CAF_PDM_InitField( &m_enableCellEdgeColors, "EnableCellEdgeColors", true, "Enable Cell Edge Results" ); @@ -63,14 +63,9 @@ RimCellEdgeColors::RimCellEdgeColors() CAF_PDM_InitField( &useYVariable, "UseYVariable", true, "Use Y Values" ); CAF_PDM_InitField( &useZVariable, "UseZVariable", true, "Use Z Values" ); - CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", ":/Legend.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend", ":/Legend.png" ); - CAF_PDM_InitFieldNoDefault( &m_singleVarEdgeResultColors, - "SingleVarEdgeResult", - "Result Property", - ":/CellResult.png", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_singleVarEdgeResultColors, "SingleVarEdgeResult", "Result Property", ":/CellResult.png" ); m_singleVarEdgeResultColors = new RimEclipseCellColors(); m_resultVariable.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp b/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp index 7942f13521..863707c04b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp @@ -34,7 +34,7 @@ CAF_PDM_SOURCE_INIT( RimColorLegend, "ColorLegend" ); //-------------------------------------------------------------------------------------------------- RimColorLegend::RimColorLegend() { - CAF_PDM_InitObject( "ColorLegend", ":/Legend.png", "", "" ); + CAF_PDM_InitObject( "ColorLegend", ":/Legend.png" ); CAF_PDM_InitField( &m_colorLegendName, "ColorLegendName", QString( "" ), "Color Legend Name" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp index dde9304590..d883e5974c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp @@ -34,17 +34,12 @@ CAF_PDM_SOURCE_INIT( RimColorLegendCollection, "ColorLegendCollection" ); //-------------------------------------------------------------------------------------------------- RimColorLegendCollection::RimColorLegendCollection() { - CAF_PDM_InitObject( "Color Legends", ":/Legend.png", "", "" ); - - CAF_PDM_InitFieldNoDefault( &m_standardColorLegends, - "StandardColorLegends", - "Standard Color Legends", - ":/Legend.png", - "", - "" ); + CAF_PDM_InitObject( "Color Legends", ":/Legend.png" ); + + CAF_PDM_InitFieldNoDefault( &m_standardColorLegends, "StandardColorLegends", "Standard Color Legends", ":/Legend.png" ); m_standardColorLegends.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_customColorLegends, "CustomColorLegends", "Custom Color Legends", ":/Legend.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_customColorLegends, "CustomColorLegends", "Custom Color Legends", ":/Legend.png" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp index 2057cb11ab..0f9448cbe5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.cpp @@ -83,7 +83,7 @@ RimContourMapProjection::RimContourMapProjection() , m_minResultAllTimeSteps( std::numeric_limits::infinity() ) , m_maxResultAllTimeSteps( -std::numeric_limits::infinity() ) { - CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png", "", "" ); + CAF_PDM_InitObject( "RimContourMapProjection", ":/2DMapProjection16x16.png" ); CAF_PDM_InitField( &m_relativeSampleSpacing, "SampleSpacing", 0.9, "Sample Spacing Factor" ); m_relativeSampleSpacing.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp index 11a00f1b61..7e98c277e0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp @@ -35,7 +35,7 @@ CAF_PDM_SOURCE_INIT( RimCustomObjectiveFunction, "RimCustomObjectiveFunction" ); //-------------------------------------------------------------------------------------------------- RimCustomObjectiveFunction::RimCustomObjectiveFunction() { - CAF_PDM_InitObject( "Objective Function", ":/ObjectiveFunction.svg", "", "" ); + CAF_PDM_InitObject( "Objective Function", ":/ObjectiveFunction.svg" ); CAF_PDM_InitFieldNoDefault( &m_functionTitle, "FunctionTitle", "Title" ); m_functionTitle.registerGetMethod( this, &RimCustomObjectiveFunction::title ); diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp index 64b672e7a6..a4b3f46fb4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp @@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimCustomObjectiveFunctionCollection, "RimCustomObjectiveFu RimCustomObjectiveFunctionCollection::RimCustomObjectiveFunctionCollection() : objectiveFunctionChanged( this ) { - CAF_PDM_InitObject( "Custom Objective Functions", ":/ObjectiveFunctionCollection.svg", "", "" ); + CAF_PDM_InitObject( "Custom Objective Functions", ":/ObjectiveFunctionCollection.svg" ); CAF_PDM_InitFieldNoDefault( &m_objectiveFunctions, "ObjectiveFunctions", "" ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp index cd6caca6b8..6611839472 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp @@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT( RimCustomObjectiveFunctionWeight, "RimCustomObjectiveFuncti //-------------------------------------------------------------------------------------------------- RimCustomObjectiveFunctionWeight::RimCustomObjectiveFunctionWeight() { - CAF_PDM_InitObject( "Custom Objective Function Weight", ":/ObjectiveFunctionWeight.svg", "", "" ); + CAF_PDM_InitObject( "Custom Objective Function Weight", ":/ObjectiveFunctionWeight.svg" ); CAF_PDM_InitFieldNoDefault( &m_title, "WeightTitle", "Title" ); m_title.registerGetMethod( this, &RimCustomObjectiveFunctionWeight::title ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp index ec80a5ba81..39c6234c64 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp @@ -41,7 +41,7 @@ CAF_PDM_SOURCE_INIT( RimEclipseCaseCollection, "ResInsightAnalysisModels" ); //-------------------------------------------------------------------------------------------------- RimEclipseCaseCollection::RimEclipseCaseCollection( void ) { - CAF_PDM_InitObject( "Grid Models", ":/Cases16x16.png", "", "" ); + CAF_PDM_InitObject( "Grid Models", ":/Cases16x16.png" ); CAF_PDM_InitFieldNoDefault( &cases, "Reservoirs", "" ); cases.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index 0be76957e9..1e8be93ede 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -62,7 +62,7 @@ RimEclipseContourMapProjection::RimEclipseContourMapProjection() , m_kLayers( 0u ) , m_useActiveCellInfo( true ) { - CAF_PDM_InitObject( "RimEclipseContourMapProjection", ":/2DMapProjection16x16.png", "", "" ); + CAF_PDM_InitObject( "RimEclipseContourMapProjection", ":/2DMapProjection16x16.png" ); CAF_PDM_InitField( &m_weightByParameter, "WeightByParameter", false, "Weight by Result Parameter" ); CAF_PDM_InitFieldNoDefault( &m_weightingResult, "WeightingResult", "" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapViewCollection.cpp index 7f17166296..45ffa07d81 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapViewCollection.cpp @@ -10,9 +10,9 @@ CAF_PDM_SOURCE_INIT( RimEclipseContourMapViewCollection, "Eclipse2dViewCollectio //-------------------------------------------------------------------------------------------------- RimEclipseContourMapViewCollection::RimEclipseContourMapViewCollection() { - CAF_PDM_InitObject( "Contour Maps", ":/2DMaps16x16.png", "", "" ); + CAF_PDM_InitObject( "Contour Maps", ":/2DMaps16x16.png" ); - CAF_PDM_InitFieldNoDefault( &m_contourMapViews, "EclipseViews", "Contour Maps", ":/CrossSection16x16.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_contourMapViews, "EclipseViews", "Contour Maps", ":/CrossSection16x16.png" ); m_contourMapViews.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.cpp index 2723a57297..d770d51fd2 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseFaultColors.cpp @@ -35,17 +35,12 @@ CAF_PDM_SOURCE_INIT( RimEclipseFaultColors, "RimFaultResultSlot" ); //-------------------------------------------------------------------------------------------------- RimEclipseFaultColors::RimEclipseFaultColors() { - CAF_PDM_InitObject( "Fault Result", ":/draw_style_faults_24x24.png", "", "" ); + CAF_PDM_InitObject( "Fault Result", ":/draw_style_faults_24x24.png" ); CAF_PDM_InitField( &showCustomFaultResult, "ShowCustomFaultResult", false, "Show Custom Fault Result" ); showCustomFaultResult.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_customFaultResultColors, - "CustomResultSlot", - "Custom Fault Result", - ":/CellResult.png", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_customFaultResultColors, "CustomResultSlot", "Custom Fault Result", ":/CellResult.png" ); m_customFaultResultColors = new RimEclipseCellColors(); m_customFaultResultColors.uiCapability()->setUiTreeHidden( true ); m_customFaultResultColors->enableDeltaResults( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp index 3c445e9082..c0103ef88b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp @@ -54,7 +54,7 @@ CAF_PDM_SOURCE_INIT( RimEclipseInputCase, "RimInputReservoir" ); RimEclipseInputCase::RimEclipseInputCase() : RimEclipseCase() { - CAF_PDM_InitObject( "RimInputCase", ":/EclipseInput48x48.png", "", "" ); + CAF_PDM_InitObject( "RimInputCase", ":/EclipseInput48x48.png" ); CAF_PDM_InitFieldNoDefault( &m_additionalFiles, "AdditionalFileNamesProxy", "Additional Files" ); m_additionalFiles.registerGetMethod( this, &RimEclipseInputCase::additionalFiles ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseInputProperty.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseInputProperty.cpp index e7ae7311cd..d1295659a3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseInputProperty.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseInputProperty.cpp @@ -52,7 +52,7 @@ CAF_PDM_SOURCE_INIT( RimEclipseInputProperty, "RimInputProperty" ); //-------------------------------------------------------------------------------------------------- RimEclipseInputProperty::RimEclipseInputProperty() { - CAF_PDM_InitObject( "Input Property", ":/EclipseInput48x48.png", "", "" ); + CAF_PDM_InitObject( "Input Property", ":/EclipseInput48x48.png" ); CAF_PDM_InitField( &resultName, "ResultName", QString(), "Result Name" ); CAF_PDM_InitField( &eclipseKeyword, "EclipseKeyword", QString(), "Eclipse Keyword" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp index f8de3814e1..3ec265b115 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp @@ -31,7 +31,7 @@ CAF_PDM_SOURCE_INIT( RimEclipseInputPropertyCollection, "RimInputPropertyCollect //-------------------------------------------------------------------------------------------------- RimEclipseInputPropertyCollection::RimEclipseInputPropertyCollection() { - CAF_PDM_InitObject( "Input Properties", ":/EclipseInput48x48.png", "", "" ); + CAF_PDM_InitObject( "Input Properties", ":/EclipseInput48x48.png" ); CAF_PDM_InitFieldNoDefault( &inputProperties, "InputProperties", "" ); inputProperties.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp index de59e690e3..58327de64f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -114,13 +114,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe CAF_PDM_InitScriptableFieldNoDefault( &m_porosityModel, "PorosityModelType", "Porosity" ); m_porosityModel.uiCapability()->setUiHidden( true ); - CAF_PDM_InitScriptableField( &m_resultVariable, - "ResultVariable", - RiaResultNames::undefinedResultName(), - "Variable", - "", - "", - "" ); + CAF_PDM_InitScriptableField( &m_resultVariable, "ResultVariable", RiaResultNames::undefinedResultName(), "Variable" ); m_resultVariable.uiCapability()->setUiHidden( true ); CAF_PDM_InitFieldNoDefault( &m_flowSolution, "FlowDiagSolution", "Solution" ); @@ -129,10 +123,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe CAF_PDM_InitField( &m_timeLapseBaseTimestep, "TimeLapseBaseTimeStep", RigEclipseResultAddress::noTimeLapseValue(), - "Base Time Step", - "", - "", - "" ); + "Base Time Step" ); CAF_PDM_InitFieldNoDefault( &m_differenceCase, "DifferenceCase", "Difference Case" ); @@ -154,10 +145,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe CAF_PDM_InitScriptableField( &m_showOnlyVisibleCategoriesInLegend, "ShowOnlyVisibleCategoriesInLegend", true, - "Show Only Visible Categories In Legend", - "", - "", - "" ); + "Show Only Visible Categories In Legend" ); // Ui only fields @@ -169,13 +157,7 @@ RimEclipseResultDefinition::RimEclipseResultDefinition( caf::PdmUiItemInfo::Labe m_porosityModelUiField.xmlCapability()->disableIO(); m_porosityModelUiField.uiCapability()->setUiLabelPosition( m_labelPosition ); - CAF_PDM_InitField( &m_resultVariableUiField, - "MResultVariable", - RiaResultNames::undefinedResultName(), - "Result Property", - "", - "", - "" ); + CAF_PDM_InitField( &m_resultVariableUiField, "MResultVariable", RiaResultNames::undefinedResultName(), "Result Property" ); m_resultVariableUiField.xmlCapability()->disableIO(); m_resultVariableUiField.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); m_resultVariableUiField.uiCapability()->setUiLabelPosition( m_labelPosition ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index 64751f2e67..500726ad46 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -65,7 +65,7 @@ CAF_PDM_SOURCE_INIT( RimEclipseStatisticsCase, "RimStatisticalCalculation" ); RimEclipseStatisticsCase::RimEclipseStatisticsCase() : RimEclipseCase() { - CAF_PDM_InitObject( "Case Group Statistics", ":/Histogram16x16.png", "", "" ); + CAF_PDM_InitObject( "Case Group Statistics", ":/Histogram16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_calculateEditCommand, "m_editingAllowed", "" ); caf::PdmUiPushButtonEditor::configureEditorForField( &m_calculateEditCommand ); @@ -87,30 +87,12 @@ RimEclipseStatisticsCase::RimEclipseStatisticsCase() CAF_PDM_InitScriptableFieldNoDefault( &m_selectedGeneratedProperties, "GeneratedPropertiesToCalculate", "" ); CAF_PDM_InitScriptableFieldNoDefault( &m_selectedInputProperties, "InputPropertiesToCalculate", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_selectedFractureDynamicProperties, - "FractureDynamicPropertiesToCalculate", - "", - "", - "", - "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_selectedFractureStaticProperties, - "FractureStaticPropertiesToCalculate", - "", - "", - "", - "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_selectedFractureDynamicProperties, "FractureDynamicPropertiesToCalculate", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_selectedFractureStaticProperties, "FractureStaticPropertiesToCalculate", "" ); CAF_PDM_InitScriptableFieldNoDefault( &m_selectedFractureGeneratedProperties, "FractureGeneratedPropertiesToCalculate", - "", - "", - "", - "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_selectedFractureInputProperties, - "FractureInputPropertiesToCalculate", - "", - "", - "", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_selectedFractureInputProperties, "FractureInputPropertiesToCalculate", "" ); m_selectedDynamicProperties.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_selectedStaticProperties.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); @@ -132,18 +114,12 @@ RimEclipseStatisticsCase::RimEclipseStatisticsCase() CAF_PDM_InitScriptableField( &m_wellDataSourceCase, "WellDataSourceCase", RiaResultNames::undefinedResultName(), - "Well Data Source Case", - "", - "", - "" ); + "Well Data Source Case" ); CAF_PDM_InitScriptableField( &m_useZeroAsInactiveCellValue, "UseZeroAsInactiveCellValue", false, - "Use Zero as Inactive Cell Value", - "", - "", - "" ); + "Use Zero as Inactive Cell Value" ); m_populateSelectionAfterLoadingGrid = false; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index 12fbbd1a25..7adbdb7467 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -139,23 +139,16 @@ RimEclipseView::RimEclipseView() "GridCellResult", "CellResult", "Cell Result", - ":/CellResult.png", - "", - "" ); + ":/CellResult.png" ); m_cellResult = new RimEclipseCellColors(); m_cellResult.uiCapability()->setUiTreeHidden( true ); m_cellResult->enableDeltaResults( true ); - CAF_PDM_InitFieldNoDefault( &m_cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_cellEdgeResult, "GridCellEdgeResult", "Cell Edge Result", ":/EdgeResult_1.png" ); m_cellEdgeResult = new RimCellEdgeColors(); m_cellEdgeResult.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_elementVectorResult, - "ElementVectorResult", - "Element Vector Result", - ":/CellResult.png", - "", - "" ); + CAF_PDM_InitFieldNoDefault( &m_elementVectorResult, "ElementVectorResult", "Element Vector Result", ":/CellResult.png" ); m_elementVectorResult = new RimElementVectorResult; m_elementVectorResult.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp index 41a2ff7335..fc20efb45d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp @@ -70,7 +70,7 @@ void AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RimElementVectorResult::RimElementVectorResult() { - CAF_PDM_InitObject( "Flow Vector Result", ":/CellResult.png", "", "" ); + CAF_PDM_InitObject( "Flow Vector Result", ":/CellResult.png" ); CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend" ); m_legendConfig = new RimRegularLegendConfig(); diff --git a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp index 46d758e729..cec620b09c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp @@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimEnsembleFractureStatisticsPlotCollection, "EnsembleFract //-------------------------------------------------------------------------------------------------- RimEnsembleFractureStatisticsPlotCollection::RimEnsembleFractureStatisticsPlotCollection() { - CAF_PDM_InitObject( "Ensemble Fracture Statistics Plots", ":/WellLogPlots16x16.png", "", "" ); + CAF_PDM_InitObject( "Ensemble Fracture Statistics Plots", ":/WellLogPlots16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_ensembleFractureStatisticsPlots, "EnsembleFractureStatisticsPlots", "" ); m_ensembleFractureStatisticsPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp index 14a879e0c8..c19453131f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp @@ -52,7 +52,7 @@ CAF_PDM_SOURCE_INIT( RimEquilibriumAxisAnnotation, "RimEquilibriumAxisAnnotation RimEquilibriumAxisAnnotation::RimEquilibriumAxisAnnotation() : RimPlotAxisAnnotation() { - CAF_PDM_InitObject( "Equilibrium Annotation", ":/LeftAxis16x16.png", "", "" ); + CAF_PDM_InitObject( "Equilibrium Annotation", ":/LeftAxis16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_annotationType, "AnnotationType", "AnnotationType" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimFormationNames.cpp b/ApplicationLibCode/ProjectDataModel/RimFormationNames.cpp index 32f475f099..27ed52ecfb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimFormationNames.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimFormationNames.cpp @@ -42,7 +42,7 @@ CAF_PDM_SOURCE_INIT( RimFormationNames, "FormationNames" ); //-------------------------------------------------------------------------------------------------- RimFormationNames::RimFormationNames() { - CAF_PDM_InitObject( "Formation Names", ":/Formations16x16.png", "", "" ); + CAF_PDM_InitObject( "Formation Names", ":/Formations16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_formationNamesFileName, "FormationNamesFileName", "File Name" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp index dea907a06f..4fdf3f80ce 100644 --- a/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp @@ -29,7 +29,7 @@ CAF_PDM_SOURCE_INIT( RimFormationNamesCollection, "FormationNamesCollectionObjec //-------------------------------------------------------------------------------------------------- RimFormationNamesCollection::RimFormationNamesCollection() { - CAF_PDM_InitObject( "Formations", ":/FormationCollection16x16.png", "", "" ); + CAF_PDM_InitObject( "Formations", ":/FormationCollection16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_formationNamesList, "FormationNamesList", "Formations" ); m_formationNamesList.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp index 5a3b44f868..485031fcc7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp @@ -47,7 +47,7 @@ CAF_PDM_SOURCE_INIT( RimGridInfo, "GridInfo" ); //-------------------------------------------------------------------------------------------------- RimGridInfo::RimGridInfo() { - CAF_PDM_InitObject( "GridInfo", ":/draw_style_meshlines_24x24.png", "", "" ); + CAF_PDM_InitObject( "GridInfo", ":/draw_style_meshlines_24x24.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Show Grid Cells" ); CAF_PDM_InitField( &m_gridName, "GridName", QString(), "Grid Name" ); @@ -151,7 +151,7 @@ CAF_PDM_SOURCE_INIT( RimGridInfoCollection, "GridInfoCollection" ); //-------------------------------------------------------------------------------------------------- RimGridInfoCollection::RimGridInfoCollection() { - CAF_PDM_InitObject( "GridInfoCollection", ":/draw_style_meshlines_24x24.png", "", "" ); + CAF_PDM_InitObject( "GridInfoCollection", ":/draw_style_meshlines_24x24.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Show Grid Cells" ); m_isActive.uiCapability()->setUiHidden( true ); @@ -250,7 +250,7 @@ CAF_PDM_SOURCE_INIT( RimGridCollection, "GridCollection" ); //-------------------------------------------------------------------------------------------------- RimGridCollection::RimGridCollection() { - CAF_PDM_InitObject( "Grids", ":/draw_style_meshlines_24x24.png", "", "" ); + CAF_PDM_InitObject( "Grids", ":/draw_style_meshlines_24x24.png" ); CAF_PDM_InitField( &m_isActive, "IsActive", true, "Show Grid Cells" ); m_isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp index 789e447d76..31ad011bce 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp @@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimGridStatisticsPlotCollection, "GridStatisticsPlotCollect //-------------------------------------------------------------------------------------------------- RimGridStatisticsPlotCollection::RimGridStatisticsPlotCollection() { - CAF_PDM_InitObject( "Grid Statistics Plots", ":/WellLogPlots16x16.png", "", "" ); + CAF_PDM_InitObject( "Grid Statistics Plots", ":/WellLogPlots16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_gridStatisticsPlots, "GridStatisticsPlots", "" ); m_gridStatisticsPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp index 8ff9fda4c0..e05a7fefd0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp @@ -52,7 +52,7 @@ CAF_PDM_SOURCE_INIT( RimGridTimeHistoryCurve, "GridTimeHistoryCurve" ); //-------------------------------------------------------------------------------------------------- RimGridTimeHistoryCurve::RimGridTimeHistoryCurve() { - CAF_PDM_InitObject( "Grid Time History Curve", ":/SummaryCurve16x16.png", "", "" ); + CAF_PDM_InitObject( "Grid Time History Curve", ":/SummaryCurve16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_geometrySelectionText, "GeometrySelectionText", "Cell Reference" ); m_geometrySelectionText.registerGetMethod( this, &RimGridTimeHistoryCurve::geometrySelectionText ); @@ -73,10 +73,7 @@ RimGridTimeHistoryCurve::RimGridTimeHistoryCurve() CAF_PDM_InitField( &m_plotAxis, "PlotAxis", caf::AppEnum( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ), - "Axis", - "", - "", - "" ); + "Axis" ); setDeletable( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp b/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp index 259aab97f6..df65dd58a0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp @@ -187,10 +187,7 @@ RimMudWeightWindowParameters::RimMudWeightWindowParameters( void ) CAF_PDM_InitField( &m_fractureGradientCalculationType, "FractureGradientCalculationType", defaultFractureGradientCalculationType, - "FG in Shale Calculation", - "", - "", - "" ); + "FG in Shale Calculation" ); caf::AppEnum defaultNonReservoirPorePressureType = RimMudWeightWindowParameters::NonReservoirPorePressureType::HYDROSTATIC; diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 07d41d9cba..8033433a0b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -68,7 +68,7 @@ CAF_PDM_SOURCE_INIT( RimMultiPlot, "MultiPlot" ); //-------------------------------------------------------------------------------------------------- RimMultiPlot::RimMultiPlot() { - CAF_PDM_InitObject( "Multi Plot", ":/MultiPlot16x16.png", "", "" ); + CAF_PDM_InitObject( "Multi Plot", ":/MultiPlot16x16.png" ); CAF_PDM_InitField( &m_showPlotWindowTitle, "ShowTitleInPlot", true, "Show Title" ); CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp index c7b93d3433..f3558ae611 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp @@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimMultiPlotCollection, "RimMultiPlotCollection" ); //-------------------------------------------------------------------------------------------------- RimMultiPlotCollection::RimMultiPlotCollection() { - CAF_PDM_InitObject( "Multi Plots", ":/MultiPlot16x16.png", "", "" ); + CAF_PDM_InitObject( "Multi Plots", ":/MultiPlot16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_multiPlots, "MultiPlots", "Plots Reports" ); m_multiPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimMultipleLocations.cpp b/ApplicationLibCode/ProjectDataModel/RimMultipleLocations.cpp index b963fe023a..9288cce217 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultipleLocations.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultipleLocations.cpp @@ -42,15 +42,12 @@ void AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RimMultipleLocations::RimMultipleLocations() { - CAF_PDM_InitObject( "RimMultipleLocations", ":/FishBoneGroup16x16.png", "", "" ); + CAF_PDM_InitObject( "RimMultipleLocations", ":/FishBoneGroup16x16.png" ); CAF_PDM_InitField( &m_locationType, "LocationMode", caf::AppEnum( LocationType::COUNT ), - "Location Defined By", - "", - "", - "" ); + "Location Defined By" ); CAF_PDM_InitField( &m_rangeStart, "RangeStart", 100.0, "Start MD" ); m_rangeStart.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp index 0fe12ed048..fb0e5bc7db 100644 --- a/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp @@ -48,7 +48,7 @@ CAF_PDM_SOURCE_INIT( RimObservedDataCollection, "ObservedDataCollection" ); //-------------------------------------------------------------------------------------------------- RimObservedDataCollection::RimObservedDataCollection() { - CAF_PDM_InitObject( "Observed Data", ":/Folder.png", "", "" ); + CAF_PDM_InitObject( "Observed Data", ":/Folder.png" ); CAF_PDM_InitFieldNoDefault( &m_observedDataArray, "ObservedDataArray", "" ); CAF_PDM_InitFieldNoDefault( &m_observedFmuRftArray, "ObservedFmuRftDataArray", "" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimObservedFmuRftData.cpp b/ApplicationLibCode/ProjectDataModel/RimObservedFmuRftData.cpp index 3b96dde244..ae1d8b6cdd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimObservedFmuRftData.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimObservedFmuRftData.cpp @@ -29,7 +29,7 @@ CAF_PDM_SOURCE_INIT( RimObservedFmuRftData, "ObservedFmuRftData" ); //-------------------------------------------------------------------------------------------------- RimObservedFmuRftData::RimObservedFmuRftData() { - CAF_PDM_InitObject( "Observed FMU Data", ":/ObservedRFTDataFile16x16.png", "", "" ); + CAF_PDM_InitObject( "Observed FMU Data", ":/ObservedRFTDataFile16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_directoryPath, "Directory", "Directory" ); m_directoryPath.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimOilField.cpp b/ApplicationLibCode/ProjectDataModel/RimOilField.cpp index 28671a5c03..ad2cba145a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimOilField.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimOilField.cpp @@ -41,15 +41,15 @@ RimOilField::RimOilField( void ) { CAF_PDM_InitObject( "Oil Field" ); - CAF_PDM_InitFieldNoDefault( &analysisModels, "AnalysisModels", "Grid Models", ":/GridModels.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &geoMechModels, "GeoMechModels", "Geo Mech Models", ":/GridModels.png", "", "" ); - CAF_PDM_InitFieldNoDefault( &wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &analysisModels, "AnalysisModels", "Grid Models", ":/GridModels.png" ); + CAF_PDM_InitFieldNoDefault( &geoMechModels, "GeoMechModels", "Geo Mech Models", ":/GridModels.png" ); + CAF_PDM_InitFieldNoDefault( &wellPathCollection, "WellPathCollection", "Well Paths", ":/WellCollection.png" ); CAF_PDM_InitFieldNoDefault( &completionTemplateCollection, "CompletionTemplateCollection", "" ); - CAF_PDM_InitFieldNoDefault( &summaryCaseMainCollection, "SummaryCaseCollection", "Summary Cases", ":/GridModels.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &summaryCaseMainCollection, "SummaryCaseCollection", "Summary Cases", ":/GridModels.png" ); CAF_PDM_InitFieldNoDefault( &formationNamesCollection, "FormationNamesCollection", "Formations" ); - CAF_PDM_InitFieldNoDefault( &observedDataCollection, "ObservedDataCollection", "Observed Data", ":/Cases16x16.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &observedDataCollection, "ObservedDataCollection", "Observed Data", ":/Cases16x16.png" ); CAF_PDM_InitFieldNoDefault( &annotationCollection, "AnnotationCollection", "Annotations" ); CAF_PDM_InitFieldNoDefault( &ensembleWellLogsCollection, "EnsembleWellLogsCollection", "Ensemble Well Logs" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisAnnotation.cpp index 394a08ec60..b6f577e501 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisAnnotation.cpp @@ -36,7 +36,7 @@ CAF_PDM_SOURCE_INIT( RimPlotAxisAnnotation, "RimPlotAxisAnnotation" ); RimPlotAxisAnnotation::RimPlotAxisAnnotation() { m_annotationType = AnnotationType::LINE; - CAF_PDM_InitObject( "Plot Axis Annotation", ":/LeftAxis16x16.png", "", "" ); + CAF_PDM_InitObject( "Plot Axis Annotation", ":/LeftAxis16x16.png" ); CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index e7573e4c73..1a2a93d8cb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -61,41 +61,41 @@ RimPlotAxisProperties::RimPlotAxisProperties() , m_enableTitleTextSettings(true) , m_isRangeSettingsEnabled(true) { - CAF_PDM_InitObject("Axis Properties", ":/LeftAxis16x16.png", "", ""); + CAF_PDM_InitObject("Axis Properties", ":/LeftAxis16x16.png"); - CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", ""); + CAF_PDM_InitField(&m_isActive, "Active", true, "Active"); m_isActive.uiCapability()->setUiHidden(true); - CAF_PDM_InitFieldNoDefault(&m_name, "Name", "Name", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_name, "Name", "Name"); m_name.uiCapability()->setUiHidden(true); - CAF_PDM_InitField(&isAutoTitle, "AutoTitle", true, "Auto Title", "", "", ""); + CAF_PDM_InitField(&isAutoTitle, "AutoTitle", true, "Auto Title"); - CAF_PDM_InitField(&m_displayLongName, "DisplayLongName", true, " Names", "", "", ""); - CAF_PDM_InitField(&m_displayShortName, "DisplayShortName", false, " Acronyms", "", "", ""); - CAF_PDM_InitField(&m_displayUnitText, "DisplayUnitText", true, " Units", "", "", ""); + CAF_PDM_InitField(&m_displayLongName, "DisplayLongName", true, " Names"); + CAF_PDM_InitField(&m_displayShortName, "DisplayShortName", false, " Acronyms"); + CAF_PDM_InitField(&m_displayUnitText, "DisplayUnitText", true, " Units"); - CAF_PDM_InitFieldNoDefault(&customTitle, "CustomTitle", "Title", "", "", ""); + CAF_PDM_InitFieldNoDefault(&customTitle, "CustomTitle", "Title"); - CAF_PDM_InitField(&visibleRangeMax, "VisibleRangeMax", RiaDefines::maximumDefaultValuePlot(), "Max", "", "", ""); - CAF_PDM_InitField(&visibleRangeMin, "VisibleRangeMin", RiaDefines::minimumDefaultValuePlot(), "Min", "", "", ""); + CAF_PDM_InitField(&visibleRangeMax, "VisibleRangeMax", RiaDefines::maximumDefaultValuePlot(), "Max"); + CAF_PDM_InitField(&visibleRangeMin, "VisibleRangeMin", RiaDefines::minimumDefaultValuePlot(), "Min"); - CAF_PDM_InitFieldNoDefault(&numberFormat, "NumberFormat", "Number Format", "", "", ""); - CAF_PDM_InitField(&numberOfDecimals, "Decimals", 2, "Number of Decimals", "", "", ""); - CAF_PDM_InitField(&scaleFactor, "ScaleFactor", 1.0, "Scale Factor", "", "", ""); + CAF_PDM_InitFieldNoDefault(&numberFormat, "NumberFormat", "Number Format"); + CAF_PDM_InitField(&numberOfDecimals, "Decimals", 2, "Number of Decimals"); + CAF_PDM_InitField(&scaleFactor, "ScaleFactor", 1.0, "Scale Factor"); numberOfDecimals.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName()); - CAF_PDM_InitField(&m_isAutoZoom, "AutoZoom", true, "Set Range Automatically", "", "", ""); - CAF_PDM_InitField(&isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale", "", "", ""); - CAF_PDM_InitField(&m_isAxisInverted, "AxisInverted", false, "Invert Axis", "", "", ""); + CAF_PDM_InitField(&m_isAutoZoom, "AutoZoom", true, "Set Range Automatically"); + CAF_PDM_InitField(&isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale"); + CAF_PDM_InitField(&m_isAxisInverted, "AxisInverted", false, "Invert Axis"); - CAF_PDM_InitFieldNoDefault(&m_titlePositionEnum, "TitlePosition", "Title Position", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_titlePositionEnum, "TitlePosition", "Title Position"); - CAF_PDM_InitFieldNoDefault(&m_titleFontSize, "TitleDeltaFontSize", "Font Size", "", "", ""); - CAF_PDM_InitFieldNoDefault(&m_valuesFontSize, "ValueDeltaFontSize", "Font Size", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_titleFontSize, "TitleDeltaFontSize", "Font Size"); + CAF_PDM_InitFieldNoDefault(&m_valuesFontSize, "ValueDeltaFontSize", "Font Size"); - CAF_PDM_InitFieldNoDefault(&m_annotations, "Annotations", "", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_annotations, "Annotations", ""); m_annotations.uiCapability()->setUiTreeHidden(true); // m_annotations.uiCapability()->setUiTreeChildrenHidden(true); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index 1c43ad6cbc..b0ec64a7ed 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -59,7 +59,7 @@ RimPlotCurve::RimPlotCurve() , dataChanged( this ) , nameChanged( this ) { - CAF_PDM_InitObject( "Curve", ":/WellLogCurve16x16.png", "", "" ); + CAF_PDM_InitObject( "Curve", ":/WellLogCurve16x16.png" ); CAF_PDM_InitField( &m_showCurve, "Show", true, "Show curve" ); m_showCurve.uiCapability()->setUiHidden( true ); @@ -97,13 +97,7 @@ RimPlotCurve::RimPlotCurve() CAF_PDM_InitFieldNoDefault( &m_pointSymbol_OBSOLETE, "PointSymbol", "Symbol" ); m_pointSymbol_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField( &m_symbolEdgeColor_OBSOLETE, - "SymbolEdgeColor", - RiaColorTools::textColor3f(), - "Symbol Edge Color", - "", - "", - "" ); + CAF_PDM_InitField( &m_symbolEdgeColor_OBSOLETE, "SymbolEdgeColor", RiaColorTools::textColor3f(), "Symbol Edge Color" ); m_symbolEdgeColor_OBSOLETE.xmlCapability()->setIOWritable( false ); CAF_PDM_InitField( &m_symbolSkipPixelDistance_OBSOLETE, diff --git a/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp index 00f0a50efa..9c8a1e3b41 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp @@ -39,7 +39,7 @@ CAF_PDM_SOURCE_INIT( RimPltPlotCollection, "WellPltPlotCollection" ); //-------------------------------------------------------------------------------------------------- RimPltPlotCollection::RimPltPlotCollection() { - CAF_PDM_InitObject( "PLT Plots", ":/WellAllocPlots16x16.png", "", "" ); + CAF_PDM_InitObject( "PLT Plots", ":/WellAllocPlots16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_pltPlots, "PltPlots", "" ); m_pltPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index fff5b9d129..00a1eee3aa 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -144,7 +144,7 @@ RimProject::RimProject( void ) colorLegendCollection = new RimColorLegendCollection(); colorLegendCollection->createStandardColorLegends(); - CAF_PDM_InitFieldNoDefault( &scriptCollection, "ScriptCollection", "Octave Scripts", ":/octave.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &scriptCollection, "ScriptCollection", "Octave Scripts", ":/octave.png" ); scriptCollection.uiCapability()->setUiTreeHidden( true ); scriptCollection.xmlCapability()->disableIO(); @@ -159,9 +159,7 @@ RimProject::RimProject( void ) CAF_PDM_InitFieldNoDefault( &viewLinkerCollection, "LinkedViews", "Linked Views (field in RimProject", - ":/LinkView16x16.png", - "", - "" ); + ":/LinkView16x16.png" ); viewLinkerCollection.uiCapability()->setUiTreeHidden( true ); viewLinkerCollection = new RimViewLinkerCollection; diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp index ad7161e60e..ea1b4aa384 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp @@ -145,7 +145,7 @@ RimRegularLegendConfig::RimRegularLegendConfig() , m_isAllTimeStepsRangeDisabled( false ) , m_resetUserDefinedValues( false ) { - CAF_PDM_InitObject( "Color Legend", ":/Legend.png", "", "" ); + CAF_PDM_InitObject( "Color Legend", ":/Legend.png" ); CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Show Legend" ); m_showLegend.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &m_numLevels, "NumberOfLevels", 8, "Number of Levels", "", "A hint on how many tick marks you whish.", "" ); @@ -160,18 +160,9 @@ RimRegularLegendConfig::RimRegularLegendConfig() CAF_PDM_InitField( &m_tickNumberFormat, "TickNumberFormat", caf::AppEnum( RiaNumberFormat::NumberFormatType::FIXED ), - "Number format", - "", - "", - "" ); + "Number format" ); - CAF_PDM_InitField( &m_colorRangeMode_OBSOLETE, - "ColorRangeMode", - ColorRangeEnum( ColorRangesType::UNDEFINED ), - "Colors", - "", - "", - "" ); + CAF_PDM_InitField( &m_colorRangeMode_OBSOLETE, "ColorRangeMode", ColorRangeEnum( ColorRangesType::UNDEFINED ), "Colors" ); m_colorRangeMode_OBSOLETE.uiCapability()->setUiHidden( true ); m_colorRangeMode_OBSOLETE.xmlCapability()->setIOWritable( false ); diff --git a/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp b/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp index 2309ac1bdb..e917bf6aa2 100644 --- a/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp @@ -322,10 +322,7 @@ RimReservoirCellResultsStorageEntryInfo::RimReservoirCellResultsStorageEntryInfo CAF_PDM_InitField( &m_resultType, "ResultType", caf::AppEnum( RiaDefines::ResultCatType::REMOVED ), - "ResultType", - "", - "", - "" ); + "ResultType" ); CAF_PDM_InitField( &m_resultName, "ResultName", QString(), "ResultName" ); CAF_PDM_InitFieldNoDefault( &m_timeStepDates, "TimeSteps", "TimeSteps" ); CAF_PDM_InitFieldNoDefault( &m_daysSinceSimulationStart, "DaysSinceSimulationStart", "DaysSinceSimulationStart" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp index ee2abc3244..b6cb68fc8d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp @@ -39,7 +39,7 @@ CAF_PDM_SOURCE_INIT( RimRftPlotCollection, "WellRftPlotCollection" ); //-------------------------------------------------------------------------------------------------- RimRftPlotCollection::RimRftPlotCollection() { - CAF_PDM_InitObject( "RFT Plots", ":/RFTPlots16x16.png", "", "" ); + CAF_PDM_InitObject( "RFT Plots", ":/RFTPlots16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_rftPlots, "RftPlots", "" ); m_rftPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp index 9ba2ef9435..8ebe37ebb8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp @@ -35,7 +35,7 @@ CAF_PDM_SOURCE_INIT( RimScriptCollection, "ScriptLocation" ); //-------------------------------------------------------------------------------------------------- RimScriptCollection::RimScriptCollection() { - CAF_PDM_InitObject( "ScriptLocation", ":/Folder.png", "", "" ); + CAF_PDM_InitObject( "ScriptLocation", ":/Folder.png" ); CAF_PDM_InitFieldNoDefault( &directory, "ScriptDirectory", "Folder" ); CAF_PDM_InitFieldNoDefault( &calcScripts, "CalcScripts", "" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp index a1be64ed8b..e7cef28043 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -138,22 +138,19 @@ CAF_PDM_SOURCE_INIT( RimSimWellInViewCollection, "Wells" ); //-------------------------------------------------------------------------------------------------- RimSimWellInViewCollection::RimSimWellInViewCollection() { - CAF_PDM_InitObject( "Simulation Wells", ":/WellCollection.png", "", "" ); + CAF_PDM_InitObject( "Simulation Wells", ":/WellCollection.png" ); CAF_PDM_InitField( &isActive, "Active", true, "Active" ); isActive.uiCapability()->setUiHidden( true ); // CAF_PDM_InitField(&showWellsIntersectingVisibleCells, "ShowWellsIntersectingVisibleCells", false, "Hide Wells Not - // Intersecting Filtered Cells", "", "", ""); + // Intersecting Filtered Cells"); CAF_PDM_InitField( &showWellsIntersectingVisibleCells, "ShowWellsIntersectingVisibleCells", false, - "Wells Through Visible Cells Only", - "", - "", - "" ); + "Wells Through Visible Cells Only" ); // CAF_PDM_InitField(&showWellsIntersectingVisibleCells, "ShowWellsIntersectingVisibleCells", false, "Hide Wells - // Missing Visible Cells", "", "", ""); + // Missing Visible Cells"); // Appearance CAF_PDM_InitFieldNoDefault( &m_showWellHead, "ShowWellHeadTristate", "Well Head" ); @@ -200,13 +197,7 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() m_showWellCells.uiCapability()->setUiEditorTypeName( caf::PdmUiCheckBoxTristateEditor::uiEditorTypeName() ); m_showWellCells.xmlCapability()->disableIO(); - CAF_PDM_InitField( &wellCellFenceType, - "DefaultWellFenceDirection", - WellFenceEnum( K_DIRECTION ), - "Well Fence Direction", - "", - "", - "" ); + CAF_PDM_InitField( &wellCellFenceType, "DefaultWellFenceDirection", WellFenceEnum( K_DIRECTION ), "Well Fence Direction" ); CAF_PDM_InitField( &wellCellTransparencyLevel, "WellCellTransparency", 0.5, "Well Cell Transparency" ); CAF_PDM_InitField( &isAutoDetectingBranches, @@ -220,10 +211,7 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() CAF_PDM_InitField( &wellHeadPosition, "WellHeadPosition", WellHeadPositionEnum( WELLHEAD_POS_TOP_COLUMN ), - "Well Head Position", - "", - "", - "" ); + "Well Head Position" ); CAF_PDM_InitFieldNoDefault( &wells, "Wells", "Wells" ); wells.uiCapability()->setUiTreeHidden( true ); @@ -242,13 +230,7 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() CAF_PDM_InitFieldNoDefault( &m_wellDiskPropertyConfigType, "WellDiskPropertyConfigType", "Property Config Type" ); CAF_PDM_InitField( &m_wellDiskShowQuantityLabels, "WellDiskShowQuantityLabels", true, "Show Quantity Labels" ); - CAF_PDM_InitField( &m_wellDiskshowLabelsBackground, - "WellDiskShowLabelsBackground", - false, - "Show Label Background", - "", - "", - "" ); + CAF_PDM_InitField( &m_wellDiskshowLabelsBackground, "WellDiskShowLabelsBackground", false, "Show Label Background" ); CAF_PDM_InitField( &m_wellDiskScaleFactor, "WellDiskScaleFactor", 1.0, "Scale Factor" ); cvf::Color3f defaultWellDiskColor = cvf::Color3::OLIVE; CAF_PDM_InitField( &wellDiskColor, "WellDiskColor", defaultWellDiskColor, "Well Disk Color" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp index ca893d5786..691ac8becb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp @@ -28,7 +28,7 @@ RimStackablePlotCurve::RimStackablePlotCurve() , stackingColorsChanged( this ) { - CAF_PDM_InitObject( "StackableCurve", ":/WellLogCurve16x16.png", "", "" ); + CAF_PDM_InitObject( "StackableCurve", ":/WellLogCurve16x16.png" ); CAF_PDM_InitField( &m_isStacked, "StackCurve", false, "Stack Curve" ); CAF_PDM_InitField( &m_isStackedWithPhaseColors, "StackPhaseColors", false, " with Phase Colors" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp index 88b51cec62..298d90f73c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStatisticsPlot.cpp @@ -103,10 +103,7 @@ RimStatisticsPlot::RimStatisticsPlot() CAF_PDM_InitField( &m_tickNumberFormat, "TickNumberFormat", caf::AppEnum( RiaNumberFormat::NumberFormatType::AUTO ), - "Number format", - "", - "", - "" ); + "Number format" ); CAF_PDM_InitFieldNoDefault( &m_graphType, "GraphType", "Graph Type" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp index 65f9cd87a6..1b75ec9a9c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp @@ -62,7 +62,7 @@ static QString toString( const std::pair& resultNameAndUnit ); //-------------------------------------------------------------------------------------------------- RimStimPlanColors::RimStimPlanColors() { - CAF_PDM_InitObject( "Fractures", ":/FractureSymbol16x16.png", "", "" ); + CAF_PDM_InitObject( "Fractures", ":/FractureSymbol16x16.png" ); CAF_PDM_InitField( &m_resultNameAndUnit, "ResultName", QString( "" ), "Result Variable" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.cpp index ee7f8ab13e..93cf19c2d3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStimPlanLegendConfig.cpp @@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimStimPlanLegendConfig, "RimStimPlanLegendConfig" ); //-------------------------------------------------------------------------------------------------- RimStimPlanLegendConfig::RimStimPlanLegendConfig() { - CAF_PDM_InitObject( "StimPlan Color Legend", ":/Legend.png", "", "" ); + CAF_PDM_InitObject( "StimPlan Color Legend", ":/Legend.png" ); CAF_PDM_InitField( &m_name, "Name", QString( "StimPlan Legend" ), "Name" ); m_name.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp index a5da0c5009..c46e92a38f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp @@ -31,7 +31,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryCalculationCollection, "RimSummaryCalculationColl //-------------------------------------------------------------------------------------------------- RimSummaryCalculationCollection::RimSummaryCalculationCollection() { - CAF_PDM_InitObject( "Calculation Collection", ":/chain.png", "", "" ); + CAF_PDM_InitObject( "Calculation Collection", ":/chain.png" ); CAF_PDM_InitFieldNoDefault( &m_calculations, "Calculations", "Calculations" ); m_calculations.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp index f780bdc06a..559e002b55 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp @@ -41,7 +41,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryCalculationVariable, "RimSummaryCalculationVariab //-------------------------------------------------------------------------------------------------- RimSummaryCalculationVariable::RimSummaryCalculationVariable() { - CAF_PDM_InitObject( "RimSummaryCalculationVariable", ":/octave.png", "", "" ); + CAF_PDM_InitObject( "RimSummaryCalculationVariable", ":/octave.png" ); CAF_PDM_InitFieldNoDefault( &m_name, "VariableName", "Variable Name" ); m_name.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp index 4deb4e8a1b..0bca5931e1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp @@ -44,7 +44,7 @@ caf::PdmFieldHandle* RimSurfaceIntersectionBand::userDescriptionField() RimSurfaceIntersectionBand::RimSurfaceIntersectionBand() : objectChanged( this ) { - CAF_PDM_InitObject( "SurfaceIntersectionBand", ":/ReservoirSurface16x16.png", "", "" ); + CAF_PDM_InitObject( "SurfaceIntersectionBand", ":/ReservoirSurface16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_lineAppearance, "LineAppearance", "Line Appearance" ); m_lineAppearance = new RimAnnotationLineAppearance; diff --git a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp index 7ba8174bdf..650d4fe235 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp @@ -35,7 +35,7 @@ CAF_PDM_SOURCE_INIT( RimSurfaceIntersectionCurve, "RimSurfaceIntersectionCurve" RimSurfaceIntersectionCurve::RimSurfaceIntersectionCurve() : objectChanged( this ) { - CAF_PDM_InitObject( "SurfaceIntersectionCurve", ":/SummaryCurve16x16.png", "", "" ); + CAF_PDM_InitObject( "SurfaceIntersectionCurve", ":/SummaryCurve16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_lineAppearance, "LineAppearance", "Line Appearance" ); m_lineAppearance = new RimAnnotationLineAppearance; diff --git a/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp b/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp index 6ada731680..8acc6dcc49 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp @@ -60,7 +60,7 @@ void AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RimTensorResults::RimTensorResults() { - CAF_PDM_InitObject( "Element Tensor Results", ":/CellResult.png", "", "" ); + CAF_PDM_InitObject( "Element Tensor Results", ":/CellResult.png" ); CAF_PDM_InitFieldNoDefault( &arrowColorLegendConfig, "LegendDefinition", "Color Legend" ); this->arrowColorLegendConfig = new RimRegularLegendConfig(); diff --git a/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp index 95610246ea..feffca27e4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -44,7 +44,7 @@ CAF_PDM_SOURCE_INIT( RimTernaryLegendConfig, "RimTernaryLegendConfig" ); //-------------------------------------------------------------------------------------------------- RimTernaryLegendConfig::RimTernaryLegendConfig() { - CAF_PDM_InitObject( "Ternary Color Legend", ":/Legend.png", "", "" ); + CAF_PDM_InitObject( "Ternary Color Legend", ":/Legend.png" ); CAF_PDM_InitField( &m_showLegend, "ShowTernaryLegend", true, "Show Ternary Legend" ); m_showLegend.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &precision, diff --git a/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.cpp index f63df778d1..82d1dc5315 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.cpp @@ -45,7 +45,7 @@ CAF_PDM_SOURCE_INIT( RimTimeAxisAnnotation, "RimTimeAxisAnnotation" ); RimTimeAxisAnnotation::RimTimeAxisAnnotation() : RimPlotAxisAnnotation() { - CAF_PDM_InitObject( "Time Axis Annotation", ":/LeftAxis16x16.png", "", "" ); + CAF_PDM_InitObject( "Time Axis Annotation", ":/LeftAxis16x16.png" ); m_value.uiCapability()->setUiHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp index 75f146d85f..d6974c4a38 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp @@ -88,7 +88,7 @@ CAF_PDM_SOURCE_INIT( RimVfpPlot, "VfpPlot" ); RimVfpPlot::RimVfpPlot() { // TODO: add icon - CAF_PDM_InitObject( "VFP Plot", ":/VfpPlot.svg", "", "" ); + CAF_PDM_InitObject( "VFP Plot", ":/VfpPlot.svg" ); CAF_PDM_InitField( &m_plotTitle, "PlotTitle", QString( "VFP Plot" ), "Plot Title" ); m_plotTitle.uiCapability()->setUiHidden( true ); @@ -117,13 +117,7 @@ RimVfpPlot::RimVfpPlot() caf::AppEnum defaultInterpolatedVariable = RimVfpDefines::InterpolatedVariableType::BHP; - CAF_PDM_InitField( &m_interpolatedVariable, - "InterpolatedVariable", - defaultInterpolatedVariable, - "Interpolated Variable", - "", - "", - "" ); + CAF_PDM_InitField( &m_interpolatedVariable, "InterpolatedVariable", defaultInterpolatedVariable, "Interpolated Variable" ); caf::AppEnum defaultPrimaryVariable = RimVfpDefines::ProductionVariableType::LIQUID_FLOW_RATE; diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp index dd58369952..572872bf9e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp @@ -36,7 +36,7 @@ CAF_PDM_SOURCE_INIT( RimVfpPlotCollection, "RimVfpPlotCollection" ); //-------------------------------------------------------------------------------------------------- RimVfpPlotCollection::RimVfpPlotCollection() { - CAF_PDM_InitObject( "VFP Plots", ":/VfpPlotCollection.svg", "", "" ); + CAF_PDM_InitObject( "VFP Plots", ":/VfpPlotCollection.svg" ); CAF_PDM_InitFieldNoDefault( &m_vfpPlots, "VfpPlots", "Vertical Flow Performance Plots" ); m_vfpPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewController.cpp b/ApplicationLibCode/ProjectDataModel/RimViewController.cpp index 4706b45617..ad9e5255c3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewController.cpp @@ -62,31 +62,31 @@ RimViewController::RimViewController() { // clang-format off - CAF_PDM_InitObject("View Link", "", "", ""); + CAF_PDM_InitObject("View Link"); - CAF_PDM_InitField(&m_isActive, "Active", true, "Active", "", "", ""); + CAF_PDM_InitField(&m_isActive, "Active", true, "Active"); m_isActive.uiCapability()->setUiHidden(true); QString defaultName = "View Config: Empty view"; - CAF_PDM_InitField(&m_name, "Name", defaultName, "Managed View Name", "", "", ""); + CAF_PDM_InitField(&m_name, "Name", defaultName, "Managed View Name"); m_name.uiCapability()->setUiHidden(true); - CAF_PDM_InitFieldNoDefault(&m_managedView, "ManagedView", "Linked View", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_managedView, "ManagedView", "Linked View"); m_managedView.uiCapability()->setUiTreeChildrenHidden(true); - CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera", "", "", ""); - CAF_PDM_InitField(&m_showCursor, "ShowCursor", true, " Show Cursor", "", "", ""); - CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step", "", "", ""); - CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Result", "", "", ""); - CAF_PDM_InitField(&m_syncLegendDefinitions, "SyncLegendDefinitions", true, " Color Legend", "", "", ""); + CAF_PDM_InitField(&m_syncCamera, "SyncCamera", true, "Camera"); + CAF_PDM_InitField(&m_showCursor, "ShowCursor", true, " Show Cursor"); + CAF_PDM_InitField(&m_syncTimeStep, "SyncTimeStep", true, "Time Step"); + CAF_PDM_InitField(&m_syncCellResult, "SyncCellResult", false, "Cell Result"); + CAF_PDM_InitField(&m_syncLegendDefinitions, "SyncLegendDefinitions", true, " Color Legend"); - CAF_PDM_InitField(&m_syncVisibleCells, "SyncVisibleCells", false, "Visible Cells", "", "", ""); + CAF_PDM_InitField(&m_syncVisibleCells, "SyncVisibleCells", false, "Visible Cells"); /// We do not support this. Consider to remove sometime m_syncVisibleCells.uiCapability()->setUiHidden(true); m_syncVisibleCells.xmlCapability()->disableIO(); - CAF_PDM_InitField(&m_syncCellFilters, "SyncRangeFilters", false, "Cell Filters", "", "", ""); - CAF_PDM_InitField(&m_syncPropertyFilters, "SyncPropertyFilters", false,"Property Filters", "", "", ""); + CAF_PDM_InitField(&m_syncCellFilters, "SyncRangeFilters", false, "Cell Filters"); + CAF_PDM_InitField(&m_syncPropertyFilters, "SyncPropertyFilters", false,"Property Filters"); // clang-format on setDeletable( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp index 24fe576046..0e60366614 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp @@ -57,21 +57,21 @@ CAF_PDM_SOURCE_INIT( RimViewLinker, "ViewLinker" ); RimViewLinker::RimViewLinker() { // clang-format off - CAF_PDM_InitObject("Linked Views", "", "", ""); + CAF_PDM_InitObject("Linked Views"); - CAF_PDM_InitField(&m_name, "Name", QString("View Group Name"), "View Group Name", "", "", ""); + CAF_PDM_InitField(&m_name, "Name", QString("View Group Name"), "View Group Name"); m_name.uiCapability()->setUiHidden(true); - CAF_PDM_InitFieldNoDefault(&m_masterView, "MainView", "Main View", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_masterView, "MainView", "Main View"); m_masterView.uiCapability()->setUiTreeChildrenHidden(true); m_masterView.uiCapability()->setUiTreeHidden(true); m_masterView.uiCapability()->setUiHidden(true); - CAF_PDM_InitFieldNoDefault(&m_viewControllers, "ManagedViews", "Managed Views", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_viewControllers, "ManagedViews", "Managed Views"); m_viewControllers.uiCapability()->setUiTreeHidden(true); m_viewControllers.uiCapability()->setUiTreeChildrenHidden(true); - CAF_PDM_InitFieldNoDefault(&m_comparisonView, "LinkedComparisonView", "Comparison View", "", "", ""); + CAF_PDM_InitFieldNoDefault(&m_comparisonView, "LinkedComparisonView", "Comparison View"); m_comparisonView.xmlCapability()->disableIO(); // clang-format on diff --git a/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp index 4323f0c0c7..138e427be3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp @@ -31,7 +31,7 @@ CAF_PDM_SOURCE_INIT( RimViewLinkerCollection, "RimViewLinkerCollection" ); //-------------------------------------------------------------------------------------------------- RimViewLinkerCollection::RimViewLinkerCollection( void ) { - CAF_PDM_InitObject( "Linked Views", ":/LinkView16x16.png", "", "" ); + CAF_PDM_InitObject( "Linked Views", ":/LinkView16x16.png" ); CAF_PDM_InitField( &isActive, "Active", true, "Active" ); isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimVirtualPerforationResults.cpp b/ApplicationLibCode/ProjectDataModel/RimVirtualPerforationResults.cpp index a9f70fabcd..c4209905ff 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVirtualPerforationResults.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVirtualPerforationResults.cpp @@ -29,7 +29,7 @@ CAF_PDM_SOURCE_INIT( RimVirtualPerforationResults, "RimVirtualPerforationResults //-------------------------------------------------------------------------------------------------- RimVirtualPerforationResults::RimVirtualPerforationResults() { - CAF_PDM_InitObject( "Well Connection Factors", ":/WellCF16x16.png", "", "" ); + CAF_PDM_InitObject( "Well Connection Factors", ":/WellCF16x16.png" ); CAF_PDM_InitField( &m_isActive, "ShowConnectionFactors", false, "" ); CAF_PDM_InitField( &m_showClosedConnections, "ShowClosedConnections", true, "Show On Closed Connections" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp b/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp index 4db3e8934f..e8fccb3530 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp @@ -35,7 +35,7 @@ CAF_PDM_SOURCE_INIT( RimWbsParameters, "WbsParameters" ); //-------------------------------------------------------------------------------------------------- RimWbsParameters::RimWbsParameters() { - CAF_PDM_InitScriptableObject( "Well Bore Stability Parameters", ":/WellLogPlot16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Well Bore Stability Parameters", ":/WellLogPlot16x16.png" ); CAF_PDM_InitScriptableFieldNoDefault( &m_porePressureSource, "PorePressureReservoirSource", diff --git a/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.cpp index 9bbc76faed..7b43a813c1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimWellBoreStabilityPlot.cpp @@ -52,10 +52,7 @@ RimWellBoreStabilityPlot::RimWellBoreStabilityPlot() CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_wbsParameters, "WbsParameters", "Parameters", - "Well Bore Stability Parameters", - "", - "", - "" ); + "Well Bore Stability Parameters" ); m_wbsParameters = new RimWbsParameters; m_wbsParameters.uiCapability()->setUiTreeHidden( true ); m_wbsParameters.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp index 6907fb0c2d..43747d7eeb 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp @@ -34,12 +34,7 @@ RimElasticPropertyScalingCollection::RimElasticPropertyScalingCollection() { CAF_PDM_InitScriptableObject( "Elastic Property Scalings" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_elasticPropertyScalings, - "ElasticPropertyScalings", - "Elastic Property Scalings", - "", - "", - "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_elasticPropertyScalings, "ElasticPropertyScalings", "Elastic Property Scalings" ); m_elasticPropertyScalings.uiCapability()->setUiTreeHidden( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp index 0aa3100640..aadbdfa90f 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp @@ -149,10 +149,7 @@ RimStimPlanModel::RimStimPlanModel() CAF_PDM_InitScriptableFieldNoDefault( &m_initialPressureEclipseCase, "InitialPressureEclipseCase", - "Initial Pressure Case", - "", - "", - "" ); + "Initial Pressure Case" ); m_initialPressureEclipseCase.uiCapability()->setUiReadOnly( true ); CAF_PDM_InitScriptableFieldNoDefault( &m_staticEclipseCase, "StaticEclipseCase", "Static Case" ); @@ -178,10 +175,7 @@ RimStimPlanModel::RimStimPlanModel() CAF_PDM_InitScriptableField( &m_extractionType, "ExtractionType", caf::AppEnum( ExtractionType::TRUE_STRATIGRAPHIC_THICKNESS ), - "Extraction Type", - "", - "", - "" ); + "Extraction Type" ); CAF_PDM_InitScriptableFieldNoDefault( &m_anchorPosition, "AnchorPosition", "Anchor Position" ); m_anchorPosition.uiCapability()->setUiReadOnly( true ); @@ -198,10 +192,7 @@ RimStimPlanModel::RimStimPlanModel() CAF_PDM_InitScriptableFieldNoDefault( &m_thicknessDirectionWellPath, "ThicknessDirectionWellPath", - "Thickness Direction Well Path", - "", - "", - "" ); + "Thickness Direction Well Path" ); CAF_PDM_InitScriptableField( &m_boundingBoxHorizontal, "BoundingBoxHorizontal", 50.0, "Bounding Box Horizontal" ); CAF_PDM_InitScriptableField( &m_boundingBoxVertical, "BoundingBoxVertical", 100.0, "Bounding Box Vertical" ); @@ -211,27 +202,18 @@ RimStimPlanModel::RimStimPlanModel() CAF_PDM_InitScriptableField( &m_relativePermeabilityFactorDefault, "RelativePermeabilityFactor", 0.5, - "Relative Permeability Factor", - "", - "", - "" ); + "Relative Permeability Factor" ); CAF_PDM_InitScriptableField( &m_poroElasticConstantDefault, "PoroElasticConstant", 0.0, "Poro-Elastic Constant" ); CAF_PDM_InitScriptableField( &m_thermalExpansionCoeffientDefault, "ThermalExpansionCoefficient", 0.0, - "Thermal Expansion Coefficient [1/C]", - "", - "", - "" ); + "Thermal Expansion Coefficient [1/C]" ); CAF_PDM_InitScriptableField( &m_perforationLength, "PerforationLength", 10.0, "Perforation Length [m]" ); CAF_PDM_InitScriptableField( &m_fractureOrientation, "FractureOrientation", caf::AppEnum( FractureOrientation::ALONG_WELL_PATH ), - "Fracture Orientation", - "", - "", - "" ); + "Fracture Orientation" ); CAF_PDM_InitScriptableField( &m_azimuthAngle, "AzimuthAngle", 0.0, "Azimuth Angle" ); CAF_PDM_InitScriptableField( &m_formationDip, "FormationDip", 0.0, "Formation Dip" ); @@ -257,12 +239,7 @@ RimStimPlanModel::RimStimPlanModel() CAF_PDM_InitScriptableField( &m_barrierFaultName, "BarrierFaultName", QString( "" ), "Barrier Fault" ); m_barrierFaultName.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitScriptableFieldNoDefault( &m_barrierTextAnnotation, - "BarrierTextAnnotation", - "Barrier Text Annotation", - "", - "", - "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_barrierTextAnnotation, "BarrierTextAnnotation", "Barrier Text Annotation" ); CAF_PDM_InitScriptableFieldNoDefault( &m_perforationInterval, "PerforationInterval", "Perforation Interval" ); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp index e4b4838d68..4819a52729 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp @@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimStimPlanModelPlotCollection, "StimPlanModelPlotCollectio //-------------------------------------------------------------------------------------------------- RimStimPlanModelPlotCollection::RimStimPlanModelPlotCollection() { - CAF_PDM_InitScriptableObject( "StimPlan Model Plots", ":/WellLogPlots16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "StimPlan Model Plots", ":/WellLogPlots16x16.png" ); CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModelPlots, "StimPlanModelPlots", "" ); m_stimPlanModelPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp index 3fb05ca736..2df5c98179 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp @@ -77,17 +77,8 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate() CAF_PDM_InitScriptableFieldNoDefault( &m_initialPressureEclipseCase, "InitialPressureEclipseCase", - "Initial Pressure Case", - "", - "", - "" ); - CAF_PDM_InitField( &m_useTableForInitialPressure, - "UseForInitialPressure", - false, - "Use Pressure Table For Initial Pressure", - "", - "", - "" ); + "Initial Pressure Case" ); + CAF_PDM_InitField( &m_useTableForInitialPressure, "UseForInitialPressure", false, "Use Pressure Table For Initial Pressure" ); CAF_PDM_InitField( &m_useTableForPressure, "UseForPressure", false, "Use Pressure Table For Pressure" ); CAF_PDM_InitField( &m_editPressureTable, "EditPressureTable", false, "Edit" ); m_editPressureTable.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); @@ -98,25 +89,13 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate() CAF_PDM_InitField( &m_useEqlnumForPressureInterpolation, "UseEqlNumForPressureInterpolation", true, - "Use EQLNUM For Pressure Interpolation", - "", - "", - "" ); - - CAF_PDM_InitScriptableField( &m_defaultPorosity, - "DefaultPorosity", - RiaDefines::defaultPorosity(), - "Default Porosity", - "", - "", - "" ); + "Use EQLNUM For Pressure Interpolation" ); + + CAF_PDM_InitScriptableField( &m_defaultPorosity, "DefaultPorosity", RiaDefines::defaultPorosity(), "Default Porosity" ); CAF_PDM_InitScriptableField( &m_defaultPermeability, "DefaultPermeability", RiaDefines::defaultPermeability(), - "Default Permeability", - "", - "", - "" ); + "Default Permeability" ); // Stress unit: bar // Stress gradient unit: bar/m @@ -130,10 +109,7 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate() CAF_PDM_InitScriptableField( &m_verticalStressGradient, "VerticalStressGradient", defaultStressGradient, - "Vertical Stress Gradient", - "", - "", - "" ); + "Vertical Stress Gradient" ); CAF_PDM_InitScriptableField( &m_stressDepth, "StressDepth", defaultStressDepth, "Stress Depth" ); m_stressDepth.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); @@ -141,62 +117,29 @@ RimStimPlanModelTemplate::RimStimPlanModelTemplate() CAF_PDM_InitScriptableField( &m_referenceTemperatureGradient, "ReferenceTemperatureGradient", 0.025, - "Temperature Gradient [C/m]", - "", - "", - "" ); - CAF_PDM_InitScriptableField( &m_referenceTemperatureDepth, - "ReferenceTemperatureDepth", - 2500.0, - "Temperature Depth [m]", - "", - "", - "" ); + "Temperature Gradient [C/m]" ); + CAF_PDM_InitScriptableField( &m_referenceTemperatureDepth, "ReferenceTemperatureDepth", 2500.0, "Temperature Depth [m]" ); CAF_PDM_InitScriptableField( &m_overburdenHeight, "OverburdenHeight", 50.0, "Overburden Height" ); CAF_PDM_InitScriptableFieldNoDefault( &m_overburdenFormation, "OverburdenFormation", "Overburden Formation" ); CAF_PDM_InitScriptableFieldNoDefault( &m_overburdenFacies, "OverburdenFacies", "Overburden Facies" ); CAF_PDM_InitScriptableField( &m_overburdenPorosity, "OverburdenPorosity", 0.0, "Overburden Porosity" ); - CAF_PDM_InitScriptableField( &m_overburdenPermeability, - "OverburdenPermeability", - 10.0e-6, - "Overburden Permeability", - "", - "", - "" ); - CAF_PDM_InitScriptableField( &m_overburdenFluidDensity, - "OverburdenFluidDensity", - 1.03, - "Overburden Fluid Density [g/cm^3]", - "", - "", - "" ); + CAF_PDM_InitScriptableField( &m_overburdenPermeability, "OverburdenPermeability", 10.0e-6, "Overburden Permeability" ); + CAF_PDM_InitScriptableField( &m_overburdenFluidDensity, "OverburdenFluidDensity", 1.03, "Overburden Fluid Density [g/cm^3]" ); CAF_PDM_InitScriptableField( &m_underburdenHeight, "UnderburdenHeight", 50.0, "Underburden Height" ); CAF_PDM_InitScriptableFieldNoDefault( &m_underburdenFormation, "UnderburdenFormation", "Underburden Formation" ); CAF_PDM_InitScriptableFieldNoDefault( &m_underburdenFacies, "UnderburdenFacies", "Underburden Facies" ); CAF_PDM_InitScriptableField( &m_underburdenPorosity, "UnderburdenPorosity", 0.0, "Underburden Porosity" ); - CAF_PDM_InitScriptableField( &m_underburdenPermeability, - "UnderburdenPermeability", - 10.0e-6, - "Underburden Permeability", - "", - "", - "" ); + CAF_PDM_InitScriptableField( &m_underburdenPermeability, "UnderburdenPermeability", 10.0e-6, "Underburden Permeability" ); CAF_PDM_InitScriptableField( &m_underburdenFluidDensity, "UnderburdenFluidDensity", 1.03, - "Underburden Fluid Density [g/cm^3]", - "", - "", - "" ); + "Underburden Fluid Density [g/cm^3]" ); CAF_PDM_InitScriptableFieldNoDefault( &m_faciesInitialPressureConfigs, "FaciesInitialPressureConfigs", - "Facies Initial Pressure Configs", - "", - "", - "" ); + "Facies Initial Pressure Configs" ); m_faciesInitialPressureConfigs.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); m_faciesInitialPressureConfigs.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); m_faciesInitialPressureConfigs.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp index 97ca077151..c50c4e09cb 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp @@ -36,14 +36,9 @@ CAF_PDM_SOURCE_INIT( RimStimPlanModelTemplateCollection, "StimPlanModelTemplateC //-------------------------------------------------------------------------------------------------- RimStimPlanModelTemplateCollection::RimStimPlanModelTemplateCollection() { - CAF_PDM_InitScriptableObject( "StimPlan Model Templates", ":/FractureTemplates16x16.png", "", "" ); - - CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModelTemplates, - "StimPlanModelTemplates", - "StimPlan Model Templates", - "", - "", - "" ); + CAF_PDM_InitScriptableObject( "StimPlan Model Templates", ":/FractureTemplates16x16.png" ); + + CAF_PDM_InitScriptableFieldNoDefault( &m_stimPlanModelTemplates, "StimPlanModelTemplates", "StimPlan Model Templates" ); m_stimPlanModelTemplates.uiCapability()->setUiTreeHidden( true ); CAF_PDM_InitField( &m_nextValidId, "NextValidId", 0, "" ); diff --git a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamline.cpp b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamline.cpp index 03ac48398f..8fc8c9378d 100644 --- a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamline.cpp +++ b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamline.cpp @@ -28,7 +28,7 @@ CAF_PDM_ABSTRACT_SOURCE_INIT( RimStreamline, "Streamline" ); //-------------------------------------------------------------------------------------------------- RimStreamline::RimStreamline( QString simWellName ) { - CAF_PDM_InitScriptableObject( "Streamline", ":/Erase.png", "", "" ); + CAF_PDM_InitScriptableObject( "Streamline", ":/Erase.png" ); CAF_PDM_InitScriptableField( &m_simWellName, "Name", simWellName, "Name" ); m_simWellName.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp index ba5ed584b4..ec85c72e97 100644 --- a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp @@ -95,7 +95,7 @@ RimStreamlineInViewCollection::RimStreamlineInViewCollection() : m_shouldGenerateTracers( false ) , m_currentTimestep( -1 ) { - CAF_PDM_InitObject( "Streamlines", ":/Erase.png", "", "" ); + CAF_PDM_InitObject( "Streamlines", ":/Erase.png" ); CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendDefinition", "Color Legend" ); m_legendConfig = new RimRegularLegendConfig(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp index 127de81278..edbd1d6311 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp @@ -41,7 +41,7 @@ CAF_PDM_SOURCE_INIT( RimAsciiDataCurve, "AsciiDataCurve" ); //-------------------------------------------------------------------------------------------------- RimAsciiDataCurve::RimAsciiDataCurve() { - CAF_PDM_InitObject( "ASCII Data Curve", ":/SummaryCurve16x16.png", "", "" ); + CAF_PDM_InitObject( "ASCII Data Curve", ":/SummaryCurve16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis" ); CAF_PDM_InitFieldNoDefault( &m_timeSteps, "TimeSteps", "Time Steps" ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.cpp index 28f6ecbf88..3cd314794e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCase.cpp @@ -28,7 +28,7 @@ CAF_PDM_SOURCE_INIT( RimCalculatedSummaryCase, "CalculatedSummaryCase" ); //-------------------------------------------------------------------------------------------------- RimCalculatedSummaryCase::RimCalculatedSummaryCase() { - CAF_PDM_InitObject( "Calculated", ":/SummaryCase.svg", "", "" ); + CAF_PDM_InitObject( "Calculated", ":/SummaryCase.svg" ); m_calculatedCurveReader = nullptr; m_displayName = "Calculated"; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimCsvUserData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimCsvUserData.cpp index 56a5e2831c..c0098ac569 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimCsvUserData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimCsvUserData.cpp @@ -36,7 +36,7 @@ CAF_PDM_SOURCE_INIT( RimCsvUserData, "RimCsvUserData" ); //-------------------------------------------------------------------------------------------------- RimCsvUserData::RimCsvUserData() { - CAF_PDM_InitObject( "Observed CSV Data File", ":/ObservedCSVDataFile16x16.png", "", "" ); + CAF_PDM_InitObject( "Observed CSV Data File", ":/ObservedCSVDataFile16x16.png" ); m_summaryHeaderFilename.uiCapability()->setUiName( "File" ); CAF_PDM_InitFieldNoDefault( &m_parseOptions, "ParseOptions", "" ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp index 9612b1ab75..a9addfcda2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp @@ -56,7 +56,7 @@ CAF_PDM_SOURCE_INIT( RimDerivedEnsembleCaseCollection, "RimDerivedEnsembleCaseCo //-------------------------------------------------------------------------------------------------- RimDerivedEnsembleCaseCollection::RimDerivedEnsembleCaseCollection() { - CAF_PDM_InitObject( "Delta Ensemble", ":/SummaryEnsemble.svg", "", "" ); + CAF_PDM_InitObject( "Delta Ensemble", ":/SummaryEnsemble.svg" ); CAF_PDM_InitFieldNoDefault( &m_ensemble1, "Ensemble1", "Ensemble 1" ); m_ensemble1.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp index f19e340d4b..233c1e3080 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp @@ -62,7 +62,7 @@ RimDerivedSummaryCase::RimDerivedSummaryCase() : m_summaryCase1( nullptr ) , m_summaryCase2( nullptr ) { - CAF_PDM_InitObject( "Summary Case", ":/SummaryCase.svg", "", "" ); + CAF_PDM_InitObject( "Summary Case", ":/SummaryCase.svg" ); CAF_PDM_InitFieldNoDefault( &m_summaryCase1, "SummaryCase1", "Summary Case 1" ); CAF_PDM_InitFieldNoDefault( &m_operator, "Operator", "Operator" ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp index 08344993cc..58f5d543b5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp @@ -66,7 +66,7 @@ RimEnsembleCurveFilter::RimEnsembleCurveFilter() : m_lowerLimit( -DOUBLE_INF ) , m_upperLimit( DOUBLE_INF ) { - CAF_PDM_InitObject( "Ensemble Curve Filter", ":/Filter.svg", "", "" ); + CAF_PDM_InitObject( "Ensemble Curve Filter", ":/Filter.svg" ); CAF_PDM_InitFieldNoDefault( &m_filterTitle, "FilterTitle", "Title" ); m_filterTitle.registerGetMethod( this, &RimEnsembleCurveFilter::description ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp index f508796dfe..2ffc05d66e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp @@ -37,7 +37,7 @@ CAF_PDM_SOURCE_INIT( RimEnsembleCurveFilterCollection, "RimEnsembleCurveFilterCo //-------------------------------------------------------------------------------------------------- RimEnsembleCurveFilterCollection::RimEnsembleCurveFilterCollection() { - CAF_PDM_InitObject( "Curve Filters", ":/FilterCollection.svg", "", "" ); + CAF_PDM_InitObject( "Curve Filters", ":/FilterCollection.svg" ); CAF_PDM_InitField( &m_active, "Active", true, "Active" ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index f5d5b7cad3..31fb883508 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -97,7 +97,7 @@ RimEnsembleCurveSet::RimEnsembleCurveSet() : filterChanged( this ) { - CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png", "", "" ); + CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_curves, "EnsembleCurveSet", "Ensemble Curve Set" ); m_curves.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp index 348f4c3ff9..41748a72bf 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp @@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT( RimEnsembleCurveSetCollection, "RimEnsembleCurveSetCollecti //-------------------------------------------------------------------------------------------------- RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection() { - CAF_PDM_InitObject( "Ensemble Curve Sets", ":/EnsembleCurveSets16x16.png", "", "" ); + CAF_PDM_InitObject( "Ensemble Curve Sets", ":/EnsembleCurveSets16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_curveSets, "EnsembleCurveSets", "Ensemble Curve Sets" ); m_curveSets.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp index 785fa1631d..27cb5309bc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp @@ -30,7 +30,7 @@ CAF_PDM_SOURCE_INIT( RimEnsembleStatistics, "RimEnsembleStatistics" ); //-------------------------------------------------------------------------------------------------- RimEnsembleStatistics::RimEnsembleStatistics( RimEnsembleCurveSetInterface* parentCurveSet ) { - CAF_PDM_InitObject( "Ensemble Curve Filter", ":/EnsembleCurveSet16x16.png", "", "" ); + CAF_PDM_InitObject( "Ensemble Curve Filter", ":/EnsembleCurveSet16x16.png" ); m_parentCurveSet = parentCurveSet; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp index a73998edb2..a3310fd99f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp @@ -60,18 +60,9 @@ RimObjectiveFunction::RimObjectiveFunction() CAF_PDM_InitField( &m_normalizeByNumberOfObservations, "NormalizeByNumberOfObservations", true, - "Normalize by Number of Observations", - "", - "", - "" ); + "Normalize by Number of Observations" ); - CAF_PDM_InitField( &m_normalizeByNumberOfVectors, - "NormalizeByNumberOfVectors", - true, - "Normalize by Number of Vectors", - "", - "", - "" ); + CAF_PDM_InitField( &m_normalizeByNumberOfVectors, "NormalizeByNumberOfVectors", true, "Normalize by Number of Vectors" ); CAF_PDM_InitField( &m_errorEstimatePercentage, "ErrorEstimatePercentage", 100.0, "Error Estimate [0..100 %]" ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedEclipseUserData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedEclipseUserData.cpp index 394a7fd832..c56306c372 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedEclipseUserData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedEclipseUserData.cpp @@ -37,7 +37,7 @@ CAF_PDM_SOURCE_INIT( RimObservedEclipseUserData, "RimObservedEclipseUserData" ); //-------------------------------------------------------------------------------------------------- RimObservedEclipseUserData::RimObservedEclipseUserData() { - CAF_PDM_InitObject( "Observed RSMSPEC Column Based Data File", ":/ObservedRSMDataFile16x16.png", "", "" ); + CAF_PDM_InitObject( "Observed RSMSPEC Column Based Data File", ":/ObservedRSMDataFile16x16.png" ); m_summaryHeaderFilename.uiCapability()->setUiName( "File" ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp index 411898405e..7e2c1b140f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp @@ -44,10 +44,7 @@ RimObservedSummaryData::RimObservedSummaryData() CAF_PDM_InitField( &m_summaryCategory, "SummaryType", caf::AppEnum( RifEclipseSummaryAddress::SUMMARY_WELL ), - "Summary Type", - "", - "", - "" ); + "Summary Type" ); m_summaryCategory.uiCapability()->setUiHidden( true ); CAF_PDM_InitFieldNoDefault( &m_identifierName, "IdentifierName", "Identifier Name" ); m_identifierName.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index 46bcbdf9f1..af8a74a258 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -105,7 +105,7 @@ RimSummaryCaseCollection::RimSummaryCaseCollection() : caseNameChanged( this ) , caseRemoved( this ) { - CAF_PDM_InitScriptableObject( "Summary Case Group", ":/SummaryGroup16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Summary Case Group", ":/SummaryGroup16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_cases, "SummaryCases", "" ); m_cases.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index fd64c1980d..c35ae80254 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -96,7 +96,7 @@ void addCaseRealizationParametersIfFound( RimSummaryCase& sumCase, const QString RimSummaryCaseMainCollection::RimSummaryCaseMainCollection() : dataSourceHasChanged( this ) { - CAF_PDM_InitObject( "Summary Cases", ":/SummaryCases16x16.png", "", "" ); + CAF_PDM_InitObject( "Summary Cases", ":/SummaryCases16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_cases, "SummaryCases", "" ); CAF_PDM_InitFieldNoDefault( &m_caseCollections, "SummaryCaseCollections", "" ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp index 334c2b672e..cf0ccea526 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp @@ -28,7 +28,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryCrossPlot, "SummaryCrossPlot" ); //-------------------------------------------------------------------------------------------------- RimSummaryCrossPlot::RimSummaryCrossPlot() { - CAF_PDM_InitObject( "Summary Cross Plot", ":/SummaryXPlotLight16x16.png", "", "" ); + CAF_PDM_InitObject( "Summary Cross Plot", ":/SummaryXPlotLight16x16.png" ); setAsCrossPlot(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp index ddedbd407f..78735662aa 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp @@ -31,7 +31,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryCrossPlotCollection, "SummaryCrossPlotCollection" //-------------------------------------------------------------------------------------------------- RimSummaryCrossPlotCollection::RimSummaryCrossPlotCollection() { - CAF_PDM_InitObject( "Summary Cross Plots", ":/SummaryXPlotsLight16x16.png", "", "" ); + CAF_PDM_InitObject( "Summary Cross Plots", ":/SummaryXPlotsLight16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_summaryCrossPlots, "SummaryCrossPlots", "Summary Cross Plots" ); m_summaryCrossPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index c097bc5cc2..82f8639abc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -65,7 +65,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryCurve, "SummaryCurve" ); //-------------------------------------------------------------------------------------------------- RimSummaryCurve::RimSummaryCurve() { - CAF_PDM_InitObject( "Summary Curve", ":/SummaryCurve16x16.png", "", "" ); + CAF_PDM_InitObject( "Summary Curve", ":/SummaryCurve16x16.png" ); // Y Values CAF_PDM_InitFieldNoDefault( &m_yValuesSummaryCase, "SummaryCase", "Case" ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index 4e98bf253b..e28a535797 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -48,7 +48,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryCurveCollection, "RimSummaryCurveCollection" ); RimSummaryCurveCollection::RimSummaryCurveCollection() : curvesChanged( this ) { - CAF_PDM_InitObject( "Summary Curves", ":/SummaryCurveFilter16x16.png", "", "" ); + CAF_PDM_InitObject( "Summary Curves", ":/SummaryCurveFilter16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_curves, "CollectionCurves", "Collection Curves" ); m_curves.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 5bec5ce2a1..29f59d0ca9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -46,7 +46,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlot::RimSummaryMultiPlot() { - CAF_PDM_InitObject( "Multi Summary Plot", "", "", "" ); + CAF_PDM_InitObject( "Multi Summary Plot" ); this->setDeletable( true ); CAF_PDM_InitFieldNoDefault( &m_filterText, "FilterText", "Filter Text" ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryObservedDataFile.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryObservedDataFile.cpp index 7d79aa3bee..48e443e367 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryObservedDataFile.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryObservedDataFile.cpp @@ -31,7 +31,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryObservedDataFile, "SummaryObservedDataFile" ); //-------------------------------------------------------------------------------------------------- RimSummaryObservedDataFile::RimSummaryObservedDataFile() { - CAF_PDM_InitObject( "Observed data file", ":/ObservedDataFile16x16.png", "", "" ); + CAF_PDM_InitObject( "Observed data file", ":/ObservedDataFile16x16.png" ); m_summaryHeaderFilename.uiCapability()->setUiName( "File" ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp index bb4dec0089..5936afc101 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp @@ -37,7 +37,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryPlotCollection, "SummaryPlotCollection" ); //-------------------------------------------------------------------------------------------------- RimSummaryPlotCollection::RimSummaryPlotCollection() { - CAF_PDM_InitScriptableObject( "Summary Plots", ":/SummaryPlotsLight16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Summary Plots", ":/SummaryPlotsLight16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_summaryPlots, "SummaryPlots", "Summary Plots" ); m_summaryPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index b50602db11..a2735128e0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -58,10 +58,7 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() CAF_PDM_InitField( &m_includeEnsembleCasesForCaseStepping, "IncludeEnsembleCasesForCaseStepping", false, - "Allow Stepping on Ensemble cases", - "", - "", - "" ); + "Allow Stepping on Ensemble cases" ); CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name" ); CAF_PDM_InitFieldNoDefault( &m_wellGroupName, "GroupName", "Group Name" ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index 842aa44c24..357349041b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -68,7 +68,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryTimeAxisProperties, "SummaryTimeAxisProperties" ) //-------------------------------------------------------------------------------------------------- RimSummaryTimeAxisProperties::RimSummaryTimeAxisProperties() { - CAF_PDM_InitObject( "Time Axis", ":/BottomAxis16x16.png", "", "" ); + CAF_PDM_InitObject( "Time Axis", ":/BottomAxis16x16.png" ); CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleStatisticsSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleStatisticsSurface.cpp index e17a89afea..b13bfe97ec 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleStatisticsSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleStatisticsSurface.cpp @@ -35,7 +35,7 @@ CAF_PDM_SOURCE_INIT( RimEnsembleStatisticsSurface, "EnsembleStatisticsSurface" ) //-------------------------------------------------------------------------------------------------- RimEnsembleStatisticsSurface::RimEnsembleStatisticsSurface() { - CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_statisticsType, "StatisticsType", "StatisticsType" ); } diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp index 09a632a5a4..f12db41728 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp @@ -42,7 +42,7 @@ CAF_PDM_SOURCE_INIT( RimEnsembleSurface, "EnsembleSurface" ); //-------------------------------------------------------------------------------------------------- RimEnsembleSurface::RimEnsembleSurface() { - CAF_PDM_InitScriptableObject( "Ensemble Surface", ":/ReservoirSurfaces16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Ensemble Surface", ":/ReservoirSurfaces16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_ensembleCurveSet, "FilterEnsembleCurveSet", "Filter by Ensemble Curve Set" ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp index ffbe787495..8e58667746 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp @@ -38,7 +38,7 @@ CAF_PDM_SOURCE_INIT( RimFileSurface, "Surface", "FileSurface" ); //-------------------------------------------------------------------------------------------------- RimFileSurface::RimFileSurface() { - CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_surfaceDefinitionFilePath, "SurfaceFilePath", "File" ); } diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp index d4bfe3ca3d..71a4f691ce 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp @@ -40,7 +40,7 @@ CAF_PDM_SOURCE_INIT( RimGridCaseSurface, "GridCaseSurface" ); //-------------------------------------------------------------------------------------------------- RimGridCaseSurface::RimGridCaseSurface() { - CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png" ); CAF_PDM_InitScriptableFieldNoDefault( &m_case, "SourceCase", "Source Case" ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurface.cpp index 85a2ae5ae3..dc7c979412 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurface.cpp @@ -53,7 +53,7 @@ void caf::AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RimSurface::RimSurface() { - CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Surface", ":/ReservoirSurface16x16.png" ); CAF_PDM_InitScriptableFieldNoDefault( &m_userDescription, "SurfaceUserDecription", "Name" ); CAF_PDM_InitField( &m_color, "SurfaceColor", cvf::Color3f( 0.5f, 0.3f, 0.2f ), "Color" ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp index 9898fc3903..c16095c038 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp @@ -49,7 +49,7 @@ CAF_PDM_SOURCE_INIT( RimSurfaceCollection, "SurfaceCollection" ); //-------------------------------------------------------------------------------------------------- RimSurfaceCollection::RimSurfaceCollection() { - CAF_PDM_InitScriptableObject( "Surfaces", ":/ReservoirSurfaces16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Surfaces", ":/ReservoirSurfaces16x16.png" ); CAF_PDM_InitScriptableFieldNoDefault( &m_collectionName, "SurfaceUserDecription", "Name" ); m_collectionName = "Surfaces"; diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp index d6e7c3d024..e3bfb3e386 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInView.cpp @@ -41,7 +41,7 @@ CAF_PDM_SOURCE_INIT( RimSurfaceInView, "SurfaceInView" ); //-------------------------------------------------------------------------------------------------- RimSurfaceInView::RimSurfaceInView() { - CAF_PDM_InitObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); + CAF_PDM_InitObject( "Surface", ":/ReservoirSurface16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name" ); m_name.registerGetMethod( this, &RimSurfaceInView::name ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp index db4bbc3a15..aca225d2f2 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp @@ -41,7 +41,7 @@ CAF_PDM_SOURCE_INIT( RimSurfaceInViewCollection, "SurfaceInViewCollection" ); //-------------------------------------------------------------------------------------------------- RimSurfaceInViewCollection::RimSurfaceInViewCollection() { - CAF_PDM_InitObject( "Surfaces", ":/ReservoirSurfaces16x16.png", "", "" ); + CAF_PDM_InitObject( "Surfaces", ":/ReservoirSurfaces16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_collectionName, "CollectionName", "Name" ); m_collectionName.registerGetMethod( this, &RimSurfaceInViewCollection::name ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp index da6dffff1e..1a06b295e7 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp @@ -36,7 +36,7 @@ CAF_PDM_SOURCE_INIT( RimSurfaceResultDefinition, "SurfaceResultDefinition" ); //-------------------------------------------------------------------------------------------------- RimSurfaceResultDefinition::RimSurfaceResultDefinition() { - CAF_PDM_InitObject( "Surface", ":/ReservoirSurface16x16.png", "", "" ); + CAF_PDM_InitObject( "Surface", ":/ReservoirSurface16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_propertyName, "PropertyName", "Property Name" ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.cpp index 63fee94e9d..2e64283d16 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogCurve.cpp @@ -60,7 +60,7 @@ Rim3dWellLogCurve::Rim3dWellLogCurve() : m_minCurveDataValue( -std::numeric_limits::infinity() ) , m_maxCurveDataValue( std::numeric_limits::infinity() ) { - CAF_PDM_InitObject( "3d Well Log Curve", ":/WellLogCurve16x16.png", "", "" ); + CAF_PDM_InitObject( "3d Well Log Curve", ":/WellLogCurve16x16.png" ); CAF_PDM_InitField( &m_showCurve, "Show3dWellLogCurve", true, "Show 3d Well Log Curve" ); m_showCurve.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp index 5671f05a75..9a7abe0e19 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp @@ -64,7 +64,7 @@ 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 ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp index b23d74ad94..82219e3d23 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp @@ -39,7 +39,7 @@ 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" ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp index 2a8f5785ac..66cb1f11b0 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp @@ -42,7 +42,7 @@ 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", "" ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp index bf33dd0a44..0294c43083 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp @@ -94,7 +94,7 @@ RimEnsembleWellLogCurveSet::RimEnsembleWellLogCurveSet() : filterChanged( this ) { - CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png", "", "" ); + CAF_PDM_InitObject( "Ensemble Curve Set", ":/EnsembleCurveSet16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_curves, "EnsembleCurveSet", "Ensemble Curve Set" ); m_curves.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp index fd3547d02e..8f3c319a91 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp @@ -29,7 +29,7 @@ CAF_PDM_SOURCE_INIT( RimEnsembleWellLogsCollection, "EnsembleWellLogsCollection" //-------------------------------------------------------------------------------------------------- RimEnsembleWellLogsCollection::RimEnsembleWellLogsCollection() { - CAF_PDM_InitObject( "Ensemble Well Logs", ":/LasFile16x16.png", "", "" ); + CAF_PDM_InitObject( "Ensemble Well Logs", ":/LasFile16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_ensembleWellLogs, "EnsembleWellLogsCollection", "" ); m_ensembleWellLogs.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp index 8662c7c6e2..ae818382c0 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp @@ -44,7 +44,7 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimWellLogCurve, "WellLogPlotCurve" ); //-------------------------------------------------------------------------------------------------- RimWellLogCurve::RimWellLogCurve() { - CAF_PDM_InitObject( "WellLogCurve", ":/WellLogCurve16x16.png", "", "" ); + CAF_PDM_InitObject( "WellLogCurve", ":/WellLogCurve16x16.png" ); m_qwtPlotCurve->setXAxis( QwtPlot::xTop ); m_qwtCurveErrorBars->setXAxis( QwtPlot::xTop ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 279cc56609..40656d7d60 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -94,7 +94,7 @@ void AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RimWellLogExtractionCurve::RimWellLogExtractionCurve() { - CAF_PDM_InitScriptableObject( "Well Log Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" ); + CAF_PDM_InitScriptableObject( "Well Log Curve", RimWellLogCurve::wellLogCurveIconName() ); CAF_PDM_InitFieldNoDefault( &m_trajectoryType, "TrajectoryType", "Trajectory Type" ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp index 48151afadc..590e82af9b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp @@ -64,7 +64,7 @@ const QDateTime RimWellLogFile::DEFAULT_DATE_TIME = RiaQDateTimeTools::createUtc //-------------------------------------------------------------------------------------------------- RimWellLogFile::RimWellLogFile() { - CAF_PDM_InitObject( "Well LAS File Info", ":/LasFile16x16.png", "", "" ); + CAF_PDM_InitObject( "Well LAS File Info", ":/LasFile16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "" ); m_wellName.uiCapability()->setUiReadOnly( true ); @@ -86,10 +86,7 @@ RimWellLogFile::RimWellLogFile() CAF_PDM_InitField( &m_wellFlowCondition, "WellFlowCondition", caf::AppEnum( RimWellLogFile::WELL_FLOW_COND_STANDARD ), - "Well Flow Rates", - "", - "", - "" ); + "Well Flow Rates" ); CAF_PDM_InitField( &m_invalidDateMessage, "InvalidDateMessage", QString( "Invalid or no date" ), "" ); m_invalidDateMessage.uiCapability()->setUiReadOnly( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp index 9f09c4a36d..482fbc6948 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp @@ -52,7 +52,7 @@ CAF_PDM_SOURCE_INIT( RimWellLogFileCurve, "WellLogFileCurve" ); //-------------------------------------------------------------------------------------------------- RimWellLogFileCurve::RimWellLogFileCurve() { - CAF_PDM_InitObject( "Well Log File Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" ); + CAF_PDM_InitObject( "Well Log File Curve", RimWellLogCurve::wellLogCurveIconName() ); CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Path" ); m_wellPath.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp index 78c917d5f8..7d1390642a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp @@ -46,7 +46,7 @@ CAF_PDM_SOURCE_INIT( RimWellLogPlotCollection, "WellLogPlotCollection" ); //-------------------------------------------------------------------------------------------------- RimWellLogPlotCollection::RimWellLogPlotCollection() { - CAF_PDM_InitScriptableObject( "Well Log Plots", ":/WellLogPlots16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Well Log Plots", ":/WellLogPlots16x16.png" ); CAF_PDM_InitScriptableFieldNoDefault( &m_wellLogPlots, "WellLogPlots", "" ); m_wellLogPlots.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index 491eb8875b..fbd41effc9 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -94,7 +94,7 @@ CAF_PDM_SOURCE_INIT( RimWellLogRftCurve, "WellLogRftCurve" ); //-------------------------------------------------------------------------------------------------- RimWellLogRftCurve::RimWellLogRftCurve() { - CAF_PDM_InitObject( "Well Log RFT Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" ); + CAF_PDM_InitObject( "Well Log RFT Curve", RimWellLogCurve::wellLogCurveIconName() ); CAF_PDM_InitFieldNoDefault( &m_eclipseResultCase, "CurveEclipseResultCase", "Eclipse Result Case" ); m_eclipseResultCase.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 30c2c9bf60..89747ea6ac 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -174,7 +174,7 @@ RimWellLogTrack::RimWellLogTrack() , m_availableDepthRangeMax( RI_LOGPLOTTRACK_MAXX_DEFAULT ) { - CAF_PDM_InitScriptableObject( "Track", ":/WellLogTrack16x16.png", "", "" ); + CAF_PDM_InitScriptableObject( "Track", ":/WellLogTrack16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_description, "TrackDescription", "Name" ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogWbsCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogWbsCurve.cpp index ec3b6f13c0..9634f79ac6 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogWbsCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogWbsCurve.cpp @@ -12,7 +12,7 @@ CAF_PDM_SOURCE_INIT( RimWellLogWbsCurve, "RimWellLogWbsCurve" ); //-------------------------------------------------------------------------------------------------- RimWellLogWbsCurve::RimWellLogWbsCurve() { - CAF_PDM_InitObject( "Well Bore Stability Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" ); + CAF_PDM_InitObject( "Well Bore Stability Curve", RimWellLogCurve::wellLogCurveIconName() ); CAF_PDM_InitField( &m_smoothCurve, "SmoothCurve", false, "Smooth Curve" ); CAF_PDM_InitField( &m_smoothingThreshold, "SmoothingThreshold", 0.002, "Smoothing Threshold" ); diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurement.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurement.cpp index d61ec04dca..17be05d7a2 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurement.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurement.cpp @@ -29,7 +29,7 @@ CAF_PDM_SOURCE_INIT( RimWellMeasurement, "WellMeasurement" ); //-------------------------------------------------------------------------------------------------- RimWellMeasurement::RimWellMeasurement() { - CAF_PDM_InitObject( "RimWellMeasurement", ":/WellMeasurement16x16.png", "", "" ); + CAF_PDM_InitObject( "RimWellMeasurement", ":/WellMeasurement16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name" ); CAF_PDM_InitField( &m_MD, "Depth", -1.0, "MD" ); diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp index 2a486a3890..ac44380a75 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp @@ -37,7 +37,7 @@ CAF_PDM_SOURCE_INIT( RimWellMeasurementCollection, "WellMeasurements" ); //-------------------------------------------------------------------------------------------------- RimWellMeasurementCollection::RimWellMeasurementCollection() { - CAF_PDM_InitObject( "Well Measurements", ":/WellMeasurement16x16.png", "", "" ); + CAF_PDM_InitObject( "Well Measurements", ":/WellMeasurement16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_measurements, "Measurements", "Well Measurements" ); m_measurements.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp index 435c19fb7f..b01b64cd01 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp @@ -50,7 +50,7 @@ CAF_PDM_SOURCE_INIT( RimWellMeasurementCurve, "WellMeasurementCurve" ); //-------------------------------------------------------------------------------------------------- RimWellMeasurementCurve::RimWellMeasurementCurve() { - CAF_PDM_InitObject( "Well Measurement Curve", RimWellLogCurve::wellLogCurveIconName(), "", "" ); + CAF_PDM_InitObject( "Well Measurement Curve", RimWellLogCurve::wellLogCurveIconName() ); CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Path" ); m_wellPath.uiCapability()->setUiTreeChildrenHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementFilePath.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementFilePath.cpp index 32ba0ff0f2..708db05aa7 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementFilePath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementFilePath.cpp @@ -29,7 +29,7 @@ CAF_PDM_SOURCE_INIT( RimWellMeasurementFilePath, "WellMeasurementFilePath" ); //-------------------------------------------------------------------------------------------------- RimWellMeasurementFilePath::RimWellMeasurementFilePath() { - CAF_PDM_InitObject( "RimWellMeasurementFilePath", ":/WellMeasurement16x16.png", "", "" ); + CAF_PDM_InitObject( "RimWellMeasurementFilePath", ":/WellMeasurement16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_userDescription, "UserDecription", "Name" ); CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" ); diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp index 16e1af635c..4070c5d51a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp @@ -48,7 +48,7 @@ CAF_PDM_SOURCE_INIT( RimWellMeasurementInView, "WellMeasurementInView" ); //-------------------------------------------------------------------------------------------------- RimWellMeasurementInView::RimWellMeasurementInView() { - CAF_PDM_InitObject( "Well Measurement", ":/WellMeasurement16x16.png", "", "" ); + CAF_PDM_InitObject( "Well Measurement", ":/WellMeasurement16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_measurementKind, "MeasurementKind", "Measurement Kind" ); m_measurementKind.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInViewCollection.cpp index affdcf921e..b94142f949 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInViewCollection.cpp @@ -43,7 +43,7 @@ CAF_PDM_SOURCE_INIT( RimWellMeasurementInViewCollection, "WellMeasurementsInView //-------------------------------------------------------------------------------------------------- RimWellMeasurementInViewCollection::RimWellMeasurementInViewCollection() { - CAF_PDM_InitObject( "Well Measurements", ":/WellMeasurement16x16.png", "", "" ); + CAF_PDM_InitObject( "Well Measurements", ":/WellMeasurement16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_measurementsInView, "MeasurementKinds", "Measurement Kinds" ); m_measurementsInView.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPath.cpp index 632f47fa15..8176ac1515 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimFileWellPath.cpp @@ -56,10 +56,7 @@ RimFileWellPath::RimFileWellPath() CAF_PDM_InitField( &m_useAutoGeneratedPointAtSeaLevel, "UseAutoGeneratedPointAtSeaLevel", false, - "Generate Point at Sea Level", - "", - "", - "" ); + "Generate Point at Sea Level" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp index a86ad9dbed..328d4d0236 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp @@ -54,10 +54,7 @@ RimModeledWellPath::RimModeledWellPath() CAF_PDM_InitScriptableFieldWithScriptKeywordNoDefault( &m_geometryDefinition, "WellPathGeometryDef", "WellPathGeometry", - "Trajectory", - "", - "", - "" ); + "Trajectory" ); m_geometryDefinition = new RimWellPathGeometryDef; m_geometryDefinition->changed.connect( this, &RimModeledWellPath::onGeometryDefinitionChanged ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp index 7499a5a170..1b99bfa0df 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp @@ -59,7 +59,7 @@ CAF_PDM_SOURCE_INIT( RimWellIASettings, "RimWellIASettings" ); //-------------------------------------------------------------------------------------------------- RimWellIASettings::RimWellIASettings() { - CAF_PDM_InitObject( "Integrity Analysis Model Settings", ":/WellIntAnalysis.png", "", "" ); + CAF_PDM_InitObject( "Integrity Analysis Model Settings", ":/WellIntAnalysis.png" ); setName( "Model" ); @@ -75,9 +75,9 @@ RimWellIASettings::RimWellIASettings() CAF_PDM_InitField( &m_bufferXY, "BufferXY", 5.0, "Model Size (XY)" ); - CAF_PDM_InitFieldNoDefault( &m_parameters, "ModelingParameters", "Modeling Parameters", ":/Bullet.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_parameters, "ModelingParameters", "Modeling Parameters", ":/Bullet.png" ); - CAF_PDM_InitFieldNoDefault( &m_csvParameters, "TimeStepParameters", "Time Step Parameters", ":/Bullet.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_csvParameters, "TimeStepParameters", "Time Step Parameters", ":/Bullet.png" ); CAF_PDM_InitFieldNoDefault( &m_nameProxy, "NameProxy", "Name Proxy" ); m_nameProxy.registerGetMethod( this, &RimWellIASettings::fullName ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp index 1548253415..1006a5b33d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp @@ -38,7 +38,7 @@ CAF_PDM_SOURCE_INIT( RimWellIASettingsCollection, "RimWellIASettingsCollection" //-------------------------------------------------------------------------------------------------- RimWellIASettingsCollection::RimWellIASettingsCollection() { - CAF_PDM_InitObject( "Integrity Analysis Models", ":/WellIntAnalysis.png", "", "" ); + CAF_PDM_InitObject( "Integrity Analysis Models", ":/WellIntAnalysis.png" ); CAF_PDM_InitFieldNoDefault( &m_wellIASettings, "WellIASettings", "Settings" ); m_wellIASettings.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp index e31b36280d..58630e65db 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp @@ -32,7 +32,7 @@ CAF_PDM_SOURCE_INIT( RimWellPathAttributeCollection, "WellPathAttributes" ); //-------------------------------------------------------------------------------------------------- RimWellPathAttributeCollection::RimWellPathAttributeCollection() { - CAF_PDM_InitObject( "Casing Design", ":/CasingDesign16x16", "", "" ); + CAF_PDM_InitObject( "Casing Design", ":/CasingDesign16x16" ); CAF_PDM_InitFieldNoDefault( &m_attributes, "Attributes", "Casing Design Attributes" ); m_attributes.uiCapability()->setUiEditorTypeName( caf::PdmUiTableViewEditor::uiEditorTypeName() ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp index 0c563fffa0..bf268cab09 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp @@ -104,10 +104,7 @@ RimWellPathCollection::RimWellPathCollection() CAF_PDM_InitField( &wellPathVisibility, "GlobalWellPathVisibility", WellVisibilityEnum( ALL_ON ), - "Global Well Path Visibility", - "", - "", - "" ); + "Global Well Path Visibility" ); CAF_PDM_InitField( &wellPathRadiusScaleFactor, "WellPathRadiusScale", 0.1, "Well Path Radius Scale" ); CAF_PDM_InitField( &wellPathCrossSectionVertexCount, "WellPathVertexCount", 12, "Well Path Vertex Count" ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp index 7a4471d9e2..b52498c1fc 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp @@ -68,10 +68,7 @@ RimWellPathGeometryDef::RimWellPathGeometryDef() "ReferencePosUtmXyd", "ReferencePoint", cvf::Vec3d( 0, 0, 0 ), - "UTM Reference Point", - "", - "", - "" ); + "UTM Reference Point" ); CAF_PDM_InitScriptableField( &m_airGap, "AirGap", 0.0, "Air Gap" ); m_airGap.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); @@ -89,26 +86,14 @@ RimWellPathGeometryDef::RimWellPathGeometryDef() CAF_PDM_InitField( &m_useTopLevelWellReferencePoint, "UseTopLevelWellReferencePoint", false, - "Use Top Level Well Reference Point", - "", - "", - "" ); + "Use Top Level Well Reference Point" ); CAF_PDM_InitScriptableField( &m_useAutoGeneratedTargetAtSeaLevel, "UseAutoGeneratedTargetAtSeaLevel", true, - "Generate Target at Sea Level", - "", - "", - "" ); - - CAF_PDM_InitScriptableField( &m_linkReferencePointUpdates, - "LinkReferencePointUpdates", - false, - "Link Reference Point", - "", - "", - "" ); + "Generate Target at Sea Level" ); + + CAF_PDM_InitScriptableField( &m_linkReferencePointUpdates, "LinkReferencePointUpdates", false, "Link Reference Point" ); CAF_PDM_InitScriptableFieldNoDefault( &m_autoTargetAtSeaLevel, "AutoGeneratedTarget", "Auto Generated Target" ); m_autoTargetAtSeaLevel = new RimWellPathTarget; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp index a0eb9a2088..6a54d448b3 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp @@ -37,7 +37,7 @@ CAF_PDM_SOURCE_INIT( RimWellPathGroup, "WellPathGroup" ); //-------------------------------------------------------------------------------------------------- RimWellPathGroup::RimWellPathGroup() { - CAF_PDM_InitObject( "Well Path Group", ":/WellPathGroup.svg", "", "" ); + CAF_PDM_InitObject( "Well Path Group", ":/WellPathGroup.svg" ); CAF_PDM_InitFieldNoDefault( &m_childWellPaths, "ChildWellPaths", "Child Well Paths" ); CAF_PDM_InitFieldNoDefault( &m_groupName, "GroupName", "Group Name" ); diff --git a/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp b/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp index 8698d7389c..7f70d847e1 100644 --- a/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp +++ b/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp @@ -27,7 +27,7 @@ CAF_PDM_SOURCE_INIT( cafTreeNode, "cafTreeNode" ); //-------------------------------------------------------------------------------------------------- cafTreeNode::cafTreeNode() { - CAF_PDM_InitObject( "WellPath", ":/Folder.svg", "", "" ); + CAF_PDM_InitObject( "WellPath", ":/Folder.svg" ); CAF_PDM_InitFieldNoDefault( &m_childNodes, "ChildNodes", "ChildNodes" ); } @@ -104,7 +104,7 @@ CAF_PDM_SOURCE_INIT( cafNamedTreeNode, "cafNamedTreeNode" ); cafNamedTreeNode::cafNamedTreeNode() : m_showCheckedBox( false ) { - CAF_PDM_InitObject( "Node", ":/Folder.svg", "", "" ); + CAF_PDM_InitObject( "Node", ":/Folder.svg" ); CAF_PDM_InitField( &m_name, "Name", QString(), "Name" ); m_name.uiCapability()->setUiHidden( true ); @@ -190,7 +190,7 @@ CAF_PDM_SOURCE_INIT( cafObjectReferenceTreeNode, "cafObjectReferenceTreeNode" ); //-------------------------------------------------------------------------------------------------- cafObjectReferenceTreeNode::cafObjectReferenceTreeNode() { - CAF_PDM_InitObject( "cafObjectReferenceTreeNode", ":/Folder.svg", "", "" ); + CAF_PDM_InitObject( "cafObjectReferenceTreeNode", ":/Folder.svg" ); CAF_PDM_InitFieldNoDefault( &m_referencedObject, "ReferencedObject", "Referenced Object" ); From 67993d56e37d44c1c438df7a3b57b75b0f03c40a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 5 Jan 2022 12:30:59 +0100 Subject: [PATCH 065/406] #8409 NNC : Make sure user defined legend ranges work --- .../RivElementVectorResultPartMgr.cpp | 11 ++++++----- .../ProjectDataModel/RimElementVectorResult.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp index 9238f42511..b06dd55172 100644 --- a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp @@ -96,13 +96,14 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode double characteristicCellSize = eclipseCase->characteristicCellSize(); float arrowConstantScaling = 10.0 * result->sizeScale() * characteristicCellSize; - double min, max; - result->mappingRange( min, max ); - double maxAbsResult = 1.0; - if ( min != cvf::UNDEFINED_DOUBLE && max != cvf::UNDEFINED_DOUBLE ) { - maxAbsResult = std::max( cvf::Math::abs( max ), cvf::Math::abs( min ) ); + double min, max; + result->mappingRange( min, max ); + if ( min != cvf::UNDEFINED_DOUBLE && max != cvf::UNDEFINED_DOUBLE ) + { + maxAbsResult = std::max( cvf::Math::abs( max ), cvf::Math::abs( min ) ); + } } float arrowScaling = arrowConstantScaling / maxAbsResult; diff --git a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp index fc20efb45d..e604373966 100644 --- a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp @@ -332,10 +332,12 @@ void RimElementVectorResult::mappingRange( double& min, double& max ) const { resultsData->minMaxCellScalarValues( resVarAddr, localMin, localMax ); } - else if ( m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP ) + else if ( m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP || + m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::USER_DEFINED ) { resultsData->minMaxCellScalarValues( resVarAddr, currentTimeStep, localMin, localMax ); } + if ( vectorView() == RimElementVectorResult::VectorView::CELL_CENTER_TOTAL ) { aggregatedVectorMax += unitVectors.at( dir ) * localMax; @@ -397,7 +399,8 @@ void RimElementVectorResult::mappingRange( double& min, double& max ) const } } else if ( m_legendConfig->rangeMode() == - RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP ) + RimRegularLegendConfig::RangeModeType::AUTOMATIC_CURRENT_TIMESTEP || + m_legendConfig->rangeMode() == RimRegularLegendConfig::RangeModeType::USER_DEFINED ) { const std::vector* nncResultVals = nncData->dynamicConnectionScalarResult( combinedAddresses[flIdx], @@ -441,9 +444,8 @@ void RimElementVectorResult::updateLegendRangesTextAndVisibility( RiuViewer* nat double minResultValue; double maxResultValue; mappingRange( minResultValue, maxResultValue ); - m_legendConfig->setAutomaticRanges( minResultValue, maxResultValue, minResultValue, maxResultValue ); - m_legendConfig->setMappingMode( RimRegularLegendConfig::MappingType::LINEAR_CONTINUOUS ); + m_legendConfig->setAutomaticRanges( minResultValue, maxResultValue, minResultValue, maxResultValue ); double posClosestToZero = HUGE_VAL; double negClosestToZero = -HUGE_VAL; From 3d5c3134b2047bc9008a4cb4134c65362f95ced9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 5 Jan 2022 12:43:27 +0100 Subject: [PATCH 066/406] #8409 Flow Vector Result : Rename to Vector Result --- ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp | 2 +- ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index 7adbdb7467..a063259df4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -148,7 +148,7 @@ RimEclipseView::RimEclipseView() m_cellEdgeResult = new RimCellEdgeColors(); m_cellEdgeResult.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_elementVectorResult, "ElementVectorResult", "Element Vector Result", ":/CellResult.png" ); + CAF_PDM_InitFieldNoDefault( &m_elementVectorResult, "ElementVectorResult", "Vector Result", ":/CellResult.png" ); m_elementVectorResult = new RimElementVectorResult; m_elementVectorResult.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp index e604373966..9d30124f44 100644 --- a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp @@ -439,7 +439,7 @@ void RimElementVectorResult::updateLegendRangesTextAndVisibility( RiuViewer* nat resultNames << QString( "Water" ); } - m_legendConfig->setTitle( QString( "Element Vector Result: \n" ) + resultNames.join( ", " ) ); + m_legendConfig->setTitle( QString( "Vector Result: \n" ) + resultNames.join( ", " ) ); double minResultValue; double maxResultValue; From 1e17da2926c7a06e661bb91f3651c836280c3347 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 6 Jan 2022 08:55:55 +0100 Subject: [PATCH 067/406] Janitor : Add SOIL SGAS SWAT to RiaResultNames wip --- .../Application/RiaResultNames.cpp | 24 ++++++++++ .../Application/RiaResultNames.h | 4 ++ .../RivTernaryTextureCoordsCreator.cpp | 12 ++--- .../ProjectDataModel/RimEclipseCase.cpp | 2 +- .../ProjectDataModel/RimEclipseCellColors.cpp | 2 +- .../RimEclipseContourMapProjection.cpp | 14 +++--- .../ProjectDataModel/RimEclipseResultCase.cpp | 2 +- .../RimEclipseResultDefinition.cpp | 12 ++--- .../RimEclipseStatisticsCase.cpp | 6 ++- .../RimTernaryLegendConfig.cpp | 6 +-- .../WellLog/RimWellLogRftCurve.cpp | 6 +-- .../RigCaseCellResultsData.cpp | 44 +++++++++++-------- .../RigFlowDiagSolverInterface.cpp | 6 +-- ...TofAccumulatedPhaseFractionsCalculator.cpp | 6 +-- .../RigTofWellDistributionCalculator.cpp | 6 +-- .../RiuRelativePermeabilityPlotPanel.cpp | 15 ++++--- .../RiuRelativePermeabilityPlotUpdater.cpp | 8 ++-- .../UserInterface/RiuResultTextBuilder.cpp | 24 +++++----- 18 files changed, 120 insertions(+), 79 deletions(-) diff --git a/ApplicationLibCode/Application/RiaResultNames.cpp b/ApplicationLibCode/Application/RiaResultNames.cpp index 0d44f2c3ed..a1e8dbbe51 100644 --- a/ApplicationLibCode/Application/RiaResultNames.cpp +++ b/ApplicationLibCode/Application/RiaResultNames.cpp @@ -350,6 +350,30 @@ QString RiaResultNames::indexKResultName() return "INDEX_K"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaResultNames::soil() +{ + return "SOIL"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaResultNames::sgas() +{ + return "SGAS"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaResultNames::swat() +{ + return "SWAT"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaResultNames.h b/ApplicationLibCode/Application/RiaResultNames.h index f0b32033df..3b61434fa7 100644 --- a/ApplicationLibCode/Application/RiaResultNames.h +++ b/ApplicationLibCode/Application/RiaResultNames.h @@ -69,6 +69,10 @@ QString indexIResultName(); QString indexJResultName(); QString indexKResultName(); +QString soil(); +QString sgas(); +QString swat(); + // Well path derived results QString wbsAzimuthResult(); QString wbsInclinationResult(); diff --git a/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp b/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp index 5341294bfa..76038fbd4f 100644 --- a/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp +++ b/ApplicationLibCode/ModelVisualization/RivTernaryTextureCoordsCreator.cpp @@ -62,19 +62,19 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator( const RimEclipse gridIndex, porosityModel, resTimeStepIdx, - RigEclipseResultAddress( "SOIL" ) ); + RigEclipseResultAddress( RiaResultNames::soil() ) ); cvf::ref sgas = RigResultAccessorFactory::createFromResultAddress( eclipseCase, gridIndex, porosityModel, resTimeStepIdx, - RigEclipseResultAddress( "SGAS" ) ); + RigEclipseResultAddress( RiaResultNames::sgas() ) ); cvf::ref swat = RigResultAccessorFactory::createFromResultAddress( eclipseCase, gridIndex, porosityModel, resTimeStepIdx, - RigEclipseResultAddress( "SWAT" ) ); + RigEclipseResultAddress( RiaResultNames::swat() ) ); m_resultAccessor = new RigTernaryResultAccessor(); m_resultAccessor->setTernaryResultAccessors( soil.p(), sgas.p(), swat.p() ); @@ -111,19 +111,19 @@ RivTernaryTextureCoordsCreator::RivTernaryTextureCoordsCreator( const RimEclipse gridIndex, porosityModel, resTimeStepIdx, - RigEclipseResultAddress( "SOIL" ) ); + RigEclipseResultAddress( RiaResultNames::soil() ) ); cvf::ref sgas = RigResultAccessorFactory::createFromResultAddress( eclipseCase, gridIndex, porosityModel, resTimeStepIdx, - RigEclipseResultAddress( "SGAS" ) ); + RigEclipseResultAddress( RiaResultNames::sgas() ) ); cvf::ref swat = RigResultAccessorFactory::createFromResultAddress( eclipseCase, gridIndex, porosityModel, resTimeStepIdx, - RigEclipseResultAddress( "SWAT" ) ); + RigEclipseResultAddress( RiaResultNames::swat() ) ); m_resultAccessor = new RigTernaryResultAccessor(); m_resultAccessor->setTernaryResultAccessors( soil.p(), sgas.p(), swat.p() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index b0b183b088..404923d36e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -298,7 +298,7 @@ RimEclipseView* RimEclipseCase::createAndAddReservoirView() auto prefs = RiaPreferences::current(); if ( prefs->loadAndShowSoil ) { - rimEclipseView->cellResult()->setResultVariable( "SOIL" ); + rimEclipseView->cellResult()->setResultVariable( RiaResultNames::soil() ); } rimEclipseView->faultCollection()->showFaultCollection = prefs->enableFaultsByDefault(); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp index ab85e59058..b57b37133a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -188,7 +188,7 @@ RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const QStri { colorRangeType = RimRegularLegendConfig::ColorRangesType::CATEGORY; } - else if ( resultName == "SWAT" ) + else if ( resultName == RiaResultNames::swat() ) { colorRangeType = RimRegularLegendConfig::ColorRangesType::OPPOSITE_NORMAL; } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp index 1e8be93ede..f48635eec8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.cpp @@ -210,12 +210,12 @@ std::vector RimEclipseContourMapProjection::generateResults( int timeSte if ( m_resultAggregation == RESULTS_OIL_COLUMN || m_resultAggregation == RESULTS_HC_COLUMN ) { gridCellResult->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SOIL" ) ); + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ); } if ( m_resultAggregation == RESULTS_GAS_COLUMN || m_resultAggregation == RESULTS_HC_COLUMN ) { gridCellResult->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ) ); + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); } gridResultValues = calculateColumnResult( m_resultAggregation() ); } @@ -304,7 +304,8 @@ std::vector RimEclipseContourMapProjection::calculateColumnResult( Resul if ( resultAggregation == RESULTS_OIL_COLUMN || resultAggregation == RESULTS_HC_COLUMN ) { const std::vector& soilResults = - resultData->cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SOIL" ), + resultData->cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, + RiaResultNames::soil() ), timeStep ); for ( size_t cellResultIdx = 0; cellResultIdx < resultValues.size(); ++cellResultIdx ) { @@ -314,12 +315,13 @@ std::vector RimEclipseContourMapProjection::calculateColumnResult( Resul if ( resultAggregation == RESULTS_GAS_COLUMN || resultAggregation == RESULTS_HC_COLUMN ) { - bool hasGasResult = - resultData->hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ) ); + bool hasGasResult = resultData->hasResultEntry( + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); if ( hasGasResult ) { const std::vector& sgasResults = - resultData->cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ), + resultData->cellScalarResults( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, + RiaResultNames::sgas() ), timeStep ); for ( size_t cellResultIdx = 0; cellResultIdx < resultValues.size(); ++cellResultIdx ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp index 5e9c980bb6..c17eeb53bc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -342,7 +342,7 @@ void RimEclipseResultCase::loadAndUpdateSourSimData() if ( eclipseView->cellResult()->resultType() == RiaDefines::ResultCatType::SOURSIMRL ) { eclipseView->cellResult()->setResultType( RiaDefines::ResultCatType::DYNAMIC_NATIVE ); - eclipseView->cellResult()->setResultVariable( "SOIL" ); + eclipseView->cellResult()->setResultVariable( RiaResultNames::soil() ); eclipseView->loadDataAndUpdate(); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 58327de64f..9bca264a1f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -1817,11 +1817,11 @@ QList if ( ternaryEnabled ) { bool hasAtLeastOneTernaryComponent = false; - if ( cellCenterResultNames.contains( "SOIL" ) ) + if ( cellCenterResultNames.contains( RiaResultNames::soil() ) ) hasAtLeastOneTernaryComponent = true; - else if ( cellCenterResultNames.contains( "SGAS" ) ) + else if ( cellCenterResultNames.contains( RiaResultNames::sgas() ) ) hasAtLeastOneTernaryComponent = true; - else if ( cellCenterResultNames.contains( "SWAT" ) ) + else if ( cellCenterResultNames.contains( RiaResultNames::swat() ) ) hasAtLeastOneTernaryComponent = true; if ( resultCatType == RiaDefines::ResultCatType::DYNAMIC_NATIVE && hasAtLeastOneTernaryComponent ) @@ -2208,7 +2208,7 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen { RigCaseCellResultsData* gridCellResults = this->currentGridCellResults(); { - RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SOIL" ); + RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ); if ( gridCellResults->ensureKnownResultLoaded( resAddr ) ) { @@ -2229,7 +2229,7 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen } { - RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ); + RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ); if ( gridCellResults->ensureKnownResultLoaded( resAddr ) ) { @@ -2250,7 +2250,7 @@ void RimEclipseResultDefinition::updateRangesForExplicitLegends( RimRegularLegen } { - RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SWAT" ); + RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() ); if ( gridCellResults->ensureKnownResultLoaded( resAddr ) ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index 500726ad46..56e9bd8a3c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -821,7 +821,8 @@ void RimEclipseStatisticsCase::populateResultSelection() { QStringList varList = caseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL ) ->resultNames( RiaDefines::ResultCatType::DYNAMIC_NATIVE ); - if ( varList.contains( "SOIL" ) ) m_selectedDynamicProperties.v().push_back( "SOIL" ); + if ( varList.contains( RiaResultNames::soil() ) ) + m_selectedDynamicProperties.v().push_back( RiaResultNames::soil() ); if ( varList.contains( "PRESSURE" ) ) m_selectedDynamicProperties.v().push_back( "PRESSURE" ); } @@ -837,7 +838,8 @@ void RimEclipseStatisticsCase::populateResultSelection() { QStringList varList = caseData->results( RiaDefines::PorosityModelType::FRACTURE_MODEL ) ->resultNames( RiaDefines::ResultCatType::DYNAMIC_NATIVE ); - if ( varList.contains( "SOIL" ) ) m_selectedFractureDynamicProperties.v().push_back( "SOIL" ); + if ( varList.contains( RiaResultNames::soil() ) ) + m_selectedFractureDynamicProperties.v().push_back( RiaResultNames::soil() ); if ( varList.contains( "PRESSURE" ) ) m_selectedFractureDynamicProperties.v().push_back( "PRESSURE" ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp index feffca27e4..7411242a82 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -301,19 +301,19 @@ void RimTernaryLegendConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiO { caf::PdmUiOrdering* ternaryGroupContainer = uiOrdering.addNewGroup( "Ternary " ); { - caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup( "SGAS" ); + caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup( RiaResultNames::sgas() ); ternaryGroup->add( &userDefinedMinValueSgas ); ternaryGroup->add( &userDefinedMaxValueSgas ); } { - caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup( "SWAT" ); + caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup( RiaResultNames::swat() ); ternaryGroup->add( &userDefinedMinValueSwat ); ternaryGroup->add( &userDefinedMaxValueSwat ); } { - caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup( "SOIL" ); + caf::PdmUiOrdering* ternaryGroup = ternaryGroupContainer->addNewGroup( RiaResultNames::soil() ); ternaryGroup->add( &userDefinedMinValueSoil ); ternaryGroup->add( &userDefinedMaxValueSoil ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index fbd41effc9..a06e53a450 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -71,9 +71,9 @@ void caf::AppEnum::setUp() addItem( RifEclipseRftAddress::NONE, "NONE", "None" ); addItem( RifEclipseRftAddress::TVD, "DEPTH", "Depth" ); addItem( RifEclipseRftAddress::PRESSURE, "PRESSURE", "Pressure" ); - addItem( RifEclipseRftAddress::SWAT, "SWAT", "Water Saturation" ); - addItem( RifEclipseRftAddress::SOIL, "SOIL", "Oil Saturation" ); - addItem( RifEclipseRftAddress::SGAS, "SGAS", "Gas Saturation" ); + addItem( RifEclipseRftAddress::SWAT, RiaResultNames::swat(), "Water Saturation" ); + addItem( RifEclipseRftAddress::SOIL, RiaResultNames::soil(), "Oil Saturation" ); + addItem( RifEclipseRftAddress::SGAS, RiaResultNames::sgas(), "Gas Saturation" ); addItem( RifEclipseRftAddress::WRAT, "WRAT", "Water Flow" ); addItem( RifEclipseRftAddress::ORAT, "ORAT", "Oil Flow" ); addItem( RifEclipseRftAddress::GRAT, "GRAT", "Gas flow" ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 1ebb3053c4..b83cf0fba2 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -914,14 +914,16 @@ void RigCaseCellResultsData::createPlaceholderResultEntries() { // SOIL { - if ( !hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SOIL" ) ) ) + if ( !hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ) ) { - if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SWAT" ) ) || - hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ) ) ) + if ( hasResultEntry( + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() ) ) || + hasResultEntry( + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ) ) { size_t soilIndex = findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SOIL" ), + RiaResultNames::soil() ), false ); this->setMustBeCalculated( soilIndex ); } @@ -931,7 +933,7 @@ void RigCaseCellResultsData::createPlaceholderResultEntries() // Oil Volume if ( RiaApplication::enableDevelopmentFeatures() ) { - if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SOIL" ) ) ) + if ( hasResultEntry( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ) ) { findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riOilVolumeResultName() ), @@ -1348,14 +1350,16 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResult( const RigEclipseResu return scalarResultIndex; } - if ( resultName == "SOIL" ) + if ( resultName == RiaResultNames::soil() ) { if ( this->mustBeCalculated( scalarResultIndex ) ) { // Trigger loading of SWAT, SGAS to establish time step count if no data has been loaded from file at // this point - findOrLoadKnownScalarResult( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SWAT" ) ); - findOrLoadKnownScalarResult( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ) ); + findOrLoadKnownScalarResult( + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() ) ); + findOrLoadKnownScalarResult( + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); m_cellScalarResults[scalarResultIndex].resize( this->maxTimeStepCount() ); for ( size_t timeStepIdx = 0; timeStepIdx < this->maxTimeStepCount(); timeStepIdx++ ) @@ -1548,7 +1552,7 @@ size_t RigCaseCellResultsData::findOrLoadKnownScalarResultForTimeStep( const Rig QString resultName = resVarAddr.resultName(); // Special handling for SOIL - if ( type == RiaDefines::ResultCatType::DYNAMIC_NATIVE && resultName.toUpper() == "SOIL" ) + if ( type == RiaDefines::ResultCatType::DYNAMIC_NATIVE && resultName.toUpper() == RiaResultNames::soil() ) { size_t soilScalarResultIndex = this->findScalarResultIndexFromAddress( resVarAddr ); @@ -1648,15 +1652,17 @@ void RigCaseCellResultsData::computeSOILForTimeStep( size_t timeStepIndex ) // Compute SGAS based on SWAT if the simulation contains no oil testAndComputeSgasForTimeStep( timeStepIndex ); - RigEclipseResultAddress SWATAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SWAT" ); - RigEclipseResultAddress SGASAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ); + RigEclipseResultAddress SWATAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() ); + RigEclipseResultAddress SGASAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ); RigEclipseResultAddress SSOLAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SSOL" ); size_t scalarIndexSWAT = - findOrLoadKnownScalarResultForTimeStep( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SWAT" ), + findOrLoadKnownScalarResultForTimeStep( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, + RiaResultNames::swat() ), timeStepIndex ); size_t scalarIndexSGAS = - findOrLoadKnownScalarResultForTimeStep( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ), + findOrLoadKnownScalarResultForTimeStep( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, + RiaResultNames::sgas() ), timeStepIndex ); size_t scalarIndexSSOL = findOrLoadKnownScalarResultForTimeStep( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SSOL" ), @@ -1694,7 +1700,7 @@ void RigCaseCellResultsData::computeSOILForTimeStep( size_t timeStepIndex ) } // Make sure memory is allocated for the new SOIL results - RigEclipseResultAddress SOILAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SOIL" ); + RigEclipseResultAddress SOILAddr( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ); size_t soilResultScalarIndex = this->findScalarResultIndexFromAddress( SOILAddr ); m_cellScalarResults[soilResultScalarIndex].resize( soilTimeStepCount ); @@ -1768,7 +1774,8 @@ void RigCaseCellResultsData::computeSOILForTimeStep( size_t timeStepIndex ) void RigCaseCellResultsData::testAndComputeSgasForTimeStep( size_t timeStepIndex ) { size_t scalarIndexSWAT = - findOrLoadKnownScalarResultForTimeStep( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SWAT" ), + findOrLoadKnownScalarResultForTimeStep( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, + RiaResultNames::swat() ), timeStepIndex ); if ( scalarIndexSWAT == cvf::UNDEFINED_SIZE_T ) { @@ -1784,7 +1791,8 @@ void RigCaseCellResultsData::testAndComputeSgasForTimeStep( size_t timeStepIndex // Simulation type is gas and water. No SGAS is present, compute SGAS based on SWAT size_t scalarIndexSGAS = - this->findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ), + this->findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, + RiaResultNames::sgas() ), false ); if ( m_cellScalarResults[scalarIndexSGAS].size() > timeStepIndex ) { @@ -2930,8 +2938,8 @@ void RigCaseCellResultsData::computeOilVolumes() false ); const std::vector& cellVolumeResults = m_cellScalarResults[cellVolIdx][0]; - size_t soilIdx = - this->findOrLoadKnownScalarResult( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SOIL" ) ); + size_t soilIdx = this->findOrLoadKnownScalarResult( + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ); size_t oilVolIdx = this->findOrCreateScalarResultIndex( RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::riOilVolumeResultName() ), diff --git a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp index e3ebbb1781..685f689128 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp @@ -563,19 +563,19 @@ void RigFlowDiagSolverInterface::assignPhaseCorrecedPORV( RigFlowDiagResultAddre case RigFlowDiagResultAddress::PHASE_OIL: phaseSaturation = eclipseCaseData->resultValues( RiaDefines::PorosityModelType::MATRIX_MODEL, RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SOIL", + RiaResultNames::soil(), timeStepIdx ); break; case RigFlowDiagResultAddress::PHASE_GAS: phaseSaturation = eclipseCaseData->resultValues( RiaDefines::PorosityModelType::MATRIX_MODEL, RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SGAS", + RiaResultNames::sgas(), timeStepIdx ); break; case RigFlowDiagResultAddress::PHASE_WAT: phaseSaturation = eclipseCaseData->resultValues( RiaDefines::PorosityModelType::MATRIX_MODEL, RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SWAT", + RiaResultNames::swat(), timeStepIdx ); break; default: diff --git a/ApplicationLibCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.cpp index 4dc72c37b8..08c7e8c742 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigTofAccumulatedPhaseFractionsCalculator.cpp @@ -46,15 +46,15 @@ RigTofAccumulatedPhaseFractionsCalculator::RigTofAccumulatedPhaseFractionsCalcul const std::vector* swatResults = eclipseCaseData->resultValues( RiaDefines::PorosityModelType::MATRIX_MODEL, RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SWAT", + RiaResultNames::swat(), timestep ); const std::vector* soilResults = eclipseCaseData->resultValues( RiaDefines::PorosityModelType::MATRIX_MODEL, RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SOIL", + RiaResultNames::soil(), timestep ); const std::vector* sgasResults = eclipseCaseData->resultValues( RiaDefines::PorosityModelType::MATRIX_MODEL, RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SGAS", + RiaResultNames::sgas(), timestep ); const std::vector* porvResults = eclipseCaseData->resultValues( RiaDefines::PorosityModelType::MATRIX_MODEL, RiaDefines::ResultCatType::STATIC_NATIVE, diff --git a/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp index 7e409efa87..664d6e7e24 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigTofWellDistributionCalculator.cpp @@ -71,11 +71,11 @@ RigTofWellDistributionCalculator::RigTofWellDistributionCalculator( RimEclipseRe QString phaseResultName; if ( phase == RiaDefines::PhaseType::WATER_PHASE ) - phaseResultName = "SWAT"; + phaseResultName = RiaResultNames::swat(); else if ( phase == RiaDefines::PhaseType::OIL_PHASE ) - phaseResultName = "SOIL"; + phaseResultName = RiaResultNames::soil(); else if ( phase == RiaDefines::PhaseType::GAS_PHASE ) - phaseResultName = "SGAS"; + phaseResultName = RiaResultNames::sgas(); const std::vector* phaseResults = eclipseCaseData->resultValues( RiaDefines::PorosityModelType::MATRIX_MODEL, RiaDefines::ResultCatType::DYNAMIC_NATIVE, phaseResultName, diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index b2bb8e8db4..b818e239f8 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -18,6 +18,12 @@ #include "RiuRelativePermeabilityPlotPanel.h" +#include "RiaCurveDataTools.h" +#include "RiaEclipseUnitTools.h" +#include "RiaResultNames.h" + +#include "RigFlowDiagSolverInterface.h" + #include "RiuDockedQwtPlot.h" #include "RiuGuiTheme.h" #include "RiuQwtPlotCurve.h" @@ -25,11 +31,6 @@ #include "RiuRelativePermeabilityPlotUpdater.h" #include "RiuTextDialog.h" -#include "RiaCurveDataTools.h" -#include "RiaEclipseUnitTools.h" - -#include "RigFlowDiagSolverInterface.h" - #include "cvfAssert.h" #include "cvfTrace.h" @@ -466,11 +467,11 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS // Add vertical marker lines to indicate cell SWAT and/or SGAS saturations if ( swat != HUGE_VAL ) { - addVerticalSaturationMarkerLine( swat, "SWAT", waterColor, plot, myPlotMarkers ); + addVerticalSaturationMarkerLine( swat, RiaResultNames::swat(), waterColor, plot, myPlotMarkers ); } if ( sgas != HUGE_VAL ) { - addVerticalSaturationMarkerLine( sgas, "SGAS", gasColor, plot, myPlotMarkers ); + addVerticalSaturationMarkerLine( sgas, RiaResultNames::sgas(), gasColor, plot, myPlotMarkers ); } if ( logScaleLeftAxis ) diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp index a6d62a6b6a..a5c40a3b2b 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotUpdater.cpp @@ -172,9 +172,9 @@ bool RiuRelativePermeabilityPlotUpdater::queryDataAndUpdatePlot( const RimEclips RigCaseCellResultsData* cellResultsData = eclipseCaseData->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); cellResultsData->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SWAT" ) ); + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() ) ); cellResultsData->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ) ); + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); cellResultsData->ensureKnownResultLoaded( RigEclipseResultAddress( RiaDefines::ResultCatType::STATIC_NATIVE, "SATNUM" ) ); @@ -185,14 +185,14 @@ bool RiuRelativePermeabilityPlotUpdater::queryDataAndUpdatePlot( const RimEclips RiaDefines::PorosityModelType::MATRIX_MODEL, timeStepIndex, RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SWAT" ) ); + RiaResultNames::swat() ) ); cvf::ref sgasAccessor = RigResultAccessorFactory::createFromResultAddress( eclipseCaseData, gridIndex, RiaDefines::PorosityModelType::MATRIX_MODEL, timeStepIndex, RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SGAS" ) ); + RiaResultNames::sgas() ) ); cvf::ref satnumAccessor = RigResultAccessorFactory::createFromResultAddress( eclipseCaseData, gridIndex, diff --git a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp index 22ba2aea6c..6754da2b70 100644 --- a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp @@ -544,11 +544,11 @@ void RiuResultTextBuilder::appendTextFromResultColors( RigEclipseCaseData* if ( gridCellResults ) { gridCellResults->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SOIL" ) ); + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ); gridCellResults->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ) ); + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); gridCellResults->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SWAT" ) ); + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() ) ); cvf::ref dataAccessObjectX = RigResultAccessorFactory::createFromResultAddress( eclipseCase, @@ -556,21 +556,21 @@ void RiuResultTextBuilder::appendTextFromResultColors( RigEclipseCaseData* porosityModel, timeStepIndex, RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SOIL" ) ); + RiaResultNames::soil() ) ); cvf::ref dataAccessObjectY = RigResultAccessorFactory::createFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SGAS" ) ); + RiaResultNames::sgas() ) ); cvf::ref dataAccessObjectZ = RigResultAccessorFactory::createFromResultAddress( eclipseCase, gridIndex, porosityModel, timeStepIndex, RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SWAT" ) ); + RiaResultNames::swat() ) ); double scalarValue = 0.0; @@ -900,11 +900,11 @@ QString RiuResultTextBuilder::cellResultText( RimEclipseResultDefinition* eclRes if ( gridCellResults ) { gridCellResults->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SOIL" ) ); + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::soil() ) ); gridCellResults->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SGAS" ) ); + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::sgas() ) ); gridCellResults->ensureKnownResultLoaded( - RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, "SWAT" ) ); + RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::swat() ) ); RiaDefines::PorosityModelType porosityModel = eclResDef->porosityModel(); @@ -914,21 +914,21 @@ QString RiuResultTextBuilder::cellResultText( RimEclipseResultDefinition* eclRes porosityModel, m_timeStepIndex, RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SOIL" ) ); + RiaResultNames::soil() ) ); cvf::ref dataAccessObjectY = RigResultAccessorFactory::createFromResultAddress( eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SGAS" ) ); + RiaResultNames::sgas() ) ); cvf::ref dataAccessObjectZ = RigResultAccessorFactory::createFromResultAddress( eclipseCaseData, m_gridIndex, porosityModel, m_timeStepIndex, RigEclipseResultAddress( RiaDefines::ResultCatType::DYNAMIC_NATIVE, - "SWAT" ) ); + RiaResultNames::swat() ) ); double scalarValue = 0.0; From 13425ce0e929bbe4c058ccbc1f4671fada114330 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 5 Jan 2022 13:29:56 +0100 Subject: [PATCH 068/406] #8410 Color Legend : Add option to center legend around zero --- .../RimRegularLegendConfig.cpp | 19 +++++++++++++++++++ .../ProjectDataModel/RimRegularLegendConfig.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp index ea1b4aa384..f2d5a44827 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp @@ -212,6 +212,8 @@ RimRegularLegendConfig::RimRegularLegendConfig() m_resetUserDefinedValuesButton.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_resetUserDefinedValuesButton.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); + CAF_PDM_InitField( &m_centerLegendAroundZero, "CenterLegendAroundZero", false, "Center Legend Around Zero" ); + updateFieldVisibility(); updateLegend(); } @@ -456,6 +458,13 @@ void RimRegularLegendConfig::updateLegend() negClosestToZero = m_globalAutoNegClosestToZero; } + if ( m_centerLegendAroundZero ) + { + auto maxValue = std::max( std::abs( adjustedMax ), std::abs( adjustedMin ) ); + adjustedMax = maxValue; + adjustedMin = -maxValue; + } + m_linDiscreteScalarMapper->setRange( adjustedMin, adjustedMax ); m_linSmoothScalarMapper->setRange( adjustedMin, adjustedMax ); @@ -613,6 +622,14 @@ void RimRegularLegendConfig::resetUserDefinedValues() m_resetUserDefinedValues = true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimRegularLegendConfig::setCenterLegendAroundZero( bool enable ) +{ + m_centerLegendAroundZero = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1226,6 +1243,8 @@ void RimRegularLegendConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiO mappingGr->add( &m_userDefinedMaxValue ); mappingGr->add( &m_userDefinedMinValue ); mappingGr->add( &m_categoryColorMode ); + mappingGr->add( &m_centerLegendAroundZero ); + uiOrdering.add( &m_resetUserDefinedValuesButton ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h index 99448d951c..e65f95cb18 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h @@ -127,6 +127,7 @@ class RimRegularLegendConfig : public RimLegendConfig MappingType mappingMode() { return m_mappingMode(); } void setTickNumberFormat( RiaNumberFormat::NumberFormatType numberFormat ); void resetUserDefinedValues(); + void setCenterLegendAroundZero( bool enable ); void disableAllTimeStepsRange( bool doDisable ); @@ -231,6 +232,7 @@ class RimRegularLegendConfig : public RimLegendConfig caf::PdmField> m_mappingMode; caf::PdmField> m_categoryColorMode; caf::PdmField m_resetUserDefinedValuesButton; + caf::PdmField m_centerLegendAroundZero; caf::PdmPtrField m_colorLegend; caf::PdmField m_selectColorLegendButton; From d578771a40e17bb5113187a753d188b7bfe5e7da Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 5 Jan 2022 13:31:58 +0100 Subject: [PATCH 069/406] #8411 Flow Cell Results : Set useful default legend --- ApplicationLibCode/Application/RiaResultNames.cpp | 11 +++++++++++ ApplicationLibCode/Application/RiaResultNames.h | 1 + .../ProjectDataModel/RimEclipseCellColors.cpp | 6 ++++++ 3 files changed, 18 insertions(+) diff --git a/ApplicationLibCode/Application/RiaResultNames.cpp b/ApplicationLibCode/Application/RiaResultNames.cpp index a1e8dbbe51..0e96b96946 100644 --- a/ApplicationLibCode/Application/RiaResultNames.cpp +++ b/ApplicationLibCode/Application/RiaResultNames.cpp @@ -84,6 +84,17 @@ bool RiaResultNames::isLogarithmicResult( const QString& resultName ) return false; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaResultNames::isFlowResultWithBothPosAndNegValues( const QString& resultName ) +{ + if ( resultName.startsWith( "FLR", Qt::CaseInsensitive ) ) return true; + if ( resultName.startsWith( "FLO", Qt::CaseInsensitive ) ) return true; + + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaResultNames.h b/ApplicationLibCode/Application/RiaResultNames.h index 3b61434fa7..1d0974375a 100644 --- a/ApplicationLibCode/Application/RiaResultNames.h +++ b/ApplicationLibCode/Application/RiaResultNames.h @@ -28,6 +28,7 @@ namespace RiaResultNames { bool isPerCellFaceResult( const QString& resultName ); bool isLogarithmicResult( const QString& resultName ); +bool isFlowResultWithBothPosAndNegValues( const QString& resultName ); QString undefinedResultName(); QString undefinedGridFaultName(); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp index b57b37133a..3219429b31 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -208,6 +208,12 @@ RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const QStri newLegend->resetUserDefinedValues(); } + if ( RiaResultNames::isFlowResultWithBothPosAndNegValues( resultName ) ) + { + colorRangeType = RimRegularLegendConfig::ColorRangesType::BLUE_WHITE_RED; + newLegend->setCenterLegendAroundZero( true ); + } + if ( colorRangeType != RimRegularLegendConfig::ColorRangesType::UNDEFINED ) { RimColorLegend* colorLegend = RimRegularLegendConfig::mapToColorLegend( colorRangeType ); From 0cb7a157c99ed4694dd57d4d53bf6c5f17661941 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 5 Jan 2022 15:27:26 +0100 Subject: [PATCH 070/406] #8409 NNC : Make sure NNC flow vector directions are stable --- .../RivElementVectorResultPartMgr.cpp | 41 ++++++++++++++++--- .../RivElementVectorResultPartMgr.h | 8 +++- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp index b06dd55172..976b34d312 100644 --- a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.cpp @@ -191,12 +191,21 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode getFaceCenterAndNormal( static_cast( gcIdx ), directions[dir], faceCenter, faceNormal ); faceNormal *= std::abs( resultValue ); + bool centerArrow = false; + if ( result->vectorSuraceCrossingLocation() == + RimElementVectorResult::VectorSurfaceCrossingLocation::VECTOR_CENTER && + result->vectorView() == RimElementVectorResult::VectorView::PER_FACE ) + { + centerArrow = true; + } + #pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_1 ) tensorVisualizations.push_back( ElementVectorResultVisualization( faceCenter, faceNormal, resultValue, - std::cbrt( cells[gcIdx].volume() / 3.0 ) ) ); + std::cbrt( cells[gcIdx].volume() / 3.0 ), + centerArrow ) ); } } } @@ -223,12 +232,20 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode } if ( aggregatedResult.length() >= result->threshold() ) { + bool centerArrow = false; + if ( result->vectorSuraceCrossingLocation() == + RimElementVectorResult::VectorSurfaceCrossingLocation::VECTOR_CENTER ) + { + centerArrow = true; + } + #pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_2 ) tensorVisualizations.push_back( ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( cells[gcIdx].center() ), aggregatedVector, aggregatedResult.length(), - std::cbrt( cells[gcIdx].volume() / 3.0 ) ) ); + std::cbrt( cells[gcIdx].volume() / 3.0 ), + centerArrow ) ); } } } @@ -280,12 +297,25 @@ void RivElementVectorResultPartMgr::appendDynamicGeometryPartsToModel( cvf::Mode if ( std::abs( resultValue ) >= result->threshold() ) { + bool centerArrow = false; + if ( result->vectorView() == RimElementVectorResult::VectorView::CELL_CENTER_TOTAL ) + { + centerArrow = true; + } + else if ( result->vectorView() == RimElementVectorResult::VectorView::PER_FACE ) + { + if ( result->vectorSuraceCrossingLocation() == + RimElementVectorResult::VectorSurfaceCrossingLocation::VECTOR_CENTER ) + centerArrow = true; + } + #pragma omp critical( critical_section_RivElementVectorResultPartMgr_add_nnc ) tensorVisualizations.push_back( ElementVectorResultVisualization( displayCordXf->transformToDisplayCoord( connCenter ), connNormal, resultValue, - std::cbrt( cells[conn.c1GlobIdx()].volume() / 3.0 ) ) ); + std::cbrt( cells[conn.c1GlobIdx()].volume() / 3.0 ), + centerArrow ) ); } } } @@ -430,8 +460,7 @@ std::array cvf::Vec3f headTop = evrViz.faceCenter + evrViz.faceNormal; cvf::Vec3f shaftStart = evrViz.faceCenter; - if ( result->vectorSuraceCrossingLocation() == RimElementVectorResult::VectorSurfaceCrossingLocation::VECTOR_CENTER && - result->vectorView() == RimElementVectorResult::VectorView::PER_FACE ) + if ( evrViz.centerArrow ) { headTop = evrViz.faceCenter + evrViz.faceNormal / 2.0; shaftStart = evrViz.faceCenter - evrViz.faceNormal / 2.0; @@ -439,7 +468,7 @@ std::array // Flip arrow for negative results and if the vector is not aggregated (in which case we do not have any negative // result) - if ( evrViz.result < 0 && result->vectorView() != RimElementVectorResult::VectorView::CELL_CENTER_TOTAL ) + if ( evrViz.result < 0 ) { std::swap( headTop, shaftStart ); } diff --git a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.h b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.h index 7739b10f9a..66a0b86f9f 100644 --- a/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.h +++ b/ApplicationLibCode/ModelVisualization/RivElementVectorResultPartMgr.h @@ -54,11 +54,16 @@ class RivElementVectorResultPartMgr : public cvf::Object private: struct ElementVectorResultVisualization { - ElementVectorResultVisualization( cvf::Vec3d faceCenter, cvf::Vec3d faceNormal, double result, double approximateCellLength ) + ElementVectorResultVisualization( cvf::Vec3d faceCenter, + cvf::Vec3d faceNormal, + double result, + double approximateCellLength, + bool centerArrow ) : faceCenter( faceCenter ) , faceNormal( faceNormal ) , result( result ) , approximateCellLength( approximateCellLength ) + , centerArrow( centerArrow ) { } @@ -66,6 +71,7 @@ class RivElementVectorResultPartMgr : public cvf::Object cvf::Vec3f faceNormal; double result; double approximateCellLength; + bool centerArrow; }; private: From dfd8b9986fc45eac96bed55d65d270f3dcdc6312 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 5 Jan 2022 21:44:56 +0100 Subject: [PATCH 071/406] Janitor: Make sure the default legend is configured for intersection results --- .../RivBoxIntersectionPartMgr.cpp | 1 - .../RimIntersectionCollection.cpp | 2 - .../RimIntersectionResultDefinition.cpp | 18 +++ .../RimIntersectionResultDefinition.h | 9 +- .../ProjectDataModel/RimEclipseCellColors.cpp | 45 +------ .../RimEclipseResultDefinition.cpp | 1 + .../RimRegularLegendConfig.cpp | 111 +++++++++++++++--- .../ProjectDataModel/RimRegularLegendConfig.h | 3 + .../UserInterface/RiuResultTextBuilder.cpp | 4 +- 9 files changed, 123 insertions(+), 71 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivBoxIntersectionPartMgr.cpp b/ApplicationLibCode/ModelVisualization/Intersections/RivBoxIntersectionPartMgr.cpp index 237ab76f87..42b00f7241 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivBoxIntersectionPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivBoxIntersectionPartMgr.cpp @@ -32,7 +32,6 @@ #include "RimGeoMechCase.h" #include "RimGeoMechCellColors.h" #include "RimGeoMechView.h" -#include "RimIntersectionResultDefinition.h" #include "RivBoxIntersectionSourceInfo.h" #include "RivExtrudedCurveIntersectionPartMgr.h" diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp index 7ec149ace0..c56728c5e7 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp @@ -29,8 +29,6 @@ #include "RimEclipseView.h" #include "RimExtrudedCurveIntersection.h" #include "RimGridView.h" -#include "RimIntersectionResultDefinition.h" -#include "RimIntersectionResultsDefinitionCollection.h" #include "RimSimWellInView.h" #include "Riu3DMainWindowTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp index c57b807dfd..f9c4716407 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp @@ -387,6 +387,24 @@ void RimIntersectionResultDefinition::update2dIntersectionViews() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIntersectionResultDefinition::setDefaultEclipseLegendConfig() +{ + bool useDiscreteLogLevels = false; + bool isCategoryResult = m_eclipseResultDefinition->hasCategoryResult(); + + auto eclResultDef = this->eclipseResultDefinition(); + eclResultDef->updateRangesForExplicitLegends( this->regularLegendConfig(), + this->ternaryLegendConfig(), + this->timeStep() ); + + m_legendConfig->setDefaultConfigForResultName( m_eclipseResultDefinition->resultVariable(), + useDiscreteLogLevels, + isCategoryResult ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.h index 706c3a9ce6..c23a3fdd5b 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.h @@ -59,18 +59,17 @@ class RimIntersectionResultDefinition : public caf::PdmObject bool isUsingOverrideViewer ); void update2dIntersectionViews(); + void setDefaultEclipseLegendConfig(); protected: caf::PdmFieldHandle* userDescriptionField() override; caf::PdmFieldHandle* objectToggleField() override; - 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; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; - void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + bool* useOptionsOnly ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void initAfterRead() override; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp index 3219429b31..5c8fd69434 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -181,49 +181,10 @@ RimRegularLegendConfig* RimEclipseCellColors::createLegendForResult( const QStri bool useDiscreteLogLevels, bool isCategoryResult ) { - bool useLog = RiaResultNames::isLogarithmicResult( resultName ); + auto* newLegend = new RimRegularLegendConfig; + newLegend->resultVariableName = resultName; - RimRegularLegendConfig::ColorRangesType colorRangeType = RimRegularLegendConfig::ColorRangesType::UNDEFINED; - if ( isCategoryResult ) - { - colorRangeType = RimRegularLegendConfig::ColorRangesType::CATEGORY; - } - else if ( resultName == RiaResultNames::swat() ) - { - colorRangeType = RimRegularLegendConfig::ColorRangesType::OPPOSITE_NORMAL; - } - - RimRegularLegendConfig* newLegend = new RimRegularLegendConfig; - newLegend->resultVariableName = resultName; - - if ( useLog ) - { - if ( useDiscreteLogLevels ) - newLegend->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_DISCRETE ); - else - newLegend->setMappingMode( RimRegularLegendConfig::MappingType::LOG10_CONTINUOUS ); - - newLegend->setTickNumberFormat( RiaNumberFormat::NumberFormatType::AUTO ); - newLegend->setRangeMode( RimLegendConfig::RangeModeType::USER_DEFINED ); - newLegend->resetUserDefinedValues(); - } - - if ( RiaResultNames::isFlowResultWithBothPosAndNegValues( resultName ) ) - { - colorRangeType = RimRegularLegendConfig::ColorRangesType::BLUE_WHITE_RED; - newLegend->setCenterLegendAroundZero( true ); - } - - if ( colorRangeType != RimRegularLegendConfig::ColorRangesType::UNDEFINED ) - { - RimColorLegend* colorLegend = RimRegularLegendConfig::mapToColorLegend( colorRangeType ); - if ( isCategoryResult ) - { - newLegend->setMappingMode( RimRegularLegendConfig::MappingType::CATEGORY_INTEGER ); - } - - newLegend->setColorLegend( colorLegend ); - } + newLegend->setDefaultConfigForResultName( resultName, useDiscreteLogLevels, isCategoryResult ); return newLegend; } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 9bca264a1f..7e60133811 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -478,6 +478,7 @@ void RimEclipseResultDefinition::updateAnyFieldHasChanged() this->firstAncestorOrThisOfType( intersectResDef ); if ( intersectResDef ) { + intersectResDef->setDefaultEclipseLegendConfig(); intersectResDef->updateConnectedEditors(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp index f2d5a44827..1e6ebf5531 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp @@ -404,25 +404,7 @@ void RimRegularLegendConfig::updateLegend() if ( m_resetUserDefinedValues && m_globalAutoMax != cvf::UNDEFINED_DOUBLE ) { - if ( m_mappingMode() == MappingType::LOG10_CONTINUOUS || m_mappingMode() == MappingType::LOG10_DISCRETE ) - { - double exponentMax = computeTenExponentCeil( m_globalAutoMax ); - double exponentMin = computeTenExponentFloor( m_globalAutoPosClosestToZero ); - - m_userDefinedMaxValue = pow( 10, exponentMax ); - m_userDefinedMinValue = pow( 10, exponentMin ); - - int numLevels = exponentMax - exponentMin; - if ( numLevels > 0 ) - { - m_numLevels = numLevels; - } - } - else if ( m_mappingMode() == MappingType::LINEAR_CONTINUOUS || m_mappingMode() == MappingType::LINEAR_DISCRETE ) - { - m_userDefinedMaxValue = m_globalAutoMax; - m_userDefinedMinValue = m_globalAutoMin; - } + updateTickCountAndUserDefinedRange(); m_resetUserDefinedValues = false; } @@ -881,6 +863,36 @@ void RimRegularLegendConfig::configureCategoryMapper() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimRegularLegendConfig::updateTickCountAndUserDefinedRange() +{ + if ( m_globalAutoMax != cvf::UNDEFINED_DOUBLE ) + { + if ( m_mappingMode() == MappingType::LOG10_CONTINUOUS || m_mappingMode() == MappingType::LOG10_DISCRETE ) + { + double exponentMax = computeTenExponentCeil( m_globalAutoMax ); + double exponentMin = computeTenExponentFloor( m_globalAutoPosClosestToZero ); + + m_userDefinedMaxValue = pow( 10, exponentMax ); + m_userDefinedMinValue = pow( 10, exponentMin ); + + int numLevels = exponentMax - exponentMin; + if ( numLevels > 0 ) + { + m_numLevels = numLevels; + } + } + else if ( m_mappingMode() == MappingType::LINEAR_CONTINUOUS || m_mappingMode() == MappingType::LINEAR_DISCRETE ) + { + m_userDefinedMaxValue = m_globalAutoMax; + m_userDefinedMinValue = m_globalAutoMin; + m_numLevels = 8; + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1206,6 +1218,67 @@ QString RimRegularLegendConfig::valueToText( double value ) const return RiaNumberFormat::valueToText( value, m_tickNumberFormat(), m_significantDigitsInData ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimRegularLegendConfig::setDefaultConfigForResultName( const QString& resultName, + bool useDiscreteLogLevels, + bool isCategoryResult ) +{ + bool useLog = RiaResultNames::isLogarithmicResult( resultName ); + + RimRegularLegendConfig::MappingType mappingType = MappingType::LINEAR_CONTINUOUS; + RimLegendConfig::RangeModeType rangeType = RimLegendConfig::RangeModeType::AUTOMATIC_ALLTIMESTEPS; + RiaNumberFormat::NumberFormatType numberFormat = RiaNumberFormat::NumberFormatType::FIXED; + + if ( useLog ) + { + if ( useDiscreteLogLevels ) + mappingType = RimRegularLegendConfig::MappingType::LOG10_DISCRETE; + else + mappingType = RimRegularLegendConfig::MappingType::LOG10_CONTINUOUS; + + numberFormat = RiaNumberFormat::NumberFormatType::AUTO; + rangeType = RimLegendConfig::RangeModeType::USER_DEFINED; + } + + bool centerLegendAroundZero = false; + RimRegularLegendConfig::ColorRangesType colorRangeType = RimRegularLegendConfig::ColorRangesType::UNDEFINED; + + if ( isCategoryResult ) + { + colorRangeType = RimRegularLegendConfig::ColorRangesType::CATEGORY; + mappingType = RimRegularLegendConfig::MappingType::CATEGORY_INTEGER; + } + else if ( resultName == RiaResultNames::swat() ) + { + colorRangeType = RimRegularLegendConfig::ColorRangesType::OPPOSITE_NORMAL; + } + else if ( RiaResultNames::isFlowResultWithBothPosAndNegValues( resultName ) ) + { + colorRangeType = RimRegularLegendConfig::ColorRangesType::BLUE_WHITE_RED; + centerLegendAroundZero = true; + } + else if ( resultName != RiaResultNames::undefinedResultName() ) + { + colorRangeType = RimRegularLegendConfig::ColorRangesType::NORMAL; + } + + resetUserDefinedValues(); + setRangeMode( rangeType ); + setMappingMode( mappingType ); + setCenterLegendAroundZero( centerLegendAroundZero ); + setTickNumberFormat( numberFormat ); + updateTickCountAndUserDefinedRange(); + + if ( colorRangeType != RimRegularLegendConfig::ColorRangesType::UNDEFINED ) + { + RimColorLegend* colorLegend = RimRegularLegendConfig::mapToColorLegend( colorRangeType ); + + setColorLegend( colorLegend ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h index e65f95cb18..71775bde93 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h @@ -170,6 +170,8 @@ class RimRegularLegendConfig : public RimLegendConfig QString valueToText( double value ) const; + void setDefaultConfigForResultName( const QString& resultName, bool useDiscreteLogLevels, bool isCategoryResult ); + private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void sendChangedSignal( const caf::PdmFieldHandle* changedField ); @@ -189,6 +191,7 @@ class RimRegularLegendConfig : public RimLegendConfig void updateCategoryItems(); void configureCategoryMapper(); + void updateTickCountAndUserDefinedRange(); friend class RimViewLinker; diff --git a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp index 6754da2b70..26c0dde78e 100644 --- a/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp +++ b/ApplicationLibCode/UserInterface/RiuResultTextBuilder.cpp @@ -19,6 +19,7 @@ #include "RiuResultTextBuilder.h" +#include "RigAllanDiagramData.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigFormationNames.h" @@ -37,13 +38,12 @@ #include "RimEclipseView.h" #include "RimExtrudedCurveIntersection.h" #include "RimFormationNames.h" +#include "RimIntersectionResultDefinition.h" #include "RimRegularLegendConfig.h" #include "RimReservoirCellResultsStorage.h" #include "RivExtrudedCurveIntersectionPartMgr.h" -#include "RigAllanDiagramData.h" -#include "RimIntersectionResultDefinition.h" #include "cafDisplayCoordTransform.h" //-------------------------------------------------------------------------------------------------- From fef0a2b70ce1c1f59bda49a3ea7de25c6411a00d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 6 Jan 2022 08:39:22 +0100 Subject: [PATCH 072/406] Janitor : Remove obsolete includes in header files --- .../RivContourMapProjectionPartMgr.cpp | 1 + .../GeoMech/RimGeoMechContourMapProjection.cpp | 1 + .../GeoMech/RimGeoMechContourMapProjection.h | 1 - .../Intersections/RimIntersectionCollection.cpp | 2 ++ .../ProjectDataModel/RimContourMapProjection.h | 2 +- .../ProjectDataModel/RimEclipseContourMapProjection.h | 1 - .../ProjectDataModel/RimEclipseResultDefinition.cpp | 1 + .../ProjectDataModel/RimElementVectorResult.cpp | 2 ++ .../ProjectDataModel/RimElementVectorResult.h | 6 +++--- ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp | 1 + ApplicationLibCode/ProjectDataModel/RimTensorResults.h | 9 +++++---- .../ProjectDataModel/RimTernaryLegendConfig.cpp | 1 + .../ProjectDataModel/Summary/RimEnsembleCurveSet.h | 1 - .../ProjectDataModel/WellLog/RimWellLogRftCurve.cpp | 1 + .../ProjectDataModel/WellLog/RimWellLogTrack.h | 1 - .../UserInterface/RiuScalarMapperLegendFrame.h | 1 - 16 files changed, 19 insertions(+), 13 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp index 7077117ce4..33fa5efd27 100644 --- a/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivContourMapProjectionPartMgr.cpp @@ -10,6 +10,7 @@ #include "RimContourMapProjection.h" #include "RimGridView.h" +#include "RimRegularLegendConfig.h" #include "cafCategoryMapper.h" #include "cafEffectGenerator.h" diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp index 72e7f6ed59..00d991b36f 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp @@ -34,6 +34,7 @@ #include "RimGeoMechCellColors.h" #include "RimGeoMechContourMapView.h" #include "RimGeoMechPropertyFilterCollection.h" +#include "RimRegularLegendConfig.h" #include "RivFemElmVisibilityCalculator.h" diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h index 1b1ec697af..706d0200ad 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h @@ -24,7 +24,6 @@ #include "RimCheckableNamedObject.h" #include "RimContourMapProjection.h" #include "RimGeoMechCase.h" -#include "RimRegularLegendConfig.h" #include "cafDisplayCoordTransform.h" #include "cafPdmChildField.h" diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp index c56728c5e7..7ec149ace0 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp @@ -29,6 +29,8 @@ #include "RimEclipseView.h" #include "RimExtrudedCurveIntersection.h" #include "RimGridView.h" +#include "RimIntersectionResultDefinition.h" +#include "RimIntersectionResultsDefinitionCollection.h" #include "RimSimWellInView.h" #include "Riu3DMainWindowTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h index 383af027a0..ae08b77e8f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimContourMapProjection.h @@ -19,7 +19,6 @@ #pragma once #include "RimCheckableNamedObject.h" -#include "RimRegularLegendConfig.h" #include "cafContourLines.h" #include "cafDisplayCoordTransform.h" @@ -35,6 +34,7 @@ #include "cvfVector2.h" class RimGridView; +class RimRegularLegendConfig; //================================================================================================== /// diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h index 9bbedbbca8..8cb131ed85 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapProjection.h @@ -20,7 +20,6 @@ #include "RimCheckableNamedObject.h" #include "RimContourMapProjection.h" -#include "RimRegularLegendConfig.h" #include "cafDisplayCoordTransform.h" #include "cafPdmChildField.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp index 7e60133811..de74d7cf52 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -61,6 +61,7 @@ #include "RimIntersectionResultDefinition.h" #include "RimPlotCurve.h" #include "RimProject.h" +#include "RimRegularLegendConfig.h" #include "RimReservoirCellResultsStorage.h" #include "RimSimWellInView.h" #include "RimSimWellInViewCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp index 9d30124f44..3a8abd3d20 100644 --- a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.cpp @@ -15,6 +15,7 @@ // for more details. // ///////////////////////////////////////////////////////////////////////////////// + #include "RimElementVectorResult.h" #include "RigCaseCellResultsData.h" @@ -26,6 +27,7 @@ #include "Rim3dView.h" #include "RimEclipseCase.h" #include "RimEclipseView.h" +#include "RimRegularLegendConfig.h" #include "RiuViewer.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.h b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.h index 024a347354..ecdaaeef63 100644 --- a/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.h +++ b/ApplicationLibCode/ProjectDataModel/RimElementVectorResult.h @@ -18,6 +18,8 @@ #pragma once +#include "RimLegendConfig.h" + #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmFieldCvfColor.h" // Include to make Pdm work for cvf::Color @@ -25,8 +27,6 @@ #include "RigEclipseResultAddress.h" -#include "RimRegularLegendConfig.h" - #include #include @@ -112,6 +112,6 @@ class RimElementVectorResult : public caf::PdmObject caf::PdmField> m_vectorColor; caf::PdmField m_uniformVectorColor; caf::PdmField m_sizeScale; - caf::PdmField m_rangeMode; + caf::PdmField m_rangeMode; caf::PdmChildField m_legendConfig; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp b/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp index 8acc6dcc49..0dbb989ac6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp @@ -22,6 +22,7 @@ #include "RimGeoMechCase.h" #include "RimGeoMechResultDefinition.h" #include "RimGeoMechView.h" +#include "RimRegularLegendConfig.h" #include "RigFemPartResultsCollection.h" #include "RigGeoMechCaseData.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimTensorResults.h b/ApplicationLibCode/ProjectDataModel/RimTensorResults.h index 8010b8f8c2..321c084c64 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTensorResults.h +++ b/ApplicationLibCode/ProjectDataModel/RimTensorResults.h @@ -18,13 +18,14 @@ #pragma once +#include "RimLegendConfig.h" + #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "RigFemResultPosEnum.h" #include "RimFemResultObserver.h" -#include "RimRegularLegendConfig.h" #include @@ -110,7 +111,7 @@ class RimTensorResults : public RimFemResultObserver, public caf::PdmObject caf::PdmField> m_vectorColor; - caf::PdmField> m_scaleMethod; - caf::PdmField m_sizeScale; - caf::PdmField m_rangeMode; + caf::PdmField> m_scaleMethod; + caf::PdmField m_sizeScale; + caf::PdmField m_rangeMode; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp index 7411242a82..9c05d725fe 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTernaryLegendConfig.cpp @@ -22,6 +22,7 @@ #include "RiaApplication.h" #include "RiaColorTables.h" #include "RiaPreferences.h" +#include "RiaResultNames.h" #include "RimEclipseView.h" #include "RimIntersectionCollection.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index 10d35df05f..35f1ef8878 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -28,7 +28,6 @@ #include "RimEnsembleCurveSetColorManager.h" #include "RimEnsembleCurveSetInterface.h" #include "RimObjectiveFunction.h" -#include "RimRegularLegendConfig.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimTimeStepFilter.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index a06e53a450..c41c0f0cf4 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -21,6 +21,7 @@ #include "RiaDefines.h" #include "RiaEclipseUnitTools.h" #include "RiaQDateTimeTools.h" +#include "RiaResultNames.h" #include "RiaSimWellBranchTools.h" #include "RifEclipseRftAddress.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index b3a9ce9159..259de526f9 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -25,7 +25,6 @@ #include "RiuPlotAnnotationTool.h" #include "RimPlot.h" -#include "RimRegularLegendConfig.h" #include "cafPdmChildArrayField.h" #include "cafPdmField.h" diff --git a/ApplicationLibCode/UserInterface/RiuScalarMapperLegendFrame.h b/ApplicationLibCode/UserInterface/RiuScalarMapperLegendFrame.h index a2737b7003..af3ed2d5da 100644 --- a/ApplicationLibCode/UserInterface/RiuScalarMapperLegendFrame.h +++ b/ApplicationLibCode/UserInterface/RiuScalarMapperLegendFrame.h @@ -19,7 +19,6 @@ #include "RiaNumberFormat.h" -#include "RimRegularLegendConfig.h" #include "RiuAbstractLegendFrame.h" #include "cvfObject.h" From aeb0bf067786296f8ce069247ba7539791703aea Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 9 Jan 2022 08:54:57 +0100 Subject: [PATCH 073/406] #8416 VFP Plot : Support import of all units (Field, PVT, ..) --- .../ProjectDataModel/RimVfpTableExtractor.cpp | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpTableExtractor.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpTableExtractor.cpp index e8825f2d1d..6f3255b3f5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpTableExtractor.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpTableExtractor.cpp @@ -22,6 +22,7 @@ #include "cafUtils.h" #include "opm/parser/eclipse/Parser/Parser.hpp" +#include "opm/parser/eclipse/Parser/ParserKeywords/V.hpp" //-------------------------------------------------------------------------------------------------- /// @@ -38,12 +39,22 @@ std::vector RimVfpTableExtractor::extractVfpInjectionTables( c std::string myKeyword = "VFPINJ"; auto keywordList = deck.getKeywordList( myKeyword ); - Opm::UnitSystem unitSystem; - for ( auto kw : keywordList ) { auto name = kw->name(); + Opm::UnitSystem unitSystem; + { + const auto& header = kw->getRecord( 0 ); + + if ( header.getItem().hasValue( 0 ) ) + { + std::string units_string; + units_string = header.getItem().get( 0 ); + unitSystem = Opm::UnitSystem( units_string ); + } + } + Opm::VFPInjTable table( *kw, unitSystem ); tables.push_back( table ); } @@ -70,12 +81,22 @@ std::vector RimVfpTableExtractor::extractVfpProductionTables( std::string myKeyword = "VFPPROD"; auto keywordList = deck.getKeywordList( myKeyword ); - Opm::UnitSystem unitSystem; - for ( auto kw : keywordList ) { auto name = kw->name(); + Opm::UnitSystem unitSystem; + { + const auto& header = kw->getRecord( 0 ); + + if ( header.getItem().hasValue( 0 ) ) + { + std::string units_string; + units_string = header.getItem().get( 0 ); + unitSystem = Opm::UnitSystem( units_string ); + } + } + Opm::VFPProdTable table( *kw, unitSystem ); tables.push_back( table ); } From e203c760992bcead61d56ff8f3d8e92f077ff3c1 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 10 Jan 2022 14:51:31 +0100 Subject: [PATCH 074/406] #8425 Summary Multi Plots: Add grouping on wells, groups, ... * #8425 Multi Graph : Support grouping on object name * #8425 Multi Graph : Improve creation of new graphs * #8425 Multi Graph : Improve default tick mark count * Handle history and non history as identical headers * #8425 Multi Graph : Increase space below a graph --- .../Application/Tools/CMakeLists_files.cmake | 4 +- ...yzer.cpp => RiaSummaryAddressAnalyzer.cpp} | 199 +++++++++++++----- ...Analyzer.h => RiaSummaryAddressAnalyzer.h} | 28 ++- .../RicNewSummaryMultiPlotFeature.cpp | 2 +- .../RicSummaryPlotBuilder.cpp | 133 +++++++++--- .../RicSummaryPlotBuilder.h | 13 +- .../RicSummaryPlotTemplateTools.cpp | 8 +- .../FileInterface/RifEclipseSummaryTools.cpp | 4 +- .../RimDataSourceSteppingTools.cpp | 6 +- .../ProjectDataModel/RimMultiPlot.cpp | 89 ++++++-- .../ProjectDataModel/RimMultiPlot.h | 12 +- .../RimPlotAxisPropertiesInterface.cpp | 1 + .../RimPlotAxisPropertiesInterface.h | 1 + .../Summary/RimEnsembleCurveSet.cpp | 2 +- .../Summary/RimSummaryMultiPlot.cpp | 129 +++++++++--- .../Summary/RimSummaryMultiPlot.h | 10 +- .../Summary/RimSummaryPlot.cpp | 8 +- .../Summary/RimSummaryPlotManager.cpp | 43 ++-- .../Summary/RimSummaryPlotManager.h | 1 + .../Summary/RimSummaryPlotNameHelper.cpp | 39 ++-- .../Summary/RimSummaryPlotNameHelper.h | 5 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 14 +- .../UnitTests/CMakeLists_files.cmake | 2 +- ...cpp => RiaSummaryAddressAnalyzer-Test.cpp} | 14 +- .../UserInterface/RiuMultiPlotPage.cpp | 14 ++ 25 files changed, 583 insertions(+), 198 deletions(-) rename ApplicationLibCode/Application/Tools/{RiaSummaryCurveAnalyzer.cpp => RiaSummaryAddressAnalyzer.cpp} (62%) rename ApplicationLibCode/Application/Tools/{RiaSummaryCurveAnalyzer.h => RiaSummaryAddressAnalyzer.h} (71%) rename ApplicationLibCode/UnitTests/{RiaSummaryCurveAnalyzer-Test.cpp => RiaSummaryAddressAnalyzer-Test.cpp} (93%) diff --git a/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake b/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake index 1078162056..5c122e3be8 100644 --- a/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/Tools/CMakeLists_files.cmake @@ -16,7 +16,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaWellNameComparer.h ${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaInterpolationTools.h - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer.h + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressAnalyzer.h ${CMAKE_CURRENT_LIST_DIR}/RiaSimWellBranchTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileVersionTools.h ${CMAKE_CURRENT_LIST_DIR}/RiaStringEncodingTools.h @@ -69,7 +69,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaWellNameComparer.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaInterpolationTools.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressAnalyzer.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaSimWellBranchTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaProjectFileVersionTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaStringEncodingTools.cpp diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp similarity index 62% rename from ApplicationLibCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp rename to ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp index 7ce053bf96..b7d84ea19f 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryCurveAnalyzer.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp @@ -16,7 +16,7 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RiaSummaryCurveAnalyzer.h" +#include "RiaSummaryAddressAnalyzer.h" #include "RiaStdStringTools.h" #include "RiaSummaryCurveDefinition.h" @@ -29,14 +29,14 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaSummaryCurveAnalyzer::RiaSummaryCurveAnalyzer() +RiaSummaryAddressAnalyzer::RiaSummaryAddressAnalyzer() { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaSummaryCurveAnalyzer::appendAddresses( const std::vector& allAddresses ) +void RiaSummaryAddressAnalyzer::appendAddresses( const std::vector& allAddresses ) { for ( const auto& adr : allAddresses ) { @@ -47,7 +47,7 @@ void RiaSummaryCurveAnalyzer::appendAddresses( const std::vector& allAddresses ) +void RiaSummaryAddressAnalyzer::appendAddresses( const std::set& allAddresses ) { for ( const auto& adr : allAddresses ) { @@ -58,7 +58,7 @@ void RiaSummaryCurveAnalyzer::appendAddresses( const std::set RiaSummaryCurveAnalyzer::quantities() const +std::set RiaSummaryAddressAnalyzer::quantities() const { return m_quantities; } @@ -66,7 +66,7 @@ std::set RiaSummaryCurveAnalyzer::quantities() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryCurveAnalyzer::quantityNamesWithHistory() const +std::set RiaSummaryAddressAnalyzer::quantityNamesWithHistory() const { assignCategoryToQuantities(); @@ -76,7 +76,7 @@ std::set RiaSummaryCurveAnalyzer::quantityNamesWithHistory() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryCurveAnalyzer::quantityNamesNoHistory() const +std::set RiaSummaryAddressAnalyzer::quantityNamesNoHistory() const { assignCategoryToQuantities(); @@ -86,7 +86,7 @@ std::set RiaSummaryCurveAnalyzer::quantityNamesNoHistory() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::string RiaSummaryCurveAnalyzer::quantityNameForTitle() const +std::string RiaSummaryAddressAnalyzer::quantityNameForTitle() const { if ( quantityNamesWithHistory().size() == 1 && quantityNamesNoHistory().empty() ) { @@ -98,37 +98,37 @@ std::string RiaSummaryCurveAnalyzer::quantityNameForTitle() const return *quantityNamesNoHistory().begin(); } - return std::string(); + return {}; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryCurveAnalyzer::wellNames() const +std::set RiaSummaryAddressAnalyzer::wellNames() const { - return m_wellNames; + return keysInMap( m_wellNames ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryCurveAnalyzer::wellGroupNames() const +std::set RiaSummaryAddressAnalyzer::wellGroupNames() const { - return m_wellGroupNames; + return keysInMap( m_wellGroupNames ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryCurveAnalyzer::regionNumbers() const +std::set RiaSummaryAddressAnalyzer::regionNumbers() const { - return m_regionNumbers; + return keysInMap( m_regionNumbers ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryCurveAnalyzer::wellCompletions( const std::string& wellName ) const +std::set RiaSummaryAddressAnalyzer::wellCompletions( const std::string& wellName ) const { std::set connections; @@ -146,7 +146,7 @@ std::set RiaSummaryCurveAnalyzer::wellCompletions( const std::strin //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryCurveAnalyzer::wellSegmentNumbers( const std::string& wellName ) const +std::set RiaSummaryAddressAnalyzer::wellSegmentNumbers( const std::string& wellName ) const { std::set segmentNumberForWell; @@ -164,23 +164,23 @@ std::set RiaSummaryCurveAnalyzer::wellSegmentNumbers( const std::string& we //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryCurveAnalyzer::blocks() const +std::set RiaSummaryAddressAnalyzer::blocks() const { - return m_blocks; + return keysInMap( m_blocks ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryCurveAnalyzer::aquifers() const +std::set RiaSummaryAddressAnalyzer::aquifers() const { - return m_aquifers; + return keysInMap( m_aquifers ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryCurveAnalyzer::categories() const +std::set RiaSummaryAddressAnalyzer::categories() const { return m_categories; } @@ -188,37 +188,62 @@ std::set RiaSummaryCurveAnalyzer:: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RiaSummaryCurveAnalyzer::identifierTexts( RifEclipseSummaryAddress::SummaryVarCategory category, - const std::string& secondaryIdentifier ) const +std::vector> RiaSummaryAddressAnalyzer::addressesGroupedByObject() const +{ + auto wellAdr = valuesInMap( m_wellNames ); + auto wellGroupAdr = valuesInMap( m_wellGroupNames ); + auto regionAdr = valuesInMap( m_regionNumbers ); + auto blockAdr = valuesInMap( m_blocks ); + auto aquiferAdr = valuesInMap( m_aquifers ); + + std::vector> groupedByObject; + groupedByObject.insert( groupedByObject.end(), wellAdr.begin(), wellAdr.end() ); + groupedByObject.insert( groupedByObject.end(), wellGroupAdr.begin(), wellGroupAdr.end() ); + groupedByObject.insert( groupedByObject.end(), regionAdr.begin(), regionAdr.end() ); + groupedByObject.insert( groupedByObject.end(), blockAdr.begin(), blockAdr.end() ); + groupedByObject.insert( groupedByObject.end(), aquiferAdr.begin(), aquiferAdr.end() ); + + return groupedByObject; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiaSummaryAddressAnalyzer::identifierTexts( RifEclipseSummaryAddress::SummaryVarCategory category, + const std::string& secondaryIdentifier ) const { std::vector identifierStrings; if ( category == RifEclipseSummaryAddress::SUMMARY_REGION ) { - for ( const auto& regionNumber : m_regionNumbers ) + auto keys = keysInMap( m_regionNumbers ); + for ( const auto& key : keys ) { - identifierStrings.push_back( QString::number( regionNumber ) ); + identifierStrings.push_back( QString::number( key ) ); } } else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL ) { - for ( const auto& wellName : m_wellNames ) + auto keys = keysInMap( m_wellNames ); + for ( const auto& key : keys ) { - identifierStrings.push_back( QString::fromStdString( wellName ) ); + identifierStrings.push_back( QString::fromStdString( key ) ); } } else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ) { - for ( const auto& wellGroupName : m_wellGroupNames ) + auto keys = keysInMap( m_wellGroupNames ); + for ( const auto& key : keys ) { - identifierStrings.push_back( QString::fromStdString( wellGroupName ) ); + identifierStrings.push_back( QString::fromStdString( key ) ); } } else if ( category == RifEclipseSummaryAddress::SUMMARY_BLOCK ) { - for ( const auto& ijkBlock : m_blocks ) + auto keys = keysInMap( m_blocks ); + for ( const auto& key : keys ) { - identifierStrings.push_back( QString::fromStdString( ijkBlock ) ); + identifierStrings.push_back( QString::fromStdString( key ) ); } } else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT ) @@ -239,9 +264,10 @@ std::vector RiaSummaryCurveAnalyzer::identifierTexts( RifEclipseSummary } else if ( category == RifEclipseSummaryAddress::SUMMARY_AQUIFER ) { - for ( const auto& aquifer : m_aquifers ) + auto keys = keysInMap( m_aquifers ); + for ( const auto& key : keys ) { - identifierStrings.push_back( QString::number( aquifer ) ); + identifierStrings.push_back( QString::number( key ) ); } } @@ -252,8 +278,8 @@ std::vector RiaSummaryCurveAnalyzer::identifierTexts( RifEclipseSummary /// //-------------------------------------------------------------------------------------------------- std::vector - RiaSummaryCurveAnalyzer::addressesForCategory( const std::set& addresses, - RifEclipseSummaryAddress::SummaryVarCategory category ) + RiaSummaryAddressAnalyzer::addressesForCategory( const std::set& addresses, + RifEclipseSummaryAddress::SummaryVarCategory category ) { std::vector filteredAddresses; @@ -271,7 +297,7 @@ std::vector //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::string RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( const std::string& curveName ) +std::string RiaSummaryAddressAnalyzer::correspondingHistorySummaryCurveName( const std::string& curveName ) { static std::string historyIdentifier = "H"; @@ -280,16 +306,14 @@ std::string RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( const std::string candidate = curveName.substr( 0, curveName.size() - 1 ); return candidate; } - else - { - return curveName + historyIdentifier; - } + + return curveName + historyIdentifier; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaSummaryCurveAnalyzer::clear() +void RiaSummaryAddressAnalyzer::clear() { m_quantities.clear(); m_wellNames.clear(); @@ -308,7 +332,7 @@ void RiaSummaryCurveAnalyzer::clear() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaSummaryCurveAnalyzer::assignCategoryToQuantities() const +void RiaSummaryAddressAnalyzer::assignCategoryToQuantities() const { if ( !m_quantities.empty() ) { @@ -322,7 +346,7 @@ void RiaSummaryCurveAnalyzer::assignCategoryToQuantities() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaSummaryCurveAnalyzer::computeQuantityNamesWithHistory() const +void RiaSummaryAddressAnalyzer::computeQuantityNamesWithHistory() const { m_quantitiesNoMatchingHistory.clear(); m_quantitiesWithMatchingHistory.clear(); @@ -355,13 +379,13 @@ void RiaSummaryCurveAnalyzer::computeQuantityNamesWithHistory() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaSummaryCurveAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddress& address ) +void RiaSummaryAddressAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddress& address ) { const std::string& wellName = address.wellName(); if ( !wellName.empty() ) { - m_wellNames.insert( wellName ); + m_wellNames.insert( { wellName, address } ); } if ( !address.quantityName().empty() ) @@ -371,12 +395,12 @@ void RiaSummaryCurveAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddre if ( !address.wellGroupName().empty() ) { - m_wellGroupNames.insert( address.wellGroupName() ); + m_wellGroupNames.insert( { address.wellGroupName(), address } ); } if ( address.regionNumber() != -1 ) { - m_regionNumbers.insert( address.regionNumber() ); + m_regionNumbers.insert( { address.regionNumber(), address } ); } if ( address.category() == RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION ) @@ -392,11 +416,12 @@ void RiaSummaryCurveAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddre else if ( address.category() == RifEclipseSummaryAddress::SUMMARY_BLOCK ) { auto text = address.blockAsString(); - m_blocks.insert( text ); + + m_blocks.insert( { text, address } ); } else if ( address.category() == RifEclipseSummaryAddress::SUMMARY_AQUIFER ) { - m_aquifers.insert( address.aquiferNumber() ); + m_aquifers.insert( { address.aquiferNumber(), address } ); } if ( address.category() != RifEclipseSummaryAddress::SUMMARY_INVALID ) @@ -404,3 +429,77 @@ void RiaSummaryCurveAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAddre m_categories.insert( address.category() ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RiaSummaryAddressAnalyzer::keysInMap( const std::multimap& map ) +{ + std::set keys; + for ( const auto& [key, value] : map ) + { + keys.insert( key ); + } + return keys; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RiaSummaryAddressAnalyzer::keysInMap( const std::multimap& map ) +{ + std::set keys; + for ( const auto& [key, value] : map ) + { + keys.insert( key ); + } + return keys; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector> + RiaSummaryAddressAnalyzer::valuesInMap( const std::multimap& map ) +{ + std::vector> groupedAddresses; + + auto uniqueKeys = keysInMap( map ); + for ( const auto& key : uniqueKeys ) + { + auto range = map.equal_range( key ); + + std::vector addresses; + for ( auto i = range.first; i != range.second; ++i ) + { + addresses.push_back( i->second ); + } + groupedAddresses.push_back( addresses ); + } + + return groupedAddresses; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector> + RiaSummaryAddressAnalyzer::valuesInMap( const std::multimap& map ) +{ + std::vector> groupedAddresses; + + auto uniqueKeys = keysInMap( map ); + for ( const auto& key : uniqueKeys ) + { + auto range = map.equal_range( key ); + + std::vector addresses; + for ( auto i = range.first; i != range.second; ++i ) + { + addresses.push_back( i->second ); + } + groupedAddresses.push_back( addresses ); + } + + return groupedAddresses; +} diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryCurveAnalyzer.h b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h similarity index 71% rename from ApplicationLibCode/Application/Tools/RiaSummaryCurveAnalyzer.h rename to ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h index 8f8595b9b9..ff00a2e4b6 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryCurveAnalyzer.h +++ b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h @@ -32,10 +32,10 @@ class QString; //================================================================================================== // //================================================================================================== -class RiaSummaryCurveAnalyzer +class RiaSummaryAddressAnalyzer { public: - RiaSummaryCurveAnalyzer(); + RiaSummaryAddressAnalyzer(); void appendAddresses( const std::set& allAddresses ); void appendAddresses( const std::vector& allAddresses ); @@ -58,6 +58,7 @@ class RiaSummaryCurveAnalyzer std::set aquifers() const; std::set categories() const; + std::vector> addressesGroupedByObject() const; std::vector identifierTexts( RifEclipseSummaryAddress::SummaryVarCategory category, const std::string& secondaryIdentifier ) const; @@ -74,18 +75,27 @@ class RiaSummaryCurveAnalyzer void analyzeSingleAddress( const RifEclipseSummaryAddress& address ); + static std::set keysInMap( const std::multimap& map ); + static std::set keysInMap( const std::multimap& map ); + + static std::vector> + valuesInMap( const std::multimap& map ); + + static std::vector> + valuesInMap( const std::multimap& map ); + private: std::set m_quantities; mutable std::set m_quantitiesWithMatchingHistory; mutable std::set m_quantitiesNoMatchingHistory; - std::set m_wellNames; - std::set m_wellGroupNames; - std::set m_regionNumbers; - std::set> m_wellCompletions; - std::set> m_wellSegmentNumbers; - std::set m_blocks; - std::set m_aquifers; + std::multimap m_wellNames; + std::multimap m_wellGroupNames; + std::multimap m_regionNumbers; + std::set> m_wellCompletions; + std::set> m_wellSegmentNumbers; + std::multimap m_blocks; + std::multimap m_aquifers; std::set m_categories; }; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp index f2df915398..bdb3bc0f4b 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp @@ -41,7 +41,7 @@ RicNewSummaryMultiPlotFeature::RicNewSummaryMultiPlotFeature() //-------------------------------------------------------------------------------------------------- caf::PdmScriptResponse RicNewSummaryMultiPlotFeature::execute() { - std::vector plots; + std::vector plots; RimSummaryMultiPlot::createAndAppendMultiPlot( plots ); return caf::PdmScriptResponse(); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index c60afe5b67..0bf2790758 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -18,6 +18,7 @@ #include "RicSummaryPlotBuilder.h" +#include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryTools.h" #include "RifEclipseSummaryAddress.h" @@ -43,6 +44,8 @@ /// //-------------------------------------------------------------------------------------------------- RicSummaryPlotBuilder::RicSummaryPlotBuilder() + : m_individualPlotPerDataSource( false ) + , m_graphCurveGrouping( RicSummaryPlotBuilder::RicGraphCurveGrouping::NONE ) { } @@ -67,17 +70,17 @@ void RicSummaryPlotBuilder::setAddresses( const std::set RicSummaryPlotBuilder::createPlots() const { std::vector plots; - if ( m_individualPlotPerDataSource && m_individualPlotPerAddress ) + if ( m_individualPlotPerDataSource ) { - for ( auto adr : m_addresses ) + if ( m_graphCurveGrouping == RicGraphCurveGrouping::SINGLE_CURVES ) + { + for ( const auto& adr : m_addresses ) + { + for ( auto summaryCase : m_summaryCases ) + { + auto plot = createPlot( { adr }, { summaryCase }, {} ); + plots.push_back( plot ); + } + + for ( auto ensemble : m_ensembles ) + { + auto plot = createPlot( { adr }, {}, { ensemble } ); + plots.push_back( plot ); + } + } + } + else if ( m_graphCurveGrouping == RicGraphCurveGrouping::CURVES_FOR_OBJECT ) + { + RiaSummaryAddressAnalyzer analyzer; + analyzer.appendAddresses( m_addresses ); + + auto groups = analyzer.addressesGroupedByObject(); + for ( const auto& group : groups ) + { + std::set addresses; + addresses.insert( group.begin(), group.end() ); + + for ( auto summaryCase : m_summaryCases ) + { + auto plot = createPlot( addresses, { summaryCase }, {} ); + plots.push_back( plot ); + } + + for ( auto ensemble : m_ensembles ) + { + auto plot = createPlot( addresses, {}, { ensemble } ); + plots.push_back( plot ); + } + } + } + else if ( m_graphCurveGrouping == RicGraphCurveGrouping::NONE ) { for ( auto summaryCase : m_summaryCases ) { - auto plot = createPlot( { adr }, { summaryCase }, {} ); + auto plot = createPlot( m_addresses, { summaryCase }, {} ); plots.push_back( plot ); } for ( auto ensemble : m_ensembles ) { - auto plot = createPlot( { adr }, {}, { ensemble } ); + auto plot = createPlot( m_addresses, {}, { ensemble } ); plots.push_back( plot ); } } } - else if ( m_individualPlotPerAddress ) + else // all data sources in same plot { - for ( auto adr : m_addresses ) + if ( m_graphCurveGrouping == RicGraphCurveGrouping::SINGLE_CURVES ) { - auto plot = createPlot( { adr }, m_summaryCases, m_ensembles ); - plots.push_back( plot ); + for ( const auto& adr : m_addresses ) + { + if ( !m_summaryCases.empty() ) + { + auto plot = createPlot( { adr }, m_summaryCases, {} ); + plots.push_back( plot ); + } + + if ( !m_ensembles.empty() ) + { + auto plot = createPlot( { adr }, {}, m_ensembles ); + plots.push_back( plot ); + } + } } - } - else if ( m_individualPlotPerDataSource ) - { - for ( auto summaryCase : m_summaryCases ) + else if ( m_graphCurveGrouping == RicGraphCurveGrouping::CURVES_FOR_OBJECT ) { - auto plot = createPlot( m_addresses, { summaryCase }, {} ); - plots.push_back( plot ); - } + RiaSummaryAddressAnalyzer analyzer; + analyzer.appendAddresses( m_addresses ); - for ( auto ensemble : m_ensembles ) + auto groups = analyzer.addressesGroupedByObject(); + for ( const auto& group : groups ) + { + std::set addresses; + addresses.insert( group.begin(), group.end() ); + + if ( !m_summaryCases.empty() ) + { + auto plot = createPlot( addresses, m_summaryCases, {} ); + plots.push_back( plot ); + } + + if ( !m_ensembles.empty() ) + { + auto plot = createPlot( addresses, {}, m_ensembles ); + plots.push_back( plot ); + } + } + } + else if ( m_graphCurveGrouping == RicGraphCurveGrouping::NONE ) { - auto plot = createPlot( m_addresses, {}, { ensemble } ); - plots.push_back( plot ); + if ( !m_summaryCases.empty() ) + { + auto plot = createPlot( m_addresses, m_summaryCases, {} ); + plots.push_back( plot ); + } + + if ( !m_ensembles.empty() ) + { + auto plot = createPlot( m_addresses, {}, m_ensembles ); + plots.push_back( plot ); + } } } - else - { - auto plot = createPlot( m_addresses, m_summaryCases, m_ensembles ); - plots.push_back( plot ); - } return plots; } @@ -225,7 +300,7 @@ RimMultiPlot* RicSummaryPlotBuilder::createAndAppendMultiPlot( const std::vector RimProject* project = RimProject::current(); RimMultiPlotCollection* plotCollection = project->mainPlotCollection()->multiPlotCollection(); - RimMultiPlot* plotWindow = new RimMultiPlot; + auto* plotWindow = new RimMultiPlot; plotWindow->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) ); plotWindow->setAsPlotMdiWindow(); plotCollection->addMultiPlot( plotWindow ); @@ -267,7 +342,7 @@ RimSummaryPlot* RicSummaryPlotBuilder::createPlot( const std::set& summaryCases, const std::vector& ensembles ) { - RimSummaryPlot* plot = new RimSummaryPlot(); + auto* plot = new RimSummaryPlot(); plot->enableAutoPlotTitle( true ); appendCurvesToPlot( plot, addresses, summaryCases, ensembles ); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h index 70b5de6c17..49b3267f99 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h @@ -40,6 +40,14 @@ class PdmObject; //================================================================================================== class RicSummaryPlotBuilder { +public: + enum class RicGraphCurveGrouping + { + SINGLE_CURVES, + CURVES_FOR_OBJECT, + NONE + }; + public: RicSummaryPlotBuilder(); @@ -48,8 +56,8 @@ class RicSummaryPlotBuilder void setAddresses( const std::set& addresses ); - void setIndividualPlotPerAddress( bool enable ); void setIndividualPlotPerDataSource( bool enable ); + void setGrouping( RicGraphCurveGrouping groping ); std::vector createPlots() const; @@ -77,6 +85,7 @@ class RicSummaryPlotBuilder std::vector m_summaryCases; std::vector m_ensembles; - bool m_individualPlotPerAddress; bool m_individualPlotPerDataSource; + + RicGraphCurveGrouping m_graphCurveGrouping; }; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index 6e526cc359..e7ddedd6e3 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -21,7 +21,7 @@ #include "RiaGuiApplication.h" #include "RiaLogging.h" #include "RiaPreferences.h" -#include "RiaSummaryCurveAnalyzer.h" +#include "RiaSummaryAddressAnalyzer.h" #include "RicSelectPlotTemplateUi.h" @@ -241,14 +241,14 @@ QString RicSummaryPlotTemplateTools::htmlTextFromPlotAndSelection( const RimSumm { QString text; - RiaSummaryCurveAnalyzer selectionAnalyzer; + RiaSummaryAddressAnalyzer selectionAnalyzer; selectionAnalyzer.appendAddresses( selectedSummaryAddresses ); if ( templatePlot ) { - std::set templateSources; - RiaSummaryCurveAnalyzer templateAnalyzer; + std::set templateSources; + RiaSummaryAddressAnalyzer templateAnalyzer; { std::set templateAddresses; diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp index f51ad56962..118ea83900 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp @@ -20,7 +20,7 @@ #include "RiaFilePathTools.h" #include "RiaStringEncodingTools.h" -#include "RiaSummaryCurveAnalyzer.h" +#include "RiaSummaryAddressAnalyzer.h" #include "RifSummaryReaderInterface.h" #include "cafAppEnum.h" @@ -142,7 +142,7 @@ void RifEclipseSummaryTools::dumpMetaData( RifSummaryReaderInterface* readerEcli RifEclipseSummaryAddress::SummaryVarCategory( category ); std::vector catAddresses = - RiaSummaryCurveAnalyzer::addressesForCategory( addresses, categoryEnum ); + RiaSummaryAddressAnalyzer::addressesForCategory( addresses, categoryEnum ); if ( !catAddresses.empty() ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp index d2d6a9b511..656401d1de 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp @@ -18,7 +18,7 @@ #include "RimDataSourceSteppingTools.h" -#include "RiaSummaryCurveAnalyzer.h" +#include "RiaSummaryAddressAnalyzer.h" #include "cafPdmUiFieldHandle.h" @@ -174,8 +174,8 @@ bool RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( cons return true; } - std::string correspondingOldString = RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( oldString ); - std::string correspondingNewString = RiaSummaryCurveAnalyzer::correspondingHistorySummaryCurveName( newString ); + std::string correspondingOldString = RiaSummaryAddressAnalyzer::correspondingHistorySummaryCurveName( oldString ); + std::string correspondingNewString = RiaSummaryAddressAnalyzer::correspondingHistorySummaryCurveName( newString ); if ( adr->quantityName() == correspondingOldString ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 8033433a0b..202bbf8da8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -52,11 +52,11 @@ void RimMultiPlot::ColumnCountEnum::setUp() template <> void RimMultiPlot::RowCountEnum::setUp() { - addItem( RimMultiPlot::ROWS_1, "1", "1 Row" ); - addItem( RimMultiPlot::ROWS_2, "2", "2 Rows" ); - addItem( RimMultiPlot::ROWS_3, "3", "3 Rows" ); - addItem( RimMultiPlot::ROWS_4, "4", "4 Rows" ); - setDefault( RimMultiPlot::ROWS_2 ); + addItem( RimMultiPlot::RowCount::ROWS_1, "1", "1 Row" ); + addItem( RimMultiPlot::RowCount::ROWS_2, "2", "2 Rows" ); + addItem( RimMultiPlot::RowCount::ROWS_3, "3", "3 Rows" ); + addItem( RimMultiPlot::RowCount::ROWS_4, "4", "4 Rows" ); + setDefault( RimMultiPlot::RowCount::ROWS_2 ); } } // namespace caf @@ -190,6 +190,8 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index ) { if ( plot ) { + setTickmarkCount( plot, m_majorTickmarkCount() ); + m_plots.insert( index, plot ); if ( m_viewer ) @@ -265,6 +267,7 @@ void RimMultiPlot::insertPlots( const std::vector& plots ) { if ( plot ) { + setTickmarkCount( plot, m_majorTickmarkCount() ); m_plots.insert( -1, plot ); if ( m_viewer ) @@ -418,6 +421,43 @@ void RimMultiPlot::setAutoScaleYEnabled( bool enabled ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::setColumnCount( RiuMultiPlotPage::ColumnCount columnCount ) +{ + m_columnCount = columnCount; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::setRowCount( RowCount rowCount ) +{ + m_rowsPerPage = rowCount; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::setTickmarkCount( RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum tickmarkCount ) +{ + m_majorTickmarkCount = tickmarkCount; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::setTickmarkCount( RimPlot* plot, RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum tickmarkCount ) +{ + std::vector timeAxisProps; + plot->descendantsIncludingThisOfType( timeAxisProps ); + for ( auto tap : timeAxisProps ) + { + tap->setMajorTickmarkCount( tickmarkCount ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -435,7 +475,29 @@ int RimMultiPlot::columnCount() const //-------------------------------------------------------------------------------------------------- int RimMultiPlot::rowsPerPage() const { - return static_cast( m_rowsPerPage() ); + RimMultiPlot::RowCount rowEnum = m_rowsPerPage().value(); + + int rowCount = 2; + + switch ( rowEnum ) + { + case RimMultiPlot::RowCount::ROWS_1: + rowCount = 1; + break; + case RimMultiPlot::RowCount::ROWS_2: + rowCount = 2; + break; + case RimMultiPlot::RowCount::ROWS_3: + rowCount = 3; + break; + case RimMultiPlot::RowCount::ROWS_4: + rowCount = 4; + break; + default: + break; + } + + return rowCount; } //-------------------------------------------------------------------------------------------------- @@ -462,6 +524,14 @@ caf::PdmFieldHandle* RimMultiPlot::pagePreviewField() return &m_pagePreviewMode; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::setShowPlotTitles( bool enable ) +{ + m_showIndividualPlotTitles = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -644,12 +714,7 @@ void RimMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, co { for ( RimPlot* plot : plots() ) { - std::vector timeAxisProps; - plot->descendantsIncludingThisOfType( timeAxisProps ); - for ( auto tap : timeAxisProps ) - { - tap->setMajorTickmarkCount( m_majorTickmarkCount() ); - } + setTickmarkCount( plot, m_majorTickmarkCount() ); } updatePlots(); diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 6755cdccf8..51d31dbba9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -46,7 +46,7 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection; - enum RowCount + enum class RowCount { ROWS_1 = 1, ROWS_2 = 2, @@ -91,12 +91,18 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection& referringObjects ) override; + static void setTickmarkCount( RimPlot* plot, RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum tickmarkCount ); + protected: caf::PdmField m_showPlotWindowTitle; caf::PdmField m_plotWindowTitle; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp index 8b9d56ae93..c07e154f7c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp @@ -34,6 +34,7 @@ void caf::AppEnum::setUp( template <> void RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum::setUp() { + addItem(RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW, "VERY_FEW", "Very Few"); addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW, "Few", "Few" ); addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT, "Default", "Default" ); addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_MANY, "Many", "Many" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h index 223980a8be..3b05cf866d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h @@ -35,6 +35,7 @@ class RimPlotAxisPropertiesInterface enum class LegendTickmarkCount { + TICKMARK_VERY_FEW, TICKMARK_FEW, TICKMARK_DEFAULT, TICKMARK_MANY, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 31fb883508..92f1809c64 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -22,7 +22,7 @@ #include "RiaGuiApplication.h" #include "RiaPreferences.h" #include "RiaResultNames.h" -#include "RiaSummaryCurveAnalyzer.h" +#include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryCurveDefinition.h" #include "RiaTimeTTools.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 29f59d0ca9..cdae6042e4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -18,6 +18,7 @@ #include "RimMultiPlot.h" +#include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryStringTools.h" #include "RimEnsembleCurveSet.h" @@ -28,6 +29,7 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" + #include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotNameHelper.h" @@ -53,6 +55,7 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() m_filterText.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); CAF_PDM_InitField( &m_individualPlotPerVector, "IndividualPlotPerVector", false, "One plot per Vector" ); + CAF_PDM_InitField( &m_individualPlotPerObject, "IndividualPlotPerObject", false, "One plot per Object" ); CAF_PDM_InitField( &m_individualPlotPerDataSource, "IndividualPlotPerDataSource", false, "One plot per Data Source" ); CAF_PDM_InitField( &m_autoPlotTitles, "AutoPlotTitles", false, "Auto Plot Titles" ); CAF_PDM_InitField( &m_autoPlotTitlesOnSubPlots, "AutoPlotTitlesSubPlots", false, "Auto Plot Titles Sub Plots" ); @@ -118,7 +121,7 @@ QString RimSummaryMultiPlot::description() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::addPlot( RimPlot* plot ) +void RimSummaryMultiPlot::addPlot( RimSummaryPlot* plot ) { m_multiPlot->addPlot( plot ); } @@ -126,7 +129,7 @@ void RimSummaryMultiPlot::addPlot( RimPlot* plot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryMultiPlot* RimSummaryMultiPlot::createAndAppendMultiPlot( const std::vector& plots ) +RimSummaryMultiPlot* RimSummaryMultiPlot::createAndAppendMultiPlot( const std::vector& plots ) { RimProject* project = RimProject::current(); auto* plotCollection = project->mainPlotCollection()->multiPlotCollection(); @@ -135,19 +138,9 @@ RimSummaryMultiPlot* RimSummaryMultiPlot::createAndAppendMultiPlot( const std::v plotWindow->setAsPlotMdiWindow(); plotCollection->addMultiSummaryPlot( plotWindow ); - for ( auto plot : plots ) - { - plotWindow->addPlot( plot ); - - plot->resolveReferencesRecursively(); - plot->revokeMdiWindowStatus(); - plot->setShowWindow( true ); - - plot->loadDataAndUpdate(); - } + insertGraphsIntoPlot( plotWindow, plots ); plotCollection->updateAllRequiredEditors(); - plotWindow->loadDataAndUpdate(); return plotWindow; } @@ -296,20 +289,26 @@ QList RimSummaryMultiPlot::calculateValueOptions( const //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - uiOrdering.add( &m_filterText ); - uiOrdering.add( &m_individualPlotPerVector ); - uiOrdering.add( &m_individualPlotPerDataSource ); uiOrdering.add( &m_autoPlotTitles ); uiOrdering.add( &m_autoPlotTitlesOnSubPlots ); - auto group = uiOrdering.addNewGroup( "Multi Plot Options" ); - m_multiPlot->uiOrderingForSummaryMultiPlot( *group ); - { auto group = uiOrdering.addNewGroup( "Data Source" ); m_sourceStepping()->uiOrdering( uiConfigName, *group ); } + auto group = uiOrdering.addNewGroup( "Multi Plot Options" ); + m_multiPlot->uiOrderingForSummaryMultiPlot( *group ); + + { + auto group = uiOrdering.addNewGroup( "Graph Building" ); + group->setCollapsedByDefault( true ); + + group->add( &m_filterText ); + group->add( &m_individualPlotPerVector ); + group->add( &m_individualPlotPerDataSource ); + group->add( &m_individualPlotPerObject ); + } uiOrdering.add( &m_showMultiPlotInProjectTree ); uiOrdering.skipRemainingFields(); @@ -335,7 +334,7 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi } } else if ( changedField == &m_filterText || changedField == &m_individualPlotPerDataSource || - changedField == &m_individualPlotPerVector ) + changedField == &m_individualPlotPerVector || changedField == &m_individualPlotPerObject ) { updatePlots(); } @@ -404,20 +403,16 @@ void RimSummaryMultiPlot::updatePlots() RicSummaryPlotBuilder plotBuilder; plotBuilder.setAddresses( filteredAddresses ); plotBuilder.setDataSources( matchingSummaryCases, matchingEnsembles ); - plotBuilder.setIndividualPlotPerAddress( m_individualPlotPerVector ); plotBuilder.setIndividualPlotPerDataSource( m_individualPlotPerDataSource ); - auto plots = plotBuilder.createPlots(); - for ( auto plot : plots ) - { - this->addPlot( plot ); + RicSummaryPlotBuilder::RicGraphCurveGrouping groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::NONE; + if ( m_individualPlotPerVector ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::SINGLE_CURVES; + if ( m_individualPlotPerObject ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::CURVES_FOR_OBJECT; + plotBuilder.setGrouping( groping ); - plot->resolveReferencesRecursively(); - plot->revokeMdiWindowStatus(); - plot->setShowWindow( true ); - } + auto plots = plotBuilder.createPlots(); - onLoadDataAndUpdate(); + insertGraphsIntoPlot( this, plots ); } } @@ -440,7 +435,7 @@ void RimSummaryMultiPlot::updatePlotTitles() // Disable auto plot, as this is required to be able to include the information in the multi plot title plot->enableAutoPlotTitle( false ); - auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper.get() ); + auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper ); plot->setDescription( plotName ); plot->updatePlotTitle(); } @@ -455,6 +450,22 @@ const RimSummaryNameHelper* RimSummaryMultiPlot::nameHelper() const return m_nameHelper.get(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::setAutoTitlePlot( bool enable ) +{ + m_autoPlotTitles = enable; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::setAutoTitleGraphs( bool enable ) +{ + m_autoPlotTitlesOnSubPlots = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -470,3 +481,59 @@ std::vector RimSummaryMultiPlot::summaryPlots() const return typedPlots; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const std::vector& graphs ) +{ + auto columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_2; + auto rowCount = RimMultiPlot::RowCount::ROWS_2; + auto tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT; + + bool showTitleSubGraph = true; + if ( graphs.size() == 1 ) + { + showTitleSubGraph = false; + tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_MANY; + } + else if ( 4 < graphs.size() && graphs.size() <= 6 ) + { + columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_3; + rowCount = RimMultiPlot::RowCount::ROWS_2; + tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW; + } + else if ( 6 < graphs.size() && graphs.size() <= 12 ) + { + columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_4; + rowCount = RimMultiPlot::RowCount::ROWS_3; + tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW; + } + else + { + columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_4; + rowCount = RimMultiPlot::RowCount::ROWS_4; + tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW; + } + + plot->setAutoTitlePlot( true ); + plot->setAutoTitleGraphs( showTitleSubGraph ); + + plot->m_multiPlot->setColumnCount( columnCount ); + plot->m_multiPlot->setRowCount( rowCount ); + plot->m_multiPlot->setShowPlotTitles( showTitleSubGraph ); + plot->m_multiPlot->setTickmarkCount( tickmarkCount ); + + for ( auto graph : graphs ) + { + plot->addPlot( graph ); + + graph->resolveReferencesRecursively(); + graph->revokeMdiWindowStatus(); + graph->setShowWindow( true ); + + graph->loadDataAndUpdate(); + } + + plot->loadDataAndUpdate(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index ddfe43b38a..28e10ebc8b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -48,12 +48,15 @@ class RimSummaryMultiPlot : public RimPlotWindow, public RimSummaryDataSourceSte void zoomAll() override; QString description() const override; - void addPlot( RimPlot* plot ); + void addPlot( RimSummaryPlot* plot ); void updatePlotTitles(); const RimSummaryNameHelper* nameHelper() const; - static RimSummaryMultiPlot* createAndAppendMultiPlot( const std::vector& plots ); + void setAutoTitlePlot( bool enable ); + void setAutoTitleGraphs( bool enable ); + + static RimSummaryMultiPlot* createAndAppendMultiPlot( const std::vector& plots ); std::vector availableAxes() const override; std::vector curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const override; @@ -82,10 +85,13 @@ class RimSummaryMultiPlot : public RimPlotWindow, public RimSummaryDataSourceSte std::vector summaryPlots() const; + static void insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const std::vector& graphs ); + private: caf::PdmField m_filterText; caf::PdmField m_individualPlotPerVector; caf::PdmField m_individualPlotPerDataSource; + caf::PdmField m_individualPlotPerObject; caf::PdmField m_autoPlotTitles; caf::PdmField m_autoPlotTitlesOnSubPlots; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 2a2d557b33..f03fe528d3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -20,7 +20,7 @@ #include "RiaColorTables.h" #include "RiaFieldHandleTools.h" -#include "RiaSummaryCurveAnalyzer.h" +#include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryCurveDefinition.h" #include "RiaSummaryTools.h" #include "RiaTimeHistoryCurveResampler.h" @@ -662,10 +662,9 @@ std::vector RimSummaryPlot::visibleStackedSummaryCurvesForAxis void RimSummaryPlot::updatePlotTitle() { m_nameHelperAllCurves->clear(); - + updateNameHelperWithCurveData( m_nameHelperAllCurves.get() ); if ( m_useAutoPlotTitle ) { - updateNameHelperWithCurveData( m_nameHelperAllCurves.get() ); m_description = m_nameHelperAllCurves->plotTitle(); } @@ -1199,6 +1198,9 @@ void RimSummaryPlot::updateTimeAxis() switch ( tickmarkCountEnum ) { + case RimSummaryTimeAxisProperties::LegendTickmarkCount::TICKMARK_VERY_FEW: + maxTickmarkCount = 2; + break; case RimSummaryTimeAxisProperties::LegendTickmarkCount::TICKMARK_FEW: maxTickmarkCount = 4; break; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index 5bf284044a..860f9d41af 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -109,9 +109,17 @@ RimSummaryPlotManager::RimSummaryPlotManager() m_labelB.uiCapability()->setUiEditorTypeName( caf::PdmUiLabelEditor::uiEditorTypeName() ); m_labelB.xmlCapability()->disableIO(); + CAF_PDM_InitField( &m_individualPlotPerObject, "IndividualPlotPerObject", false, "One plot per Object" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_individualPlotPerObject ); + CAF_PDM_InitField( &m_individualPlotPerVector, "IndividualPlotPerVector", false, "One plot per Vector" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_individualPlotPerVector ); + CAF_PDM_InitField( &m_individualPlotPerDataSource, "IndividualPlotPerDataSource", false, "One plot per Data Source" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_individualPlotPerDataSource ); + CAF_PDM_InitField( &m_createMultiPlot, "CreateMultiPlot", false, "Create Multiple Plots in One Window" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_createMultiPlot ); } //-------------------------------------------------------------------------------------------------- @@ -330,8 +338,9 @@ void RimSummaryPlotManager::defineUiOrdering( QString uiConfigName, caf::PdmUiOr uiOrdering.add( &m_selectedDataSources, false ); uiOrdering.add( &m_individualPlotPerVector ); - uiOrdering.add( &m_individualPlotPerDataSource ); - uiOrdering.add( &m_createMultiPlot ); + uiOrdering.add( &m_individualPlotPerDataSource, false ); + uiOrdering.add( &m_individualPlotPerObject ); + uiOrdering.add( &m_createMultiPlot, false ); uiOrdering.add( &m_pushButtonAppend ); uiOrdering.add( &m_pushButtonReplace, { false } ); @@ -379,30 +388,34 @@ void RimSummaryPlotManager::createNewPlot() RicSummaryPlotBuilder plotBuilder; plotBuilder.setAddresses( filteredAddressesFromSource ); plotBuilder.setDataSources( summaryCases, ensembles ); - plotBuilder.setIndividualPlotPerAddress( m_individualPlotPerVector ); - plotBuilder.setIndividualPlotPerDataSource( m_individualPlotPerDataSource ); + + RicSummaryPlotBuilder::RicGraphCurveGrouping groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::NONE; + if ( m_individualPlotPerVector ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::SINGLE_CURVES; + if ( m_individualPlotPerObject ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::CURVES_FOR_OBJECT; + plotBuilder.setGrouping( groping ); auto plots = plotBuilder.createPlots(); if ( m_createMultiPlot ) { - std::vector plotsForMultiPlot; - for ( auto p : plots ) { - p->loadDataAndUpdate(); - plotsForMultiPlot.push_back( dynamic_cast( p ) ); - } + auto summaryPlots = plotBuilder.createPlots(); + auto plot = RimSummaryMultiPlot::createAndAppendMultiPlot( summaryPlots ); - RicSummaryPlotBuilder::createAndAppendMultiPlot( plotsForMultiPlot ); + RiuPlotMainWindowTools::selectAsCurrentItem( plot ); + } + bool createStandardMultiPlot = false; + if ( createStandardMultiPlot ) { - auto myCopyOfPlots = plotBuilder.createPlots(); - std::vector myRimPlots; - for ( auto p : myCopyOfPlots ) + // Code to generate a standard multi plot + std::vector plotsForMultiPlot; + for ( auto p : plots ) { p->loadDataAndUpdate(); - myRimPlots.push_back( dynamic_cast( p ) ); + plotsForMultiPlot.push_back( dynamic_cast( p ) ); } - RimSummaryMultiPlot::createAndAppendMultiPlot( myRimPlots ); + + RicSummaryPlotBuilder::createAndAppendMultiPlot( plotsForMultiPlot ); } } else diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h index 81348b207d..70e2a5d336 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h @@ -101,6 +101,7 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: caf::PdmField m_individualPlotPerVector; caf::PdmField m_individualPlotPerDataSource; + caf::PdmField m_individualPlotPerObject; caf::PdmField m_createMultiPlot; caf::PdmField m_labelA; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp index 1859db90b3..4c668a8901 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp @@ -18,18 +18,19 @@ #include "RimSummaryPlotNameHelper.h" +#include "RiaSummaryAddressAnalyzer.h" #include "RifEclipseSummaryAddress.h" +#include "RimObjectiveFunctionTools.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" -#include "RiuSummaryQuantityNameInfoProvider.h" - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimSummaryPlotNameHelper::RimSummaryPlotNameHelper() { + m_analyzer = std::make_unique(); } //-------------------------------------------------------------------------------------------------- @@ -39,7 +40,7 @@ void RimSummaryPlotNameHelper::clear() { m_summaryCases.clear(); m_ensembleCases.clear(); - m_analyzer.clear(); + m_analyzer->clear(); clearTitleSubStrings(); } @@ -49,7 +50,7 @@ void RimSummaryPlotNameHelper::clear() //-------------------------------------------------------------------------------------------------- void RimSummaryPlotNameHelper::appendAddresses( const std::vector& addresses ) { - m_analyzer.appendAddresses( addresses ); + m_analyzer->appendAddresses( addresses ); extractPlotTitleSubStrings(); } @@ -103,7 +104,19 @@ QString RimSummaryPlotNameHelper::plotTitle() const //-------------------------------------------------------------------------------------------------- bool RimSummaryPlotNameHelper::isPlotDisplayingSingleQuantity() const { - return m_analyzer.quantities().size() == 1; + if ( m_analyzer->quantities().size() == 2 ) + { + std::vector strings; + for ( const auto& q : m_analyzer->quantities() ) + strings.push_back( q ); + + auto first = RimObjectiveFunctionTools::nativeQuantityName( strings[0] ); + auto second = RimObjectiveFunctionTools::nativeQuantityName( strings[1] ); + + if ( first == second ) return true; + } + + return m_analyzer->quantities().size() == 1; } //-------------------------------------------------------------------------------------------------- @@ -249,22 +262,22 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings() { clearTitleSubStrings(); - auto wellNames = m_analyzer.wellNames(); - auto wellGroupNames = m_analyzer.wellGroupNames(); - auto regions = m_analyzer.regionNumbers(); - auto blocks = m_analyzer.blocks(); - auto categories = m_analyzer.categories(); + auto wellNames = m_analyzer->wellNames(); + auto wellGroupNames = m_analyzer->wellGroupNames(); + auto regions = m_analyzer->regionNumbers(); + auto blocks = m_analyzer->blocks(); + auto categories = m_analyzer->categories(); if ( categories.size() == 1 ) { - m_titleQuantity = m_analyzer.quantityNameForTitle(); + m_titleQuantity = m_analyzer->quantityNameForTitle(); if ( wellNames.size() == 1 ) { m_titleWellName = *( wellNames.begin() ); { - auto segments = m_analyzer.wellSegmentNumbers( m_titleWellName ); + auto segments = m_analyzer->wellSegmentNumbers( m_titleWellName ); if ( segments.size() == 1 ) { m_titleSegment = std::to_string( *( segments.begin() ) ); @@ -272,7 +285,7 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings() } { - auto completions = m_analyzer.wellCompletions( m_titleWellName ); + auto completions = m_analyzer->wellCompletions( m_titleWellName ); if ( completions.size() == 1 ) { m_titleCompletion = *( completions.begin() ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h index cd12676265..7e7435f962 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h @@ -20,19 +20,20 @@ #include "RimSummaryNameHelper.h" -#include "RiaSummaryCurveAnalyzer.h" #include "RifEclipseSummaryAddress.h" #include "cafPdmPointer.h" #include +#include #include #include class RimSummaryCurve; class RimSummaryCase; class RimSummaryCaseCollection; +class RiaSummaryAddressAnalyzer; //================================================================================================== // @@ -77,7 +78,7 @@ class RimSummaryPlotNameHelper : public RimSummaryNameHelper std::set setOfEnsembleCases() const; private: - RiaSummaryCurveAnalyzer m_analyzer; + std::unique_ptr m_analyzer; std::vector> m_summaryCases; std::vector> m_ensembleCases; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index a2735128e0..c33747fc3f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -20,7 +20,7 @@ #include "RiaGuiApplication.h" #include "RiaStdStringTools.h" -#include "RiaSummaryCurveAnalyzer.h" +#include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryCurveDefinition.h" #include "RimDataSourceSteppingTools.h" @@ -235,12 +235,12 @@ QList std::map displayAndValueStrings; { - RiaSummaryCurveAnalyzer quantityAnalyzer; + RiaSummaryAddressAnalyzer quantityAnalyzer; - auto subset = RiaSummaryCurveAnalyzer::addressesForCategory( addresses, category ); + auto subset = RiaSummaryAddressAnalyzer::addressesForCategory( addresses, category ); quantityAnalyzer.appendAddresses( subset ); - RiaSummaryCurveAnalyzer analyzerForVisibleCurves; + RiaSummaryAddressAnalyzer analyzerForVisibleCurves; analyzerForVisibleCurves.appendAddresses( visibleCurveAddresses ); if ( analyzerForVisibleCurves.quantityNamesWithHistory().empty() ) @@ -327,7 +327,7 @@ QList if ( category != RifEclipseSummaryAddress::SUMMARY_INVALID ) { - RiaSummaryCurveAnalyzer analyzer; + RiaSummaryAddressAnalyzer analyzer; analyzer.appendAddresses( addresses ); identifierTexts = analyzer.identifierTexts( category, secondaryIdentifier ); @@ -586,7 +586,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* //-------------------------------------------------------------------------------------------------- caf::PdmValueField* RimSummaryPlotSourceStepping::fieldToModify() { - RiaSummaryCurveAnalyzer analyzer; + RiaSummaryAddressAnalyzer analyzer; analyzer.appendAddresses( addressesForCurvesInPlot() ); if ( analyzer.wellNames().size() == 1 ) @@ -779,7 +779,7 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi std::vector fieldsCommonForAllCurves; { - RiaSummaryCurveAnalyzer analyzer; + RiaSummaryAddressAnalyzer analyzer; analyzer.appendAddresses( addressesForCurvesInPlot() ); RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_INVALID; diff --git a/ApplicationLibCode/UnitTests/CMakeLists_files.cmake b/ApplicationLibCode/UnitTests/CMakeLists_files.cmake index 0ab5ec9bc5..2e5cb9569d 100644 --- a/ApplicationLibCode/UnitTests/CMakeLists_files.cmake +++ b/ApplicationLibCode/UnitTests/CMakeLists_files.cmake @@ -60,7 +60,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCaseCollection-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RifActiveCellsReader-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RifCsvDataTableFormatter-Test.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryCurveAnalyzer-Test.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaSummaryAddressAnalyzer-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaStdStringTools-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaInterpolationTools-Test.cpp ${CMAKE_CURRENT_LIST_DIR}/RifWellMeasurementReader-Test.cpp diff --git a/ApplicationLibCode/UnitTests/RiaSummaryCurveAnalyzer-Test.cpp b/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp similarity index 93% rename from ApplicationLibCode/UnitTests/RiaSummaryCurveAnalyzer-Test.cpp rename to ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp index c69c5b1eff..bd9c76de9a 100644 --- a/ApplicationLibCode/UnitTests/RiaSummaryCurveAnalyzer-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp @@ -1,11 +1,11 @@ #include "gtest/gtest.h" -#include "RiaSummaryCurveAnalyzer.h" +#include "RiaSummaryAddressAnalyzer.h" //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -TEST( RiaSummaryCurveAnalyzer, WellCompletions ) +TEST( RiaSummaryAddressAnalyzer, WellCompletions ) { std::vector addresses; @@ -45,7 +45,7 @@ TEST( RiaSummaryCurveAnalyzer, WellCompletions ) addresses.push_back( adr ); } - RiaSummaryCurveAnalyzer analyzer; + RiaSummaryAddressAnalyzer analyzer; analyzer.appendAddresses( addresses ); EXPECT_EQ( 2u, analyzer.wellNames().size() ); @@ -62,7 +62,7 @@ TEST( RiaSummaryCurveAnalyzer, WellCompletions ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -TEST( RiaSummaryCurveAnalyzer, WellSegments ) +TEST( RiaSummaryAddressAnalyzer, WellSegments ) { std::vector addresses; @@ -96,7 +96,7 @@ TEST( RiaSummaryCurveAnalyzer, WellSegments ) addresses.push_back( adr ); } - RiaSummaryCurveAnalyzer analyzer; + RiaSummaryAddressAnalyzer analyzer; analyzer.appendAddresses( addresses ); EXPECT_EQ( 2u, analyzer.wellNames().size() ); @@ -111,7 +111,7 @@ TEST( RiaSummaryCurveAnalyzer, WellSegments ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -TEST( RiaSummaryCurveAnalyzer, CellBlocks ) +TEST( RiaSummaryAddressAnalyzer, CellBlocks ) { std::vector addresses; @@ -132,7 +132,7 @@ TEST( RiaSummaryCurveAnalyzer, CellBlocks ) addresses.push_back( adr ); } - RiaSummaryCurveAnalyzer analyzer; + RiaSummaryAddressAnalyzer analyzer; analyzer.appendAddresses( addresses ); auto blocks = analyzer.blocks(); diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 7fc454d4fc..37637ba3ff 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -621,6 +621,20 @@ void RiuMultiPlotPage::reinsertPlotWidgets() plotWidgets[visibleIndex]->setAxisTitleEnabled( QwtPlot::yLeft, showYAxis( row, column ) ); plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize ); + { + int left = 0; + int top = 0; + int right = 0; + int bot = 0; + + plotWidgets[visibleIndex]->getContentsMargins( &left, &top, &right, &bot ); + bot = 40; + + // Adjust the space below a graph to make sure the heading of the row below is closest to the + // corresponding graph + plotWidgets[visibleIndex]->setContentsMargins( left, top, right, bot ); + } + plotWidgets[visibleIndex]->show(); if ( legends[visibleIndex] ) From 3495cdd4b4b0a8d967f8f4f7aaa6108fdd19df9a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 10 Jan 2022 19:07:43 +0100 Subject: [PATCH 075/406] Gha: Do not use unity build --- .github/workflows/ResInsightWithCache.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 170bd91eac..864b63fba6 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -5,7 +5,7 @@ on: pull_request: schedule: # Every day at 1am to make sure we have a build cache for the current date - # build cache is + # build cache is - cron: '0 1 * * * ' env: BUILD_TYPE: Release @@ -195,7 +195,6 @@ jobs: -B cmakebuild -D CMAKE_BUILD_TYPE=$ENV{BUILD_TYPE} -D CMAKE_INSTALL_PREFIX=cmakebuild/install - -D RESINSIGHT_ENABLE_UNITY_BUILD=true -D RESINSIGHT_BUNDLE_OPENSSL=true -D RESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true -D RESINSIGHT_TREAT_WARNINGS_AS_ERRORS=true From 457f9653a8f12986a2447c67d98250fe9d647719 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 10 Jan 2022 15:53:14 +0100 Subject: [PATCH 076/406] Janitor : Remove hard-coded height --- ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 6df1004a5f..c250565ab2 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -86,7 +86,7 @@ class BookFrame : public QFrame for ( auto page : pages ) { fullSize.setWidth( std::max( fullSize.width(), page->minimumSizeHint().width() ) ); - fullSize.setHeight( fullSize.height() + 8 + page->minimumSizeHint().height() ); + fullSize.setHeight( fullSize.height() + m_margins + page->minimumSizeHint().height() ); } return fullSize; } From 051bbe6467a46fcfa2708a987e5f5531a1bb325c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 10 Jan 2022 21:57:14 +0100 Subject: [PATCH 077/406] Intersection Depth Filter : Add missing geometry update --- .../ProjectDataModel/Intersections/RimIntersectionCollection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp index 7ec149ace0..f0946ddece 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp @@ -378,6 +378,7 @@ void RimIntersectionCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha for ( RimExtrudedCurveIntersection* cs : m_intersections ) { cs->setDepthOverride( m_depthThresholdOverridden, m_collectionDepthThreshold, m_collectionDepthDisplayType() ); + cs->rebuildGeometryAndScheduleCreateDisplayModel(); } Rim3dView* rimView = nullptr; From eb02908dc7f704291c2579d903e6560696f6d816 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 10 Jan 2022 22:19:22 +0100 Subject: [PATCH 078/406] Intersection : Support creation of multiple intersections from sim wells --- .../RicNewSimWellIntersectionFeature.cpp | 26 +++++++++---------- .../RimContextCommandBuilder.cpp | 1 + 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp index 9a54a35d3e..4ec8b7d5ea 100644 --- a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp +++ b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.cpp @@ -46,18 +46,18 @@ bool RicNewSimWellIntersectionFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicNewSimWellIntersectionFeature::onActionTriggered( bool isChecked ) { - std::vector collection; - caf::SelectionManager::instance()->objectsByType( &collection ); - CVF_ASSERT( collection.size() == 1 ); - - RimSimWellInView* simWell = collection[0]; - - RimEclipseView* eclView = nullptr; - simWell->firstAncestorOrThisOfType( eclView ); - CVF_ASSERT( eclView ); - - RicNewSimWellIntersectionCmd* cmd = new RicNewSimWellIntersectionCmd( eclView->intersectionCollection(), simWell ); - caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd ); + std::vector simWells; + caf::SelectionManager::instance()->objectsByType( &simWells ); + + for ( auto simWell : simWells ) + { + RimEclipseView* eclView = nullptr; + simWell->firstAncestorOrThisOfType( eclView ); + CVF_ASSERT( eclView ); + + auto* cmd = new RicNewSimWellIntersectionCmd( eclView->intersectionCollection(), simWell ); + caf::CmdExecCommandManager::instance()->processExecuteCommand( cmd ); + } } //-------------------------------------------------------------------------------------------------- @@ -103,7 +103,7 @@ void RicNewSimWellIntersectionCmd::redo() CVF_ASSERT( m_intersectionCollection ); CVF_ASSERT( m_simWell ); - RimExtrudedCurveIntersection* intersection = new RimExtrudedCurveIntersection(); + auto* intersection = new RimExtrudedCurveIntersection(); intersection->setName( m_simWell->name ); intersection->configureForSimulationWell( m_simWell ); diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 529297c594..3c68d87ac9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1182,6 +1182,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicEclipseWellShowWellCellFenceFeature"; menuBuilder << "Separator"; menuBuilder << "RicNewSimWellFractureFeature"; + menuBuilder << "RicNewSimWellIntersectionFeature"; } #ifdef USE_ODB_API else if ( dynamic_cast( firstUiItem ) ) From dc31a731adf85f24d7ad3fe5c350e8acedc5e057 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 11 Jan 2022 14:55:30 +0100 Subject: [PATCH 079/406] Summary Data Source Stepping : Reintroduce stepping for summary plot Data source stepping for multi plot is work in progress, and have disabled stepping for single summary plots. This commit will make it possible to do source stepping on single summary plots. --- .../Summary/RimSummaryPlot.cpp | 15 +------ .../Summary/RimSummaryPlotSourceStepping.cpp | 40 +++++-------------- .../Summary/RimSummaryPlotSourceStepping.h | 2 +- 3 files changed, 11 insertions(+), 46 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index f03fe528d3..ab7c3f2721 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2242,20 +2242,7 @@ void RimSummaryPlot::onCurveCollectionChanged( const SignalEmitter* emitter ) //-------------------------------------------------------------------------------------------------- RimSummaryPlotSourceStepping* RimSummaryPlot::sourceSteppingObjectForKeyEventHandling() const { - caf::PdmObjectHandle* selectedObj = - dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); - if ( selectedObj ) - { - RimEnsembleCurveSetCollection* ensembleCurveSetColl = nullptr; - selectedObj->firstAncestorOrThisOfType( ensembleCurveSetColl ); - - if ( ensembleCurveSetColl ) - { - return ensembleCurveSetCollection()->sourceSteppingObject(); - } - } - - return summaryCurveCollection()->sourceSteppingObject( RimSummaryDataSourceStepping::Axis::Y_AXIS ); + return m_sourceStepping; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index c33747fc3f..bef8b73527 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -159,7 +159,7 @@ void RimSummaryPlotSourceStepping::applyPrevOtherIdentifier() //-------------------------------------------------------------------------------------------------- std::vector RimSummaryPlotSourceStepping::fieldsToShowInToolbar() { - return computeVisibleFieldsAndSetFieldVisibility(); + return activeFieldsForDataSourceStepping(); } //-------------------------------------------------------------------------------------------------- @@ -167,15 +167,18 @@ std::vector RimSummaryPlotSourceStepping::fieldsToShowInTo //-------------------------------------------------------------------------------------------------- void RimSummaryPlotSourceStepping::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - auto visible = computeVisibleFieldsAndSetFieldVisibility(); + auto visible = activeFieldsForDataSourceStepping(); if ( visible.empty() ) { - m_placeholderForLabel.uiCapability()->setUiHidden( false ); + uiOrdering.add( &m_placeholderForLabel ); } - else + + for ( auto f : visible ) { - m_placeholderForLabel.uiCapability()->setUiHidden( true ); + uiOrdering.add( f ); } + + uiOrdering.skipRemainingFields(); } //-------------------------------------------------------------------------------------------------- @@ -728,21 +731,8 @@ std::set RimSummaryPlotSourceStepping::summaryCasesCurveCollect //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimSummaryPlotSourceStepping::computeVisibleFieldsAndSetFieldVisibility() +std::vector RimSummaryPlotSourceStepping::activeFieldsForDataSourceStepping() { - // Required to set all stepping controls hidden, as they show up in the property editor when selecting a plot - m_summaryCase.uiCapability()->setUiHidden( true ); - m_includeEnsembleCasesForCaseStepping.uiCapability()->setUiHidden( true ); - m_wellName.uiCapability()->setUiHidden( true ); - m_wellGroupName.uiCapability()->setUiHidden( true ); - m_region.uiCapability()->setUiHidden( true ); - m_quantity.uiCapability()->setUiHidden( true ); - m_ensemble.uiCapability()->setUiHidden( true ); - m_cellBlock.uiCapability()->setUiHidden( true ); - m_segment.uiCapability()->setUiHidden( true ); - m_completion.uiCapability()->setUiHidden( true ); - m_aquifer.uiCapability()->setUiHidden( true ); - std::vector fields; auto sumCases = summaryCasesCurveCollection(); @@ -753,8 +743,6 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi { m_summaryCase = *( sumCases.begin() ); - m_summaryCase.uiCapability()->setUiHidden( false ); - fields.push_back( &m_summaryCase ); m_includeEnsembleCasesForCaseStepping.uiCapability()->setUiHidden( false ); @@ -770,8 +758,6 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi { m_ensemble = *( ensembleColl.begin() ); - m_ensemble.uiCapability()->setUiHidden( false ); - fields.push_back( &m_ensemble ); } } @@ -814,7 +800,6 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi { QString txt = QString::fromStdString( *( analyzer.wellNames().begin() ) ); m_wellName = txt; - m_wellName.uiCapability()->setUiHidden( false ); fieldsCommonForAllCurves.push_back( &m_wellName ); } @@ -823,7 +808,6 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi { QString txt = QString::fromStdString( *( analyzer.wellGroupNames().begin() ) ); m_wellGroupName = txt; - m_wellGroupName.uiCapability()->setUiHidden( false ); fieldsCommonForAllCurves.push_back( &m_wellGroupName ); } @@ -831,7 +815,6 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi if ( analyzer.regionNumbers().size() == 1 ) { m_region = *( analyzer.regionNumbers().begin() ); - m_region.uiCapability()->setUiHidden( false ); fieldsCommonForAllCurves.push_back( &m_region ); } @@ -840,7 +823,6 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi { QString txt = QString::number( *( analyzer.wellSegmentNumbers( m_wellName().toStdString() ).begin() ) ); m_segment = txt; - m_segment.uiCapability()->setUiHidden( false ); fieldsCommonForAllCurves.push_back( &m_segment ); } @@ -849,7 +831,6 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi { QString txt = QString::fromStdString( *( analyzer.blocks().begin() ) ); m_cellBlock = txt; - m_cellBlock.uiCapability()->setUiHidden( false ); fieldsCommonForAllCurves.push_back( &m_cellBlock ); } @@ -858,7 +839,6 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi { QString txt = QString::fromStdString( *( analyzer.wellCompletions( m_wellName().toStdString() ).begin() ) ); m_completion = txt; - m_completion.uiCapability()->setUiHidden( false ); fieldsCommonForAllCurves.push_back( &m_completion ); } @@ -866,7 +846,6 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi if ( analyzer.aquifers().size() == 1 ) { m_aquifer = *( analyzer.aquifers().begin() ); - m_aquifer.uiCapability()->setUiHidden( false ); fieldsCommonForAllCurves.push_back( &m_aquifer ); } @@ -875,7 +854,6 @@ std::vector RimSummaryPlotSourceStepping::computeVisibleFi { QString txt = QString::fromStdString( analyzer.quantityNameForTitle() ); m_quantity = txt; - m_quantity.uiCapability()->setUiHidden( false ); fieldsCommonForAllCurves.push_back( &m_quantity ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index ea5250a512..22b36a16a5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -78,7 +78,7 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject std::set addressesForCurvesInPlot() const; std::set summaryCasesCurveCollection() const; - std::vector computeVisibleFieldsAndSetFieldVisibility(); + std::vector activeFieldsForDataSourceStepping(); std::set ensembleCollection() const; bool isXAxisStepping() const; From 9d4b7422e8568ab6ff90c5ed26b9fb565209d02b Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 13 Jan 2022 09:02:07 +0100 Subject: [PATCH 080/406] Show summary data as tree structure in explorer. (#8430) * Show summary data vectors in project explorer for both summary cases and ensembles. * Enable Drag to be able to drag'n'drop data vector into future summary plot * Make sure tree is refreshed on reload/replace operations * Provide case id and ensemble id in drag/drop object in addition to address --- ApplicationExeCode/Resources/DataVector.png | Bin 0 -> 337 bytes ApplicationExeCode/Resources/ResInsight.qrc | 1 + .../Commands/RicReloadSummaryCaseFeature.cpp | 1 + .../Commands/RicReplaceSummaryCaseFeature.cpp | 2 + .../RimMainPlotCollection.cpp | 2 +- .../Summary/CMakeLists_files.cmake | 2 + .../Summary/RimSummaryAddress.cpp | 79 +++++++- .../Summary/RimSummaryAddress.h | 46 +++-- .../Summary/RimSummaryAddressCollection.cpp | 190 ++++++++++++++++++ .../Summary/RimSummaryAddressCollection.h | 59 ++++++ .../Summary/RimSummaryCase.cpp | 42 ++++ .../ProjectDataModel/Summary/RimSummaryCase.h | 9 + .../Summary/RimSummaryCaseCollection.cpp | 71 ++++++- .../Summary/RimSummaryCaseCollection.h | 14 +- .../Summary/RimSummaryCaseMainCollection.cpp | 2 + .../UserInterface/RiuDragDrop.cpp | 3 +- 16 files changed, 502 insertions(+), 21 deletions(-) create mode 100644 ApplicationExeCode/Resources/DataVector.png create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h diff --git a/ApplicationExeCode/Resources/DataVector.png b/ApplicationExeCode/Resources/DataVector.png new file mode 100644 index 0000000000000000000000000000000000000000..17778a1002d061fe60dae5cc2e132094b85951ae GIT binary patch literal 337 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85rE|f-s}V*~jLjZ;&pYE&bne`n`Jc06&VT+g zrSVdaTHi){-x)8Kdw#0=Gi!nVAMr_br!Mj?J^oGV gzL51>`$rc3mnv){T;vu70Da8h>FVdQ&MBb@0LFEN#{d8T literal 0 HcmV?d00001 diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index 36cf73cb3c..ebd7275464 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -240,6 +240,7 @@ ComboBoxDown.svg ComboBoxUp.svg WellIntAnalysis.png + DataVector.png fs_CellFace.glsl diff --git a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp index 21918dc2b6..0bdf03d494 100644 --- a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp @@ -61,6 +61,7 @@ void RicReloadSummaryCaseFeature::onActionTriggered( bool isChecked ) { summaryCase->createSummaryReaderInterface(); summaryCase->createRftReaderInterface(); + summaryCase->refreshMetaData(); RicReplaceSummaryCaseFeature::updateRequredCalculatedCurves( summaryCase ); diff --git a/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp index dd39a039a9..6acb769081 100644 --- a/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp @@ -92,6 +92,8 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked ) summaryCase->updateAutoShortName(); summaryCase->createSummaryReaderInterface(); summaryCase->createRftReaderInterface(); + summaryCase->refreshMetaData(); + RiaLogging::info( QString( "Replaced summary data for %1" ).arg( oldSummaryHeaderFilename ) ); RicReplaceSummaryCaseFeature::updateRequredCalculatedCurves( summaryCase ); diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp index 33959f1883..503979b3c9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp @@ -347,7 +347,7 @@ void RimMainPlotCollection::ensureCalculationIdsAreAssigned() for ( RimSummaryAddress* adr : allAddresses ) { - adr->ensureIdIsAssigned(); + adr->ensureCalculationIdIsAssigned(); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake index c5b3d836f9..ea3b2fff7b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -41,6 +41,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryDataSourceStepping.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryNameHelper.h ${CMAKE_CURRENT_LIST_DIR}/RimMultipleSummaryPlotNameHelper.h + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressCollection.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -86,6 +87,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryDataSourceStepping.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryNameHelper.cpp ${CMAKE_CURRENT_LIST_DIR}/RimMultipleSummaryPlotNameHelper.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressCollection.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp index cea2e0e94a..932e938aea 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp @@ -58,6 +58,8 @@ CAF_PDM_SOURCE_INIT( RimSummaryAddress, "SummaryAddress" ); //-------------------------------------------------------------------------------------------------- RimSummaryAddress::RimSummaryAddress() { + CAF_PDM_InitObject( "SummaryAddress", ":/DataVector.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_category, "SummaryVarType", "Type" ); CAF_PDM_InitFieldNoDefault( &m_quantityName, "SummaryQuantityName", "Quantity" ); CAF_PDM_InitFieldNoDefault( &m_regionNumber, "SummaryRegion", "Region" ); @@ -73,6 +75,9 @@ RimSummaryAddress::RimSummaryAddress() CAF_PDM_InitFieldNoDefault( &m_isErrorResult, "IsErrorResult", "Is Error Result" ); CAF_PDM_InitFieldNoDefault( &m_calculationId, "CalculationId", "Calculation Id" ); + CAF_PDM_InitField( &m_caseId, "CaseId", -1, "CaseId" ); + CAF_PDM_InitField( &m_ensembleId, "EnsembleId", -1, "EnsembleId" ); + m_category = RifEclipseSummaryAddress::SUMMARY_INVALID; m_regionNumber = -1; m_regionNumber2 = -1; @@ -92,6 +97,20 @@ RimSummaryAddress::~RimSummaryAddress() { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryAddress* RimSummaryAddress::wrapFileReaderAddress( const RifEclipseSummaryAddress& addr, + int caseId /* = -1 */, + int ensembleId /* = -1 */ ) +{ + RimSummaryAddress* newAddress = new RimSummaryAddress(); + newAddress->setAddress( addr ); + newAddress->setCaseId( caseId ); + newAddress->setEnsembleId( ensembleId ); + return newAddress; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -112,6 +131,8 @@ void RimSummaryAddress::setAddress( const RifEclipseSummaryAddress& addr ) m_cellJ = addr.cellJ(); m_cellK = addr.cellK(); m_calculationId = addr.id(); + + setUiName( m_quantityName ); } //-------------------------------------------------------------------------------------------------- @@ -138,7 +159,7 @@ RifEclipseSummaryAddress RimSummaryAddress::address() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryAddress::ensureIdIsAssigned() +void RimSummaryAddress::ensureCalculationIdIsAssigned() { if ( m_category == RifEclipseSummaryAddress::SUMMARY_CALCULATED && m_calculationId == -1 ) { @@ -176,3 +197,59 @@ RiaDefines::PhaseType RimSummaryAddress::addressPhaseType() const } return RiaDefines::PhaseType::PHASE_NOT_APPLICABLE; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddress::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + uiOrdering.skipRemainingFields( true ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddress::setCaseId( int caseId ) +{ + m_caseId = caseId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimSummaryAddress::caseId() const +{ + return m_caseId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryAddress::quantityName() const +{ + return m_quantityName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddress::setEnsembleId( int ensembleId ) +{ + m_ensembleId = ensembleId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimSummaryAddress::ensembleId() const +{ + return m_ensembleId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryAddress::isEnsemble() const +{ + return m_ensembleId >= 0; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h index 7b54ba07ae..5a1fb208d3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h @@ -44,26 +44,44 @@ class RimSummaryAddress : public caf::PdmObject RimSummaryAddress(); ~RimSummaryAddress() override; + static RimSummaryAddress* + wrapFileReaderAddress( const RifEclipseSummaryAddress& addr, int caseId = -1, int ensembleId = -1 ); + void setAddress( const RifEclipseSummaryAddress& addr ); RifEclipseSummaryAddress address(); - void ensureIdIsAssigned(); + void setCaseId( int caseId ); + int caseId() const; + + void setEnsembleId( int ensembleId ); + int ensembleId() const; + bool isEnsemble() const; + + QString quantityName() const; + + void ensureCalculationIdIsAssigned(); RiaDefines::PhaseType addressPhaseType() const; +protected: + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + private: caf::PdmField> m_category; - caf::PdmField m_quantityName; - caf::PdmField m_regionNumber; - caf::PdmField m_regionNumber2; - caf::PdmField m_wellGroupName; - caf::PdmField m_wellName; - caf::PdmField m_wellSegmentNumber; - caf::PdmField m_lgrName; - caf::PdmField m_cellI; - caf::PdmField m_cellJ; - caf::PdmField m_cellK; - caf::PdmField m_aquiferNumber; - caf::PdmField m_isErrorResult; - caf::PdmField m_calculationId; + + caf::PdmField m_quantityName; + caf::PdmField m_regionNumber; + caf::PdmField m_regionNumber2; + caf::PdmField m_wellGroupName; + caf::PdmField m_wellName; + caf::PdmField m_wellSegmentNumber; + caf::PdmField m_lgrName; + caf::PdmField m_cellI; + caf::PdmField m_cellJ; + caf::PdmField m_cellK; + caf::PdmField m_aquiferNumber; + caf::PdmField m_isErrorResult; + caf::PdmField m_calculationId; + caf::PdmField m_caseId; + caf::PdmField m_ensembleId; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp new file mode 100644 index 0000000000..5be61624a9 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -0,0 +1,190 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimSummaryAddressCollection.h" + +#include "RifEclipseSummaryAddress.h" + +#include "RimSummaryAddress.h" + +#include "cafPdmUiTreeOrdering.h" + +CAF_PDM_SOURCE_INIT( RimSummaryAddressCollection, "RimSummaryAddressCollection" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryAddressCollection::RimSummaryAddressCollection() +{ + CAF_PDM_InitObject( "Folder", ":/Folder.png", "", "" ); + + CAF_PDM_InitFieldNoDefault( &m_adresses, "SummaryAddresses", "Addresses" ); + m_adresses.uiCapability()->setUiTreeHidden( true ); + + CAF_PDM_InitFieldNoDefault( &m_subfolders, "AddressSubfolders", "Subfolders" ); + m_subfolders.uiCapability()->setUiTreeHidden( true ); + + nameField()->uiCapability()->setUiHidden( true ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryAddressCollection::~RimSummaryAddressCollection() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryAddressCollection::hasDataVector( const QString quantityName ) const +{ + for ( auto& address : m_adresses ) + { + if ( address->quantityName() == quantityName ) return true; + } + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryAddressCollection::hasDataVector( const std::string quantityName ) const +{ + return hasDataVector( QString::fromStdString( quantityName ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddressCollection::addAddress( const RifEclipseSummaryAddress& address, int caseId, int ensembleId ) +{ + if ( !hasDataVector( address.quantityName() ) ) + { + m_adresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, caseId, ensembleId ) ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddressCollection::addToSubfolder( QString foldername, + const RifEclipseSummaryAddress& address, + int caseId, + int ensembleId ) +{ + RimSummaryAddressCollection* folder = getOrCreateSubfolder( foldername ); + folder->addAddress( address, caseId, ensembleId ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddressCollection::updateFolderStructure( const std::set& addresses, + int caseId, + int ensembleId ) +{ + if ( addresses.size() == 0 ) return; + + RimSummaryAddressCollection* misc = getOrCreateSubfolder( "Miscellaneous" ); + RimSummaryAddressCollection* fields = getOrCreateSubfolder( "Field" ); + RimSummaryAddressCollection* regions = getOrCreateSubfolder( "Regions" ); + RimSummaryAddressCollection* wells = getOrCreateSubfolder( "Wells" ); + RimSummaryAddressCollection* groups = getOrCreateSubfolder( "Groups" ); + + for ( const auto& address : addresses ) + { + switch ( address.category() ) + { + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_MISC: + misc->addAddress( address, caseId, ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_FIELD: + fields->addAddress( address, caseId, ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_REGION: + regions->addToSubfolder( QString::number( address.regionNumber() ), address, caseId, ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_GROUP: + groups->addToSubfolder( QString::fromStdString( address.wellGroupName() ), address, caseId, ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL: + wells->addToSubfolder( QString::fromStdString( address.wellName() ), address, caseId, ensembleId ); + break; + + default: + continue; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryAddressCollection* RimSummaryAddressCollection::getOrCreateSubfolder( const QString folderName ) +{ + for ( auto& folder : m_subfolders ) + { + if ( folder->name() == folderName ) + { + return folder; + } + } + + RimSummaryAddressCollection* newFolder = new RimSummaryAddressCollection(); + newFolder->setName( folderName ); + m_subfolders.push_back( newFolder ); + return newFolder; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddressCollection::clear() +{ + m_adresses.clear(); + m_subfolders.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryAddressCollection::isEmpty() const +{ + return ( ( m_adresses.size() == 0 ) && ( m_subfolders.size() == 0 ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddressCollection::updateUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering ) const +{ + for ( auto& folder : m_subfolders() ) + { + uiTreeOrdering.add( folder ); + } + + for ( auto& address : m_adresses() ) + { + uiTreeOrdering.add( address ); + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h new file mode 100644 index 0000000000..c4f2619b40 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include "RimNamedObject.h" + +#include "cafPdmChildArrayField.h" + +#include +#include +#include + +class RimSummaryAddress; +class RifEclipseSummaryAddress; + +class RimSummaryAddressCollection : public RimNamedObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimSummaryAddressCollection(); + ~RimSummaryAddressCollection() override; + + void updateFolderStructure( const std::set& addresses, int caseid, int ensembleId = -1 ); + + void clear(); + + bool isEmpty() const; + + void updateUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering ) const; + +private: + RimSummaryAddressCollection* getOrCreateSubfolder( const QString folderName ); + + bool hasDataVector( const QString quantityName ) const; + bool hasDataVector( const std::string quantityName ) const; + + void addAddress( const RifEclipseSummaryAddress& address, int caseId, int ensembleId = -1 ); + void addToSubfolder( QString foldername, const RifEclipseSummaryAddress& address, int caseId, int ensembleId = -1 ); + +private: + caf::PdmChildArrayField m_adresses; + caf::PdmChildArrayField m_subfolders; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp index 86f3e451a6..d715f50ad1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp @@ -24,12 +24,17 @@ #include "RicfCommandObject.h" #include "RifSummaryReaderInterface.h" +#include "RifEclipseSummaryAddress.h" + #include "RimMainPlotCollection.h" #include "RimProject.h" +#include "RimSummaryAddress.h" +#include "RimSummaryAddressCollection.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryPlotCollection.h" #include "cafPdmFieldScriptingCapability.h" +#include "cafPdmUiTreeOrdering.h" #include "cvfAssert.h" @@ -62,6 +67,11 @@ RimSummaryCase::RimSummaryCase() m_caseId.uiCapability()->setUiReadOnly( true ); m_caseId.capability()->setIOWriteable( false ); + CAF_PDM_InitFieldNoDefault( &m_dataVectorFolders, "DataVectorFolders", "Data Folders" ); + m_dataVectorFolders = new RimSummaryAddressCollection(); + m_dataVectorFolders.uiCapability()->setUiHidden( true ); + m_dataVectorFolders.xmlCapability()->disableIO(); + m_isObservedData = false; } @@ -200,11 +210,32 @@ QString RimSummaryCase::errorMessagesFromReader() return QString(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCase::buildChildNodes() +{ + m_dataVectorFolders->clear(); + + RifSummaryReaderInterface* reader = summaryReader(); + if ( !reader ) return; + + m_dataVectorFolders->updateFolderStructure( reader->allResultAddresses(), m_caseId ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimSummaryCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) { + if ( !ensemble() ) + { + if ( m_dataVectorFolders->isEmpty() ) buildChildNodes(); + m_dataVectorFolders->updateUiTreeOrdering( uiTreeOrdering ); + } + + uiTreeOrdering.skipRemainingChildren( true ); + updateTreeItemName(); } @@ -269,6 +300,8 @@ void RimSummaryCase::initAfterRead() } updateOptionSensitivity(); + + refreshMetaData(); } //-------------------------------------------------------------------------------------------------- @@ -361,3 +394,12 @@ int RimSummaryCase::caseId() const { return m_caseId(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCase::refreshMetaData() +{ + buildChildNodes(); + updateConnectedEditors(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h index 999d30a4ee..a87b9352cb 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h @@ -23,6 +23,8 @@ #include "RimCaseDisplayNameTools.h" #include "cafFilePath.h" +#include "cafPdmChildArrayField.h" +#include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" @@ -31,6 +33,7 @@ class RifReaderRftInterface; class RifSummaryReaderInterface; class RimSummaryCaseCollection; +class RimSummaryAddressCollection; //================================================================================================== // @@ -63,6 +66,8 @@ class RimSummaryCase : public caf::PdmObject void updateAutoShortName(); void updateOptionSensitivity(); + void refreshMetaData(); + virtual void createSummaryReaderInterface() = 0; virtual void createRftReaderInterface() {} virtual RifSummaryReaderInterface* summaryReader() = 0; @@ -93,11 +98,15 @@ class RimSummaryCase : public caf::PdmObject static QString uniqueShortNameForEnsembleCase( RimSummaryCase* summaryCase ); static QString uniqueShortNameForSummaryCase( RimSummaryCase* summaryCase ); + void buildChildNodes(); + protected: caf::PdmField m_displayName; caf::PdmField m_displayNameOption; caf::PdmField m_summaryHeaderFilename; + caf::PdmChildField m_dataVectorFolders; + bool m_isObservedData; caf::PdmField m_caseId; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index af8a74a258..3c361f6f38 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -31,6 +31,7 @@ #include "RimEnsembleCurveSet.h" #include "RimGridSummaryCase.h" #include "RimProject.h" +#include "RimSummaryAddressCollection.h" #include "RimSummaryCase.h" #include "RifReaderEclipseRft.h" @@ -38,6 +39,7 @@ #include "RifSummaryReaderInterface.h" #include "cafPdmFieldScriptingCapability.h" +#include "cafPdmUiTreeOrdering.h" #include @@ -124,6 +126,13 @@ RimSummaryCaseCollection::RimSummaryCaseCollection() m_ensembleId.uiCapability()->setUiReadOnly( true ); m_ensembleId.capability()->setIOWriteable( false ); + CAF_PDM_InitFieldNoDefault( &m_dataVectorFolders, "DataVectorFolders", "Data Folders" ); + m_dataVectorFolders = new RimSummaryAddressCollection(); + m_dataVectorFolders.uiCapability()->setUiHidden( true ); + m_dataVectorFolders.uiCapability()->setUiTreeHidden( true ); + m_dataVectorFolders->uiCapability()->setUiTreeHidden( true ); + m_dataVectorFolders.xmlCapability()->disableIO(); + m_statisticsEclipseRftReader = new RifReaderEnsembleStatisticsRft( this ); m_commonAddressCount = 0; @@ -158,6 +167,8 @@ void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase ) if ( dynamic_cast( summaryCase ) == nullptr ) calculateEnsembleParametersIntersectionHash(); } + + buildChildNodes(); } //-------------------------------------------------------------------------------------------------- @@ -188,6 +199,8 @@ void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase ) } updateReferringCurveSets(); + + buildChildNodes(); } //-------------------------------------------------------------------------------------------------- @@ -237,6 +250,8 @@ void RimSummaryCaseCollection::setAsEnsemble( bool isEnsemble ) validateEnsembleCases( allSummaryCases() ); calculateEnsembleParametersIntersectionHash(); } + + refreshMetaData(); } } @@ -872,7 +887,11 @@ caf::PdmFieldHandle* RimSummaryCaseCollection::userDescriptionField() //-------------------------------------------------------------------------------------------------- void RimSummaryCaseCollection::onLoadDataAndUpdate() { - if ( m_isEnsemble ) calculateEnsembleParametersIntersectionHash(); + if ( m_isEnsemble ) + { + calculateEnsembleParametersIntersectionHash(); + buildChildNodes(); + } } //-------------------------------------------------------------------------------------------------- @@ -933,6 +952,8 @@ void RimSummaryCaseCollection::initAfterRead() } updateIcon(); + + buildChildNodes(); } //-------------------------------------------------------------------------------------------------- @@ -969,6 +990,30 @@ void RimSummaryCaseCollection::defineUiOrdering( QString uiConfigName, caf::PdmU uiOrdering.skipRemainingFields( true ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCaseCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, + QString uiConfigName /*= ""*/ ) +{ + if ( m_isEnsemble() ) + { + if ( m_dataVectorFolders->isEmpty() ) + { + buildChildNodes(); + } + m_dataVectorFolders->updateUiTreeOrdering( uiTreeOrdering ); + + auto subnode = uiTreeOrdering.add( "Realizations", ":/Folder.png" ); + for ( auto& smcase : m_cases ) + { + subnode->add( smcase ); + } + + uiTreeOrdering.skipRemainingChildren( true ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1008,3 +1053,27 @@ bool RimSummaryCaseCollection::hasEnsembleParameters() const return false; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCaseCollection::buildChildNodes() +{ + m_dataVectorFolders->clear(); + + for ( auto& smcase : m_cases ) + { + m_dataVectorFolders->updateFolderStructure( smcase->summaryReader()->allResultAddresses(), + smcase->caseId(), + m_ensembleId ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCaseCollection::refreshMetaData() +{ + buildChildNodes(); + updateConnectedEditors(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h index d5c389cfcc..394050c9e3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h @@ -28,6 +28,7 @@ #include "RimObjectiveFunction.h" #include "cafPdmChildArrayField.h" +#include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmProxyValueField.h" @@ -40,6 +41,7 @@ class RifReaderRftInterface; class RifReaderEnsembleStatisticsRft; class RimSummaryCase; +class RimSummaryAddressCollection; //================================================================================================== /// @@ -100,6 +102,8 @@ class RimSummaryCaseCollection : public caf::PdmObject RiaDefines::EclipseUnitSystem unitSystem() const; + void refreshMetaData(); + private: RigEnsembleParameter createEnsembleParameter( const QString& paramName ) const; static void sortByBinnedVariation( std::vector& parameterVector ); @@ -114,18 +118,22 @@ class RimSummaryCaseCollection : public caf::PdmObject void onCaseNameChanged( const SignalEmitter* emitter ); + void buildChildNodes(); + protected: virtual void onLoadDataAndUpdate(); void updateReferringCurveSets(); void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void setNameAsReadOnly(); caf::PdmChildArrayField m_cases; private: - caf::PdmField m_name; - caf::PdmProxyValueField m_nameAndItemCount; - caf::PdmField m_isEnsemble; + caf::PdmField m_name; + caf::PdmProxyValueField m_nameAndItemCount; + caf::PdmField m_isEnsemble; + caf::PdmChildField m_dataVectorFolders; cvf::ref m_statisticsEclipseRftReader; caf::PdmField m_ensembleId; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index c35ae80254..dd13a74e2a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -628,6 +628,7 @@ std::vector RimSummaryCaseMainCollection::createSummaryCasesFro newSumCase->setAssociatedEclipseCase( eclCase ); newSumCase->updateOptionSensitivity(); project->assignCaseIdToSummaryCase( newSumCase ); + newSumCase->refreshMetaData(); sumCases.push_back( newSumCase ); } else @@ -644,6 +645,7 @@ std::vector RimSummaryCaseMainCollection::createSummaryCasesFro newSumCase->setSummaryHeaderFileName( fileInfo.summaryFileName() ); newSumCase->updateOptionSensitivity(); project->assignCaseIdToSummaryCase( newSumCase ); + newSumCase->refreshMetaData(); sumCases.push_back( newSumCase ); } diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index 88bd676b81..999d8002c1 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -33,6 +33,7 @@ #include "RimMimeData.h" #include "RimMultiPlot.h" #include "RimPlot.h" +#include "RimSummaryAddress.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" @@ -230,7 +231,7 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const if ( dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || - dynamic_cast( uiItem ) ) + dynamic_cast( uiItem ) || dynamic_cast( uiItem ) ) { // TODO: Remember to handle reservoir holding the main grid itemflags |= Qt::ItemIsDragEnabled; From 376451da2eeab086c9b785a9cebf13317c7a5c5e Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 14 Jan 2022 16:44:00 +0100 Subject: [PATCH 081/406] Update GUI text for faults --- .../ProjectDataModel/Faults/RimFaultInViewCollection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp index 0e181e9f80..c343a8c292 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp @@ -75,7 +75,7 @@ RimFaultInViewCollection::RimFaultInViewCollection() CAF_PDM_InitField( &m_showFaultsOutsideFilters, "ShowFaultsOutsideFilters", true, "Show Faults Outside Filters" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showFaultsOutsideFilters ); - CAF_PDM_InitField( &m_onlyShowWithNeighbor, "OnlyShowWithDefNeighbor", false, "Only Show Faces With Defined Cell Neighbor" ); + CAF_PDM_InitField( &m_onlyShowWithNeighbor, "OnlyShowWithDefNeighbor", false, "Show Only Faces with Juxtaposition" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_onlyShowWithNeighbor ); CAF_PDM_InitField( &faultResult, From d9bb82de91c99dd49e8b798ecc975f2f7f7a6f0f Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Sun, 16 Jan 2022 23:56:00 +0100 Subject: [PATCH 082/406] Merge pull request #8447 from OPM/intersection_filterupdate Intersection: depth filter updates --- ...udedCurveIntersectionGeometryGenerator.cpp | 4 +- .../RimExtrudedCurveIntersection.cpp | 144 +++++++++++++----- .../RimExtrudedCurveIntersection.h | 20 ++- .../RimIntersectionCollection.cpp | 128 ++++++++++------ .../Intersections/RimIntersectionCollection.h | 8 +- .../Intersections/RimIntersectionEnums.cpp | 11 +- .../Intersections/RimIntersectionEnums.h | 9 +- 7 files changed, 216 insertions(+), 108 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp index 74567dbd98..50ae5d6874 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp @@ -292,8 +292,8 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays() const double gridRadius = gridBBox.radius(); // set up our horizontal cut planes - const double topDepth = -1.0 * m_intersection->topDepth( gridRadius ); - const double bottomDepth = -1.0 * m_intersection->bottomDepth( gridRadius ); + const double topDepth = -1.0 * m_intersection->upperFilterDepth( gridRadius ); + const double bottomDepth = -1.0 * m_intersection->lowerFilterDepth( gridRadius ); std::array corners; gridBBox.cornerVertices( corners.data() ); diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp index 7397a9668d..1372cd0315 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp @@ -244,25 +244,30 @@ RimExtrudedCurveIntersection::RimExtrudedCurveIntersection() m_surfaceIntersections = new RimSurfaceIntersectionCollection; m_surfaceIntersections->objectChanged.connect( this, &RimExtrudedCurveIntersection::onSurfaceIntersectionsChanged ); - CAF_PDM_InitField( &m_depthThreshold, "DepthThreshold", 2000.0, "Threshold" ); - m_depthThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + CAF_PDM_InitField( &m_depthUpperThreshold, "UpperThreshold", 2000.0, "Upper Threshold" ); + m_depthUpperThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_depthDisplayType, "DepthDisplayType", "Intersection Display Type" ); + CAF_PDM_InitField( &m_depthLowerThreshold, "LowerThreshold", 3000.0, "Lower Threshold" ); + m_depthLowerThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_collectionDepthThreshold, "CollectionDepthThreshold", "Collection Threshold" ); - m_collectionDepthThreshold.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_depthFilterType, "DepthFilter", "Depth Filter" ); + + CAF_PDM_InitFieldNoDefault( &m_collectionUpperThreshold, "CollectionUpperThreshold", "Collection Upper Threshold" ); + m_collectionUpperThreshold.uiCapability()->setUiHidden( true ); + + CAF_PDM_InitFieldNoDefault( &m_collectionLowerThreshold, "CollectionLowerThreshold", "Collection Lower Threshold" ); + m_collectionLowerThreshold.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &m_depthThresholdOverridden, "ThresholdOverridden", false, - "Depth Threshold is Controlled by Intersection Collection" ); - m_depthThresholdOverridden.uiCapability()->setUiReadOnly( true ); + "Depth Filter is Controlled by Intersection Collection" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_depthThresholdOverridden ); - CAF_PDM_InitFieldNoDefault( &m_collectionDepthDisplayType, - "CollectionDepthDisplayType", - "Collection Controlled Display Type" ); - m_collectionDepthDisplayType.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_collectionDepthFilterType, + "CollectionDepthFilterType", + "Collection Controlled Filter Type" ); + m_collectionDepthFilterType.uiCapability()->setUiHidden( true ); setDeletable( true ); } @@ -301,51 +306,87 @@ void RimExtrudedCurveIntersection::setName( const QString& newName ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RimExtrudedCurveIntersection::topDepth( double sceneRadius ) const +double RimExtrudedCurveIntersection::upperFilterDepth( double sceneRadius ) const { if ( m_depthThresholdOverridden ) { - if ( m_collectionDepthDisplayType == RimIntersectionDepthCutEnum::INTERSECT_SHOW_BELOW ) - return m_collectionDepthThreshold; - return -sceneRadius; + switch ( m_collectionDepthFilterType() ) + { + case RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW: + case RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN: + return m_collectionUpperThreshold; + + case RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE: + case RimIntersectionFilterEnum::INTERSECT_FILTER_NONE: + default: + return -sceneRadius; + } } - if ( m_depthDisplayType == RimIntersectionDepthCutEnum::INTERSECT_SHOW_BELOW ) + switch ( m_depthFilterType() ) { - return m_depthThreshold; + case RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW: + case RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN: + return m_depthUpperThreshold; + + case RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE: + case RimIntersectionFilterEnum::INTERSECT_FILTER_NONE: + default: + return -sceneRadius; } - return -sceneRadius; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RimExtrudedCurveIntersection::bottomDepth( double sceneRadius ) const +double RimExtrudedCurveIntersection::lowerFilterDepth( double sceneRadius ) const { if ( m_depthThresholdOverridden ) { - if ( m_collectionDepthDisplayType == RimIntersectionDepthCutEnum::INTERSECT_SHOW_ABOVE ) - return m_collectionDepthThreshold; - return sceneRadius; + switch ( m_collectionDepthFilterType() ) + { + case RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE: + case RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN: + return m_collectionLowerThreshold; + + case RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW: + case RimIntersectionFilterEnum::INTERSECT_FILTER_NONE: + default: + return sceneRadius; + } } - if ( m_depthDisplayType == RimIntersectionDepthCutEnum::INTERSECT_SHOW_ABOVE ) + switch ( m_depthFilterType() ) { - return m_depthThreshold; + case RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE: + case RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN: + return m_depthLowerThreshold; + + case RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW: + case RimIntersectionFilterEnum::INTERSECT_FILTER_NONE: + default: + return sceneRadius; } - return sceneRadius; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimExtrudedCurveIntersection::setDepthOverride( bool collectionOverride, - double depthThreshold, - RimIntersectionDepthCutEnum displayType ) +void RimExtrudedCurveIntersection::setDepthOverride( bool collectionOverride ) { - m_depthThresholdOverridden = collectionOverride; - m_collectionDepthThreshold = depthThreshold; - m_collectionDepthDisplayType = displayType; + m_depthThresholdOverridden = collectionOverride; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimExtrudedCurveIntersection::setDepthOverrideParameters( double upperThreshold, + double lowerThreshold, + RimIntersectionFilterEnum filterType ) +{ + m_collectionUpperThreshold = upperThreshold; + m_collectionLowerThreshold = lowerThreshold; + m_collectionDepthFilterType = filterType; } //-------------------------------------------------------------------------------------------------- @@ -359,7 +400,9 @@ void RimExtrudedCurveIntersection::fieldChangedByUi( const caf::PdmFieldHandle* changedField == &m_wellPath || changedField == &m_simulationWell || changedField == &m_branchIndex || changedField == &m_extentLength || changedField == &m_lengthUp || changedField == &m_lengthDown || changedField == &m_showInactiveCells || changedField == &m_useSeparateDataSource || - changedField == &m_separateDataSource || changedField == &m_depthThreshold || changedField == &m_depthDisplayType ) + changedField == &m_separateDataSource || changedField == &m_depthUpperThreshold || + changedField == &m_depthLowerThreshold || changedField == &m_depthThresholdOverridden || + changedField == &m_depthFilterType ) { rebuildGeometryAndScheduleCreateDisplayModel(); } @@ -466,6 +509,7 @@ void RimExtrudedCurveIntersection::defineUiOrdering( QString uiConfigName, caf:: } caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup( "Options" ); + optionsGroup->setCollapsedByDefault( true ); if ( type() == CrossSectionEnum::CS_AZIMUTHLINE ) { @@ -497,16 +541,38 @@ void RimExtrudedCurveIntersection::defineUiOrdering( QString uiConfigName, caf:: if ( eclipseView() ) { + auto filterGroup = uiOrdering.addNewGroup( "Depth Filter" ); if ( m_depthThresholdOverridden() ) { - optionsGroup->add( &m_depthThresholdOverridden ); + filterGroup->add( &m_depthThresholdOverridden ); } else { - optionsGroup->add( &m_depthDisplayType ); - optionsGroup->add( &m_depthThreshold ); - m_depthThreshold.uiCapability()->setUiReadOnly( m_depthDisplayType() == - RimIntersectionDepthCutEnum ::INTERSECT_SHOW_ALL ); + filterGroup->add( &m_depthFilterType ); + + switch ( m_depthFilterType() ) + { + case RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW: + m_depthUpperThreshold.uiCapability()->setUiName( "Depth" ); + filterGroup->add( &m_depthUpperThreshold ); + break; + + case RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN: + m_depthUpperThreshold.uiCapability()->setUiName( "Upper Depth" ); + filterGroup->add( &m_depthUpperThreshold ); + m_depthLowerThreshold.uiCapability()->setUiName( "Lower Depth" ); + filterGroup->add( &m_depthLowerThreshold ); + break; + + case RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE: + m_depthLowerThreshold.uiCapability()->setUiName( "Depth" ); + filterGroup->add( &m_depthLowerThreshold ); + break; + + case RimIntersectionFilterEnum::INTERSECT_FILTER_NONE: + default: + break; + } } } @@ -891,11 +957,9 @@ void RimExtrudedCurveIntersection::setPushButtonText( bool buttonEnable, caf::Pd //-------------------------------------------------------------------------------------------------- void RimExtrudedCurveIntersection::setBaseColor( bool enable, caf::PdmUiListEditorAttribute* attribute ) { - // if ( attribute && enable ) if ( attribute ) { attribute->m_qssState = enable ? "ExternalInput" : QString(); - // attribute->m_baseColor.setRgb( 255, 220, 255 ); } } @@ -921,7 +985,7 @@ void RimExtrudedCurveIntersection::defineEditorAttribute( const caf::PdmFieldHan doubleSliderAttrib->m_maximum = 180; doubleSliderAttrib->m_sliderTickCount = 180; } - else if ( field == &m_depthThreshold ) + else if ( ( field == &m_depthUpperThreshold ) || ( field == &m_depthLowerThreshold ) ) { RimEclipseView* eclView = eclipseView(); diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h index 562d5770ef..7369089e52 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h @@ -78,9 +78,11 @@ class RimExtrudedCurveIntersection : public RimIntersection QString name() const override; void setName( const QString& newName ); - double topDepth( double sceneRadius ) const; - double bottomDepth( double sceneRadius ) const; - void setDepthOverride( bool collectionOverride, double depthThreshold, RimIntersectionDepthCutEnum displayType ); + double upperFilterDepth( double sceneRadius ) const; + double lowerFilterDepth( double sceneRadius ) const; + + void setDepthOverride( bool collectionOverride ); + void setDepthOverrideParameters( double upperThreshold, double lowerThreshold, RimIntersectionFilterEnum filterType ); RimExtrudedCurveIntersection::CrossSectionEnum type() const; RimExtrudedCurveIntersection::CrossSectionDirEnum direction() const; @@ -163,12 +165,14 @@ class RimExtrudedCurveIntersection : public RimIntersection private: caf::PdmField m_name; - caf::PdmField> m_depthDisplayType; - caf::PdmField m_depthThreshold; + caf::PdmField> m_depthFilterType; + caf::PdmField m_depthUpperThreshold; + caf::PdmField m_depthLowerThreshold; - caf::PdmField m_depthThresholdOverridden; - caf::PdmField m_collectionDepthThreshold; - caf::PdmField> m_collectionDepthDisplayType; + caf::PdmField m_depthThresholdOverridden; + caf::PdmField m_collectionUpperThreshold; + caf::PdmField m_collectionLowerThreshold; + caf::PdmField> m_collectionDepthFilterType; caf::PdmField> m_type; caf::PdmField> m_direction; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp index f0946ddece..8fa52c288f 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp @@ -61,13 +61,16 @@ RimIntersectionCollection::RimIntersectionCollection() CAF_PDM_InitField( &isActive, "Active", true, "Active" ); isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_collectionDepthThreshold, "CollectionDepthThreshold", "Threshold" ); - m_collectionDepthThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + CAF_PDM_InitFieldNoDefault( &m_depthUpperThreshold, "UpperDepthThreshold", "Upper Threshold" ); + m_depthUpperThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_depthThresholdOverridden, "ThresholdOverridden", false, "Override Intersection Display Settings" ); + CAF_PDM_InitFieldNoDefault( &m_depthLowerThreshold, "LowerDepthThreshold", "Lower Threshold" ); + m_depthLowerThreshold.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleSliderEditor::uiEditorTypeName() ); + + CAF_PDM_InitField( &m_depthThresholdOverridden, "DepthFilterOverride", false, "Override Intersection Depth Filters" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_depthThresholdOverridden ); - CAF_PDM_InitFieldNoDefault( &m_collectionDepthDisplayType, "CollectionDepthDisplayType", "Intersection Display Type" ); + CAF_PDM_InitFieldNoDefault( &m_depthFilterType, "CollectionDepthFilterType", "Depth Filter Type" ); } //-------------------------------------------------------------------------------------------------- @@ -280,19 +283,15 @@ void RimIntersectionCollection::appendIntersectionAndUpdate( RimExtrudedCurveInt { m_intersections.push_back( intersection ); - intersection->setDepthOverride( m_depthThresholdOverridden, m_collectionDepthThreshold, m_collectionDepthDisplayType() ); + intersection->setDepthOverride( m_depthThresholdOverridden ); + intersection->setDepthOverrideParameters( m_depthUpperThreshold, m_depthLowerThreshold, m_depthFilterType() ); syncronize2dIntersectionViews(); updateConnectedEditors(); Riu3DMainWindowTools::selectAsCurrentItem( intersection, allowActiveViewChange ); - Rim3dView* rimView = nullptr; - firstAncestorOrThisOfType( rimView ); - if ( rimView ) - { - rimView->scheduleCreateDisplayModelAndRedraw(); - } + rebuild3dView(); } //-------------------------------------------------------------------------------------------------- @@ -300,7 +299,8 @@ void RimIntersectionCollection::appendIntersectionAndUpdate( RimExtrudedCurveInt //-------------------------------------------------------------------------------------------------- void RimIntersectionCollection::appendIntersectionNoUpdate( RimExtrudedCurveIntersection* intersection ) { - intersection->setDepthOverride( m_depthThresholdOverridden, m_collectionDepthThreshold, m_collectionDepthDisplayType() ); + intersection->setDepthOverride( m_depthThresholdOverridden ); + intersection->setDepthOverrideParameters( m_depthUpperThreshold, m_depthLowerThreshold, m_depthFilterType() ); m_intersections.push_back( intersection ); } @@ -338,12 +338,7 @@ void RimIntersectionCollection::appendIntersectionBoxAndUpdate( RimBoxIntersecti updateConnectedEditors(); Riu3DMainWindowTools::selectAsCurrentItem( intersectionBox, false ); - Rim3dView* rimView = nullptr; - firstAncestorOrThisOfType( rimView ); - if ( rimView ) - { - rimView->scheduleCreateDisplayModelAndRedraw(); - } + rebuild3dView(); } //-------------------------------------------------------------------------------------------------- @@ -361,32 +356,41 @@ void RimIntersectionCollection::fieldChangedByUi( const caf::PdmFieldHandle* cha const QVariant& oldValue, const QVariant& newValue ) { + bool rebuildView = false; + if ( changedField == &isActive ) { updateUiIconFromToggleField(); - - Rim3dView* rimView = nullptr; - firstAncestorOrThisOfType( rimView ); - if ( rimView ) - { - rimView->scheduleCreateDisplayModelAndRedraw(); - } + rebuildView = true; } - if ( ( changedField == &m_collectionDepthThreshold ) || ( changedField == &m_depthThresholdOverridden ) || - ( changedField == &m_collectionDepthDisplayType ) ) + if ( changedField == &m_depthThresholdOverridden ) { for ( RimExtrudedCurveIntersection* cs : m_intersections ) { - cs->setDepthOverride( m_depthThresholdOverridden, m_collectionDepthThreshold, m_collectionDepthDisplayType() ); + cs->setDepthOverride( m_depthThresholdOverridden ); + if ( m_depthThresholdOverridden() ) + { + cs->setDepthOverrideParameters( m_depthUpperThreshold, m_depthLowerThreshold, m_depthFilterType() ); + } cs->rebuildGeometryAndScheduleCreateDisplayModel(); } + rebuildView = true; + } - Rim3dView* rimView = nullptr; - firstAncestorOrThisOfType( rimView ); - if ( rimView ) + if ( ( changedField == &m_depthUpperThreshold ) || ( changedField == &m_depthLowerThreshold ) || + ( changedField == &m_depthFilterType ) ) + { + for ( RimExtrudedCurveIntersection* cs : m_intersections ) { - rimView->scheduleCreateDisplayModelAndRedraw(); + cs->setDepthOverrideParameters( m_depthUpperThreshold, m_depthLowerThreshold, m_depthFilterType() ); + cs->rebuildGeometryAndScheduleCreateDisplayModel(); } + rebuildView = true; + } + + if ( rebuildView ) + { + rebuild3dView(); } } @@ -397,13 +401,7 @@ void RimIntersectionCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* std::vector& referringObjects ) { syncronize2dIntersectionViews(); - - Rim3dView* rimView = nullptr; - firstAncestorOrThisOfType( rimView ); - if ( rimView ) - { - rimView->scheduleCreateDisplayModelAndRedraw(); - } + rebuild3dView(); } //-------------------------------------------------------------------------------------------------- @@ -443,13 +441,38 @@ void RimIntersectionCollection::defineUiOrdering( QString uiConfigName, caf::Pdm { if ( eclipseView() ) { - caf::PdmUiGroup* optionsGroup = uiOrdering.addNewGroup( "Curve Intersections" ); + caf::PdmUiGroup* filterGroup = uiOrdering.addNewGroup( "Depth Filter - Curve Intersections" ); + + m_depthFilterType.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() ); + m_depthUpperThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() ); + m_depthLowerThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() ); - optionsGroup->add( &m_depthThresholdOverridden ); - optionsGroup->add( &m_collectionDepthDisplayType ); - optionsGroup->add( &m_collectionDepthThreshold ); - m_collectionDepthDisplayType.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() ); - m_collectionDepthThreshold.uiCapability()->setUiReadOnly( !m_depthThresholdOverridden() ); + filterGroup->add( &m_depthThresholdOverridden ); + filterGroup->add( &m_depthFilterType ); + + switch ( m_depthFilterType() ) + { + case RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW: + m_depthUpperThreshold.uiCapability()->setUiName( "Depth" ); + filterGroup->add( &m_depthUpperThreshold ); + break; + + case RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN: + m_depthUpperThreshold.uiCapability()->setUiName( "Upper Depth" ); + filterGroup->add( &m_depthUpperThreshold ); + m_depthLowerThreshold.uiCapability()->setUiName( "Lower Depth" ); + filterGroup->add( &m_depthLowerThreshold ); + break; + + case RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE: + m_depthLowerThreshold.uiCapability()->setUiName( "Depth" ); + filterGroup->add( &m_depthLowerThreshold ); + break; + + case RimIntersectionFilterEnum::INTERSECT_FILTER_NONE: + default: + break; + } } uiOrdering.skipRemainingFields( true ); @@ -465,7 +488,7 @@ void RimIntersectionCollection::defineEditorAttribute( const caf::PdmFieldHandle auto* doubleSliderAttrib = dynamic_cast( attribute ); if ( doubleSliderAttrib ) { - if ( field == &m_collectionDepthThreshold ) + if ( ( field == &m_depthUpperThreshold ) || ( field == &m_depthLowerThreshold ) ) { RimEclipseView* eclView = eclipseView(); @@ -489,3 +512,16 @@ RimEclipseView* RimIntersectionCollection::eclipseView() const firstAncestorOrThisOfType( eclipseView ); return eclipseView; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIntersectionCollection::rebuild3dView() const +{ + Rim3dView* rimView = nullptr; + firstAncestorOrThisOfType( rimView ); + if ( rimView ) + { + rimView->scheduleCreateDisplayModelAndRedraw(); + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h index 5aea710d5c..d15a23c0d4 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h @@ -95,11 +95,13 @@ class RimIntersectionCollection : public caf::PdmObject private: RimEclipseView* eclipseView() const; + void rebuild3dView() const; caf::PdmChildArrayField m_intersections; caf::PdmChildArrayField m_intersectionBoxes; - caf::PdmField m_depthThresholdOverridden; - caf::PdmField m_collectionDepthThreshold; - caf::PdmField> m_collectionDepthDisplayType; + caf::PdmField m_depthThresholdOverridden; + caf::PdmField m_depthUpperThreshold; + caf::PdmField m_depthLowerThreshold; + caf::PdmField> m_depthFilterType; }; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.cpp index f69d7cccbc..3c57dcf5db 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.cpp @@ -23,12 +23,13 @@ namespace caf { template <> -void caf::AppEnum::setUp() +void caf::AppEnum::setUp() { - addItem( RimIntersectionDepthCutEnum::INTERSECT_SHOW_ALL, "INTERSECT_SHOW_ALL", "Show All" ); - addItem( RimIntersectionDepthCutEnum::INTERSECT_SHOW_ABOVE, "INTERSECT_SHOW_ABOVE", "Show Above Threshold" ); - addItem( RimIntersectionDepthCutEnum::INTERSECT_SHOW_BELOW, "INTERSECT_SHOW_BELOW", "Show Below Threshold" ); - setDefault( RimIntersectionDepthCutEnum::INTERSECT_SHOW_ALL ); + addItem( RimIntersectionFilterEnum::INTERSECT_FILTER_NONE, "INTERSECT_SHOW_ALL", "None" ); + addItem( RimIntersectionFilterEnum::INTERSECT_FILTER_ABOVE, "INTERSECT_SHOW_ABOVE", "Above" ); + addItem( RimIntersectionFilterEnum::INTERSECT_FILTER_BELOW, "INTERSECT_SHOW_BELOW", "Below" ); + addItem( RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN, "INTERSECT_SHOW_BELOW", "Between" ); + setDefault( RimIntersectionFilterEnum::INTERSECT_FILTER_NONE ); } } // namespace caf diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.h index 40dea9f248..b23e462297 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionEnums.h @@ -18,9 +18,10 @@ #pragma once -enum class RimIntersectionDepthCutEnum +enum class RimIntersectionFilterEnum { - INTERSECT_SHOW_ALL, - INTERSECT_SHOW_BELOW, - INTERSECT_SHOW_ABOVE + INTERSECT_FILTER_NONE, + INTERSECT_FILTER_ABOVE, + INTERSECT_FILTER_BELOW, + INTERSECT_FILTER_BETWEEN }; From 258fbddc10a7ad3c1cbaa3f0be0d63fa51db4b99 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 17 Jan 2022 13:14:21 +0100 Subject: [PATCH 083/406] Merge pull request #8387 from OPM/qtcharts-summary-plots Closes #8228 Major refactoring of summary plotting. Now possible to create plots both with Qwt and QtChart as plotting tool. --- .../Application/CMakeLists_files.cmake | 2 + ApplicationLibCode/Application/RiaDefines.cpp | 33 - ApplicationLibCode/Application/RiaDefines.h | 12 - .../Application/RiaPlotDefines.cpp | 75 ++ .../Application/RiaPlotDefines.h | 39 + .../RiaPlotWindowRedrawScheduler.cpp | 10 +- .../RiaPlotWindowRedrawScheduler.h | 8 +- .../Commands/CMakeLists_files.cmake | 2 +- .../RicPlotProductionRateFeature.h | 2 +- ...icPasteAsciiDataToSummaryPlotFeatureUi.cpp | 2 +- .../RicPasteAsciiDataToSummaryPlotFeatureUi.h | 4 +- .../RicSummaryCurveSwitchAxisFeature.cpp | 2 +- .../RicSummaryPlotEditorUi.cpp | 4 +- .../RicNewWellBoreStabilityPlotFeature.cpp | 2 +- .../AnalysisPlots/RimAnalysisPlot.cpp | 43 +- .../AnalysisPlots/RimAnalysisPlot.h | 10 +- .../ProjectDataModel/CMakeLists_files.cmake | 4 +- .../RimAbstractCorrelationPlot.cpp | 16 +- .../RimAbstractCorrelationPlot.h | 10 +- .../RimCorrelationMatrixPlot.cpp | 59 +- .../RimCorrelationMatrixPlot.h | 6 +- .../CorrelationPlots/RimCorrelationPlot.cpp | 47 +- .../CorrelationPlots/RimCorrelationPlot.h | 3 +- .../RimCorrelationReportPlot.cpp | 2 + .../RimParameterResultCrossPlot.cpp | 40 +- .../Flow/RimWellDistributionPlot.cpp | 44 +- .../Flow/RimWellDistributionPlot.h | 26 +- .../RimWellDistributionPlotCollection.cpp | 8 +- .../Flow/RimWellFlowRateCurve.cpp | 31 +- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 2 +- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 48 +- .../ProjectDataModel/Flow/RimWellRftPlot.h | 12 +- .../GridCrossPlots/RimGridCrossPlot.cpp | 120 +- .../GridCrossPlots/RimGridCrossPlot.h | 17 +- .../GridCrossPlots/RimGridCrossPlotCurve.cpp | 56 +- .../GridCrossPlots/RimGridCrossPlotCurve.h | 11 - .../RimGridCrossPlotDataSet.cpp | 25 +- .../GridCrossPlots/RimGridCrossPlotDataSet.h | 3 +- .../ProjectDataModel/RimDepthTrackPlot.cpp | 8 +- .../ProjectDataModel/RimDepthTrackPlot.h | 1 + .../RimGridTimeHistoryCurve.cpp | 24 +- .../RimMdiWindowController.cpp | 1 + .../ProjectDataModel/RimMultiPlot.cpp | 16 +- .../ProjectDataModel/RimMultiPlot.h | 1 + .../ProjectDataModel/RimPlot.cpp | 99 +- ApplicationLibCode/ProjectDataModel/RimPlot.h | 45 +- .../RimPlotAxisLogRangeCalculator.cpp | 116 ++ .../RimPlotAxisLogRangeCalculator.h | 44 + .../RimPlotAxisProperties.cpp | 185 +-- .../ProjectDataModel/RimPlotAxisProperties.h | 28 +- .../RimPlotAxisPropertiesInterface.h | 2 +- .../ProjectDataModel/RimPlotCurve.cpp | 799 +++++++------ .../ProjectDataModel/RimPlotCurve.h | 114 +- .../RimPlotCurveAppearance.cpp | 58 +- .../ProjectDataModel/RimPlotCurveAppearance.h | 14 +- .../RimStackablePlotCurve.cpp | 7 + .../ProjectDataModel/RimStackablePlotCurve.h | 1 + .../ProjectDataModel/RimVfpPlot.cpp | 129 +-- .../ProjectDataModel/RimVfpPlot.h | 36 +- .../Summary/RimAsciiDataCurve.cpp | 22 +- .../Summary/RimAsciiDataCurve.h | 2 +- .../Summary/RimEnsembleCurveSet.cpp | 220 ++-- .../Summary/RimEnsembleCurveSet.h | 14 +- .../Summary/RimEnsembleCurveSetCollection.cpp | 24 +- .../Summary/RimEnsembleCurveSetCollection.h | 14 +- .../Summary/RimSummaryCurve.cpp | 49 +- .../Summary/RimSummaryCurve.h | 2 +- .../RimSummaryCurveAppearanceCalculator.cpp | 12 +- .../RimSummaryCurveAppearanceCalculator.h | 16 +- .../Summary/RimSummaryCurveCollection.cpp | 20 +- .../Summary/RimSummaryCurveCollection.h | 12 +- .../Summary/RimSummaryPlot.cpp | 314 ++--- .../ProjectDataModel/Summary/RimSummaryPlot.h | 30 +- .../Summary/RimSummaryPlotAxisFormatter.cpp | 77 +- .../Summary/RimSummaryPlotAxisFormatter.h | 8 +- .../WellLog/RimEnsembleWellLogCurveSet.cpp | 39 +- .../WellLog/RimEnsembleWellLogCurveSet.h | 7 +- .../WellLog/RimWellLogCurve.cpp | 28 +- .../WellLog/RimWellLogExtractionCurve.cpp | 12 +- .../WellLog/RimWellLogFileCurve.cpp | 15 +- .../WellLog/RimWellLogRftCurve.cpp | 24 +- .../WellLog/RimWellLogTrack.cpp | 111 +- .../WellLog/RimWellLogTrack.h | 15 +- .../RimWellMeasurementCurve.cpp | 42 +- .../WellMeasurement/RimWellMeasurementCurve.h | 4 +- .../UserInterface/CMakeLists_files.cmake | 43 +- .../RiuFlowCharacteristicsPlot.cpp | 9 +- .../RiuFlowCharacteristicsPlot.h | 3 +- .../UserInterface/RiuGridCrossQwtPlot.cpp | 49 +- .../UserInterface/RiuGridCrossQwtPlot.h | 5 +- .../UserInterface/RiuMohrsCirclePlot.cpp | 7 +- .../UserInterface/RiuMohrsCirclePlot.h | 6 +- .../UserInterface/RiuMultiPlotBook.cpp | 28 +- .../UserInterface/RiuMultiPlotBook.h | 15 +- .../UserInterface/RiuMultiPlotPage.cpp | 65 +- .../UserInterface/RiuMultiPlotPage.h | 14 +- .../UserInterface/RiuPlotCurve.cpp | 206 ++++ .../UserInterface/RiuPlotCurve.h | 150 +++ .../UserInterface/RiuPlotCurveSymbol.cpp | 153 +++ .../UserInterface/RiuPlotCurveSymbol.h | 101 ++ .../UserInterface/RiuPlotItem.h | 26 + .../UserInterface/RiuPlotWidget.cpp | 242 ++++ .../UserInterface/RiuPlotWidget.h | 194 ++++ .../UserInterface/RiuQtChartView.cpp | 56 +- .../UserInterface/RiuQtChartView.h | 8 + .../UserInterface/RiuQtChartsPlotCurve.cpp | 390 +++++++ .../UserInterface/RiuQtChartsPlotCurve.h | 94 ++ .../RiuQtChartsPlotCurveSymbol.cpp | 618 ++++++++++ .../RiuQtChartsPlotCurveSymbol.h | 79 ++ .../UserInterface/RiuQtChartsPlotTools.cpp | 105 ++ .../UserInterface/RiuQtChartsPlotTools.h | 40 + .../UserInterface/RiuQtChartsPlotWidget.cpp | 1027 +++++++++++++++++ .../UserInterface/RiuQtChartsPlotWidget.h | 211 ++++ .../UserInterface/RiuQwtPlotCurve.cpp | 340 ++++-- .../UserInterface/RiuQwtPlotCurve.h | 97 +- .../UserInterface/RiuQwtPlotCurveDefines.cpp | 19 + .../UserInterface/RiuQwtPlotCurveDefines.h | 4 + .../UserInterface/RiuQwtPlotItem.cpp | 34 + ...{RiuRimQwtPlotCurve.h => RiuQwtPlotItem.h} | 19 +- .../UserInterface/RiuQwtPlotTools.cpp | 30 + .../UserInterface/RiuQwtPlotTools.h | 4 + .../UserInterface/RiuQwtPlotWidget.cpp | 584 +++++----- .../UserInterface/RiuQwtPlotWidget.h | 173 +-- .../UserInterface/RiuQwtSymbol.cpp | 129 +-- .../UserInterface/RiuQwtSymbol.h | 67 +- .../RiuRelativePermeabilityPlotPanel.cpp | 17 +- .../UserInterface/RiuResultQwtPlot.cpp | 2 +- .../UserInterface/RiuResultQwtPlot.h | 2 - .../UserInterface/RiuRimQwtPlotCurve.cpp | 45 - .../UserInterface/RiuSummaryPlot.cpp | 198 ++++ .../UserInterface/RiuSummaryPlot.h | 57 + .../UserInterface/RiuSummaryQtChartsPlot.cpp | 98 ++ .../UserInterface/RiuSummaryQtChartsPlot.h | 61 + .../UserInterface/RiuSummaryQwtPlot.cpp | 227 +--- .../UserInterface/RiuSummaryQwtPlot.h | 21 +- .../RiuTofAccumulatedPhaseFractionsPlot.cpp | 1 + .../RiuTofAccumulatedPhaseFractionsPlot.h | 2 +- .../UserInterface/RiuWellAllocationPlot.h | 2 - .../UserInterface/RiuWellLogPlot.cpp | 4 +- .../UserInterface/RiuWellLogTrack.cpp | 32 +- .../UserInterface/RiuWellLogTrack.h | 2 + .../RiuWellPathComponentPlotItem.cpp | 140 ++- .../RiuWellPathComponentPlotItem.h | 42 +- CMakeLists.txt | 23 +- doc/qwtplot.plantuml | 34 +- 145 files changed, 7234 insertions(+), 2921 deletions(-) create mode 100644 ApplicationLibCode/Application/RiaPlotDefines.cpp create mode 100644 ApplicationLibCode/Application/RiaPlotDefines.h create mode 100644 ApplicationLibCode/ProjectDataModel/RimPlotAxisLogRangeCalculator.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimPlotAxisLogRangeCalculator.h create mode 100644 ApplicationLibCode/UserInterface/RiuPlotCurve.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuPlotCurve.h create mode 100644 ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.h create mode 100644 ApplicationLibCode/UserInterface/RiuPlotItem.h create mode 100644 ApplicationLibCode/UserInterface/RiuPlotWidget.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuPlotWidget.h create mode 100644 ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h create mode 100644 ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h create mode 100644 ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.h create mode 100644 ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h create mode 100644 ApplicationLibCode/UserInterface/RiuQwtPlotItem.cpp rename ApplicationLibCode/UserInterface/{RiuRimQwtPlotCurve.h => RiuQwtPlotItem.h} (65%) delete mode 100644 ApplicationLibCode/UserInterface/RiuRimQwtPlotCurve.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuSummaryPlot.h create mode 100644 ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h diff --git a/ApplicationLibCode/Application/CMakeLists_files.cmake b/ApplicationLibCode/Application/CMakeLists_files.cmake index 57990caa03..0bd6d1abfc 100644 --- a/ApplicationLibCode/Application/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/CMakeLists_files.cmake @@ -21,6 +21,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.h ${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.h ${CMAKE_CURRENT_LIST_DIR}/RiaNncDefines.h + ${CMAKE_CURRENT_LIST_DIR}/RiaPlotDefines.h ${CMAKE_CURRENT_LIST_DIR}/RiaStimPlanModelDefines.h ${CMAKE_CURRENT_LIST_DIR}/RiaResultNames.h ${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.h @@ -49,6 +50,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaFeatureCommandContext.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaStringListSerializer.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaNncDefines.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaPlotDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaStimPlanModelDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaResultNames.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.cpp diff --git a/ApplicationLibCode/Application/RiaDefines.cpp b/ApplicationLibCode/Application/RiaDefines.cpp index fcac9ae01f..30641e323a 100644 --- a/ApplicationLibCode/Application/RiaDefines.cpp +++ b/ApplicationLibCode/Application/RiaDefines.cpp @@ -70,15 +70,6 @@ void caf::AppEnum::setUp() setDefault( RiaDefines::DepthTypeEnum::MEASURED_DEPTH ); } -template <> -void caf::AppEnum::setUp() -{ - addItem( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "PLOT_AXIS_LEFT", "Left" ); - addItem( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, "PLOT_AXIS_RIGHT", "Right" ); - - setDefault( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); -} - template <> void caf::AppEnum::setUp() { @@ -240,30 +231,6 @@ RiaDefines::EclipseUnitSystem RiaDefines::fromDepthUnit( DepthUnitType depthUnit return RiaDefines::EclipseUnitSystem::UNITS_UNKNOWN; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RiaDefines::minimumDefaultValuePlot() -{ - return -10.0; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RiaDefines::minimumDefaultLogValuePlot() -{ - return 1.0; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -double RiaDefines::maximumDefaultValuePlot() -{ - return 100.0; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaDefines.h b/ApplicationLibCode/Application/RiaDefines.h index 77407d96fa..a32beee91a 100644 --- a/ApplicationLibCode/Application/RiaDefines.h +++ b/ApplicationLibCode/Application/RiaDefines.h @@ -107,18 +107,6 @@ enum class DepthTypeEnum TRUE_VERTICAL_DEPTH_RKB }; -// Defines relate to plotting -enum class PlotAxis -{ - PLOT_AXIS_LEFT, - PLOT_AXIS_RIGHT, - PLOT_AXIS_BOTTOM -}; - -double minimumDefaultValuePlot(); -double minimumDefaultLogValuePlot(); -double maximumDefaultValuePlot(); - enum class PhaseType { OIL_PHASE, diff --git a/ApplicationLibCode/Application/RiaPlotDefines.cpp b/ApplicationLibCode/Application/RiaPlotDefines.cpp new file mode 100644 index 0000000000..0a7b4d3a74 --- /dev/null +++ b/ApplicationLibCode/Application/RiaPlotDefines.cpp @@ -0,0 +1,75 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiaPlotDefines.h" + +#include "cafAppEnum.h" + +namespace caf +{ +template <> +void caf::AppEnum::setUp() +{ + addItem( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "PLOT_AXIS_LEFT", "Left" ); + addItem( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, "PLOT_AXIS_RIGHT", "Right" ); + addItem( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "PLOT_AXIS_BOTTOM", "Bottom" ); + addItem( RiaDefines::PlotAxis::PLOT_AXIS_TOP, "PLOT_AXIS_TOP", "Top" ); + + setDefault( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); +} +}; // namespace caf + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RiaDefines::minimumDefaultValuePlot() +{ + return -10.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RiaDefines::minimumDefaultLogValuePlot() +{ + return 1.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RiaDefines::maximumDefaultValuePlot() +{ + return 100.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaDefines::isHorizontal( RiaDefines::PlotAxis axis ) +{ + return !isVertical( axis ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaDefines::isVertical( RiaDefines::PlotAxis axis ) +{ + return ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || axis == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); +} diff --git a/ApplicationLibCode/Application/RiaPlotDefines.h b/ApplicationLibCode/Application/RiaPlotDefines.h new file mode 100644 index 0000000000..5eadaf47de --- /dev/null +++ b/ApplicationLibCode/Application/RiaPlotDefines.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +// Defines relate to plotting +namespace RiaDefines +{ +enum class PlotAxis +{ + PLOT_AXIS_LEFT, + PLOT_AXIS_RIGHT, + PLOT_AXIS_BOTTOM, + PLOT_AXIS_TOP +}; + +double minimumDefaultValuePlot(); +double minimumDefaultLogValuePlot(); +double maximumDefaultValuePlot(); + +bool isHorizontal( PlotAxis axis ); +bool isVertical( PlotAxis axis ); + +}; // namespace RiaDefines diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp index 0aafd16592..5e64f7534f 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp @@ -19,7 +19,7 @@ #include "RiuMultiPlotBook.h" #include "RiuMultiPlotPage.h" -#include "RiuQwtPlotWidget.h" +#include "RiuPlotWidget.h" #include #include @@ -61,7 +61,7 @@ void RiaPlotWindowRedrawScheduler::scheduleMultiPlotPageUpdate( RiuMultiPlotPage //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaPlotWindowRedrawScheduler::schedulePlotWidgetReplot( RiuQwtPlotWidget* plotWidget ) +void RiaPlotWindowRedrawScheduler::schedulePlotWidgetReplot( RiuPlotWidget* plotWidget ) { m_plotWidgetsToReplot.push_back( plotWidget ); @@ -92,13 +92,13 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() { std::vector> plotWindowsToUpdate; std::vector> plotPagesToUpdate; - std::vector> plotWidgetsToReplot; + std::vector> plotWidgetsToReplot; plotWindowsToUpdate.swap( m_plotWindowsToUpdate ); plotPagesToUpdate.swap( m_plotPagesToUpdate ); plotWidgetsToReplot.swap( m_plotWidgetsToReplot ); - std::set> updatedPlots; + std::set> updatedPlots; std::set> updatedPlotWindows; std::set> updatedPlotPages; @@ -127,7 +127,7 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() } // Perform update and replot. Make sure we handle legend update - for ( QPointer plot : plotWidgetsToReplot ) + for ( QPointer plot : plotWidgetsToReplot ) { if ( !plot.isNull() && !updatedPlots.count( plot ) ) { diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h index 4f43b0664d..13868d5d43 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h @@ -28,7 +28,7 @@ class RiuMultiPlotPage; class RiuMultiPlotBook; -class RiuQwtPlotWidget; +class RiuPlotWidget; class RiaPlotWindowRedrawScheduler : public QObject { @@ -38,7 +38,7 @@ class RiaPlotWindowRedrawScheduler : public QObject static RiaPlotWindowRedrawScheduler* instance(); void scheduleMultiPlotWindowUpdate( RiuMultiPlotBook* plotWindow ); void scheduleMultiPlotPageUpdate( RiuMultiPlotPage* plotWindow ); - void schedulePlotWidgetReplot( RiuQwtPlotWidget* plotWidget ); + void schedulePlotWidgetReplot( RiuPlotWidget* plotWidget ); void clearAllScheduledUpdates(); void performScheduledUpdatesAndReplots(); @@ -46,13 +46,13 @@ private slots: void slotUpdateAndReplotScheduledItemsWhenReady(); private: - RiaPlotWindowRedrawScheduler() = default; + RiaPlotWindowRedrawScheduler() = default; ~RiaPlotWindowRedrawScheduler() override = default; void startTimer( int msecs ); private: - std::vector> m_plotWidgetsToReplot; + std::vector> m_plotWidgetsToReplot; std::vector> m_plotWindowsToUpdate; std::vector> m_plotPagesToUpdate; QScopedPointer m_plotWindowUpdateTimer; diff --git a/ApplicationLibCode/Commands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/CMakeLists_files.cmake index a0f73e60a7..deaa0ca249 100644 --- a/ApplicationLibCode/Commands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/CMakeLists_files.cmake @@ -161,7 +161,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicCreateSurfaceIntersectionCurveFeature.cpp ) -if(Qt5Charts_FOUND) +if(RESINSIGHT_USE_QT_CHARTS) list( APPEND SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicCreateEnsembleFractureStatisticsPlotFeature.h diff --git a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.h b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.h index adcccf5ca7..f832394171 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.h +++ b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.h @@ -20,7 +20,7 @@ #include "cafCmdFeature.h" -#include "RiaDefines.h" +#include "RiaPlotDefines.h" #include "RimFlowDiagSolution.h" class RimGridSummaryCase; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp index 05c592b166..239171e268 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp @@ -199,7 +199,7 @@ RicPasteAsciiDataToSummaryPlotFeatureUi::RicPasteAsciiDataToSummaryPlotFeatureUi "Line Style" ); CAF_PDM_InitField( &m_curveSymbol, "Symbol", - caf::AppEnum( RiuQwtSymbol::SYMBOL_ELLIPSE ), + caf::AppEnum( RiuQwtSymbol::SYMBOL_ELLIPSE ), "Symbol" ); CAF_PDM_InitField( &m_curveSymbolSkipDistance, "SymbolSkipDinstance", 0.0f, "Symbol Skip Distance" ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h index 1c270406de..2df84ad372 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h @@ -60,7 +60,7 @@ class AsciiDataParseOptions bool assumeNumericDataColumns; RiuQwtPlotCurveDefines::LineStyleEnum curveLineStyle; - RiuQwtSymbol::PointSymbolEnum curveSymbol; + RiuPlotCurveSymbol::PointSymbolEnum curveSymbol; float curveSymbolSkipDistance; }; @@ -160,7 +160,7 @@ class RicPasteAsciiDataToSummaryPlotFeatureUi : public caf::PdmObject caf::PdmField m_timeSeriesColumnName; caf::PdmField> m_curveLineStyle; - caf::PdmField> m_curveSymbol; + caf::PdmField> m_curveSymbol; caf::PdmField m_curveSymbolSkipDistance; bool m_createNewPlot; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp index e1f6ddc5bc..196e27cd7c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp @@ -67,7 +67,7 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered( bool isChecked ) summaryCurve->setLeftOrRightAxisY( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); } - summaryCurve->updateQwtPlotAxis(); + summaryCurve->updatePlotAxis(); summaryCurve->updateConnectedEditors(); RimSummaryPlot* plot = nullptr; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index a570358ab3..00c738e84c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -688,7 +688,7 @@ void RicSummaryPlotEditorUi::updateTargetPlot() copyEnsembleCurveAndAddToCurveSet( editedCurve, editedCurveSet ); } - newCurveSet->setParentQwtPlotNoReplot( m_targetPlot->viewer() ); + newCurveSet->setParentPlotNoReplot( m_targetPlot->plotWidget() ); } m_targetPlot->enableAutoPlotTitle( m_useAutoPlotTitleProxy() ); @@ -900,7 +900,7 @@ void RicSummaryPlotEditorUi::updateCurveNames() curve->updateCurveNameNoLegendUpdate(); } - if ( m_previewPlot && m_previewPlot->viewer() ) m_previewPlot->viewer()->updateLegend(); + if ( m_previewPlot && m_previewPlot->plotWidget() ) m_previewPlot->updateLegend(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp index 8dfc783b5b..b0841f9dca 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp @@ -413,7 +413,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability curve->loadDataAndUpdate( false ); double actualMinValue = minValue, actualMaxValue = maxValue; - curve->xValueRangeInQwt( &actualMinValue, &actualMaxValue ); + curve->xValueRange( &actualMinValue, &actualMaxValue ); while ( maxValue < actualMaxValue ) { maxValue += angleIncrement; diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index f430ebdc8a..69933ea188 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -18,12 +18,15 @@ #include "RimAnalysisPlot.h" +#include "RiaDefines.h" +#include "RiaPlotDefines.h" #include "RiaPreferences.h" #include "RiaSummaryCurveDefinition.h" #include "RiaTextStringTools.h" #include "RiuGroupedBarChartBuilder.h" #include "RiuPlotMainWindowTools.h" +#include "RiuQwtPlotTools.h" #include "RiuSummaryQwtPlot.h" #include "RiuSummaryVectorSelectionDialog.h" @@ -159,7 +162,7 @@ RimAnalysisPlot::RimAnalysisPlot() CAF_PDM_InitFieldNoDefault( &m_valueAxisProperties, "ValueAxisProperties", "ValueAxisProperties" ); m_valueAxisProperties.uiCapability()->setUiTreeHidden( true ); m_valueAxisProperties = new RimPlotAxisProperties; - m_valueAxisProperties->setNameAndAxis( "Value-Axis", QwtPlot::yLeft ); + m_valueAxisProperties->setNameAndAxis( "Value-Axis", RiuQwtPlotTools::fromQwtPlotAxis( QwtPlot::yLeft ) ); m_valueAxisProperties->enableRangeSettings( false ); CAF_PDM_InitFieldNoDefault( &m_plotDataFilterCollection, "PlotDataFilterCollection", "PlotDataFilterCollection" ); @@ -772,26 +775,26 @@ void RimAnalysisPlot::onLoadDataAndUpdate() if ( m_plotWidget ) { - m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotBarChart ); - m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotScale ); + m_plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotBarChart ); + m_plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotScale ); RiuGroupedBarChartBuilder chartBuilder; chartBuilder.setLabelFontSize( barTextFontSize() ); // buildTestPlot( chartBuilder ); addDataToChartBuilder( chartBuilder ); - chartBuilder.addBarChartToPlot( m_plotWidget, + chartBuilder.addBarChartToPlot( m_plotWidget->qwtPlot(), m_barOrientation == BARS_HORIZONTAL ? Qt::Horizontal : Qt::Vertical, m_useTopBarsFilter() ? m_maxBarCount : -1 ); - if ( m_showPlotLegends && m_plotWidget->legend() == nullptr ) + if ( m_showPlotLegends && m_plotWidget->qwtPlot()->legend() == nullptr ) { QwtLegend* legend = new QwtLegend( m_plotWidget ); - m_plotWidget->insertLegend( legend, QwtPlot::RightLegend ); + m_plotWidget->qwtPlot()->insertLegend( legend, QwtPlot::RightLegend ); } else if ( !m_showPlotLegends ) { - m_plotWidget->insertLegend( nullptr ); + m_plotWidget->qwtPlot()->insertLegend( nullptr ); } m_plotWidget->setLegendFontSize( legendFontSize() ); @@ -829,7 +832,7 @@ QString RimAnalysisPlot::description() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget* RimAnalysisPlot::doCreatePlotViewWidget( QWidget* mainWindowParent /*= nullptr */ ) +RiuPlotWidget* RimAnalysisPlot::doCreatePlotViewWidget( QWidget* mainWindowParent /*= nullptr */ ) { if ( !m_plotWidget ) { @@ -847,12 +850,20 @@ RiuQwtPlotWidget* RimAnalysisPlot::viewer() return m_plotWidget; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotWidget* RimAnalysisPlot::plotWidget() +{ + return m_plotWidget; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimAnalysisPlot::detachAllCurves() { - if ( m_plotWidget ) m_plotWidget->detachItems(); + if ( m_plotWidget ) m_plotWidget->qwtPlot()->detachItems(); } //-------------------------------------------------------------------------------------------------- @@ -862,29 +873,29 @@ void RimAnalysisPlot::updateAxes() { if ( !m_plotWidget ) return; - QwtPlot::Axis qwtAxis = QwtPlot::yLeft; + RiaDefines::PlotAxis axis = RiaDefines::PlotAxis::PLOT_AXIS_LEFT; if ( m_barOrientation == BARS_HORIZONTAL ) { - qwtAxis = QwtPlot::xBottom; - m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, false ); + axis = RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM; + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, false ); } else { - m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, false ); + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, false ); } RimPlotAxisProperties* valAxisProperties = m_valueAxisProperties(); if ( valAxisProperties->isActive() ) { - m_plotWidget->enableAxis( qwtAxis, true ); - m_valueAxisProperties->setNameAndAxis( "Value-Axis", qwtAxis ); + m_plotWidget->enableAxis( axis, true ); + m_valueAxisProperties->setNameAndAxis( "Value-Axis", axis ); RimSummaryPlotAxisFormatter calc( valAxisProperties, {}, curveDefinitions(), {}, {} ); calc.applyAxisPropertiesToPlot( m_plotWidget ); } else { - m_plotWidget->enableAxis( qwtAxis, false ); + m_plotWidget->enableAxis( axis, false ); } } diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h index 31cdff91d5..53a70a0636 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h @@ -127,22 +127,20 @@ class RimAnalysisPlot : public RimPlot // RimPlot Overrides - RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; - RiuQwtPlotWidget* viewer() override; + RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; + RiuQwtPlotWidget* viewer(); + RiuPlotWidget* plotWidget() override; void detachAllCurves() override; void reattachAllCurves() override {} void updateAxes() override; void onAxisSelected( int axis, bool toggle ) override; - void updateZoomInQwt() override {} - void updateZoomFromQwt() override {} void setAutoScaleXEnabled( bool enabled ) override {} void setAutoScaleYEnabled( bool enabled ) override {} void updateLegend() override{}; - QString asciiDataForPlotExport() const override { return ""; } - caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override { return nullptr; } + QString asciiDataForPlotExport() const override { return ""; } // Private methods diff --git a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake index 0cbdbde466..d0898303ce 100644 --- a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake @@ -93,6 +93,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisPropertiesInterface.h ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.h ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.h + ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisLogRangeCalculator.h ${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.h ${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotCollection.h @@ -213,6 +214,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisPropertiesInterface.cpp ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisProperties.cpp ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisAnnotation.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimPlotAxisLogRangeCalculator.cpp ${CMAKE_CURRENT_LIST_DIR}/RimObservedDataCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimObservedFmuRftData.cpp ${CMAKE_CURRENT_LIST_DIR}/RimMultiPlotCollection.cpp @@ -235,7 +237,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCollection.cpp ) -if(Qt5Charts_FOUND) +if(RESINSIGHT_USE_QT_CHARTS) list( APPEND SOURCE_GROUP_HEADER_FILES diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp index 716d572bd9..de7643318c 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp @@ -42,6 +42,8 @@ #include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiToolButtonEditor.h" +#include "qwt_plot.h" + CAF_PDM_ABSTRACT_SOURCE_INIT( RimAbstractCorrelationPlot, "AbstractCorrelationPlot" ); //-------------------------------------------------------------------------------------------------- @@ -557,7 +559,7 @@ QString RimAbstractCorrelationPlot::description() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget* RimAbstractCorrelationPlot::doCreatePlotViewWidget( QWidget* mainWindowParent /*= nullptr */ ) +RiuPlotWidget* RimAbstractCorrelationPlot::doCreatePlotViewWidget( QWidget* mainWindowParent /*= nullptr */ ) { if ( !m_plotWidget ) { @@ -576,12 +578,20 @@ RiuQwtPlotWidget* RimAbstractCorrelationPlot::viewer() return m_plotWidget; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotWidget* RimAbstractCorrelationPlot::plotWidget() +{ + return m_plotWidget; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimAbstractCorrelationPlot::detachAllCurves() { - if ( m_plotWidget ) m_plotWidget->detachItems(); + if ( m_plotWidget ) m_plotWidget->qwtPlot()->detachItems(); } //-------------------------------------------------------------------------------------------------- @@ -661,7 +671,7 @@ void RimAbstractCorrelationPlot::updateLegend() { if ( m_plotWidget ) { - m_plotWidget->insertLegend( nullptr ); + m_plotWidget->qwtPlot()->insertLegend( nullptr ); } } diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h index 665ac9920e..f134284d07 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h @@ -61,7 +61,8 @@ class RimAbstractCorrelationPlot : public RimPlot RimEnsembleCurveSet* caseFilterDataSource() const; void setCaseFilterDataSource( RimEnsembleCurveSet* ensemble ); - RiuQwtPlotWidget* viewer() override; + RiuQwtPlotWidget* viewer(); + RiuPlotWidget* plotWidget() override; void detachAllCurves() override; QDateTime timeStep() const; QString timeStepString() const; @@ -103,17 +104,14 @@ class RimAbstractCorrelationPlot : public RimPlot void doUpdateLayout() override {} // RimPlot Overrides - RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; + RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; void reattachAllCurves() override {} - void updateZoomInQwt() override {} - void updateZoomFromQwt() override {} void setAutoScaleXEnabled( bool enabled ) override {} void setAutoScaleYEnabled( bool enabled ) override {} void updateLegend() override; - QString asciiDataForPlotExport() const override { return ""; } - caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override { return nullptr; } + QString asciiDataForPlotExport() const override { return ""; } void cleanupBeforeClose(); virtual void updatePlotTitle() = 0; diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index 0ed0e8a7b1..face4acc3a 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -25,6 +25,7 @@ #include "RiaSummaryCurveDefinition.h" #include "RiuPlotMainWindowTools.h" #include "RiuQwtLinearScaleEngine.h" +#include "RiuQwtPlotItem.h" #include "RiuQwtPlotTools.h" #include "RiuQwtPlotWidget.h" @@ -369,14 +370,14 @@ void RimCorrelationMatrixPlot::onLoadDataAndUpdate() if ( m_plotWidget ) { - m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotBarChart ); - m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotScale ); - m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotItem ); + m_plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotBarChart ); + m_plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotScale ); + m_plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotItem ); updateLegend(); createMatrix(); - m_plotWidget->insertLegend( nullptr ); + m_plotWidget->qwtPlot()->insertLegend( nullptr ); this->updateAxes(); this->updatePlotTitle(); @@ -399,14 +400,18 @@ void RimCorrelationMatrixPlot::updateAxes() { if ( !m_plotWidget ) return; - m_plotWidget->setAxisScaleDraw( QwtPlot::yLeft, new TextScaleDraw( m_resultLabels ) ); - m_plotWidget->setAxisScaleEngine( QwtPlot::yLeft, new RiuQwtLinearScaleEngine ); - m_plotWidget->setAxisTitleText( QwtPlot::yLeft, "Result Vector" ); - m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true ); - m_plotWidget->setAxisFontsAndAlignment( QwtPlot::yLeft, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter ); - m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::yLeft, true, false ); - m_plotWidget->setAxisRange( QwtPlot::yLeft, 0.0, (double)m_resultLabels.size() + 1 ); - m_plotWidget->setMajorAndMinorTickIntervalsAndRange( QwtPlot::yLeft, + m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::yLeft, new TextScaleDraw( m_resultLabels ) ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new RiuQwtLinearScaleEngine ); + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "Result Vector" ); + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); + m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + axisTitleFontSize(), + axisValueFontSize(), + false, + Qt::AlignCenter ); + m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true, false ); + m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0.0, (double)m_resultLabels.size() + 1 ); + m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 1.0, 0.0, 0.5, @@ -416,19 +421,18 @@ void RimCorrelationMatrixPlot::updateAxes() auto scaleDraw = new TextScaleDraw( m_paramLabels ); scaleDraw->setLabelRotation( 30.0 ); - m_plotWidget->setAxisScaleDraw( QwtPlot::xBottom, scaleDraw ); - - m_plotWidget->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine ); - m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "Ensemble Parameter" ); - m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true ); - m_plotWidget->setAxisFontsAndAlignment( QwtPlot::xBottom, + m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::xBottom, scaleDraw ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine ); + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Ensemble Parameter" ); + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter | Qt::AlignTop ); - m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::xBottom, true, false ); - m_plotWidget->setAxisRange( QwtPlot::xBottom, 0.0, (double)m_paramLabels.size() + 1 ); - m_plotWidget->setMajorAndMinorTickIntervalsAndRange( QwtPlot::xBottom, + m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true, false ); + m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0.0, (double)m_paramLabels.size() + 1 ); + m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 1.0, 0.0, 0.5, @@ -436,7 +440,7 @@ void RimCorrelationMatrixPlot::updateAxes() 0.0, (double)m_paramLabels.size() ); - m_plotWidget->setAxisLabelAlignment( QwtPlot::xBottom, Qt::AlignRight ); + m_plotWidget->qwtPlot()->setAxisLabelAlignment( QwtPlot::xBottom, Qt::AlignRight ); } template @@ -636,8 +640,8 @@ void RimCorrelationMatrixPlot::createMatrix() marker->setLabel( textLabel ); marker->setXValue( colIdx + 0.5 ); marker->setYValue( rowIdx + 0.5 ); - rectangle->attach( m_plotWidget ); - marker->attach( m_plotWidget ); + rectangle->attach( m_plotWidget->qwtPlot() ); + marker->attach( m_plotWidget->qwtPlot() ); m_paramLabels[colIdx] = correlationMatrixRows[rowIdx].m_values[colIdx]; } @@ -682,9 +686,12 @@ void RimCorrelationMatrixPlot::updateLegend() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimCorrelationMatrixPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) +void RimCorrelationMatrixPlot::onPlotItemSelected( std::shared_ptr plotItem, bool toggle, int sampleIndex ) { - CorrelationMatrixShapeItem* matrixItem = dynamic_cast( plotItem ); + RiuQwtPlotItem* qwtPlotItem = dynamic_cast( plotItem.get() ); + if ( !qwtPlotItem ) return; + + CorrelationMatrixShapeItem* matrixItem = dynamic_cast( qwtPlotItem->qwtPlotItem() ); if ( matrixItem ) { matrixCellSelected.send( std::make_pair( matrixItem->parameter, matrixItem->curveDef ) ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h index 1c4a68dba0..3c3110efcd 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h @@ -22,11 +22,11 @@ #include "cafAppEnum.h" -#include - class RimRegularLegendConfig; class RimSummaryAddress; + class RiuGroupedBarChartBuilder; +class RiuPlotItem; //================================================================================================== /// @@ -79,7 +79,7 @@ class RimCorrelationMatrixPlot : public RimAbstractCorrelationPlot void createMatrix(); void updatePlotTitle() override; void updateLegend() override; - void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) override; + void onPlotItemSelected( std::shared_ptr plotItem, bool toggle, int sampleIndex ) override; private: caf::PdmField m_showAbsoluteValues; diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp index 3986a95dcc..3d36441293 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp @@ -22,6 +22,7 @@ #include "RiaQDateTimeTools.h" #include "RiuGroupedBarChartBuilder.h" #include "RiuPlotMainWindowTools.h" +#include "RiuQwtPlotItem.h" #include "RiuQwtPlotWidget.h" #include "RifSummaryReaderInterface.h" @@ -40,6 +41,7 @@ #include "cafPdmUiComboBoxEditor.h" #include "cafPdmUiTreeSelectionEditor.h" +#include "qwt_plot.h" #include "qwt_plot_barchart.h" #include @@ -176,19 +178,19 @@ void RimCorrelationPlot::onLoadDataAndUpdate() if ( m_plotWidget && m_analyserOfSelectedCurveDefs ) { - m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotBarChart ); - m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotScale ); + m_plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotBarChart ); + m_plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotScale ); RiuGroupedBarChartBuilder chartBuilder; addDataToChartBuilder( chartBuilder ); - chartBuilder.addBarChartToPlot( m_plotWidget, + chartBuilder.addBarChartToPlot( m_plotWidget->qwtPlot(), Qt::Horizontal, m_showOnlyTopNCorrelations() ? m_topNFilterCount() : -1 ); chartBuilder.setLabelFontSize( labelFontSize() ); - m_plotWidget->insertLegend( nullptr ); + m_plotWidget->qwtPlot()->insertLegend( nullptr ); m_plotWidget->updateLegend(); this->updateAxes(); @@ -204,22 +206,30 @@ void RimCorrelationPlot::updateAxes() { if ( !m_plotWidget ) return; - m_plotWidget->setAxisTitleText( QwtPlot::yLeft, "Parameter" ); - m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true ); - m_plotWidget->setAxisFontsAndAlignment( QwtPlot::yLeft, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter ); - - m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "Pearson Correlation Coefficient" ); - m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true ); - m_plotWidget->setAxisFontsAndAlignment( QwtPlot::xBottom, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter ); + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "Parameter" ); + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); + m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + axisTitleFontSize(), + axisValueFontSize(), + false, + Qt::AlignCenter ); + + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Pearson Correlation Coefficient" ); + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, + axisTitleFontSize(), + axisValueFontSize(), + false, + Qt::AlignCenter ); if ( m_showAbsoluteValues ) { - m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "Pearson Correlation Coefficient ABS" ); - m_plotWidget->setAxisRange( QwtPlot::xBottom, 0.0, 1.0 ); + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Pearson Correlation Coefficient ABS" ); + m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0.0, 1.0 ); } else { - m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "Pearson Correlation Coefficient" ); - m_plotWidget->setAxisRange( QwtPlot::xBottom, -1.0, 1.0 ); + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Pearson Correlation Coefficient" ); + m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, -1.0, 1.0 ); } } @@ -273,9 +283,12 @@ void RimCorrelationPlot::updatePlotTitle() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimCorrelationPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) +void RimCorrelationPlot::onPlotItemSelected( std::shared_ptr plotItem, bool toggle, int sampleIndex ) { - QwtPlotBarChart* barChart = dynamic_cast( plotItem ); + RiuQwtPlotItem* qwtPlotItem = dynamic_cast( plotItem.get() ); + if ( !qwtPlotItem ) return; + + QwtPlotBarChart* barChart = dynamic_cast( qwtPlotItem->qwtPlotItem() ); if ( barChart && !curveDefinitions().empty() ) { auto curveDef = curveDefinitions().front(); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h index bee98e0569..1013a2408c 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h @@ -28,6 +28,7 @@ class RimSummaryAddress; class RiuGroupedBarChartBuilder; +class RiuPlotItem; //================================================================================================== /// @@ -70,7 +71,7 @@ class RimCorrelationPlot : public RimAbstractCorrelationPlot // Private methods void addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBuilder ); void updatePlotTitle() override; - void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) override; + void onPlotItemSelected( std::shared_ptr plotItem, bool toggle, int sampleIndex ) override; private: caf::PdmField m_showAbsoluteValues; diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp index 7689ebaee6..4fea83af1d 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp @@ -29,6 +29,8 @@ #include "RimSummaryCaseCollection.h" #include "RiuMultiPlotPage.h" +#include "RiuPlotWidget.h" +#include "RiuQwtPlotWidget.h" #include "cafAssert.h" #include "cafPdmUiOrdering.h" diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp index ec48fd998a..23d7af2481 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp @@ -39,6 +39,7 @@ #include "RimSummaryCaseCollection.h" #include "RimSummaryPlotAxisFormatter.h" +#include "RiuPlotCurve.h" #include "RiuPlotMainWindowTools.h" #include "RiuQwtPlotCurve.h" #include "RiuSummaryQwtPlot.h" @@ -49,6 +50,7 @@ #include "cafPdmUiPushButtonEditor.h" #include "qwt_legend.h" +#include "qwt_plot.h" #include "qwt_plot_curve.h" #include "qwt_scale_engine.h" @@ -168,7 +170,7 @@ void RimParameterResultCrossPlot::onLoadDataAndUpdate() if ( m_showPlotLegends && !isSubPlot() ) { QwtLegend* legend = new QwtLegend( m_plotWidget ); - m_plotWidget->insertLegend( legend, QwtPlot::RightLegend ); + m_plotWidget->qwtPlot()->insertLegend( legend, QwtPlot::RightLegend ); m_plotWidget->setLegendFontSize( legendFontSize() ); m_plotWidget->updateLegend(); } @@ -186,19 +188,31 @@ void RimParameterResultCrossPlot::updateAxes() { if ( !m_plotWidget ) return; - m_plotWidget->setAxisTitleText( QwtPlot::yLeft, completeAddressText() ); - m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true ); - m_plotWidget->setAxisFontsAndAlignment( QwtPlot::yLeft, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter ); + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, completeAddressText() ); + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); + m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + axisTitleFontSize(), + axisValueFontSize(), + false, + Qt::AlignCenter ); double yRangeWidth = m_yRange.second - m_yRange.first; - m_plotWidget->setAxisRange( QwtPlot::yLeft, m_yRange.first - yRangeWidth * 0.1, m_yRange.second + yRangeWidth * 0.1 ); - - m_plotWidget->setAxisTitleText( QwtPlot::xBottom, m_ensembleParameter ); - m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true ); - m_plotWidget->setAxisFontsAndAlignment( QwtPlot::xBottom, axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter ); + m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + m_yRange.first - yRangeWidth * 0.1, + m_yRange.second + yRangeWidth * 0.1 ); + + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_ensembleParameter ); + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, + axisTitleFontSize(), + axisValueFontSize(), + false, + Qt::AlignCenter ); double xRangeWidth = m_xRange.second - m_xRange.first; - m_plotWidget->setAxisRange( QwtPlot::xBottom, m_xRange.first - xRangeWidth * 0.1, m_xRange.second + xRangeWidth * 0.1 ); + m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, + m_xRange.first - xRangeWidth * 0.1, + m_xRange.second + xRangeWidth * 0.1 ); } //-------------------------------------------------------------------------------------------------- @@ -295,10 +309,10 @@ void RimParameterResultCrossPlot::createPoints() m_yRange.second = std::max( m_yRange.second, closestValue ); RiuQwtPlotCurve* plotCurve = new RiuQwtPlotCurve; - plotCurve->setSamples( parameterValues.data(), caseValuesAtTimestep.data(), (int)parameterValues.size() ); + plotCurve->setSamplesValues( parameterValues, caseValuesAtTimestep ); plotCurve->setStyle( QwtPlotCurve::NoCurve ); RiuQwtSymbol* symbol = - new RiuQwtSymbol( RiuQwtSymbol::cycledSymbolStyle( ensembleIdx, addressIdx ), "" ); + new RiuQwtSymbol( RiuPlotCurveSymbol::cycledSymbolStyle( ensembleIdx, addressIdx ), "" ); symbol->setSize( legendFontSize(), legendFontSize() ); symbol->setColor( colorTable.cycledQColor( caseIdx ) ); plotCurve->setSymbol( symbol ); @@ -309,7 +323,7 @@ void RimParameterResultCrossPlot::createPoints() plotCurve->setTitle( curveName.join( " - " ) ); - plotCurve->attach( m_plotWidget ); + plotCurve->attach( m_plotWidget->qwtPlot() ); } } addressIdx++; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp index bccd8debb0..6c2c861097 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp @@ -119,7 +119,7 @@ RiaDefines::PhaseType RimWellDistributionPlot::phase() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget* RimWellDistributionPlot::viewer() +RiuPlotWidget* RimWellDistributionPlot::plotWidget() { return m_plotWidget; } @@ -170,28 +170,28 @@ void RimWellDistributionPlot::updateLegend() if ( doShowLegend ) { QwtLegend* legend = new QwtLegend( m_plotWidget ); - m_plotWidget->insertLegend( legend, QwtPlot::BottomLegend ); + m_plotWidget->qwtPlot()->insertLegend( legend, QwtPlot::BottomLegend ); } else { - m_plotWidget->insertLegend( nullptr ); + m_plotWidget->qwtPlot()->insertLegend( nullptr ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellDistributionPlot::updateZoomInQwt() +void RimWellDistributionPlot::updateZoomInParentPlot() { - // cvf::Trace::show("RimWellDistributionPlot::updateZoomInQwt()"); + // cvf::Trace::show("RimWellDistributionPlot::updateZoomInParentPlot()"); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellDistributionPlot::updateZoomFromQwt() +void RimWellDistributionPlot::updateZoomFromParentPlot() { - // cvf::Trace::show("RimWellDistributionPlot::updateZoomFromQwt()"); + // cvf::Trace::show("RimWellDistributionPlot::updateZoomFromParentPlot()"); } //-------------------------------------------------------------------------------------------------- @@ -222,7 +222,7 @@ void RimWellDistributionPlot::detachAllCurves() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmObject* RimWellDistributionPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* /*curve*/ ) const +caf::PdmObject* RimWellDistributionPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve* /*curve*/ ) const { // cvf::Trace::show("RimWellDistributionPlot::findPdmObjectFromQwtCurve()"); return nullptr; @@ -282,7 +282,7 @@ void RimWellDistributionPlot::zoomAll() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget* RimWellDistributionPlot::doCreatePlotViewWidget( QWidget* mainWindowParent ) +RiuPlotWidget* RimWellDistributionPlot::doCreatePlotViewWidget( QWidget* mainWindowParent ) { // cvf::Trace::show("RimWellDistributionPlot::createViewWidget()"); @@ -294,7 +294,7 @@ RiuQwtPlotWidget* RimWellDistributionPlot::doCreatePlotViewWidget( QWidget* main m_plotWidget = new RiuQwtPlotWidget( this, mainWindowParent ); - m_plotWidget->setAutoReplot( false ); + m_plotWidget->qwtPlot()->setAutoReplot( false ); updateLegend(); onLoadDataAndUpdate(); @@ -339,7 +339,7 @@ void RimWellDistributionPlot::onLoadDataAndUpdate() return; } - m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve ); + m_plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotCurve ); updateLegend(); @@ -374,12 +374,12 @@ void RimWellDistributionPlot::onLoadDataAndUpdate() const QString plotTitleStr = QString( "%1 Distribution: %2, %3" ).arg( phaseString ).arg( m_wellName ).arg( timeStepName ); - m_plotWidget->setTitle( plotTitleStr ); + m_plotWidget->setPlotTitle( plotTitleStr ); - m_plotWidget->setAxisTitleText( QwtPlot::xBottom, "TOF [years]" ); - m_plotWidget->setAxisTitleText( QwtPlot::yLeft, "Reservoir Volume [m3]" ); - m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true ); - m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true ); + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "TOF [years]" ); + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "Reservoir Volume [m3]" ); + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); m_plotWidget->scheduleReplot(); } @@ -397,11 +397,11 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellD // Currently select this value so that the grid appears on top of the curves const double baseCurveZValue = 9.5; - plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve ); - plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 ); - plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 ); - plotWidget->setAxisAutoScale( QwtPlot::xBottom, true ); - plotWidget->setAxisAutoScale( QwtPlot::yLeft, true ); + plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotCurve ); + plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0, 1 ); + plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0, 1 ); + plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); const std::vector& tofValuesDays = calculator.sortedUniqueTofValues(); if ( tofValuesDays.size() == 0 ) @@ -449,7 +449,7 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellD curve->setBrush( qtClr ); curve->setZ( baseCurveZValue - i * 0.0001 ); curve->setSamples( tofValuesYears.data(), yVals.data(), static_cast( tofValuesYears.size() ) ); - curve->attach( plotWidget ); + curve->attach( plotWidget->qwtPlot() ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h index f3e05d96ae..1949837277 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h @@ -49,18 +49,18 @@ class RimWellDistributionPlot : public RimPlot RiaDefines::PhaseType phase() const; // RimPlot implementations - RiuQwtPlotWidget* viewer() override; - void setAutoScaleXEnabled( bool enabled ) override; - void setAutoScaleYEnabled( bool enabled ) override; - void updateAxes() override; - void updateLegend() override; - void updateZoomInQwt() override; - void updateZoomFromQwt() override; - QString asciiDataForPlotExport() const override; - void reattachAllCurves() override; - void detachAllCurves() override; - caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override; - void onAxisSelected( int axis, bool toggle ) override; + RiuPlotWidget* plotWidget() override; + void setAutoScaleXEnabled( bool enabled ) override; + void setAutoScaleYEnabled( bool enabled ) override; + void updateAxes() override; + void updateLegend() override; + void updateZoomInParentPlot() override; + void updateZoomFromParentPlot() override; + QString asciiDataForPlotExport() const override; + void reattachAllCurves() override; + void detachAllCurves() override; + caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; + void onAxisSelected( int axis, bool toggle ) override; // RimPlotWindow implementations QString description() const override; @@ -76,7 +76,7 @@ class RimWellDistributionPlot : public RimPlot void onLoadDataAndUpdate() override; private: - RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent ) override; + RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent ) override; void fixupDependentFieldsAfterCaseChange(); static void populatePlotWidgetWithCurveData( const RigTofWellDistributionCalculator& calculator, diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp index 47b4d156cf..7231a3ada7 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp @@ -30,7 +30,9 @@ #include "RiaColorTools.h" #include "RiuMultiPlotPage.h" +#include "RiuPlotWidget.h" #include "RiuQwtPlotTools.h" +#include "RiuQwtPlotWidget.h" #include "qwt_legend.h" #include "qwt_plot.h" @@ -217,7 +219,7 @@ void RimWellDistributionPlotCollection::addPlot( RimPlot* plot ) if ( m_viewer ) { plot->createPlotWidget(); - m_viewer->insertPlot( plot->viewer(), index ); + m_viewer->insertPlot( plot->plotWidget(), index ); } plot->setShowWindow( true ); plot->setLegendsVisible( false ); @@ -373,7 +375,7 @@ void RimWellDistributionPlotCollection::updatePlots() for ( RimPlot* plot : m_plots() ) { plot->loadDataAndUpdate(); - plot->updateZoomInQwt(); + plot->updateZoomInParentPlot(); } } } @@ -407,7 +409,7 @@ void RimWellDistributionPlotCollection::recreatePlotWidgets() for ( auto plot : m_plots() ) { plot->createPlotWidget(); - m_viewer->addPlot( plot->viewer() ); + m_viewer->addPlot( plot->plotWidget() ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp index 4ed994addd..0574c63a42 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp @@ -161,7 +161,7 @@ void RimWellFlowRateCurve::onLoadDataAndUpdate( bool updateParentPlot ) { this->RimPlotCurve::updateCurvePresentation( updateParentPlot ); - m_qwtPlotCurve->setTitle( createCurveAutoName() ); + m_plotCurve->setTitle( createCurveAutoName() ); if ( updateParentPlot ) { @@ -172,7 +172,7 @@ void RimWellFlowRateCurve::onLoadDataAndUpdate( bool updateParentPlot ) updateZoomInParentPlot(); } - if ( m_parentQwtPlot ) m_parentQwtPlot->replot(); + if ( hasParentPlot() ) m_parentPlot->replot(); } //-------------------------------------------------------------------------------------------------- @@ -195,9 +195,11 @@ void RimWellFlowRateCurve::updateCurveAppearance() } } - if ( isUsingConnectionNumberDepthType() ) + QwtPlotCurve* qwtPlotCurve = dynamic_cast( m_plotCurve ); + if ( isUsingConnectionNumberDepthType() && qwtPlotCurve ) { - m_qwtPlotCurve->setStyle( QwtPlotCurve::Steps ); + // Steps style only for Qwt. + qwtPlotCurve->setStyle( QwtPlotCurve::Steps ); } if ( m_doFillCurve || isLastCurveInGroup ) // Fill the last curve in group with a transparent color to "tie" the @@ -222,14 +224,19 @@ void RimWellFlowRateCurve::updateCurveAppearance() gradient.setColorAt( 0.6, fillColor ); gradient.setColorAt( 0.8, fillColor.darker( 110 ) ); gradient.setColorAt( 1, fillColor ); - m_qwtPlotCurve->setBrush( gradient ); - - QPen curvePen = m_qwtPlotCurve->pen(); - curvePen.setColor( lineColor ); - m_qwtPlotCurve->setPen( curvePen ); - m_qwtPlotCurve->setOrientation( Qt::Horizontal ); - m_qwtPlotCurve->setBaseline( 0.0 ); - m_qwtPlotCurve->setCurveAttribute( QwtPlotCurve::Inverted, true ); + m_plotCurve->setBrush( gradient ); + + if ( qwtPlotCurve ) + { + // Baseline and orientation only available for Qwt. + QPen curvePen = qwtPlotCurve->pen(); + curvePen.setColor( lineColor ); + qwtPlotCurve->setPen( curvePen ); + qwtPlotCurve->setOrientation( Qt::Horizontal ); + qwtPlotCurve->setBaseline( 0.0 ); + + qwtPlotCurve->setCurveAttribute( QwtPlotCurve::Inverted, true ); + } } } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 6f01c57815..87cc43993b 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -709,7 +709,7 @@ void RimWellPltPlot::addStackedCurve( const QString& curveName, if ( curveGroupId == 0 ) { curve->setDoFillCurve( true ); - curve->setSymbol( RiuQwtSymbol::SYMBOL_NONE ); + curve->setSymbol( RiuPlotCurveSymbol::SYMBOL_NONE ); } else { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index c270833651..970fe4b760 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -156,7 +156,7 @@ void RimWellRftPlot::applyCurveAppearance( RimWellLogCurve* curve ) RiaRftPltCurveDefinition curveDef = RimWellPlotTools::curveDefFromCurve( curve ); RiuQwtPlotCurveDefines::LineStyleEnum lineStyle = RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID; - RiuQwtSymbol::PointSymbolEnum currentSymbol = RiuQwtSymbol::SYMBOL_NONE; + RiuPlotCurveSymbol::PointSymbolEnum currentSymbol = RiuPlotCurveSymbol::SYMBOL_NONE; if ( curveDef.address().sourceType() != RifDataSourceForRftPlt::ENSEMBLE_RFT ) { currentSymbol = m_timeStepSymbols[curveDef.timeStep()]; @@ -571,8 +571,8 @@ void RimWellRftPlot::updateCurvesInPlot( const std::setsetZOrder( RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_STAT_CURVE ) ); applyCurveAppearance( curve ); - auto symbol = statisticsCurveSymbolFromAddress( rftAddress ); - RiuQwtSymbol::LabelPosition labelPos = statisticsLabelPosFromAddress( rftAddress ); + auto symbol = statisticsCurveSymbolFromAddress( rftAddress ); + RiuPlotCurveSymbol::LabelPosition labelPos = statisticsLabelPosFromAddress( rftAddress ); curve->setSymbol( symbol ); curve->setSymbolLabelPosition( labelPos ); curve->setSymbolSize( curve->symbolSize() + 3 ); @@ -1159,39 +1159,39 @@ void RimWellRftPlot::assignWellPathToExtractionCurves() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::PointSymbolEnum RimWellRftPlot::statisticsCurveSymbolFromAddress( const RifEclipseRftAddress& address ) +RiuPlotCurveSymbol::PointSymbolEnum RimWellRftPlot::statisticsCurveSymbolFromAddress( const RifEclipseRftAddress& address ) { switch ( address.wellLogChannel() ) { case RifEclipseRftAddress::PRESSURE_P10: - return RiuQwtSymbol::SYMBOL_TRIANGLE; + return RiuPlotCurveSymbol::SYMBOL_TRIANGLE; case RifEclipseRftAddress::PRESSURE_P50: - return RiuQwtSymbol::SYMBOL_DOWN_TRIANGLE; + return RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE; case RifEclipseRftAddress::PRESSURE_P90: - return RiuQwtSymbol::SYMBOL_LEFT_TRIANGLE; + return RiuPlotCurveSymbol::SYMBOL_LEFT_TRIANGLE; case RifEclipseRftAddress::PRESSURE_MEAN: - return RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE; + return RiuPlotCurveSymbol::SYMBOL_RIGHT_TRIANGLE; } - return RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE; + return RiuPlotCurveSymbol::SYMBOL_RIGHT_TRIANGLE; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::LabelPosition RimWellRftPlot::statisticsLabelPosFromAddress( const RifEclipseRftAddress& address ) +RiuPlotCurveSymbol::LabelPosition RimWellRftPlot::statisticsLabelPosFromAddress( const RifEclipseRftAddress& address ) { switch ( address.wellLogChannel() ) { case RifEclipseRftAddress::PRESSURE_P10: - return RiuQwtSymbol::LabelLeftOfSymbol; + return RiuPlotCurveSymbol::LabelLeftOfSymbol; case RifEclipseRftAddress::PRESSURE_P50: - return RiuQwtSymbol::LabelAboveSymbol; + return RiuPlotCurveSymbol::LabelAboveSymbol; case RifEclipseRftAddress::PRESSURE_P90: - return RiuQwtSymbol::LabelRightOfSymbol; + return RiuPlotCurveSymbol::LabelRightOfSymbol; case RifEclipseRftAddress::PRESSURE_MEAN: - return RiuQwtSymbol::LabelBelowSymbol; + return RiuPlotCurveSymbol::LabelBelowSymbol; } - return RiuQwtSymbol::LabelAboveSymbol; + return RiuPlotCurveSymbol::LabelAboveSymbol; } //-------------------------------------------------------------------------------------------------- @@ -1217,10 +1217,10 @@ cvf::Color3f RimWellRftPlot::findCurveColor( RimWellLogCurve* curve ) if ( m_showStatisticsCurves ) { - if ( plotByIndex( 0 ) && plotByIndex( 0 )->viewer() ) + if ( plotByIndex( 0 ) && plotByIndex( 0 )->plotWidget() ) { cvf::Color3f backgroundColor = - RiaColorTools::fromQColorTo3f( plotByIndex( 0 )->viewer()->canvasBackground().color() ); + RiaColorTools::fromQColorTo3f( plotByIndex( 0 )->plotWidget()->backgroundColor() ); curveColor = RiaColorTools::blendCvfColors( backgroundColor, curveColor, 1, 2 ); } } @@ -1272,7 +1272,7 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::setcanvas(), viewer->overlayMargins() ); + auto m = new RiuDraggableOverlayFrame( viewer->getParentForOverlay(), viewer->overlayMargins() ); m->setContentFrame( curveSet->legendConfig()->makeLegendFrame() ); m_ensembleLegendFrames[curveSet] = m; @@ -1286,12 +1286,12 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set colorTable; RiaColorTables::summaryCurveDefaultPaletteColors().color3fArray().toStdVector( &colorTable ); - std::vector symbolTable = { RiuQwtSymbol::SYMBOL_ELLIPSE, - RiuQwtSymbol::SYMBOL_RECT, - RiuQwtSymbol::SYMBOL_DIAMOND, - RiuQwtSymbol::SYMBOL_CROSS, - RiuQwtSymbol::SYMBOL_XCROSS, - RiuQwtSymbol::SYMBOL_STAR1 }; + std::vector symbolTable = { RiuPlotCurveSymbol::SYMBOL_ELLIPSE, + RiuPlotCurveSymbol::SYMBOL_RECT, + RiuPlotCurveSymbol::SYMBOL_DIAMOND, + RiuPlotCurveSymbol::SYMBOL_CROSS, + RiuPlotCurveSymbol::SYMBOL_XCROSS, + RiuPlotCurveSymbol::SYMBOL_STAR1 }; // Add new curves for ( const RiaRftPltCurveDefinition& curveDefToAdd : allCurveDefs ) diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h index 0e10d3acdd..565d8a33bf 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h @@ -24,7 +24,7 @@ #include "RimWellRftEnsembleCurveSet.h" #include "RifDataSourceForRftPltQMetaType.h" -#include "RiuQwtSymbol.h" +#include "RiuPlotCurveSymbol.h" #include "cafPdmField.h" #include "cafPdmObject.h" @@ -130,8 +130,8 @@ class RimWellRftPlot : public RimWellLogPlot void updateFormationsOnPlot() const; QString associatedSimWellName() const; - static RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseRftAddress& address ); - static RiuQwtSymbol::LabelPosition statisticsLabelPosFromAddress( const RifEclipseRftAddress& address ); + static RiuPlotCurveSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseRftAddress& address ); + static RiuPlotCurveSymbol::LabelPosition statisticsLabelPosFromAddress( const RifEclipseRftAddress& address ); cvf::Color3f findCurveColor( RimWellLogCurve* curve ); void defineCurveColorsAndSymbols( const std::set& allCurveDefs ); @@ -158,9 +158,9 @@ class RimWellRftPlot : public RimWellLogPlot caf::PdmChildArrayField m_ensembleCurveSets; std::map> m_ensembleLegendFrames; - std::map m_dataSourceColors; - std::map m_timeStepSymbols; - bool m_isOnLoad; + std::map m_dataSourceColors; + std::map m_timeStepSymbols; + bool m_isOnLoad; caf::PdmChildField m_wellLogPlot_OBSOLETE; }; diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index 8b0ad9a7f5..e600e90909 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RimGridCrossPlot.h" +#include "RiaDefines.h" #include "RiaFontCache.h" #include "RiaPreferences.h" @@ -30,6 +31,7 @@ #include "RimGridCrossPlotCurve.h" #include "RimGridCrossPlotDataSet.h" #include "RimMultiPlot.h" +#include "RimPlotAxisLogRangeCalculator.h" #include "RimPlotAxisProperties.h" #include "cafPdmUiCheckBoxEditor.h" @@ -41,7 +43,6 @@ #include "qwt_legend.h" #include "qwt_plot.h" #include "qwt_plot_curve.h" -#include "qwt_scale_engine.h" #include @@ -64,13 +65,13 @@ RimGridCrossPlot::RimGridCrossPlot() 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->setNameAndAxis( "X-Axis", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); m_xAxisProperties->setEnableTitleTextSettings( false ); 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->setNameAndAxis( "Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); m_yAxisProperties->setEnableTitleTextSettings( false ); connectAxisSignals( m_xAxisProperties() ); @@ -156,7 +157,7 @@ QWidget* RimGridCrossPlot::viewWidget() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget* RimGridCrossPlot::viewer() +RiuPlotWidget* RimGridCrossPlot::plotWidget() { return m_plotWidget; } @@ -185,7 +186,7 @@ void RimGridCrossPlot::zoomAll() setAutoScaleXEnabled( true ); setAutoScaleYEnabled( true ); - updateZoomInQwt(); + updateZoomInParentPlot(); } //-------------------------------------------------------------------------------------------------- @@ -211,10 +212,13 @@ void RimGridCrossPlot::reattachAllCurves() dataSet->detachAllCurves(); if ( dataSet->isChecked() ) { - dataSet->setParentQwtPlotNoReplot( m_plotWidget ); + dataSet->setParentPlotNoReplot( m_plotWidget ); + dataSet->loadDataAndUpdate( false ); } } - updateZoomInQwt(); + updateCurveNamesAndPlotTitle(); + updateLegend(); + updateZoomInParentPlot(); } } @@ -291,7 +295,8 @@ void RimGridCrossPlot::updateInfoBox() { if ( !m_infoBox ) { - m_infoBox = new RiuDraggableOverlayFrame( m_plotWidget->canvas(), m_plotWidget->overlayMargins() ); + m_infoBox = + new RiuDraggableOverlayFrame( m_plotWidget->getParentForOverlay(), m_plotWidget->overlayMargins() ); m_infoBox->setAnchorCorner( RiuDraggableOverlayFrame::AnchorCorner::TopRight ); RiuTextOverlayContentFrame* textFrame = new RiuTextOverlayContentFrame( m_infoBox ); textFrame->setText( generateInfoBoxText() ); @@ -349,13 +354,13 @@ void RimGridCrossPlot::setAutoScaleYEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmObject* RimGridCrossPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* qwtCurve ) const +caf::PdmObject* RimGridCrossPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve* plotCurve ) const { for ( auto dataSet : m_crossPlotDataSets ) { for ( auto curve : dataSet->curves() ) { - if ( curve->qwtPlotCurve() == qwtCurve ) + if ( curve->isSameCurve( plotCurve ) ) { return curve; } @@ -454,13 +459,13 @@ void RimGridCrossPlot::onPlotZoomed() { setAutoScaleXEnabled( false ); setAutoScaleYEnabled( false ); - updateZoomFromQwt(); + updateZoomFromParentPlot(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget* RimGridCrossPlot::doCreatePlotViewWidget( QWidget* mainWindowParent ) +RiuPlotWidget* RimGridCrossPlot::doCreatePlotViewWidget( QWidget* mainWindowParent ) { if ( !m_plotWidget ) { @@ -468,7 +473,7 @@ RiuQwtPlotWidget* RimGridCrossPlot::doCreatePlotViewWidget( QWidget* mainWindowP for ( auto dataSet : m_crossPlotDataSets ) { - dataSet->setParentQwtPlotNoReplot( m_plotWidget ); + dataSet->setParentPlotNoReplot( m_plotWidget ); } updateCurveNamesAndPlotTitle(); @@ -592,15 +597,16 @@ void RimGridCrossPlot::updatePlot() { if ( m_plotWidget ) { - RiuQwtPlotTools::setCommonPlotBehaviour( m_plotWidget ); - RiuQwtPlotTools::setDefaultAxes( m_plotWidget ); + RiuQwtPlotTools::setCommonPlotBehaviour( m_plotWidget->qwtPlot() ); + RiuQwtPlotTools::setDefaultAxes( m_plotWidget->qwtPlot() ); updateFonts(); updateAxes(); for ( auto dataSet : m_crossPlotDataSets ) { - dataSet->setParentQwtPlotNoReplot( m_plotWidget ); + dataSet->setParentPlotNoReplot( m_plotWidget ); + dataSet->loadDataAndUpdate( false ); } updateLegend(); @@ -635,9 +641,9 @@ void RimGridCrossPlot::swapAxes() RimPlotAxisProperties* xAxisProperties = m_xAxisProperties(); RimPlotAxisProperties* yAxisProperties = m_yAxisProperties(); - QString tmpName = xAxisProperties->name(); - QwtPlot::Axis tmpAxis = xAxisProperties->qwtPlotAxisType(); - xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->qwtPlotAxisType() ); + QString tmpName = xAxisProperties->name(); + RiaDefines::PlotAxis tmpAxis = xAxisProperties->plotAxisType(); + xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->plotAxisType() ); yAxisProperties->setNameAndAxis( tmpName, tmpAxis ); m_xAxisProperties.removeChildObject( xAxisProperties ); @@ -760,14 +766,14 @@ void RimGridCrossPlot::updateLegend() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlot::updateZoomInQwt() +void RimGridCrossPlot::updateZoomInParentPlot() { if ( m_plotWidget ) { updateAxisInQwt( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); updateAxisInQwt( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); - m_plotWidget->updateAxes(); - updateZoomFromQwt(); + m_plotWidget->qwtPlot()->updateAxes(); + updateZoomFromParentPlot(); m_plotWidget->scheduleReplot(); } } @@ -775,7 +781,7 @@ void RimGridCrossPlot::updateZoomInQwt() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlot::updateZoomFromQwt() +void RimGridCrossPlot::updateZoomFromParentPlot() { updateAxisFromQwt( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); updateAxisFromQwt( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); @@ -845,42 +851,39 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType ) axisParameterString = yAxisParameterString(); } - QwtPlot::Axis qwtAxisId = axisProperties->qwtPlotAxisType(); - + RiaDefines::PlotAxis axis = axisProperties->plotAxisType(); if ( axisProperties->isActive() ) { - m_plotWidget->enableAxis( qwtAxisId, true ); + m_plotWidget->enableAxis( axis, true ); Qt::AlignmentFlag alignment = Qt::AlignCenter; if ( axisProperties->titlePosition() == RimPlotAxisPropertiesInterface::AXIS_TITLE_END ) { alignment = Qt::AlignRight; } - m_plotWidget->setAxisFontsAndAlignment( qwtAxisId, + m_plotWidget->setAxisFontsAndAlignment( axis, caf::FontTools::pointSizeToPixelSize( axisProperties->titleFontSize() ), caf::FontTools::pointSizeToPixelSize( axisProperties->valuesFontSize() ), true, alignment ); - m_plotWidget->setAxisTitleText( qwtAxisId, axisParameterString ); - m_plotWidget->setAxisTitleEnabled( qwtAxisId, true ); + m_plotWidget->setAxisTitleText( axis, axisParameterString ); + m_plotWidget->setAxisTitleEnabled( axis, true ); if ( axisProperties->isLogarithmicScaleEnabled ) { - QwtLogScaleEngine* currentScaleEngine = - dynamic_cast( m_plotWidget->axisScaleEngine( axisProperties->qwtPlotAxisType() ) ); - if ( !currentScaleEngine ) + bool isLogScale = m_plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC; + if ( !isLogScale ) { - m_plotWidget->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine ); - m_plotWidget->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 5 ); + m_plotWidget->setAxisScaleType( axis, RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC ); + m_plotWidget->setAxisMaxMinor( axis, 5 ); } double min = axisProperties->visibleRangeMin; double max = axisProperties->visibleRangeMax; if ( axisProperties->isAutoZoom() ) { - std::vector plotCurves = visibleQwtCurves(); - - RimPlotAxisLogRangeCalculator logRangeCalculator( qwtAxisId, plotCurves ); + std::vector plotCurves = visibleCurves(); + RimPlotAxisLogRangeCalculator logRangeCalculator( axis, plotCurves ); logRangeCalculator.computeAxisRange( &min, &max ); } @@ -888,23 +891,21 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType ) { std::swap( min, max ); } - m_plotWidget->setAxisScale( qwtAxisId, min, max ); + m_plotWidget->setAxisScale( axis, min, max ); } else { - QwtLinearScaleEngine* currentScaleEngine = - dynamic_cast( m_plotWidget->axisScaleEngine( axisProperties->qwtPlotAxisType() ) ); - if ( !currentScaleEngine ) + bool isLinearScale = m_plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LINEAR; + if ( !isLinearScale ) { - m_plotWidget->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine ); - m_plotWidget->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 3 ); + m_plotWidget->setAxisScaleType( axis, RiuQwtPlotWidget::AxisScaleType::LINEAR ); + m_plotWidget->setAxisMaxMinor( axis, 3 ); } if ( axisProperties->isAutoZoom() ) { - m_plotWidget->setAxisAutoScale( qwtAxisId ); - m_plotWidget->axisScaleEngine( axisProperties->qwtPlotAxisType() ) - ->setAttribute( QwtScaleEngine::Inverted, axisProperties->isAxisInverted() ); + m_plotWidget->setAxisAutoScale( axis, true ); + m_plotWidget->setAxisInverted( axis, axisProperties->isAxisInverted() ); } else { @@ -915,13 +916,13 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType ) std::swap( min, max ); } - m_plotWidget->setAxisScale( qwtAxisId, min, max ); + m_plotWidget->setAxisScale( axis, min, max ); } } } else { - m_plotWidget->enableAxis( qwtAxisId, false ); + m_plotWidget->enableAxis( axis, false ); } } @@ -932,20 +933,23 @@ void RimGridCrossPlot::updateAxisFromQwt( RiaDefines::PlotAxis axisType ) { if ( !m_plotWidget ) return; - QwtInterval xAxisRange = m_plotWidget->axisRange( QwtPlot::xBottom ); - QwtInterval yAxisRange = m_plotWidget->axisRange( QwtPlot::yLeft ); + auto [xAxisRangeMin, xAxisRangeMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); RimPlotAxisProperties* axisProperties = m_xAxisProperties(); - QwtInterval axisRange = xAxisRange; + double axisRangeMin = xAxisRangeMin; + double axisRangeMax = xAxisRangeMax; if ( axisType == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) { - axisProperties = m_yAxisProperties(); - axisRange = yAxisRange; + axisProperties = m_yAxisProperties(); + auto [yAxisRangeMin, yAxisRangeMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); + + axisRangeMin = yAxisRangeMin; + axisRangeMax = yAxisRangeMax; } - axisProperties->visibleRangeMin = std::min( axisRange.minValue(), axisRange.maxValue() ); - axisProperties->visibleRangeMax = std::max( axisRange.minValue(), axisRange.maxValue() ); + axisProperties->visibleRangeMin = std::min( axisRangeMin, axisRangeMax ); + axisProperties->visibleRangeMax = std::max( axisRangeMin, axisRangeMax ); axisProperties->updateConnectedEditors(); } @@ -953,9 +957,9 @@ void RimGridCrossPlot::updateAxisFromQwt( RiaDefines::PlotAxis axisType ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimGridCrossPlot::visibleQwtCurves() const +std::vector RimGridCrossPlot::visibleCurves() const { - std::vector plotCurves; + std::vector plotCurves; for ( auto dataSet : m_crossPlotDataSets ) { if ( dataSet->isChecked() ) @@ -964,7 +968,7 @@ std::vector RimGridCrossPlot::visibleQwtCurves() const { if ( curve->isCurveVisible() ) { - plotCurves.push_back( curve->qwtPlotCurve() ); + plotCurves.push_back( curve ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h index 11509e415c..36d460f79d 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h @@ -21,7 +21,7 @@ #include "cafPdmChildField.h" #include "cafPdmObject.h" -#include "RiaDefines.h" +#include "RiaPlotDefines.h" #include "RimNameConfig.h" #include "RimPlot.h" @@ -34,6 +34,7 @@ class RimPlotAxisProperties; class RimGridCrossPlotDataSet; class RiuDraggableOverlayFrame; class RiuGridCrossQwtPlot; +class RimPlotCurve; class RimGridCrossPlotNameConfig : public RimNameConfig { @@ -69,8 +70,8 @@ class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface std::vector dataSets() const; - QWidget* viewWidget() override; - RiuQwtPlotWidget* viewer() override; + QWidget* viewWidget() override; + RiuPlotWidget* plotWidget() override; QImage snapshotWindowContent() override; void zoomAll() override; @@ -98,12 +99,12 @@ class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface void updateLegend() override; - void updateZoomInQwt() override; - void updateZoomFromQwt() override; + void updateZoomInParentPlot() override; + void updateZoomFromParentPlot() override; void setAutoScaleXEnabled( bool enabled ) override; void setAutoScaleYEnabled( bool enabled ) override; - caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override; + caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; void onAxisSelected( int axis, bool toggle ) override; bool isDeletable() const override; @@ -124,7 +125,7 @@ class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface void updateAxisInQwt( RiaDefines::PlotAxis axisType ); void updateAxisFromQwt( RiaDefines::PlotAxis axisType ); - std::vector visibleQwtCurves() const; + std::vector visibleCurves() const; RimPlotAxisProperties* xAxisProperties(); RimPlotAxisProperties* yAxisProperties(); @@ -135,7 +136,7 @@ class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface std::set allPlotAxes() const; private: - RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; + RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; void doUpdateLayout() override; void cleanupBeforeClose(); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp index b62f3665a9..7130e6f6fd 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp @@ -18,28 +18,10 @@ #include "RimGridCrossPlotCurve.h" -#include "RigCaseCellResultCalculator.h" - -#include "RimCase.h" -#include "RimEclipseCase.h" -#include "RimEclipseResultDefinition.h" #include "RimGridCrossPlot.h" -#include "RimTools.h" - -#include "RiuQwtPlotCurve.h" -#include "RiuQwtSymbol.h" - -#include "cafPdmUiComboBoxEditor.h" - -#include -#include -#include -#include "qwt_graphic.h" -#include "qwt_plot.h" -#include "qwt_plot_curve.h" - -#include +#include "RiuPlotCurve.h" +#include "RiuPlotWidget.h" CAF_PDM_SOURCE_INIT( RimGridCrossPlotCurve, "GridCrossPlotCurve" ); @@ -53,7 +35,7 @@ RimGridCrossPlotCurve::RimGridCrossPlotCurve() CAF_PDM_InitObject( "Cross Plot Points", ":/WellLogCurve16x16.png" ); setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); - setSymbol( RiuQwtSymbol::SYMBOL_NONE ); + setSymbol( RiuPlotCurveSymbol::SYMBOL_NONE ); setSymbolSize( 4 ); } @@ -73,9 +55,9 @@ void RimGridCrossPlotCurve::setSamples( const std::vector& xValues, cons { CVF_ASSERT( xValues.size() == yValues.size() ); - if ( xValues.empty() || yValues.empty() || !m_qwtPlotCurve ) return; + if ( xValues.empty() || yValues.empty() || !m_plotCurve ) return; - m_qwtPlotCurve->setSamples( &xValues[0], &yValues[0], static_cast( xValues.size() ) ); + m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, false ); } //-------------------------------------------------------------------------------------------------- @@ -100,7 +82,7 @@ int RimGridCrossPlotCurve::groupIndex() const //-------------------------------------------------------------------------------------------------- size_t RimGridCrossPlotCurve::sampleCount() const { - return m_qwtPlotCurve ? m_qwtPlotCurve->dataSize() : 0; + return m_plotCurve ? m_plotCurve->numSamples() : 0; } //-------------------------------------------------------------------------------------------------- @@ -108,12 +90,12 @@ size_t RimGridCrossPlotCurve::sampleCount() const //-------------------------------------------------------------------------------------------------- void RimGridCrossPlotCurve::determineLegendIcon() { - if ( !m_qwtPlotCurve ) return; + if ( !m_plotCurve ) return; RimGridCrossPlot* plot = nullptr; firstAncestorOrThisOfTypeAsserted( plot ); int fontSize = plot->legendFontSize(); - m_qwtPlotCurve->setLegendIconSize( QSize( fontSize, fontSize ) ); + m_plotCurve->setLegendIconSize( QSize( fontSize, fontSize ) ); } //-------------------------------------------------------------------------------------------------- @@ -121,9 +103,9 @@ void RimGridCrossPlotCurve::determineLegendIcon() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlotCurve::setBlackAndWhiteLegendIcons( bool blackAndWhite ) { - if ( m_qwtPlotCurve ) + if ( m_plotCurve ) { - m_qwtPlotCurve->setBlackAndWhiteLegendIcon( blackAndWhite ); + m_plotCurve->setBlackAndWhiteLegendIcon( blackAndWhite ); } } @@ -132,7 +114,7 @@ void RimGridCrossPlotCurve::setBlackAndWhiteLegendIcons( bool blackAndWhite ) //-------------------------------------------------------------------------------------------------- void RimGridCrossPlotCurve::determineSymbol() { - RiuQwtSymbol::PointSymbolEnum symbol = RiuQwtSymbol::cycledSymbolStyle( m_dataSetIndex ); + RiuPlotCurveSymbol::PointSymbolEnum symbol = RiuPlotCurveSymbol::cycledSymbolStyle( m_dataSetIndex ); setSymbol( symbol ); } @@ -146,20 +128,6 @@ void RimGridCrossPlotCurve::updateZoomInParentPlot() plot->calculateZoomRangeAndUpdateQwt(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotCurve::updateLegendsInPlot() -{ - RimGridCrossPlot* plot = nullptr; - this->firstAncestorOrThisOfType( plot ); - if ( plot ) - { - plot->reattachAllCurves(); - } - RimPlotCurve::updateLegendsInPlot(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -175,7 +143,7 @@ void RimGridCrossPlotCurve::onLoadDataAndUpdate( bool updateParentPlot ) { if ( updateParentPlot ) { - m_parentQwtPlot->replot(); + m_parentPlot->replot(); } } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.h b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.h index dc580fa302..bfc7ce940c 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.h +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.h @@ -19,16 +19,6 @@ #include "RimPlotCurve.h" -#include "cafPdmChildField.h" -#include "cafPdmPtrField.h" - -#include -#include - -class RimCase; -class RimEclipseResultDefinition; -class QwtPlotCurve; - //================================================================================================== /// /// @@ -52,7 +42,6 @@ class RimGridCrossPlotCurve : public RimPlotCurve protected: void determineSymbol(); void updateZoomInParentPlot() override; - void updateLegendsInPlot() override; QString createCurveAutoName() override; void onLoadDataAndUpdate( bool updateParentPlot ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp index c245681a57..999ffa4618 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp @@ -34,6 +34,7 @@ #include "RiuDraggableOverlayFrame.h" #include "RiuGridCrossQwtPlot.h" +#include "RiuPlotWidget.h" #include "RiuScalarMapperLegendFrame.h" #include "RimCase.h" @@ -62,6 +63,8 @@ #include "cvfScalarMapper.h" #include "cvfqtUtils.h" +#include "qwt_plot.h" + #include CAF_PDM_SOURCE_INIT( RimGridCrossPlotDataSet, "GridCrossPlotCurveSet" ); @@ -196,11 +199,11 @@ void RimGridCrossPlotDataSet::loadDataAndUpdate( bool updateParentPlot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::setParentQwtPlotNoReplot( QwtPlot* parent ) +void RimGridCrossPlotDataSet::setParentPlotNoReplot( RiuPlotWidget* parent ) { for ( auto& curve : m_crossPlotCurves() ) { - curve->setParentQwtPlotNoReplot( m_isChecked() ? parent : nullptr ); + curve->setParentPlotNoReplot( m_isChecked() ? parent : nullptr ); } } @@ -341,7 +344,7 @@ void RimGridCrossPlotDataSet::detachAllCurves() { for ( auto curve : m_crossPlotCurves() ) { - curve->detachQwtCurve(); + curve->detach(); } } @@ -652,8 +655,9 @@ void RimGridCrossPlotDataSet::fillCurveDataInExistingCurves( const RigEclipseCro { CVF_ASSERT( m_crossPlotCurves.size() == 1u ); RimGridCrossPlotCurve* curve = m_crossPlotCurves[0]; - curve->setSamples( result.xValues, result.yValues ); curve->setGroupingInformation( indexInPlot(), 0 ); + curve->updateCurveVisibility(); + curve->setSamples( result.xValues, result.yValues ); curve->updateCurveAppearance(); curve->updateUiIconFromPlotSymbol(); } @@ -665,8 +669,9 @@ void RimGridCrossPlotDataSet::fillCurveDataInExistingCurves( const RigEclipseCro 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->updateCurveVisibility(); + curve->setSamples( groupIt->second.xValues, groupIt->second.yValues ); curve->updateCurveAppearance(); curve->updateUiIconFromPlotSymbol(); } @@ -1009,7 +1014,7 @@ void RimGridCrossPlotDataSet::updateLegendRange() RimGridCrossPlot* parent; this->firstAncestorOrThisOfTypeAsserted( parent ); - if ( parent->viewer() ) + if ( parent->plotWidget() ) { if ( groupingEnabled() && m_case() && isChecked() && legendConfig()->showLegend() ) { @@ -1050,17 +1055,17 @@ void RimGridCrossPlotDataSet::updateLegendRange() } if ( !m_legendOverlayFrame ) { - m_legendOverlayFrame = - new RiuDraggableOverlayFrame( parent->viewer()->canvas(), parent->viewer()->overlayMargins() ); + m_legendOverlayFrame = new RiuDraggableOverlayFrame( parent->plotWidget()->getParentForOverlay(), + parent->plotWidget()->overlayMargins() ); } m_legendOverlayFrame->setContentFrame( legendConfig()->makeLegendFrame() ); - parent->viewer()->addOverlayFrame( m_legendOverlayFrame ); + parent->plotWidget()->addOverlayFrame( m_legendOverlayFrame ); } else { if ( m_legendOverlayFrame ) { - parent->viewer()->removeOverlayFrame( m_legendOverlayFrame ); + parent->plotWidget()->removeOverlayFrame( m_legendOverlayFrame ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h index 8c2a877ca1..8bc6a389ab 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h @@ -54,6 +54,7 @@ class RiuDraggableOverlayFrame; class QwtPlot; class QwtPlotCurve; class QString; +class RiuPlotWidget; class RimGridCrossPlotDataSetNameConfig : public RimNameConfig { @@ -99,7 +100,7 @@ class RimGridCrossPlotDataSet : public RimCheckableNamedObject, public RimNameCo void setCellFilterView( RimGridView* cellFilterView ); void loadDataAndUpdate( bool updateParentPlot ); - void setParentQwtPlotNoReplot( QwtPlot* parent ); + void setParentPlotNoReplot( RiuPlotWidget* parent ); QString xAxisName() const; QString yAxisName() const; QString infoText() const; diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index df5e36e92a..e02d18c582 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -294,7 +294,7 @@ void RimDepthTrackPlot::updateZoom() for ( RimPlot* plot : plots() ) { static_cast( plot )->setVisibleYRange( m_minVisibleDepth(), m_maxVisibleDepth() ); - plot->updateZoomInQwt(); + plot->updateZoomInParentPlot(); } if ( m_viewer ) @@ -588,7 +588,7 @@ void RimDepthTrackPlot::recreatePlotWidgets() for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx ) { plotVector[tIdx]->createPlotWidget(); - m_viewer->addPlot( plotVector[tIdx]->viewer() ); + m_viewer->addPlot( plotVector[tIdx]->plotWidget() ); } } @@ -1029,7 +1029,7 @@ void RimDepthTrackPlot::insertPlot( RimPlot* plot, size_t index ) if ( m_viewer ) { plot->createPlotWidget(); - m_viewer->insertPlot( plot->viewer(), index ); + m_viewer->insertPlot( plot->plotWidget(), index ); } plot->setShowWindow( true ); onPlotAdditionOrRemoval(); @@ -1045,7 +1045,7 @@ void RimDepthTrackPlot::removePlot( RimPlot* plot ) { if ( m_viewer ) { - m_viewer->removePlot( plot->viewer() ); + m_viewer->removePlot( plot->plotWidget() ); } m_plots.removeChildObject( plot ); diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h index af772f2aff..92e69c2f2e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h @@ -22,6 +22,7 @@ #include "RiaDefines.h" #include "RimAbstractPlotCollection.h" #include "RimEnsembleWellLogStatistics.h" +#include "RimPlot.h" #include "RimPlotWindow.h" #include "RimWellLogPlotNameConfig.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp index e05a7fefd0..ed4fc2da8b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp @@ -378,7 +378,7 @@ void RimGridTimeHistoryCurve::updateZoomInParentPlot() RimSummaryPlot* plot = nullptr; firstAncestorOrThisOfType( plot ); - plot->updateZoomInQwt(); + plot->updateZoomInParentPlot(); } //-------------------------------------------------------------------------------------------------- @@ -415,11 +415,11 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate( bool updateParentPlot ) std::vector dateTimes = timeStepValues(); if ( dateTimes.size() > 0 && dateTimes.size() == values.size() ) { - m_qwtPlotCurve->setSamplesFromTimeTAndYValues( dateTimes, values, isLogCurve ); + m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, values, isLogCurve ); } else { - m_qwtPlotCurve->setSamplesFromTimeTAndYValues( std::vector(), std::vector(), isLogCurve ); + m_plotCurve->setSamplesFromTimeTAndYValues( std::vector(), std::vector(), isLogCurve ); } } else @@ -435,17 +435,17 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate( bool updateParentPlot ) times.push_back( timeScale * day ); } - m_qwtPlotCurve->setSamplesFromXValuesAndYValues( times, values, isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( times, values, isLogCurve ); } else { - m_qwtPlotCurve->setSamplesFromTimeTAndYValues( std::vector(), std::vector(), isLogCurve ); + m_plotCurve->setSamplesFromTimeTAndYValues( std::vector(), std::vector(), isLogCurve ); } } updateZoomInParentPlot(); - if ( m_parentQwtPlot ) m_parentQwtPlot->replot(); + if ( m_parentPlot ) m_parentPlot->replot(); updateQwtPlotAxis(); plot->updateAxes(); @@ -708,17 +708,7 @@ QString RimGridTimeHistoryCurve::geometrySelectionText() const //-------------------------------------------------------------------------------------------------- void RimGridTimeHistoryCurve::updateQwtPlotAxis() { - if ( m_qwtPlotCurve ) - { - if ( this->yAxis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) - { - m_qwtPlotCurve->setYAxis( QwtPlot::yLeft ); - } - else - { - m_qwtPlotCurve->setYAxis( QwtPlot::yRight ); - } - } + if ( m_plotCurve ) updateAxisInPlot( yAxis() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp index 3bd71ad6ff..3dc1efc4fe 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp @@ -100,6 +100,7 @@ void RimMdiWindowController::removeWindowFromMDI() if ( mainWin && viewWidget() ) { mainWin->removeViewer( viewWidget() ); + viewPdmObject()->deleteViewWidget(); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 202bbf8da8..15d9c5248d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -197,7 +197,7 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index ) if ( m_viewer ) { plot->createPlotWidget(); - m_viewer->insertPlot( plot->viewer(), index ); + m_viewer->insertPlot( plot->plotWidget(), index ); } plot->setShowWindow( true ); plot->updateAfterInsertingIntoMultiPlot(); @@ -215,7 +215,7 @@ void RimMultiPlot::removePlot( RimPlot* plot ) { if ( m_viewer ) { - m_viewer->removePlot( plot->viewer() ); + m_viewer->removePlot( plot->plotWidget() ); } m_plots.removeChildObject( plot ); @@ -273,7 +273,7 @@ void RimMultiPlot::insertPlots( const std::vector& plots ) if ( m_viewer ) { plot->createPlotWidget(); - m_viewer->insertPlot( plot->viewer(), -1 ); + m_viewer->insertPlot( plot->plotWidget(), -1 ); } plot->setShowWindow( true ); plot->updateAfterInsertingIntoMultiPlot(); @@ -291,7 +291,7 @@ void RimMultiPlot::deleteAllPlots() { if ( plot && m_viewer ) { - m_viewer->removePlot( plot->viewer() ); + m_viewer->removePlot( plot->plotWidget() ); } } @@ -391,8 +391,8 @@ void RimMultiPlot::doRenderWindowContent( QPaintDevice* paintDevice ) void RimMultiPlot::updatePlotOrderFromGridWidget() { std::sort( m_plots.begin(), m_plots.end(), [this]( RimPlot* lhs, RimPlot* rhs ) { - auto indexLhs = m_viewer->indexOfPlotWidget( lhs->viewer() ); - auto indexRhs = m_viewer->indexOfPlotWidget( rhs->viewer() ); + auto indexLhs = m_viewer->indexOfPlotWidget( lhs->plotWidget() ); + auto indexRhs = m_viewer->indexOfPlotWidget( rhs->plotWidget() ); return indexLhs < indexRhs; } ); updateSubPlotNames(); @@ -877,7 +877,7 @@ void RimMultiPlot::updateZoom() { for ( RimPlot* plot : plots() ) { - plot->updateZoomInQwt(); + plot->updateZoomInParentPlot(); } } @@ -895,7 +895,7 @@ void RimMultiPlot::recreatePlotWidgets() for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx ) { plotVector[tIdx]->createPlotWidget(); - m_viewer->addPlot( plotVector[tIdx]->viewer() ); + m_viewer->addPlot( plotVector[tIdx]->plotWidget() ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 51d31dbba9..be4ca57e30 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -19,6 +19,7 @@ #pragma once #include "RimAbstractPlotCollection.h" +#include "RimPlot.h" #include "RimPlotAxisPropertiesInterface.h" #include "RimPlotWindow.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index 2407194abe..1880414555 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -26,12 +26,10 @@ #include "RimPlotWindow.h" #include "RiuPlotMainWindowTools.h" -#include "RiuQwtPlotWidget.h" +#include "RiuPlotWidget.h" #include "cafPdmObject.h" -#include "qwt_plot_curve.h" - namespace caf { template <> @@ -73,9 +71,7 @@ RimPlot::~RimPlot() //-------------------------------------------------------------------------------------------------- QWidget* RimPlot::createViewWidget( QWidget* parent /*= nullptr */ ) { - RiuQwtPlotWidget* plotWidget = doCreatePlotViewWidget( parent ); - - RimPlot::attachPlotWidgetSignals( this, plotWidget ); + RiuPlotWidget* plotWidget = doCreatePlotViewWidget( parent ); updateWindowVisibility(); plotWidget->scheduleReplot(); @@ -88,10 +84,10 @@ QWidget* RimPlot::createViewWidget( QWidget* parent /*= nullptr */ ) //-------------------------------------------------------------------------------------------------- void RimPlot::updateFonts() { - if ( viewer() ) + if ( plotWidget() ) { - viewer()->setPlotTitleFontSize( titleFontSize() ); - viewer()->setLegendFontSize( legendFontSize() ); + plotWidget()->setPlotTitleFontSize( titleFontSize() ); + plotWidget()->setLegendFontSize( legendFontSize() ); } } @@ -195,30 +191,14 @@ void RimPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const Q } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlot::attachPlotWidgetSignals( RimPlot* plot, RiuQwtPlotWidget* plotWidget ) -{ - CAF_ASSERT( plot && plotWidget ); - plot->connect( plotWidget, SIGNAL( plotSelected( bool ) ), SLOT( onPlotSelected( bool ) ) ); - plot->connect( plotWidget, SIGNAL( axisSelected( int, bool ) ), SLOT( onAxisSelected( int, bool ) ) ); - plot->connect( plotWidget, - SIGNAL( plotItemSelected( QwtPlotItem*, bool, int ) ), - SLOT( onPlotItemSelected( QwtPlotItem*, bool, int ) ) ); - plot->connect( plotWidget, SIGNAL( onKeyPressEvent( QKeyEvent* ) ), SLOT( onKeyPressEvent( QKeyEvent* ) ) ); - plot->connect( plotWidget, SIGNAL( onWheelEvent( QWheelEvent* ) ), SLOT( onWheelEvent( QWheelEvent* ) ) ); - plot->connect( plotWidget, SIGNAL( destroyed() ), SLOT( onViewerDestroyed() ) ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimPlot::doRenderWindowContent( QPaintDevice* paintDevice ) { - if ( viewer() ) + if ( plotWidget() ) { - viewer()->renderTo( paintDevice, viewer()->frameGeometry() ); + plotWidget()->renderTo( paintDevice, plotWidget()->frameGeometry() ); } } @@ -237,29 +217,6 @@ void RimPlot::onPlotSelected( bool toggle ) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ) -{ - QwtPlotCurve* curve = dynamic_cast( plotItem ); - if ( curve ) - { - RimPlotCurve* selectedCurve = dynamic_cast( this->findPdmObjectFromQwtCurve( curve ) ); - if ( selectedCurve ) - { - if ( toggle ) - { - RiuPlotMainWindowTools::toggleItemInSelection( selectedCurve ); - } - else - { - RiuPlotMainWindowTools::selectAsCurrentItem( selectedCurve ); - } - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -302,3 +259,45 @@ void RimPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, { loadDataAndUpdate(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlot::updateZoomInParentPlot() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlot::updateZoomFromParentPlot() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlot::handleKeyPressEvent( QKeyEvent* event ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlot::handleWheelEvent( QWheelEvent* event ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlot::onPlotItemSelected( std::shared_ptr, bool, int ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlot::onAxisSelected( int axis, bool toggle ) +{ +} diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.h b/ApplicationLibCode/ProjectDataModel/RimPlot.h index d792ffe481..7a9a6e1559 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.h @@ -30,13 +30,11 @@ #include #include -class RiuQwtPlotWidget; -class RimPlotCurve; -class QwtPlotCurve; -class QwtPlotItem; - class QPaintDevice; class QWheelEvent; +class RiuPlotWidget; +class RiuPlotCurve; +class RiuPlotItem; //================================================================================================== /// @@ -73,21 +71,16 @@ class RimPlot : public QObject, public RimPlotWindow void updateAfterInsertingIntoMultiPlot(); // Pure virtual interface methods - virtual RiuQwtPlotWidget* viewer() = 0; - virtual void setAutoScaleXEnabled( bool enabled ) = 0; virtual void setAutoScaleYEnabled( bool enabled ) = 0; virtual void updateAxes() = 0; - virtual void updateLegend() = 0; - virtual void updateZoomInQwt() = 0; - virtual void updateZoomFromQwt() = 0; + virtual void updateLegend() = 0; virtual QString asciiDataForPlotExport() const = 0; - virtual void reattachAllCurves() = 0; - virtual void detachAllCurves() = 0; - virtual caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const = 0; + virtual void reattachAllCurves() = 0; + virtual void detachAllCurves() = 0; void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector& referringObjects ) override; @@ -100,25 +93,31 @@ class RimPlot : public QObject, public RimPlotWindow return parentPlotWindow != nullptr; } + virtual RiuPlotWidget* plotWidget() = 0; + + virtual void updateZoomInParentPlot(); + virtual void updateZoomFromParentPlot(); + + virtual caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const { return nullptr; }; + protected: + virtual RiuPlotWidget* doCreatePlotViewWidget( QWidget* parent ) = 0; + + QWidget* createViewWidget( QWidget* parent = nullptr ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - static void attachPlotWidgetSignals( RimPlot* plot, RiuQwtPlotWidget* plotWidget ); - QWidget* createViewWidget( QWidget* parent = nullptr ) final; - void updateFonts() override; + void doRenderWindowContent( QPaintDevice* paintDevice ) override; -private: - void doRenderWindowContent( QPaintDevice* paintDevice ) override; - virtual void handleKeyPressEvent( QKeyEvent* event ) {} - virtual void handleWheelEvent( QWheelEvent* event ) {} - virtual RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* parent ) = 0; + virtual void handleKeyPressEvent( QKeyEvent* event ); + virtual void handleWheelEvent( QWheelEvent* event ); private slots: + virtual void onAxisSelected( int axis, bool toggle ); + virtual void onPlotItemSelected( std::shared_ptr selectedItem, bool toggleItem, int sampleIndex ); void onPlotSelected( bool toggle ); - virtual void onAxisSelected( int axis, bool toggle ) {} - virtual void onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int sampleIndex ); void onViewerDestroyed(); void onKeyPressEvent( QKeyEvent* event ); void onWheelEvent( QWheelEvent* event ); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisLogRangeCalculator.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisLogRangeCalculator.cpp new file mode 100644 index 0000000000..b10d648262 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisLogRangeCalculator.cpp @@ -0,0 +1,116 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimPlotAxisLogRangeCalculator.h" + +#include "RiaPlotDefines.h" + +#include "RimPlotCurve.h" + +#include "cvfVector2.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimPlotAxisLogRangeCalculator::RimPlotAxisLogRangeCalculator( RiaDefines::PlotAxis axis, + const std::vector& curves ) + : m_axis( axis ) + , m_curves( curves ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisLogRangeCalculator::computeAxisRange( double* minPositive, double* max ) const +{ + double minPosValue = HUGE_VAL; + double maxValue = -HUGE_VAL; + + for ( const RimPlotCurve* curve : m_curves ) + { + double minPosCurveValue = HUGE_VAL; + double maxCurveValue = -HUGE_VAL; + + if ( curveValueRange( curve, &minPosCurveValue, &maxCurveValue ) ) + { + if ( minPosCurveValue < minPosValue ) + { + CVF_ASSERT( minPosCurveValue > 0.0 ); + minPosValue = minPosCurveValue; + } + + if ( maxCurveValue > maxValue ) + { + maxValue = maxCurveValue; + } + } + } + + if ( minPosValue == HUGE_VAL ) + { + minPosValue = RiaDefines::minimumDefaultLogValuePlot(); + maxValue = RiaDefines::maximumDefaultValuePlot(); + } + + *minPositive = minPosValue; + *max = maxValue; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotAxisLogRangeCalculator::curveValueRange( const RimPlotCurve* curve, double* minPositive, double* max ) const +{ + if ( !curve ) return false; + + if ( curve->dataSize() < 1 ) + { + return false; + } + + float minPosF = std::numeric_limits::infinity(); + float maxF = -std::numeric_limits::infinity(); + + int axisValueIndex = 0; + if ( RiaDefines::isVertical( m_axis ) ) + { + axisValueIndex = 1; + } + + for ( int i = 0; i < curve->dataSize(); ++i ) + { + auto [x, y] = curve->sample( i ); + cvf::Vec2f vec( x, y ); + float value = vec[axisValueIndex]; + if ( value == HUGE_VALF ) continue; + + maxF = std::max( maxF, value ); + if ( value > 0.0f && value < minPosF ) + { + minPosF = value; + } + } + + *minPositive = minPosF; + *max = maxF; + + return true; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisLogRangeCalculator.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisLogRangeCalculator.h new file mode 100644 index 0000000000..9bfb9164b9 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisLogRangeCalculator.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaPlotDefines.h" + +#include + +class RimPlotCurve; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimPlotAxisLogRangeCalculator +{ +public: + RimPlotAxisLogRangeCalculator( RiaDefines::PlotAxis axis, const std::vector& curves ); + + void computeAxisRange( double* minPositive, double* max ) const; + +private: + bool curveValueRange( const RimPlotCurve* curve, double* minPositive, double* max ) const; + +private: + RiaDefines::PlotAxis m_axis; + const std::vector m_curves; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 1a2a93d8cb..e5067bbb03 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -19,13 +19,9 @@ #include "RimPlotAxisProperties.h" -#include "RiaApplication.h" #include "RiaDefines.h" -#include "RiaFontCache.h" #include "RiaPreferences.h" -#include "RigStatisticsCalculator.h" -#include "RimPlot.h" #include "RimPlotAxisAnnotation.h" #include "cafPdmUiSliderEditor.h" @@ -34,74 +30,67 @@ #include -#include - -// clang-format off namespace caf { -template<> +template <> void caf::AppEnum::setUp() { - addItem(RimPlotAxisProperties::NUMBER_FORMAT_AUTO, "NUMBER_FORMAT_AUTO", "Auto"); - addItem(RimPlotAxisProperties::NUMBER_FORMAT_DECIMAL, "NUMBER_FORMAT_DECIMAL", "Decimal"); - addItem(RimPlotAxisProperties::NUMBER_FORMAT_SCIENTIFIC, "NUMBER_FORMAT_SCIENTIFIC", "Scientific"); + addItem( RimPlotAxisProperties::NUMBER_FORMAT_AUTO, "NUMBER_FORMAT_AUTO", "Auto" ); + addItem( RimPlotAxisProperties::NUMBER_FORMAT_DECIMAL, "NUMBER_FORMAT_DECIMAL", "Decimal" ); + addItem( RimPlotAxisProperties::NUMBER_FORMAT_SCIENTIFIC, "NUMBER_FORMAT_SCIENTIFIC", "Scientific" ); - setDefault(RimPlotAxisProperties::NUMBER_FORMAT_AUTO); + setDefault( RimPlotAxisProperties::NUMBER_FORMAT_AUTO ); } } // namespace caf -CAF_PDM_SOURCE_INIT(RimPlotAxisProperties, "SummaryYAxisProperties"); +CAF_PDM_SOURCE_INIT( RimPlotAxisProperties, "SummaryYAxisProperties" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimPlotAxisProperties::RimPlotAxisProperties() - : settingsChanged(this) - , logarithmicChanged(this) - , m_enableTitleTextSettings(true) - , m_isRangeSettingsEnabled(true) + : settingsChanged( this ) + , logarithmicChanged( this ) + , m_enableTitleTextSettings( true ) + , m_isRangeSettingsEnabled( true ) { - CAF_PDM_InitObject("Axis Properties", ":/LeftAxis16x16.png"); + CAF_PDM_InitObject( "Axis Properties", ":/LeftAxis16x16.png" ); - CAF_PDM_InitField(&m_isActive, "Active", true, "Active"); - m_isActive.uiCapability()->setUiHidden(true); + CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); + m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault(&m_name, "Name", "Name"); - m_name.uiCapability()->setUiHidden(true); + CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name" ); + m_name.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField(&isAutoTitle, "AutoTitle", true, "Auto Title"); - - CAF_PDM_InitField(&m_displayLongName, "DisplayLongName", true, " Names"); - CAF_PDM_InitField(&m_displayShortName, "DisplayShortName", false, " Acronyms"); - CAF_PDM_InitField(&m_displayUnitText, "DisplayUnitText", true, " Units"); + CAF_PDM_InitField( &isAutoTitle, "AutoTitle", true, "Auto Title" ); - CAF_PDM_InitFieldNoDefault(&customTitle, "CustomTitle", "Title"); + CAF_PDM_InitField( &m_displayLongName, "DisplayLongName", true, " Names" ); + CAF_PDM_InitField( &m_displayShortName, "DisplayShortName", false, " Acronyms" ); + CAF_PDM_InitField( &m_displayUnitText, "DisplayUnitText", true, " Units" ); - CAF_PDM_InitField(&visibleRangeMax, "VisibleRangeMax", RiaDefines::maximumDefaultValuePlot(), "Max"); - CAF_PDM_InitField(&visibleRangeMin, "VisibleRangeMin", RiaDefines::minimumDefaultValuePlot(), "Min"); + CAF_PDM_InitFieldNoDefault( &customTitle, "CustomTitle", "Title" ); - CAF_PDM_InitFieldNoDefault(&numberFormat, "NumberFormat", "Number Format"); - CAF_PDM_InitField(&numberOfDecimals, "Decimals", 2, "Number of Decimals"); - CAF_PDM_InitField(&scaleFactor, "ScaleFactor", 1.0, "Scale Factor"); + CAF_PDM_InitField( &visibleRangeMax, "VisibleRangeMax", RiaDefines::maximumDefaultValuePlot(), "Max" ); + CAF_PDM_InitField( &visibleRangeMin, "VisibleRangeMin", RiaDefines::minimumDefaultValuePlot(), "Min" ); - numberOfDecimals.uiCapability()->setUiEditorTypeName(caf::PdmUiSliderEditor::uiEditorTypeName()); + CAF_PDM_InitFieldNoDefault( &numberFormat, "NumberFormat", "Number Format" ); + CAF_PDM_InitField( &numberOfDecimals, "Decimals", 2, "Number of Decimals" ); + CAF_PDM_InitField( &scaleFactor, "ScaleFactor", 1.0, "Scale Factor" ); - CAF_PDM_InitField(&m_isAutoZoom, "AutoZoom", true, "Set Range Automatically"); - CAF_PDM_InitField(&isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale"); - CAF_PDM_InitField(&m_isAxisInverted, "AxisInverted", false, "Invert Axis"); + CAF_PDM_InitField( &m_isAutoZoom, "AutoZoom", true, "Set Range Automatically" ); + CAF_PDM_InitField( &isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale" ); + CAF_PDM_InitField( &m_isAxisInverted, "AxisInverted", false, "Invert Axis" ); - CAF_PDM_InitFieldNoDefault(&m_titlePositionEnum, "TitlePosition", "Title Position"); + CAF_PDM_InitFieldNoDefault( &m_titlePositionEnum, "TitlePosition", "Title Position" ); - CAF_PDM_InitFieldNoDefault(&m_titleFontSize, "TitleDeltaFontSize", "Font Size"); - CAF_PDM_InitFieldNoDefault(&m_valuesFontSize, "ValueDeltaFontSize", "Font Size"); + CAF_PDM_InitFieldNoDefault( &m_titleFontSize, "TitleDeltaFontSize", "Font Size" ); + CAF_PDM_InitFieldNoDefault( &m_valuesFontSize, "ValueDeltaFontSize", "Font Size" ); - CAF_PDM_InitFieldNoDefault(&m_annotations, "Annotations", ""); - m_annotations.uiCapability()->setUiTreeHidden(true); -// m_annotations.uiCapability()->setUiTreeChildrenHidden(true); + CAF_PDM_InitFieldNoDefault( &m_annotations, "Annotations", "" ); + m_annotations.uiCapability()->setUiTreeHidden( true ); updateOptionSensitivity(); } -// clang-format on //-------------------------------------------------------------------------------------------------- /// @@ -212,13 +201,13 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotAxisProperties::setNameAndAxis( const QString& name, QwtPlot::Axis axis ) +void RimPlotAxisProperties::setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis ) { m_name = name; m_axis = axis; - if ( axis == QwtPlot::yRight ) this->setUiIconFromResourceString( ":/RightAxis16x16.png" ); - if ( axis == QwtPlot::xBottom ) this->setUiIconFromResourceString( ":/BottomAxis16x16.png" ); + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) this->setUiIconFromResourceString( ":/RightAxis16x16.png" ); + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) this->setUiIconFromResourceString( ":/BottomAxis16x16.png" ); } //-------------------------------------------------------------------------------------------------- @@ -245,14 +234,6 @@ int RimPlotAxisProperties::valuesFontSize() const return caf::FontTools::absolutePointSize( plotFontSize(), m_valuesFontSize() ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QwtPlot::Axis RimPlotAxisProperties::qwtPlotAxisType() const -{ - return m_axis; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -266,10 +247,7 @@ QString RimPlotAxisProperties::name() const //-------------------------------------------------------------------------------------------------- RiaDefines::PlotAxis RimPlotAxisProperties::plotAxisType() const { - if ( m_axis == QwtPlot::yRight ) return RiaDefines::PlotAxis::PLOT_AXIS_RIGHT; - if ( m_axis == QwtPlot::xBottom ) return RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM; - - return RiaDefines::PlotAxis::PLOT_AXIS_LEFT; + return m_axis; } //-------------------------------------------------------------------------------------------------- @@ -449,92 +427,3 @@ caf::PdmFieldHandle* RimPlotAxisProperties::objectToggleField() { return &m_isActive; } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimPlotAxisLogRangeCalculator::RimPlotAxisLogRangeCalculator( QwtPlot::Axis axis, - const std::vector& qwtCurves ) - : m_axis( axis ) - , m_curves( qwtCurves ) -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotAxisLogRangeCalculator::computeAxisRange( double* minPositive, double* max ) const -{ - double minPosValue = HUGE_VAL; - double maxValue = -HUGE_VAL; - - for ( const QwtPlotCurve* curve : m_curves ) - { - double minPosCurveValue = HUGE_VAL; - double maxCurveValue = -HUGE_VAL; - - if ( curveValueRange( curve, &minPosCurveValue, &maxCurveValue ) ) - { - if ( minPosCurveValue < minPosValue ) - { - CVF_ASSERT( minPosCurveValue > 0.0 ); - minPosValue = minPosCurveValue; - } - - if ( maxCurveValue > maxValue ) - { - maxValue = maxCurveValue; - } - } - } - - if ( minPosValue == HUGE_VAL ) - { - minPosValue = RiaDefines::minimumDefaultLogValuePlot(); - maxValue = RiaDefines::maximumDefaultValuePlot(); - } - - *minPositive = minPosValue; - *max = maxValue; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimPlotAxisLogRangeCalculator::curveValueRange( const QwtPlotCurve* qwtCurve, double* minPositive, double* max ) const -{ - if ( !qwtCurve ) return false; - - if ( qwtCurve->data()->size() < 1 ) - { - return false; - } - - float minPosF = std::numeric_limits::infinity(); - float maxF = -std::numeric_limits::infinity(); - - int axisValueIndex = 0; - if ( m_axis == QwtPlot::yLeft || m_axis == QwtPlot::yRight ) - { - axisValueIndex = 1; - } - - for ( size_t i = 0; i < qwtCurve->dataSize(); ++i ) - { - QPointF sample = qwtCurve->sample( (int)i ); - cvf::Vec2f vec( sample.x(), sample.y() ); - float value = vec[axisValueIndex]; - if ( value == HUGE_VALF ) continue; - - maxF = std::max( maxF, value ); - if ( value > 0.0f && value < minPosF ) - { - minPosF = value; - } - } - - *minPositive = minPosF; - *max = maxF; - - return true; -} diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index cb3d6d5002..26f4994945 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -28,8 +28,6 @@ #include "cafPdmField.h" #include "cafPdmObject.h" -#include "qwt_plot.h" - #include class RimPlotAxisAnnotation; @@ -59,13 +57,12 @@ class RimPlotAxisProperties : public caf::PdmObject, public RimPlotAxisPropertie void setEnableTitleTextSettings( bool enable ); void enableRangeSettings( bool enable ); - void setNameAndAxis( const QString& name, QwtPlot::Axis axis ); + void setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis ); AxisTitlePositionType titlePosition() const override; int titleFontSize() const override; int valuesFontSize() const override; - QwtPlot::Axis qwtPlotAxisType() const; QString name() const; RiaDefines::PlotAxis plotAxisType() const override; bool useAutoTitle() const; @@ -121,7 +118,7 @@ class RimPlotAxisProperties : public caf::PdmObject, public RimPlotAxisPropertie caf::PdmField m_isAxisInverted; caf::PdmField m_name; - QwtPlot::Axis m_axis; + RiaDefines::PlotAxis m_axis; bool m_enableTitleTextSettings; bool m_isRangeSettingsEnabled; @@ -131,24 +128,3 @@ class RimPlotAxisProperties : public caf::PdmObject, public RimPlotAxisPropertie caf::PdmField m_valuesFontSize; caf::PdmChildArrayField m_annotations; }; - -class QwtPlotCurve; - -//================================================================================================== -/// -/// -//================================================================================================== -class RimPlotAxisLogRangeCalculator -{ -public: - RimPlotAxisLogRangeCalculator( QwtPlot::Axis axis, const std::vector& qwtCurves ); - - void computeAxisRange( double* minPositive, double* max ) const; - -private: - bool curveValueRange( const QwtPlotCurve* qwtCurve, double* minPositive, double* max ) const; - -private: - QwtPlot::Axis m_axis; - const std::vector m_curves; -}; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h index 3b05cf866d..39ac415775 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h @@ -18,7 +18,7 @@ #pragma once -#include "RiaDefines.h" +#include "RiaPlotDefines.h" #include "cafAppEnum.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index b0ec64a7ed..6249b67cc1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -18,7 +18,6 @@ #include "RimPlotCurve.h" -#include "RiaColorTables.h" #include "RiaColorTools.h" #include "RiaCurveDataTools.h" #include "RiaGuiApplication.h" @@ -33,23 +32,19 @@ #include "RimSummaryCurveCollection.h" #include "RimSummaryPlot.h" +#include "RiuPlotCurve.h" +#include "RiuPlotCurveSymbol.h" #include "RiuPlotMainWindowTools.h" -#include "RiuRimQwtPlotCurve.h" +#include "RiuPlotWidget.h" +#include "cafAssert.h" #include "cafPdmUiComboBoxEditor.h" -#include "cvfAssert.h" - -#include "qwt_date.h" -#include "qwt_interval_symbol.h" -#include "qwt_plot.h" -#include "qwt_symbol.h" +#include // NB! Special macro for pure virtual class CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotCurve, "PlotCurve" ); -#define DOUBLE_INF std::numeric_limits::infinity() - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -125,14 +120,8 @@ RimPlotCurve::RimPlotCurve() m_curveAppearance->appearanceChanged.connect( this, &RimPlotCurve::onCurveAppearanceChanged ); m_curveAppearance->appearanceChanged.connect( this, &RimPlotCurve::onFillColorChanged ); - m_qwtPlotCurve = new RiuRimQwtPlotCurve( this ); - m_qwtCurveErrorBars = new QwtPlotIntervalCurve(); - m_qwtCurveErrorBars->setStyle( QwtPlotIntervalCurve::CurveStyle::NoCurve ); - m_qwtCurveErrorBars->setSymbol( new QwtIntervalSymbol( QwtIntervalSymbol::Bar ) ); - m_qwtCurveErrorBars->setItemAttribute( QwtPlotItem::Legend, false ); - m_qwtCurveErrorBars->setZ( RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ERROR_BARS ) ); - - m_parentQwtPlot = nullptr; + m_plotCurve = nullptr; + m_parentPlot = nullptr; } //-------------------------------------------------------------------------------------------------- @@ -140,18 +129,11 @@ RimPlotCurve::RimPlotCurve() //-------------------------------------------------------------------------------------------------- RimPlotCurve::~RimPlotCurve() { - if ( m_qwtPlotCurve ) - { - m_qwtPlotCurve->detach(); - delete m_qwtPlotCurve; - m_qwtPlotCurve = nullptr; - } - - if ( m_qwtCurveErrorBars ) + if ( m_plotCurve ) { - m_qwtCurveErrorBars->detach(); - delete m_qwtCurveErrorBars; - m_qwtCurveErrorBars = nullptr; + detach(); + delete m_plotCurve; + m_plotCurve = nullptr; } } @@ -191,7 +173,7 @@ void RimPlotCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, co } RiuPlotMainWindowTools::refreshToolbars(); - if ( m_parentQwtPlot ) m_parentQwtPlot->replot(); + replotParentPlot(); } //-------------------------------------------------------------------------------------------------- @@ -237,22 +219,7 @@ void RimPlotCurve::setLegendEntryText( const QString& legendEntryText ) void RimPlotCurve::setErrorBarsVisible( bool isVisible ) { m_showErrorBars = isVisible; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::updateCurveVisibility() -{ - if ( canCurveBeAttached() ) - { - attachCurveAndErrorBars(); - } - else - { - m_qwtPlotCurve->detach(); - m_qwtCurveErrorBars->detach(); - } + updateCurveAppearance(); } //-------------------------------------------------------------------------------------------------- @@ -286,37 +253,6 @@ void RimPlotCurve::updateCurvePresentation( bool updatePlotLegendAndTitle ) updateCurveAppearance(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::setParentQwtPlotAndReplot( QwtPlot* plot ) -{ - m_parentQwtPlot = plot; - if ( canCurveBeAttached() ) - { - attachCurveAndErrorBars(); - - m_parentQwtPlot->replot(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::setParentQwtPlotNoReplot( QwtPlot* plot ) -{ - m_parentQwtPlot = plot; - if ( canCurveBeAttached() ) - { - attachCurveAndErrorBars(); - } - else - { - m_qwtPlotCurve->detach(); - m_qwtCurveErrorBars->detach(); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -342,35 +278,6 @@ cvf::Color3f RimPlotCurve::color() const return m_curveAppearance->color(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::detachQwtCurve() -{ - m_qwtPlotCurve->detach(); - m_qwtCurveErrorBars->detach(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::reattachQwtCurve() -{ - detachQwtCurve(); - if ( canCurveBeAttached() ) - { - attachCurveAndErrorBars(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QwtPlotCurve* RimPlotCurve::qwtPlotCurve() const -{ - return m_qwtPlotCurve; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -401,16 +308,13 @@ void RimPlotCurve::updateCurveName() m_curveName = m_customCurveName; } - if ( m_qwtPlotCurve ) + if ( !m_legendEntryText().isEmpty() ) { - if ( !m_legendEntryText().isEmpty() ) - { - m_qwtPlotCurve->setTitle( m_legendEntryText ); - } - else - { - m_qwtPlotCurve->setTitle( m_curveName ); - } + setTitle( m_legendEntryText ); + } + else + { + setTitle( m_curveName ); } } @@ -453,126 +357,6 @@ void RimPlotCurve::updatePlotTitle() } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::updateLegendsInPlot() -{ - nameChanged.send( curveName() ); - if ( m_parentQwtPlot != nullptr ) - { - m_parentQwtPlot->updateLegend(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::setSamplesFromXYErrorValues( - const std::vector& xValues, - const std::vector& yValues, - const std::vector& errorValues, - bool keepOnlyPositiveValues, - RiaCurveDataTools::ErrorAxis errorAxis /*= RiuQwtPlotCurve::ERROR_ALONG_Y_AXIS */ ) -{ - CVF_ASSERT( xValues.size() == yValues.size() ); - CVF_ASSERT( xValues.size() == errorValues.size() ); - - auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, keepOnlyPositiveValues ); - std::vector filteredYValues; - std::vector filteredXValues; - - RiaCurveDataTools::getValuesByIntervals( yValues, intervalsOfValidValues, &filteredYValues ); - RiaCurveDataTools::getValuesByIntervals( xValues, intervalsOfValidValues, &filteredXValues ); - - std::vector filteredErrorValues; - RiaCurveDataTools::getValuesByIntervals( errorValues, intervalsOfValidValues, &filteredErrorValues ); - - QVector errorIntervals; - - errorIntervals.reserve( static_cast( filteredXValues.size() ) ); - - for ( size_t i = 0; i < filteredXValues.size(); i++ ) - { - if ( filteredYValues[i] != DOUBLE_INF && filteredErrorValues[i] != DOUBLE_INF ) - { - if ( errorAxis == RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ) - { - errorIntervals << QwtIntervalSample( filteredXValues[i], - filteredYValues[i] - filteredErrorValues[i], - filteredYValues[i] + filteredErrorValues[i] ); - } - else - { - errorIntervals << QwtIntervalSample( filteredYValues[i], - filteredXValues[i] - filteredErrorValues[i], - filteredXValues[i] + filteredErrorValues[i] ); - } - } - } - - if ( m_qwtPlotCurve ) - { - m_qwtPlotCurve->setSamples( filteredXValues.data(), - filteredYValues.data(), - static_cast( filteredXValues.size() ) ); - - m_qwtPlotCurve->setLineSegmentStartStopIndices( intervalsOfValidValues ); - } - - if ( m_qwtCurveErrorBars ) - { - m_qwtCurveErrorBars->setSamples( errorIntervals ); - if ( errorAxis == RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ) - { - m_qwtCurveErrorBars->setOrientation( Qt::Vertical ); - } - else - { - m_qwtCurveErrorBars->setOrientation( Qt::Horizontal ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::setSamplesFromXYValues( const std::vector& xValues, - const std::vector& yValues, - bool keepOnlyPositiveValues ) -{ - if ( m_qwtPlotCurve ) - { - m_qwtPlotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, keepOnlyPositiveValues ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::setSamplesFromDatesAndYValues( const std::vector& dateTimes, - const std::vector& yValues, - bool keepOnlyPositiveValues ) -{ - if ( m_qwtPlotCurve ) - { - m_qwtPlotCurve->setSamplesFromDatesAndYValues( dateTimes, yValues, keepOnlyPositiveValues ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::setSamplesFromTimeTAndYValues( const std::vector& dateTimes, - const std::vector& yValues, - bool keepOnlyPositiveValues ) -{ - if ( m_qwtPlotCurve ) - { - m_qwtPlotCurve->setSamplesFromTimeTAndYValues( dateTimes, yValues, keepOnlyPositiveValues ); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -591,21 +375,6 @@ void RimPlotCurve::curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering ) uiOrdering.add( &m_curveName ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::updateUiIconFromPlotSymbol() -{ - if ( m_curveAppearance->symbol() != RiuQwtSymbol::SYMBOL_NONE && m_qwtPlotCurve ) - { - CVF_ASSERT( RiaGuiApplication::isRunning() ); - QSizeF iconSize( 24, 24 ); - QwtGraphic graphic = m_qwtPlotCurve->legendIcon( 0, iconSize ); - QPixmap pixmap = graphic.toPixmap(); - setUiIcon( caf::IconProvider( pixmap ) ); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -631,7 +400,7 @@ void RimPlotCurve::updateCurveAppearanceForFilesOlderThan_2021_06() //-------------------------------------------------------------------------------------------------- bool RimPlotCurve::canCurveBeAttached() const { - if ( !m_parentQwtPlot ) + if ( !hasParentPlot() ) { return false; } @@ -656,19 +425,6 @@ bool RimPlotCurve::canCurveBeAttached() const return isVisibleInPossibleParent; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::attachCurveAndErrorBars() -{ - m_qwtPlotCurve->attach( m_parentQwtPlot ); - - if ( m_showErrorBars ) - { - m_qwtCurveErrorBars->attach( m_parentQwtPlot ); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -680,88 +436,6 @@ void RimPlotCurve::checkAndApplyDefaultFillColor() // } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotCurve::updateCurveAppearance() -{ - QColor curveColor = RiaColorTools::toQColor( m_curveAppearance->color() ); - QwtSymbol* symbol = nullptr; - - if ( m_curveAppearance->symbol() != RiuQwtSymbol::SYMBOL_NONE ) - { - int legendFontSize = caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), - caf::FontTools::RelativeSize::Small ); - RimPlotWindow* plotWindow = nullptr; - this->firstAncestorOrThisOfType( plotWindow ); - if ( plotWindow ) - { - legendFontSize = plotWindow->legendFontSize(); - } - - // QwtPlotCurve will take ownership of the symbol - symbol = new RiuQwtSymbol( m_curveAppearance->symbol(), - m_curveAppearance->symbolLabel(), - m_curveAppearance->symbolLabelPosition(), - legendFontSize ); - symbol->setSize( m_curveAppearance->symbolSize(), m_curveAppearance->symbolSize() ); - symbol->setColor( curveColor ); - - // If the symbol is a "filled" symbol, we can have a different edge color - // Otherwise we'll have to use the curve color. - if ( RiuQwtSymbol::isFilledSymbol( m_curveAppearance->symbol() ) ) - { - QColor symbolEdgeColor = RiaColorTools::toQColor( m_curveAppearance->symbolEdgeColor() ); - symbol->setPen( symbolEdgeColor ); - } - else - { - symbol->setPen( curveColor ); - } - } - - if ( m_qwtCurveErrorBars ) - { - QwtIntervalSymbol* newSymbol = new QwtIntervalSymbol( QwtIntervalSymbol::Bar ); - newSymbol->setPen( QPen( curveColor ) ); - m_qwtCurveErrorBars->setSymbol( newSymbol ); - } - - if ( m_qwtPlotCurve ) - { - QColor fillColor = RiaColorTools::toQColor( m_curveAppearance->fillColor() ); - - fillColor = RiaColorTools::blendQColors( fillColor, QColor( Qt::white ), 3, 1 ); - QBrush fillBrush( fillColor, m_curveAppearance->fillStyle() ); - m_qwtPlotCurve->setAppearance( m_curveAppearance->lineStyle(), - m_curveAppearance->interpolation(), - m_curveAppearance->lineThickness(), - curveColor, - fillBrush ); - m_qwtPlotCurve->setSymbol( symbol ); - m_qwtPlotCurve->setSymbolSkipPixelDistance( m_curveAppearance->symbolSkipDistance() ); - - // Make sure the legend lines are long enough to distinguish between line types. - // Standard width in Qwt is 8 which is too short. - // Use 10 and scale this by curve thickness + add space for displaying symbol. - if ( m_curveAppearance->lineStyle() != RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ) - { - QSize legendIconSize = m_qwtPlotCurve->legendIconSize(); - - int symbolWidth = 0; - if ( symbol ) - { - symbolWidth = symbol->boundingRect().size().width() + 2; - } - - int width = std::max( 10 * m_curveAppearance->lineThickness(), ( symbolWidth * 3 ) / 2 ); - - legendIconSize.setWidth( width ); - m_qwtPlotCurve->setLegendIconSize( legendIconSize ); - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -786,44 +460,6 @@ void RimPlotCurve::loadDataAndUpdate( bool updateParentPlot ) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimPlotCurve::xValueRangeInQwt( double* minimumValue, double* maximumValue ) const -{ - CVF_ASSERT( minimumValue && maximumValue ); - CVF_ASSERT( m_qwtPlotCurve ); - - if ( m_qwtPlotCurve->data()->size() < 1 ) - { - return false; - } - - *minimumValue = m_qwtPlotCurve->minXValue(); - *maximumValue = m_qwtPlotCurve->maxXValue(); - - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimPlotCurve::yValueRangeInQwt( double* minimumValue, double* maximumValue ) const -{ - CVF_ASSERT( minimumValue && maximumValue ); - CVF_ASSERT( m_qwtPlotCurve ); - - if ( m_qwtPlotCurve->data()->size() < 1 ) - { - return false; - } - - *minimumValue = m_qwtPlotCurve->minYValue(); - *maximumValue = m_qwtPlotCurve->maxYValue(); - - return true; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -835,7 +471,7 @@ void RimPlotCurve::setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle ) +void RimPlotCurve::setSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbolStyle ) { m_curveAppearance->setSymbol( symbolStyle ); } @@ -851,7 +487,7 @@ void RimPlotCurve::setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationE //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::PointSymbolEnum RimPlotCurve::symbol() +RiuPlotCurveSymbol::PointSymbolEnum RimPlotCurve::symbol() { return m_curveAppearance->symbol(); } @@ -899,7 +535,7 @@ void RimPlotCurve::setSymbolLabel( const QString& label ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::setSymbolLabelPosition( RiuQwtSymbol::LabelPosition labelPosition ) +void RimPlotCurve::setSymbolLabelPosition( RiuPlotCurveSymbol::LabelPosition labelPosition ) { m_curveAppearance->setSymbolLabelPosition( labelPosition ); } @@ -929,7 +565,7 @@ void RimPlotCurve::resetAppearance() setSymbolEdgeColor( RiaColorTools::textColor3f() ); setLineThickness( 2 ); setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); - setSymbol( RiuQwtSymbol::SYMBOL_NONE ); + setSymbol( RiuPlotCurveSymbol::SYMBOL_NONE ); setSymbolSkipDistance( 10 ); } @@ -979,27 +615,130 @@ bool RimPlotCurve::errorBarsVisible() const void RimPlotCurve::setShowInLegend( bool show ) { m_showLegend = show; + if ( m_plotCurve ) m_plotCurve->setVisibleInLegend( show ); + updateLegendEntryVisibilityNoPlotUpdate(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::setZOrder( double z ) +void RimPlotCurve::updateLegendEntryVisibilityAndPlotLegend() { - if ( m_qwtPlotCurve != nullptr ) + updateLegendEntryVisibilityNoPlotUpdate(); + updateLegendsInPlot(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::onCurveAppearanceChanged( const caf::SignalEmitter* emitter ) +{ + checkAndApplyDefaultFillColor(); + updateCurveAppearance(); + appearanceChanged.send(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::onFillColorChanged( const caf::SignalEmitter* emitter ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::updateLegendsInPlot() +{ + nameChanged.send( curveName() ); + if ( m_parentPlot != nullptr ) { - m_qwtPlotCurve->setZ( z ); + m_parentPlot->updateLegend(); } } +void RimPlotCurve::setTitle( const QString& title ) +{ + if ( m_plotCurve ) m_plotCurve->setTitle( title ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::updateLegendEntryVisibilityAndPlotLegend() +void RimPlotCurve::replotParentPlot() { - updateLegendEntryVisibilityNoPlotUpdate(); - updateLegendsInPlot(); + if ( m_parentPlot ) m_parentPlot->replot(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotCurve::hasParentPlot() const +{ + return ( m_parentPlot != nullptr ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::setSamplesFromXYValues( const std::vector& xValues, + const std::vector& yValues, + bool keepOnlyPositiveValues ) +{ + if ( m_plotCurve ) + { + m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, keepOnlyPositiveValues ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::setSamplesFromDatesAndYValues( const std::vector& dateTimes, + const std::vector& yValues, + bool keepOnlyPositiveValues ) +{ + if ( m_plotCurve ) + { + m_plotCurve->setSamplesFromDatesAndYValues( dateTimes, yValues, keepOnlyPositiveValues ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::setSamplesFromTimeTAndYValues( const std::vector& dateTimes, + const std::vector& yValues, + bool keepOnlyPositiveValues ) +{ + if ( m_plotCurve ) + { + m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, yValues, keepOnlyPositiveValues ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::setSamplesFromXYErrorValues( const std::vector& xValues, + const std::vector& yValues, + const std::vector& errorValues, + bool keepOnlyPositiveValues, + RiaCurveDataTools::ErrorAxis errorAxis ) +{ + if ( m_plotCurve ) + { + m_plotCurve->setSamplesFromXYErrorValues( xValues, yValues, errorValues, keepOnlyPositiveValues, errorAxis ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::updateAxisInPlot( RiaDefines::PlotAxis plotAxis ) +{ + if ( m_plotCurve ) m_plotCurve->setYAxis( plotAxis ); } //-------------------------------------------------------------------------------------------------- @@ -1007,7 +746,7 @@ void RimPlotCurve::updateLegendEntryVisibilityAndPlotLegend() //-------------------------------------------------------------------------------------------------- void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate() { - if ( !m_qwtPlotCurve ) return; + if ( !m_plotCurve ) return; RimEnsembleCurveSet* ensembleCurveSet = nullptr; this->firstAncestorOrThisOfType( ensembleCurveSet ); @@ -1016,7 +755,7 @@ void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate() return; } - bool showLegendInQwt = m_showLegend(); + bool showLegendInPlot = m_showLegend(); RimSummaryPlot* summaryPlot = nullptr; this->firstAncestorOrThisOfType( summaryPlot ); @@ -1037,25 +776,279 @@ void RimPlotCurve::updateLegendEntryVisibilityNoPlotUpdate() summaryPlot->curveCount() == 1 ) { // Disable display of legend if the summary plot has only one single curve - showLegendInQwt = false; + showLegendInPlot = false; } } - m_qwtPlotCurve->setItemAttribute( QwtPlotItem::Legend, showLegendInQwt ); + + m_plotCurve->setVisibleInLegend( showLegendInPlot ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::onCurveAppearanceChanged( const caf::SignalEmitter* emitter ) +bool RimPlotCurve::xValueRange( double* minimumValue, double* maximumValue ) const { - checkAndApplyDefaultFillColor(); - updateCurveAppearance(); - appearanceChanged.send(); + CAF_ASSERT( minimumValue && maximumValue ); + CAF_ASSERT( m_plotCurve ); + + if ( m_plotCurve->numSamples() < 1 ) + { + return false; + } + + auto [min, max] = m_plotCurve->xDataRange(); + *minimumValue = min; + *maximumValue = max; + + return true; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::onFillColorChanged( const caf::SignalEmitter* emitter ) +bool RimPlotCurve::yValueRange( double* minimumValue, double* maximumValue ) const +{ + CAF_ASSERT( minimumValue && maximumValue ); + CAF_ASSERT( m_plotCurve ); + + if ( m_plotCurve->numSamples() < 1 ) + { + return false; + } + + auto [min, max] = m_plotCurve->yDataRange(); + *minimumValue = min; + *maximumValue = max; + + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::setZOrder( double z ) +{ + if ( m_plotCurve != nullptr ) + { + m_plotCurve->setZ( z ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::updateCurveAppearance() +{ + QColor curveColor = RiaColorTools::toQColor( m_curveAppearance->color() ); + + if ( !m_plotCurve ) return; + + RiuPlotCurveSymbol* symbol = nullptr; + if ( m_curveAppearance->symbol() != RiuPlotCurveSymbol::SYMBOL_NONE ) + { + int legendFontSize = caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), + caf::FontTools::RelativeSize::Small ); + + RimPlotWindow* plotWindow = nullptr; + this->firstAncestorOrThisOfType( plotWindow ); + if ( plotWindow ) + { + legendFontSize = plotWindow->legendFontSize(); + } + + // Plot curve will take ownership of the symbol + symbol = m_plotCurve->createSymbol( m_curveAppearance->symbol() ); + + if ( symbol ) + { + symbol->setLabelPosition( m_curveAppearance->symbolLabelPosition() ); + symbol->setGlobalLabel( m_curveAppearance->symbolLabel() ); + symbol->setSize( m_curveAppearance->symbolSize(), m_curveAppearance->symbolSize() ); + symbol->setColor( curveColor ); + symbol->setLabelFontSize( legendFontSize ); + + // If the symbol is a "filled" symbol, we can have a different edge color + // Otherwise we'll have to use the curve color. + if ( RiuPlotCurveSymbol::isFilledSymbol( m_curveAppearance->symbol() ) ) + { + QColor symbolEdgeColor = RiaColorTools::toQColor( m_curveAppearance->symbolEdgeColor() ); + symbol->setPen( symbolEdgeColor ); + } + else + { + symbol->setPen( curveColor ); + } + } + } + + m_plotCurve->updateErrorBarsAppearance( m_showErrorBars, curveColor ); + + QColor fillColor = RiaColorTools::toQColor( m_curveAppearance->fillColor() ); + + fillColor = RiaColorTools::blendQColors( fillColor, QColor( Qt::white ), 3, 1 ); + QBrush fillBrush( fillColor, m_curveAppearance->fillStyle() ); + m_plotCurve->setAppearance( m_curveAppearance->lineStyle(), + m_curveAppearance->interpolation(), + m_curveAppearance->lineThickness(), + curveColor, + fillBrush ); + + m_plotCurve->setSymbol( symbol ); + m_plotCurve->setSymbolSkipPixelDistance( m_curveAppearance->symbolSkipDistance() ); + + // Make sure the legend lines are long enough to distinguish between line types. + // Standard width in Qwt is 8 which is too short. + // Use 10 and scale this by curve thickness + add space for displaying symbol. + if ( m_curveAppearance->lineStyle() != RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ) + { + QSize legendIconSize = m_plotCurve->legendIconSize(); + + int symbolWidth = 0; + if ( symbol ) + { + symbolWidth = symbol->boundingRect().size().width() + 2; + } + + int width = std::max( 10 * m_curveAppearance->lineThickness(), ( symbolWidth * 3 ) / 2 ); + + legendIconSize.setWidth( width ); + m_plotCurve->setLegendIconSize( legendIconSize ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::clearErrorBars() +{ + if ( m_plotCurve ) m_plotCurve->clearErrorBars(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::updateUiIconFromPlotSymbol() +{ + if ( m_curveAppearance->symbol() != RiuPlotCurveSymbol::SYMBOL_NONE && m_plotCurve ) + { + CAF_ASSERT( RiaGuiApplication::isRunning() ); + QSizeF iconSize( 24, 24 ); + QPixmap pixmap = m_plotCurve->legendIcon( iconSize ); + setUiIcon( caf::IconProvider( pixmap ) ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::updateCurveVisibility() +{ + if ( canCurveBeAttached() ) + { + reattach(); + } + else + { + detach(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimPlotCurve::dataSize() const +{ + if ( m_plotCurve ) + return m_plotCurve->numSamples(); + else + return 0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RimPlotCurve::sample( int index ) const +{ + CAF_ASSERT( m_plotCurve ); + CAF_ASSERT( index >= 0 && index <= dataSize() ); + return m_plotCurve->sample( index ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::setParentPlotNoReplot( RiuPlotWidget* plotWidget ) +{ + if ( !plotWidget ) return; + + m_parentPlot = plotWidget; + if ( !m_plotCurve ) + { + m_plotCurve = m_parentPlot->createPlotCurve( this, "", RiaColorTools::toQColor( m_curveAppearance->color() ) ); + } + + m_plotCurve->attachToPlot( plotWidget ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::setParentPlotAndReplot( RiuPlotWidget* plotWidget ) +{ + CAF_ASSERT( plotWidget ); + setParentPlotNoReplot( plotWidget ); + plotWidget->replot(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::attach( RiuPlotWidget* plotWidget ) +{ + setParentPlotAndReplot( plotWidget ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::detach() +{ + if ( m_plotCurve ) + { + m_plotCurve->detach(); + } + + replotParentPlot(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::reattach() +{ + if ( m_parentPlot ) attach( m_parentPlot ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotCurve::isSameCurve( const RiuPlotCurve* plotCurve ) const +{ + return m_plotCurve == plotCurve; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimPlotCurve::curveName() const +{ + return m_curveName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimPlotCurve::curveExportDescription( const RifEclipseSummaryAddress& address ) const { + return m_curveName; } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h index 8ba949857f..fac7435d08 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h @@ -22,7 +22,7 @@ #include "RimPlotCurveAppearance.h" #include "RiaCurveDataTools.h" -#include "RiaDefines.h" +#include "RiaPlotDefines.h" #include "RiuQwtPlotCurveDefines.h" #include "RiuQwtSymbol.h" @@ -35,10 +35,8 @@ #include #include -class QwtPlot; -class QwtPlotCurve; -class QwtPlotIntervalCurve; -class RiuQwtPlotCurve; +class RiuPlotCurve; +class RiuPlotWidget; //================================================================================================== /// @@ -60,33 +58,24 @@ class RimPlotCurve : public caf::PdmObject void loadDataAndUpdate( bool updateParentPlot ); - virtual bool xValueRangeInQwt( double* minimumValue, double* maximumValue ) const; - virtual bool yValueRangeInQwt( double* minimumValue, double* maximumValue ) const; - - void setParentQwtPlotAndReplot( QwtPlot* plot ); - void setParentQwtPlotNoReplot( QwtPlot* plot ); - void detachQwtCurve(); - void reattachQwtCurve(); - QwtPlotCurve* qwtPlotCurve() const; - - void setColor( const cvf::Color3f& color ); - cvf::Color3f color() const; - void setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle ); - void setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle ); - void setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum ); - RiuQwtSymbol::PointSymbolEnum symbol(); - int symbolSize() const; - cvf::Color3f symbolEdgeColor() const; - void setSymbolEdgeColor( const cvf::Color3f& edgeColor ); - void setSymbolSkipDistance( float distance ); - void setSymbolLabel( const QString& label ); - void setSymbolLabelPosition( RiuQwtSymbol::LabelPosition labelPosition ); - void setSymbolSize( int sizeInPixels ); - void setLineThickness( int thickness ); - void resetAppearance(); - Qt::BrushStyle fillStyle() const; - void setFillStyle( Qt::BrushStyle brushStyle ); - void setFillColor( const cvf::Color3f& fillColor ); + void setColor( const cvf::Color3f& color ); + cvf::Color3f color() const; + void setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle ); + void setSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbolStyle ); + void setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum ); + RiuPlotCurveSymbol::PointSymbolEnum symbol(); + int symbolSize() const; + cvf::Color3f symbolEdgeColor() const; + void setSymbolEdgeColor( const cvf::Color3f& edgeColor ); + void setSymbolSkipDistance( float distance ); + void setSymbolLabel( const QString& label ); + void setSymbolLabelPosition( RiuPlotCurveSymbol::LabelPosition labelPosition ); + void setSymbolSize( int sizeInPixels ); + void setLineThickness( int thickness ); + void resetAppearance(); + Qt::BrushStyle fillStyle() const; + void setFillStyle( Qt::BrushStyle brushStyle ); + void setFillColor( const cvf::Color3f& fillColor ); bool isCurveVisible() const; void setCurveVisibility( bool visible ); @@ -95,32 +84,48 @@ class RimPlotCurve : public caf::PdmObject void updateCurveNameAndUpdatePlotLegendAndTitle(); void updateCurveNameNoLegendUpdate(); - QString curveName() const { return m_curveName; } - virtual QString curveExportDescription( const RifEclipseSummaryAddress& address = RifEclipseSummaryAddress() ) const - { - return m_curveName; - } + QString curveName() const; + virtual QString curveExportDescription( const RifEclipseSummaryAddress& address = RifEclipseSummaryAddress() ) const; + void setCustomName( const QString& customName ); QString legendEntryText() const; void setLegendEntryText( const QString& legendEntryText ); - void updateCurveVisibility(); - void updateLegendEntryVisibilityAndPlotLegend(); - void updateLegendEntryVisibilityNoPlotUpdate(); + virtual void updateCurveVisibility(); + void updateLegendEntryVisibilityAndPlotLegend(); + void updateLegendEntryVisibilityNoPlotUpdate(); + virtual void replotParentPlot(); bool showInLegend() const; bool errorBarsVisible() const; - void setShowInLegend( bool show ); - void setZOrder( double z ); - void setErrorBarsVisible( bool isVisible ); + void setShowInLegend( bool show ); + virtual void setZOrder( double z ); + void setErrorBarsVisible( bool isVisible ); virtual void updateCurveAppearance(); bool isCrossPlotCurve() const; - void updateUiIconFromPlotSymbol(); + virtual void updateUiIconFromPlotSymbol(); + virtual bool hasParentPlot() const; void updateCurveAppearanceForFilesOlderThan_2021_06(); + virtual bool xValueRange( double* minimumValue, double* maximumValue ) const; + virtual bool yValueRange( double* minimumValue, double* maximumValue ) const; + + virtual void setTitle( const QString& title ); + + int dataSize() const; + std::pair sample( int index ) const; + + void setParentPlotNoReplot( RiuPlotWidget* ); + void setParentPlotAndReplot( RiuPlotWidget* ); + + void attach( RiuPlotWidget* ); + void detach(); + void reattach(); + bool isSameCurve( const RiuPlotCurve* plotCurve ) const; + protected: virtual QString createCurveAutoName() = 0; virtual void updateZoomInParentPlot() = 0; @@ -137,9 +142,11 @@ class RimPlotCurve : public caf::PdmObject const std::vector& errorValues, bool keepOnlyPositiveValues, RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ); + void setSamplesFromXYValues( const std::vector& xValues, const std::vector& yValues, bool keepOnlyPositiveValues ); + void setSamplesFromDatesAndYValues( const std::vector& dateTimes, const std::vector& yValues, bool keepOnlyPositiveValues ); @@ -156,20 +163,16 @@ class RimPlotCurve : public caf::PdmObject void appearanceUiOrdering( caf::PdmUiOrdering& uiOrdering ); void curveNameUiOrdering( caf::PdmUiOrdering& uiOrdering ); - virtual void onCurveAppearanceChanged( const caf::SignalEmitter* emitter ); + void onCurveAppearanceChanged( const caf::SignalEmitter* emitter ); virtual void onFillColorChanged( const caf::SignalEmitter* emitter ); -private: - bool canCurveBeAttached() const; - void attachCurveAndErrorBars(); - void checkAndApplyDefaultFillColor(); - -protected: - QPointer m_parentQwtPlot; + bool canCurveBeAttached() const; + virtual void clearErrorBars(); + void checkAndApplyDefaultFillColor(); - RiuQwtPlotCurve* m_qwtPlotCurve; - QwtPlotIntervalCurve* m_qwtCurveErrorBars; + virtual void updateAxisInPlot( RiaDefines::PlotAxis plotAxis ); +protected: caf::PdmField m_showCurve; caf::PdmField m_curveName; caf::PdmField m_customCurveName; @@ -180,6 +183,9 @@ class RimPlotCurve : public caf::PdmObject caf::PdmChildField m_curveAppearance; + QPointer m_parentPlot; + RiuPlotCurve* m_plotCurve; + caf::PdmField m_symbolLabel_OBSOLETE; caf::PdmField m_symbolSize_OBSOLETE; caf::PdmField m_curveColor_OBSOLETE; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp index be81f780c1..17161f0231 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp @@ -31,30 +31,30 @@ namespace caf template <> void RimPlotCurveAppearance::PointSymbol::setUp() { - addItem( RiuQwtSymbol::SYMBOL_NONE, "SYMBOL_NONE", "None" ); - addItem( RiuQwtSymbol::SYMBOL_ELLIPSE, "SYMBOL_ELLIPSE", "Ellipse" ); - addItem( RiuQwtSymbol::SYMBOL_RECT, "SYMBOL_RECT", "Rect" ); - addItem( RiuQwtSymbol::SYMBOL_DIAMOND, "SYMBOL_DIAMOND", "Diamond" ); - addItem( RiuQwtSymbol::SYMBOL_TRIANGLE, "SYMBOL_TRIANGLE", "Triangle" ); - addItem( RiuQwtSymbol::SYMBOL_DOWN_TRIANGLE, "SYMBOL_DOWN_TRIANGLE", "Down Triangle" ); - addItem( RiuQwtSymbol::SYMBOL_CROSS, "SYMBOL_CROSS", "Cross" ); - addItem( RiuQwtSymbol::SYMBOL_XCROSS, "SYMBOL_XCROSS", "X Cross" ); - addItem( RiuQwtSymbol::SYMBOL_STAR1, "SYMBOL_STAR1", "Star 1" ); - addItem( RiuQwtSymbol::SYMBOL_STAR2, "SYMBOL_STAR2", "Star 2" ); - addItem( RiuQwtSymbol::SYMBOL_HEXAGON, "SYMBOL_HEXAGON", "Hexagon" ); - addItem( RiuQwtSymbol::SYMBOL_LEFT_TRIANGLE, "SYMBOL_LEFT_TRIANGLE", "Left Triangle" ); - addItem( RiuQwtSymbol::SYMBOL_RIGHT_TRIANGLE, "SYMBOL_RIGHT_TRIANGLE", "Right Triangle" ); - setDefault( RiuQwtSymbol::SYMBOL_NONE ); + addItem( RiuPlotCurveSymbol::SYMBOL_NONE, "SYMBOL_NONE", "None" ); + addItem( RiuPlotCurveSymbol::SYMBOL_ELLIPSE, "SYMBOL_ELLIPSE", "Ellipse" ); + addItem( RiuPlotCurveSymbol::SYMBOL_RECT, "SYMBOL_RECT", "Rect" ); + addItem( RiuPlotCurveSymbol::SYMBOL_DIAMOND, "SYMBOL_DIAMOND", "Diamond" ); + addItem( RiuPlotCurveSymbol::SYMBOL_TRIANGLE, "SYMBOL_TRIANGLE", "Triangle" ); + addItem( RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE, "SYMBOL_DOWN_TRIANGLE", "Down Triangle" ); + addItem( RiuPlotCurveSymbol::SYMBOL_CROSS, "SYMBOL_CROSS", "Cross" ); + addItem( RiuPlotCurveSymbol::SYMBOL_XCROSS, "SYMBOL_XCROSS", "X Cross" ); + addItem( RiuPlotCurveSymbol::SYMBOL_STAR1, "SYMBOL_STAR1", "Star 1" ); + addItem( RiuPlotCurveSymbol::SYMBOL_STAR2, "SYMBOL_STAR2", "Star 2" ); + addItem( RiuPlotCurveSymbol::SYMBOL_HEXAGON, "SYMBOL_HEXAGON", "Hexagon" ); + addItem( RiuPlotCurveSymbol::SYMBOL_LEFT_TRIANGLE, "SYMBOL_LEFT_TRIANGLE", "Left Triangle" ); + addItem( RiuPlotCurveSymbol::SYMBOL_RIGHT_TRIANGLE, "SYMBOL_RIGHT_TRIANGLE", "Right Triangle" ); + setDefault( RiuPlotCurveSymbol::SYMBOL_NONE ); } template <> void RimPlotCurveAppearance::LabelPosition::setUp() { - addItem( RiuQwtSymbol::LabelAboveSymbol, "LABEL_ABOVE_SYMBOL", "Label above Symbol" ); - addItem( RiuQwtSymbol::LabelBelowSymbol, "LABEL_BELOW_SYMBOL", "Label below Symbol" ); - addItem( RiuQwtSymbol::LabelLeftOfSymbol, "LABEL_LEFT_OF_SYMBOL", "Label left of Symbol" ); - addItem( RiuQwtSymbol::LabelRightOfSymbol, "LABEL_RIGHT_OF_SYMBOL", "Label right of Symbol" ); - setDefault( RiuQwtSymbol::LabelAboveSymbol ); + addItem( RiuPlotCurveSymbol::LabelAboveSymbol, "LABEL_ABOVE_SYMBOL", "Label above Symbol" ); + addItem( RiuPlotCurveSymbol::LabelBelowSymbol, "LABEL_BELOW_SYMBOL", "Label below Symbol" ); + addItem( RiuPlotCurveSymbol::LabelLeftOfSymbol, "LABEL_LEFT_OF_SYMBOL", "Label left of Symbol" ); + addItem( RiuPlotCurveSymbol::LabelRightOfSymbol, "LABEL_RIGHT_OF_SYMBOL", "Label right of Symbol" ); + setDefault( RiuPlotCurveSymbol::LabelAboveSymbol ); } template <> @@ -132,8 +132,8 @@ void RimPlotCurveAppearance::fieldChangedByUi( const caf::PdmFieldHandle* change { if ( &m_pointSymbol == changedField ) { - m_symbolSize.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE ); - m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE ); + m_symbolSize.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuPlotCurveSymbol::SYMBOL_NONE ); + m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuPlotCurveSymbol::SYMBOL_NONE ); } else if ( &m_lineStyle == changedField ) { @@ -156,8 +156,8 @@ void RimPlotCurveAppearance::fieldChangedByUi( const caf::PdmFieldHandle* change //-------------------------------------------------------------------------------------------------- void RimPlotCurveAppearance::initAfterRead() { - m_symbolSize.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE ); - m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuQwtSymbol::SYMBOL_NONE ); + m_symbolSize.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuPlotCurveSymbol::SYMBOL_NONE ); + m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuPlotCurveSymbol::SYMBOL_NONE ); m_curveThickness.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); } @@ -188,7 +188,7 @@ void RimPlotCurveAppearance::defineUiOrdering( QString uiConfigName, caf::PdmUiO m_curveColor.uiCapability()->setUiHidden( !m_colorVisible ); uiOrdering.add( &m_pointSymbol ); - if ( RiuQwtSymbol::isFilledSymbol( m_pointSymbol() ) ) + if ( RiuPlotCurveSymbol::isFilledSymbol( m_pointSymbol() ) ) { uiOrdering.add( &m_symbolEdgeColor ); } @@ -242,7 +242,7 @@ void RimPlotCurveAppearance::setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurveAppearance::setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle ) +void RimPlotCurveAppearance::setSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbolStyle ) { m_pointSymbol = symbolStyle; } @@ -274,7 +274,7 @@ RiuQwtPlotCurveDefines::LineStyleEnum RimPlotCurveAppearance::lineStyle() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::PointSymbolEnum RimPlotCurveAppearance::symbol() const +RiuPlotCurveSymbol::PointSymbolEnum RimPlotCurveAppearance::symbol() const { return m_pointSymbol(); } @@ -338,7 +338,7 @@ QString RimPlotCurveAppearance::symbolLabel() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurveAppearance::setSymbolLabelPosition( RiuQwtSymbol::LabelPosition labelPosition ) +void RimPlotCurveAppearance::setSymbolLabelPosition( RiuPlotCurveSymbol::LabelPosition labelPosition ) { m_symbolLabelPosition = labelPosition; } @@ -346,7 +346,7 @@ void RimPlotCurveAppearance::setSymbolLabelPosition( RiuQwtSymbol::LabelPosition //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::LabelPosition RimPlotCurveAppearance::symbolLabelPosition() const +RiuPlotCurveSymbol::LabelPosition RimPlotCurveAppearance::symbolLabelPosition() const { return m_symbolLabelPosition.value(); } @@ -384,7 +384,7 @@ void RimPlotCurveAppearance::resetAppearance() setSymbolEdgeColor( RiaColorTools::textColor3f() ); setLineThickness( 2 ); setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); - setSymbol( RiuQwtSymbol::SYMBOL_NONE ); + setSymbol( RiuPlotCurveSymbol::SYMBOL_NONE ); setSymbolSkipDistance( 10 ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h index e986988c59..1159649f2e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h @@ -20,8 +20,8 @@ #include "RiaCurveDataTools.h" #include "RiaDefines.h" +#include "RiuPlotCurveSymbol.h" #include "RiuQwtPlotCurveDefines.h" -#include "RiuQwtSymbol.h" #include "cafPdmField.h" #include "cafPdmFieldCvfColor.h" @@ -42,8 +42,8 @@ class RimPlotCurveAppearance : public caf::PdmObject public: typedef caf::AppEnum CurveInterpolation; typedef caf::AppEnum LineStyle; - typedef caf::AppEnum PointSymbol; - typedef caf::AppEnum LabelPosition; + typedef caf::AppEnum PointSymbol; + typedef caf::AppEnum LabelPosition; typedef caf::AppEnum FillStyle; public: @@ -59,8 +59,8 @@ class RimPlotCurveAppearance : public caf::PdmObject void setLineThickness( int thickness ); int lineThickness() const; - void setSymbol( RiuQwtSymbol::PointSymbolEnum symbolStyle ); - RiuQwtSymbol::PointSymbolEnum symbol() const; + void setSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbolStyle ); + RiuPlotCurveSymbol::PointSymbolEnum symbol() const; void setSymbolSize( int sizeInPixels ); int symbolSize() const; @@ -74,8 +74,8 @@ class RimPlotCurveAppearance : public caf::PdmObject void setSymbolLabel( const QString& label ); QString symbolLabel() const; - void setSymbolLabelPosition( RiuQwtSymbol::LabelPosition labelPosition ); - RiuQwtSymbol::LabelPosition symbolLabelPosition() const; + void setSymbolLabelPosition( RiuPlotCurveSymbol::LabelPosition labelPosition ); + RiuPlotCurveSymbol::LabelPosition symbolLabelPosition() const; void resetAppearance(); Qt::BrushStyle fillStyle() const; diff --git a/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp index 691ac8becb..f6bf53e6bb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.cpp @@ -34,6 +34,13 @@ RimStackablePlotCurve::RimStackablePlotCurve() CAF_PDM_InitField( &m_isStackedWithPhaseColors, "StackPhaseColors", false, " with Phase Colors" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimStackablePlotCurve::~RimStackablePlotCurve() +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.h b/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.h index a15b593ebc..735ab524f0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.h +++ b/ApplicationLibCode/ProjectDataModel/RimStackablePlotCurve.h @@ -27,6 +27,7 @@ class RimStackablePlotCurve : public RimPlotCurve public: RimStackablePlotCurve(); + ~RimStackablePlotCurve() override; virtual RiaDefines::PhaseType phaseType() const; void assignStackColor( size_t index, size_t count ); diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp index d6974c4a38..0e3caef211 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp @@ -18,6 +18,7 @@ #include "RimVfpPlot.h" +#include "RiaDefines.h" #include "RimVfpDefines.h" #include "RimVfpTableExtractor.h" @@ -25,18 +26,15 @@ #include "RiaEclipseUnitTools.h" #include "RiuContextMenuLauncher.h" -#include "RiuQwtPlotTools.h" +#include "RiuPlotCurve.h" +#include "RiuPlotWidget.h" +#include "RiuQwtPlotCurveDefines.h" #include "RiuQwtPlotWidget.h" +#include "RiuQwtSymbol.h" #include "cafCmdFeatureMenuBuilder.h" #include "cafPdmUiComboBoxEditor.h" -#include "qwt_legend.h" -#include "qwt_legend_label.h" -#include "qwt_plot.h" -#include "qwt_plot_curve.h" -#include "qwt_symbol.h" - #include #include @@ -169,7 +167,7 @@ void RimVfpPlot::setFileName( const QString& filename ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget* RimVfpPlot::viewer() +RiuPlotWidget* RimVfpPlot::plotWidget() { return m_plotWidget; } @@ -214,29 +212,14 @@ void RimVfpPlot::updateLegend() if ( doShowLegend ) { - QwtLegend* legend = new QwtLegend( m_plotWidget ); - m_plotWidget->insertLegend( legend, QwtPlot::BottomLegend ); + m_plotWidget->insertLegend( RiuPlotWidget::Legend::BOTTOM ); } else { - m_plotWidget->insertLegend( nullptr ); + m_plotWidget->clearLegend(); } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot::updateZoomInQwt() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot::updateZoomFromQwt() -{ -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -328,21 +311,6 @@ void RimVfpPlot::detachAllCurves() { } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmObject* RimVfpPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* /*curve*/ ) const -{ - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimVfpPlot::onAxisSelected( int /*axis*/, bool /*toggle*/ ) -{ -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -392,7 +360,7 @@ void RimVfpPlot::doRemoveFromCollection() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget* RimVfpPlot::doCreatePlotViewWidget( QWidget* mainWindowParent ) +RiuPlotWidget* RimVfpPlot::doCreatePlotViewWidget( QWidget* mainWindowParent ) { // It seems we risk being called multiple times if ( m_plotWidget ) @@ -401,13 +369,10 @@ RiuQwtPlotWidget* RimVfpPlot::doCreatePlotViewWidget( QWidget* mainWindowParent } { - auto plotWidget = new RiuQwtPlotWidget( this, mainWindowParent ); + RiuPlotWidget* plotWidget = new RiuQwtPlotWidget( this, mainWindowParent ); // Remove event filter to disable unwanted highlighting on left click in plot. - plotWidget->removeEventFilter( plotWidget ); - plotWidget->canvas()->removeEventFilter( plotWidget ); - - RiuQwtPlotTools::setCommonPlotBehaviour( plotWidget ); + plotWidget->removeEventFilter(); caf::CmdFeatureMenuBuilder menuBuilder; menuBuilder << "RicShowPlotDataFeature"; @@ -454,7 +419,7 @@ void RimVfpPlot::onLoadDataAndUpdate() return; } - m_plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve ); + m_plotWidget->detachItems( RiuPlotWidget::PlotItemType::CURVE ); updateLegend(); @@ -500,8 +465,8 @@ void RimVfpPlot::onLoadDataAndUpdate() m_primaryVariable(), m_familyVariable() ) ); - m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, true ); - m_plotWidget->setAxisTitleEnabled( QwtPlot::yLeft, true ); + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); } m_plotWidget->scheduleReplot(); @@ -510,7 +475,7 @@ void RimVfpPlot::onLoadDataAndUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget, const Opm::VFPInjTable& table ) +void RimVfpPlot::populatePlotWidgetWithCurveData( RiuPlotWidget* plotWidget, const Opm::VFPInjTable& table ) { VfpPlotData plotData; populatePlotData( table, m_interpolatedVariable(), plotData ); @@ -570,7 +535,7 @@ void RimVfpPlot::populatePlotData( const Opm::VFPInjTable& table //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget, +void RimVfpPlot::populatePlotWidgetWithCurveData( RiuPlotWidget* plotWidget, const Opm::VFPProdTable& table, RimVfpDefines::ProductionVariableType primaryVariable, RimVfpDefines::ProductionVariableType familyVariable ) @@ -583,25 +548,36 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuQwtPlotWidget* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimVfpPlot::populatePlotWidgetWithPlotData( RiuQwtPlotWidget* plotWidget, const VfpPlotData& plotData ) +void RimVfpPlot::populatePlotWidgetWithPlotData( RiuPlotWidget* plotWidget, const VfpPlotData& plotData ) { - plotWidget->detachItems( QwtPlotItem::Rtti_PlotCurve ); - plotWidget->setAxisScale( QwtPlot::xBottom, 0, 1 ); - plotWidget->setAxisScale( QwtPlot::yLeft, 0, 1 ); - plotWidget->setAxisAutoScale( QwtPlot::xBottom, true ); - plotWidget->setAxisAutoScale( QwtPlot::yLeft, true ); - plotWidget->setAxisTitleText( QwtPlot::xBottom, plotData.xAxisTitle() ); - plotWidget->setAxisTitleText( QwtPlot::yLeft, plotData.yAxisTitle() ); + plotWidget->detachItems( RiuPlotWidget::PlotItemType::CURVE ); + plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0, 1 ); + plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0, 1 ); + plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); + plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, plotData.xAxisTitle() ); + plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, plotData.yAxisTitle() ); for ( auto idx = 0u; idx < plotData.size(); idx++ ) { QColor qtClr = RiaColorTables::summaryCurveDefaultPaletteColors().cycledQColor( idx ); - QwtPlotCurve* curve = createPlotCurve( plotData.curveTitle( idx ), qtClr ); - curve->setSamples( plotData.xData( idx ).data(), - plotData.yData( idx ).data(), - static_cast( plotData.curveSize( idx ) ) ); - curve->attach( plotWidget ); - curve->show(); + RiuPlotCurve* curve = m_plotWidget->createPlotCurve( nullptr, plotData.curveTitle( idx ), qtClr ); + + curve->setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID, + RiuQwtPlotCurveDefines::CurveInterpolationEnum::INTERPOLATION_POINT_TO_POINT, + 2, + qtClr ); + + RiuPlotCurveSymbol* symbol = curve->createSymbol( RiuPlotCurveSymbol::PointSymbolEnum::SYMBOL_ELLIPSE ); + symbol->setColor( qtClr ); + symbol->setSize( 6, 6 ); + curve->setSymbol( symbol ); + + curve->setSamplesFromXValuesAndYValues( plotData.xData( idx ), + plotData.yData( idx ), + static_cast( plotData.curveSize( idx ) ) ); + curve->attachToPlot( plotWidget ); + curve->showInPlot(); } } @@ -687,27 +663,6 @@ void RimVfpPlot::populatePlotData( const Opm::VFPProdTable& table } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QwtPlotCurve* RimVfpPlot::createPlotCurve( const QString title, const QColor& color ) -{ - QwtPlotCurve* curve = new QwtPlotCurve; - curve->setTitle( title ); - curve->setPen( QPen( color, 2 ) ); - curve->setLegendAttribute( QwtPlotCurve::LegendShowLine, true ); - curve->setLegendAttribute( QwtPlotCurve::LegendShowSymbol, true ); - curve->setLegendAttribute( QwtPlotCurve::LegendShowBrush, true ); - curve->setRenderHint( QwtPlotItem::RenderAntialiased, true ); - - QwtSymbol* symbol = new QwtSymbol( QwtSymbol::Ellipse ); - symbol->setSize( 6 ); - symbol->setColor( color ); - curve->setSymbol( symbol ); - - return curve; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1036,7 +991,7 @@ void RimVfpPlot::updatePlotTitle( const QString& plotTitle ) if ( m_plotWidget ) { - m_plotWidget->setTitle( plotTitle ); + m_plotWidget->setPlotTitle( plotTitle ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h index f73241115c..ca832c04b7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h @@ -29,7 +29,7 @@ #include "opm/parser/eclipse/EclipseState/Schedule/VFPInjTable.hpp" #include "opm/parser/eclipse/EclipseState/Schedule/VFPProdTable.hpp" -class RiuQwtPlotWidget; +class RiuPlotWidget; class VfpPlotData; //-------------------------------------------------------------------------------------------------- @@ -46,18 +46,15 @@ class RimVfpPlot : public RimPlot void setFileName( const QString& filename ); // RimPlot implementations - RiuQwtPlotWidget* viewer() override; - void setAutoScaleXEnabled( bool enabled ) override; - void setAutoScaleYEnabled( bool enabled ) override; - void updateAxes() override; - void updateLegend() override; - void updateZoomInQwt() override; - void updateZoomFromQwt() override; - QString asciiDataForPlotExport() const override; - void reattachAllCurves() override; - void detachAllCurves() override; - caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override; - void onAxisSelected( int axis, bool toggle ) override; + RiuPlotWidget* plotWidget() override; + + void setAutoScaleXEnabled( bool enabled ) override; + void setAutoScaleYEnabled( bool enabled ) override; + void updateAxes() override; + void updateLegend() override; + QString asciiDataForPlotExport() const override; + void reattachAllCurves() override; + void detachAllCurves() override; // RimPlotWindow implementations QString description() const override; @@ -79,10 +76,10 @@ class RimVfpPlot : public RimPlot caf::PdmFieldHandle* userDescriptionField() override; private: - RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent ) override; + RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent ) override; - void populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget, const Opm::VFPInjTable& table ); - void populatePlotWidgetWithCurveData( RiuQwtPlotWidget* plotWidget, + void populatePlotWidgetWithCurveData( RiuPlotWidget* plotWidget, const Opm::VFPInjTable& table ); + void populatePlotWidgetWithCurveData( RiuPlotWidget* plotWidget, const Opm::VFPProdTable& table, RimVfpDefines::ProductionVariableType primaryVariable, RimVfpDefines::ProductionVariableType familyVariable ); @@ -114,8 +111,7 @@ class RimVfpPlot : public RimPlot RimVfpDefines::ProductionVariableType primaryVariable, RimVfpDefines::ProductionVariableType familyVariable ); - static QwtPlotCurve* createPlotCurve( const QString title, const QColor& color ); - static double convertToDisplayUnit( double value, RimVfpDefines::ProductionVariableType variableType ); + static double convertToDisplayUnit( double value, RimVfpDefines::ProductionVariableType variableType ); static void convertToDisplayUnit( std::vector& values, RimVfpDefines::ProductionVariableType variableType ); static QString getDisplayUnit( RimVfpDefines::ProductionVariableType variableType ); @@ -137,7 +133,7 @@ class RimVfpPlot : public RimPlot RimVfpDefines::InterpolatedVariableType interpolatedVariable, VfpPlotData& plotData ) const; - void populatePlotWidgetWithPlotData( RiuQwtPlotWidget* plotWidget, const VfpPlotData& plotData ); + void populatePlotWidgetWithPlotData( RiuPlotWidget* plotWidget, const VfpPlotData& plotData ); private: caf::PdmField m_plotTitle; @@ -159,7 +155,7 @@ class RimVfpPlot : public RimPlot caf::PdmField m_waterCutIdx; caf::PdmField m_gasLiquidRatioIdx; - QPointer m_plotWidget; + QPointer m_plotWidget; std::unique_ptr m_prodTable; std::unique_ptr m_injectionTable; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp index edbd1d6311..cd49e4e8ff 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp @@ -117,7 +117,7 @@ void RimAsciiDataCurve::updateZoomInParentPlot() RimSummaryPlot* plot = nullptr; firstAncestorOrThisOfType( plot ); - plot->updateZoomInQwt(); + plot->updateZoomInParentPlot(); } //-------------------------------------------------------------------------------------------------- @@ -140,7 +140,7 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot ) { if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE ) { - m_qwtPlotCurve->setSamplesFromTimeTAndYValues( dateTimes, values, isLogCurve ); + m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, values, isLogCurve ); } else { @@ -156,17 +156,17 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot ) } } - m_qwtPlotCurve->setSamplesFromXValuesAndYValues( times, values, isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( times, values, isLogCurve ); } } else { - m_qwtPlotCurve->setSamplesFromTimeTAndYValues( std::vector(), std::vector(), isLogCurve ); + m_plotCurve->setSamplesFromTimeTAndYValues( std::vector(), std::vector(), isLogCurve ); } updateZoomInParentPlot(); - if ( m_parentQwtPlot ) m_parentQwtPlot->replot(); + if ( m_parentPlot ) m_parentPlot->replot(); } updateQwtPlotAxis(); @@ -197,17 +197,7 @@ void RimAsciiDataCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi //-------------------------------------------------------------------------------------------------- void RimAsciiDataCurve::updateQwtPlotAxis() { - if ( m_qwtPlotCurve ) - { - if ( this->yAxis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) - { - m_qwtPlotCurve->setYAxis( QwtPlot::yLeft ); - } - else - { - m_qwtPlotCurve->setYAxis( QwtPlot::yRight ); - } - } + if ( m_plotCurve ) updateAxisInPlot( this->yAxis() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h index 9a61b06ed9..1fab04ea7e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h @@ -58,7 +58,7 @@ class RimAsciiDataCurve : public RimPlotCurve void setTimeSteps( const std::vector& timeSteps ); void setValues( const std::vector& values ); - void setTitle( const QString& title ); + void setTitle( const QString& title ) override; protected: // RimPlotCurve overrides diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 92f1809c64..0a027bf986 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -53,9 +53,9 @@ #include "RiuAbstractLegendFrame.h" #include "RiuDraggableOverlayFrame.h" +#include "RiuPlotCurve.h" +#include "RiuPlotCurveSymbol.h" #include "RiuPlotMainWindow.h" -#include "RiuQwtPlotCurve.h" -#include "RiuSummaryQwtPlot.h" #include "RiuSummaryVectorSelectionDialog.h" #include "RiuTextContentFrame.h" @@ -70,23 +70,13 @@ #include "cafPdmUiTreeSelectionEditor.h" #include "cafTitledOverlayFrame.h" -#include "cvfScalarMapper.h" - -#include "qwt_plot_curve.h" -#include "qwt_symbol.h" - #include -//-------------------------------------------------------------------------------------------------- -/// Internal constants -//-------------------------------------------------------------------------------------------------- -#define DOUBLE_INF std::numeric_limits::infinity() - //-------------------------------------------------------------------------------------------------- /// Internal functions //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseSummaryAddress& address ); -int statisticsCurveSymbolSize( RiuQwtSymbol::PointSymbolEnum symbol ); +RiuPlotCurveSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseSummaryAddress& address ); +int statisticsCurveSymbolSize( RiuPlotCurveSymbol::PointSymbolEnum symbol ); CAF_PDM_SOURCE_INIT( RimEnsembleCurveSet, "RimEnsembleCurveSet" ); @@ -210,8 +200,7 @@ RimEnsembleCurveSet::RimEnsembleCurveSet() m_summaryAddressNameTools = new RimSummaryCurveAutoName; - m_qwtPlotCurveForLegendText = new QwtPlotCurve; - m_qwtPlotCurveForLegendText->setLegendAttribute( QwtPlotCurve::LegendShowSymbol, true ); + m_plotCurveForLegendText = nullptr; m_ensembleStatCase.reset( new RimEnsembleStatisticsCase( this ) ); m_ensembleStatCase->createSummaryReaderInterface(); @@ -232,12 +221,12 @@ RimEnsembleCurveSet::~RimEnsembleCurveSet() RimSummaryPlot* parentPlot; firstAncestorOrThisOfType( parentPlot ); - if ( parentPlot && parentPlot->viewer() ) + if ( parentPlot && parentPlot->plotWidget() ) { - m_qwtPlotCurveForLegendText->detach(); + if ( m_plotCurveForLegendText ) m_plotCurveForLegendText->detach(); if ( m_legendOverlayFrame ) { - parentPlot->viewer()->removeOverlayFrame( m_legendOverlayFrame ); + parentPlot->plotWidget()->removeOverlayFrame( m_legendOverlayFrame ); } } if ( m_legendOverlayFrame ) @@ -256,7 +245,7 @@ RimEnsembleCurveSet::~RimEnsembleCurveSet() delete m_objectiveFunctionOverlayFrame; } - delete m_qwtPlotCurveForLegendText; + delete m_plotCurveForLegendText; } //-------------------------------------------------------------------------------------------------- @@ -304,44 +293,55 @@ void RimEnsembleCurveSet::loadDataAndUpdate( bool updateParentPlot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSet::setParentQwtPlotNoReplot( QwtPlot* plot ) +void RimEnsembleCurveSet::setParentPlotNoReplot( RiuPlotWidget* plot ) { for ( RimSummaryCurve* curve : m_curves ) { - curve->setParentQwtPlotNoReplot( plot ); + // TODO: attach without replotting + curve->attach( plot ); + } + + if ( !m_plotCurveForLegendText ) + { + m_plotCurveForLegendText = plot->createPlotCurve( nullptr, "", Qt::black ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSet::detachQwtCurves() +void RimEnsembleCurveSet::detachPlotCurves() { for ( RimSummaryCurve* curve : m_curves ) { - curve->detachQwtCurve(); + curve->detach(); } - m_qwtPlotCurveForLegendText->detach(); + if ( m_plotCurveForLegendText ) + { + m_plotCurveForLegendText->detach(); + delete m_plotCurveForLegendText; + m_plotCurveForLegendText = nullptr; + } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSet::reattachQwtCurves() +void RimEnsembleCurveSet::reattachPlotCurves() { for ( RimSummaryCurve* curve : m_curves ) { - curve->reattachQwtCurve(); + curve->reattach(); } - m_qwtPlotCurveForLegendText->detach(); - - RimSummaryPlot* plot = nullptr; - firstAncestorOrThisOfType( plot ); - if ( plot ) + if ( m_plotCurveForLegendText ) { - m_qwtPlotCurveForLegendText->attach( plot->viewer() ); + m_plotCurveForLegendText->detach(); + + RimSummaryPlot* plot = nullptr; + firstAncestorOrThisOfType( plot ); + if ( plot && plot->plotWidget() ) m_plotCurveForLegendText->attachToPlot( plot->plotWidget() ); } } @@ -354,7 +354,7 @@ void RimEnsembleCurveSet::addCurve( RimSummaryCurve* curve ) { RimSummaryPlot* plot; firstAncestorOrThisOfType( plot ); - if ( plot ) curve->setParentQwtPlotNoReplot( plot->viewer() ); + if ( plot && plot->plotWidget() ) curve->setParentPlotNoReplot( plot->plotWidget() ); curve->setColor( m_color ); m_curves.push_back( curve ); @@ -619,6 +619,15 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi if ( changedField == &m_showCurves ) { + if ( !m_showCurves() ) + { + // Need to detach the legend since the plot type might change from Qwt to QtCharts. + // The plot curve for legend text needs to be recreated when curves are shown next time. + m_plotCurveForLegendText->detach(); + delete m_plotCurveForLegendText; + m_plotCurveForLegendText = nullptr; + } + loadDataAndUpdate( true ); updateConnectedEditors(); @@ -738,7 +747,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi curve->setLeftOrRightAxisY( m_plotAxis() ); } - updateQwtPlotAxis(); + updatePlotAxis(); plot->updateAxes(); updateTextInPlot = true; @@ -1315,26 +1324,26 @@ void RimEnsembleCurveSet::updateFilterLegend() { RimSummaryPlot* plot; firstAncestorOrThisOfType( plot ); - if ( plot && plot->viewer() ) + if ( plot && plot->plotWidget() ) { if ( m_curveFilters()->isActive() && m_curveFilters()->countActiveFilters() > 0 ) { if ( !m_filterOverlayFrame ) { m_filterOverlayFrame = - new RiuDraggableOverlayFrame( plot->viewer()->canvas(), plot->viewer()->overlayMargins() ); + new RiuDraggableOverlayFrame( plot->plotWidget(), plot->plotWidget()->overlayMargins() ); } m_filterOverlayFrame->setContentFrame( m_curveFilters()->makeFilterDescriptionFrame() ); - plot->viewer()->addOverlayFrame( m_filterOverlayFrame ); + plot->plotWidget()->addOverlayFrame( m_filterOverlayFrame ); } else { if ( m_filterOverlayFrame ) { - plot->viewer()->removeOverlayFrame( m_filterOverlayFrame ); + plot->plotWidget()->removeOverlayFrame( m_filterOverlayFrame ); } } - plot->viewer()->scheduleReplot(); + plot->plotWidget()->scheduleReplot(); } } @@ -1345,7 +1354,7 @@ void RimEnsembleCurveSet::updateObjectiveFunctionLegend() { RimSummaryPlot* plot; firstAncestorOrThisOfType( plot ); - if ( plot && plot->viewer() ) + if ( plot && plot->plotWidget() ) { if ( ( m_colorMode == ColorMode::BY_OBJECTIVE_FUNCTION || m_colorMode == ColorMode::BY_CUSTOM_OBJECTIVE_FUNCTION ) && m_showObjectiveFunctionFormula() ) @@ -1353,7 +1362,7 @@ void RimEnsembleCurveSet::updateObjectiveFunctionLegend() if ( !m_objectiveFunctionOverlayFrame ) { m_objectiveFunctionOverlayFrame = - new RiuDraggableOverlayFrame( plot->viewer()->canvas(), plot->viewer()->overlayMargins() ); + new RiuDraggableOverlayFrame( plot->plotWidget(), plot->plotWidget()->overlayMargins() ); } QString title; QString description; @@ -1385,18 +1394,18 @@ void RimEnsembleCurveSet::updateObjectiveFunctionLegend() { m_objectiveFunctionOverlayFrame->setContentFrame( new RiuTextContentFrame( nullptr, title, description ) ); m_objectiveFunctionOverlayFrame->setMaximumWidth( 10000 ); - plot->viewer()->addOverlayFrame( m_objectiveFunctionOverlayFrame ); + plot->plotWidget()->addOverlayFrame( m_objectiveFunctionOverlayFrame ); } } else { if ( m_objectiveFunctionOverlayFrame ) { - plot->viewer()->removeOverlayFrame( m_objectiveFunctionOverlayFrame ); + plot->plotWidget()->removeOverlayFrame( m_objectiveFunctionOverlayFrame ); } } } - plot->viewer()->scheduleReplot(); + plot->plotWidget()->scheduleReplot(); } //-------------------------------------------------------------------------------------------------- @@ -1565,27 +1574,27 @@ void RimEnsembleCurveSet::updateCurveColors() RimSummaryPlot* plot; firstAncestorOrThisOfType( plot ); - if ( plot && plot->viewer() ) + if ( plot && plot->plotWidget() ) { if ( m_yValuesSummaryCaseCollection() && isCurvesVisible() && m_colorMode != ColorMode::SINGLE_COLOR && m_legendConfig->showLegend() ) { if ( !m_legendOverlayFrame ) { - m_legendOverlayFrame = - new RiuDraggableOverlayFrame( plot->viewer()->canvas(), plot->viewer()->overlayMargins() ); + m_legendOverlayFrame = new RiuDraggableOverlayFrame( plot->plotWidget()->getParentForOverlay(), + plot->plotWidget()->overlayMargins() ); } m_legendOverlayFrame->setContentFrame( m_legendConfig->makeLegendFrame() ); - plot->viewer()->addOverlayFrame( m_legendOverlayFrame ); + plot->plotWidget()->addOverlayFrame( m_legendOverlayFrame ); } else { if ( m_legendOverlayFrame ) { - plot->viewer()->removeOverlayFrame( m_legendOverlayFrame ); + plot->plotWidget()->removeOverlayFrame( m_legendOverlayFrame ); } } - plot->viewer()->scheduleReplot(); + plot->plotWidget()->scheduleReplot(); } } @@ -1638,11 +1647,11 @@ void RimEnsembleCurveSet::updateAddressesUiField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSet::updateQwtPlotAxis() +void RimEnsembleCurveSet::updatePlotAxis() { for ( RimSummaryCurve* curve : curves() ) { - curve->updateQwtPlotAxis(); + curve->updatePlotAxis(); } } @@ -1656,7 +1665,7 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectordetach(); + if ( m_plotCurveForLegendText ) m_plotCurveForLegendText->detach(); deleteStatisticsCurves(); if ( m_statistics->hideEnsembleCurves() ) return; @@ -1692,20 +1701,18 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectorloadDataAndUpdate( false ); - newSummaryCurves[i]->updateQwtPlotAxis(); - if ( newSummaryCurves[i]->qwtPlotCurve() ) - { - newSummaryCurves[i]->qwtPlotCurve()->setItemAttribute( QwtPlotItem::Legend, false ); - } + newSummaryCurves[i]->updatePlotAxis(); + newSummaryCurves[i]->setShowInLegend( false ); } - if ( plot->viewer() ) m_qwtPlotCurveForLegendText->attach( plot->viewer() ); + if ( plot->plotWidget() && m_plotCurveForLegendText ) + m_plotCurveForLegendText->attachToPlot( plot->plotWidget() ); } - if ( plot->viewer() ) + if ( plot->plotWidget() ) { - if ( plot->legendsVisible() ) plot->viewer()->updateLegend(); - plot->viewer()->scheduleReplot(); + if ( plot->legendsVisible() ) plot->plotWidget()->updateLegend(); + plot->plotWidget()->scheduleReplot(); plot->updateAxes(); plot->updatePlotInfoLabel(); } @@ -1764,35 +1771,36 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vectorplotWidget() ) { - auto curve = new RimSummaryCurve(); - curve->setParentQwtPlotNoReplot( plot->viewer() ); - m_curves.push_back( curve ); - curve->setColor( m_statistics->color() ); - curve->setResampling( m_resampling() ); - - auto symbol = statisticsCurveSymbolFromAddress( address ); - curve->setSymbol( symbol ); - curve->setSymbolSize( statisticsCurveSymbolSize( symbol ) ); - curve->setSymbolSkipDistance( 150 ); - if ( m_statistics->showCurveLabels() ) + for ( auto address : addresses ) { - curve->setSymbolLabel( QString::fromStdString( address.ensembleStatisticsQuantityName() ) ); - } - curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); - curve->setSummaryCaseY( m_ensembleStatCase.get() ); - curve->setSummaryAddressYAndApplyInterpolation( address ); - curve->setLeftOrRightAxisY( m_plotAxis() ); + auto curve = new RimSummaryCurve(); + curve->setParentPlotNoReplot( plot->plotWidget() ); + m_curves.push_back( curve ); + curve->setColor( m_statistics->color() ); + curve->setResampling( m_resampling() ); + + auto symbol = statisticsCurveSymbolFromAddress( address ); + curve->setSymbol( symbol ); + curve->setSymbolSize( statisticsCurveSymbolSize( symbol ) ); + curve->setSymbolSkipDistance( 150 ); + if ( m_statistics->showCurveLabels() ) + { + curve->setSymbolLabel( QString::fromStdString( address.ensembleStatisticsQuantityName() ) ); + } + curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); + curve->setSummaryCaseY( m_ensembleStatCase.get() ); + curve->setSummaryAddressYAndApplyInterpolation( address ); + curve->setLeftOrRightAxisY( m_plotAxis() ); - curve->updateCurveVisibility(); - curve->loadDataAndUpdate( false ); - curve->updateQwtPlotAxis(); - } + curve->updateCurveVisibility(); + curve->loadDataAndUpdate( false ); + curve->updatePlotAxis(); + } - if ( plot->viewer() ) - { - plot->viewer()->updateLegend(); + plot->plotWidget()->updateLegend(); plot->updateAxes(); } } @@ -1839,7 +1847,7 @@ void RimEnsembleCurveSet::updateAllTextInPlot() RimSummaryPlot* summaryPlot = nullptr; this->firstAncestorOrThisOfTypeAsserted( summaryPlot ); - if ( summaryPlot->viewer() ) + if ( summaryPlot->plotWidget() ) { summaryPlot->updatePlotTitle(); } @@ -1944,16 +1952,16 @@ bool RimEnsembleCurveSet::hasMeanData() const //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSet::updateEnsembleLegendItem() { - m_qwtPlotCurveForLegendText->setTitle( name() ); + if ( !m_plotCurveForLegendText ) return; + + m_plotCurveForLegendText->setTitle( name() ); { - QwtSymbol* symbol = nullptr; + RiuPlotCurveSymbol* symbol = m_plotCurveForLegendText->createSymbol( RiuPlotCurveSymbol::SYMBOL_CROSS ); if ( m_colorMode == ColorMode::SINGLE_COLOR ) { - symbol = new QwtSymbol( QwtSymbol::HLine ); - - QColor curveColor( m_color.value().rByte(), m_color.value().gByte(), m_color.value().bByte() ); + QColor curveColor = RiaColorTools::toQColor( m_color ); QPen curvePen( curveColor ); curvePen.setWidth( 2 ); @@ -1963,17 +1971,15 @@ void RimEnsembleCurveSet::updateEnsembleLegendItem() else if ( m_colorMode == ColorMode::BY_ENSEMBLE_PARAM ) { QPixmap p = QPixmap( ":/Legend.png" ); - - symbol = new QwtSymbol; symbol->setPixmap( p ); symbol->setSize( 8, 8 ); } - m_qwtPlotCurveForLegendText->setSymbol( symbol ); + m_plotCurveForLegendText->setSymbol( symbol ); } bool showLegendItem = isCurvesVisible(); - m_qwtPlotCurveForLegendText->setItemAttribute( QwtPlotItem::Legend, showLegendItem ); + m_plotCurveForLegendText->setVisibleInLegend( showLegendItem ); } //-------------------------------------------------------------------------------------------------- @@ -2039,23 +2045,23 @@ void RimEnsembleCurveSet::updateLegendMappingMode() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseSummaryAddress& address ) +RiuPlotCurveSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseSummaryAddress& address ) { auto qName = QString::fromStdString( address.quantityName() ); - if ( qName.contains( ENSEMBLE_STAT_P10_QUANTITY_NAME ) ) return RiuQwtSymbol::SYMBOL_TRIANGLE; - if ( qName.contains( ENSEMBLE_STAT_P90_QUANTITY_NAME ) ) return RiuQwtSymbol::SYMBOL_DOWN_TRIANGLE; - if ( qName.contains( ENSEMBLE_STAT_P50_QUANTITY_NAME ) ) return RiuQwtSymbol::SYMBOL_DIAMOND; - return RiuQwtSymbol::SYMBOL_ELLIPSE; + if ( qName.contains( ENSEMBLE_STAT_P10_QUANTITY_NAME ) ) return RiuPlotCurveSymbol::SYMBOL_TRIANGLE; + if ( qName.contains( ENSEMBLE_STAT_P90_QUANTITY_NAME ) ) return RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE; + if ( qName.contains( ENSEMBLE_STAT_P50_QUANTITY_NAME ) ) return RiuPlotCurveSymbol::SYMBOL_DIAMOND; + return RiuPlotCurveSymbol::SYMBOL_ELLIPSE; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int statisticsCurveSymbolSize( RiuQwtSymbol::PointSymbolEnum symbol ) +int statisticsCurveSymbolSize( RiuPlotCurveSymbol::PointSymbolEnum symbol ) { - if ( symbol == RiuQwtSymbol::SYMBOL_DIAMOND ) return 8; - if ( symbol == RiuQwtSymbol::SYMBOL_TRIANGLE ) return 7; - if ( symbol == RiuQwtSymbol::SYMBOL_DOWN_TRIANGLE ) return 7; + if ( symbol == RiuPlotCurveSymbol::SYMBOL_DIAMOND ) return 8; + if ( symbol == RiuPlotCurveSymbol::SYMBOL_TRIANGLE ) return 7; + if ( symbol == RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE ) return 7; return 6; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index 35f1ef8878..d8a648104e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -22,7 +22,7 @@ #include "RifEclipseSummaryAddressQMetaType.h" #include "RifSummaryReaderInterface.h" -#include "RiaDefines.h" +#include "RiaPlotDefines.h" #include "RiaQDateTimeTools.h" #include "RimEnsembleCurveSetColorManager.h" @@ -61,6 +61,8 @@ class RiuDraggableOverlayFrame; class RiaSummaryCurveDefinitionAnalyser; class RiaSummaryCurveDefinition; class RiuSummaryVectorSelectionDialog; +class RiuPlotWidget; +class RiuPlotCurve; class QwtPlot; class QwtPlotCurve; @@ -92,9 +94,9 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt void setColor( cvf::Color3f color ); void loadDataAndUpdate( bool updateParentPlot ); - void setParentQwtPlotNoReplot( QwtPlot* plot ); - void detachQwtCurves(); - void reattachQwtCurves(); + void setParentPlotNoReplot( RiuPlotWidget* plot ); + void detachPlotCurves(); + void reattachPlotCurves(); void addCurve( RimSummaryCurve* curve ); void deleteCurve( RimSummaryCurve* curve ); @@ -184,7 +186,7 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - void updateQwtPlotAxis(); + void updatePlotAxis(); QString createAutoName() const; @@ -241,7 +243,7 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt caf::PdmProxyValueField m_autoGeneratedName; caf::PdmChildField m_summaryAddressNameTools; - QwtPlotCurve* m_qwtPlotCurveForLegendText; + RiuPlotCurve* m_plotCurveForLegendText; QPointer m_legendOverlayFrame; QPointer m_filterOverlayFrame; QPointer m_objectiveFunctionOverlayFrame; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp index 41748a72bf..b2156944cb 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp @@ -29,9 +29,7 @@ #include "RimSummaryPlot.h" #include "RimSummaryPlotSourceStepping.h" -#include "RiuQwtPlotCurve.h" - -#include "qwt_plot.h" +#include "RiuPlotCurve.h" CAF_PDM_SOURCE_INIT( RimEnsembleCurveSetCollection, "RimEnsembleCurveSetCollection" ); @@ -94,11 +92,11 @@ void RimEnsembleCurveSetCollection::loadDataAndUpdate( bool updateParentPlot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSetCollection::setParentQwtPlotAndReplot( QwtPlot* plot ) +void RimEnsembleCurveSetCollection::setParentPlotAndReplot( RiuPlotWidget* plot ) { for ( RimEnsembleCurveSet* curveSet : m_curveSets ) { - curveSet->setParentQwtPlotNoReplot( plot ); + curveSet->setParentPlotNoReplot( plot ); } if ( plot ) plot->replot(); @@ -107,35 +105,35 @@ void RimEnsembleCurveSetCollection::setParentQwtPlotAndReplot( QwtPlot* plot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSetCollection::detachQwtCurves() +void RimEnsembleCurveSetCollection::detachPlotCurves() { for ( const auto& curveSet : m_curveSets ) { - curveSet->detachQwtCurves(); + curveSet->detachPlotCurves(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSetCollection::reattachQwtCurves() +void RimEnsembleCurveSetCollection::reattachPlotCurves() { for ( const auto& curveSet : m_curveSets ) { - curveSet->reattachQwtCurves(); + curveSet->reattachPlotCurves(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryCurve* RimEnsembleCurveSetCollection::findRimCurveFromQwtCurve( const QwtPlotCurve* qwtCurve ) const +RimSummaryCurve* RimEnsembleCurveSetCollection::findRimCurveFromPlotCurve( const RiuPlotCurve* curve ) const { for ( RimEnsembleCurveSet* curveSet : m_curveSets ) { for ( RimSummaryCurve* rimCurve : curveSet->curves() ) { - if ( rimCurve->qwtPlotCurve() == qwtCurve ) + if ( rimCurve->isSameCurve( curve ) ) { return rimCurve; } @@ -148,13 +146,13 @@ RimSummaryCurve* RimEnsembleCurveSetCollection::findRimCurveFromQwtCurve( const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimEnsembleCurveSet* RimEnsembleCurveSetCollection::findRimCurveSetFromQwtCurve( const QwtPlotCurve* qwtCurve ) const +RimEnsembleCurveSet* RimEnsembleCurveSetCollection::findCurveSetFromPlotCurve( const RiuPlotCurve* curve ) const { for ( RimEnsembleCurveSet* curveSet : m_curveSets ) { for ( RimSummaryCurve* rimCurve : curveSet->curves() ) { - if ( rimCurve->qwtPlotCurve() == qwtCurve ) + if ( rimCurve->isSameCurve( curve ) ) { return curveSet; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h index f5253bdbb6..331e986e22 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h @@ -18,6 +18,7 @@ #pragma once +#include "RiuPlotWidget.h" #include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" #include "cafPdmField.h" @@ -26,8 +27,7 @@ class RimEnsembleCurveSet; class RimSummaryPlotSourceStepping; class RimSummaryCurve; -class QwtPlot; -class QwtPlotCurve; +class RiuPlotCurve; //================================================================================================== /// @@ -43,12 +43,12 @@ class RimEnsembleCurveSetCollection : public caf::PdmObject bool isCurveSetsVisible(); void loadDataAndUpdate( bool updateParentPlot ); - void setParentQwtPlotAndReplot( QwtPlot* plot ); - void detachQwtCurves(); - void reattachQwtCurves(); + void setParentPlotAndReplot( RiuPlotWidget* plot ); + void detachPlotCurves(); + void reattachPlotCurves(); - RimSummaryCurve* findRimCurveFromQwtCurve( const QwtPlotCurve* qwtCurve ) const; - RimEnsembleCurveSet* findRimCurveSetFromQwtCurve( const QwtPlotCurve* qwtCurve ) const; + RimSummaryCurve* findRimCurveFromPlotCurve( const RiuPlotCurve* qwtCurve ) const; + RimEnsembleCurveSet* findCurveSetFromPlotCurve( const RiuPlotCurve* qwtCurve ) const; void addCurveSet( RimEnsembleCurveSet* curveSet ); void deleteCurveSet( RimEnsembleCurveSet* curveSet ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 82f8639abc..9a2b728fa0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -55,9 +55,6 @@ #include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiTreeOrdering.h" -#include "qwt_date.h" -#include "qwt_plot.h" - CAF_PDM_SOURCE_INIT( RimSummaryCurve, "SummaryCurve" ); //-------------------------------------------------------------------------------------------------- @@ -153,7 +150,7 @@ void RimSummaryCurve::setSummaryCaseY( RimSummaryCase* sumCase ) { if ( m_yValuesSummaryCase != sumCase ) { - m_qwtCurveErrorBars->setSamples( nullptr ); + clearErrorBars(); } bool isEnsembleCurve = false; @@ -215,7 +212,7 @@ void RimSummaryCurve::setSummaryAddressY( const RifEclipseSummaryAddress& addres { if ( m_yValuesSummaryAddress->address() != address ) { - m_qwtCurveErrorBars->setSamples( nullptr ); + clearErrorBars(); } m_yValuesSummaryAddress->setAddress( address ); @@ -392,10 +389,7 @@ double RimSummaryCurve::yValueAtTimeT( time_t time ) const //-------------------------------------------------------------------------------------------------- void RimSummaryCurve::setOverrideCurveDataY( const std::vector& dateTimes, const std::vector& yValues ) { - if ( m_qwtPlotCurve ) - { - m_qwtPlotCurve->setSamplesFromTimeTAndYValues( dateTimes, yValues, true ); - } + setSamplesFromTimeTAndYValues( dateTimes, yValues, true ); } //-------------------------------------------------------------------------------------------------- @@ -558,7 +552,7 @@ void RimSummaryCurve::updateZoomInParentPlot() RimSummaryPlot* plot = nullptr; firstAncestorOrThisOfTypeAsserted( plot ); - plot->updateZoomInQwt(); + plot->updateZoomInParentPlot(); } //-------------------------------------------------------------------------------------------------- @@ -699,14 +693,14 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot ) this->setSamplesFromXYValues( std::vector(), std::vector(), isLogCurve ); } - if ( updateParentPlot && m_parentQwtPlot ) + if ( updateParentPlot && hasParentPlot() ) { updateZoomInParentPlot(); - m_parentQwtPlot->replot(); + replotParentPlot(); } } - if ( updateParentPlot ) updateQwtPlotAxis(); + if ( updateParentPlot ) updateAxisInPlot( axisY() ); } //-------------------------------------------------------------------------------------------------- @@ -909,19 +903,9 @@ RiaDefines::PhaseType RimSummaryCurve::phaseType() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryCurve::updateQwtPlotAxis() +void RimSummaryCurve::updatePlotAxis() { - if ( m_qwtPlotCurve ) - { - if ( this->axisY() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) - { - m_qwtPlotCurve->setYAxis( QwtPlot::yLeft ); - } - else - { - m_qwtPlotCurve->setYAxis( QwtPlot::yRight ); - } - } + updateAxisInPlot( axisY() ); } //-------------------------------------------------------------------------------------------------- @@ -942,7 +926,7 @@ QString RimSummaryCurve::curveExportDescription( const RifEclipseSummaryAddress& RimEnsembleCurveSetCollection* coll; firstAncestorOrThisOfType( coll ); - auto curveSet = coll ? coll->findRimCurveSetFromQwtCurve( m_qwtPlotCurve ) : nullptr; + auto curveSet = coll ? coll->findCurveSetFromPlotCurve( m_plotCurve ) : nullptr; auto group = curveSet ? curveSet->summaryCaseCollection() : nullptr; auto addressUiText = addr.uiText(); @@ -970,7 +954,7 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType() if ( m_yValuesSummaryCase->isObservedData() ) { setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); - setSymbol( RiuQwtSymbol::SYMBOL_XCROSS ); + setSymbol( RiuPlotCurveSymbol::SYMBOL_XCROSS ); return; } @@ -984,7 +968,7 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType() { setSymbolEdgeColor( m_curveAppearance->color() ); - setSymbol( RiuQwtSymbol::SYMBOL_XCROSS ); + setSymbol( RiuPlotCurveSymbol::SYMBOL_XCROSS ); setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); } else if ( prefs->defaultSummaryHistoryCurveStyle() == @@ -992,12 +976,12 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType() { setSymbolEdgeColor( m_curveAppearance->color() ); - setSymbol( RiuQwtSymbol::SYMBOL_XCROSS ); + setSymbol( RiuPlotCurveSymbol::SYMBOL_XCROSS ); setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); } else if ( prefs->defaultSummaryHistoryCurveStyle() == RiaPreferencesSummary::SummaryHistoryCurveStyleMode::LINES ) { - setSymbol( RiuQwtSymbol::SYMBOL_NONE ); + setSymbol( RiuPlotCurveSymbol::SYMBOL_NONE ); setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); } @@ -1063,8 +1047,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, } else if ( changedField == &m_plotAxis ) { - updateQwtPlotAxis(); - + updateAxisInPlot( axisY() ); plot->updateAxes(); dataChanged.send(); } @@ -1075,7 +1058,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { // If no previous case selected and observed data, use symbols to indicate observed data curve setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); - setSymbol( RiuQwtSymbol::SYMBOL_XCROSS ); + setSymbol( RiuPlotCurveSymbol::SYMBOL_XCROSS ); } plot->updateCaseNameHasChanged(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h index 4558b6c149..44c2c06ca7 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -87,7 +87,7 @@ class RimSummaryCurve : public RimStackablePlotCurve bool isEnsembleCurve() const; void setIsEnsembleCurve( bool isEnsembleCurve ); - void updateQwtPlotAxis(); + void updatePlotAxis(); void applyCurveAutoNameSettings( const RimSummaryCurveAutoName& autoNameSettings ); QString curveExportDescription( const RifEclipseSummaryAddress& address = RifEclipseSummaryAddress() ) const override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp index 99cfc2ae63..2405449e43 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp @@ -245,8 +245,8 @@ std::map } else if ( appearance == CurveAppearanceType::SYMBOL ) { - numOptions = caf::AppEnum::size() - 1; // -1 since the No symbol option is not - // counted see cycledSymbol() + numOptions = caf::AppEnum::size() - 1; // -1 since the No symbol option is + // not counted see cycledSymbol() } else if ( appearance == CurveAppearanceType::LINE_STYLE ) { @@ -524,12 +524,12 @@ RiuQwtPlotCurveDefines::LineStyleEnum RimSummaryCurveAppearanceCalculator::cycle //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::PointSymbolEnum RimSummaryCurveAppearanceCalculator::cycledSymbol( int index ) +RiuPlotCurveSymbol::PointSymbolEnum RimSummaryCurveAppearanceCalculator::cycledSymbol( int index ) { - if ( index < 0 ) return RiuQwtSymbol::SYMBOL_NONE; + if ( index < 0 ) return RiuPlotCurveSymbol::SYMBOL_NONE; - return caf::AppEnum::fromIndex( - 1 + ( index % ( caf::AppEnum::size() - 1 ) ) ); + return caf::AppEnum::fromIndex( + 1 + ( index % ( caf::AppEnum::size() - 1 ) ) ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h index 9ee0f47232..86e261b22e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h @@ -17,8 +17,8 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include "RiuPlotCurveSymbol.h" #include "RiuQwtPlotCurveDefines.h" -#include "RiuQwtSymbol.h" #include "cvfColor3.h" @@ -57,13 +57,13 @@ class RimSummaryCurveAppearanceCalculator void setupCurveLook( RimSummaryCurve* curve ); - static cvf::Color3f cycledPaletteColor( int colorIndex ); - static cvf::Color3f cycledNoneRGBBrColor( int colorIndex ); - static cvf::Color3f cycledGreenColor( int colorIndex ); - static cvf::Color3f cycledBlueColor( int colorIndex ); - static cvf::Color3f cycledRedColor( int colorIndex ); - static cvf::Color3f cycledBrownColor( int colorIndex ); - static RiuQwtSymbol::PointSymbolEnum cycledSymbol( int index ); + static cvf::Color3f cycledPaletteColor( int colorIndex ); + static cvf::Color3f cycledNoneRGBBrColor( int colorIndex ); + static cvf::Color3f cycledGreenColor( int colorIndex ); + static cvf::Color3f cycledBlueColor( int colorIndex ); + static cvf::Color3f cycledRedColor( int colorIndex ); + static cvf::Color3f cycledBrownColor( int colorIndex ); + static RiuPlotCurveSymbol::PointSymbolEnum cycledSymbol( int index ); private: void setOneCurveAppearance( CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index e28a535797..f5e1b4d672 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -109,7 +109,7 @@ void RimSummaryCurveCollection::loadDataAndUpdate( bool updateParentPlot ) for ( RimSummaryCurve* curve : m_curves ) { curve->loadDataAndUpdate( false ); - curve->updateQwtPlotAxis(); + curve->updatePlotAxis(); } if ( updateParentPlot ) @@ -123,11 +123,11 @@ void RimSummaryCurveCollection::loadDataAndUpdate( bool updateParentPlot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryCurveCollection::setParentQwtPlotAndReplot( QwtPlot* plot ) +void RimSummaryCurveCollection::setParentPlotAndReplot( RiuPlotWidget* plot ) { for ( RimSummaryCurve* curve : m_curves ) { - curve->setParentQwtPlotNoReplot( plot ); + curve->setParentPlotNoReplot( plot ); } if ( plot ) plot->replot(); @@ -136,33 +136,33 @@ void RimSummaryCurveCollection::setParentQwtPlotAndReplot( QwtPlot* plot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryCurveCollection::detachQwtCurves() +void RimSummaryCurveCollection::detachPlotCurves() { for ( RimSummaryCurve* curve : m_curves ) { - curve->detachQwtCurve(); + curve->detach(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryCurveCollection::reattachQwtCurves() +void RimSummaryCurveCollection::reattachPlotCurves() { for ( RimSummaryCurve* curve : m_curves ) { - curve->reattachQwtCurve(); + curve->reattach(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryCurve* RimSummaryCurveCollection::findRimCurveFromQwtCurve( const QwtPlotCurve* qwtCurve ) const +RimSummaryCurve* RimSummaryCurveCollection::findRimCurveFromPlotCurve( const RiuPlotCurve* curve ) const { for ( RimSummaryCurve* rimCurve : m_curves ) { - if ( rimCurve->qwtPlotCurve() == qwtCurve ) + if ( rimCurve->isSameCurve( curve ) ) { return rimCurve; } @@ -342,7 +342,7 @@ void RimSummaryCurveCollection::updateCaseNameHasChanged() firstAncestorOrThisOfTypeAsserted( parentPlot ); parentPlot->updatePlotTitle(); - if ( parentPlot->viewer() ) parentPlot->viewer()->updateLegend(); + if ( parentPlot->plotWidget() ) parentPlot->plotWidget()->updateLegend(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h index 2c4c34a190..e77dd4392f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h @@ -26,12 +26,12 @@ #include "cafPdmObject.h" #include "cafPdmPtrArrayField.h" -class QwtPlot; -class QwtPlotCurve; class RimSummaryCase; class RimSummaryCurve; class RimSummaryCrossPlot; class RimSummaryPlot; +class RiuPlotWidget; +class RiuPlotCurve; class QKeyEvent; //================================================================================================== @@ -63,11 +63,11 @@ class RimSummaryCurveCollection : public caf::PdmObject void loadDataAndUpdate( bool updateParentPlot ); private: - void setParentQwtPlotAndReplot( QwtPlot* plot ); - void detachQwtCurves(); - void reattachQwtCurves(); + void setParentPlotAndReplot( RiuPlotWidget* plot ); + void detachPlotCurves(); + void reattachPlotCurves(); - RimSummaryCurve* findRimCurveFromQwtCurve( const QwtPlotCurve* qwtCurve ) const; + RimSummaryCurve* findRimCurveFromPlotCurve( const RiuPlotCurve* curve ) const; void addCurve( RimSummaryCurve* curve ); void insertCurve( RimSummaryCurve* curve, size_t index ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index ab7c3f2721..235bbce5a3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -19,11 +19,14 @@ #include "RimSummaryPlot.h" #include "RiaColorTables.h" +#include "RiaDefines.h" #include "RiaFieldHandleTools.h" +#include "RiaPlotDefines.h" #include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryCurveDefinition.h" #include "RiaSummaryTools.h" #include "RiaTimeHistoryCurveResampler.h" + #include "RicfCommandObject.h" #include "SummaryPlotCommands/RicSummaryPlotEditorUi.h" @@ -35,6 +38,7 @@ #include "RimEnsembleCurveSetCollection.h" #include "RimGridTimeHistoryCurve.h" #include "RimMultiPlot.h" +#include "RimPlotAxisLogRangeCalculator.h" #include "RimPlotAxisProperties.h" #include "RimProject.h" #include "RimSummaryCase.h" @@ -50,6 +54,10 @@ #include "RiuSummaryQwtPlot.h" #include "RiuTreeViewEventFilter.h" +#ifdef USE_QTCHARTS +#include "RiuSummaryQtChartsPlot.h" +#endif + #include "cvfColor3.h" #include "cafPdmFieldScriptingCapability.h" @@ -57,12 +65,9 @@ #include "cafPdmUiTreeOrdering.h" #include "cafSelectionManager.h" -#include "qwt_abstract_legend.h" -#include "qwt_legend.h" +#include "qwt_plot.h" #include "qwt_plot_curve.h" -#include "qwt_plot_renderer.h" #include "qwt_plot_textlabel.h" -#include "qwt_scale_engine.h" #include #include @@ -203,7 +208,9 @@ RimSummaryPlot::RimSummaryPlot() CAF_PDM_InitScriptableField( &m_useAutoPlotTitle, "IsUsingAutoName", true, "Auto Title" ); CAF_PDM_InitScriptableField( &m_description, "PlotDescription", QString( "Summary Plot" ), "Name" ); CAF_PDM_InitScriptableField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves" ); - +#ifdef USE_QTCHARTS + CAF_PDM_InitScriptableField( &m_useQtChartsPlot, "useQtChartsPlot", false, "Use Qt Charts" ); +#endif CAF_PDM_InitFieldNoDefault( &m_summaryCurveCollection, "SummaryCurveCollection", "" ); m_summaryCurveCollection.uiCapability()->setUiTreeHidden( true ); m_summaryCurveCollection = new RimSummaryCurveCollection; @@ -222,17 +229,17 @@ RimSummaryPlot::RimSummaryPlot() CAF_PDM_InitFieldNoDefault( &m_leftYAxisProperties, "LeftYAxisProperties", "Left Y Axis" ); m_leftYAxisProperties.uiCapability()->setUiTreeHidden( true ); m_leftYAxisProperties = new RimPlotAxisProperties; - m_leftYAxisProperties->setNameAndAxis( "Left Y-Axis", QwtPlot::yLeft ); + m_leftYAxisProperties->setNameAndAxis( "Left Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); CAF_PDM_InitFieldNoDefault( &m_rightYAxisProperties, "RightYAxisProperties", "Right Y Axis" ); m_rightYAxisProperties.uiCapability()->setUiTreeHidden( true ); m_rightYAxisProperties = new RimPlotAxisProperties; - m_rightYAxisProperties->setNameAndAxis( "Right Y-Axis", QwtPlot::yRight ); + m_rightYAxisProperties->setNameAndAxis( "Right Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); CAF_PDM_InitFieldNoDefault( &m_bottomAxisProperties, "BottomAxisProperties", "Bottom X Axis" ); m_bottomAxisProperties.uiCapability()->setUiTreeHidden( true ); m_bottomAxisProperties = new RimPlotAxisProperties; - m_bottomAxisProperties->setNameAndAxis( "Bottom X-Axis", QwtPlot::xBottom ); + m_bottomAxisProperties->setNameAndAxis( "Bottom X-Axis", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); connectAxisSignals( m_leftYAxisProperties() ); connectAxisSignals( m_rightYAxisProperties() ); @@ -282,13 +289,13 @@ void RimSummaryPlot::updateAxes() updateYAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); updateYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); - if ( m_timeAxisProperties() && m_plotWidget ) + if ( m_timeAxisProperties() && plotWidget() ) { - m_plotWidget->updateAnnotationObjects( m_timeAxisProperties() ); + m_summaryPlot->updateAnnotationObjects( m_timeAxisProperties() ); } - if ( m_leftYAxisProperties() && m_plotWidget ) + if ( m_leftYAxisProperties() && plotWidget() ) { - m_plotWidget->updateAnnotationObjects( m_leftYAxisProperties() ); + m_summaryPlot->updateAnnotationObjects( m_leftYAxisProperties() ); } if ( m_isCrossPlot ) @@ -300,9 +307,9 @@ void RimSummaryPlot::updateAxes() updateTimeAxis(); } - m_plotWidget->scheduleReplot(); + plotWidget()->scheduleReplot(); - updateZoomInQwt(); + updateZoomInParentPlot(); } //-------------------------------------------------------------------------------------------------- @@ -352,15 +359,17 @@ time_t RimSummaryPlot::firstTimeStepOfFirstCurve() //-------------------------------------------------------------------------------------------------- QWidget* RimSummaryPlot::viewWidget() { - return m_plotWidget; + return plotWidget(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget* RimSummaryPlot::viewer() +RiuPlotWidget* RimSummaryPlot::plotWidget() { - return m_plotWidget; + if ( !m_summaryPlot ) return nullptr; + + return m_summaryPlot->plotWidget(); } //-------------------------------------------------------------------------------------------------- @@ -421,11 +430,11 @@ QString RimSummaryPlot::asciiDataForSummaryPlotExport( RiaQDateTimeTools::DateTi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmObject* RimSummaryPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* qwtCurve ) const +caf::PdmObject* RimSummaryPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve* plotCurve ) const { for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves ) { - if ( curve->qwtPlotCurve() == qwtCurve ) + if ( curve->isSameCurve( plotCurve ) ) { return curve; } @@ -433,7 +442,7 @@ caf::PdmObject* RimSummaryPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* q for ( RimAsciiDataCurve* curve : m_asciiDataCurves ) { - if ( curve->qwtPlotCurve() == qwtCurve ) + if ( curve->isSameCurve( plotCurve ) ) { return curve; } @@ -441,7 +450,7 @@ caf::PdmObject* RimSummaryPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* q if ( m_summaryCurveCollection ) { - RimSummaryCurve* foundCurve = m_summaryCurveCollection->findRimCurveFromQwtCurve( qwtCurve ); + RimSummaryCurve* foundCurve = m_summaryCurveCollection->findRimCurveFromPlotCurve( plotCurve ); if ( foundCurve ) { @@ -453,7 +462,7 @@ caf::PdmObject* RimSummaryPlot::findPdmObjectFromQwtCurve( const QwtPlotCurve* q if ( m_ensembleCurveSetCollection ) { - RimSummaryCurve* foundCurve = m_ensembleCurveSetCollection->findRimCurveFromQwtCurve( qwtCurve ); + RimSummaryCurve* foundCurve = m_ensembleCurveSetCollection->findRimCurveFromPlotCurve( plotCurve ); if ( foundCurve ) { @@ -671,12 +680,12 @@ void RimSummaryPlot::updatePlotTitle() updateCurveNames(); updateMdiWindowTitle(); - if ( m_plotWidget ) + if ( plotWidget() ) { QString plotTitle = description(); - m_plotWidget->setPlotTitle( plotTitle ); - m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() ); - m_plotWidget->scheduleReplot(); + plotWidget()->setPlotTitle( plotTitle ); + plotWidget()->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() ); + plotWidget()->scheduleReplot(); } } @@ -736,10 +745,10 @@ void RimSummaryPlot::copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSu //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updateAll() { - if ( m_plotWidget ) + if ( plotWidget() ) { updatePlotTitle(); - m_plotWidget->updateLegend(); + plotWidget()->updateLegend(); updateAxes(); } } @@ -749,15 +758,15 @@ void RimSummaryPlot::updateAll() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updateLegend() { - if ( m_plotWidget ) + if ( plotWidget() ) { - m_plotWidget->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() ); + plotWidget()->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() ); } reattachAllCurves(); - if ( m_plotWidget ) + if ( plotWidget() ) { - m_plotWidget->updateLegend(); + plotWidget()->updateLegend(); } } @@ -783,8 +792,11 @@ void RimSummaryPlot::setPlotInfoLabel( const QString& label ) //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::showPlotInfoLabel( bool show ) { + RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast( plotWidget() ); + if ( !qwtPlotWidget ) return; + if ( show ) - m_plotInfoLabel->attach( m_plotWidget ); + m_plotInfoLabel->attach( qwtPlotWidget->qwtPlot() ); else m_plotInfoLabel->detach(); } @@ -881,22 +893,12 @@ bool RimSummaryPlot::isNormalizationEnabled() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updateYAxis( RiaDefines::PlotAxis plotAxis ) { - if ( !m_plotWidget ) return; - - QwtPlot::Axis qwtAxis = QwtPlot::yLeft; - if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) - { - qwtAxis = QwtPlot::yLeft; - } - else - { - qwtAxis = QwtPlot::yRight; - } + if ( !plotWidget() ) return; RimPlotAxisProperties* yAxisProperties = yAxisPropertiesLeftOrRight( plotAxis ); if ( yAxisProperties->isActive() && hasVisibleCurvesForAxis( plotAxis ) ) { - m_plotWidget->enableAxis( qwtAxis, true ); + plotWidget()->enableAxis( plotAxis, true ); std::set timeHistoryQuantities; @@ -910,11 +912,11 @@ void RimSummaryPlot::updateYAxis( RiaDefines::PlotAxis plotAxis ) {}, visibleAsciiDataCurvesForAxis( plotAxis ), timeHistoryQuantities ); - calc.applyAxisPropertiesToPlot( m_plotWidget ); + calc.applyAxisPropertiesToPlot( plotWidget() ); } else { - m_plotWidget->enableAxis( qwtAxis, false ); + plotWidget()->enableAxis( plotAxis, false ); } } @@ -929,11 +931,11 @@ void RimSummaryPlot::updateZoomForAxis( RiaDefines::PlotAxis plotAxis ) { if ( m_bottomAxisProperties->isAutoZoom() ) { - m_plotWidget->setAxisAutoScale( QwtPlot::xBottom, true ); + plotWidget()->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); } else { - m_plotWidget->setAxisScale( QwtPlot::xBottom, + plotWidget()->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_bottomAxisProperties->visibleRangeMin(), m_bottomAxisProperties->visibleRangeMax() ); } @@ -942,11 +944,11 @@ void RimSummaryPlot::updateZoomForAxis( RiaDefines::PlotAxis plotAxis ) { if ( m_timeAxisProperties->isAutoZoom() ) { - m_plotWidget->setAxisAutoScale( QwtPlot::xBottom, true ); + plotWidget()->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); } else { - m_plotWidget->setAxisScale( QwtPlot::xBottom, + plotWidget()->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_timeAxisProperties->visibleRangeMin(), m_timeAxisProperties->visibleRangeMax() ); } @@ -958,29 +960,29 @@ void RimSummaryPlot::updateZoomForAxis( RiaDefines::PlotAxis plotAxis ) if ( yAxisProps->isAutoZoom() ) { - m_plotWidget->setAxisIsLogarithmic( yAxisProps->qwtPlotAxisType(), yAxisProps->isLogarithmicScaleEnabled ); - if ( yAxisProps->isLogarithmicScaleEnabled ) { - std::vector plotCurves; + plotWidget()->setAxisScaleType( yAxisProps->plotAxisType(), RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC ); + + std::vector plotCurves; for ( RimSummaryCurve* c : visibleSummaryCurvesForAxis( plotAxis ) ) { - plotCurves.push_back( c->qwtPlotCurve() ); + plotCurves.push_back( c ); } for ( RimGridTimeHistoryCurve* c : visibleTimeHistoryCurvesForAxis( plotAxis ) ) { - plotCurves.push_back( c->qwtPlotCurve() ); + plotCurves.push_back( c ); } for ( RimAsciiDataCurve* c : visibleAsciiDataCurvesForAxis( plotAxis ) ) { - plotCurves.push_back( c->qwtPlotCurve() ); + plotCurves.push_back( c ); } double min, max; - RimPlotAxisLogRangeCalculator calc( QwtPlot::yLeft, plotCurves ); + RimPlotAxisLogRangeCalculator calc( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, plotCurves ); calc.computeAxisRange( &min, &max ); if ( yAxisProps->isAxisInverted() ) @@ -988,22 +990,21 @@ void RimSummaryPlot::updateZoomForAxis( RiaDefines::PlotAxis plotAxis ) std::swap( min, max ); } - m_plotWidget->setAxisScale( yAxisProps->qwtPlotAxisType(), min, max ); + plotWidget()->setAxisScale( yAxisProps->plotAxisType(), min, max ); } else { - m_plotWidget->setAxisAutoScale( yAxisProps->qwtPlotAxisType(), true ); + plotWidget()->setAxisAutoScale( yAxisProps->plotAxisType(), true ); } } else { - m_plotWidget->setAxisScale( yAxisProps->qwtPlotAxisType(), + plotWidget()->setAxisScale( yAxisProps->plotAxisType(), yAxisProps->visibleRangeMin(), yAxisProps->visibleRangeMax() ); } - m_plotWidget->axisScaleEngine( yAxisProps->qwtPlotAxisType() ) - ->setAttribute( QwtScaleEngine::Inverted, yAxisProps->isAxisInverted() ); + plotWidget()->setAxisInverted( yAxisProps->plotAxisType(), yAxisProps->isAxisInverted() ); } } @@ -1149,11 +1150,11 @@ std::vector RimSummaryPlot::visibleAsciiDataCurvesForAxis( R //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updateTimeAxis() { - if ( !m_plotWidget ) return; + if ( !plotWidget() ) return; if ( !m_timeAxisProperties->isActive() ) { - m_plotWidget->enableAxis( QwtPlot::xBottom, false ); + plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, false ); return; } @@ -1166,14 +1167,14 @@ void RimSummaryPlot::updateTimeAxis() QString dateFormat = m_timeAxisProperties->dateFormat(); QString timeFormat = m_timeAxisProperties->timeFormat(); - m_plotWidget->useDateBasedTimeAxis( dateFormat, timeFormat, dateComponents, timeComponents ); + m_summaryPlot->useDateBasedTimeAxis( dateFormat, timeFormat, dateComponents, timeComponents ); } else { - m_plotWidget->useTimeBasedTimeAxis(); + m_summaryPlot->useTimeBasedTimeAxis(); } - m_plotWidget->enableAxis( QwtPlot::xBottom, true ); + plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); { Qt::AlignmentFlag alignment = Qt::AlignCenter; @@ -1182,13 +1183,13 @@ void RimSummaryPlot::updateTimeAxis() alignment = Qt::AlignRight; } - m_plotWidget->setAxisFontsAndAlignment( QwtPlot::xBottom, + plotWidget()->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_timeAxisProperties->titleFontSize(), m_timeAxisProperties->valuesFontSize(), true, alignment ); - m_plotWidget->setAxisTitleText( QwtPlot::xBottom, m_timeAxisProperties->title() ); - m_plotWidget->setAxisTitleEnabled( QwtPlot::xBottom, m_timeAxisProperties->showTitle ); + plotWidget()->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_timeAxisProperties->title() ); + plotWidget()->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_timeAxisProperties->showTitle ); { RimSummaryTimeAxisProperties::LegendTickmarkCount tickmarkCountEnum = @@ -1214,7 +1215,7 @@ void RimSummaryPlot::updateTimeAxis() break; } - m_plotWidget->setAxisMaxMajor( QwtPlot::xBottom, maxTickmarkCount ); + plotWidget()->setAxisMaxMajor( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, maxTickmarkCount ); } } } @@ -1224,15 +1225,13 @@ void RimSummaryPlot::updateTimeAxis() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updateBottomXAxis() { - if ( !m_plotWidget ) return; - - QwtPlot::Axis qwtAxis = QwtPlot::xBottom; + if ( !plotWidget() ) return; RimPlotAxisProperties* bottomAxisProperties = m_bottomAxisProperties(); if ( bottomAxisProperties->isActive() ) { - m_plotWidget->enableAxis( qwtAxis, true ); + plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); std::set timeHistoryQuantities; @@ -1241,11 +1240,11 @@ void RimSummaryPlot::updateBottomXAxis() {}, visibleAsciiDataCurvesForAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ), timeHistoryQuantities ); - calc.applyAxisPropertiesToPlot( m_plotWidget ); + calc.applyAxisPropertiesToPlot( plotWidget() ); } else { - m_plotWidget->enableAxis( qwtAxis, false ); + plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, false ); } } @@ -1306,7 +1305,7 @@ void RimSummaryPlot::zoomAll() { setAutoScaleXEnabled( true ); setAutoScaleYEnabled( true ); - updateZoomInQwt(); + updateZoomInParentPlot(); } //-------------------------------------------------------------------------------------------------- @@ -1318,9 +1317,9 @@ void RimSummaryPlot::addCurveAndUpdate( RimSummaryCurve* curve ) { m_summaryCurveCollection->addCurve( curve ); connectCurveSignals( curve ); - if ( m_plotWidget ) + if ( plotWidget() ) { - curve->setParentQwtPlotAndReplot( m_plotWidget ); + curve->setParentPlotAndReplot( plotWidget() ); this->updateAxes(); } } @@ -1335,9 +1334,9 @@ void RimSummaryPlot::addCurveNoUpdate( RimSummaryCurve* curve ) { m_summaryCurveCollection->addCurve( curve ); connectCurveSignals( curve ); - if ( m_plotWidget ) + if ( plotWidget() ) { - curve->setParentQwtPlotNoReplot( m_plotWidget ); + curve->setParentPlotNoReplot( plotWidget() ); } } } @@ -1351,9 +1350,9 @@ void RimSummaryPlot::insertCurve( RimSummaryCurve* curve, size_t insertAtPositio { m_summaryCurveCollection->insertCurve( curve, insertAtPosition ); connectCurveSignals( curve ); - if ( m_plotWidget ) + if ( plotWidget() ) { - curve->setParentQwtPlotNoReplot( m_plotWidget ); + curve->setParentPlotNoReplot( plotWidget() ); } } } @@ -1405,9 +1404,9 @@ void RimSummaryPlot::deleteCurves( const std::vector& curves ) if ( curveSet->curves().empty() ) { if ( curveSet->colorMode() == RimEnsembleCurveSet::ColorMode::BY_ENSEMBLE_PARAM && - m_plotWidget && curveSet->legendFrame() ) + plotWidget() && curveSet->legendFrame() ) { - m_plotWidget->removeOverlayFrame( curveSet->legendFrame() ); + plotWidget()->removeOverlayFrame( curveSet->legendFrame() ); } m_ensembleCurveSetCollection->deleteCurveSet( curveSet ); } @@ -1450,9 +1449,9 @@ void RimSummaryPlot::addGridTimeHistoryCurve( RimGridTimeHistoryCurve* curve ) CVF_ASSERT( curve ); m_gridTimeHistoryCurves.push_back( curve ); - if ( m_plotWidget ) + if ( plotWidget() ) { - curve->setParentQwtPlotAndReplot( m_plotWidget ); + curve->setParentPlotAndReplot( plotWidget() ); this->updateAxes(); } } @@ -1465,9 +1464,9 @@ void RimSummaryPlot::addGridTimeHistoryCurveNoUpdate( RimGridTimeHistoryCurve* c CVF_ASSERT( curve ); m_gridTimeHistoryCurves.push_back( curve ); - if ( m_plotWidget ) + if ( plotWidget() ) { - curve->setParentQwtPlotNoReplot( m_plotWidget ); + curve->setParentPlotNoReplot( plotWidget() ); } } @@ -1487,10 +1486,9 @@ void RimSummaryPlot::addAsciiDataCruve( RimAsciiDataCurve* curve ) CVF_ASSERT( curve ); m_asciiDataCurves.push_back( curve ); - if ( m_plotWidget ) + if ( plotWidget() ) { - curve->setParentQwtPlotAndReplot( m_plotWidget ); - this->updateAxes(); + curve->setParentPlotAndReplot( plotWidget() ); } } @@ -1549,10 +1547,10 @@ void RimSummaryPlot::updateStackedCurveData() updateStackedCurveDataForAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); updateStackedCurveDataForAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); - if ( m_plotWidget ) + if ( plotWidget() ) { reattachAllCurves(); - m_plotWidget->scheduleReplot(); + plotWidget()->scheduleReplot(); } } @@ -1622,9 +1620,9 @@ QImage RimSummaryPlot::snapshotWindowContent() { QImage image; - if ( m_plotWidget ) + if ( plotWidget() ) { - QPixmap pix = m_plotWidget->grab(); + QPixmap pix = plotWidget()->grab(); image = pix.toImage(); } @@ -1696,11 +1694,11 @@ void RimSummaryPlot::onLoadDataAndUpdate() curve->loadDataAndUpdate( false ); } - if ( m_plotWidget ) + if ( plotWidget() ) { - m_plotWidget->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() ); - m_plotWidget->setLegendFontSize( legendFontSize() ); - m_plotWidget->updateLegend(); + plotWidget()->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() ); + plotWidget()->setLegendFontSize( legendFontSize() ); + plotWidget()->updateLegend(); } this->updateAxes(); @@ -1712,49 +1710,49 @@ void RimSummaryPlot::onLoadDataAndUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::updateZoomInQwt() +void RimSummaryPlot::updateZoomInParentPlot() { - if ( m_plotWidget ) + if ( plotWidget() ) { updateZoomForAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); updateZoomForAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); updateZoomForAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); - m_plotWidget->updateAxes(); - updateZoomFromQwt(); - m_plotWidget->scheduleReplot(); + plotWidget()->updateAxes(); + updateZoomFromParentPlot(); + plotWidget()->scheduleReplot(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::updateZoomFromQwt() +void RimSummaryPlot::updateZoomFromParentPlot() { - if ( !m_plotWidget ) return; + if ( !plotWidget() ) return; - QwtInterval leftAxis = m_plotWidget->axisRange( QwtPlot::yLeft ); - QwtInterval rightAxis = m_plotWidget->axisRange( QwtPlot::yRight ); - QwtInterval timeAxis = m_plotWidget->axisRange( QwtPlot::xBottom ); + auto [leftAxisMin, leftAxisMax] = plotWidget()->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); + auto [rightAxisMin, rightAxisMax] = plotWidget()->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); + auto [timeAxisMin, timeAxisMax] = plotWidget()->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); - m_leftYAxisProperties->visibleRangeMax = leftAxis.maxValue(); - m_leftYAxisProperties->visibleRangeMin = leftAxis.minValue(); + m_leftYAxisProperties->visibleRangeMax = leftAxisMax; + m_leftYAxisProperties->visibleRangeMin = leftAxisMin; m_leftYAxisProperties->updateConnectedEditors(); - m_rightYAxisProperties->visibleRangeMax = rightAxis.maxValue(); - m_rightYAxisProperties->visibleRangeMin = rightAxis.minValue(); + m_rightYAxisProperties->visibleRangeMax = rightAxisMax; + m_rightYAxisProperties->visibleRangeMin = rightAxisMin; m_rightYAxisProperties->updateConnectedEditors(); if ( m_isCrossPlot ) { - m_bottomAxisProperties->visibleRangeMax = timeAxis.maxValue(); - m_bottomAxisProperties->visibleRangeMin = timeAxis.minValue(); + m_bottomAxisProperties->visibleRangeMax = timeAxisMax; + m_bottomAxisProperties->visibleRangeMin = timeAxisMin; m_bottomAxisProperties->updateConnectedEditors(); } else { - m_timeAxisProperties->setVisibleRangeMin( timeAxis.minValue() ); - m_timeAxisProperties->setVisibleRangeMax( timeAxis.maxValue() ); + m_timeAxisProperties->setVisibleRangeMin( timeAxisMin ); + m_timeAxisProperties->setVisibleRangeMax( timeAxisMax ); m_timeAxisProperties->updateConnectedEditors(); } } @@ -1772,13 +1770,19 @@ std::set RimSummaryPlot::allPlotAxes() const //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::cleanupBeforeClose() { - detachAllPlotItems(); - - if ( m_plotWidget ) + if ( isDeletable() ) { - m_plotWidget->setParent( nullptr ); - delete m_plotWidget; - m_plotWidget = nullptr; + detachAllPlotItems(); + + if ( plotWidget() ) + { + plotWidget()->setParent( nullptr ); + } + + if ( m_summaryPlot ) + { + m_summaryPlot.reset(); + } } } @@ -1827,9 +1831,9 @@ void RimSummaryPlot::curveVisibilityChanged( const caf::SignalEmitter* emitter, //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::curveAppearanceChanged( const caf::SignalEmitter* emitter ) { - if ( m_plotWidget ) + if ( plotWidget() ) { - m_plotWidget->scheduleReplot(); + plotWidget()->scheduleReplot(); } } @@ -1929,7 +1933,7 @@ void RimSummaryPlot::onPlotZoomed() { setAutoScaleXEnabled( false ); setAutoScaleYEnabled( false ); - updateZoomFromQwt(); + updateZoomFromParentPlot(); } //-------------------------------------------------------------------------------------------------- @@ -1944,7 +1948,9 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& caf::PdmUiGroup* mainOptions = uiOrdering.addNewGroup( "General Plot Options" ); mainOptions->setCollapsedByDefault( true ); - +#ifdef USE_QTCHARTS + mainOptions->add( &m_useQtChartsPlot ); +#endif if ( isMdiWindow() ) { mainOptions->add( &m_showPlotTitle ); @@ -1976,38 +1982,49 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent ) +RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent ) { - if ( !m_plotWidget ) + if ( !plotWidget() ) { - m_plotWidget = new RiuSummaryQwtPlot( this, mainWindowParent ); +#ifdef USE_QTCHARTS + if ( m_useQtChartsPlot ) + { + m_summaryPlot = std::make_unique( this, mainWindowParent ); + } + else + { + m_summaryPlot = std::make_unique( this, mainWindowParent ); + } +#else + m_summaryPlot = std::make_unique( this, mainWindowParent ); +#endif for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves ) { - curve->setParentQwtPlotNoReplot( m_plotWidget ); + curve->setParentPlotNoReplot( plotWidget() ); } for ( RimAsciiDataCurve* curve : m_asciiDataCurves ) { - curve->setParentQwtPlotNoReplot( m_plotWidget ); + curve->setParentPlotNoReplot( plotWidget() ); } if ( m_summaryCurveCollection ) { - m_summaryCurveCollection->setParentQwtPlotAndReplot( m_plotWidget ); + m_summaryCurveCollection->setParentPlotAndReplot( plotWidget() ); } if ( m_ensembleCurveSetCollection ) { - m_ensembleCurveSetCollection->setParentQwtPlotAndReplot( m_plotWidget ); + m_ensembleCurveSetCollection->setParentPlotAndReplot( plotWidget() ); } - this->connect( m_plotWidget, SIGNAL( plotZoomed() ), SLOT( onPlotZoomed() ) ); + this->connect( plotWidget(), SIGNAL( plotZoomed() ), SLOT( onPlotZoomed() ) ); updatePlotTitle(); } - return m_plotWidget; + return plotWidget(); } //-------------------------------------------------------------------------------------------------- @@ -2102,19 +2119,22 @@ void RimSummaryPlot::detachAllPlotItems() { if ( m_summaryCurveCollection ) { - m_summaryCurveCollection->detachQwtCurves(); + m_summaryCurveCollection->detachPlotCurves(); } - m_ensembleCurveSetCollection->detachQwtCurves(); + if ( m_ensembleCurveSetCollection ) + { + m_ensembleCurveSetCollection->detachPlotCurves(); + } for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves ) { - curve->detachQwtCurve(); + curve->detach(); } for ( RimAsciiDataCurve* curve : m_asciiDataCurves ) { - curve->detachQwtCurve(); + curve->detach(); } m_plotInfoLabel->detach(); @@ -2154,19 +2174,19 @@ void RimSummaryPlot::reattachAllCurves() { if ( m_summaryCurveCollection ) { - m_summaryCurveCollection->reattachQwtCurves(); + m_summaryCurveCollection->reattachPlotCurves(); } - m_ensembleCurveSetCollection->reattachQwtCurves(); + m_ensembleCurveSetCollection->reattachPlotCurves(); for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves ) { - curve->reattachQwtCurve(); + curve->reattach(); } for ( RimAsciiDataCurve* curve : m_asciiDataCurves ) { - curve->reattachQwtCurve(); + curve->reattach(); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index f4817f8156..9cbee46ffc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -18,7 +18,7 @@ #pragma once -#include "RiaDefines.h" +#include "RiaPlotDefines.h" #include "RiaQDateTimeTools.h" #include "RifEclipseSummaryAddress.h" @@ -26,7 +26,8 @@ #include "RimPlot.h" #include "RimSummaryDataSourceStepping.h" -#include "qwt_plot_textlabel.h" +#include "RiuQwtPlotWidget.h" +#include "RiuSummaryPlot.h" #include "cafPdmChildArrayField.h" #include "cafPdmPtrArrayField.h" @@ -59,6 +60,7 @@ class RiaSummaryCurveDefinition; class QwtInterval; class QwtPlotCurve; +class QwtPlotTextLabel; class QKeyEvent; @@ -120,8 +122,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping RimSummaryTimeAxisProperties* timeAxisProperties(); time_t firstTimeStepOfFirstCurve(); - QWidget* viewWidget() override; - RiuQwtPlotWidget* viewer() override; + QWidget* viewWidget() override; QString asciiDataForPlotExport() const override; QString asciiDataForSummaryPlotExport( RiaQDateTimeTools::DateTimePeriod resamplingPeriod, @@ -160,14 +161,14 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping virtual RimSummaryPlotSourceStepping* sourceSteppingObjectForKeyEventHandling() const; virtual std::vector fieldsToShowInToolbar(); - void setAutoScaleXEnabled( bool enabled ) override; - void setAutoScaleYEnabled( bool enabled ) override; + void setAutoScaleXEnabled( bool enabled ) override; + void setAutoScaleYEnabled( bool enabled ) override; + RiuPlotWidget* plotWidget() override; + void zoomAll() override; + void updateZoomInParentPlot() override; + void updateZoomFromParentPlot() override; - void zoomAll() override; - void updateZoomInQwt() override; - void updateZoomFromQwt() override; - - caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override; + caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; void onAxisSelected( int axis, bool toggle ) override; @@ -192,7 +193,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping bool isDeletable() const override; private: - RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; + RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; void updateNameHelperWithCurveData( RimSummaryPlotNameHelper* nameHelper ) const; @@ -256,6 +257,9 @@ private slots: void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic ); private: +#ifdef USE_QTCHARTS + caf::PdmField m_useQtChartsPlot; +#endif caf::PdmField m_normalizeCurveYValues; caf::PdmField m_useAutoPlotTitle; @@ -275,7 +279,7 @@ private slots: caf::PdmChildField m_textCurveSetEditor; - QPointer m_plotWidget; + std::unique_ptr m_summaryPlot; std::unique_ptr m_plotInfoLabel; bool m_isCrossPlot; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index 216a55144e..687a7c9f7a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -19,6 +19,7 @@ #include "RimSummaryPlotAxisFormatter.h" #include "RiaDefines.h" +#include "RiaNumberFormat.h" #include "RiaSummaryCurveDefinition.h" #include "RifSummaryReaderInterface.h" @@ -29,13 +30,15 @@ #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" +#include "RiuQtChartsPlotWidget.h" +#include "RiuQwtPlotTools.h" #include "RiuSummaryQuantityNameInfoProvider.h" #include "RiuSummaryQwtPlot.h" #include "qwt_date_scale_engine.h" +#include "qwt_plot.h" #include "qwt_plot_curve.h" #include "qwt_scale_draw.h" -#include "qwt_scale_engine.h" #include #include @@ -111,10 +114,11 @@ RimSummaryPlotAxisFormatter::RimSummaryPlotAxisFormatter( RimPlotAxisProperties* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuQwtPlotWidget* qwtPlot ) +void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plotWidget ) { - if ( !qwtPlot ) return; + if ( !plotWidget ) return; + RiaDefines::PlotAxis axis = m_axisProperties->plotAxisType(); { QString axisTitle = m_axisProperties->customTitle; if ( m_axisProperties->useAutoTitle() ) axisTitle = autoAxisTitle(); @@ -124,51 +128,72 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuQwtPlotWidget* q { titleAlignment = Qt::AlignRight; } - qwtPlot->setAxisTitleText( m_axisProperties->qwtPlotAxisType(), axisTitle ); - qwtPlot->setAxisFontsAndAlignment( m_axisProperties->qwtPlotAxisType(), - m_axisProperties->titleFontSize(), - m_axisProperties->valuesFontSize(), - true, - titleAlignment ); - qwtPlot->setAxisTitleEnabled( m_axisProperties->qwtPlotAxisType(), true ); + plotWidget->setAxisTitleText( axis, axisTitle ); + plotWidget->setAxisFontsAndAlignment( axis, + m_axisProperties->titleFontSize(), + m_axisProperties->valuesFontSize(), + true, + titleAlignment ); + plotWidget->setAxisTitleEnabled( axis, true ); } + auto qwtPlotWidget = dynamic_cast( plotWidget ); + if ( qwtPlotWidget ) { + QwtPlot::Axis qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis ); + if ( m_axisProperties->numberFormat == RimPlotAxisProperties::NUMBER_FORMAT_AUTO && m_axisProperties->scaleFactor() == 1.0 ) { // Default to Qwt's own scale draw to avoid changing too much for default values - qwtPlot->setAxisScaleDraw( m_axisProperties->qwtPlotAxisType(), new QwtScaleDraw ); + qwtPlotWidget->qwtPlot()->setAxisScaleDraw( qwtAxisId, new QwtScaleDraw ); } else { - qwtPlot->setAxisScaleDraw( m_axisProperties->qwtPlotAxisType(), - new SummaryScaleDraw( m_axisProperties->scaleFactor(), - m_axisProperties->numberOfDecimals(), - m_axisProperties->numberFormat() ) ); + qwtPlotWidget->qwtPlot()->setAxisScaleDraw( qwtAxisId, + new SummaryScaleDraw( m_axisProperties->scaleFactor(), + m_axisProperties->numberOfDecimals(), + m_axisProperties->numberFormat() ) ); } } +#ifdef USE_QTCHARTS + auto qtChartsPlotWidget = dynamic_cast( plotWidget ); + if ( qtChartsPlotWidget ) + { + auto mapToRiaNumberFormatType = []( RimPlotAxisProperties::NumberFormatType formatType ) { + if ( formatType == RimPlotAxisProperties::NumberFormatType::NUMBER_FORMAT_DECIMAL ) + return RiaNumberFormat::NumberFormatType::FIXED; + + if ( formatType == RimPlotAxisProperties::NumberFormatType::NUMBER_FORMAT_SCIENTIFIC ) + return RiaNumberFormat::NumberFormatType::SCIENTIFIC; + + return RiaNumberFormat::NumberFormatType::AUTO; + }; + + auto formatType = mapToRiaNumberFormatType( m_axisProperties->numberFormat() ); + QString format = RiaNumberFormat::sprintfFormat( formatType, m_axisProperties->numberOfDecimals() ); + qtChartsPlotWidget->setAxisFormat( axis, format ); + } +#endif + { if ( m_axisProperties->isLogarithmicScaleEnabled ) { - QwtLogScaleEngine* currentScaleEngine = - dynamic_cast( qwtPlot->axisScaleEngine( m_axisProperties->qwtPlotAxisType() ) ); - if ( !currentScaleEngine ) + bool isLogScale = plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC; + if ( !isLogScale ) { - qwtPlot->setAxisScaleEngine( m_axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine ); - qwtPlot->setAxisMaxMinor( m_axisProperties->qwtPlotAxisType(), 5 ); + plotWidget->setAxisScaleType( axis, RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC ); + plotWidget->setAxisMaxMinor( axis, 5 ); } } else { - QwtLinearScaleEngine* currentScaleEngine = - dynamic_cast( qwtPlot->axisScaleEngine( m_axisProperties->qwtPlotAxisType() ) ); - QwtDateScaleEngine* dateScaleEngine = dynamic_cast( currentScaleEngine ); - if ( !currentScaleEngine || dateScaleEngine ) + bool isLinearScale = plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LINEAR; + if ( !isLinearScale ) { - qwtPlot->setAxisScaleEngine( m_axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine ); - qwtPlot->setAxisMaxMinor( m_axisProperties->qwtPlotAxisType(), 3 ); + plotWidget->setAxisScaleType( axis, RiuQwtPlotWidget::AxisScaleType::LINEAR ); + plotWidget->setAxisMaxMinor( axis, 3 ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.h index be45af8018..8e91d61e39 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.h @@ -22,16 +22,12 @@ #include #include -#include - class RimAsciiDataCurve; class RimSummaryCurve; class RimPlotAxisProperties; class RiaSummaryCurveDefinition; -class RiuQwtPlotWidget; - -class QwtPlotCurve; +class RiuPlotWidget; class RimSummaryPlotAxisFormatter { @@ -42,7 +38,7 @@ class RimSummaryPlotAxisFormatter const std::vector& asciiCurves, const std::set& timeHistoryCurveQuantities ); - void applyAxisPropertiesToPlot( RiuQwtPlotWidget* qwtPlot ); + void applyAxisPropertiesToPlot( RiuPlotWidget* qwtPlot ); private: QString autoAxisTitle() const; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp index 0294c43083..5a0a6cb269 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp @@ -61,6 +61,7 @@ #include "cvfObject.h" +#include "qwt_plot.h" #include "qwt_plot_curve.h" #include "qwt_symbol.h" @@ -70,7 +71,7 @@ //-------------------------------------------------------------------------------------------------- /// Internal functions //-------------------------------------------------------------------------------------------------- -int statisticsCurveSymbolSize( RiuQwtSymbol::PointSymbolEnum symbol ); +int statisticsCurveSymbolSize( RiuPlotCurveSymbol::PointSymbolEnum symbol ); namespace caf { @@ -135,7 +136,7 @@ RimEnsembleWellLogCurveSet::RimEnsembleWellLogCurveSet() m_curveAppearance->setColorVisible( false ); m_curveAppearance->setFillOptionsVisible( false ); - m_curveAppearance->setSymbol( RiuQwtSymbol::PointSymbolEnum::SYMBOL_ELLIPSE ); + m_curveAppearance->setSymbol( RiuPlotCurveSymbol::PointSymbolEnum::SYMBOL_ELLIPSE ); m_curveAppearance->setSymbolSize( 5 ); m_curveAppearance->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); m_curveAppearance->setSymbolEdgeColor( cvf::Color3f::BLACK ); @@ -218,22 +219,22 @@ void RimEnsembleWellLogCurveSet::loadDataAndUpdate( bool updateParentPlot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleWellLogCurveSet::setParentQwtPlotNoReplot( QwtPlot* plot ) +void RimEnsembleWellLogCurveSet::setParentPlotNoReplot( RiuPlotWidget* plot ) { for ( RimWellLogCurve* curve : m_curves ) { - curve->setParentQwtPlotNoReplot( plot ); + curve->setParentPlotNoReplot( plot ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleWellLogCurveSet::detachQwtCurves() +void RimEnsembleWellLogCurveSet::detachPlotCurves() { for ( RimWellLogCurve* curve : m_curves ) { - curve->detachQwtCurve(); + curve->detach(); } m_qwtPlotCurveForLegendText->detach(); @@ -242,11 +243,11 @@ void RimEnsembleWellLogCurveSet::detachQwtCurves() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleWellLogCurveSet::reattachQwtCurves() +void RimEnsembleWellLogCurveSet::reattachPlotCurves() { for ( RimWellLogCurve* curve : m_curves ) { - curve->reattachQwtCurve(); + curve->reattach(); } m_qwtPlotCurveForLegendText->detach(); @@ -255,7 +256,7 @@ void RimEnsembleWellLogCurveSet::reattachQwtCurves() firstAncestorOrThisOfType( plot ); if ( plot ) { - m_qwtPlotCurveForLegendText->attach( plot->viewer() ); + m_qwtPlotCurveForLegendText->attach( plot->viewer()->qwtPlot() ); } } @@ -637,8 +638,8 @@ void RimEnsembleWellLogCurveSet::updateFilterLegend() { if ( !m_filterOverlayFrame ) { - m_filterOverlayFrame = - new RiuDraggableOverlayFrame( plotTrack->viewer()->canvas(), plotTrack->viewer()->overlayMargins() ); + m_filterOverlayFrame = new RiuDraggableOverlayFrame( plotTrack->viewer()->qwtPlot()->canvas(), + plotTrack->viewer()->overlayMargins() ); } m_filterOverlayFrame->setContentFrame( m_ensembleCurveSet->curveFilters()->makeFilterDescriptionFrame() ); plotTrack->viewer()->addOverlayFrame( m_filterOverlayFrame ); @@ -735,8 +736,8 @@ void RimEnsembleWellLogCurveSet::updateCurveColors() { if ( !m_legendOverlayFrame ) { - m_legendOverlayFrame = - new RiuDraggableOverlayFrame( plotTrack->viewer()->canvas(), plotTrack->viewer()->overlayMargins() ); + m_legendOverlayFrame = new RiuDraggableOverlayFrame( plotTrack->viewer()->getParentForOverlay(), + plotTrack->viewer()->overlayMargins() ); } m_legendOverlayFrame->setContentFrame( m_ensembleCurveSet->legendConfig()->makeLegendFrame() ); plotTrack->viewer()->addOverlayFrame( m_legendOverlayFrame ); @@ -780,7 +781,7 @@ void RimEnsembleWellLogCurveSet::updateEnsembleCurves( const std::vectorattach( plotTrack->viewer() ); + m_qwtPlotCurveForLegendText->attach( plotTrack->viewer()->qwtPlot() ); QString wellLogChannelName = m_wellLogChannelName(); if ( plotTrack && wellLogChannelName != "None" ) @@ -920,11 +921,13 @@ void RimEnsembleWellLogCurveSet::updateStatisticsCurves( const std::vector curves() const; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp index ae818382c0..a4a7909752 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp @@ -20,6 +20,7 @@ #include "RimWellLogCurve.h" #include "RiaCurveDataTools.h" +#include "RiaPlotDefines.h" #include "RigWellLogCurveData.h" #include "RimDepthTrackPlot.h" @@ -46,10 +47,6 @@ RimWellLogCurve::RimWellLogCurve() { CAF_PDM_InitObject( "WellLogCurve", ":/WellLogCurve16x16.png" ); - m_qwtPlotCurve->setXAxis( QwtPlot::xTop ); - m_qwtCurveErrorBars->setXAxis( QwtPlot::xTop ); - m_qwtPlotCurve->setYAxis( QwtPlot::yLeft ); - m_curveData = new RigWellLogCurveData; m_curveDataXRange = std::make_pair( std::numeric_limits::infinity(), -std::numeric_limits::infinity() ); @@ -179,11 +176,22 @@ const RigWellLogCurveData* RimWellLogCurve::curveData() const void RimWellLogCurve::updateCurveAppearance() { RimPlotCurve::updateCurveAppearance(); + + if ( m_plotCurve ) + { + m_plotCurve->setXAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP ); + m_plotCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); + } + if ( fillStyle() != Qt::BrushStyle::NoBrush ) { - m_qwtPlotCurve->setOrientation( Qt::Horizontal ); - m_qwtPlotCurve->setBaseline( -std::numeric_limits::infinity() ); - m_qwtPlotCurve->setCurveAttribute( QwtPlotCurve::Inverted, true ); + RiuQwtPlotCurve* qwtPlotCurve = dynamic_cast( m_plotCurve ); + if ( qwtPlotCurve ) + { + qwtPlotCurve->setOrientation( Qt::Horizontal ); + qwtPlotCurve->setBaseline( -std::numeric_limits::infinity() ); + qwtPlotCurve->setCurveAttribute( QwtPlotCurve::Inverted, true ); + } } } @@ -212,10 +220,10 @@ void RimWellLogCurve::setOverrideCurveData( const std::vector& { auto minmax_it = std::minmax_element( xValues.begin(), xValues.end() ); this->setOverrideCurveDataXRange( *( minmax_it.first ), *( minmax_it.second ) ); - if ( m_qwtPlotCurve ) + if ( m_plotCurve ) { - m_qwtPlotCurve->setSamples( xValues.data(), depthValues.data(), static_cast( depthValues.size() ) ); - m_qwtPlotCurve->setLineSegmentStartStopIndices( curveIntervals ); + m_plotCurve->setSamplesValues( xValues, depthValues ); + m_plotCurve->setLineSegmentStartStopIndices( curveIntervals ); } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 40656d7d60..934a4d3224 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -340,7 +340,7 @@ void RimWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* cha //-------------------------------------------------------------------------------------------------- void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot ) { - if ( isCurveVisible() ) + if ( isCurveVisible() && m_plotCurve ) { bool isUsingPseudoLength = false; performDataExtraction( &isUsingPseudoLength ); @@ -360,9 +360,9 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot ) std::vector xPlotValues = curveData()->xPlotValues(); std::vector depthPlotValues = curveData()->depthPlotValues( depthType, displayUnit ); CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() ); - m_qwtPlotCurve->setSamples( xPlotValues.data(), depthPlotValues.data(), static_cast( xPlotValues.size() ) ); + m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, static_cast( xPlotValues.size() ) ); - m_qwtPlotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() ); + m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() ); this->RimPlotCurve::updateCurvePresentation( updateParentPlot ); @@ -375,7 +375,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot ) RiuQwtPlotWidget* viewer = wellLogTrack->viewer(); if ( viewer ) { - viewer->setAxisTitleText( QwtPlot::yLeft, "PL/" + wellLogPlot->depthAxisTitle() ); + viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "PL/" + wellLogPlot->depthAxisTitle() ); } } @@ -386,9 +386,9 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot ) setLogScaleFromSelectedResult(); - if ( m_parentQwtPlot ) + if ( m_parentPlot ) { - m_parentQwtPlot->replot(); + m_parentPlot->replot(); } } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp index 482fbc6948..751eba2695 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp @@ -172,7 +172,7 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot ) if ( m_isUsingAutoName ) { - m_qwtPlotCurve->setTitle( createCurveAutoName() ); + m_plotCurve->setTitle( createCurveAutoName() ); } } @@ -188,19 +188,18 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot ) depthType = wellLogPlot->depthType(); } - m_qwtPlotCurve->setSamples( this->curveData()->xPlotValues().data(), - this->curveData()->depthPlotValues( depthType, displayUnit ).data(), - static_cast( this->curveData()->xPlotValues().size() ) ); - m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); + m_plotCurve->setSamplesValues( this->curveData()->xPlotValues(), + this->curveData()->depthPlotValues( depthType, displayUnit ) ); + m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); if ( updateParentPlot ) { updateZoomInParentPlot(); } - if ( m_parentQwtPlot ) + if ( m_parentPlot ) { - m_parentQwtPlot->replot(); + m_parentPlot->replot(); } } } @@ -315,7 +314,7 @@ void RimWellLogFileCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFi { this->loadDataAndUpdate( true ); } - if ( m_parentQwtPlot ) m_parentQwtPlot->replot(); + if ( m_parentPlot ) m_parentPlot->replot(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index c41c0f0cf4..1635602f4d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -396,7 +396,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) if ( values.empty() || values.size() != tvDepthVector.size() ) { - this->detachQwtCurve(); + this->detach(); return; } @@ -466,7 +466,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) if ( wellLogPlot->depthType() == RiaDefines::DepthTypeEnum::MEASURED_DEPTH ) { - m_qwtPlotCurve->setPerPointLabels( perPointLabels ); + m_plotCurve->setPerPointLabels( perPointLabels ); auto xValues = this->curveData()->xPlotValues(); auto yValues = this->curveData()->depthPlotValues( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit ); @@ -482,7 +482,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) } else { - m_qwtPlotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, keepOnlyPositiveValues ); + m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, keepOnlyPositiveValues ); } RimWellLogTrack* wellLogTrack; @@ -496,22 +496,24 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) { if ( derivedMDSource == WELL_PATH ) { - viewer->setAxisTitleText( QwtPlot::yLeft, "WELL/" + wellLogPlot->depthAxisTitle() ); + viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + "WELL/" + wellLogPlot->depthAxisTitle() ); } else { - viewer->setAxisTitleText( QwtPlot::yLeft, "OBS/" + wellLogPlot->depthAxisTitle() ); + viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + "OBS/" + wellLogPlot->depthAxisTitle() ); } } else // Standard depth title set from plot { - viewer->setAxisTitleText( QwtPlot::yLeft, wellLogPlot->depthAxisTitle() ); + viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, wellLogPlot->depthAxisTitle() ); } } } else { - m_qwtPlotCurve->setPerPointLabels( perPointLabels ); + m_plotCurve->setPerPointLabels( perPointLabels ); auto xValues = this->curveData()->xPlotValues(); auto yValues = @@ -528,20 +530,20 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) } else { - m_qwtPlotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, isLogCurve ); } } - m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); + m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); if ( updateParentPlot ) { updateZoomInParentPlot(); } - if ( m_parentQwtPlot ) + if ( m_parentPlot ) { - m_parentQwtPlot->replot(); + m_parentPlot->replot(); } } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 89747ea6ac..fc87841764 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -344,7 +344,7 @@ void RimWellLogTrack::detachAllPlotItems() { for ( RimPlotCurve* curve : m_curves ) { - curve->detachQwtCurve(); + curve->detach(); } for ( auto& plotObjects : m_wellPathAttributePlotObjects ) { @@ -493,7 +493,7 @@ void RimWellLogTrack::updateXZoom() componentRangeMax *= 1.5; } - m_plotWidget->setAxisRange( QwtPlot::xBottom, componentRangeMin, componentRangeMax ); + m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, componentRangeMin, componentRangeMax ); } //-------------------------------------------------------------------------------------------------- @@ -503,7 +503,7 @@ void RimWellLogTrack::updateYZoom() { if ( !m_plotWidget ) return; - m_plotWidget->setAxisRange( QwtPlot::yLeft, m_visibleDepthRangeMin(), m_visibleDepthRangeMax() ); + m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, m_visibleDepthRangeMin(), m_visibleDepthRangeMax() ); } //-------------------------------------------------------------------------------------------------- @@ -540,8 +540,8 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { if ( m_plotWidget ) { - m_majorTickInterval = m_plotWidget->majorTickInterval( QwtPlot::xTop ); - m_minorTickInterval = m_plotWidget->minorTickInterval( QwtPlot::xTop ); + m_majorTickInterval = m_plotWidget->majorTickInterval( RiaDefines::PlotAxis::PLOT_AXIS_TOP ); + m_minorTickInterval = m_plotWidget->minorTickInterval( RiaDefines::PlotAxis::PLOT_AXIS_TOP ); } m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); @@ -762,13 +762,13 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() bool emptyRange = isEmptyVisibleXRange(); if ( emptyRange ) { - m_plotWidget->enableGridLines( QwtPlot::xTop, false, false ); - m_plotWidget->setAxisRange( QwtPlot::xTop, 0.0, 1.0 ); - m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::xTop, false, false ); + m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false, false ); + m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP, 0.0, 1.0 ); + m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false, false ); } else { - m_plotWidget->setAxisLabelsAndTicksEnabled( QwtPlot::xTop, true, true ); + m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_TOP, true, true ); if ( m_minAndMaxTicksOnly ) { auto roundToDigits = []( double value, int numberOfDigits, bool useFloor ) { @@ -803,11 +803,11 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() div.setTicks( QwtScaleDiv::TickType::MajorTick, majorTicks ); - m_plotWidget->setAxisScaleDiv( QwtPlot::xTop, div ); + m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtPlot::xTop, div ); } else if ( m_explicitTickIntervals ) { - m_plotWidget->setMajorAndMinorTickIntervals( QwtPlot::xTop, + m_plotWidget->setMajorAndMinorTickIntervals( RiaDefines::PlotAxis::PLOT_AXIS_TOP, m_majorTickInterval(), m_minorTickInterval(), m_visibleXRangeMin(), @@ -817,11 +817,13 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() { int majorTickIntervals = 5; int minorTickIntervals = 10; - m_plotWidget->setAutoTickIntervalCounts( QwtPlot::xTop, majorTickIntervals, minorTickIntervals ); - m_plotWidget->setAxisRange( QwtPlot::xTop, m_visibleXRangeMin, m_visibleXRangeMax ); + m_plotWidget->setAutoTickIntervalCounts( RiaDefines::PlotAxis::PLOT_AXIS_TOP, + majorTickIntervals, + minorTickIntervals ); + m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP, m_visibleXRangeMin, m_visibleXRangeMax ); } - m_plotWidget->enableGridLines( QwtPlot::xTop, + m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_TOP, m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR, m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR ); } @@ -830,7 +832,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() this->firstAncestorOrThisOfType( wellLogPlot ); if ( wellLogPlot ) { - m_plotWidget->enableGridLines( QwtPlot::yLeft, + m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MAJOR, wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MINOR ); } @@ -1004,15 +1006,15 @@ QString RimWellLogTrack::asciiDataForPlotExport() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::updateZoomFromQwt() +void RimWellLogTrack::updateZoomFromParentPlot() { - QwtInterval xInterval = m_plotWidget->axisRange( QwtPlot::xTop ); - QwtInterval depthInterval = m_plotWidget->axisRange( QwtPlot::yLeft ); + auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP ); + auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); - m_visibleXRangeMin = xInterval.minValue(); - m_visibleXRangeMax = xInterval.maxValue(); - m_visibleDepthRangeMin = depthInterval.minValue(); - m_visibleDepthRangeMax = depthInterval.maxValue(); + m_visibleXRangeMin = xIntervalMin; + m_visibleXRangeMax = xIntervalMax; + m_visibleDepthRangeMin = depthIntervalMin; + m_visibleDepthRangeMax = depthIntervalMax; } //-------------------------------------------------------------------------------------------------- @@ -1120,7 +1122,7 @@ void RimWellLogTrack::addCurve( RimWellLogCurve* curve ) if ( m_plotWidget ) { - curve->setParentQwtPlotAndReplot( m_plotWidget ); + curve->setParentPlotAndReplot( m_plotWidget ); } } @@ -1141,7 +1143,7 @@ void RimWellLogTrack::insertCurve( RimWellLogCurve* curve, size_t index ) if ( m_plotWidget ) { - curve->setParentQwtPlotAndReplot( m_plotWidget ); + curve->setParentPlotAndReplot( m_plotWidget ); } } } @@ -1154,7 +1156,7 @@ void RimWellLogTrack::removeCurve( RimWellLogCurve* curve ) size_t index = m_curves.index( curve ); if ( index < m_curves.size() ) { - m_curves[index]->detachQwtCurve(); + m_curves[index]->detach(); m_curves.removeChildObject( curve ); } } @@ -1226,8 +1228,8 @@ void RimWellLogTrack::onLoadDataAndUpdate() if ( wellLogPlot && m_plotWidget ) { - m_plotWidget->setAxisTitleText( QwtPlot::xTop, m_xAxisTitle ); - m_plotWidget->setAxisTitleText( QwtPlot::yLeft, wellLogPlot->depthAxisTitle() ); + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_TOP, m_xAxisTitle ); + m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, wellLogPlot->depthAxisTitle() ); } for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx ) @@ -1500,17 +1502,17 @@ RimWellLogTrack::TrajectoryType RimWellLogTrack::formationTrajectoryType() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget* RimWellLogTrack::doCreatePlotViewWidget( QWidget* mainWindowParent ) +RiuPlotWidget* RimWellLogTrack::doCreatePlotViewWidget( QWidget* mainWindowParent ) { if ( m_plotWidget == nullptr ) { m_plotWidget = new RiuWellLogTrack( this, mainWindowParent ); - m_plotWidget->setAxisInverted( QwtPlot::yLeft ); + m_plotWidget->setAxisInverted( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); updateAxisScaleEngine(); for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx ) { - m_curves[cIdx]->setParentQwtPlotNoReplot( this->m_plotWidget ); + m_curves[cIdx]->setParentPlotNoReplot( m_plotWidget ); } } return m_plotWidget; @@ -1539,8 +1541,9 @@ void RimWellLogTrack::reattachAllCurves() { for ( RimPlotCurve* curve : m_curves ) { - curve->reattachQwtCurve(); + curve->reattach(); } + for ( auto& plotObjects : m_wellPathAttributePlotObjects ) { plotObjects->reattachToQwt(); @@ -1597,7 +1600,7 @@ void RimWellLogTrack::setVisibleYRange( double minValue, double maxValue ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::updateZoomInQwt() +void RimWellLogTrack::updateZoomInParentPlot() { updateXZoom(); updateYZoom(); @@ -1767,6 +1770,14 @@ RiuQwtPlotWidget* RimWellLogTrack::viewer() return m_plotWidget; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotWidget* RimWellLogTrack::plotWidget() +{ + return m_plotWidget; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1790,17 +1801,17 @@ void RimWellLogTrack::zoomAll() { setAutoScaleXEnabled( true ); setAutoScaleYEnabled( true ); - updateZoomInQwt(); + updateZoomInParentPlot(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmObject* RimWellLogTrack::findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const +caf::PdmObject* RimWellLogTrack::findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const { for ( size_t idx = 0; idx < m_curves.size(); idx++ ) { - if ( m_curves[idx]->qwtPlotCurve() == curve ) + if ( m_curves[idx]->isSameCurve( curve ) ) { return m_curves[idx]; } @@ -1965,17 +1976,17 @@ void RimWellLogTrack::updateAxisScaleEngine() if ( m_isLogarithmicScaleEnabled ) { - m_plotWidget->setAxisScaleEngine( QwtPlot::xTop, new QwtLogScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new QwtLogScaleEngine ); // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work - m_plotWidget->setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine ); } else { - m_plotWidget->setAxisScaleEngine( QwtPlot::xTop, new RiuQwtLinearScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new RiuQwtLinearScaleEngine ); // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work - m_plotWidget->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine ); } } @@ -2030,7 +2041,7 @@ void RimWellLogTrack::handleWheelEvent( QWheelEvent* event ) { if ( event->modifiers() & Qt::ControlModifier ) { - QwtScaleMap scaleMap = m_plotWidget->canvasMap( QwtPlot::yLeft ); + QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtPlot::yLeft ); double zoomCenter = scaleMap.invTransform( event->pos().y() ); if ( event->delta() > 0 ) @@ -2606,7 +2617,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot() std::vector convertedYValues = RiaWellLogUnitTools::convertDepths( yValues, fromDepthUnit, toDepthUnit ); - m_annotationTool->attachWellPicks( m_plotWidget, formationNamesToPlot, convertedYValues ); + m_annotationTool->attachWellPicks( m_plotWidget->qwtPlot(), formationNamesToPlot, convertedYValues ); } else { @@ -2674,7 +2685,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot() const std::vector> convertedYValues = RiaWellLogUnitTools::convertDepths( waterAndRockIntervals, fromDepthUnit, toDepthUnit ); - m_annotationTool->attachNamedRegions( m_plotWidget, + m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(), { "Sea Level", "" }, xRange, convertedYValues, @@ -2686,7 +2697,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot() { Qt::SolidPattern, Qt::Dense6Pattern } ); } - if ( m_formationSource == CASE ) + if ( m_formationSource == CASE && m_plotWidget ) { if ( ( m_formationSimWellName == QString( "None" ) && m_formationWellPathForSourceCase == nullptr ) || m_formationCase == nullptr ) @@ -2719,7 +2730,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot() RiaWellLogUnitTools::convertDepths( yValues, fromDepthUnit, toDepthUnit ); caf::ColorTable colorTable( m_colorShadingLegend->colorArray() ); - m_annotationTool->attachNamedRegions( m_plotWidget, + m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(), formationNamesToPlot, xRange, convertedYValues, @@ -2847,7 +2858,7 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot() int fontSize = caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), m_regionLabelFontSize() ); - m_annotationTool->attachNamedRegions( m_plotWidget, + m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(), namesToPlot, xRange, convertedYValues, @@ -2924,7 +2935,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot() std::vector> convertedYValues = RiaWellLogUnitTools::convertDepths( yValues, fromDepthUnit, toDepthUnit ); - m_annotationTool->attachNamedRegions( m_plotWidget, + m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(), sourceNamesToPlot, xRange, convertedYValues, @@ -2955,7 +2966,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot() std::vector> convertedYValues = RiaWellLogUnitTools::convertDepths( yValues, fromDepthUnit, toDepthUnit ); - m_annotationTool->attachNamedRegions( m_plotWidget, + m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(), sourceNamesToPlot, xRange, convertedYValues, @@ -2985,7 +2996,7 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot() std::vector> convertedYValues = RiaWellLogUnitTools::convertDepths( yValues, fromDepthUnit, toDepthUnit ); - m_annotationTool->attachNamedRegions( m_plotWidget, + m_annotationTool->attachNamedRegions( m_plotWidget->qwtPlot(), sourceNamesToPlot, xRange, convertedYValues, @@ -3084,7 +3095,7 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot() attributePlotObject->setDepthType( depthType ); attributePlotObject->setShowLabel( m_showWellPathComponentLabels() ); attributePlotObject->loadDataAndUpdate( false ); - attributePlotObject->setParentQwtPlotNoReplot( m_plotWidget ); + attributePlotObject->setParentPlotNoReplot( m_plotWidget->qwtPlot() ); } } updateXZoom(); @@ -3117,7 +3128,7 @@ void RimWellLogTrack::onChildDeleted( caf::PdmChildArrayFieldHandle* childA std::vector& referringObjects ) { setAutoScaleXEnabled( true ); - updateZoomInQwt(); + updateZoomInParentPlot(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); mainPlotWindow->updateWellLogPlotToolBar(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index 259de526f9..c6172b81d4 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -31,8 +31,6 @@ #include "cafPdmObject.h" #include "cafPdmPtrField.h" -#include "qwt_plot.h" - #include #include @@ -58,8 +56,6 @@ class RimEclipseResultDefinition; class RimColorLegend; class RimEnsembleWellLogCurveSet; -class QwtPlotCurve; - struct CurveSamplingPointData { std::vector data; @@ -97,7 +93,8 @@ class RimWellLogTrack : public RimPlot ~RimWellLogTrack() override; QWidget* viewWidget() override; - RiuQwtPlotWidget* viewer() override; + RiuQwtPlotWidget* viewer(); + RiuPlotWidget* plotWidget() override; QImage snapshotWindowContent() override; void zoomAll() override; @@ -153,8 +150,8 @@ class RimWellLogTrack : public RimPlot void setVisibleXRange( double minValue, double maxValue ); void setVisibleYRange( double minValue, double maxValue ); - void updateZoomInQwt() override; - void updateZoomFromQwt() override; + void updateZoomInParentPlot() override; + void updateZoomFromParentPlot() override; void updateParentPlotZoom(); @@ -188,7 +185,7 @@ class RimWellLogTrack : public RimPlot RimWellPath* wellPathAttributeSource() const; - caf::PdmObject* findPdmObjectFromQwtCurve( const QwtPlotCurve* curve ) const override; + caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; void setLogarithmicScale( bool enable ); bool isLogarithmicScale() const; @@ -241,7 +238,7 @@ class RimWellLogTrack : public RimPlot void onLoadDataAndUpdate() override; private: - RiuQwtPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; + RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; void cleanupBeforeClose(); void detachAllPlotItems(); diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp index b01b64cd01..fc02d7b22c 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp @@ -136,7 +136,7 @@ void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot ) if ( m_isUsingAutoName ) { - m_qwtPlotCurve->setTitle( createCurveAutoName() ); + m_plotCurve->setTitle( createCurveAutoName() ); } setSymbol( getSymbolForMeasurementKind( m_measurementKind() ) ); @@ -156,10 +156,10 @@ void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot ) depthType = wellLogPlot->depthType(); } - m_qwtPlotCurve->setSamples( this->curveData()->xPlotValues().data(), - this->curveData()->depthPlotValues( depthType, displayUnit ).data(), - static_cast( this->curveData()->xPlotValues().size() ) ); - m_qwtPlotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); + m_plotCurve->setSamplesFromXValuesAndYValues( this->curveData()->xPlotValues(), + this->curveData()->depthPlotValues( depthType, displayUnit ), + static_cast( this->curveData()->xPlotValues().size() ) ); + m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); } this->RimPlotCurve::updateCurvePresentation( updateParentPlot ); @@ -169,9 +169,9 @@ void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot ) updateZoomInParentPlot(); } - if ( m_parentQwtPlot ) + if ( m_parentPlot ) { - m_parentQwtPlot->replot(); + m_parentPlot->replot(); } } @@ -205,7 +205,7 @@ void RimWellMeasurementCurve::fieldChangedByUi( const caf::PdmFieldHandle* chang this->loadDataAndUpdate( true ); } - if ( m_parentQwtPlot ) m_parentQwtPlot->replot(); + if ( m_parentPlot ) m_parentPlot->replot(); } //-------------------------------------------------------------------------------------------------- @@ -350,25 +350,25 @@ void RimWellMeasurementCurve::setMeasurementKind( const QString& measurementKind //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::PointSymbolEnum RimWellMeasurementCurve::getSymbolForMeasurementKind( const QString& measurementKind ) +RiuPlotCurveSymbol::PointSymbolEnum RimWellMeasurementCurve::getSymbolForMeasurementKind( const QString& measurementKind ) { - std::map symbolTable; - symbolTable["XLOT"] = RiuQwtSymbol::SYMBOL_RECT; - symbolTable["LOT"] = RiuQwtSymbol::SYMBOL_TRIANGLE; - symbolTable["FIT"] = RiuQwtSymbol::SYMBOL_DIAMOND; - symbolTable["MCF"] = RiuQwtSymbol::SYMBOL_ELLIPSE; - symbolTable["MNF"] = RiuQwtSymbol::SYMBOL_ELLIPSE; - symbolTable["TH"] = RiuQwtSymbol::SYMBOL_STAR1; - symbolTable["LE"] = RiuQwtSymbol::SYMBOL_STAR2; - symbolTable["BA"] = RiuQwtSymbol::SYMBOL_STAR1; - symbolTable["CORE"] = RiuQwtSymbol::SYMBOL_RECT; - symbolTable["PPG"] = RiuQwtSymbol::SYMBOL_RECT; + std::map symbolTable; + symbolTable["XLOT"] = RiuPlotCurveSymbol::SYMBOL_RECT; + symbolTable["LOT"] = RiuPlotCurveSymbol::SYMBOL_TRIANGLE; + symbolTable["FIT"] = RiuPlotCurveSymbol::SYMBOL_DIAMOND; + symbolTable["MCF"] = RiuPlotCurveSymbol::SYMBOL_ELLIPSE; + symbolTable["MNF"] = RiuPlotCurveSymbol::SYMBOL_ELLIPSE; + symbolTable["TH"] = RiuPlotCurveSymbol::SYMBOL_STAR1; + symbolTable["LE"] = RiuPlotCurveSymbol::SYMBOL_STAR2; + symbolTable["BA"] = RiuPlotCurveSymbol::SYMBOL_STAR1; + symbolTable["CORE"] = RiuPlotCurveSymbol::SYMBOL_RECT; + symbolTable["PPG"] = RiuPlotCurveSymbol::SYMBOL_RECT; auto it = symbolTable.find( measurementKind ); if ( it != symbolTable.end() ) return it->second; else - return RiuQwtSymbol::SYMBOL_CROSS; + return RiuPlotCurveSymbol::SYMBOL_CROSS; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.h b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.h index 69cc2e1800..3f5c8a6271 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.h @@ -63,8 +63,8 @@ class RimWellMeasurementCurve : public RimWellLogCurve QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) override; - RiuQwtSymbol::PointSymbolEnum getSymbolForMeasurementKind( const QString& measurementKind ); - cvf::Color3f getColorForMeasurementKind( const QString& measurementKind ); + RiuPlotCurveSymbol::PointSymbolEnum getSymbolForMeasurementKind( const QString& measurementKind ); + cvf::Color3f getColorForMeasurementKind( const QString& measurementKind ); protected: caf::PdmPtrField m_wellPath; diff --git a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake index 344f285a01..688c9a2ce4 100644 --- a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake @@ -5,10 +5,13 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuFemResultTextBuilder.h ${CMAKE_CURRENT_LIST_DIR}/RiuGeoQuestNavigation.h ${CMAKE_CURRENT_LIST_DIR}/RiuInterfaceToViewWindow.h + ${CMAKE_CURRENT_LIST_DIR}/RiuPlotCurveSymbol.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtSymbol.h + ${CMAKE_CURRENT_LIST_DIR}/RiuPlotCurve.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotCurve.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotCurveDefines.h - ${CMAKE_CURRENT_LIST_DIR}/RiuRimQwtPlotCurve.h + ${CMAKE_CURRENT_LIST_DIR}/RiuPlotItem.h + ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotItem.h ${CMAKE_CURRENT_LIST_DIR}/RiuPlotMainWindow.h ${CMAKE_CURRENT_LIST_DIR}/RiuMainWindow.h ${CMAKE_CURRENT_LIST_DIR}/RiuMainWindowBase.h @@ -38,6 +41,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuDockedQwtPlot.h ${CMAKE_CURRENT_LIST_DIR}/RiuGridCrossQwtPlot.h ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryQwtPlot.h + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryPlot.h ${CMAKE_CURRENT_LIST_DIR}/RiuTextDialog.h ${CMAKE_CURRENT_LIST_DIR}/RiuTimeStepChangedHandler.h ${CMAKE_CURRENT_LIST_DIR}/RiuTofAccumulatedPhaseFractionsPlot.h @@ -52,6 +56,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.h + ${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.h ${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.h @@ -102,10 +107,12 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuFemResultTextBuilder.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuGeoQuestNavigation.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuInterfaceToViewWindow.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuPlotCurveSymbol.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuQwtSymbol.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuPlotCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotCurveDefines.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiuRimQwtPlotCurve.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotItem.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuPlotMainWindow.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMainWindow.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMainWindowBase.cpp @@ -134,6 +141,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuDockedQwtPlot.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuGridCrossQwtPlot.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryQwtPlot.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryPlot.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuTextDialog.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuTimeStepChangedHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuTofAccumulatedPhaseFractionsPlot.cpp @@ -147,6 +155,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.cpp @@ -190,12 +199,32 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuTextContentFrame.cpp ) -if(Qt5Charts_FOUND) - list(APPEND CODE_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartView.h) +if(RESINSIGHT_USE_QT_CHARTS) + list( + APPEND + CODE_HEADER_FILES + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartView.h + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotCurve.h + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotWidget.h + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotTools.h + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotCurveSymbol.h + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryQtChartsPlot.h + ) - list(APPEND CODE_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartView.cpp) + list( + APPEND + CODE_SOURCE_FILES + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartView.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotCurve.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotWidget.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotTools.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotCurveSymbol.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryQtChartsPlot.cpp + ) - # list(APPEND QT_MOC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartView.h) + list(APPEND QT_MOC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotWidget.h + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryQtChartsPlot.h + ) endif() list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) @@ -224,11 +253,13 @@ list( ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.h + ${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.h ${CMAKE_CURRENT_LIST_DIR}/RiuRecentFileActionProvider.h ${CMAKE_CURRENT_LIST_DIR}/RiuDockedQwtPlot.h ${CMAKE_CURRENT_LIST_DIR}/RiuGridCrossQwtPlot.h ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryQwtPlot.h + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryPlot.h ${CMAKE_CURRENT_LIST_DIR}/RiuTofAccumulatedPhaseFractionsPlot.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtScalePicker.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWheelZoomer.h diff --git a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp index b179e3680e..a42392024c 100644 --- a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp @@ -25,10 +25,12 @@ #include "RimFlowCharacteristicsPlot.h" +#include "RiuPlotCurveSymbol.h" #include "RiuQwtPlotCurve.h" #include "RiuQwtPlotTools.h" #include "RiuQwtPlotWheelZoomer.h" #include "RiuQwtPlotZoomer.h" +#include "RiuQwtSymbol.h" #include "RiuResultQwtPlot.h" #include "cvfColor3.h" @@ -39,7 +41,6 @@ #include "qwt_legend.h" #include "qwt_plot.h" #include "qwt_plot_zoomer.h" -#include "qwt_symbol.h" #include #include @@ -194,9 +195,7 @@ void RiuFlowCharacteristicsPlot::addCurveWithLargeSymbol( QwtPlot* plot, { auto curve = createEmptyCurve( plot, curveName, color ); - QwtSymbol::Style style = QwtSymbol::Diamond; - QwtSymbol* symbol = new QwtSymbol( style ); - + RiuPlotCurveSymbol* symbol = new RiuQwtSymbol( RiuPlotCurveSymbol::PointSymbolEnum::SYMBOL_DIAMOND ); symbol->setSize( 15, 15 ); symbol->setColor( color ); @@ -221,7 +220,7 @@ void RiuFlowCharacteristicsPlot::addCurveWithLargeSymbol( QwtPlot* plot, RiuQwtPlotCurve* RiuFlowCharacteristicsPlot::createEmptyCurve( QwtPlot* plot, const QString& curveName, const QColor& curveColor ) { - RiuQwtPlotCurve* plotCurve = new RiuQwtPlotCurve( curveName ); + RiuQwtPlotCurve* plotCurve = new RiuQwtPlotCurve( nullptr, curveName ); plotCurve->setTitle( curveName ); plotCurve->setPen( QPen( curveColor ) ); diff --git a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.h b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.h index f559e5ea5e..666031a845 100644 --- a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.h +++ b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.h @@ -22,8 +22,6 @@ #include "cafPdmPointer.h" -#include "qwt_plot.h" - #include #include @@ -33,6 +31,7 @@ class RiuResultQwtPlot; class RiuQwtPlotCurve; class QLabel; +class QwtPlot; namespace cvf { diff --git a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp index e935f7bb9c..d67923ca52 100644 --- a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp @@ -30,11 +30,12 @@ #include "RiuContextMenuLauncher.h" #include "RiuGuiTheme.h" #include "RiuPlotAnnotationTool.h" +#include "RiuPlotCurve.h" #include "RiuQwtCurvePointTracker.h" +#include "RiuQwtPlotItem.h" #include "RiuQwtPlotTools.h" #include "RiuQwtPlotWheelZoomer.h" #include "RiuQwtPlotZoomer.h" -#include "RiuRimQwtPlotCurve.h" #include "RiuWidgetDragger.h" #include "cafCmdFeatureMenuBuilder.h" @@ -44,6 +45,7 @@ #include "qwt_legend.h" #include "qwt_legend_label.h" +#include "qwt_plot_curve.h" #include "qwt_plot_panner.h" #include "qwt_scale_draw.h" #include "qwt_scale_widget.h" @@ -62,29 +64,29 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* paren : RiuQwtPlotWidget( plot, parent ) { // LeftButton for the zooming - m_zoomerLeft = new RiuQwtPlotZoomer( canvas() ); + m_zoomerLeft = new RiuQwtPlotZoomer( qwtPlot()->canvas() ); m_zoomerLeft->setTrackerMode( QwtPicker::AlwaysOff ); m_zoomerLeft->initMousePattern( 1 ); // Attach a zoomer for the right axis - m_zoomerRight = new RiuQwtPlotZoomer( canvas() ); - m_zoomerRight->setAxis( xTop, yRight ); + m_zoomerRight = new RiuQwtPlotZoomer( qwtPlot()->canvas() ); + m_zoomerRight->setAxis( QwtPlot::xTop, QwtPlot::yRight ); m_zoomerRight->setTrackerMode( QwtPicker::AlwaysOff ); m_zoomerRight->initMousePattern( 1 ); // MidButton for the panning - QwtPlotPanner* panner = new QwtPlotPanner( canvas() ); + QwtPlotPanner* panner = new QwtPlotPanner( qwtPlot()->canvas() ); panner->setMouseButton( Qt::MidButton ); - auto wheelZoomer = new RiuQwtPlotWheelZoomer( this ); + auto wheelZoomer = new RiuQwtPlotWheelZoomer( qwtPlot() ); connect( wheelZoomer, SIGNAL( zoomUpdated() ), SLOT( onZoomedSlot() ) ); connect( m_zoomerLeft, SIGNAL( zoomed( const QRectF& ) ), SLOT( onZoomedSlot() ) ); connect( m_zoomerRight, SIGNAL( zoomed( const QRectF& ) ), SLOT( onZoomedSlot() ) ); connect( panner, SIGNAL( panned( int, int ) ), SLOT( onZoomedSlot() ) ); connect( this, - SIGNAL( plotItemSelected( QwtPlotItem*, bool, int ) ), - SLOT( onPlotItemSelected( QwtPlotItem*, bool, int ) ) ); + SIGNAL( plotItemSelected( std::shared_ptr, bool, int ) ), + SLOT( onPlotItemSelected( std::shared_ptr, bool, int ) ) ); m_annotationTool = std::unique_ptr( new RiuPlotAnnotationTool() ); m_selectedPointMarker = new QwtPlotMarker; @@ -99,11 +101,11 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* paren m_selectedPointMarker->setSpacing( 3 ); m_selectedPointMarker->setZ( 1000.0 ); // Make sure it ends up in front of highlighted curves. - RiuQwtPlotTools::setCommonPlotBehaviour( this ); - RiuQwtPlotTools::setDefaultAxes( this ); + RiuQwtPlotTools::setCommonPlotBehaviour( qwtPlot() ); + RiuQwtPlotTools::setDefaultAxes( qwtPlot() ); this->installEventFilter( this ); - this->canvas()->installEventFilter( this ); + this->qwtPlot()->canvas()->installEventFilter( this ); setInternalQwtLegendVisible( true ); @@ -139,7 +141,7 @@ void RiuGridCrossQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterfac for ( auto annotation : axisProperties->annotations() ) { - m_annotationTool->attachAnnotationLine( this, + m_annotationTool->attachAnnotationLine( qwtPlot(), annotation->color(), annotation->name(), annotation->value(), @@ -152,13 +154,13 @@ void RiuGridCrossQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterfac //-------------------------------------------------------------------------------------------------- void RiuGridCrossQwtPlot::setLegendFontSize( int fontSize ) { - if ( legend() ) + if ( qwtPlot()->legend() ) { - QFont font = legend()->font(); + QFont font = qwtPlot()->legend()->font(); font.setPixelSize( caf::FontTools::pointSizeToPixelSize( fontSize ) ); - legend()->setFont( font ); + qwtPlot()->legend()->setFont( font ); // Set font size for all existing labels - QList labels = legend()->findChildren(); + QList labels = qwtPlot()->legend()->findChildren(); for ( QwtLegendLabel* label : labels ) { label->setFont( font ); @@ -174,29 +176,32 @@ void RiuGridCrossQwtPlot::setInternalQwtLegendVisible( bool visible ) if ( visible ) { QwtLegend* legend = new QwtLegend( this ); - this->insertLegend( legend, BottomLegend ); + this->qwtPlot()->insertLegend( legend, QwtPlot::BottomLegend ); } else { - this->insertLegend( nullptr ); + this->qwtPlot()->insertLegend( nullptr ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuGridCrossQwtPlot::onPlotItemSelected( QwtPlotItem* plotItem, bool toggle, int pointNumber ) +void RiuGridCrossQwtPlot::onPlotItemSelected( std::shared_ptr plotItem, bool toggle, int pointNumber ) { if ( pointNumber == -1 ) m_selectedPointMarker->detach(); else { - QwtPlotCurve* curve = dynamic_cast( plotItem ); + RiuQwtPlotItem* qwtPlotItem = dynamic_cast( plotItem.get() ); + if ( !qwtPlotItem ) return; + + QwtPlotCurve* curve = dynamic_cast( qwtPlotItem->qwtPlotItem() ); if ( curve ) { QPointF sample = curve->sample( pointNumber ); m_selectedPointMarker->setValue( sample ); m_selectedPointMarker->setAxes( QwtPlot::xBottom, QwtPlot::yLeft ); - m_selectedPointMarker->attach( this ); + m_selectedPointMarker->attach( qwtPlot() ); QString curveName, xAxisName, yAxisName; if ( curveText( curve, &curveName, &xAxisName, &yAxisName ) ) { @@ -224,7 +229,7 @@ bool RiuGridCrossQwtPlot::curveText( const QwtPlotCurve* curve, QString* curveTi { CVF_ASSERT( curveTitle && xParamName && yParamName ); - auto riuCurve = dynamic_cast( curve ); + auto riuCurve = dynamic_cast( curve ); if ( riuCurve ) { auto crossPlotCurve = dynamic_cast( riuCurve->ownerRimCurve() ); diff --git a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.h b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.h index 5acd93ffb8..597a5304e7 100644 --- a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.h +++ b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.h @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once -#include "RiuInterfaceToViewWindow.h" #include "RiuPlotAnnotationTool.h" #include "RiuQwtPlotWidget.h" @@ -58,7 +57,7 @@ class RiuGridCrossQwtPlot : public RiuQwtPlotWidget void updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties ); - void setLegendFontSize( int fontSize ); + void setLegendFontSize( int fontSize ) override; void setInternalQwtLegendVisible( bool visible ); protected: @@ -68,7 +67,7 @@ class RiuGridCrossQwtPlot : public RiuQwtPlotWidget private slots: void onZoomedSlot(); - void onPlotItemSelected( QwtPlotItem* selectedItem, bool toggleItem, int sampleIndex ); + void onPlotItemSelected( std::shared_ptr selectedItem, bool toggleItem, int sampleIndex ); private: std::unique_ptr m_annotationTool; diff --git a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp index 2ea6ee8fa6..c503a2933e 100644 --- a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp @@ -20,9 +20,6 @@ #include "RiaColorTables.h" -#include "Riu3dSelectionManager.h" -#include "RiuQwtPlotTools.h" - #include "RigFemPart.h" #include "RigFemPartCollection.h" #include "RigFemPartGrid.h" @@ -37,12 +34,14 @@ #include "RimGeoMechResultDefinition.h" #include "RimGeoMechView.h" +#include "Riu3dSelectionManager.h" +#include "RiuQwtPlotTools.h" + #include "cvfAssert.h" #include #include #include -#include #include "qwt_legend.h" #include "qwt_plot_curve.h" diff --git a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.h b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.h index 19a103b8a4..f84f79acc1 100644 --- a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.h +++ b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.h @@ -20,12 +20,7 @@ #include "RiuDockedQwtPlot.h" -#include "qwt_plot.h" -#include "qwt_plot_curve.h" -#include "qwt_plot_item.h" - #include "cafTensor3.h" - #include "cvfColor3.h" #include @@ -38,6 +33,7 @@ class RiuSelectionItem; class RimGeoMechCase; class RimGeoMechResultDefinition; class RiuGeoMechSelectionItem; +class QwtPlotCurve; //================================================================================================== // diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index c250565ab2..e35a81d327 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -29,19 +29,13 @@ #include "RiuMultiPlotPage.h" #include "RiuPlotMainWindow.h" #include "RiuPlotObjectPicker.h" -#include "RiuQwtPlotLegend.h" -#include "RiuQwtPlotWidget.h" +#include "RiuPlotWidget.h" #include "cafCmdFeatureMenuBuilder.h" #include "cafSelectionManager.h" #include "cvfAssert.h" -#include "qwt_legend.h" -#include "qwt_plot_layout.h" -#include "qwt_plot_renderer.h" -#include "qwt_scale_draw.h" - #include #include #include @@ -156,7 +150,7 @@ RimViewWindow* RiuMultiPlotBook::ownerViewWindow() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotBook::addPlot( RiuQwtPlotWidget* plotWidget ) +void RiuMultiPlotBook::addPlot( RiuPlotWidget* plotWidget ) { // Push the plot to the back of the list insertPlot( plotWidget, m_plotWidgets.size() ); @@ -165,7 +159,7 @@ void RiuMultiPlotBook::addPlot( RiuQwtPlotWidget* plotWidget ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotBook::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ) +void RiuMultiPlotBook::insertPlot( RiuPlotWidget* plotWidget, size_t index ) { m_plotWidgets.insert( static_cast( index ), plotWidget ); scheduleUpdate(); @@ -174,7 +168,7 @@ void RiuMultiPlotBook::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotBook::removePlot( RiuQwtPlotWidget* plotWidget ) +void RiuMultiPlotBook::removePlot( RiuPlotWidget* plotWidget ) { if ( !plotWidget ) return; @@ -277,7 +271,7 @@ void RiuMultiPlotBook::setAxisFontSizes( int axisTitleFontSize, int axisValueFon //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuMultiPlotBook::indexOfPlotWidget( RiuQwtPlotWidget* plotWidget ) +int RiuMultiPlotBook::indexOfPlotWidget( RiuPlotWidget* plotWidget ) { return m_plotWidgets.indexOf( plotWidget ); } @@ -316,7 +310,7 @@ void RiuMultiPlotBook::scheduleUpdate() //-------------------------------------------------------------------------------------------------- void RiuMultiPlotBook::scheduleReplotOfAllPlots() { - for ( RiuQwtPlotWidget* plotWidget : visiblePlotWidgets() ) + for ( RiuPlotWidget* plotWidget : visiblePlotWidgets() ) { plotWidget->scheduleReplot(); } @@ -466,10 +460,10 @@ void RiuMultiPlotBook::performUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList> RiuMultiPlotBook::visiblePlotWidgets() const +QList> RiuMultiPlotBook::visiblePlotWidgets() const { - QList> plotWidgets; - for ( QPointer plotWidget : m_plotWidgets ) + QList> plotWidgets; + for ( QPointer plotWidget : m_plotWidgets ) { CAF_ASSERT( plotWidget ); if ( plotWidget->isChecked() ) @@ -501,8 +495,8 @@ void RiuMultiPlotBook::createPages() { CAF_ASSERT( m_plotDefinition ); - QList> plotWidgets = this->visiblePlotWidgets(); - auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() ); + QList> plotWidgets = this->visiblePlotWidgets(); + auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() ); int rowsPerPage = m_plotDefinition->rowsPerPage(); int row = 0; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index e664f93b65..4a8072cc91 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -17,7 +17,6 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once -#include "RiuInterfaceToViewWindow.h" #include "RiuMultiPlotPage.h" #include "cafPdmPointer.h" @@ -35,7 +34,7 @@ class RiaPlotWindowRedrawScheduler; class RimMultiPlot; class RiuMultiPlotPage; -class RiuQwtPlotWidget; +class RiuPlotWidget; class BookFrame; class QFocusEvent; @@ -63,9 +62,9 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow RimViewWindow* ownerViewWindow() const override; - void addPlot( RiuQwtPlotWidget* plotWidget ); - void insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ); - void removePlot( RiuQwtPlotWidget* plotWidget ); + void addPlot( RiuPlotWidget* plotWidget ); + void insertPlot( RiuPlotWidget* plotWidget, size_t index ); + void removePlot( RiuPlotWidget* plotWidget ); void removeAllPlots(); void setPlotTitle( const QString& plotTitle ); @@ -77,7 +76,7 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void setLegendFontSize( int legendFontSize ); void setAxisFontSizes( int axisTitleFontSize, int axisValueFontSize ); - int indexOfPlotWidget( RiuQwtPlotWidget* plotWidget ); + int indexOfPlotWidget( RiuPlotWidget* plotWidget ); bool pagePreviewModeEnabled() const; void setPagePreviewModeEnabled( bool previewMode ); @@ -100,7 +99,7 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow virtual bool showYAxis( int row, int column ) const; - QList> visiblePlotWidgets() const; + QList> visiblePlotWidgets() const; private: void deleteAllPages(); @@ -120,7 +119,7 @@ private slots: QPointer m_bookLayout; QList> m_pages; - QList> m_plotWidgets; + QList> m_plotWidgets; caf::PdmPointer m_plotDefinition; QString m_plotTitle; bool m_titleVisible; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 37637ba3ff..52f728eaee 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -34,6 +34,7 @@ #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" #include "RiuPlotObjectPicker.h" +#include "RiuPlotWidget.h" #include "RiuQwtPlotLegend.h" #include "RiuQwtPlotWidget.h" @@ -133,7 +134,7 @@ RimPlotWindow* RiuMultiPlotPage::ownerPlotDefinition() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotPage::addPlot( RiuQwtPlotWidget* plotWidget ) +void RiuMultiPlotPage::addPlot( RiuPlotWidget* plotWidget ) { // Insert the plot to the left of the scroll bar insertPlot( plotWidget, m_plotWidgets.size() ); @@ -142,7 +143,7 @@ void RiuMultiPlotPage::addPlot( RiuQwtPlotWidget* plotWidget ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotPage::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ) +void RiuMultiPlotPage::insertPlot( RiuPlotWidget* plotWidget, size_t index ) { m_plotWidgets.insert( static_cast( index ), plotWidget ); plotWidget->setVisible( false ); @@ -166,9 +167,13 @@ void RiuMultiPlotPage::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ) legend->setMaxColumns( legendColumns ); legend->horizontalScrollBar()->setVisible( false ); legend->verticalScrollBar()->setVisible( false ); - legend->connect( plotWidget, - SIGNAL( legendDataChanged( const QVariant&, const QList& ) ), - SLOT( updateLegend( const QVariant&, const QList& ) ) ); + RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast( plotWidget ); + if ( qwtPlotWidget ) + { + legend->connect( qwtPlotWidget->qwtPlot(), + SIGNAL( legendDataChanged( const QVariant&, const QList& ) ), + SLOT( updateLegend( const QVariant&, const QList& ) ) ); + } QObject::connect( legend, SIGNAL( legendUpdated() ), this, SLOT( onLegendUpdated() ) ); legend->contentsWidget()->layout()->setAlignment( Qt::AlignBottom | Qt::AlignHCenter ); @@ -183,7 +188,7 @@ void RiuMultiPlotPage::insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotPage::removePlot( RiuQwtPlotWidget* plotWidget ) +void RiuMultiPlotPage::removePlot( RiuPlotWidget* plotWidget ) { if ( !plotWidget ) return; @@ -215,7 +220,7 @@ void RiuMultiPlotPage::removePlot( RiuQwtPlotWidget* plotWidget ) void RiuMultiPlotPage::removeAllPlots() { auto plotWidgets = m_plotWidgets; - for ( RiuQwtPlotWidget* plotWidget : plotWidgets ) + for ( RiuPlotWidget* plotWidget : plotWidgets ) { removePlot( plotWidget ); } @@ -296,7 +301,7 @@ void RiuMultiPlotPage::setPagePreviewModeEnabled( bool previewMode ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuMultiPlotPage::indexOfPlotWidget( RiuQwtPlotWidget* plotWidget ) +int RiuMultiPlotPage::indexOfPlotWidget( RiuPlotWidget* plotWidget ) { return m_plotWidgets.indexOf( plotWidget ); } @@ -315,7 +320,7 @@ void RiuMultiPlotPage::scheduleUpdate() //-------------------------------------------------------------------------------------------------- void RiuMultiPlotPage::scheduleReplotOfAllPlots() { - for ( RiuQwtPlotWidget* plotWidget : visiblePlotWidgets() ) + for ( RiuPlotWidget* plotWidget : visiblePlotWidgets() ) { plotWidget->scheduleReplot(); } @@ -517,7 +522,7 @@ void RiuMultiPlotPage::onSelectionManagerSelectionChanged( const std::set& { if ( !m_plotDefinition ) return; - for ( RiuQwtPlotWidget* plotWidget : m_plotWidgets ) + for ( RiuPlotWidget* plotWidget : m_plotWidgets ) { CAF_ASSERT( plotWidget ); RimPlot* plot = plotWidget->plotDefinition(); @@ -587,7 +592,7 @@ void RiuMultiPlotPage::reinsertPlotWidgets() QList> subTitles = this->subTitlesForVisiblePlots(); QList> legends = this->legendsForVisiblePlots(); - QList> plotWidgets = this->visiblePlotWidgets(); + QList> plotWidgets = this->visiblePlotWidgets(); if ( !plotWidgets.empty() ) { @@ -615,10 +620,10 @@ void RiuMultiPlotPage::reinsertPlotWidgets() subTitleFont.setPixelSize( m_subTitleFontPixelSize ); subTitles[visibleIndex]->setFont( subTitleFont ); - plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( QwtPlot::yLeft, + plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, showYAxis( row, column ), showYAxis( row, column ) ); - plotWidgets[visibleIndex]->setAxisTitleEnabled( QwtPlot::yLeft, showYAxis( row, column ) ); + plotWidgets[visibleIndex]->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, showYAxis( row, column ) ); plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize ); { @@ -679,7 +684,7 @@ int RiuMultiPlotPage::alignCanvasTops() { CVF_ASSERT( m_legends.size() == m_plotWidgets.size() ); - QList> plotWidgets = visiblePlotWidgets(); + QList> plotWidgets = visiblePlotWidgets(); QList> legends = legendsForVisiblePlots(); if ( plotWidgets.empty() ) return 0; @@ -689,22 +694,30 @@ int RiuMultiPlotPage::alignCanvasTops() for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex ) { - int row = visibleIndex / rowAndColumnCount.second; - if ( plotWidgets[visibleIndex]->axisEnabled( QwtPlot::xTop ) ) + RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast( plotWidgets[visibleIndex].data() ); + if ( qwtPlotWidget ) { - QFont font = m_plotWidgets[visibleIndex]->axisFont( QwtPlot::xTop ); - maxExtents[row] = - std::max( maxExtents[row], plotWidgets[visibleIndex]->axisScaleDraw( QwtPlot::xTop )->extent( font ) ); + int row = visibleIndex / rowAndColumnCount.second; + if ( plotWidgets[visibleIndex]->axisEnabled( RiaDefines::PlotAxis::PLOT_AXIS_TOP ) ) + { + QFont font = qwtPlotWidget->qwtPlot()->axisFont( QwtPlot::xTop ); + maxExtents[row] = std::max( maxExtents[row], + qwtPlotWidget->qwtPlot()->axisScaleDraw( QwtPlot::xTop )->extent( font ) ); + } } } for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex ) { - int row = visibleIndex / rowAndColumnCount.second; - plotWidgets[visibleIndex]->axisScaleDraw( QwtPlot::xTop )->setMinimumExtent( maxExtents[row] ); - if ( legends[visibleIndex] ) + RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast( plotWidgets[visibleIndex].data() ); + if ( qwtPlotWidget ) { - legends[visibleIndex]->adjustSize(); + int row = visibleIndex / rowAndColumnCount.second; + qwtPlotWidget->qwtPlot()->axisScaleDraw( QwtPlot::xTop )->setMinimumExtent( maxExtents[row] ); + if ( legends[visibleIndex] ) + { + legends[visibleIndex]->adjustSize(); + } } } return maxExtents[0]; @@ -740,10 +753,10 @@ void RiuMultiPlotPage::clearGridLayout() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList> RiuMultiPlotPage::visiblePlotWidgets() const +QList> RiuMultiPlotPage::visiblePlotWidgets() const { - QList> plotWidgets; - for ( QPointer plotWidget : m_plotWidgets ) + QList> plotWidgets; + for ( QPointer plotWidget : m_plotWidgets ) { if ( plotWidget->isChecked() ) { diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h index fc643efa22..0eae4164ca 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h @@ -34,7 +34,7 @@ class RiaPlotWindowRedrawScheduler; class RimPlotWindow; class RiuQwtPlotLegend; -class RiuQwtPlotWidget; +class RiuPlotWidget; class QFocusEvent; class QLabel; @@ -70,11 +70,11 @@ class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, p RimViewWindow* ownerViewWindow() const override; RimPlotWindow* ownerPlotDefinition(); - void addPlot( RiuQwtPlotWidget* plotWidget ); - void insertPlot( RiuQwtPlotWidget* plotWidget, size_t index ); - void removePlot( RiuQwtPlotWidget* plotWidget ); + void addPlot( RiuPlotWidget* plotWidget ); + void insertPlot( RiuPlotWidget* plotWidget, size_t index ); + void removePlot( RiuPlotWidget* plotWidget ); void removeAllPlots(); - int indexOfPlotWidget( RiuQwtPlotWidget* plotWidget ); + int indexOfPlotWidget( RiuPlotWidget* plotWidget ); void setPlotTitle( const QString& plotTitle ); void setTitleVisible( bool visible ); @@ -117,7 +117,7 @@ class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, p void clearGridLayout(); - QList> visiblePlotWidgets() const; + QList> visiblePlotWidgets() const; QList> legendsForVisiblePlots() const; QList> subTitlesForVisiblePlots() const; @@ -138,7 +138,7 @@ private slots: QPointer m_plotTitle; QList> m_subTitles; QList> m_legends; - QList> m_plotWidgets; + QList> m_plotWidgets; caf::PdmPointer m_plotDefinition; int m_titleFontPixelSize; diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuPlotCurve.cpp new file mode 100644 index 0000000000..ab9ce18781 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuPlotCurve.cpp @@ -0,0 +1,206 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuPlotCurve.h" + +#include "RiaCurveDataTools.h" +#include "RiaTimeTTools.h" + +#include "RimPlotCurve.h" + +#include "qwt_date.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotCurve::RiuPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title ) +{ + m_ownerRimCurve = ownerRimCurve; + + m_symbolSkipPixelDistance = 10.0f; + + m_blackAndWhiteLegendIcon = false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotCurve::~RiuPlotCurve() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurve::setSamplesValues( const std::vector& xValues, const std::vector& yValues ) +{ + setSamplesInPlot( xValues, yValues, static_cast( xValues.size() ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurve::setSamplesFromXValuesAndYValues( const std::vector& xValues, + const std::vector& yValues, + bool keepOnlyPositiveValues ) +{ + computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurve::setSamplesFromDatesAndYValues( const std::vector& dateTimes, + const std::vector& yValues, + bool keepOnlyPositiveValues ) +{ + auto xValues = RiuPlotCurve::fromQDateTime( dateTimes ); + + computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurve::setSamplesFromTimeTAndYValues( const std::vector& dateTimes, + const std::vector& yValues, + bool keepOnlyPositiveValues ) +{ + auto xValues = RiuPlotCurve::fromTime_t( dateTimes ); + + computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurve::setLineSegmentStartStopIndices( const std::vector>& lineSegmentStartStopIndices ) +{ + m_polyLineStartStopIndices = lineSegmentStartStopIndices; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurve::setSymbolSkipPixelDistance( float distance ) +{ + m_symbolSkipPixelDistance = distance >= 0.0f ? distance : 0.0f; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurve::setPerPointLabels( const std::vector& labels ) +{ + m_perPointLabels = labels; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurve::setBlackAndWhiteLegendIcon( bool blackAndWhite ) +{ + m_blackAndWhiteLegendIcon = blackAndWhite; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurve::computeValidIntervalsAndSetCurveData( const std::vector& xValues, + const std::vector& yValues, + bool keepOnlyPositiveValues ) +{ + auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, keepOnlyPositiveValues ); + + std::vector validYValues; + std::vector validXValues; + + RiaCurveDataTools::getValuesByIntervals( yValues, intervalsOfValidValues, &validYValues ); + RiaCurveDataTools::getValuesByIntervals( xValues, intervalsOfValidValues, &validXValues ); + + setSamplesInPlot( validXValues, validYValues, static_cast( validXValues.size() ) ); + + setLineSegmentStartStopIndices( RiaCurveDataTools::computePolyLineStartStopIndices( intervalsOfValidValues ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiuPlotCurve::fromQDateTime( const std::vector& dateTimes ) +{ + std::vector doubleValues; + + if ( !dateTimes.empty() ) + { + doubleValues.reserve( dateTimes.size() ); + + for ( const auto& dt : dateTimes ) + { + // TODO: remove Qwt usage here.. + doubleValues.push_back( QwtDate::toDouble( dt ) ); + } + } + + return doubleValues; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiuPlotCurve::fromTime_t( const std::vector& timeSteps ) +{ + std::vector doubleValues; + + if ( !timeSteps.empty() ) + { + doubleValues.reserve( timeSteps.size() ); + for ( const auto& time : timeSteps ) + { + doubleValues.push_back( RiaTimeTTools::toDouble( time ) ); + } + } + + return doubleValues; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurve::setSamplesFromXYErrorValues( const std::vector& xValues, + const std::vector& yValues, + const std::vector& errorValues, + bool keepOnlyPositiveValues, + RiaCurveDataTools::ErrorAxis errorAxis ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimPlotCurve* RiuPlotCurve::ownerRimCurve() +{ + return m_ownerRimCurve; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RimPlotCurve* RiuPlotCurve::ownerRimCurve() const +{ + return m_ownerRimCurve; +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurve.h b/ApplicationLibCode/UserInterface/RiuPlotCurve.h new file mode 100644 index 0000000000..a1eed61b76 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuPlotCurve.h @@ -0,0 +1,150 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaCurveDataTools.h" + +#include "RiuPlotCurveSymbol.h" +#include "RiuPlotWidget.h" +#include "RiuQwtPlotCurveDefines.h" + +#include +#include +#include +#include + +class RimPlotCurve; + +//================================================================================================== +// +// If infinite data is present in the curve data, Qwt is not able to draw a nice curve. +// This class assumes that inf data is removed, and segments to be draw are indicated by start/stop indices into curve +// data. +// +// Single values in the curve are drawn using a CrossX symbol +// +// Here you can see the curve segments visualized. Curve segments are drawn between vector indices. +// +// 0 - 1 +// 5 - 7 +// 9 -10 +// +// * * +// * * * +// Curve * * * ----- X +// +// Values 1.0|2.0|inf|inf|inf|1.0|2.0|1.0|inf|1.0|1.0|inf|1.0|inf +// Vec index 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13 +//================================================================================================== +class RiuPlotCurve +{ +public: + explicit RiuPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title = QString() ); + explicit RiuPlotCurve(); + virtual ~RiuPlotCurve(); + + virtual void setTitle( const QString& title ) = 0; + + virtual void setSamplesValues( const std::vector& xValues, const std::vector& yValues ); + + void setSamplesFromXValuesAndYValues( const std::vector& xValues, + const std::vector& yValues, + bool keepOnlyPositiveValues ); + + void setSamplesFromDatesAndYValues( const std::vector& dateTimes, + const std::vector& yValues, + bool keepOnlyPositiveValues ); + + void setSamplesFromTimeTAndYValues( const std::vector& dateTimes, + const std::vector& yValues, + bool keepOnlyPositiveValues ); + + virtual void setSamplesFromXYErrorValues( + const std::vector& xValues, + const std::vector& yValues, + const std::vector& errorValues, + bool keepOnlyPositiveValues, + RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ); + + void setLineSegmentStartStopIndices( const std::vector>& lineSegmentStartStopIndices ); + + void setSymbolSkipPixelDistance( float distance ); + void setPerPointLabels( const std::vector& labels ); + + virtual void setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle, + RiuQwtPlotCurveDefines::CurveInterpolationEnum interpolationType, + int curveThickness, + const QColor& curveColor, + const QBrush& fillBrush = QBrush( Qt::NoBrush ) ) = 0; + + virtual void setBrush( const QBrush& brush ) = 0; + + void setBlackAndWhiteLegendIcon( bool blackAndWhite ); + virtual void setVisibleInLegend( bool isVisibleInLegend ) = 0; + virtual void setLegendIconSize( const QSize& iconSize ) = 0; + virtual QSize legendIconSize() const = 0; + virtual QPixmap legendIcon( const QSizeF& size ) const = 0; + + virtual void attachToPlot( RiuPlotWidget* plotWidget ) = 0; + virtual void showInPlot() = 0; + virtual void detach() = 0; + + static std::vector fromQDateTime( const std::vector& dateTimes ); + static std::vector fromTime_t( const std::vector& timeSteps ); + + virtual void setZ( int z ) = 0; + + virtual void updateErrorBarsAppearance( bool showErrorBars, const QColor& curveColor ) = 0; + virtual void clearErrorBars() = 0; + + virtual int numSamples() const = 0; + virtual std::pair sample( int index ) const = 0; + + RimPlotCurve* ownerRimCurve(); + const RimPlotCurve* ownerRimCurve() const; + + virtual std::pair xDataRange() const = 0; + virtual std::pair yDataRange() const = 0; + + virtual void setXAxis( RiaDefines::PlotAxis axis ) = 0; + virtual void setYAxis( RiaDefines::PlotAxis axis ) = 0; + + virtual void setSymbol( RiuPlotCurveSymbol* symbol ) = 0; + + virtual RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const = 0; + +protected: + virtual void + setSamplesInPlot( const std::vector& xValues, const std::vector& yValues, int numSamples ) = 0; + +private: + void computeValidIntervalsAndSetCurveData( const std::vector& xValues, + const std::vector& yValues, + bool keepOnlyPositiveValues ); + +protected: + float m_symbolSkipPixelDistance; + bool m_blackAndWhiteLegendIcon; + + std::vector m_perPointLabels; + + std::vector> m_polyLineStartStopIndices; + + caf::PdmPointer m_ownerRimCurve; +}; diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.cpp b/ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.cpp new file mode 100644 index 0000000000..648a0c5d08 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.cpp @@ -0,0 +1,153 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Equinor 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuPlotCurveSymbol.h" + +#include "cafFontTools.h" +#include "cvfAssert.h" + +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotCurveSymbol::RiuPlotCurveSymbol( PointSymbolEnum riuStyle, + const QString& label, + LabelPosition labelPosition, + int labelFontSizePt ) + : m_style( riuStyle ) + , m_globalLabel( label ) + , m_labelPosition( labelPosition ) + , m_labelFontSizePx( caf::FontTools::pointSizeToPixelSize( labelFontSizePt ) ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuPlotCurveSymbol::globalLabel() const +{ + return m_globalLabel; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurveSymbol::setGlobalLabel( const QString& label ) +{ + m_globalLabel = label; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurveSymbol::setLabelPosition( LabelPosition labelPosition ) +{ + m_labelPosition = labelPosition; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotCurveSymbol::setLabelFontSize( int labelFontSizePt ) +{ + m_labelFontSizePx = caf::FontTools::pointSizeToPixelSize( labelFontSizePt ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotCurveSymbol::PointSymbolEnum RiuPlotCurveSymbol::cycledSymbolStyle( int indexLevel1, int indexLevel2 ) +{ + std::vector> categorisedStyles = { + { SYMBOL_ELLIPSE, SYMBOL_RECT, SYMBOL_DIAMOND }, + { SYMBOL_DOWN_TRIANGLE, SYMBOL_UP_TRIANGLE }, + { SYMBOL_LEFT_TRIANGLE, SYMBOL_RIGHT_TRIANGLE }, + { SYMBOL_CROSS, SYMBOL_XCROSS }, + { SYMBOL_STAR1, SYMBOL_STAR2 }, + }; + + int level1Category = indexLevel1 % int( categorisedStyles.size() ); + int level2Category = indexLevel2 % int( categorisedStyles[level1Category].size() ); + + return categorisedStyles[level1Category][level2Category]; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotCurveSymbol::PointSymbolEnum RiuPlotCurveSymbol::cycledSymbolStyle( int indexLevel ) +{ + std::vector contrastingSymbols = { SYMBOL_ELLIPSE, + SYMBOL_CROSS, + SYMBOL_RECT, + SYMBOL_DOWN_TRIANGLE, + SYMBOL_UP_TRIANGLE, + SYMBOL_LEFT_TRIANGLE, + SYMBOL_RIGHT_TRIANGLE, + SYMBOL_STAR2, + SYMBOL_DIAMOND, + SYMBOL_STAR1 }; + + return contrastingSymbols[indexLevel % (int)contrastingSymbols.size()]; +} + +//-------------------------------------------------------------------------------------------------- +/// Is this a symbol with an interior and a border? If false, it is just lines. +//-------------------------------------------------------------------------------------------------- +bool RiuPlotCurveSymbol::isFilledSymbol( PointSymbolEnum symbol ) +{ + return symbol != SYMBOL_NONE && symbol != SYMBOL_CROSS && symbol != SYMBOL_XCROSS && symbol != SYMBOL_STAR1; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QRect RiuPlotCurveSymbol::labelBoundingRect( const QPainter* painter, const QRect& symbolRect, const QString& label ) const +{ + CVF_ASSERT( painter ); + + QPoint symbolPosition = symbolRect.topLeft(); + + int symbolWidth = symbolRect.width(); + int symbolHeight = symbolRect.height(); + + int labelWidth = painter->fontMetrics().width( label ); + int labelHeight = painter->fontMetrics().height(); + + QPoint labelPosition; + if ( m_labelPosition == LabelAboveSymbol ) + { + labelPosition = QPoint( symbolPosition.x() - labelWidth / 2, symbolPosition.y() - 5 ); + } + else if ( m_labelPosition == LabelBelowSymbol ) + { + labelPosition = QPoint( symbolPosition.x() - labelWidth / 2, symbolPosition.y() + symbolHeight + 5 ); + } + else if ( m_labelPosition == LabelLeftOfSymbol ) + { + labelPosition = QPoint( symbolPosition.x() - labelWidth - symbolWidth, symbolPosition.y() ); + } + else if ( m_labelPosition == LabelRightOfSymbol ) + { + labelPosition = QPoint( symbolPosition.x() + symbolWidth + 3, symbolPosition.y() ); + } + return QRect( labelPosition.x(), labelPosition.y(), labelWidth, labelHeight ); +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.h b/ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.h new file mode 100644 index 0000000000..93ca53d803 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.h @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Equinor 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include + +class QColor; +class QPen; +class QPainter; +class QRect; +class QPixmap; + +//-------------------------------------------------------------------------------------------------- +/// Interface for plot curve symbol +//-------------------------------------------------------------------------------------------------- +class RiuPlotCurveSymbol +{ +public: + enum LabelPosition + { + LabelAboveSymbol, + LabelBelowSymbol, + LabelLeftOfSymbol, + LabelRightOfSymbol + }; + + enum PointSymbolEnum + { + SYMBOL_NONE, + SYMBOL_ELLIPSE, + SYMBOL_RECT, + SYMBOL_DIAMOND, + SYMBOL_TRIANGLE, + SYMBOL_DOWN_TRIANGLE, + SYMBOL_CROSS, + SYMBOL_XCROSS, + SYMBOL_LEFT_ALIGNED_TRIANGLE, // Aligned so pin point is at lower right corner + SYMBOL_RIGHT_ALIGNED_TRIANGLE, // Aligned so pin point is at lower left corner + SYMBOL_LEFT_ANGLED_TRIANGLE, + SYMBOL_RIGHT_ANGLED_TRIANGLE, + SYMBOL_UP_TRIANGLE, + SYMBOL_STAR1, + SYMBOL_STAR2, + SYMBOL_HEXAGON, + SYMBOL_LEFT_TRIANGLE, + SYMBOL_RIGHT_TRIANGLE + }; + + RiuPlotCurveSymbol( PointSymbolEnum riuStyle, + const QString& label, + LabelPosition labelPosition = LabelAboveSymbol, + int labelFontSizePt = 8 ); + + QString globalLabel() const; + + void setGlobalLabel( const QString& label ); + + void setLabelPosition( LabelPosition labelPosition ); + + void setLabelFontSize( int labelFontSizePt ); + + virtual void setPixmap( const QPixmap& pixmap ) = 0; + + virtual void setSize( int width, int height ) = 0; + + virtual void setColor( const QColor& color ) = 0; + + virtual void setPen( const QPen& pen ) = 0; + + virtual QRect boundingRect() const = 0; + + static PointSymbolEnum cycledSymbolStyle( int indexLevel1, int indexLevel2 ); + static PointSymbolEnum cycledSymbolStyle( int indexLevel ); + + static bool isFilledSymbol( PointSymbolEnum symbol ); + + QRect labelBoundingRect( const QPainter* painter, const QRect& symbolRect, const QString& label ) const; + +protected: + PointSymbolEnum m_style; + QString m_globalLabel; + int m_labelFontSizePx; + LabelPosition m_labelPosition; +}; diff --git a/ApplicationLibCode/UserInterface/RiuPlotItem.h b/ApplicationLibCode/UserInterface/RiuPlotItem.h new file mode 100644 index 0000000000..e7fdb92738 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuPlotItem.h @@ -0,0 +1,26 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +class RiuPlotItem +{ +public: + explicit RiuPlotItem(){}; + virtual ~RiuPlotItem(){}; +}; diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp new file mode 100644 index 0000000000..cb88347f48 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp @@ -0,0 +1,242 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuQwtPlotWidget.h" + +#include "RiaPlotDefines.h" +#include "RiaPlotWindowRedrawScheduler.h" +#include "RimPlot.h" + +#include "RiuDraggableOverlayFrame.h" + +#include "cafAssert.h" + +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotWidget::RiuPlotWidget( RimPlot* plotDefinition, QWidget* parent ) + : QWidget( parent ) + , m_plotDefinition( plotDefinition ) + , m_overlayMargins( 5 ) + , m_plotTitle( "" ) + , m_plotTitleEnabled( true ) +{ + CAF_ASSERT( m_plotDefinition ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotWidget::~RiuPlotWidget() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimPlot* RiuPlotWidget::plotDefinition() +{ + return m_plotDefinition; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuPlotWidget::isChecked() const +{ + if ( m_plotDefinition ) + { + return m_plotDefinition->showWindow(); + } + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuPlotWidget::colSpan() const +{ + if ( m_plotDefinition ) + { + return m_plotDefinition->colSpan(); + } + return 1; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuPlotWidget::rowSpan() const +{ + if ( m_plotDefinition ) + { + return m_plotDefinition->rowSpan(); + } + return 1; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QString& RiuPlotWidget::plotTitle() const +{ + return m_plotTitle; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotWidget::setPlotTitleEnabled( bool enabled ) +{ + m_plotTitleEnabled = enabled; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuPlotWidget::plotTitleEnabled() const +{ + return m_plotTitleEnabled; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QPoint RiuPlotWidget::dragStartPosition() const +{ + return m_clickPosition; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotWidget::scheduleReplot() +{ + RiaPlotWindowRedrawScheduler::instance()->schedulePlotWidgetReplot( this ); +} + +//-------------------------------------------------------------------------------------------------- +/// Adds an overlay frame. The overlay frame becomes the responsibility of the plot widget +//-------------------------------------------------------------------------------------------------- +void RiuPlotWidget::addOverlayFrame( RiuDraggableOverlayFrame* overlayFrame ) +{ + if ( std::find( m_overlayFrames.begin(), m_overlayFrames.end(), overlayFrame ) == m_overlayFrames.end() ) + { + overlayFrame->setParent( getParentForOverlay() ); + m_overlayFrames.push_back( overlayFrame ); + updateLayout(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// Remove the overlay widget. The frame becomes the responsibility of the caller +//-------------------------------------------------------------------------------------------------- +void RiuPlotWidget::removeOverlayFrame( RiuDraggableOverlayFrame* overlayFrame ) +{ + CAF_ASSERT( overlayFrame ); + + overlayFrame->hide(); + overlayFrame->setParent( nullptr ); + m_overlayFrames.removeOne( overlayFrame ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotWidget::removeEventFilter() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotWidget::updateOverlayFrameLayout() +{ + const int spacing = 5; + + int xpos = spacing; + int ypos = spacing; + int widthOfCurrentColumn = 0; + + QSize canvasSize = getParentForOverlay()->size(); + QSize maxFrameSize( canvasSize.width() - 2 * m_overlayMargins, canvasSize.height() - 2 * m_overlayMargins ); + + for ( RiuDraggableOverlayFrame* frame : m_overlayFrames ) + { + if ( frame ) + { + QSize minFrameSize = frame->minimumSizeHint(); + QSize desiredFrameSize = frame->sizeHint(); + + int width = std::min( std::max( minFrameSize.width(), desiredFrameSize.width() ), maxFrameSize.width() ); + int height = std::min( std::max( minFrameSize.height(), desiredFrameSize.height() ), maxFrameSize.height() ); + + frame->resize( width, height ); + + if ( frame->anchorCorner() == RiuDraggableOverlayFrame::AnchorCorner::TopLeft ) + { + if ( ypos + frame->height() + spacing > getParentForOverlay()->height() && widthOfCurrentColumn > 0 ) + { + xpos += spacing + widthOfCurrentColumn; + ypos = spacing; + widthOfCurrentColumn = 0; + } + frame->move( xpos, ypos ); + ypos += frame->height() + spacing; + widthOfCurrentColumn = std::max( widthOfCurrentColumn, frame->width() ); + } + else if ( frame->anchorCorner() == RiuDraggableOverlayFrame::AnchorCorner::TopRight ) + { + QRect frameRect = frame->frameGeometry(); + QRect canvasRect = getParentForOverlay()->rect(); + QPoint canvasTopRight = canvasRect.topRight(); + frameRect.moveTopRight( QPoint( canvasTopRight.x() - spacing, canvasTopRight.y() + spacing ) ); + frame->move( frameRect.topLeft() ); + } + frame->show(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuPlotWidget::overlayMargins() const +{ + return m_overlayMargins; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimViewWindow* RiuPlotWidget::ownerViewWindow() const +{ + return m_plotDefinition; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuPlotWidget::defaultMinimumWidth() +{ + return 80; +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.h b/ApplicationLibCode/UserInterface/RiuPlotWidget.h new file mode 100644 index 0000000000..9217ae2a29 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.h @@ -0,0 +1,194 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaPlotDefines.h" + +#include "RiuInterfaceToViewWindow.h" + +#include "cafPdmObject.h" +#include "cafPdmPointer.h" + +#include +#include + +class RiaPlotWindowRedrawScheduler; +class RimPlot; +class RimPlotCurve; + +class RiuDraggableOverlayFrame; +class RiuPlotCurve; + +class QPainter; +class QPaintDevice; + +//================================================================================================== +// +// +// +//================================================================================================== +class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow +{ + Q_OBJECT + +public: + enum class AxisScaleType + { + LINEAR, + LOGARITHMIC, + DATE + }; + + enum class Legend + { + BOTTOM, + TOP, + LEFT, + RIGHT + }; + + enum class PlotItemType + { + CURVE, + LEGEND + }; + + RiuPlotWidget( RimPlot* plotDefinition, QWidget* parent = nullptr ); + ~RiuPlotWidget() override; + + RimPlot* plotDefinition(); + + bool isChecked() const; + + int colSpan() const; + int rowSpan() const; + + virtual int axisTitleFontSize( RiaDefines::PlotAxis axis ) const = 0; + virtual int axisValueFontSize( RiaDefines::PlotAxis axis ) const = 0; + virtual void setAxisFontsAndAlignment( RiaDefines::PlotAxis, + int titleFontSize, + int valueFontSize, + bool titleBold = false, + int alignment = (int)Qt::AlignCenter ) = 0; + virtual void setAxesFontsAndAlignment( int titleFontSize, + int valueFontSize, + bool titleBold = false, + int alignment = (int)Qt::AlignCenter ) = 0; + + virtual void enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) = 0; + virtual bool axisEnabled( RiaDefines::PlotAxis axis ) const = 0; + + virtual void setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) = 0; + virtual void setAxisAutoScale( RiaDefines::PlotAxis axis, bool enable ) = 0; + + virtual void setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) = 0; + virtual void setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) = 0; + + virtual RiuPlotWidget::AxisScaleType axisScaleType( RiaDefines::PlotAxis axis ) const = 0; + virtual void setAxisScaleType( RiaDefines::PlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) = 0; + + virtual void setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) = 0; + virtual void setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) = 0; + + virtual void setPlotTitle( const QString& plotTitle ) = 0; + const QString& plotTitle() const; + void setPlotTitleEnabled( bool enabled ); + bool plotTitleEnabled() const; + virtual void setPlotTitleFontSize( int titleFontSize ) = 0; + + virtual void setLegendFontSize( int fontSize ) = 0; + virtual void setInternalLegendVisible( bool visible ) = 0; + virtual void insertLegend( RiuPlotWidget::Legend ) = 0; + virtual void clearLegend() = 0; + virtual void updateLegend() = 0; + + virtual void detachItems( RiuPlotWidget::PlotItemType plotItemType ) = 0; + + virtual std::pair axisRange( RiaDefines::PlotAxis axis ) const = 0; + virtual void setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) = 0; + + virtual void setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) = 0; + virtual void setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) = 0; + + virtual void enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) = 0; + + virtual void setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minValue, + double maxValue ) = 0; + virtual void setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minTickValue, + double maxTickValue, + double rangeMin, + double rangeMax ) = 0; + + virtual void setAutoTickIntervalCounts( RiaDefines::PlotAxis axis, + int maxMajorTickIntervalCount, + int maxMinorTickIntervalCount ) = 0; + virtual double majorTickInterval( RiaDefines::PlotAxis axis ) const = 0; + virtual double minorTickInterval( RiaDefines::PlotAxis axis ) const = 0; + + virtual int axisExtent( RiaDefines::PlotAxis axis ) const = 0; + + QPoint dragStartPosition() const; + + void scheduleReplot(); + virtual void replot() = 0; + + void addOverlayFrame( RiuDraggableOverlayFrame* overlayWidget ); + void removeOverlayFrame( RiuDraggableOverlayFrame* overlayWidget ); + virtual void updateLayout() = 0; + + virtual void renderTo( QPainter* painter, const QRect& targetRect, double scaling ) = 0; + virtual void renderTo( QPaintDevice* painter, const QRect& targetRect ) = 0; + int overlayMargins() const; + + RimViewWindow* ownerViewWindow() const override; + + virtual void removeEventFilter(); + + virtual void updateAxes() = 0; + + virtual RiuPlotCurve* createPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title, const QColor& color ) = 0; + + virtual const QColor& backgroundColor() const = 0; + + virtual QWidget* getParentForOverlay() const = 0; + + virtual std::pair findClosestCurve( const QPoint& pos, double& distanceToClick ) const = 0; + +protected: + void updateOverlayFrameLayout(); + + static int defaultMinimumWidth(); + + caf::PdmPointer m_plotDefinition; + QPoint m_clickPosition; + std::map m_axisTitles; + std::map m_axisTitlesEnabled; + const int m_overlayMargins; + QString m_plotTitle; + bool m_plotTitleEnabled; + + QList> m_overlayFrames; +}; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartView.cpp b/ApplicationLibCode/UserInterface/RiuQtChartView.cpp index df58794e72..d96617eff1 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartView.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartView.cpp @@ -27,7 +27,7 @@ RiuQtChartView::RiuQtChartView( RimPlotWindow* plotWindow, QWidget* parent ) : QtCharts::QChartView( parent ) , m_plotWindow( plotWindow ) { - CAF_ASSERT( m_plotWindow ); + setMouseTracking( true ); } //-------------------------------------------------------------------------------------------------- @@ -44,3 +44,57 @@ RimViewWindow* RiuQtChartView::ownerViewWindow() const { return m_plotWindow; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartView::mousePressEvent( QMouseEvent* event ) +{ + if ( event->buttons() & Qt::MiddleButton ) + { + m_isPanning = true; + m_panStartPosition = event->pos(); + setCursor( Qt::ClosedHandCursor ); + event->accept(); + } + else + { + event->ignore(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartView::mouseReleaseEvent( QMouseEvent* event ) +{ + if ( event->buttons() & Qt::MiddleButton ) + { + m_isPanning = false; + setCursor( Qt::ArrowCursor ); + event->accept(); + } + else + { + event->ignore(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartView::mouseMoveEvent( QMouseEvent* event ) +{ + if ( event->buttons() & Qt::MiddleButton && m_isPanning ) + { + QPoint newPosition = event->pos(); + QPointF delta = mapToScene( newPosition ) - mapToScene( m_panStartPosition ); + chart()->scroll( -delta.x(), delta.y() ); + m_panStartPosition = newPosition; + event->accept(); + } + else + { + event->ignore(); + } +} diff --git a/ApplicationLibCode/UserInterface/RiuQtChartView.h b/ApplicationLibCode/UserInterface/RiuQtChartView.h index 34a1dc5f54..9edea6bca5 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartView.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartView.h @@ -37,6 +37,14 @@ class RiuQtChartView : public QtCharts::QChartView, public RiuInterfaceToViewWin RimViewWindow* ownerViewWindow() const override; +protected: + void mouseReleaseEvent( QMouseEvent* event ) override; + void mousePressEvent( QMouseEvent* event ) override; + void mouseMoveEvent( QMouseEvent* event ) override; + private: caf::PdmPointer m_plotWindow; + + bool m_isPanning; + QPoint m_panStartPosition; }; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp new file mode 100644 index 0000000000..a12684eb25 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -0,0 +1,390 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuQtChartsPlotCurve.h" + +#include "RiaPlotDefines.h" + +#include "RiuQtChartsPlotCurveSymbol.h" +#include "RiuQtChartsPlotWidget.h" + +#include "cvfBoundingBox.h" + +#include +#include +#include + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuQtChartsPlotCurve::RiuQtChartsPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title ) + : RiuPlotCurve( ownerRimCurve, title ) +{ + m_plotWidget = nullptr; + + m_lineSeries = new QtCharts::QLineSeries(); + m_lineSeries->setName( title ); + + m_scatterSeries = new QtCharts::QScatterSeries(); + m_scatterSeries->setName( title ); + + m_axisX = RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM; + m_axisY = RiaDefines::PlotAxis::PLOT_AXIS_LEFT; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuQtChartsPlotCurve::~RiuQtChartsPlotCurve() +{ + detach(); + + // Delete if it is still owned by by plot curve + delete m_lineSeries; + m_lineSeries = nullptr; + + delete m_scatterSeries; + m_scatterSeries = nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setTitle( const QString& title ) +{ + lineSeries()->setName( title ); + scatterSeries()->setName( title ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle, + RiuQwtPlotCurveDefines::CurveInterpolationEnum interpolationType, + int requestedCurveThickness, + const QColor& curveColor, + const QBrush& fillBrush /* = QBrush( Qt::NoBrush )*/ ) +{ + Qt::PenStyle penStyle = RiuQwtPlotCurveDefines::convertToPenStyle( lineStyle ); + + QPen curvePen( curveColor ); + curvePen.setWidth( requestedCurveThickness ); + curvePen.setStyle( penStyle ); + + lineSeries()->setPen( curvePen ); + lineSeries()->setBrush( fillBrush ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setBrush( const QBrush& brush ) +{ + lineSeries()->setBrush( brush ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::attachToPlot( RiuPlotWidget* plotWidget ) +{ + m_plotWidget = dynamic_cast( plotWidget ); + CAF_ASSERT( m_plotWidget ); + + if ( m_plotWidget->getLineSeries( this ) && m_plotWidget->getScatterSeries( this ) ) + { + m_plotWidget->qtChart()->legend()->setMarkerShape( QtCharts::QLegend::MarkerShape::MarkerShapeFromSeries ); + setVisibleInLegend( true ); + lineSeries()->show(); + } + else + { + m_plotWidget->attach( this, lineSeries(), scatterSeries(), m_axisX, m_axisY ); + // Plot widget takes ownership. + m_lineSeries = nullptr; + m_scatterSeries = nullptr; + } + + if ( scatterSeries() ) + { + if ( m_symbol ) + { + scatterSeries()->show(); + auto qtChartsSymbol = dynamic_cast( m_symbol.get() ); + CAF_ASSERT( qtChartsSymbol ); + qtChartsSymbol->applyToScatterSeries( scatterSeries() ); + } + else + { + scatterSeries()->hide(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::detach() +{ + QtCharts::QLineSeries* line = lineSeries(); + if ( line ) + { + line->hide(); + } + + QtCharts::QScatterSeries* scatter = scatterSeries(); + if ( scatter ) + { + scatter->hide(); + } + + if ( m_plotWidget ) setVisibleInLegend( false ); + + m_plotWidget = nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::showInPlot() +{ + // show(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, + const std::vector& yValues, + int numValues ) +{ + CAF_ASSERT( xValues.size() == yValues.size() ); + CAF_ASSERT( numValues <= static_cast( xValues.size() ) ); + CAF_ASSERT( numValues >= 0 ); + + QtCharts::QLineSeries* line = lineSeries(); + QtCharts::QScatterSeries* scatter = scatterSeries(); + + line->clear(); + scatter->clear(); + for ( int i = 0; i < numValues; i++ ) + { + line->append( xValues[i], yValues[i] ); + scatter->append( xValues[i], yValues[i] ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setZ( int z ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::clearErrorBars() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::updateErrorBarsAppearance( bool showErrorBars, const QColor& curveColor ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setXAxis( RiaDefines::PlotAxis axis ) +{ + m_axisX = axis; + if ( m_plotWidget ) + { + m_plotWidget->setXAxis( axis, lineSeries() ); + m_plotWidget->setXAxis( axis, scatterSeries() ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setYAxis( RiaDefines::PlotAxis axis ) +{ + m_axisY = axis; + if ( m_plotWidget ) + { + m_plotWidget->setYAxis( axis, lineSeries() ); + m_plotWidget->setYAxis( axis, scatterSeries() ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuQtChartsPlotCurve::numSamples() const +{ + return lineSeries()->count(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RiuQtChartsPlotCurve::sample( int index ) const +{ + CAF_ASSERT( index >= 0 && index <= numSamples() ); + auto p = lineSeries()->at( index ); + return std::make_pair( p.x(), p.y() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RiuQtChartsPlotCurve::xDataRange() const +{ + cvf::BoundingBox bb = computeBoundingBox(); + return std::make_pair( bb.min().x(), bb.max().x() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RiuQtChartsPlotCurve::yDataRange() const +{ + cvf::BoundingBox bb = computeBoundingBox(); + return std::make_pair( bb.min().y(), bb.max().y() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::BoundingBox RiuQtChartsPlotCurve::computeBoundingBox() const +{ + auto points = lineSeries()->pointsVector(); + + cvf::BoundingBox bb; + for ( auto p : points ) + bb.add( cvf::Vec3d( p.x(), p.y(), 0.0 ) ); + + return bb; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setVisibleInLegend( bool isVisibleInLegend ) +{ + if ( !m_plotWidget ) return; + + CAF_ASSERT( m_plotWidget->qtChart() ); + CAF_ASSERT( m_plotWidget->qtChart()->legend() ); + + if ( scatterSeries() ) + { + auto markers = m_plotWidget->qtChart()->legend()->markers( scatterSeries() ); + if ( !markers.isEmpty() ) markers[0]->setVisible( isVisibleInLegend ); + + auto lineSeriesMarkers = m_plotWidget->qtChart()->legend()->markers( lineSeries() ); + if ( !lineSeriesMarkers.isEmpty() ) lineSeriesMarkers[0]->setVisible( false ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QtCharts::QLineSeries* RiuQtChartsPlotCurve::lineSeries() const +{ + if ( m_lineSeries ) + return m_lineSeries; + else if ( m_plotWidget ) + return dynamic_cast( m_plotWidget->getLineSeries( this ) ); + else + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QtCharts::QScatterSeries* RiuQtChartsPlotCurve::scatterSeries() const +{ + if ( m_scatterSeries ) + return m_scatterSeries; + else if ( m_plotWidget ) + return dynamic_cast( m_plotWidget->getScatterSeries( this ) ); + else + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setSymbol( RiuPlotCurveSymbol* symbol ) +{ + if ( symbol ) + { + auto qtChartsSymbol = dynamic_cast( symbol ); + CAF_ASSERT( qtChartsSymbol ); + m_symbol.reset( symbol ); + + if ( scatterSeries() ) + { + qtChartsSymbol->applyToScatterSeries( scatterSeries() ); + } + } + else + { + m_symbol.reset(); + if ( scatterSeries() ) scatterSeries()->hide(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotCurveSymbol* RiuQtChartsPlotCurve::createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const +{ + return new RiuQtChartsPlotCurveSymbol( symbol ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setLegendIconSize( const QSize& iconSize ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QSize RiuQtChartsPlotCurve::legendIconSize() const +{ + // Default from Qwt + return QSize( 8, 8 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QPixmap RiuQtChartsPlotCurve::legendIcon( const QSizeF& iconSize ) const +{ + return QPixmap(); +} diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h new file mode 100644 index 0000000000..07c7bac9ea --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiuPlotCurve.h" +#include "RiuQwtPlotCurveDefines.h" + +#include "cvfBoundingBox.h" + +#include +#include + +class RiuQtChartsPlotWidget; +class RiuPlotCurveSymbol; + +//================================================================================================== +// +//================================================================================================== +class RiuQtChartsPlotCurve : public RiuPlotCurve +{ +public: + explicit RiuQtChartsPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title = QString() ); + ~RiuQtChartsPlotCurve() override; + + void setTitle( const QString& title ) override; + + void setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle, + RiuQwtPlotCurveDefines::CurveInterpolationEnum interpolationType, + int curveThickness, + const QColor& curveColor, + const QBrush& fillBrush = QBrush( Qt::NoBrush ) ) override; + + void setBrush( const QBrush& brush ) override; + + void setLegendIconSize( const QSize& iconSize ) override; + QSize legendIconSize() const override; + QPixmap legendIcon( const QSizeF& size ) const override; + + void attachToPlot( RiuPlotWidget* plotWidget ) override; + void showInPlot() override; + + void setZ( int z ) override; + + void updateErrorBarsAppearance( bool showErrorBars, const QColor& curveColor ) override; + void clearErrorBars() override; + + int numSamples() const override; + std::pair sample( int index ) const override; + + std::pair xDataRange() const override; + std::pair yDataRange() const override; + + void detach() override; + + void setXAxis( RiaDefines::PlotAxis axis ) override; + void setYAxis( RiaDefines::PlotAxis axis ) override; + + void setVisibleInLegend( bool isVisibleInLegend ) override; + + void setSymbol( RiuPlotCurveSymbol* symbol ) override; + + RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override; + +protected: + void setSamplesInPlot( const std::vector&, const std::vector&, int ) override; + + QtCharts::QLineSeries* lineSeries() const; + QtCharts::QScatterSeries* scatterSeries() const; + + cvf::BoundingBox computeBoundingBox() const; + + QtCharts::QLineSeries* m_lineSeries; + QtCharts::QScatterSeries* m_scatterSeries; + std::shared_ptr m_symbol; + RiuQtChartsPlotWidget* m_plotWidget; + RiaDefines::PlotAxis m_axisX; + RiaDefines::PlotAxis m_axisY; +}; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp new file mode 100644 index 0000000000..50aad6fa70 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp @@ -0,0 +1,618 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Equinor 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuQtChartsPlotCurveSymbol.h" + +#include "RiaColorTools.h" +#include "RiaFontCache.h" +#include "RiaLogging.h" + +#include "RiuPlotCurveSymbol.h" +#include "cvfAssert.h" + +#include +#include +#include + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuQtChartsPlotCurveSymbol::RiuQtChartsPlotCurveSymbol( PointSymbolEnum riuStyle, + const QString& label, + LabelPosition labelPosition, + int labelFontSizePt ) + : RiuPlotCurveSymbol( riuStyle, label, labelPosition, labelFontSizePt ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurveSymbol::setSize( int width, int height ) +{ + m_size = std::min( width, height ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurveSymbol::setColor( const QColor& color ) +{ + m_color = color; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurveSymbol::setPen( const QPen& pen ) +{ + m_pen = pen; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurveSymbol::setPixmap( const QPixmap& pixmap ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurveSymbol::applyToScatterSeries( QtCharts::QScatterSeries* series ) const +{ + if ( m_style == PointSymbolEnum::SYMBOL_NONE ) + { + series->hide(); + return; + } + + series->show(); + + if ( m_style == PointSymbolEnum::SYMBOL_RECT ) + { + setImageBrush( series, createRectImage() ); + } + else if ( m_style == PointSymbolEnum::SYMBOL_ELLIPSE ) + { + setImageBrush( series, createEllipseImage() ); + } + else if ( m_style == PointSymbolEnum::SYMBOL_CROSS ) + { + setImageBrush( series, createCrossImage() ); + } + else if ( m_style == PointSymbolEnum::SYMBOL_XCROSS ) + { + setImageBrush( series, createXCrossImage() ); + } + else if ( m_style == PointSymbolEnum::SYMBOL_DIAMOND ) + { + setImageBrush( series, createDiamondImage() ); + } + else if ( m_style == PointSymbolEnum::SYMBOL_HEXAGON ) + { + setImageBrush( series, createHexagonImage() ); + } + else if ( m_style == PointSymbolEnum::SYMBOL_STAR1 ) + { + setImageBrush( series, createStar1Image() ); + } + else if ( m_style == PointSymbolEnum::SYMBOL_STAR1 ) + { + setImageBrush( series, createStar1Image() ); + } + else if ( m_style == PointSymbolEnum::SYMBOL_STAR2 ) + { + setImageBrush( series, createStar2Image() ); + } + else if ( m_style == PointSymbolEnum::SYMBOL_TRIANGLE || m_style == PointSymbolEnum::SYMBOL_UP_TRIANGLE || + m_style == PointSymbolEnum::SYMBOL_DOWN_TRIANGLE || m_style == PointSymbolEnum::SYMBOL_LEFT_TRIANGLE || + m_style == PointSymbolEnum::SYMBOL_RIGHT_TRIANGLE ) + { + setImageBrush( series, createTriangleImage( m_style ) ); + } + else + { + RiaLogging::warning( "Missing symbol style." ); + } + + series->setMarkerSize( m_size ); + series->setColor( m_color ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurveSymbol::setImageBrush( QtCharts::QScatterSeries* series, const QImage& image ) const +{ + series->setMarkerShape( QtCharts::QScatterSeries::MarkerShapeRectangle ); + series->setBrush( image ); + series->setPen( QColor( Qt::transparent ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// Adapted from QwtSymbol::qwtDrawTriangleSymbols +//-------------------------------------------------------------------------------------------------- +QImage RiuQtChartsPlotCurveSymbol::createTriangleImage( RiuPlotCurveSymbol::PointSymbolEnum symbolStyle ) const +{ + QSize size( m_size, m_size ); + + QImage star( size.width(), size.height(), QImage::Format_ARGB32 ); + star.fill( Qt::transparent ); + + QPainter painter( &star ); + painter.setRenderHint( QPainter::Antialiasing ); + + QPen pen( m_pen ); + pen.setWidth( 1.0 ); + pen.setJoinStyle( Qt::MiterJoin ); + + painter.setPen( pen ); + painter.setBrush( m_color ); + + double sw2 = 0.5 * size.width(); + double sh2 = 0.5 * size.height(); + + QPolygonF triangle( 3 ); + QPointF* trianglePoints = triangle.data(); + + double x = size.width() * 0.5; + double y = size.width() * 0.5; + + const double x1 = x - sw2; + const double x2 = x1 + size.width(); + const double y1 = y - sh2; + const double y2 = y1 + size.height(); + + if ( symbolStyle == PointSymbolEnum::SYMBOL_LEFT_TRIANGLE ) + { + trianglePoints[0].rx() = x2; + trianglePoints[0].ry() = y1; + + trianglePoints[1].rx() = x1; + trianglePoints[1].ry() = y; + + trianglePoints[2].rx() = x2; + trianglePoints[2].ry() = y2; + } + + if ( symbolStyle == PointSymbolEnum::SYMBOL_RIGHT_TRIANGLE ) + { + trianglePoints[0].rx() = x1; + trianglePoints[0].ry() = y1; + + trianglePoints[1].rx() = x2; + trianglePoints[1].ry() = y; + + trianglePoints[2].rx() = x1; + trianglePoints[2].ry() = y2; + } + + if ( symbolStyle == PointSymbolEnum::SYMBOL_UP_TRIANGLE || symbolStyle == PointSymbolEnum::SYMBOL_TRIANGLE ) + { + trianglePoints[0].rx() = x1; + trianglePoints[0].ry() = y2; + + trianglePoints[1].rx() = x; + trianglePoints[1].ry() = y1; + + trianglePoints[2].rx() = x2; + trianglePoints[2].ry() = y2; + } + + if ( symbolStyle == PointSymbolEnum::SYMBOL_DOWN_TRIANGLE ) + { + trianglePoints[0].rx() = x1; + trianglePoints[0].ry() = y1; + + trianglePoints[1].rx() = x; + trianglePoints[1].ry() = y2; + + trianglePoints[2].rx() = x2; + trianglePoints[2].ry() = y1; + } + + painter.drawPolygon( triangle ); + + return star; +} + +//-------------------------------------------------------------------------------------------------- +/// Adapted from QwtSymbol::qwtDrawLineSymbols +//-------------------------------------------------------------------------------------------------- +QImage RiuQtChartsPlotCurveSymbol::createCrossImage() const +{ + const QSize size( m_size, m_size ); + + QImage image( m_size, m_size, QImage::Format_ARGB32 ); + image.fill( Qt::transparent ); + + QPainter painter( &image ); + painter.setRenderHint( QPainter::Antialiasing ); + + QPen pen( m_pen ); + pen.setWidth( 1.0 ); + pen.setJoinStyle( Qt::MiterJoin ); + + painter.setPen( pen ); + painter.setBrush( m_color ); + + const double sw = size.width(); + const double sh = size.height(); + const double sw2 = 0.5 * size.width(); + const double sh2 = 0.5 * size.height(); + + double midX = size.width() * 0.5; + double midY = size.height() * 0.5; + + { + const double x = midX - sw2; + const double y = midY; + + painter.drawLine( x, y, x + sw, y ); + } + { + const double y = midY - sh2; + const double x = midX; + + painter.drawLine( x, y, x, y + sh ); + } + + return image; +} + +//-------------------------------------------------------------------------------------------------- +/// Adapted from QwtSymbol::qwtDrawXCrossSymbols +//-------------------------------------------------------------------------------------------------- +QImage RiuQtChartsPlotCurveSymbol::createXCrossImage() const +{ + const QSize size( m_size, m_size ); + + QImage image( m_size, m_size, QImage::Format_ARGB32 ); + image.fill( Qt::transparent ); + + QPainter painter( &image ); + painter.setRenderHint( QPainter::Antialiasing ); + + QPen pen( m_pen ); + pen.setWidth( 1.0 ); + pen.setJoinStyle( Qt::MiterJoin ); + + painter.setPen( pen ); + painter.setBrush( m_color ); + + const double sw = size.width(); + const double sh = size.height(); + const double sw2 = 0.5 * size.width(); + const double sh2 = 0.5 * size.height(); + + double midX = size.width() * 0.5; + double midY = size.height() * 0.5; + + const double x1 = midX - sw2; + const double x2 = x1 + sw; + const double y1 = midY - sh2; + const double y2 = y1 + sh; + + painter.drawLine( x1, y1, x2, y2 ); + painter.drawLine( x1, y2, x2, y1 ); + + return image; +} + +//-------------------------------------------------------------------------------------------------- +/// Adapted from QwtSymbol::qwtDrawRectSymbols +//-------------------------------------------------------------------------------------------------- +QImage RiuQtChartsPlotCurveSymbol::createRectImage() const +{ + const QSize size( m_size, m_size ); + + QImage image( m_size, m_size, QImage::Format_ARGB32 ); + image.fill( Qt::transparent ); + + QPainter painter( &image ); + painter.setRenderHint( QPainter::Antialiasing ); + + QPen pen( m_pen ); + pen.setWidth( 1.0 ); + pen.setJoinStyle( Qt::MiterJoin ); + + painter.setPen( pen ); + painter.setBrush( m_color ); + + const double sw = size.width(); + const double sh = size.height(); + const double sw2 = 0.5 * size.width(); + const double sh2 = 0.5 * size.height(); + + // Mid point + const double x = sw * 0.5; + const double y = sw * 0.5; + + const QRectF r( x - sw2, y - sh2, sw, sh ); + painter.drawRect( r ); + + return image; +} + +//-------------------------------------------------------------------------------------------------- +/// Adapted from QwtSymbol::qwtDrawEllipseSymbols +//-------------------------------------------------------------------------------------------------- +QImage RiuQtChartsPlotCurveSymbol::createEllipseImage() const +{ + const QSize size( m_size, m_size ); + + QImage image( m_size, m_size, QImage::Format_ARGB32 ); + image.fill( Qt::transparent ); + + QPainter painter( &image ); + painter.setRenderHint( QPainter::Antialiasing ); + + QPen pen( m_pen ); + pen.setWidth( 1.0 ); + pen.setJoinStyle( Qt::MiterJoin ); + + painter.setPen( pen ); + painter.setBrush( m_color ); + + const double sw = size.width(); + const double sh = size.height(); + const double sw2 = 0.5 * size.width(); + const double sh2 = 0.5 * size.height(); + + // Mid point + const double x = sw * 0.5; + const double y = sw * 0.5; + + const QRectF r( x - sw2, y - sh2, sw, sh ); + painter.drawEllipse( r ); + + return image; +} + +//-------------------------------------------------------------------------------------------------- +/// Adapted from QwtSymbol::qwtDrawStar1Symbols +//-------------------------------------------------------------------------------------------------- +QImage RiuQtChartsPlotCurveSymbol::createStar1Image() const +{ + QImage image( m_size, m_size, QImage::Format_ARGB32 ); + image.fill( Qt::transparent ); + + QPainter painter( &image ); + painter.setRenderHint( QPainter::Antialiasing ); + + QPen pen( m_pen ); + pen.setWidth( 1.0 ); + pen.setJoinStyle( Qt::MiterJoin ); + + painter.setPen( pen ); + painter.setBrush( m_color ); + + QRectF r( 0, 0, m_size, m_size ); + + const double sqrt1_2 = 1.0 / sqrt( 2 ); + + const QPointF c = r.center(); + const double d1 = r.width() / 2.0 * ( 1.0 - sqrt1_2 ); + + painter.drawLine( r.left() + d1, r.top() + d1, r.right() - d1, r.bottom() - d1 ); + painter.drawLine( r.left() + d1, r.bottom() - d1, r.right() - d1, r.top() + d1 ); + painter.drawLine( c.x(), r.top(), c.x(), r.bottom() ); + painter.drawLine( r.left(), c.y(), r.right(), c.y() ); + + return image; +} + +//-------------------------------------------------------------------------------------------------- +/// Adapted from QwtSymbol::qwtDrawStar2Symbols +//-------------------------------------------------------------------------------------------------- +QImage RiuQtChartsPlotCurveSymbol::createStar2Image() const +{ + QImage image( m_size, m_size, QImage::Format_ARGB32 ); + image.fill( Qt::transparent ); + + QPainter painter( &image ); + painter.setRenderHint( QPainter::Antialiasing ); + + QPen pen( m_pen ); + pen.setWidth( 1.0 ); + pen.setJoinStyle( Qt::MiterJoin ); + + painter.setPen( pen ); + painter.setBrush( m_color ); + + QRectF r( 0, 0, m_size, m_size ); + + const double cos30 = 0.866025; // cos(30°) + + const double dy = 0.25 * m_size; + const double dx = 0.5 * m_size * cos30 / 3.0; + + QPolygonF star( 12 ); + QPointF* starPoints = star.data(); + + double x = m_size * 0.5; + double y = m_size * 0.5; + + double x1 = x - 3 * dx; + double y1 = y - 2 * dy; + + const double x2 = x1 + 1 * dx; + const double x3 = x1 + 2 * dx; + const double x4 = x1 + 3 * dx; + const double x5 = x1 + 4 * dx; + const double x6 = x1 + 5 * dx; + const double x7 = x1 + 6 * dx; + + const double y2 = y1 + 1 * dy; + const double y3 = y1 + 2 * dy; + const double y4 = y1 + 3 * dy; + const double y5 = y1 + 4 * dy; + + starPoints[0].rx() = x4; + starPoints[0].ry() = y1; + + starPoints[1].rx() = x5; + starPoints[1].ry() = y2; + + starPoints[2].rx() = x7; + starPoints[2].ry() = y2; + + starPoints[3].rx() = x6; + starPoints[3].ry() = y3; + + starPoints[4].rx() = x7; + starPoints[4].ry() = y4; + + starPoints[5].rx() = x5; + starPoints[5].ry() = y4; + + starPoints[6].rx() = x4; + starPoints[6].ry() = y5; + + starPoints[7].rx() = x3; + starPoints[7].ry() = y4; + + starPoints[8].rx() = x1; + starPoints[8].ry() = y4; + + starPoints[9].rx() = x2; + starPoints[9].ry() = y3; + + starPoints[10].rx() = x1; + starPoints[10].ry() = y2; + + starPoints[11].rx() = x3; + starPoints[11].ry() = y2; + + painter.drawPolygon( star ); + + return image; +} + +//-------------------------------------------------------------------------------------------------- +/// Adapted from QwtSymbol::qwtDrawHexagonSymbols +//-------------------------------------------------------------------------------------------------- +QImage RiuQtChartsPlotCurveSymbol::createHexagonImage() const +{ + QImage image( m_size, m_size, QImage::Format_ARGB32 ); + image.fill( Qt::transparent ); + + QPainter painter( &image ); + painter.setRenderHint( QPainter::Antialiasing ); + + QPen pen( m_pen ); + pen.setWidth( 1.0 ); + pen.setJoinStyle( Qt::MiterJoin ); + + painter.setPen( pen ); + painter.setBrush( m_color ); + + QRectF r( 0, 0, m_size, m_size ); + + const double cos30 = 0.866025; // cos(30°) + const double dx = 0.5 * ( m_size - cos30 ); + + const double dy = 0.25 * m_size; + + QPolygonF hexaPolygon( 6 ); + QPointF* hexaPoints = hexaPolygon.data(); + + double x = m_size * 0.5; + double y = m_size * 0.5; + + double x1 = x - dx; + double y1 = y - 2 * dy; + + const double x2 = x1 + 1 * dx; + const double x3 = x1 + 2 * dx; + + const double y2 = y1 + 1 * dy; + const double y3 = y1 + 3 * dy; + const double y4 = y1 + 4 * dy; + + hexaPoints[0].rx() = x2; + hexaPoints[0].ry() = y1; + + hexaPoints[1].rx() = x3; + hexaPoints[1].ry() = y2; + + hexaPoints[2].rx() = x3; + hexaPoints[2].ry() = y3; + + hexaPoints[3].rx() = x2; + hexaPoints[3].ry() = y4; + + hexaPoints[4].rx() = x1; + hexaPoints[4].ry() = y3; + + hexaPoints[5].rx() = x1; + hexaPoints[5].ry() = y2; + + painter.drawPolygon( hexaPolygon ); + return image; +} + +//-------------------------------------------------------------------------------------------------- +/// Adapted from QwtSymbol::qwtDrawDiamondSymbols +//-------------------------------------------------------------------------------------------------- +QImage RiuQtChartsPlotCurveSymbol::createDiamondImage() const +{ + QImage image( m_size, m_size, QImage::Format_ARGB32 ); + image.fill( Qt::transparent ); + + QPainter painter( &image ); + painter.setRenderHint( QPainter::Antialiasing ); + + QPen pen( m_pen ); + pen.setWidth( 1.0 ); + pen.setJoinStyle( Qt::MiterJoin ); + + painter.setPen( pen ); + painter.setBrush( m_color ); + + QSize size( m_size, m_size ); + + double x = size.width() * 0.5; + double y = size.height() * 0.5; + const double x1 = x - 0.5 * size.width(); + const double y1 = y - 0.5 * size.height(); + const double x2 = x1 + size.width(); + const double y2 = y1 + size.height(); + + QPolygonF polygon; + polygon += QPointF( x, y1 ); + polygon += QPointF( x2, y ); + polygon += QPointF( x, y2 ); + polygon += QPointF( x1, y ); + + painter.drawPolygon( polygon ); + + return image; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QRect RiuQtChartsPlotCurveSymbol::boundingRect() const +{ + return QRect( 0, 0, m_size, m_size ); +} diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h new file mode 100644 index 0000000000..7f9a531934 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h @@ -0,0 +1,79 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Equinor 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiuPlotCurveSymbol.h" + +#include +#include +#include +#include + +class QPainter; +class QPointF; +class QRect; + +namespace QtCharts +{ +class QScatterSeries; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RiuQtChartsPlotCurveSymbol : public RiuPlotCurveSymbol +{ +public: + RiuQtChartsPlotCurveSymbol( RiuPlotCurveSymbol::PointSymbolEnum riuStyle, + const QString& label = QString(), + LabelPosition labelPosition = RiuPlotCurveSymbol::LabelAboveSymbol, + int labelFontSizePt = 8 ); + + void renderSymbolLabel( QPainter* painter, const QPointF& position, const QString& label ) const; + + void setSize( int width, int height ) override; + + void setColor( const QColor& color ) override; + + void setPen( const QPen& pen ) override; + + void setPixmap( const QPixmap& pixmap ) override; + + QRect boundingRect() const override; + + void applyToScatterSeries( QtCharts::QScatterSeries* series ) const; + +private: + QImage createTriangleImage( RiuPlotCurveSymbol::PointSymbolEnum symbolStyle ) const; + QImage createRectImage() const; + QImage createStar1Image() const; + QImage createStar2Image() const; + QImage createHexagonImage() const; + QImage createEllipseImage() const; + QImage createCrossImage() const; + QImage createXCrossImage() const; + QImage createDiamondImage() const; + + void setImageBrush( QtCharts::QScatterSeries* series, const QImage& image ) const; + + QColor m_color; + QPen m_pen; + int m_size; +}; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp new file mode 100644 index 0000000000..34395a0314 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp @@ -0,0 +1,105 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#include "RiuQtChartsPlotTools.h" + +#include "RiaPlotDefines.h" +#include "RiuGuiTheme.h" + +#include "RiaApplication.h" +#include "RiaPreferences.h" +#include "RiuQtChartsPlotWidget.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotTools::setCommonPlotBehaviour( RiuQtChartsPlotWidget* plot ) +{ + // Plot background and frame look + QPalette newPalette( plot->palette() ); + newPalette.setColor( QPalette::Window, Qt::white ); + plot->setPalette( newPalette ); + + plot->setAutoFillBackground( true ); + + // Axis number font + int axisFontSize = caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), + caf::FontTools::RelativeSize::Medium ); + + // Axis title font + int titleFontSize = caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), + caf::FontTools::RelativeSize::Medium ); + bool titleBold = false; + plot->setAxesFontsAndAlignment( titleFontSize, axisFontSize, titleBold, Qt::AlignRight ); + + // Store the pointer address as an object name. This way + // each plot can be identified uniquely for CSS-stylesheets + QString objectName = QString( "%1" ).arg( reinterpret_cast( plot ) ); + plot->setObjectName( objectName ); + + QString canvasName = QString( "%1" ).arg( reinterpret_cast( plot->getParentForOverlay() ) ); + plot->getParentForOverlay()->setObjectName( canvasName ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotTools::setDefaultAxes( RiuQtChartsPlotWidget* plot ) +{ + plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); + plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false ); + plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, false ); + + plot->setAxisMaxMinor( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 2 ); + plot->setAxisMaxMinor( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 3 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotTools::enableDateBasedBottomXAxis( RiuQtChartsPlotWidget* plot, + const QString& dateFormat, + const QString& timeFormat, + RiaQDateTimeTools::DateFormatComponents dateComponents, + RiaQDateTimeTools::TimeFormatComponents timeComponents ) +{ + QString format = dateTimeFormatForInterval( dateFormat, timeFormat, dateComponents, timeComponents ); + plot->setAxisFormat( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, format ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuQtChartsPlotTools::dateTimeFormatForInterval( const QString& dateFormat, + const QString& timeFormat, + RiaQDateTimeTools::DateFormatComponents dateComponents, + RiaQDateTimeTools::TimeFormatComponents timeComponents ) +{ + if ( dateComponents != RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED && + timeComponents != RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) + { + return RiaQDateTimeTools::timeFormatString( timeFormat, timeComponents ) + "\n" + + RiaQDateTimeTools::dateFormatString( dateFormat, dateComponents ); + } + + // Default: + return RiaQDateTimeTools::timeFormatString( timeFormat, RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_NONE ) + + "\n" + + RiaQDateTimeTools::dateFormatString( dateFormat, + RiaQDateTimeTools::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); +} diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.h new file mode 100644 index 0000000000..e809ad2de4 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include "RiaQDateTimeTools.h" + +class RiuQtChartsPlotWidget; + +class RiuQtChartsPlotTools +{ +public: + static void setCommonPlotBehaviour( RiuQtChartsPlotWidget* plot ); + static void setDefaultAxes( RiuQtChartsPlotWidget* plot ); + static void enableDateBasedBottomXAxis( + RiuQtChartsPlotWidget* plot, + const QString& dateFormat, + const QString& timeFormat, + RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED, + RiaQDateTimeTools::TimeFormatComponents timeComponents = RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ); + + static QString dateTimeFormatForInterval( const QString& dateFormat, + const QString& timeFormat, + RiaQDateTimeTools::DateFormatComponents dateComponents, + RiaQDateTimeTools::TimeFormatComponents timeComponents ); +}; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp new file mode 100644 index 0000000000..4621f666ee --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -0,0 +1,1027 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2021- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuQtChartsPlotWidget.h" + +#include "RiaDefines.h" +#include "RiaFontCache.h" +#include "RiaGuiApplication.h" +#include "RiaPlotDefines.h" +#include "RiaPlotWindowRedrawScheduler.h" +#include "RimPlot.h" + +#include "RiuDraggableOverlayFrame.h" +#include "RiuGuiTheme.h" +#include "RiuPlotMainWindowTools.h" +#include "RiuPlotWidget.h" +#include "RiuQtChartView.h" +#include "RiuQtChartsPlotCurve.h" + +#include "cafAssert.h" + +#include "cvfTrace.h" + +#include +#include +#include +#include +#include +#include + +#include + +using namespace QtCharts; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuQtChartsPlotWidget::RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* parent ) + : RiuPlotWidget( plotDefinition, parent ) +{ + CAF_ASSERT( m_plotDefinition ); + + QVBoxLayout* layout = new QVBoxLayout; + layout->setContentsMargins( 0, 0, 0, 0 ); + setLayout( layout ); + + QtCharts::QChart* chart = new QtCharts::QChart(); + chart->layout()->setContentsMargins( 0, 0, 0, 0 ); + chart->setBackgroundRoundness( 0 ); + + m_viewer = new RiuQtChartView( nullptr, parent ); + m_viewer->setChart( chart ); + m_viewer->setRenderHint( QPainter::Antialiasing ); + + layout->addWidget( m_viewer ); + + QValueAxis* axisBottom = new QValueAxis(); + chart->addAxis( axisBottom, Qt::AlignBottom ); + m_axes[RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM] = axisBottom; + + QValueAxis* axisTop = new QValueAxis(); + chart->addAxis( axisTop, Qt::AlignTop ); + m_axes[RiaDefines::PlotAxis::PLOT_AXIS_TOP] = axisTop; + + QValueAxis* axisLeft = new QValueAxis(); + chart->addAxis( axisLeft, Qt::AlignLeft ); + m_axes[RiaDefines::PlotAxis::PLOT_AXIS_LEFT] = axisLeft; + + QValueAxis* axisRight = new QValueAxis(); + chart->addAxis( axisRight, Qt::AlignRight ); + m_axes[RiaDefines::PlotAxis::PLOT_AXIS_RIGHT] = axisRight; + + enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); + enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, false ); + enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false ); + + setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); + setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, false ); + setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false ); + + m_viewer->setRubberBand( QChartView::RectangleRubberBand ); + + setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuQtChartsPlotWidget::~RiuQtChartsPlotWidget() +{ + if ( m_plotDefinition ) + { + m_plotDefinition->detachAllCurves(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::axisRangeChanged() +{ + if ( qtChart()->isZoomed() ) emit plotZoomed(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuQtChartsPlotWidget::axisTitleFontSize( RiaDefines::PlotAxis axis ) const +{ + if ( axisEnabled( axis ) ) + { + return plotAxis( axis )->titleFont().pointSize(); + } + + return -1; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuQtChartsPlotWidget::axisValueFontSize( RiaDefines::PlotAxis axis ) const +{ + if ( axisEnabled( axis ) ) + { + return plotAxis( axis )->labelsFont().pointSize(); + } + + return -1; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisFontsAndAlignment( RiaDefines::PlotAxis axis, + int titleFontSize, + int valueFontSize, + bool titleBold, + int alignment ) +{ + int titleFontPixelSize = caf::FontTools::pointSizeToPixelSize( titleFontSize ); + int valueFontPixelSize = caf::FontTools::pointSizeToPixelSize( valueFontSize ); + + // Axis number font + QFont axisFont = plotAxis( axis )->labelsFont(); + axisFont.setPixelSize( valueFontPixelSize ); + axisFont.setBold( false ); + plotAxis( axis )->setLabelsFont( axisFont ); + + // Axis title font + QFont axisTitleFont = plotAxis( axis )->labelsFont(); + axisTitleFont.setPixelSize( titleFontPixelSize ); + axisTitleFont.setBold( titleBold ); + plotAxis( axis )->setTitleFont( axisTitleFont ); + + applyAxisTitleToPlot( axis ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int valueFontSize, bool titleBold, int alignment ) +{ + for ( auto axisTitlePair : m_axisTitles ) + { + setAxisFontsAndAlignment( axisTitlePair.first, titleFontSize, valueFontSize, titleBold, alignment ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) +{ + m_axisTitles[axis] = title; + applyAxisTitleToPlot( axis ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) +{ + m_axisTitlesEnabled[axis] = enable; + applyAxisTitleToPlot( axis ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisFormat( RiaDefines::PlotAxis axis, const QString& format ) +{ + auto ax = plotAxis( axis ); + + auto valueAxis = dynamic_cast( ax ); + if ( valueAxis ) valueAxis->setLabelFormat( format ); + + auto logAxis = dynamic_cast( ax ); + if ( logAxis ) logAxis->setLabelFormat( format ); + + auto dateAxis = dynamic_cast( ax ); + if ( dateAxis ) dateAxis->setFormat( format ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setPlotTitle( const QString& plotTitle ) +{ + m_plotTitle = plotTitle; + applyPlotTitleToPlot(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QString& RiuQtChartsPlotWidget::plotTitle() const +{ + return m_plotTitle; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setPlotTitleEnabled( bool enabled ) +{ + m_plotTitleEnabled = enabled; + applyPlotTitleToPlot(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuQtChartsPlotWidget::plotTitleEnabled() const +{ + return m_plotTitleEnabled; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setPlotTitleFontSize( int titleFontSize ) +{ + QFont font = qtChart()->titleFont(); + font.setPixelSize( caf::FontTools::pointSizeToPixelSize( titleFontSize ) ); + qtChart()->setTitleFont( font ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setLegendFontSize( int fontSize ) +{ + if ( qtChart()->legend() ) + { + QFont font = qtChart()->legend()->font(); + font.setPixelSize( caf::FontTools::pointSizeToPixelSize( fontSize ) ); + qtChart()->legend()->setFont( font ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setInternalLegendVisible( bool visible ) +{ + if ( visible ) + { + insertLegend( RiuPlotWidget::Legend::BOTTOM ); + } + else + { + clearLegend(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::insertLegend( RiuPlotWidget::Legend legendPosition ) +{ + auto mapLegendPosition = []( RiuPlotWidget::Legend pos ) { + if ( pos == RiuPlotWidget::Legend::BOTTOM ) + return Qt::AlignBottom; + else if ( pos == RiuPlotWidget::Legend::TOP ) + return Qt::AlignTop; + else if ( pos == RiuPlotWidget::Legend::LEFT ) + return Qt::AlignLeft; + + return Qt::AlignRight; + }; + + QLegend* legend = qtChart()->legend(); + legend->setAlignment( mapLegendPosition( legendPosition ) ); + if ( !legend->isAttachedToChart() ) + { + legend->attachToChart(); + } + + replot(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::clearLegend() +{ + QLegend* legend = qtChart()->legend(); + legend->detachFromChart(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RiuQtChartsPlotWidget::axisRange( RiaDefines::PlotAxis axis ) const +{ + auto ax = plotAxis( axis ); + + auto valueAxis = dynamic_cast( ax ); + if ( valueAxis ) return std::make_pair( valueAxis->min(), valueAxis->max() ); + + auto logAxis = dynamic_cast( ax ); + if ( logAxis ) return std::make_pair( logAxis->min(), logAxis->max() ); + + auto dateAxis = dynamic_cast( ax ); + if ( dateAxis ) return std::make_pair( dateAxis->min().toMSecsSinceEpoch(), dateAxis->max().toMSecsSinceEpoch() ); + + return std::make_pair( 0.0, 1.0 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) +{ + // Note: Especially the Y-axis may be inverted + if ( plotAxis( axis )->isReverse() ) + { + setAxisScale( axis, max, min ); + } + else + { + setAxisScale( axis, min, max ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) +{ + auto ax = plotAxis( axis ); + ax->setReverse( isInverted ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) +{ + plotAxis( axis )->setLabelsVisible( enableLabels ); + plotAxis( axis )->setGridLineVisible( enableTicks ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) +{ + plotAxis( axis )->setGridLineVisible( majorGridLines ); + plotAxis( axis )->setMinorGridLineVisible( minorGridLines ); + + QPen gridLinePen( Qt::lightGray, 1.0, Qt::SolidLine ); + plotAxis( axis )->setGridLinePen( gridLinePen ); + + QPen minorGridLinePen( Qt::lightGray, 1.0, Qt::DashLine ); + plotAxis( axis )->setMinorGridLinePen( minorGridLinePen ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minValue, + double maxValue ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minTickValue, + double maxTickValue, + double rangeMin, + double rangeMax ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAutoTickIntervalCounts( RiaDefines::PlotAxis axis, + int maxMajorTickIntervalCount, + int maxMinorTickIntervalCount ) +{ + setAxisMaxMajor( axis, maxMajorTickIntervalCount ); + setAxisMaxMinor( axis, maxMinorTickIntervalCount ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RiuQtChartsPlotWidget::majorTickInterval( RiaDefines::PlotAxis axis ) const +{ +#if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 ) + // QValueAxis::tickInterval was introduced in 5.12 + QAbstractAxis* ax = plotAxis( axis ); + QValueAxis* valueAxis = dynamic_cast( ax ); + if ( valueAxis ) return valueAxis->tickInterval(); +#endif + return 0.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RiuQtChartsPlotWidget::minorTickInterval( RiaDefines::PlotAxis axis ) const +{ + return 0.0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuQtChartsPlotWidget::axisExtent( RiaDefines::PlotAxis axis ) const +{ + CAF_ASSERT( false && "Not implemented" ); + return 100; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QPoint RiuQtChartsPlotWidget::dragStartPosition() const +{ + return m_clickPosition; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::scheduleReplot() +{ + RiaPlotWindowRedrawScheduler::instance()->schedulePlotWidgetReplot( this ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::updateLayout() +{ + updateOverlayFrameLayout(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::updateLegend() +{ + qtChart()->legend()->update(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::resizeEvent( QResizeEvent* event ) +{ + QWidget::resizeEvent( event ); + updateOverlayFrameLayout(); + event->accept(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::keyPressEvent( QKeyEvent* event ) +{ + switch ( event->key() ) + { + case Qt::Key_Plus: + qtChart()->zoomIn(); + break; + case Qt::Key_Minus: + qtChart()->zoomOut(); + break; + default: + QWidget::keyPressEvent( event ); + break; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::applyPlotTitleToPlot() +{ + QString plotTitleToApply = m_plotTitleEnabled ? m_plotTitle : QString( "" ); + m_viewer->chart()->setTitle( plotTitleToApply ); + m_viewer->chart()->update(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::applyAxisTitleToPlot( RiaDefines::PlotAxis axis ) +{ + QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" ); + plotAxis( axis )->setTitleText( titleToApply ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QSize RiuQtChartsPlotWidget::sizeHint() const +{ + return QSize( 0, 0 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QSize RiuQtChartsPlotWidget::minimumSizeHint() const +{ + return QSize( 0, 0 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuQtChartsPlotWidget::isZoomerActive() const +{ + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// Empty default implementation +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::endZoomOperations() +{ +} + +//-------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::renderTo( QPainter* painter, const QRect& targetRect, double scaling ) +{ + // TODO: handle scaling... + painter->setRenderHint( QPainter::Antialiasing ); + m_viewer->render( painter, targetRect ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::renderTo( QPaintDevice* paintDevice, const QRect& targetRect ) +{ + int resolution = paintDevice->logicalDpiX(); + double scaling = resolution / static_cast( RiaGuiApplication::applicationResolution() ); + QPainter painter( paintDevice ); + renderTo( &painter, targetRect, scaling ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuQtChartsPlotWidget::overlayMargins() const +{ + return m_overlayMargins; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* RiuQtChartsPlotWidget::getParentForOverlay() const +{ + return m_viewer; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimViewWindow* RiuQtChartsPlotWidget::ownerViewWindow() const +{ + return m_plotDefinition; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuQtChartsPlotWidget::defaultMinimumWidth() +{ + return 80; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::replot() +{ + qtChart()->update(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) +{ + m_axesEnabled[axis] = isEnabled; + plotAxis( axis )->setVisible( isEnabled ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuQtChartsPlotWidget::axisEnabled( RiaDefines::PlotAxis axis ) const +{ + auto it = m_axesEnabled.find( axis ); + if ( it != m_axesEnabled.end() ) + return it->second; + else + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) +{ + QAbstractAxis* ax = plotAxis( axis ); + QValueAxis* valueAxis = dynamic_cast( ax ); + if ( valueAxis ) + { + valueAxis->setTickCount( maxMinor ); + } + else + { + QDateTimeAxis* dateAxis = dynamic_cast( ax ); + if ( dateAxis ) dateAxis->setTickCount( maxMinor ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) +{ + QAbstractAxis* ax = plotAxis( axis ); + QValueAxis* valueAxis = dynamic_cast( ax ); + if ( valueAxis ) + { + valueAxis->setTickCount( maxMajor ); + } + else + { + QDateTimeAxis* dateAxis = dynamic_cast( ax ); + if ( dateAxis ) dateAxis->setTickCount( maxMajor ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisAutoScale( RiaDefines::PlotAxis axis, bool autoScale ) +{ + m_axesAutoScale[axis] = autoScale; + + if ( autoScale ) + { + rescaleAxis( axis ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) +{ + plotAxis( axis )->setRange( min, max ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuQtChartsPlotWidget::AxisScaleType RiuQtChartsPlotWidget::axisScaleType( RiaDefines::PlotAxis axis ) const +{ + if ( plotAxis( axis )->type() == QAbstractAxis::AxisTypeLogValue ) return AxisScaleType::LOGARITHMIC; + if ( plotAxis( axis )->type() == QAbstractAxis::AxisTypeDateTime ) return AxisScaleType::DATE; + return AxisScaleType::LINEAR; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxisScaleType( RiaDefines::PlotAxis axis, RiuQtChartsPlotWidget::AxisScaleType axisScaleType ) +{ + QAbstractAxis* removeaxis = plotAxis( axis ); + QAbstractAxis* insertaxis = nullptr; + + if ( axisScaleType == AxisScaleType::LOGARITHMIC ) + { + insertaxis = new QLogValueAxis; + } + else if ( axisScaleType == AxisScaleType::DATE ) + { + insertaxis = new QDateTimeAxis; + } + else if ( axisScaleType == AxisScaleType::LINEAR ) + { + insertaxis = new QValueAxis; + } + + QChart* chart = qtChart(); + auto mapToAlignment = []( auto axis ) { + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) return Qt::AlignBottom; + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_TOP ) return Qt::AlignTop; + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) return Qt::AlignLeft; + return Qt::AlignRight; + }; + + if ( chart->axes().contains( removeaxis ) ) chart->removeAxis( removeaxis ); + chart->addAxis( insertaxis, mapToAlignment( axis ) ); + + m_axes[axis] = insertaxis; + for ( auto serie : chart->series() ) + { + if ( serie->attachedAxes().contains( removeaxis ) ) serie->detachAxis( removeaxis ); + serie->attachAxis( insertaxis ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::updateAxes() +{ + m_viewer->chart()->update(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotCurve* RiuQtChartsPlotWidget::createPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title, const QColor& color ) +{ + return new RiuQtChartsPlotCurve( ownerRimCurve, title ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QtCharts::QChart* RiuQtChartsPlotWidget::qtChart() +{ + return m_viewer->chart(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, + QtCharts::QAbstractSeries* lineSeries, + QtCharts::QAbstractSeries* scatterSeries, + RiaDefines::PlotAxis xAxis, + RiaDefines::PlotAxis yAxis ) +{ + auto addToChart = [this]( std::map& curveSeriesMap, + auto plotCurve, + auto series, + auto xAxis, + auto yAxis ) { + if ( !series->chart() ) + { + curveSeriesMap[plotCurve] = series; + qtChart()->addSeries( series ); + setXAxis( xAxis, series ); + setXAxis( yAxis, series ); + rescaleAxis( xAxis ); + rescaleAxis( yAxis ); + } + }; + + addToChart( m_lineSeriesMap, plotCurve, lineSeries, xAxis, yAxis ); + addToChart( m_scatterSeriesMap, plotCurve, scatterSeries, xAxis, yAxis ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QtCharts::QAbstractSeries* RiuQtChartsPlotWidget::getLineSeries( const RiuPlotCurve* plotCurve ) const +{ + auto series = m_lineSeriesMap.find( plotCurve ); + if ( series != m_lineSeriesMap.end() ) + return series->second; + else + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QtCharts::QAbstractSeries* RiuQtChartsPlotWidget::getScatterSeries( const RiuPlotCurve* plotCurve ) const +{ + auto series = m_scatterSeriesMap.find( plotCurve ); + if ( series != m_scatterSeriesMap.end() ) + return series->second; + else + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::detachItems( RiuPlotWidget::PlotItemType plotItemType ) +{ + cvf::Trace::show( "RiuQtChartsPlotWidget::detachItems" ); + + if ( plotItemType == RiuPlotWidget::PlotItemType::CURVE ) + { + m_lineSeriesMap.clear(); + m_scatterSeriesMap.clear(); + qtChart()->removeAllSeries(); + } + else + { + cvf::Trace::show( "Detach items not implemented for this type." ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setXAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ) +{ + setAxis( axis, series ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setYAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ) +{ + setAxis( axis, series ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ) +{ + if ( qtChart()->series().contains( series ) && !series->attachedAxes().contains( plotAxis( axis ) ) ) + { + auto newAxis = plotAxis( axis ); + + // Detach any other axis for the same orientation + for ( auto ax : series->attachedAxes() ) + { + if ( ax->orientation() == orientation( axis ) ) + { + series->detachAxis( ax ); + } + } + + series->attachAxis( newAxis ); + + if ( qobject_cast( newAxis ) || qobject_cast( newAxis ) ) + { + connect( newAxis, SIGNAL( rangeChanged( double, double ) ), this, SLOT( axisRangeChanged() ) ); + } + else if ( qobject_cast( newAxis ) ) + { + connect( newAxis, SIGNAL( rangeChanged( QDateTime, QDateTime ) ), this, SLOT( axisRangeChanged() ) ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::rescaleAxis( RiaDefines::PlotAxis axis ) +{ + if ( !m_axesAutoScale[axis] ) return; + + QAbstractAxis* pAxis = plotAxis( axis ); + Qt::Orientation orr = orientation( axis ); + + double min = std::numeric_limits::max(); + double max = -std::numeric_limits::max(); + for ( auto series : qtChart()->series() ) + { + auto attachedAxes = series->attachedAxes(); + if ( attachedAxes.contains( pAxis ) ) + { + QVector points; + for ( auto attachedAxis : attachedAxes ) + { + QValueAxis* valueAxis = dynamic_cast( attachedAxis ); + if ( valueAxis && valueAxis->orientation() == orr && dynamic_cast( series ) ) + { + points = dynamic_cast( series )->pointsVector(); + } + + QDateTimeAxis* dateTimeAxis = dynamic_cast( attachedAxis ); + if ( dateTimeAxis && dateTimeAxis->orientation() == orr && dynamic_cast( series ) ) + { + points = dynamic_cast( series )->pointsVector(); + } + + for ( auto p : points ) + { + if ( orr == Qt::Orientation::Horizontal ) + { + min = std::min( min, p.x() ); + max = std::max( max, p.x() ); + } + else + { + min = std::min( min, p.y() ); + max = std::max( max, p.y() ); + } + } + } + } + } + + if ( axisScaleType( axis ) == RiuPlotWidget::AxisScaleType::DATE ) + { + pAxis->setRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) ); + } + else + { + pAxis->setRange( min, max ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QAbstractAxis* RiuQtChartsPlotWidget::plotAxis( RiaDefines::PlotAxis axis ) const +{ + const auto ax = m_axes.find( axis ); + if ( ax != m_axes.end() ) + { + return ax->second; + } + + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +Qt::Orientation RiuQtChartsPlotWidget::orientation( RiaDefines::PlotAxis axis ) const +{ + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM || axis == RiaDefines::PlotAxis::PLOT_AXIS_TOP ) + return Qt::Orientation::Horizontal; + + return Qt::Orientation::Vertical; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::wheelEvent( QWheelEvent* event ) +{ + float factor = event->angleDelta().y() > 0 ? 0.9 : 1.1; + + QRectF plotAreaRect = m_viewer->chart()->plotArea(); + QPointF centerPoint = plotAreaRect.center(); + + // Adjust the size of the plot area + plotAreaRect.setWidth( plotAreaRect.width() * factor ); + plotAreaRect.setHeight( plotAreaRect.height() * factor ); + + // Find new center which keeps the mouse location in the same place in the plot + QPointF newCenterPoint( ( 2 * centerPoint - event->pos() ) - ( centerPoint - event->pos() ) / factor ); + plotAreaRect.moveCenter( newCenterPoint ); + + // Zoom in on the adjusted plot area + m_viewer->chart()->zoomIn( plotAreaRect ); + + event->accept(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QColor& RiuQtChartsPlotWidget::backgroundColor() const +{ + return m_viewer->chart()->backgroundBrush().color(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RiuQtChartsPlotWidget::findClosestCurve( const QPoint& pos, double& distanceToClick ) const +{ + return std::make_pair( nullptr, -1 ); +} diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h new file mode 100644 index 0000000000..cbe52cb4f7 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -0,0 +1,211 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaDefines.h" +#include "RiaPlotDefines.h" + +#include "RiuPlotWidget.h" + +#include "cafPdmObject.h" +#include "cafPdmPointer.h" + +#include + +#include + +class RiaPlotWindowRedrawScheduler; +class RimPlot; +class RiuPlotCurve; + +class QEvent; +class QLabel; +class QPainter; +class QPaintDevice; +class QWheelEvent; + +namespace QtCharts +{ +class QValueAxis; +class QChart; +class QAbstractSeries; +class QAbstractAxis; +class QChartView; +}; // namespace QtCharts + +//================================================================================================== +// +// +// +//================================================================================================== +class RiuQtChartsPlotWidget : public RiuPlotWidget +{ + Q_OBJECT + +public: + RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* parent = nullptr ); + ~RiuQtChartsPlotWidget() override; + + int axisTitleFontSize( RiaDefines::PlotAxis axis ) const override; + int axisValueFontSize( RiaDefines::PlotAxis axis ) const override; + void setAxisFontsAndAlignment( RiaDefines::PlotAxis, + int titleFontSize, + int valueFontSize, + bool titleBold = false, + int alignment = (int)Qt::AlignCenter ) override; + void setAxesFontsAndAlignment( int titleFontSize, + int valueFontSize, + bool titleBold = false, + int alignment = (int)Qt::AlignCenter ) override; + + void enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) override; + bool axisEnabled( RiaDefines::PlotAxis axis ) const override; + + void setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) override; + void setAxisAutoScale( RiaDefines::PlotAxis axis, bool enable ) override; + + void setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) override; + void setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) override; + + RiuPlotWidget::AxisScaleType axisScaleType( RiaDefines::PlotAxis axis ) const override; + void setAxisScaleType( RiaDefines::PlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) override; + + void setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) override; + void setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) override; + + void setAxisFormat( RiaDefines::PlotAxis axis, const QString& format ); + + void setPlotTitle( const QString& plotTitle ) override; + const QString& plotTitle() const; + void setPlotTitleEnabled( bool enabled ); + bool plotTitleEnabled() const; + void setPlotTitleFontSize( int titleFontSize ) override; + + void setLegendFontSize( int fontSize ) override; + void setInternalLegendVisible( bool visible ) override; + void insertLegend( RiuPlotWidget::Legend ) override; + void clearLegend() override; + + std::pair axisRange( RiaDefines::PlotAxis axis ) const override; + void setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) override; + + void setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) override; + void setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) override; + + void enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) override; + + void setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minValue, + double maxValue ) override; + void setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minTickValue, + double maxTickValue, + double rangeMin, + double rangeMax ) override; + void setAutoTickIntervalCounts( RiaDefines::PlotAxis axis, + int maxMajorTickIntervalCount, + int maxMinorTickIntervalCount ) override; + double majorTickInterval( RiaDefines::PlotAxis axis ) const override; + double minorTickInterval( RiaDefines::PlotAxis axis ) const override; + + void detachItems( RiuPlotWidget::PlotItemType plotItemType ) override; + + int axisExtent( RiaDefines::PlotAxis axis ) const override; + + QPoint dragStartPosition() const; + + void scheduleReplot(); + + void updateLayout() override; + + void renderTo( QPainter* painter, const QRect& targetRect, double scaling ) override; + void renderTo( QPaintDevice* painter, const QRect& targetRect ) override; + int overlayMargins() const; + + RimViewWindow* ownerViewWindow() const override; + + void updateLegend() override; + void updateAxes() override; + + RiuPlotCurve* createPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title, const QColor& color ) override; + + QtCharts::QChart* qtChart(); + + void attach( RiuPlotCurve* plotCurve, + QtCharts::QAbstractSeries* lineseries, + QtCharts::QAbstractSeries* scatterSeries, + RiaDefines::PlotAxis xAxis, + RiaDefines::PlotAxis yAxis ); + + QtCharts::QAbstractSeries* getLineSeries( const RiuPlotCurve* plotCurve ) const; + QtCharts::QAbstractSeries* getScatterSeries( const RiuPlotCurve* plotCurve ) const; + + void setXAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ); + void setYAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ); + + const QColor& backgroundColor() const override; + + QWidget* getParentForOverlay() const override; + + std::pair findClosestCurve( const QPoint& pos, double& distanceToClick ) const override; + +protected: + void setAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ); + + void resizeEvent( QResizeEvent* event ) override; + void keyPressEvent( QKeyEvent* event ) override; + void wheelEvent( QWheelEvent* event ) override; + + void applyPlotTitleToPlot(); + void applyAxisTitleToPlot( RiaDefines::PlotAxis axis ); + + QSize sizeHint() const override; + QSize minimumSizeHint() const override; + + virtual bool isZoomerActive() const; + virtual void endZoomOperations(); + + void rescaleAxis( RiaDefines::PlotAxis axis ); + QtCharts::QAbstractAxis* plotAxis( RiaDefines::PlotAxis axis ) const; + Qt::Orientation orientation( RiaDefines::PlotAxis axis ) const; + +signals: + void plotZoomed(); + +private slots: + void axisRangeChanged(); + +private: + static int defaultMinimumWidth(); + void replot() override; + + QPointer m_viewer; + + std::map m_axes; + std::map m_axesEnabled; + std::map m_axesAutoScale; + + std::map m_lineSeriesMap; + std::map m_scatterSeriesMap; +}; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index 5110f0f361..babf2fee97 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -21,29 +21,29 @@ #include "RiaCurveDataTools.h" #include "RiaImageTools.h" -#include "RiaTimeTTools.h" +#include "RiuQwtPlotTools.h" +#include "RiuQwtPlotWidget.h" #include "RiuQwtSymbol.h" #include "qwt_date.h" #include "qwt_interval_symbol.h" #include "qwt_painter.h" +#include "qwt_plot_curve.h" +#include "qwt_plot_intervalcurve.h" #include "qwt_point_mapper.h" #include "qwt_scale_map.h" #include "qwt_symbol.h" #include -//-------------------------------------------------------------------------------------------------- -/// Internal constants -//-------------------------------------------------------------------------------------------------- -#define DOUBLE_INF std::numeric_limits::infinity() - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotCurve::RiuQwtPlotCurve( const QString& title ) - : QwtPlotCurve( title ) +RiuQwtPlotCurve::RiuQwtPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title ) + : RiuPlotCurve( ownerRimCurve, title ) + , QwtPlotCurve( title ) + , m_showErrorBars( false ) { this->setLegendAttribute( QwtPlotCurve::LegendShowLine, true ); this->setLegendAttribute( QwtPlotCurve::LegendShowSymbol, true ); @@ -51,9 +51,11 @@ RiuQwtPlotCurve::RiuQwtPlotCurve( const QString& title ) this->setRenderHint( QwtPlotItem::RenderAntialiased, true ); - m_symbolSkipPixelDistance = 10.0f; - - m_blackAndWhiteLegendIcon = false; + m_qwtCurveErrorBars = new QwtPlotIntervalCurve(); + m_qwtCurveErrorBars->setStyle( QwtPlotIntervalCurve::CurveStyle::NoCurve ); + m_qwtCurveErrorBars->setSymbol( new QwtIntervalSymbol( QwtIntervalSymbol::Bar ) ); + m_qwtCurveErrorBars->setItemAttribute( QwtPlotItem::Legend, false ); + m_qwtCurveErrorBars->setZ( RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ERROR_BARS ) ); } //-------------------------------------------------------------------------------------------------- @@ -61,40 +63,20 @@ RiuQwtPlotCurve::RiuQwtPlotCurve( const QString& title ) //-------------------------------------------------------------------------------------------------- RiuQwtPlotCurve::~RiuQwtPlotCurve() { + if ( m_qwtCurveErrorBars ) + { + m_qwtCurveErrorBars->detach(); + delete m_qwtCurveErrorBars; + m_qwtCurveErrorBars = nullptr; + } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotCurve::setSamplesFromXValuesAndYValues( const std::vector& xValues, - const std::vector& yValues, - bool keepOnlyPositiveValues ) -{ - computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuQwtPlotCurve::setSamplesFromDatesAndYValues( const std::vector& dateTimes, - const std::vector& yValues, - bool keepOnlyPositiveValues ) -{ - auto xValues = RiuQwtPlotCurve::fromQDateTime( dateTimes ); - - computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuQwtPlotCurve::setSamplesFromTimeTAndYValues( const std::vector& dateTimes, - const std::vector& yValues, - bool keepOnlyPositiveValues ) +void RiuQwtPlotCurve::setTitle( const QString& title ) { - auto xValues = RiuQwtPlotCurve::fromTime_t( dateTimes ); - - computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues ); + QwtPlotCurve::setTitle( title ); } //-------------------------------------------------------------------------------------------------- @@ -235,30 +217,6 @@ void RiuQwtPlotCurve::drawSymbols( QPainter* painter, } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuQwtPlotCurve::setLineSegmentStartStopIndices( const std::vector>& lineSegmentStartStopIndices ) -{ - m_polyLineStartStopIndices = lineSegmentStartStopIndices; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuQwtPlotCurve::setSymbolSkipPixelDistance( float distance ) -{ - m_symbolSkipPixelDistance = distance >= 0.0f ? distance : 0.0f; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuQwtPlotCurve::setPerPointLabels( const std::vector& labels ) -{ - m_perPointLabels = labels; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -269,7 +227,7 @@ void RiuQwtPlotCurve::setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum const QBrush& fillBrush /* = QBrush( Qt::NoBrush )*/ ) { QwtPlotCurve::CurveStyle curveStyle = QwtPlotCurve::NoCurve; - Qt::PenStyle penStyle = Qt::NoPen; + Qt::PenStyle penStyle = RiuQwtPlotCurveDefines::convertToPenStyle( lineStyle ); // Qwt bug workaround (#4135): need to set 0 curve thickness for STYLE_NONE int curveThickness = 0; @@ -287,25 +245,6 @@ void RiuQwtPlotCurve::setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum curveStyle = QwtPlotCurve::Lines; break; } - - switch ( lineStyle ) - { - case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID: - penStyle = Qt::SolidLine; - break; - case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH: - penStyle = Qt::DashLine; - break; - case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DOT: - penStyle = Qt::DotLine; - break; - case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH_DOT: - penStyle = Qt::DashDotLine; - break; - - default: - break; - } } QPen curvePen( curveColor ); curvePen.setWidth( curveThickness ); @@ -319,9 +258,9 @@ void RiuQwtPlotCurve::setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotCurve::setBlackAndWhiteLegendIcon( bool blackAndWhite ) +void RiuQwtPlotCurve::setBrush( const QBrush& brush ) { - m_blackAndWhiteLegendIcon = blackAndWhite; + QwtPlotCurve::setBrush( brush ); } //-------------------------------------------------------------------------------------------------- @@ -344,58 +283,237 @@ QwtGraphic RiuQwtPlotCurve::legendIcon( int index, const QSizeF& size ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotCurve::computeValidIntervalsAndSetCurveData( const std::vector& xValues, - const std::vector& yValues, - bool keepOnlyPositiveValues ) +QPixmap RiuQwtPlotCurve::legendIcon( const QSizeF& size ) const { - auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, keepOnlyPositiveValues ); + return legendIcon( 0, size ).toPixmap(); +} - std::vector validYValues; - std::vector validXValues; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::setLegendIconSize( const QSize& iconSize ) +{ + QwtPlotCurve::setLegendIconSize( iconSize ); +} - RiaCurveDataTools::getValuesByIntervals( yValues, intervalsOfValidValues, &validYValues ); - RiaCurveDataTools::getValuesByIntervals( xValues, intervalsOfValidValues, &validXValues ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QSize RiuQwtPlotCurve::legendIconSize() const +{ + return QwtPlotCurve::legendIconSize(); +} - setSamples( validXValues.data(), validYValues.data(), static_cast( validXValues.size() ) ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::attachToPlot( RiuPlotWidget* plotWidget ) +{ + RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast( plotWidget ); + attach( qwtPlotWidget->qwtPlot() ); - setLineSegmentStartStopIndices( RiaCurveDataTools::computePolyLineStartStopIndices( intervalsOfValidValues ) ); + if ( m_showErrorBars ) + { + m_qwtCurveErrorBars->attach( qwtPlotWidget->qwtPlot() ); + } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RiuQwtPlotCurve::fromQDateTime( const std::vector& dateTimes ) +void RiuQwtPlotCurve::detach() { - std::vector doubleValues; + QwtPlotCurve::detach(); + m_qwtCurveErrorBars->detach(); +} - if ( !dateTimes.empty() ) +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::showInPlot() +{ + show(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::setSamplesInPlot( const std::vector& xValues, const std::vector& yValues, int numValues ) +{ + setSamples( xValues.data(), yValues.data(), numValues ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::setZ( int z ) +{ + QwtPlotCurve::setZ( z ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::updateErrorBarsAppearance( bool showErrorBars, const QColor& curveColor ) +{ + m_showErrorBars = showErrorBars; + if ( m_qwtCurveErrorBars ) { - doubleValues.reserve( dateTimes.size() ); + QwtIntervalSymbol* newSymbol = new QwtIntervalSymbol( QwtIntervalSymbol::Bar ); + newSymbol->setPen( QPen( curveColor ) ); + m_qwtCurveErrorBars->setSymbol( newSymbol ); + m_qwtCurveErrorBars->setVisible( showErrorBars ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::clearErrorBars() +{ + m_showErrorBars = false; + + m_qwtCurveErrorBars->setSamples( nullptr ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuQwtPlotCurve::numSamples() const +{ + return dataSize(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RiuQwtPlotCurve::sample( int index ) const +{ + CAF_ASSERT( index >= 0 && index <= numSamples() ); + auto p = QwtPlotCurve::sample( index ); + return std::make_pair( p.x(), p.y() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RiuQwtPlotCurve::xDataRange() const +{ + return std::make_pair( minXValue(), maxXValue() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RiuQwtPlotCurve::yDataRange() const +{ + return std::make_pair( minYValue(), maxYValue() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::setSamplesFromXYErrorValues( const std::vector& xValues, + const std::vector& yValues, + const std::vector& errorValues, + bool keepOnlyPositiveValues, + RiaCurveDataTools::ErrorAxis errorAxis ) +{ + CVF_ASSERT( xValues.size() == yValues.size() ); + CVF_ASSERT( xValues.size() == errorValues.size() ); + + auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, keepOnlyPositiveValues ); + std::vector filteredYValues; + std::vector filteredXValues; - for ( const auto& dt : dateTimes ) + RiaCurveDataTools::getValuesByIntervals( yValues, intervalsOfValidValues, &filteredYValues ); + RiaCurveDataTools::getValuesByIntervals( xValues, intervalsOfValidValues, &filteredXValues ); + + std::vector filteredErrorValues; + RiaCurveDataTools::getValuesByIntervals( errorValues, intervalsOfValidValues, &filteredErrorValues ); + + QVector errorIntervals; + + errorIntervals.reserve( static_cast( filteredXValues.size() ) ); + + for ( size_t i = 0; i < filteredXValues.size(); i++ ) + { + if ( !std::isinf( filteredYValues[i] ) && !std::isinf( filteredErrorValues[i] ) ) { - doubleValues.push_back( QwtDate::toDouble( dt ) ); + if ( errorAxis == RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ) + { + errorIntervals << QwtIntervalSample( filteredXValues[i], + filteredYValues[i] - filteredErrorValues[i], + filteredYValues[i] + filteredErrorValues[i] ); + } + else + { + errorIntervals << QwtIntervalSample( filteredYValues[i], + filteredXValues[i] - filteredErrorValues[i], + filteredXValues[i] + filteredErrorValues[i] ); + } } } - return doubleValues; + setSamplesInPlot( filteredXValues, filteredYValues, static_cast( filteredXValues.size() ) ); + + setLineSegmentStartStopIndices( intervalsOfValidValues ); + + if ( m_qwtCurveErrorBars ) + { + m_qwtCurveErrorBars->setSamples( errorIntervals ); + if ( errorAxis == RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ) + { + m_qwtCurveErrorBars->setOrientation( Qt::Vertical ); + } + else + { + m_qwtCurveErrorBars->setOrientation( Qt::Horizontal ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::setXAxis( RiaDefines::PlotAxis axis ) +{ + QwtPlotCurve::setXAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::setYAxis( RiaDefines::PlotAxis axis ) +{ + QwtPlotCurve::setYAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RiuQwtPlotCurve::fromTime_t( const std::vector& timeSteps ) +void RiuQwtPlotCurve::setVisibleInLegend( bool isVisibleInLegend ) { - std::vector doubleValues; + setItemAttribute( QwtPlotItem::Legend, isVisibleInLegend ); +} - if ( !timeSteps.empty() ) +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::setSymbol( RiuPlotCurveSymbol* symbol ) +{ + if ( symbol ) { - doubleValues.reserve( timeSteps.size() ); - for ( const auto& time : timeSteps ) - { - doubleValues.push_back( RiaTimeTTools::toDouble( time ) ); - } + auto qwtSymbol = dynamic_cast( symbol ); + CAF_ASSERT( qwtSymbol ); + QwtPlotCurve::setSymbol( qwtSymbol ); } +} - return doubleValues; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotCurveSymbol* RiuQwtPlotCurve::createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const +{ + return new RiuQwtSymbol( symbol ); } diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h index f83cdade33..e44aec3a39 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h @@ -19,67 +19,66 @@ #pragma once +#include "RiuPlotCurve.h" #include "RiuQwtPlotCurveDefines.h" #include "qwt_plot_curve.h" -#include "qwt_plot_intervalcurve.h" -#include "qwt_symbol.h" + +class QwtPlotIntervalCurve; //================================================================================================== // -// If infinite data is present in the curve data, Qwt is not able to draw a nice curve. -// This class assumes that inf data is removed, and segments to be draw are indicated by start/stop indices into curve -// data. -// -// Single values in the curve are drawn using a CrossX symbol -// -// Here you can see the curve segments visualized. Curve segments are drawn between vector indices. -// -// 0 - 1 -// 5 - 7 -// 9 -10 -// -// * * -// * * * -// Curve * * * ----- X -// -// Values 1.0|2.0|inf|inf|inf|1.0|2.0|1.0|inf|1.0|1.0|inf|1.0|inf -// Vec index 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10| 11| 12| 13 //================================================================================================== -class RiuQwtPlotCurve : public QwtPlotCurve +class RiuQwtPlotCurve : public RiuPlotCurve, public QwtPlotCurve { public: - explicit RiuQwtPlotCurve( const QString& title = QString() ); + explicit RiuQwtPlotCurve( RimPlotCurve* ownerRimCurve = nullptr, const QString& title = QString() ); ~RiuQwtPlotCurve() override; - void setSamplesFromXValuesAndYValues( const std::vector& xValues, - const std::vector& yValues, - bool keepOnlyPositiveValues ); - - void setSamplesFromDatesAndYValues( const std::vector& dateTimes, - const std::vector& yValues, - bool keepOnlyPositiveValues ); - - void setSamplesFromTimeTAndYValues( const std::vector& dateTimes, - const std::vector& yValues, - bool keepOnlyPositiveValues ); - - void setLineSegmentStartStopIndices( const std::vector>& lineSegmentStartStopIndices ); - - void setSymbolSkipPixelDistance( float distance ); - void setPerPointLabels( const std::vector& labels ); + void setTitle( const QString& title ) override; void setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle, RiuQwtPlotCurveDefines::CurveInterpolationEnum interpolationType, int curveThickness, const QColor& curveColor, - const QBrush& fillBrush = QBrush( Qt::NoBrush ) ); + const QBrush& fillBrush = QBrush( Qt::NoBrush ) ) override; + + void setBrush( const QBrush& brush ) override; + + void setLegendIconSize( const QSize& iconSize ) override; + QSize legendIconSize() const override; + QPixmap legendIcon( const QSizeF& size ) const override; - void setBlackAndWhiteLegendIcon( bool blackAndWhite ); QwtGraphic legendIcon( int index, const QSizeF& size ) const override; + void setVisibleInLegend( bool isVisibleInLegend ) override; + + void attachToPlot( RiuPlotWidget* plotWidget ) override; + void detach() override; + void showInPlot() override; + + void setZ( int z ) override; + + void updateErrorBarsAppearance( bool showErrorBars, const QColor& curveColor ) override; + void clearErrorBars() override; + + int numSamples() const override; + std::pair sample( int index ) const override; - static std::vector fromQDateTime( const std::vector& dateTimes ); - static std::vector fromTime_t( const std::vector& timeSteps ); + std::pair xDataRange() const override; + std::pair yDataRange() const override; + + void setSamplesFromXYErrorValues( + const std::vector& xValues, + const std::vector& yValues, + const std::vector& errorValues, + bool keepOnlyPositiveValues, + RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ) override; + + void setXAxis( RiaDefines::PlotAxis axis ) override; + void setYAxis( RiaDefines::PlotAxis axis ) override; + + void setSymbol( RiuPlotCurveSymbol* symbol ) override; + RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override; protected: void drawCurve( QPainter* p, @@ -98,16 +97,8 @@ class RiuQwtPlotCurve : public QwtPlotCurve int from, int to ) const override; -private: - void computeValidIntervalsAndSetCurveData( const std::vector& xValues, - const std::vector& yValues, - bool keepOnlyPositiveValues ); - -private: - float m_symbolSkipPixelDistance; - bool m_blackAndWhiteLegendIcon; - - std::vector m_perPointLabels; + void setSamplesInPlot( const std::vector&, const std::vector&, int ) override; - std::vector> m_polyLineStartStopIndices; + QwtPlotIntervalCurve* m_qwtCurveErrorBars; + bool m_showErrorBars; }; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurveDefines.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurveDefines.cpp index 8db9feefa3..9550755efc 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurveDefines.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurveDefines.cpp @@ -75,3 +75,22 @@ int RiuQwtPlotCurveDefines::zDepthForIndex( ZIndex index ) return 0; } + +Qt::PenStyle RiuQwtPlotCurveDefines::convertToPenStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle ) +{ + switch ( lineStyle ) + { + case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE: + return Qt::NoPen; + case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID: + return Qt::SolidLine; + case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH: + return Qt::DashLine; + case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DOT: + return Qt::DotLine; + case RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_DASH_DOT: + return Qt::DashDotLine; + default: + return Qt::NoPen; + } +} diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurveDefines.h b/ApplicationLibCode/UserInterface/RiuQwtPlotCurveDefines.h index d7f670f91e..a5e4579de8 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurveDefines.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurveDefines.h @@ -19,6 +19,8 @@ #pragma once +#include + namespace RiuQwtPlotCurveDefines { enum class CurveInterpolationEnum @@ -48,4 +50,6 @@ enum class ZIndex int zDepthForIndex( ZIndex index ); +Qt::PenStyle convertToPenStyle( RiuQwtPlotCurveDefines::LineStyleEnum lineStyle ); + }; // namespace RiuQwtPlotCurveDefines diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotItem.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotItem.cpp new file mode 100644 index 0000000000..21dffabca7 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotItem.cpp @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuQwtPlotItem.h" + +RiuQwtPlotItem::RiuQwtPlotItem( QwtPlotItem* qwtPlotItem ) + : RiuPlotItem() + , m_qwtPlotItem( qwtPlotItem ) +{ +} + +RiuQwtPlotItem::~RiuQwtPlotItem() +{ +} + +QwtPlotItem* RiuQwtPlotItem::qwtPlotItem() const +{ + return m_qwtPlotItem; +}; diff --git a/ApplicationLibCode/UserInterface/RiuRimQwtPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQwtPlotItem.h similarity index 65% rename from ApplicationLibCode/UserInterface/RiuRimQwtPlotCurve.h rename to ApplicationLibCode/UserInterface/RiuQwtPlotItem.h index 270ed3e974..16ddc6eb07 100644 --- a/ApplicationLibCode/UserInterface/RiuRimQwtPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotItem.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2018- Equinor ASA +// Copyright (C) 2022- 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 @@ -15,22 +15,21 @@ // for more details. // ///////////////////////////////////////////////////////////////////////////////// -#pragma once -#include "RiuQwtPlotCurve.h" +#pragma once -#include "cafPdmPointer.h" +#include "RiuPlotItem.h" -class RimPlotCurve; +class QwtPlotItem; -class RiuRimQwtPlotCurve : public RiuQwtPlotCurve +class RiuQwtPlotItem : public RiuPlotItem { public: - explicit RiuRimQwtPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title = QString() ); + RiuQwtPlotItem( QwtPlotItem* qwtPlotItem ); + ~RiuQwtPlotItem() override; - RimPlotCurve* ownerRimCurve(); - const RimPlotCurve* ownerRimCurve() const; + QwtPlotItem* qwtPlotItem() const; private: - caf::PdmPointer m_ownerRimCurve; + QwtPlotItem* m_qwtPlotItem; }; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp index 6dcf4d2084..d997d2838b 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp @@ -230,3 +230,33 @@ QwtPlotShapeItem* RiuQwtPlotTools::createBoxShape( const QString& label, { return createBoxShapeT( label, startX, endX, startY, endY, color, brushStyle ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QwtPlot::Axis RiuQwtPlotTools::toQwtPlotAxis( RiaDefines::PlotAxis axis ) +{ + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) + return QwtPlot::yLeft; + else if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) + return QwtPlot::yRight; + else if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) + return QwtPlot::xBottom; + + return QwtPlot::xTop; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::PlotAxis RiuQwtPlotTools::fromQwtPlotAxis( QwtPlot::Axis axis ) +{ + if ( axis == QwtPlot::yLeft ) + return RiaDefines::PlotAxis::PLOT_AXIS_LEFT; + else if ( axis == QwtPlot::yRight ) + return RiaDefines::PlotAxis::PLOT_AXIS_RIGHT; + else if ( axis == QwtPlot::xBottom ) + return RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM; + + return RiaDefines::PlotAxis::PLOT_AXIS_TOP; +} diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h index 27121e3a95..2d2cbed420 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h @@ -17,6 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include "RiaPlotDefines.h" #include "RiaQDateTimeTools.h" #include #include @@ -56,6 +57,9 @@ class RiuQwtPlotTools double endY, QColor color, Qt::BrushStyle brushStyle = Qt::SolidPattern ); + + static QwtPlot::Axis toQwtPlotAxis( RiaDefines::PlotAxis ); + static RiaDefines::PlotAxis fromQwtPlotAxis( QwtPlot::Axis ); }; //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index cbbdabcde0..5d75b89f59 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -20,21 +20,26 @@ #include "RiuQwtPlotWidget.h" #include "RiaColorTools.h" -#include "RiaFontCache.h" +#include "RiaDefines.h" #include "RiaGuiApplication.h" +#include "RiaPlotDefines.h" #include "RiaPlotWindowRedrawScheduler.h" #include "RimPlot.h" #include "RiuDraggableOverlayFrame.h" #include "RiuGuiTheme.h" #include "RiuPlotMainWindowTools.h" +#include "RiuPlotWidget.h" #include "RiuQwtCurvePointTracker.h" #include "RiuQwtLinearScaleEngine.h" +#include "RiuQwtPlotCurve.h" +#include "RiuQwtPlotItem.h" #include "RiuQwtPlotTools.h" #include "RiuQwtScalePicker.h" #include "cafAssert.h" +#include "qwt_date_scale_engine.h" #include "qwt_legend.h" #include "qwt_legend_label.h" #include "qwt_plot_barchart.h" @@ -46,20 +51,16 @@ #include "qwt_plot_renderer.h" #include "qwt_plot_shapeitem.h" #include "qwt_scale_draw.h" +#include "qwt_scale_engine.h" #include "qwt_scale_widget.h" #include "qwt_symbol.h" #include "qwt_text.h" #include "qwt_text_label.h" -#include -#include #include #include -#include -#include -#include #include -#include +#include #include #include @@ -69,84 +70,54 @@ /// //-------------------------------------------------------------------------------------------------- RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent ) - : QwtPlot( parent ) - , m_plotDefinition( plotDefinition ) - , m_overlayMargins( 5 ) - , m_plotTitle( "" ) - , m_plotTitleEnabled( true ) + : RiuPlotWidget( plotDefinition, parent ) { CAF_ASSERT( m_plotDefinition ); - RiuQwtPlotTools::setCommonPlotBehaviour( this ); - this->installEventFilter( this ); - this->canvas()->installEventFilter( this ); + QVBoxLayout* layout = new QVBoxLayout; + layout->setContentsMargins( 0, 0, 0, 0 ); + setLayout( layout ); - this->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); -} + m_plot = new QwtPlot( this ); + layout->addWidget( m_plot ); -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget::~RiuQwtPlotWidget() -{ - if ( m_plotDefinition ) - { - m_plotDefinition->detachAllCurves(); - } -} + RiuQwtPlotTools::setCommonPlotBehaviour( m_plot ); -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimPlot* RiuQwtPlotWidget::plotDefinition() -{ - return m_plotDefinition; -} + m_plot->installEventFilter( m_plot ); + m_plot->canvas()->installEventFilter( this ); -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RiuQwtPlotWidget::isChecked() const -{ - if ( m_plotDefinition ) - { - return m_plotDefinition->showWindow(); - } - return false; -} + setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -int RiuQwtPlotWidget::colSpan() const -{ - if ( m_plotDefinition ) - { - return m_plotDefinition->colSpan(); - } - return 1; + connect( this, SIGNAL( plotSelected( bool ) ), plotDefinition, SLOT( onPlotSelected( bool ) ) ); + connect( this, SIGNAL( axisSelected( int, bool ) ), plotDefinition, SLOT( onAxisSelected( int, bool ) ) ); + connect( this, + SIGNAL( plotItemSelected( std::shared_ptr, bool, int ) ), + plotDefinition, + SLOT( onPlotItemSelected( std::shared_ptr, bool, int ) ) ); + connect( this, SIGNAL( onKeyPressEvent( QKeyEvent* ) ), plotDefinition, SLOT( onKeyPressEvent( QKeyEvent* ) ) ); + connect( this, SIGNAL( onWheelEvent( QWheelEvent* ) ), plotDefinition, SLOT( onWheelEvent( QWheelEvent* ) ) ); + connect( this, SIGNAL( destroyed() ), plotDefinition, SLOT( onViewerDestroyed() ) ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuQwtPlotWidget::rowSpan() const +RiuQwtPlotWidget::~RiuQwtPlotWidget() { if ( m_plotDefinition ) { - return m_plotDefinition->rowSpan(); + m_plotDefinition->detachAllCurves(); } - return 1; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuQwtPlotWidget::axisTitleFontSize( QwtPlot::Axis axis ) const +int RiuQwtPlotWidget::axisTitleFontSize( RiaDefines::PlotAxis axis ) const { - if ( this->axisEnabled( axis ) ) + if ( axisEnabled( axis ) ) { - return this->axisFont( axis ).pointSize(); + return m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).pointSize(); } return -1; } @@ -154,11 +125,11 @@ int RiuQwtPlotWidget::axisTitleFontSize( QwtPlot::Axis axis ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuQwtPlotWidget::axisValueFontSize( QwtPlot::Axis axis ) const +int RiuQwtPlotWidget::axisValueFontSize( RiaDefines::PlotAxis axis ) const { - if ( this->axisEnabled( axis ) ) + if ( axisEnabled( axis ) ) { - return this->axisTitle( axis ).font().pointSize(); + return m_plot->axisTitle( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).font().pointSize(); } return -1; } @@ -166,30 +137,32 @@ int RiuQwtPlotWidget::axisValueFontSize( QwtPlot::Axis axis ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisFontsAndAlignment( QwtPlot::Axis axis, - int titleFontSize, - int valueFontSize, - bool titleBold, - int alignment ) +void RiuQwtPlotWidget::setAxisFontsAndAlignment( RiaDefines::PlotAxis axis, + int titleFontSize, + int valueFontSize, + bool titleBold, + int alignment ) { int titleFontPixelSize = caf::FontTools::pointSizeToPixelSize( titleFontSize ); int valueFontPixelSize = caf::FontTools::pointSizeToPixelSize( valueFontSize ); // Axis number font - QFont axisFont = this->axisFont( axis ); + + int qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QFont axisFont = m_plot->axisFont( qwtAxis ); axisFont.setPixelSize( valueFontPixelSize ); axisFont.setBold( false ); - this->setAxisFont( axis, axisFont ); + m_plot->setAxisFont( qwtAxis, axisFont ); // Axis title font - QwtText axisTitle = this->axisTitle( axis ); + QwtText axisTitle = m_plot->axisTitle( qwtAxis ); QFont axisTitleFont = axisTitle.font(); axisTitleFont.setPixelSize( titleFontPixelSize ); axisTitleFont.setBold( titleBold ); axisTitle.setFont( axisTitleFont ); axisTitle.setRenderFlags( alignment | Qt::TextWordWrap ); - setAxisTitle( axis, axisTitle ); + m_plot->setAxisTitle( qwtAxis, axisTitle ); applyAxisTitleToQwt( axis ); } @@ -207,7 +180,7 @@ void RiuQwtPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int valueFon //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisTitleText( QwtPlot::Axis axis, const QString& title ) +void RiuQwtPlotWidget::setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) { m_axisTitles[axis] = title; applyAxisTitleToQwt( axis ); @@ -216,7 +189,7 @@ void RiuQwtPlotWidget::setAxisTitleText( QwtPlot::Axis axis, const QString& titl //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisTitleEnabled( QwtPlot::Axis axis, bool enable ) +void RiuQwtPlotWidget::setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) { m_axisTitlesEnabled[axis] = enable; applyAxisTitleToQwt( axis ); @@ -261,11 +234,11 @@ bool RiuQwtPlotWidget::plotTitleEnabled() const //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setPlotTitleFontSize( int titleFontSize ) { - auto title = this->title(); + auto title = m_plot->title(); QFont font = title.font(); font.setPixelSize( caf::FontTools::pointSizeToPixelSize( titleFontSize ) ); title.setFont( font ); - setTitle( title ); + m_plot->setTitle( title ); } //-------------------------------------------------------------------------------------------------- @@ -273,13 +246,13 @@ void RiuQwtPlotWidget::setPlotTitleFontSize( int titleFontSize ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setLegendFontSize( int fontSize ) { - if ( legend() ) + if ( m_plot->legend() ) { - QFont font = legend()->font(); + QFont font = m_plot->legend()->font(); font.setPixelSize( caf::FontTools::pointSizeToPixelSize( fontSize ) ); - legend()->setFont( font ); + m_plot->legend()->setFont( font ); // Set font size for all existing labels - QList labels = legend()->findChildren(); + QList labels = m_plot->legend()->findChildren(); for ( QwtLegendLabel* label : labels ) { label->setFont( font ); @@ -295,29 +268,49 @@ void RiuQwtPlotWidget::setInternalLegendVisible( bool visible ) if ( visible ) { QwtLegend* legend = new QwtLegend( this ); - this->insertLegend( legend, BottomLegend ); + m_plot->insertLegend( legend, QwtPlot::BottomLegend ); } else { - this->insertLegend( nullptr ); + m_plot->insertLegend( nullptr ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QwtInterval RiuQwtPlotWidget::axisRange( QwtPlot::Axis axis ) const +void RiuQwtPlotWidget::insertLegend( RiuPlotWidget::Legend legendPosition ) +{ + CAF_ASSERT( legendPosition == RiuPlotWidget::Legend::BOTTOM ); + + QwtLegend* legend = new QwtLegend( this ); + m_plot->insertLegend( legend, QwtPlot::BottomLegend ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::clearLegend() +{ + m_plot->insertLegend( nullptr ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RiuQwtPlotWidget::axisRange( RiaDefines::PlotAxis axis ) const { - return axisScaleDiv( axis ).interval(); + QwtInterval interval = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).interval(); + return std::make_pair( interval.minValue(), interval.maxValue() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisRange( QwtPlot::Axis axis, double min, double max ) +void RiuQwtPlotWidget::setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) { // Note: Especially the Y-axis may be inverted - if ( axisScaleEngine( axis )->testAttribute( QwtScaleEngine::Inverted ) ) + if ( m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->testAttribute( QwtScaleEngine::Inverted ) ) { setAxisScale( axis, max, min ); } @@ -330,39 +323,40 @@ void RiuQwtPlotWidget::setAxisRange( QwtPlot::Axis axis, double min, double max //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisInverted( QwtPlot::Axis axis ) +void RiuQwtPlotWidget::setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) { - axisScaleEngine( axis )->setAttribute( QwtScaleEngine::Inverted, true ); + m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->setAttribute( QwtScaleEngine::Inverted, isInverted ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( QwtPlot::Axis axis, bool enableLabels, bool enableTicks ) +void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) { - this->axisScaleDraw( axis )->enableComponent( QwtAbstractScaleDraw::Ticks, enableTicks ); - this->axisScaleDraw( axis )->enableComponent( QwtAbstractScaleDraw::Labels, enableLabels ); + m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Ticks, enableTicks ); + m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Labels, enableLabels ); recalculateAxisExtents( axis ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::enableGridLines( QwtPlot::Axis axis, bool majorGridLines, bool minorGridLines ) +void RiuQwtPlotWidget::enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) { - QwtPlotItemList plotItems = this->itemList( QwtPlotItem::Rtti_PlotGrid ); + QwtPlotItemList plotItems = m_plot->itemList( QwtPlotItem::Rtti_PlotGrid ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); for ( QwtPlotItem* plotItem : plotItems ) { QwtPlotGrid* grid = static_cast( plotItem ); - if ( axis == QwtPlot::xTop || axis == QwtPlot::xBottom ) + if ( qwtAxis == QwtPlot::xTop || qwtAxis == QwtPlot::xBottom ) { - grid->setXAxis( axis ); + grid->setXAxis( qwtAxis ); grid->enableX( majorGridLines ); grid->enableXMin( minorGridLines ); } else { - grid->setYAxis( axis ); + grid->setYAxis( qwtAxis ); grid->enableY( majorGridLines ); grid->enableYMin( minorGridLines ); } @@ -374,34 +368,36 @@ void RiuQwtPlotWidget::enableGridLines( QwtPlot::Axis axis, bool majorGridLines, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( QwtPlot::Axis axis, - double majorTickInterval, - double minorTickInterval, - double minValue, - double maxValue ) +void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minValue, + double maxValue ) { - RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( this->axisScaleEngine( axis ) ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); if ( scaleEngine ) { QwtScaleDiv scaleDiv = scaleEngine->divideScaleWithExplicitIntervals( minValue, maxValue, majorTickInterval, minorTickInterval ); - this->setAxisScaleDiv( axis, scaleDiv ); + m_plot->setAxisScaleDiv( qwtAxis, scaleDiv ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( QwtPlot::Axis axis, - double majorTickInterval, - double minorTickInterval, - double minTickValue, - double maxTickValue, - double rangeMin, - double rangeMax ) +void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minTickValue, + double maxTickValue, + double rangeMin, + double rangeMax ) { - RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( this->axisScaleEngine( axis ) ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); if ( scaleEngine ) { QwtScaleDiv scaleDiv = scaleEngine->divideScaleWithExplicitIntervalsAndRange( minTickValue, @@ -411,30 +407,30 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( QwtPlot::Axis axis rangeMin, rangeMax ); - this->setAxisScaleDiv( axis, scaleDiv ); + m_plot->setAxisScaleDiv( qwtAxis, scaleDiv ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAutoTickIntervalCounts( QwtPlot::Axis axis, - int maxMajorTickIntervalCount, - int maxMinorTickIntervalCount ) +void RiuQwtPlotWidget::setAutoTickIntervalCounts( RiaDefines::PlotAxis axis, + int maxMajorTickIntervalCount, + int maxMinorTickIntervalCount ) { - this->setAxisMaxMajor( axis, maxMajorTickIntervalCount ); - this->setAxisMaxMinor( axis, maxMinorTickIntervalCount ); + m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMajorTickIntervalCount ); + m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMinorTickIntervalCount ); // Reapply axis limits to force Qwt to use the tick settings. - QwtInterval currentRange = this->axisInterval( axis ); + QwtInterval currentRange = m_plot->axisInterval( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); setAxisScale( axis, currentRange.minValue(), currentRange.maxValue() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RiuQwtPlotWidget::majorTickInterval( QwtPlot::Axis axis ) const +double RiuQwtPlotWidget::majorTickInterval( RiaDefines::PlotAxis axis ) const { - QwtScaleDiv scaleDiv = this->axisScaleDiv( axis ); + QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); QList majorTicks = scaleDiv.ticks( QwtScaleDiv::MajorTick ); if ( majorTicks.size() < 2 ) return 0.0; @@ -444,9 +440,9 @@ double RiuQwtPlotWidget::majorTickInterval( QwtPlot::Axis axis ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RiuQwtPlotWidget::minorTickInterval( QwtPlot::Axis axis ) const +double RiuQwtPlotWidget::minorTickInterval( RiaDefines::PlotAxis axis ) const { - QwtScaleDiv scaleDiv = this->axisScaleDiv( QwtPlot::xTop ); + QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( QwtPlot::xTop ); QList minorTicks = scaleDiv.ticks( QwtScaleDiv::MinorTick ); if ( minorTicks.size() < 2 ) return 0.0; @@ -456,24 +452,26 @@ double RiuQwtPlotWidget::minorTickInterval( QwtPlot::Axis axis ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuQwtPlotWidget::axisExtent( QwtPlot::Axis axis ) const +int RiuQwtPlotWidget::axisExtent( RiaDefines::PlotAxis axis ) const { - if ( std::abs( axisRange( axis ).maxValue() - axisRange( axis ).minValue() ) < 1.0e-14 ) return 0; + auto [rangeMin, rangeMax] = axisRange( axis ); + if ( std::abs( rangeMax - rangeMin ) < 1.0e-14 ) return 0; - int lineExtent = 0; + int lineExtent = 0; + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); - if ( this->axisScaleDraw( axis )->hasComponent( QwtAbstractScaleDraw::Ticks ) ) + if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Ticks ) ) { - lineExtent += this->axisScaleDraw( axis )->maxTickLength(); + lineExtent += m_plot->axisScaleDraw( qwtAxis )->maxTickLength(); } - if ( this->axisScaleDraw( axis )->hasComponent( QwtAbstractScaleDraw::Labels ) ) + if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Labels ) ) { - QFont tickLabelFont = axisFont( axis ); + QFont tickLabelFont = m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); // Make space for a fairly long value label QSize labelSize = QFontMetrics( tickLabelFont ).boundingRect( QString( "9.9e-9" ) ).size(); - if ( axis == QwtPlot::yLeft || axis == QwtPlot::yRight ) + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) { lineExtent = labelSize.width(); } @@ -483,12 +481,12 @@ int RiuQwtPlotWidget::axisExtent( QwtPlot::Axis axis ) const } } - if ( !axisTitle( axis ).text().isEmpty() ) + if ( !m_plot->axisTitle( qwtAxis ).text().isEmpty() ) { auto it = m_axisTitlesEnabled.find( axis ); if ( it != m_axisTitlesEnabled.end() && it->second ) { - QFont titleFont = axisTitle( axis ).font(); + QFont titleFont = m_plot->axisTitle( qwtAxis ).font(); // Label is aligned vertically on vertical axes // So height is sufficient in both cases. lineExtent += QFontMetrics( titleFont ).height(); @@ -498,38 +496,6 @@ int RiuQwtPlotWidget::axisExtent( QwtPlot::Axis axis ) const return lineExtent; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RiuQwtPlotWidget::frameIsInFrontOfThis( const QRect& frameGeometry ) -{ - QRect ownGeometry = this->canvas()->geometry(); - ownGeometry.translate( this->geometry().topLeft() ); - - if ( frameGeometry.bottom() < ownGeometry.center().y() ) - { - return true; - } - else if ( frameGeometry.left() < ownGeometry.left() && frameGeometry.top() < ownGeometry.center().y() ) - { - return true; - } - else - { - QRect intersection = ownGeometry.intersected( frameGeometry ); - - double ownArea = double( ownGeometry.height() ) * double( ownGeometry.width() ); - double frameArea = double( frameGeometry.height() ) * double( frameGeometry.width() ); - double intersectionArea = double( intersection.height() ) * double( intersection.width() ); - if ( intersectionArea > 0.8 * std::min( ownArea, frameArea ) ) - { - return true; - } - } - - return false; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -547,37 +513,20 @@ void RiuQwtPlotWidget::scheduleReplot() } //-------------------------------------------------------------------------------------------------- -/// Adds an overlay frame. The overlay frame becomes the responsibility of the plot widget +/// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::addOverlayFrame( RiuDraggableOverlayFrame* overlayFrame ) +void RiuQwtPlotWidget::updateLayout() { - if ( std::find( m_overlayFrames.begin(), m_overlayFrames.end(), overlayFrame ) == m_overlayFrames.end() ) - { - overlayFrame->setParent( this->canvas() ); - m_overlayFrames.push_back( overlayFrame ); - updateLayout(); - } + m_plot->updateLayout(); + updateOverlayFrameLayout(); } -//-------------------------------------------------------------------------------------------------- -/// Remove the overlay widget. The frame becomes the responsibility of the caller -//-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::removeOverlayFrame( RiuDraggableOverlayFrame* overlayFrame ) -{ - CAF_ASSERT( overlayFrame ); - - overlayFrame->hide(); - overlayFrame->setParent( nullptr ); - m_overlayFrames.removeOne( overlayFrame ); -}; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::updateLayout() +void RiuQwtPlotWidget::updateLegend() { - QwtPlot::updateLayout(); - updateOverlayFrameLayout(); + m_plot->updateLegend(); } //-------------------------------------------------------------------------------------------------- @@ -586,7 +535,7 @@ void RiuQwtPlotWidget::updateLayout() bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event ) { QWheelEvent* wheelEvent = dynamic_cast( event ); - if ( wheelEvent && watched == canvas() ) + if ( wheelEvent && watched == m_plot->canvas() ) { event->accept(); @@ -606,12 +555,12 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event ) m_clickPosition = mouseEvent->pos(); } - if ( watched == this && !this->canvas()->geometry().contains( mouseEvent->pos() ) ) + if ( watched == this && !m_plot->canvas()->geometry().contains( mouseEvent->pos() ) ) { if ( mouseEvent->type() == QMouseEvent::MouseButtonRelease && ( mouseEvent->button() == Qt::LeftButton ) && !m_clickPosition.isNull() ) { - QWidget* childClicked = this->childAt( m_clickPosition ); + QWidget* childClicked = m_plot->childAt( m_clickPosition ); if ( childClicked ) { QwtScaleWidget* scaleWidget = qobject_cast( childClicked ); @@ -631,7 +580,7 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event ) } } } - else if ( watched == canvas() ) + else if ( watched == m_plot->canvas() ) { if ( mouseEvent->type() == QMouseEvent::MouseButtonRelease && mouseEvent->button() == Qt::LeftButton && !m_clickPosition.isNull() ) @@ -652,7 +601,8 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event ) void RiuQwtPlotWidget::hideEvent( QHideEvent* event ) { resetPlotItemHighlighting(); - QwtPlot::hideEvent( event ); + // TODO: remove? + // m_plot->hideEvent( event ); } //-------------------------------------------------------------------------------------------------- @@ -660,7 +610,8 @@ void RiuQwtPlotWidget::hideEvent( QHideEvent* event ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::showEvent( QShowEvent* event ) { - QwtPlot::showEvent( event ); + // TODO: remove? + // m_plot->showEvent( event ); } //-------------------------------------------------------------------------------------------------- @@ -668,7 +619,8 @@ void RiuQwtPlotWidget::showEvent( QShowEvent* event ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::resizeEvent( QResizeEvent* event ) { - QwtPlot::resizeEvent( event ); + // TODO: remove??? + // QwtPlot::resizeEvent( event ); updateOverlayFrameLayout(); event->accept(); } @@ -687,27 +639,28 @@ void RiuQwtPlotWidget::keyPressEvent( QKeyEvent* event ) void RiuQwtPlotWidget::applyPlotTitleToQwt() { QString plotTitleToApply = m_plotTitleEnabled ? m_plotTitle : QString( "" ); - QwtText plotTitle = this->title(); + QwtText plotTitle = m_plot->title(); plotTitle.setRenderFlags( Qt::AlignHCenter | Qt::TextSingleLine ); if ( plotTitleToApply != plotTitle.text() ) { plotTitle.setText( plotTitleToApply ); - setTitle( plotTitle ); + m_plot->setTitle( plotTitle ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::applyAxisTitleToQwt( QwtPlot::Axis axis ) +void RiuQwtPlotWidget::applyAxisTitleToQwt( RiaDefines::PlotAxis axis ) { - QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" ); - QwtText axisTitle = this->axisTitle( axis ); + QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QwtText axisTitle = m_plot->axisTitle( qwtAxis ); if ( titleToApply != axisTitle.text() ) { axisTitle.setText( titleToApply ); - setAxisTitle( axis, axisTitle ); + m_plot->setAxisTitle( qwtAxis, axisTitle ); } recalculateAxisExtents( axis ); } @@ -748,11 +701,11 @@ void RiuQwtPlotWidget::endZoomOperations() //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::renderTo( QPainter* painter, const QRect& targetRect, double scaling ) { - static_cast( this->canvas() )->setPaintAttribute( QwtPlotCanvas::BackingStore, false ); + static_cast( m_plot->canvas() )->setPaintAttribute( QwtPlotCanvas::BackingStore, false ); QPoint plotTopLeftInWindowCoords = targetRect.topLeft(); - QRectF canvasRect = this->plotLayout()->canvasRect(); + QRectF canvasRect = m_plot->plotLayout()->canvasRect(); QPoint canvasTopLeftInPlotCoords( canvasRect.topLeft().x() * scaling, canvasRect.topLeft().y() * scaling ); QPoint canvasBottomRightInPlotCoords( canvasRect.bottomRight().x(), canvasRect.bottomRight().y() ); @@ -760,8 +713,8 @@ void RiuQwtPlotWidget::renderTo( QPainter* painter, const QRect& targetRect, dou QPoint canvasBottomRightInWindowCoords = canvasBottomRightInPlotCoords + plotTopLeftInWindowCoords; QwtPlotRenderer renderer( this ); - renderer.render( this, painter, targetRect ); - static_cast( this->canvas() )->setPaintAttribute( QwtPlotCanvas::BackingStore, true ); + renderer.render( m_plot, painter, targetRect ); + static_cast( m_plot->canvas() )->setPaintAttribute( QwtPlotCanvas::BackingStore, true ); for ( RiuDraggableOverlayFrame* overlayFrame : m_overlayFrames ) { @@ -827,7 +780,7 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS int axisId = -1; for ( int i = 0; i < QwtPlot::axisCnt; ++i ) { - if ( scale == this->axisWidget( i ) ) + if ( scale == m_plot->axisWidget( i ) ) { axisId = i; } @@ -838,65 +791,23 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::recalculateAxisExtents( QwtPlot::Axis axis ) +void RiuQwtPlotWidget::recalculateAxisExtents( RiaDefines::PlotAxis axis ) { - if ( axis == QwtPlot::yLeft || axis == QwtPlot::yRight ) + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + if ( qwtAxis == QwtPlot::yLeft || qwtAxis == QwtPlot::yRight ) { int extent = axisExtent( axis ); - axisScaleDraw( axis )->setMinimumExtent( extent ); + m_plot->axisScaleDraw( qwtAxis )->setMinimumExtent( extent ); setMinimumWidth( defaultMinimumWidth() + extent ); } } -//-------------------------------------------------------------------------------------------------- +//-------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::updateOverlayFrameLayout() +QWidget* RiuQwtPlotWidget::getParentForOverlay() const { - const int spacing = 5; - - int xpos = spacing; - int ypos = spacing; - int widthOfCurrentColumn = 0; - - QSize canvasSize = this->canvas()->size(); - QSize maxFrameSize( canvasSize.width() - 2 * m_overlayMargins, canvasSize.height() - 2 * m_overlayMargins ); - - for ( RiuDraggableOverlayFrame* frame : m_overlayFrames ) - { - if ( frame ) - { - QSize minFrameSize = frame->minimumSizeHint(); - QSize desiredFrameSize = frame->sizeHint(); - - int width = std::min( std::max( minFrameSize.width(), desiredFrameSize.width() ), maxFrameSize.width() ); - int height = std::min( std::max( minFrameSize.height(), desiredFrameSize.height() ), maxFrameSize.height() ); - - frame->resize( width, height ); - - if ( frame->anchorCorner() == RiuDraggableOverlayFrame::AnchorCorner::TopLeft ) - { - if ( ypos + frame->height() + spacing > this->canvas()->height() && widthOfCurrentColumn > 0 ) - { - xpos += spacing + widthOfCurrentColumn; - ypos = spacing; - widthOfCurrentColumn = 0; - } - frame->move( xpos, ypos ); - ypos += frame->height() + spacing; - widthOfCurrentColumn = std::max( widthOfCurrentColumn, frame->width() ); - } - else if ( frame->anchorCorner() == RiuDraggableOverlayFrame::AnchorCorner::TopRight ) - { - QRect frameRect = frame->frameGeometry(); - QRect canvasRect = canvas()->rect(); - QPoint canvasTopRight = canvasRect.topRight(); - frameRect.moveTopRight( QPoint( canvasTopRight.x() - spacing, canvasTopRight.y() + spacing ) ); - frame->move( frameRect.topLeft() ); - } - frame->show(); - } - } + return m_plot->canvas(); } //-------------------------------------------------------------------------------------------- @@ -914,7 +825,7 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos, *closestCurvePoint = -1; *distanceFromClick = std::numeric_limits::infinity(); - const QwtPlotItemList& itmList = itemList(); + const QwtPlotItemList& itmList = m_plot->itemList(); for ( QwtPlotItemIterator it = itmList.begin(); it != itmList.end(); it++ ) { if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotCurve ) @@ -932,7 +843,8 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos, else if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotShape ) { QwtPlotShapeItem* shapeItem = static_cast( *it ); - QPointF scalePos( invTransform( xBottom, pos.x() ), invTransform( yLeft, pos.y() ) ); + QPointF scalePos( m_plot->invTransform( QwtPlot::xBottom, pos.x() ), + m_plot->invTransform( QwtPlot::yLeft, pos.y() ) ); if ( shapeItem->shape().boundingRect().contains( scalePos ) ) { *closestItem = *it; @@ -942,7 +854,8 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos, else if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotBarChart ) { QwtPlotBarChart* barChart = static_cast( *it ); - QPointF scalePos( invTransform( xBottom, pos.x() ), invTransform( yLeft, pos.y() ) ); + QPointF scalePos( m_plot->invTransform( QwtPlot::xBottom, pos.x() ), + m_plot->invTransform( QwtPlot::yLeft, pos.y() ) ); bool horizontal = barChart->orientation() == Qt::Horizontal; for ( size_t i = 0; i < barChart->dataSize(); ++i ) @@ -961,6 +874,23 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos, } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- + +std::pair RiuQwtPlotWidget::findClosestCurve( const QPoint& pos, double& distanceFromClick ) const +{ + QwtPlotItem* closestItem = nullptr; + + int closestCurvePoint = -1; + QPoint globalPos = mapToGlobal( pos ); + QPoint localPos = qwtPlot()->canvas()->mapFromGlobal( globalPos ); + + findClosestPlotItem( localPos, &closestItem, &closestCurvePoint, &distanceFromClick ); + auto plotCurve = dynamic_cast( closestItem ); + return std::make_pair( plotCurve, closestCurvePoint ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -978,7 +908,8 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem { // TODO: highlight all selected curves highlightPlotItem( closestItem ); - emit plotItemSelected( closestItem, toggleItemInSelection, distanceFromClick < 10 ? closestCurvePoint : -1 ); + auto plotItem = std::make_shared( closestItem ); + emit plotItemSelected( plotItem, toggleItemInSelection, distanceFromClick < 10 ? closestCurvePoint : -1 ); scheduleReplot(); } @@ -1001,7 +932,7 @@ int RiuQwtPlotWidget::defaultMinimumWidth() //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::replot() { - QwtPlot::replot(); + m_plot->replot(); } //-------------------------------------------------------------------------------------------------- @@ -1011,7 +942,7 @@ void RiuQwtPlotWidget::highlightPlotItem( const QwtPlotItem* closestItem ) { // NB! Create a copy of the item list before the loop to avoid invalidated iterators when iterating the list // plotCurve->setZ() causes the ordering of items in the list to change - auto plotItemList = this->itemList(); + auto plotItemList = m_plot->itemList(); for ( QwtPlotItem* plotItem : plotItemList ) { QwtPlotCurve* plotCurve = dynamic_cast( plotItem ); @@ -1019,7 +950,7 @@ void RiuQwtPlotWidget::highlightPlotItem( const QwtPlotItem* closestItem ) if ( plotCurve ) { QPen existingPen = plotCurve->pen(); - QColor bgColor = this->canvasBackground().color(); + QColor bgColor = m_plot->canvasBackground().color(); QColor curveColor = existingPen.color(); QColor symbolColor; @@ -1073,7 +1004,7 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting() { // NB! Create a copy of the item list before the loop to avoid invalidated iterators when iterating the list // plotCurve->setZ() causes the ordering of items in the list to change - auto plotItemList = this->itemList(); + auto plotItemList = m_plot->itemList(); for ( QwtPlotItem* plotItem : plotItemList ) { QwtPlotCurve* plotCurve = dynamic_cast( plotItem ); @@ -1108,3 +1039,130 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting() m_originalCurveColors.clear(); m_originalZValues.clear(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QwtPlot* RiuQwtPlotWidget::qwtPlot() const +{ + return m_plot; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) +{ + m_plot->enableAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ), isEnabled ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuQwtPlotWidget::axisEnabled( RiaDefines::PlotAxis axis ) const +{ + return m_plot->axisEnabled( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) +{ + m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMinor ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) +{ + m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMajor ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::removeEventFilter() +{ + m_plot->removeEventFilter( m_plot ); + m_plot->canvas()->removeEventFilter( m_plot ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::setAxisAutoScale( RiaDefines::PlotAxis axis, bool autoScale ) +{ + m_plot->setAxisAutoScale( RiuQwtPlotTools::toQwtPlotAxis( axis ), autoScale ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) +{ + m_plot->setAxisScale( RiuQwtPlotTools::toQwtPlotAxis( axis ), min, max ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiaDefines::PlotAxis axis ) const +{ + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + + QwtLogScaleEngine* logScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); + QwtDateScaleEngine* dateScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); + if ( logScaleEngine != nullptr ) + return AxisScaleType::LOGARITHMIC; + else if ( dateScaleEngine != nullptr ) + return AxisScaleType::DATE; + + return AxisScaleType::LINEAR; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::setAxisScaleType( RiaDefines::PlotAxis axis, RiuQwtPlotWidget::AxisScaleType axisScaleType ) +{ + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + + if ( axisScaleType == AxisScaleType::LOGARITHMIC ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLogScaleEngine ); + if ( axisScaleType == AxisScaleType::LINEAR ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLinearScaleEngine ); + if ( axisScaleType == AxisScaleType::DATE ) m_plot->setAxisScaleEngine( qwtAxis, new QwtDateScaleEngine ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::updateAxes() +{ + m_plot->updateAxes(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotCurve* RiuQwtPlotWidget::createPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title, const QColor& color ) +{ + return new RiuQwtPlotCurve( ownerRimCurve, title ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::detachItems( RiuPlotWidget::PlotItemType plotItemType ) +{ + CAF_ASSERT( plotItemType == RiuPlotWidget::PlotItemType::CURVE ); + if ( plotItemType == RiuPlotWidget::PlotItemType::CURVE ) qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotCurve ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QColor& RiuQwtPlotWidget::backgroundColor() const +{ + return m_plot->canvasBackground().color(); +} diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index 0a07ac795c..342c0dd182 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -19,27 +19,31 @@ #pragma once -#include "RiuInterfaceToViewWindow.h" +#include "RiaDefines.h" +#include "RiaPlotDefines.h" + +#include "RiuPlotWidget.h" #include "cafPdmObject.h" #include "cafPdmPointer.h" -#include "qwt_plot.h" - #include -#include - class RiaPlotWindowRedrawScheduler; class RimPlot; -class RiuDraggableOverlayFrame; +class RimPlotCurve; +class RiuPlotCurve; +class RiuPlotItem; + +class QwtPlot; class QwtLegend; class QwtPicker; class QwtPlotCurve; class QwtPlotGrid; class QwtPlotItem; class QwtPlotMarker; +class QwtScaleWidget; class QEvent; class QLabel; @@ -52,7 +56,7 @@ class QWheelEvent; // // //================================================================================================== -class RiuQwtPlotWidget : public QwtPlot, public RiuInterfaceToViewWindow +class RiuQwtPlotWidget : public RiuPlotWidget { Q_OBJECT @@ -60,82 +64,110 @@ class RiuQwtPlotWidget : public QwtPlot, public RiuInterfaceToViewWindow RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent = nullptr ); ~RiuQwtPlotWidget() override; - RimPlot* plotDefinition(); - - bool isChecked() const; - - int colSpan() const; - int rowSpan() const; - - int axisTitleFontSize( QwtPlot::Axis axis ) const; - int axisValueFontSize( QwtPlot::Axis axis ) const; - void setAxisFontsAndAlignment( QwtPlot::Axis, + int axisTitleFontSize( RiaDefines::PlotAxis axis ) const override; + int axisValueFontSize( RiaDefines::PlotAxis axis ) const override; + void setAxisFontsAndAlignment( RiaDefines::PlotAxis, int titleFontSize, int valueFontSize, bool titleBold = false, - int alignment = (int)Qt::AlignCenter ); + int alignment = (int)Qt::AlignCenter ) override; void setAxesFontsAndAlignment( int titleFontSize, int valueFontSize, bool titleBold = false, - int alignment = (int)Qt::AlignCenter ); + int alignment = (int)Qt::AlignCenter ) override; + + void enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) override; + bool axisEnabled( RiaDefines::PlotAxis axis ) const override; + + void setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) override; + void setAxisAutoScale( RiaDefines::PlotAxis axis, bool enable ) override; - void setAxisTitleText( QwtPlot::Axis axis, const QString& title ); - void setAxisTitleEnabled( QwtPlot::Axis axis, bool enable ); + void setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) override; + void setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) override; - void setPlotTitle( const QString& plotTitle ); + RiuPlotWidget::AxisScaleType axisScaleType( RiaDefines::PlotAxis axis ) const override; + void setAxisScaleType( RiaDefines::PlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) override; + + void setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) override; + void setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) override; + + void setPlotTitle( const QString& plotTitle ) override; const QString& plotTitle() const; void setPlotTitleEnabled( bool enabled ); bool plotTitleEnabled() const; - void setPlotTitleFontSize( int titleFontSize ); - - void setLegendFontSize( int fontSize ); - void setInternalLegendVisible( bool visible ); - - QwtInterval axisRange( QwtPlot::Axis axis ) const; - void setAxisRange( QwtPlot::Axis axis, double min, double max ); - - void setAxisInverted( QwtPlot::Axis axis ); - void setAxisLabelsAndTicksEnabled( QwtPlot::Axis axis, bool enableLabels, bool enableTicks ); - - void enableGridLines( QwtPlot::Axis axis, bool majorGridLines, bool minorGridLines ); - - void setMajorAndMinorTickIntervals( QwtPlot::Axis axis, - double majorTickInterval, - double minorTickInterval, - double minValue, - double maxValue ); - void setMajorAndMinorTickIntervalsAndRange( QwtPlot::Axis axis, - double majorTickInterval, - double minorTickInterval, - double minTickValue, - double maxTickValue, - double rangeMin, - double rangeMax ); - void setAutoTickIntervalCounts( QwtPlot::Axis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ); - double majorTickInterval( QwtPlot::Axis axis ) const; - double minorTickInterval( QwtPlot::Axis axis ) const; - - int axisExtent( QwtPlot::Axis axis ) const; - - bool frameIsInFrontOfThis( const QRect& frameGeometry ); + void setPlotTitleFontSize( int titleFontSize ) override; + + void setLegendFontSize( int fontSize ) override; + void setInternalLegendVisible( bool visible ) override; + void insertLegend( RiuPlotWidget::Legend ) override; + void clearLegend() override; + + std::pair axisRange( RiaDefines::PlotAxis axis ) const override; + void setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) override; + + void setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) override; + void setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) override; + + void enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) override; + + void setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minValue, + double maxValue ) override; + void setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minTickValue, + double maxTickValue, + double rangeMin, + double rangeMax ) override; + void setAutoTickIntervalCounts( RiaDefines::PlotAxis axis, + int maxMajorTickIntervalCount, + int maxMinorTickIntervalCount ) override; + double majorTickInterval( RiaDefines::PlotAxis axis ) const override; + double minorTickInterval( RiaDefines::PlotAxis axis ) const override; + + int axisExtent( RiaDefines::PlotAxis axis ) const override; + QPoint dragStartPosition() const; void scheduleReplot(); - void addOverlayFrame( RiuDraggableOverlayFrame* overlayWidget ); - void removeOverlayFrame( RiuDraggableOverlayFrame* overlayWidget ); void updateLayout() override; - void renderTo( QPainter* painter, const QRect& targetRect, double scaling ); - void renderTo( QPaintDevice* painter, const QRect& targetRect ); + void renderTo( QPainter* painter, const QRect& targetRect, double scaling ) override; + void renderTo( QPaintDevice* painter, const QRect& targetRect ) override; int overlayMargins() const; RimViewWindow* ownerViewWindow() const override; + QwtPlot* qwtPlot() const; + + void removeEventFilter() override; + + void updateLegend() override; + void updateAxes() override; + + RiuPlotCurve* createPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title, const QColor& color ) override; + + void detachItems( RiuPlotWidget::PlotItemType plotItemType ) override; + + void findClosestPlotItem( const QPoint& pos, + QwtPlotItem** closestItem, + int* closestCurvePoint, + double* distanceFromClick ) const; + + const QColor& backgroundColor() const override; + + QWidget* getParentForOverlay() const override; + + std::pair findClosestCurve( const QPoint& pos, double& distanceToClick ) const override; + signals: void plotSelected( bool toggleSelection ); void axisSelected( int axisId, bool toggleSelection ); - void plotItemSelected( QwtPlotItem* plotItem, bool toggleSelection, int sampleIndex ); + void plotItemSelected( std::shared_ptr plotItem, bool toggleSelection, int sampleIndex ); void onKeyPressEvent( QKeyEvent* event ); void onWheelEvent( QWheelEvent* event ); void plotZoomed(); @@ -148,7 +180,7 @@ class RiuQwtPlotWidget : public QwtPlot, public RiuInterfaceToViewWindow void keyPressEvent( QKeyEvent* event ) override; void applyPlotTitleToQwt(); - void applyAxisTitleToQwt( QwtPlot::Axis axis ); + void applyAxisTitleToQwt( RiaDefines::PlotAxis axis ); QSize sizeHint() const override; QSize minimumSizeHint() const override; @@ -156,11 +188,6 @@ class RiuQwtPlotWidget : public QwtPlot, public RiuInterfaceToViewWindow virtual bool isZoomerActive() const; virtual void endZoomOperations(); - void findClosestPlotItem( const QPoint& pos, - QwtPlotItem** closestItem, - int* closestCurvePoint, - double* distanceFromClick ) const; - private: void selectClosestPlotItem( const QPoint& pos, bool toggleItemInSelection = false ); static int defaultMinimumWidth(); @@ -169,21 +196,9 @@ class RiuQwtPlotWidget : public QwtPlot, public RiuInterfaceToViewWindow void highlightPlotItem( const QwtPlotItem* closestItem ); void resetPlotItemHighlighting(); void onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection ); - void recalculateAxisExtents( QwtPlot::Axis axis ); - - void updateOverlayFrameLayout(); + void recalculateAxisExtents( RiaDefines::PlotAxis axis ); private: - caf::PdmPointer m_plotDefinition; - QPoint m_clickPosition; - std::map m_axisTitles; - std::map m_axisTitlesEnabled; - const int m_overlayMargins; - QString m_plotTitle; - bool m_plotTitleEnabled; - - QList> m_overlayFrames; - struct CurveColors { QColor lineColor; @@ -194,5 +209,5 @@ class RiuQwtPlotWidget : public QwtPlot, public RiuInterfaceToViewWindow std::map m_originalCurveColors; std::map m_originalZValues; - friend class RiaPlotWindowRedrawScheduler; + QPointer m_plot; }; diff --git a/ApplicationLibCode/UserInterface/RiuQwtSymbol.cpp b/ApplicationLibCode/UserInterface/RiuQwtSymbol.cpp index 719abef29f..b8f292b726 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtSymbol.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtSymbol.cpp @@ -22,7 +22,9 @@ #include "RiaColorTools.h" #include "RiaFontCache.h" +#include "RiuPlotCurveSymbol.h" #include "cvfAssert.h" +#include "qwt_symbol.h" #include #include @@ -31,10 +33,8 @@ /// Internal class to support labels on symbols //-------------------------------------------------------------------------------------------------- RiuQwtSymbol::RiuQwtSymbol( PointSymbolEnum riuStyle, const QString& label, LabelPosition labelPosition, int labelFontSizePt ) - : QwtSymbol( QwtSymbol::NoSymbol ) - , m_globalLabel( label ) - , m_labelPosition( labelPosition ) - , m_labelFontSizePx( caf::FontTools::pointSizeToPixelSize( labelFontSizePt ) ) + : RiuPlotCurveSymbol( riuStyle, label, labelPosition, labelFontSizePt ) + , QwtSymbol( QwtSymbol::NoSymbol ) { QwtSymbol::Style style = QwtSymbol::NoSymbol; @@ -132,6 +132,30 @@ RiuQwtSymbol::RiuQwtSymbol( PointSymbolEnum riuStyle, const QString& label, Labe setStyle( style ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtSymbol::setSize( int width, int height ) +{ + QwtSymbol::setSize( width, height ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtSymbol::setColor( const QColor& color ) +{ + QwtSymbol::setColor( color ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtSymbol::setPen( const QPen& pen ) +{ + QwtSymbol::setPen( pen ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -170,104 +194,15 @@ void RiuQwtSymbol::renderSymbolLabel( QPainter* painter, const QPointF& position //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiuQwtSymbol::globalLabel() const -{ - return m_globalLabel; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuQwtSymbol::setGlobalLabel( const QString& label ) -{ - m_globalLabel = label; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuQwtSymbol::setLabelPosition( LabelPosition labelPosition ) -{ - m_labelPosition = labelPosition; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::PointSymbolEnum RiuQwtSymbol::cycledSymbolStyle( int indexLevel1, int indexLevel2 ) +void RiuQwtSymbol::setPixmap( const QPixmap& pixmap ) { - std::vector> categorisedStyles = { - { SYMBOL_ELLIPSE, SYMBOL_RECT, SYMBOL_DIAMOND }, - { SYMBOL_DOWN_TRIANGLE, SYMBOL_UP_TRIANGLE }, - { SYMBOL_LEFT_TRIANGLE, SYMBOL_RIGHT_TRIANGLE }, - { SYMBOL_CROSS, SYMBOL_XCROSS }, - { SYMBOL_STAR1, SYMBOL_STAR2 }, - }; - - int level1Category = indexLevel1 % int( categorisedStyles.size() ); - int level2Category = indexLevel2 % int( categorisedStyles[level1Category].size() ); - - return categorisedStyles[level1Category][level2Category]; + QwtSymbol::setPixmap( pixmap ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::PointSymbolEnum RiuQwtSymbol::cycledSymbolStyle( int indexLevel ) -{ - std::vector contrastingSymbols = { SYMBOL_ELLIPSE, - SYMBOL_CROSS, - SYMBOL_RECT, - SYMBOL_DOWN_TRIANGLE, - SYMBOL_UP_TRIANGLE, - SYMBOL_LEFT_TRIANGLE, - SYMBOL_RIGHT_TRIANGLE, - SYMBOL_STAR2, - SYMBOL_DIAMOND, - SYMBOL_STAR1 }; - - return contrastingSymbols[indexLevel % (int)contrastingSymbols.size()]; -} - -//-------------------------------------------------------------------------------------------------- -/// Is this a symbol with an interior and a border? If false, it is just lines. -//-------------------------------------------------------------------------------------------------- -bool RiuQwtSymbol::isFilledSymbol( PointSymbolEnum symbol ) +QRect RiuQwtSymbol::boundingRect() const { - return symbol != SYMBOL_NONE && symbol != SYMBOL_CROSS && symbol != SYMBOL_XCROSS && symbol != SYMBOL_STAR1; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QRect RiuQwtSymbol::labelBoundingRect( const QPainter* painter, const QRect& symbolRect, const QString& label ) const -{ - CVF_ASSERT( painter ); - - QPoint symbolPosition = symbolRect.topLeft(); - - int symbolWidth = symbolRect.width(); - int symbolHeight = symbolRect.height(); - - int labelWidth = painter->fontMetrics().width( label ); - int labelHeight = painter->fontMetrics().height(); - - QPoint labelPosition; - if ( m_labelPosition == LabelAboveSymbol ) - { - labelPosition = QPoint( symbolPosition.x() - labelWidth / 2, symbolPosition.y() - 5 ); - } - else if ( m_labelPosition == LabelBelowSymbol ) - { - labelPosition = QPoint( symbolPosition.x() - labelWidth / 2, symbolPosition.y() + symbolHeight + 5 ); - } - else if ( m_labelPosition == LabelLeftOfSymbol ) - { - labelPosition = QPoint( symbolPosition.x() - labelWidth - symbolWidth, symbolPosition.y() ); - } - else if ( m_labelPosition == LabelRightOfSymbol ) - { - labelPosition = QPoint( symbolPosition.x() + symbolWidth + 3, symbolPosition.y() ); - } - return QRect( labelPosition.x(), labelPosition.y(), labelWidth, labelHeight ); + return QwtSymbol::boundingRect(); } diff --git a/ApplicationLibCode/UserInterface/RiuQwtSymbol.h b/ApplicationLibCode/UserInterface/RiuQwtSymbol.h index 8b3e627773..343a50ec7f 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtSymbol.h +++ b/ApplicationLibCode/UserInterface/RiuQwtSymbol.h @@ -18,70 +18,39 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include "RiuPlotCurveSymbol.h" #include "qwt_symbol.h" + #include +class QPainter; +class QPointF; +class QRect; + //-------------------------------------------------------------------------------------------------- /// This class overrides renderSymbols to draw symbols and labels. /// The label is only visible in the legend, while it is clipped in the plot. /// Therefore the method RiuQwtPlotCurve::drawSymbols also draw labels to have labels /// in the plot as well. //-------------------------------------------------------------------------------------------------- -class RiuQwtSymbol : public QwtSymbol +class RiuQwtSymbol : public RiuPlotCurveSymbol, public QwtSymbol { public: - enum LabelPosition - { - LabelAboveSymbol, - LabelBelowSymbol, - LabelLeftOfSymbol, - LabelRightOfSymbol - }; - enum PointSymbolEnum - { - SYMBOL_NONE, - SYMBOL_ELLIPSE, - SYMBOL_RECT, - SYMBOL_DIAMOND, - SYMBOL_TRIANGLE, - SYMBOL_DOWN_TRIANGLE, - SYMBOL_CROSS, - SYMBOL_XCROSS, - SYMBOL_LEFT_ALIGNED_TRIANGLE, // Aligned so pin point is at lower right corner - SYMBOL_RIGHT_ALIGNED_TRIANGLE, // Aligned so pin point is at lower left corner - SYMBOL_LEFT_ANGLED_TRIANGLE, - SYMBOL_RIGHT_ANGLED_TRIANGLE, - SYMBOL_UP_TRIANGLE, - SYMBOL_STAR1, - SYMBOL_STAR2, - SYMBOL_HEXAGON, - SYMBOL_LEFT_TRIANGLE, - SYMBOL_RIGHT_TRIANGLE - }; - - RiuQwtSymbol( PointSymbolEnum riuStyle, - const QString& label, - LabelPosition labelPosition = LabelAboveSymbol, - int labelFontSizePt = 8 ); - void renderSymbols( QPainter* painter, const QPointF* points, int numPoints ) const override; - void renderSymbolLabel( QPainter* painter, const QPointF& position, const QString& label ) const; - QString globalLabel() const; - - void setGlobalLabel( const QString& label ); + RiuQwtSymbol( RiuPlotCurveSymbol::PointSymbolEnum riuStyle, + const QString& label = QString(), + LabelPosition labelPosition = RiuPlotCurveSymbol::LabelAboveSymbol, + int labelFontSizePt = 8 ); + void renderSymbols( QPainter* painter, const QPointF* points, int numPoints ) const override; + void renderSymbolLabel( QPainter* painter, const QPointF& position, const QString& label ) const; - void setLabelPosition( LabelPosition labelPosition ); + void setSize( int width, int height ) override; - static PointSymbolEnum cycledSymbolStyle( int indexLevel1, int indexLevel2 ); - static PointSymbolEnum cycledSymbolStyle( int indexLevel ); + void setColor( const QColor& color ) override; - static bool isFilledSymbol( PointSymbolEnum symbol ); + void setPen( const QPen& pen ) override; -private: - QRect labelBoundingRect( const QPainter* painter, const QRect& symbolRect, const QString& label ) const; + void setPixmap( const QPixmap& pixmap ) override; -private: - QString m_globalLabel; - int m_labelFontSizePx; - LabelPosition m_labelPosition; + QRect boundingRect() const override; }; diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index b818e239f8..6e9a38430a 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -18,16 +18,18 @@ #include "RiuRelativePermeabilityPlotPanel.h" +#include "RigFlowDiagSolverInterface.h" + #include "RiaCurveDataTools.h" #include "RiaEclipseUnitTools.h" +#include "RiaPlotDefines.h" #include "RiaResultNames.h" - -#include "RigFlowDiagSolverInterface.h" - #include "RiuDockedQwtPlot.h" #include "RiuGuiTheme.h" +#include "RiuPlotCurveSymbol.h" #include "RiuQwtPlotCurve.h" #include "RiuQwtPlotTools.h" +#include "RiuQwtSymbol.h" #include "RiuRelativePermeabilityPlotUpdater.h" #include "RiuTextDialog.h" @@ -39,7 +41,6 @@ #include "qwt_plot_curve.h" #include "qwt_plot_marker.h" #include "qwt_scale_engine.h" -#include "qwt_symbol.h" #include #include @@ -363,11 +364,9 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS plotOnWhichYAxis = RIGHT_YAXIS; } - // QwtPlotCurve* qwtCurve = new QwtPlotCurve(curve.name.c_str()); - RiuQwtPlotCurve* qwtCurve = new RiuQwtPlotCurve( curve.name.c_str() ); + RiuQwtPlotCurve* qwtCurve = new RiuQwtPlotCurve( nullptr, curve.name.c_str() ); CVF_ASSERT( curve.saturationVals.size() == curve.yVals.size() ); - // qwtCurve->setSamples(curve.xVals.data(), curve.yVals.data(), static_cast(curve.xVals.size())); const bool includePositiveValuesOnly = ( logScaleLeftAxis && plotOnWhichYAxis == LEFT_YAXIS ); qwtCurve->setSamplesFromXValuesAndYValues( curve.saturationVals, curve.yVals, includePositiveValuesOnly ); @@ -403,7 +402,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS const QPen curvePen( QBrush(), 1, penStyle ); qwtCurve->setPen( curvePen ); - QwtSymbol* curveSymbol = new QwtSymbol( QwtSymbol::Ellipse ); + RiuQwtSymbol* curveSymbol = new RiuQwtSymbol( RiuPlotCurveSymbol::SYMBOL_ELLIPSE ); curveSymbol->setSize( 6, 6 ); curveSymbol->setBrush( Qt::NoBrush ); qwtCurve->setSymbol( curveSymbol ); @@ -416,7 +415,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS if ( plotOnWhichYAxis == RIGHT_YAXIS ) { - qwtCurve->setYAxis( QwtPlot::yRight ); + qwtCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); shouldEnableRightYAxis = true; } diff --git a/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp index c8f087be81..d368d102d1 100644 --- a/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp @@ -78,7 +78,7 @@ void RiuResultQwtPlot::addCurve( const RimCase* rimCase, return; } - RiuQwtPlotCurve* plotCurve = new RiuQwtPlotCurve( "Curve 1" ); + RiuQwtPlotCurve* plotCurve = new RiuQwtPlotCurve( nullptr, "Curve 1" ); plotCurve->setSamplesFromDatesAndYValues( dateTimes, timeHistoryValues, false ); plotCurve->setTitle( curveName ); diff --git a/ApplicationLibCode/UserInterface/RiuResultQwtPlot.h b/ApplicationLibCode/UserInterface/RiuResultQwtPlot.h index 4c94cd5ad2..e6f346b9d2 100644 --- a/ApplicationLibCode/UserInterface/RiuResultQwtPlot.h +++ b/ApplicationLibCode/UserInterface/RiuResultQwtPlot.h @@ -21,8 +21,6 @@ #include "RiuDockedQwtPlot.h" -#include "qwt_plot.h" - #include #include #include diff --git a/ApplicationLibCode/UserInterface/RiuRimQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuRimQwtPlotCurve.cpp deleted file mode 100644 index 77fbe027b3..0000000000 --- a/ApplicationLibCode/UserInterface/RiuRimQwtPlotCurve.cpp +++ /dev/null @@ -1,45 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// 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 -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RiuRimQwtPlotCurve.h" -#include "RimPlotCurve.h" - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuRimQwtPlotCurve::RiuRimQwtPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title /*= QString()*/ ) - : RiuQwtPlotCurve( title ) - , m_ownerRimCurve( ownerRimCurve ) -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimPlotCurve* RiuRimQwtPlotCurve::ownerRimCurve() -{ - return m_ownerRimCurve; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -const RimPlotCurve* RiuRimQwtPlotCurve::ownerRimCurve() const -{ - return m_ownerRimCurve; -} diff --git a/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp new file mode 100644 index 0000000000..5ec31a3c1a --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp @@ -0,0 +1,198 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2019- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuSummaryPlot.h" + +#include "Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h" + +#include "RimEnsembleCurveSet.h" +#include "RimPlot.h" +#include "RimSummaryCurve.h" +#include "RimSummaryPlot.h" + +#include "RiuPlotCurve.h" +#include "RiuPlotWidget.h" + +#include "cafCmdFeatureMenuBuilder.h" + +#include + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuSummaryPlot::RiuSummaryPlot( RimSummaryPlot* plot, QWidget* parent ) + : QWidget( parent ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuSummaryPlot::~RiuSummaryPlot() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSummaryPlot::showContextMenu( QPoint pos ) +{ + QMenu menu; + caf::CmdFeatureMenuBuilder menuBuilder; + + menuBuilder << "RicShowPlotDataFeature"; + menuBuilder << "RicSavePlotTemplateFeature"; + + double distanceFromClick = std::numeric_limits::infinity(); + + auto [plotCurve, closestCurvePoint] = plotWidget()->findClosestCurve( pos, distanceFromClick ); + + if ( plotCurve && closestCurvePoint >= 0 ) + { + RimSummaryCurve* summaryCurve = dynamic_cast( plotCurve->ownerRimCurve() ); + if ( summaryCurve && closestCurvePoint < (int)summaryCurve->timeStepsY().size() ) + { + std::time_t timeStep = summaryCurve->timeStepsY()[closestCurvePoint]; + + RimSummaryCaseCollection* ensemble = nullptr; + QString clickedQuantityName; + QStringList allQuantityNamesInPlot; + + RimEnsembleCurveSet* clickedEnsembleCurveSet = nullptr; + summaryCurve->firstAncestorOrThisOfType( clickedEnsembleCurveSet ); + + bool curveClicked = distanceFromClick < 50; + + if ( clickedEnsembleCurveSet ) + { + ensemble = clickedEnsembleCurveSet->summaryCaseCollection(); + if ( ensemble && ensemble->isEnsemble() ) + { + clickedQuantityName = QString::fromStdString( clickedEnsembleCurveSet->summaryAddress().uiText() ); + } + } + + { + auto summaryCase = summaryCurve->summaryCaseY(); + if ( summaryCase ) + { + int summaryCaseId = summaryCase->caseId(); + QVariant summaryCaseIdVariant( summaryCaseId ); + auto modelName = summaryCase->nativeCaseName(); + + menuBuilder.addCmdFeatureWithUserData( "RicImportGridModelFromSummaryCurveFeature", + QString( "Open Grid Model '%1'" ).arg( modelName ), + summaryCaseIdVariant ); + } + } + + if ( !curveClicked ) + { + RimSummaryPlot* summaryPlot = static_cast( plotWidget()->plotDefinition() ); + std::vector allCurveSetsInPlot; + summaryPlot->descendantsOfType( allCurveSetsInPlot ); + for ( auto curveSet : allCurveSetsInPlot ) + { + allQuantityNamesInPlot.push_back( QString::fromStdString( curveSet->summaryAddress().uiText() ) ); + } + } + else + { + allQuantityNamesInPlot.push_back( clickedQuantityName ); + } + + if ( !clickedQuantityName.isEmpty() || !allQuantityNamesInPlot.isEmpty() ) + { + if ( ensemble && ensemble->isEnsemble() ) + { + EnsemblePlotParams params( ensemble, allQuantityNamesInPlot, clickedQuantityName, timeStep ); + QVariant variant = QVariant::fromValue( params ); + + menuBuilder.addCmdFeatureWithUserData( "RicNewAnalysisPlotFeature", "New Analysis Plot", variant ); + + QString subMenuName = "Create Correlation Plot"; + if ( curveClicked ) + { + subMenuName = "Create Correlation Plot From Curve Point"; + } + menuBuilder.subMenuStart( subMenuName, *caf::IconProvider( ":/CorrelationPlots16x16.png" ).icon() ); + + { + if ( curveClicked ) + { + menuBuilder.addCmdFeatureWithUserData( "RicNewCorrelationPlotFeature", + "New Tornado Plot", + variant ); + } + menuBuilder.addCmdFeatureWithUserData( "RicNewCorrelationMatrixPlotFeature", + "New Matrix Plot", + variant ); + menuBuilder.addCmdFeatureWithUserData( "RicNewCorrelationReportPlotFeature", + "New Report Plot", + variant ); + if ( curveClicked ) + { + menuBuilder.subMenuStart( "Cross Plots", + *caf::IconProvider( ":/CorrelationCrossPlot16x16.png" ).icon() ); + std::vector> ensembleParameters = + ensemble->parameterCorrelations( clickedEnsembleCurveSet->summaryAddress(), timeStep ); + std::sort( ensembleParameters.begin(), + ensembleParameters.end(), + []( const std::pair& lhs, + const std::pair& rhs ) { + return std::fabs( lhs.second ) > std::fabs( rhs.second ); + } ); + + for ( const auto& param : ensembleParameters ) + { + if ( std::fabs( param.second ) >= 1.0e-6 ) + { + params.ensembleParameter = param.first.name; + variant = QVariant::fromValue( params ); + menuBuilder.addCmdFeatureWithUserData( "RicNewParameterResultCrossPlotFeature", + QString( "New Cross Plot Against %1 " + "(Correlation: %2)" ) + .arg( param.first.name ) + .arg( param.second, 5, 'f', 2 ), + variant ); + } + } + menuBuilder.subMenuEnd(); + } + } + menuBuilder.subMenuEnd(); + } + } + } + } + + menuBuilder.appendToMenu( &menu ); + + if ( menu.actions().size() > 0 ) + { + menu.exec( mapToGlobal( pos ) ); + + // Parts of progress dialog GUI can be present after menu has closed related to + // RicImportGridModelFromSummaryCurveFeature. Make sure the plot is updated, and call processEvents() to make + // sure all GUI events are processed + plotWidget()->update(); + QApplication::processEvents(); + } +} diff --git a/ApplicationLibCode/UserInterface/RiuSummaryPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryPlot.h new file mode 100644 index 0000000000..50bd88b3ba --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuSummaryPlot.h @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2019- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaQDateTimeTools.h" +#include "RiuInterfaceToViewWindow.h" + +#include + +class RimSummaryPlot; +class RimPlotAxisPropertiesInterface; +class RiuPlotWidget; + +//================================================================================================== +// +// +// +//================================================================================================== +class RiuSummaryPlot : public QWidget +{ + Q_OBJECT +public: + RiuSummaryPlot( RimSummaryPlot* plot, QWidget* parent ); + ~RiuSummaryPlot() override; + + virtual void useDateBasedTimeAxis( + const QString& dateFormat, + const QString& timeFormat, + RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED, + RiaQDateTimeTools::TimeFormatComponents timeComponents = + RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) = 0; + + virtual void useTimeBasedTimeAxis() = 0; + + virtual void updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties ) = 0; + + virtual RiuPlotWidget* plotWidget() const = 0; + +public slots: + void showContextMenu( QPoint ); +}; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp new file mode 100644 index 0000000000..24e663dc77 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp @@ -0,0 +1,98 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2019- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuSummaryQtChartsPlot.h" + +#include "RiaPreferences.h" + +#include "RimSummaryPlot.h" + +#include "RiuPlotCurve.h" +#include "RiuPlotWidget.h" +#include "RiuQtChartsPlotTools.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuSummaryQtChartsPlot::RiuSummaryQtChartsPlot( RimSummaryPlot* plot, QWidget* parent /*= nullptr*/ ) + : RiuSummaryPlot( plot, parent ) +{ + m_plotWidget = new RiuQtChartsPlotWidget( plot ); + m_plotWidget->setContextMenuPolicy( Qt::CustomContextMenu ); + connect( m_plotWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( showContextMenu( QPoint ) ) ); + + setDefaults(); + + RiuQtChartsPlotTools::setCommonPlotBehaviour( m_plotWidget ); + RiuQtChartsPlotTools::setDefaultAxes( m_plotWidget ); + + m_plotWidget->setInternalLegendVisible( true ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuSummaryQtChartsPlot::~RiuSummaryQtChartsPlot() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSummaryQtChartsPlot::useDateBasedTimeAxis( const QString& dateFormat, + const QString& timeFormat, + RiaQDateTimeTools::DateFormatComponents dateComponents, + RiaQDateTimeTools::TimeFormatComponents timeComponents ) +{ + m_plotWidget->setAxisScaleType( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, RiuPlotWidget::AxisScaleType::DATE ); + RiuQtChartsPlotTools::enableDateBasedBottomXAxis( m_plotWidget, dateFormat, timeFormat, dateComponents, timeComponents ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSummaryQtChartsPlot::useTimeBasedTimeAxis() +{ + m_plotWidget->setAxisScaleType( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, RiuPlotWidget::AxisScaleType::DATE ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSummaryQtChartsPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSummaryQtChartsPlot::setDefaults() +{ + QString dateFormat = RiaPreferences::current()->dateFormat(); + QString timeFormat = RiaPreferences::current()->timeFormat(); + + useDateBasedTimeAxis( dateFormat, timeFormat ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotWidget* RiuSummaryQtChartsPlot::plotWidget() const +{ + return m_plotWidget; +} diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h new file mode 100644 index 0000000000..4d8b4c84bb --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2019- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaQDateTimeTools.h" + +#include "RiuQtChartsPlotWidget.h" +#include "RiuSummaryPlot.h" + +#include + +class RimSummaryPlot; +class RimPlotAxisPropertiesInterface; + +//================================================================================================== +// +// +// +//================================================================================================== +class RiuSummaryQtChartsPlot : public RiuSummaryPlot +{ + Q_OBJECT; + +public: + RiuSummaryQtChartsPlot( RimSummaryPlot* plot, QWidget* parent = nullptr ); + ~RiuSummaryQtChartsPlot() override; + + void useDateBasedTimeAxis( const QString& dateFormat, + const QString& timeFormat, + RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED, + RiaQDateTimeTools::TimeFormatComponents timeComponents = + RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) override; + + void useTimeBasedTimeAxis() override; + + void updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties ) override; + + RiuPlotWidget* plotWidget() const override; + +protected: + void setDefaults(); + +private: + QPointer m_plotWidget; +}; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp index 2036c1f7ac..c99f8f7f3c 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -23,26 +23,18 @@ #include "Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h" -#include "RimEnsembleCurveSet.h" -#include "RimEnsembleCurveSetCollection.h" -#include "RimEnsembleStatisticsCase.h" -#include "RimMainPlotCollection.h" -#include "RimPlot.h" #include "RimPlotAxisAnnotation.h" #include "RimPlotAxisProperties.h" #include "RimPlotAxisPropertiesInterface.h" -#include "RimRegularLegendConfig.h" #include "RimSummaryCase.h" -#include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" -#include "RimSummaryCurveCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotAnnotationTool.h" +#include "RiuPlotCurve.h" #include "RiuQwtCurvePointTracker.h" #include "RiuQwtPlotWheelZoomer.h" -#include "RiuRimQwtPlotCurve.h" +#include "RiuQwtPlotWidget.h" #include "RiuWidgetDragger.h" #include "RiuPlotMainWindowTools.h" @@ -51,8 +43,6 @@ #include "RiuQwtPlotZoomer.h" #include "RiuQwtScalePicker.h" -#include "RimProject.h" - #include "cafCmdFeatureMenuBuilder.h" #include "cafIconProvider.h" #include "cafSelectionManager.h" @@ -88,8 +78,8 @@ class EnsembleCurveInfoTextProvider : public IPlotCurveInfoTextProvider //-------------------------------------------------------------------------------------------------- QString curveInfoText( QwtPlotCurve* curve ) override { - RiuRimQwtPlotCurve* riuCurve = dynamic_cast( curve ); - RimSummaryCurve* sumCurve = nullptr; + RiuPlotCurve* riuCurve = dynamic_cast( curve ); + RimSummaryCurve* sumCurve = nullptr; if ( riuCurve ) { sumCurve = dynamic_cast( riuCurve->ownerRimCurve() ); @@ -104,24 +94,28 @@ static EnsembleCurveInfoTextProvider ensembleCurveInfoTextProvider; /// //-------------------------------------------------------------------------------------------------- RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*= nullptr*/ ) - : RiuQwtPlotWidget( plot, parent ) + : RiuSummaryPlot( plot, parent ) { + m_plotWidget = new RiuQwtPlotWidget( plot, parent ); + m_plotWidget->setContextMenuPolicy( Qt::CustomContextMenu ); + connect( m_plotWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( showContextMenu( QPoint ) ) ); + // LeftButton for the zooming - m_zoomerLeft = new RiuQwtPlotZoomer( canvas() ); + m_zoomerLeft = new RiuQwtPlotZoomer( m_plotWidget->qwtPlot()->canvas() ); m_zoomerLeft->setTrackerMode( QwtPicker::AlwaysOff ); m_zoomerLeft->initMousePattern( 1 ); // Attach a zoomer for the right axis - m_zoomerRight = new RiuQwtPlotZoomer( canvas() ); - m_zoomerRight->setAxis( xTop, yRight ); + m_zoomerRight = new RiuQwtPlotZoomer( m_plotWidget->qwtPlot()->canvas() ); + m_zoomerRight->setAxis( QwtPlot::xTop, QwtPlot::yRight ); m_zoomerRight->setTrackerMode( QwtPicker::AlwaysOff ); m_zoomerRight->initMousePattern( 1 ); // MidButton for the panning - QwtPlotPanner* panner = new QwtPlotPanner( canvas() ); + QwtPlotPanner* panner = new QwtPlotPanner( m_plotWidget->qwtPlot()->canvas() ); panner->setMouseButton( Qt::MidButton ); - m_wheelZoomer = new RiuQwtPlotWheelZoomer( this ); + m_wheelZoomer = new RiuQwtPlotWheelZoomer( m_plotWidget->qwtPlot() ); connect( m_wheelZoomer, SIGNAL( zoomUpdated() ), SLOT( onZoomedSlot() ) ); connect( m_zoomerLeft, SIGNAL( zoomed( const QRectF& ) ), SLOT( onZoomedSlot() ) ); @@ -129,12 +123,12 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*= connect( panner, SIGNAL( panned( int, int ) ), SLOT( onZoomedSlot() ) ); setDefaults(); - new RiuQwtCurvePointTracker( this, true, &ensembleCurveInfoTextProvider ); + new RiuQwtCurvePointTracker( m_plotWidget->qwtPlot(), true, &ensembleCurveInfoTextProvider ); - RiuQwtPlotTools::setCommonPlotBehaviour( this ); - RiuQwtPlotTools::setDefaultAxes( this ); + RiuQwtPlotTools::setCommonPlotBehaviour( m_plotWidget->qwtPlot() ); + RiuQwtPlotTools::setDefaultAxes( m_plotWidget->qwtPlot() ); - setInternalLegendVisible( true ); + m_plotWidget->setInternalLegendVisible( true ); m_annotationTool = std::unique_ptr( new RiuPlotAnnotationTool() ); } @@ -154,7 +148,7 @@ void RiuSummaryQwtPlot::useDateBasedTimeAxis( const QString& RiaQDateTimeTools::DateFormatComponents dateComponents, RiaQDateTimeTools::TimeFormatComponents timeComponents ) { - RiuQwtPlotTools::enableDateBasedBottomXAxis( this, dateFormat, timeFormat, dateComponents, timeComponents ); + RiuQwtPlotTools::enableDateBasedBottomXAxis( m_plotWidget->qwtPlot(), dateFormat, timeFormat, dateComponents, timeComponents ); } //-------------------------------------------------------------------------------------------------- @@ -162,16 +156,8 @@ void RiuSummaryQwtPlot::useDateBasedTimeAxis( const QString& //-------------------------------------------------------------------------------------------------- void RiuSummaryQwtPlot::useTimeBasedTimeAxis() { - setAxisScaleEngine( QwtPlot::xBottom, new QwtLinearScaleEngine() ); - setAxisScaleDraw( QwtPlot::xBottom, new QwtScaleDraw() ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuSummaryQwtPlot::setAxisIsLogarithmic( QwtPlot::Axis axis, bool logarithmic ) -{ - if ( m_wheelZoomer ) m_wheelZoomer->setAxisIsLogarithmic( axis, logarithmic ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new QwtLinearScaleEngine() ); + m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::xBottom, new QwtScaleDraw() ); } //-------------------------------------------------------------------------------------------------- @@ -190,7 +176,7 @@ void RiuSummaryQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterface* { if ( annotation->annotationType() == RimPlotAxisAnnotation::AnnotationType::LINE ) { - m_annotationTool->attachAnnotationLine( this, + m_annotationTool->attachAnnotationLine( m_plotWidget->qwtPlot(), annotation->color(), annotation->name(), annotation->value(), @@ -198,7 +184,7 @@ void RiuSummaryQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterface* } else if ( annotation->annotationType() == RimPlotAxisAnnotation::AnnotationType::RANGE ) { - m_annotationTool->attachAnnotationRange( this, + m_annotationTool->attachAnnotationRange( m_plotWidget->qwtPlot(), annotation->color(), annotation->name(), annotation->rangeStart(), @@ -208,163 +194,6 @@ void RiuSummaryQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterface* } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuSummaryQwtPlot::contextMenuEvent( QContextMenuEvent* event ) -{ - QMenu menu; - caf::CmdFeatureMenuBuilder menuBuilder; - - emit plotSelected( false ); - - menuBuilder << "RicShowPlotDataFeature"; - menuBuilder << "RicSavePlotTemplateFeature"; - - QwtPlotItem* closestItem = nullptr; - double distanceFromClick = std::numeric_limits::infinity(); - int closestCurvePoint = -1; - QPoint globalPos = event->globalPos(); - QPoint localPos = this->canvas()->mapFromGlobal( globalPos ); - - findClosestPlotItem( localPos, &closestItem, &closestCurvePoint, &distanceFromClick ); - if ( closestItem && closestCurvePoint >= 0 ) - { - RiuRimQwtPlotCurve* plotCurve = dynamic_cast( closestItem ); - if ( plotCurve ) - { - RimSummaryCurve* summaryCurve = dynamic_cast( plotCurve->ownerRimCurve() ); - if ( summaryCurve && closestCurvePoint < (int)summaryCurve->timeStepsY().size() ) - { - std::time_t timeStep = summaryCurve->timeStepsY()[closestCurvePoint]; - - RimSummaryCaseCollection* ensemble = nullptr; - QString clickedQuantityName; - QStringList allQuantityNamesInPlot; - - RimEnsembleCurveSet* clickedEnsembleCurveSet = nullptr; - summaryCurve->firstAncestorOrThisOfType( clickedEnsembleCurveSet ); - - bool curveClicked = distanceFromClick < 50; - - if ( clickedEnsembleCurveSet ) - { - ensemble = clickedEnsembleCurveSet->summaryCaseCollection(); - if ( ensemble && ensemble->isEnsemble() ) - { - clickedQuantityName = QString::fromStdString( clickedEnsembleCurveSet->summaryAddress().uiText() ); - } - } - - { - auto summaryCase = summaryCurve->summaryCaseY(); - if ( summaryCase ) - { - int summaryCaseId = summaryCase->caseId(); - QVariant summaryCaseIdVariant( summaryCaseId ); - auto modelName = summaryCase->nativeCaseName(); - - menuBuilder.addCmdFeatureWithUserData( "RicImportGridModelFromSummaryCurveFeature", - QString( "Open Grid Model '%1'" ).arg( modelName ), - summaryCaseIdVariant ); - } - } - - if ( !curveClicked ) - { - RimSummaryPlot* summaryPlot = static_cast( plotDefinition() ); - std::vector allCurveSetsInPlot; - summaryPlot->descendantsOfType( allCurveSetsInPlot ); - for ( auto curveSet : allCurveSetsInPlot ) - { - allQuantityNamesInPlot.push_back( QString::fromStdString( curveSet->summaryAddress().uiText() ) ); - } - } - else - { - allQuantityNamesInPlot.push_back( clickedQuantityName ); - } - - if ( !clickedQuantityName.isEmpty() || !allQuantityNamesInPlot.isEmpty() ) - { - if ( ensemble && ensemble->isEnsemble() ) - { - EnsemblePlotParams params( ensemble, allQuantityNamesInPlot, clickedQuantityName, timeStep ); - QVariant variant = QVariant::fromValue( params ); - - menuBuilder.addCmdFeatureWithUserData( "RicNewAnalysisPlotFeature", "New Analysis Plot", variant ); - - QString subMenuName = "Create Correlation Plot"; - if ( curveClicked ) - { - subMenuName = "Create Correlation Plot From Curve Point"; - } - menuBuilder.subMenuStart( subMenuName, *caf::IconProvider( ":/CorrelationPlots16x16.png" ).icon() ); - - { - if ( curveClicked ) - { - menuBuilder.addCmdFeatureWithUserData( "RicNewCorrelationPlotFeature", - "New Tornado Plot", - variant ); - } - menuBuilder.addCmdFeatureWithUserData( "RicNewCorrelationMatrixPlotFeature", - "New Matrix Plot", - variant ); - menuBuilder.addCmdFeatureWithUserData( "RicNewCorrelationReportPlotFeature", - "New Report Plot", - variant ); - if ( curveClicked ) - { - menuBuilder.subMenuStart( "Cross Plots", - *caf::IconProvider( ":/CorrelationCrossPlot16x16.png" ).icon() ); - std::vector> ensembleParameters = - ensemble->parameterCorrelations( clickedEnsembleCurveSet->summaryAddress(), timeStep ); - std::sort( ensembleParameters.begin(), - ensembleParameters.end(), - []( const std::pair& lhs, - const std::pair& rhs ) { - return std::fabs( lhs.second ) > std::fabs( rhs.second ); - } ); - - for ( const auto& param : ensembleParameters ) - { - if ( std::fabs( param.second ) >= 1.0e-6 ) - { - params.ensembleParameter = param.first.name; - variant = QVariant::fromValue( params ); - menuBuilder.addCmdFeatureWithUserData( "RicNewParameterResultCrossPlotFeature", - QString( "New Cross Plot Against %1 " - "(Correlation: %2)" ) - .arg( param.first.name ) - .arg( param.second, 5, 'f', 2 ), - variant ); - } - } - menuBuilder.subMenuEnd(); - } - } - menuBuilder.subMenuEnd(); - } - } - } - } - } - - menuBuilder.appendToMenu( &menu ); - - if ( menu.actions().size() > 0 ) - { - menu.exec( event->globalPos() ); - - // Parts of progress dialog GUI can be present after menu has closed related to - // RicImportGridModelFromSummaryCurveFeature. Make sure the plot is updated, and call processEvents() to make - // sure all GUI events are processed - update(); - QApplication::processEvents(); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -398,5 +227,13 @@ void RiuSummaryQwtPlot::endZoomOperations() //-------------------------------------------------------------------------------------------------- void RiuSummaryQwtPlot::onZoomedSlot() { - emit plotZoomed(); + emit m_plotWidget->plotZoomed(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotWidget* RiuSummaryQwtPlot::plotWidget() const +{ + return m_plotWidget; } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h index 8c76a8adff..1e1a909005 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h @@ -19,10 +19,10 @@ #pragma once #include "RiaQDateTimeTools.h" + #include "RiuInterfaceToViewWindow.h" #include "RiuQwtPlotWidget.h" - -#include "cafPdmPointer.h" +#include "RiuSummaryPlot.h" #include @@ -39,7 +39,7 @@ class RiuPlotAnnotationTool; // // //================================================================================================== -class RiuSummaryQwtPlot : public RiuQwtPlotWidget +class RiuSummaryQwtPlot : public RiuSummaryPlot { Q_OBJECT; @@ -51,24 +51,25 @@ class RiuSummaryQwtPlot : public RiuQwtPlotWidget const QString& timeFormat, RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED, RiaQDateTimeTools::TimeFormatComponents timeComponents = - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ); + RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) override; + + void useTimeBasedTimeAxis() override; - void useTimeBasedTimeAxis(); - void setAxisIsLogarithmic( QwtPlot::Axis axis, bool logarithmic ); + void updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties ) override; - void updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties ); + RiuPlotWidget* plotWidget() const override; protected: - void contextMenuEvent( QContextMenuEvent* ) override; void setDefaults(); - bool isZoomerActive() const override; - void endZoomOperations() override; + bool isZoomerActive() const; + void endZoomOperations(); private slots: void onZoomedSlot(); private: std::unique_ptr m_annotationTool; + QPointer m_plotWidget; QPointer m_zoomerLeft; QPointer m_zoomerRight; diff --git a/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp b/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp index b22a023b2f..cf85d1873c 100644 --- a/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp @@ -32,6 +32,7 @@ #include "cvfAssert.h" #include "qwt_legend.h" +#include "qwt_plot_curve.h" #include "qwt_plot_grid.h" #include "qwt_plot_layout.h" diff --git a/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.h b/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.h index 4d04457da0..c13949e182 100644 --- a/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.h +++ b/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.h @@ -22,7 +22,6 @@ #include "cafPdmPointer.h" #include "qwt_plot.h" -#include "qwt_plot_curve.h" #include #include @@ -31,6 +30,7 @@ #include "RiuInterfaceToViewWindow.h" class RimTofAccumulatedPhaseFractionsPlot; +class QwtPlotCurve; //================================================================================================== // diff --git a/ApplicationLibCode/UserInterface/RiuWellAllocationPlot.h b/ApplicationLibCode/UserInterface/RiuWellAllocationPlot.h index 6c8cc081b3..474cef26ba 100644 --- a/ApplicationLibCode/UserInterface/RiuWellAllocationPlot.h +++ b/ApplicationLibCode/UserInterface/RiuWellAllocationPlot.h @@ -18,8 +18,6 @@ #pragma once -#include "qwt_plot.h" - #include "cafPdmPointer.h" #include diff --git a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp index 20b853355e..7044bd523b 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp @@ -86,8 +86,8 @@ bool RiuWellLogPlot::showYAxis( int row, int column ) const //-------------------------------------------------------------------------------------------------- void RiuWellLogPlot::reinsertScrollbar() { - QList> plotWidgets = this->visiblePlotWidgets(); - int colCount = this->m_gridLayout->columnCount(); + QList> plotWidgets = this->visiblePlotWidgets(); + int colCount = this->m_gridLayout->columnCount(); m_gridLayout->addLayout( m_trackScrollBarLayout, 2, colCount, 1, 1 ); m_trackScrollBar->setVisible( !plotWidgets.empty() ); diff --git a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp index b571514f56..cab731c8e9 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp @@ -19,14 +19,19 @@ #include "RiuWellLogTrack.h" +#include "RiaDefines.h" +#include "RiaPlotDefines.h" #include "RimWellLogCurve.h" #include "RimWellLogExtractionCurve.h" #include "RimWellLogTrack.h" #include "RiuGuiTheme.h" +#include "RiuPlotCurve.h" #include "RiuQwtCurvePointTracker.h" -#include "RiuRimQwtPlotCurve.h" +#include "RiuQwtPlotTools.h" +#include "qwt_plot.h" +#include "qwt_plot_curve.h" #include "qwt_scale_draw.h" #include "qwt_scale_engine.h" #include "qwt_scale_widget.h" @@ -92,8 +97,8 @@ class WellLogCurveInfoTextProvider : public IPlotCurveInfoTextProvider //-------------------------------------------------------------------------------------------------- QString curveInfoText( QwtPlotCurve* curve ) override { - RiuRimQwtPlotCurve* riuCurve = dynamic_cast( curve ); - RimWellLogCurve* wlCurve = nullptr; + RiuPlotCurve* riuCurve = dynamic_cast( curve ); + RimWellLogCurve* wlCurve = nullptr; if ( riuCurve ) { wlCurve = dynamic_cast( riuCurve->ownerRimCurve() ); @@ -119,7 +124,7 @@ RiuWellLogTrack::RiuWellLogTrack( RimWellLogTrack* track, QWidget* parent /*= nu setAxisEnabled( QwtPlot::xTop, true ); setAxisEnabled( QwtPlot::xBottom, false ); - new RiuWellLogCurvePointTracker( this, &wellLogCurveInfoTextProvider ); + new RiuWellLogCurvePointTracker( this->qwtPlot(), &wellLogCurveInfoTextProvider ); } //-------------------------------------------------------------------------------------------------- @@ -134,20 +139,17 @@ RiuWellLogTrack::~RiuWellLogTrack() //-------------------------------------------------------------------------------------------------- void RiuWellLogTrack::setAxisEnabled( QwtPlot::Axis axis, bool enabled ) { + RiaDefines::PlotAxis plotAxis = RiuQwtPlotTools::fromQwtPlotAxis( axis ); + RiuQwtPlotWidget::enableAxis( plotAxis, enabled ); + if ( enabled ) { - enableAxis( axis, true ); - // Align the canvas with the actual min and max values of the curves - axisScaleEngine( axis )->setAttribute( QwtScaleEngine::Floating, true ); - setAxisScale( axis, 0.0, 100.0 ); - axisScaleDraw( axis )->setMinimumExtent( axisExtent( axis ) ); + qwtPlot()->axisScaleEngine( axis )->setAttribute( QwtScaleEngine::Floating, true ); + setAxisScale( plotAxis, 0.0, 100.0 ); + qwtPlot()->axisScaleDraw( axis )->setMinimumExtent( axisExtent( plotAxis ) ); - axisWidget( axis )->setMargin( 0 ); - setAxisTitleEnabled( axis, true ); - } - else - { - enableAxis( axis, false ); + qwtPlot()->axisWidget( axis )->setMargin( 0 ); + setAxisTitleEnabled( plotAxis, true ); } } diff --git a/ApplicationLibCode/UserInterface/RiuWellLogTrack.h b/ApplicationLibCode/UserInterface/RiuWellLogTrack.h index 85def5a8ba..9979e1c1f7 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogTrack.h +++ b/ApplicationLibCode/UserInterface/RiuWellLogTrack.h @@ -20,6 +20,8 @@ #include "RiuQwtPlotWidget.h" +#include "qwt_plot.h" + class RimWellLogTrack; class QWheelEvent; diff --git a/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp b/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp index 6075b4516d..4f8ab03a94 100644 --- a/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp @@ -180,15 +180,25 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot ) double posMax = 0.75 + m_columnOffset; addColumnFeature( -posMax, -posMin, startDepth, endDepth, componentColor() ); addColumnFeature( posMin, posMax, startDepth, endDepth, componentColor() ); - addMarker( -posMax, endDepth, 12, RiuQwtSymbol::SYMBOL_LEFT_ANGLED_TRIANGLE, componentColor() ); - addMarker( posMax, endDepth, 12, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor() ); - addMarker( casingTrackEnd, endDepth, 12, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor( 0.0 ), label() ); + addMarker( -posMax, endDepth, 12, RiuPlotCurveSymbol::SYMBOL_LEFT_ANGLED_TRIANGLE, componentColor() ); + addMarker( posMax, endDepth, 12, RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor() ); + addMarker( casingTrackEnd, + endDepth, + 12, + RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, + componentColor( 0.0 ), + label() ); } else if ( m_componentType == RiaDefines::WellPathComponentType::LINER ) { addColumnFeature( -0.5, -0.25, startDepth, endDepth, componentColor() ); addColumnFeature( 0.25, 0.5, startDepth, endDepth, componentColor() ); - addMarker( casingTrackEnd, endDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor( 0.0 ), label() ); + addMarker( casingTrackEnd, + endDepth, + 10, + RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, + componentColor( 0.0 ), + label() ); } else if ( m_componentType == RiaDefines::WellPathComponentType::PERFORATION_INTERVAL ) { @@ -200,18 +210,31 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot ) double markerDepth = startDepth; while ( markerDepth < endDepth - 5 ) { - addMarker( -casingTrackEnd, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_LEFT_ALIGNED_TRIANGLE, componentColor() ); - addMarker( casingTrackEnd, markerDepth, markerSize, RiuQwtSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor() ); + addMarker( -casingTrackEnd, + markerDepth, + markerSize, + RiuPlotCurveSymbol::SYMBOL_LEFT_ALIGNED_TRIANGLE, + componentColor() ); + addMarker( casingTrackEnd, + markerDepth, + markerSize, + RiuPlotCurveSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, + componentColor() ); markerDepth += markerSpacing; } - addMarker( casingTrackEnd, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor( 0.0 ), label() ); + addMarker( casingTrackEnd, + midDepth, + 10, + RiuPlotCurveSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, + componentColor( 0.0 ), + label() ); QwtPlotItem* legendItem1 = - createMarker( 16.0, 0.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor() ); + createMarker( 16.0, 0.0, 6, RiuPlotCurveSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor() ); legendItem1->setLegendIconSize( QSize( 4, 8 ) ); QwtPlotItem* legendItem2 = - createMarker( 16.0, 8.0, 6, RiuQwtSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor() ); + createMarker( 16.0, 8.0, 6, RiuPlotCurveSymbol::SYMBOL_RIGHT_ALIGNED_TRIANGLE, componentColor() ); legendItem2->setLegendIconSize( QSize( 4, 8 ) ); m_combinedComponentGroup.addLegendItem( legendItem1 ); m_combinedComponentGroup.addLegendItem( legendItem2 ); @@ -220,7 +243,12 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot ) { addColumnFeature( -casingTrackEnd, -0.25, startDepth, endDepth, componentColor(), Qt::BDiagPattern ); addColumnFeature( 0.25, casingTrackEnd, startDepth, endDepth, componentColor(), Qt::FDiagPattern ); - addMarker( casingTrackEnd, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor( 0.0 ), label() ); + addMarker( casingTrackEnd, + midDepth, + 10, + RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, + componentColor( 0.0 ), + label() ); } else if ( m_componentType == RiaDefines::WellPathComponentType::FRACTURE ) { @@ -229,7 +257,7 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot ) addMarker( casingTrackEnd, startDepth, 10, - RiuQwtSymbol::SYMBOL_NONE, + RiuPlotCurveSymbol::SYMBOL_NONE, componentColor(), "", Qt::AlignTop | Qt::AlignRight, @@ -238,7 +266,7 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot ) addMarker( casingTrackEnd, endDepth, 10, - RiuQwtSymbol::SYMBOL_NONE, + RiuPlotCurveSymbol::SYMBOL_NONE, componentColor(), "", Qt::AlignTop | Qt::AlignRight, @@ -247,7 +275,7 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot ) addMarker( casingTrackEnd, startDepth, 1, - RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, + RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor( 0.0f ), label(), Qt::AlignTop | Qt::AlignRight ); @@ -256,34 +284,66 @@ void RiuWellPathComponentPlotItem::onLoadDataAndUpdate( bool updateParentPlot ) { for ( double md : m_subMDs ) { - addMarker( 0.0, md, 16, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), "", Qt::AlignCenter, Qt::Horizontal, false, true ); + addMarker( 0.0, + md, + 16, + RiuPlotCurveSymbol::SYMBOL_ELLIPSE, + componentColor(), + "", + Qt::AlignCenter, + Qt::Horizontal, + false, + true ); } m_combinedComponentGroup.addLegendItem( - createMarker( 0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor() ) ); + createMarker( 0.0, 0.0, 12.0, RiuPlotCurveSymbol::SYMBOL_ELLIPSE, componentColor() ) ); } else if ( m_componentType == RiaDefines::WellPathComponentType::ICV ) { for ( double md : m_subMDs ) { - addMarker( 0.0, md, 16, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), "", Qt::AlignCenter, Qt::Horizontal, false, true ); + addMarker( 0.0, + md, + 16, + RiuPlotCurveSymbol::SYMBOL_ELLIPSE, + componentColor(), + "", + Qt::AlignCenter, + Qt::Horizontal, + false, + true ); } m_combinedComponentGroup.addLegendItem( - createMarker( 0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor() ) ); + createMarker( 0.0, 0.0, 12.0, RiuPlotCurveSymbol::SYMBOL_ELLIPSE, componentColor() ) ); } else if ( m_componentType == RiaDefines::WellPathComponentType::AICD ) { for ( double md : m_subMDs ) { - addMarker( 0.0, md, 16, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor(), "", Qt::AlignCenter, Qt::Horizontal, false, true ); + addMarker( 0.0, + md, + 16, + RiuPlotCurveSymbol::SYMBOL_ELLIPSE, + componentColor(), + "", + Qt::AlignCenter, + Qt::Horizontal, + false, + true ); } m_combinedComponentGroup.addLegendItem( - createMarker( 0.0, 0.0, 12.0, RiuQwtSymbol::SYMBOL_ELLIPSE, componentColor() ) ); + createMarker( 0.0, 0.0, 12.0, RiuPlotCurveSymbol::SYMBOL_ELLIPSE, componentColor() ) ); } else if ( m_componentType == RiaDefines::WellPathComponentType::PACKER ) { addColumnFeature( -1.1 * casingTrackEnd, -0.25, startDepth, endDepth, componentColor(), Qt::DiagCrossPattern ); addColumnFeature( 0.25, 1.1 * casingTrackEnd, startDepth, endDepth, componentColor(), Qt::DiagCrossPattern ); - addMarker( casingTrackEnd, midDepth, 10, RiuQwtSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, componentColor( 0.0 ), label() ); + addMarker( casingTrackEnd, + midDepth, + 10, + RiuPlotCurveSymbol::SYMBOL_RIGHT_ANGLED_TRIANGLE, + componentColor( 0.0 ), + label() ); } m_combinedComponentGroup.setTitle( legendTitle() ); m_combinedComponentGroup.setLegendIconSize( QSize( 20, 16 ) ); @@ -335,16 +395,16 @@ std::pair RiuWellPathComponentPlotItem::depthsOfDepthType() cons //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellPathComponentPlotItem::addMarker( double posX, - double depth, - int size, - RiuQwtSymbol::PointSymbolEnum symbolType, - cvf::Color4f baseColor, - const QString& label /*= QString("")*/, - Qt::Alignment labelAlignment /*= Qt::AlignTop*/, - Qt::Orientation labelOrientation /*= Qt::Vertical*/, - bool drawLine /*= false*/, - bool contrastTextColor /*= true*/ ) +void RiuWellPathComponentPlotItem::addMarker( double posX, + double depth, + int size, + RiuPlotCurveSymbol::PointSymbolEnum symbolType, + cvf::Color4f baseColor, + const QString& label /*= QString("")*/, + Qt::Alignment labelAlignment /*= Qt::AlignTop*/, + Qt::Orientation labelOrientation /*= Qt::Vertical*/, + bool drawLine /*= false*/, + bool contrastTextColor /*= true*/ ) { QwtPlotItem* marker = createMarker( posX, depth, size, symbolType, baseColor, label, labelAlignment, labelOrientation, drawLine, contrastTextColor ); @@ -354,12 +414,12 @@ void RiuWellPathComponentPlotItem::addMarker( double posX //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QwtPlotItem* RiuWellPathComponentPlotItem::createMarker( double posX, - double depth, - int size, - RiuQwtSymbol::PointSymbolEnum symbolType, - cvf::Color4f baseColor, - const QString& label /*= QString("")*/, +QwtPlotItem* RiuWellPathComponentPlotItem::createMarker( double posX, + double depth, + int size, + RiuPlotCurveSymbol::PointSymbolEnum symbolType, + cvf::Color4f baseColor, + const QString& label /*= QString("")*/, Qt::Alignment labelAlignment /*= Qt::AlignTop*/, Qt::Orientation labelOrientation /*= Qt::Vertical*/, bool drawLine /*= false*/, @@ -372,8 +432,8 @@ QwtPlotItem* RiuWellPathComponentPlotItem::createMarker( double textColor = RiaColorTools::toQColor( RiaColorTools::contrastColor( baseColor.toColor3f() ) ); } QwtPlotMarker* marker = new QwtPlotMarker( label ); - RiuQwtSymbol* symbol = new RiuQwtSymbol( symbolType, "", RiuQwtSymbol::LabelRightOfSymbol ); - symbol->setSize( size ); + RiuQwtSymbol* symbol = new RiuQwtSymbol( symbolType, "", RiuPlotCurveSymbol::LabelRightOfSymbol ); + symbol->setSize( size, size ); symbol->setColor( bgColor ); marker->setSymbol( symbol ); marker->setSpacing( 6 ); @@ -512,7 +572,7 @@ void RiuWellPathComponentPlotItem::setContributeToLegend( bool contributeToLegen //-------------------------------------------------------------------------------------------------- void RiuWellPathComponentPlotItem::setParentQwtPlotAndReplot( QwtPlot* plot ) { - setParentQwtPlotNoReplot( plot ); + setParentPlotNoReplot( plot ); if ( m_parentQwtPlot ) { m_parentQwtPlot->replot(); @@ -522,7 +582,7 @@ void RiuWellPathComponentPlotItem::setParentQwtPlotAndReplot( QwtPlot* plot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellPathComponentPlotItem::setParentQwtPlotNoReplot( QwtPlot* plot ) +void RiuWellPathComponentPlotItem::setParentPlotNoReplot( QwtPlot* plot ) { m_parentQwtPlot = plot; attachToQwt(); diff --git a/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.h b/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.h index ec7a452188..3a28088fe7 100644 --- a/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.h +++ b/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.h @@ -68,7 +68,7 @@ class RiuWellPathComponentPlotItem void setContributeToLegend( bool contributeToLegend ); void setParentQwtPlotAndReplot( QwtPlot* plot ); - void setParentQwtPlotNoReplot( QwtPlot* plot ); + void setParentPlotNoReplot( QwtPlot* plot ); void attachToQwt(); void detachFromQwt(); void reattachToQwt(); @@ -80,26 +80,26 @@ class RiuWellPathComponentPlotItem std::pair depthsOfDepthType() const; - void addMarker( double posX, - double depth, - int size, - RiuQwtSymbol::PointSymbolEnum symbolType, - cvf::Color4f baseColor, - const QString& label = QString( "" ), - Qt::Alignment labelAlignment = Qt::AlignVCenter | Qt::AlignRight, - Qt::Orientation labelOrientation = Qt::Horizontal, - bool drawLine = false, - bool contrastTextColor = false ); - QwtPlotItem* createMarker( double posX, - double depth, - int size, - RiuQwtSymbol::PointSymbolEnum symbolType, - cvf::Color4f baseColor, - const QString& label = QString( "" ), - Qt::Alignment labelAlignment = Qt::AlignVCenter | Qt::AlignRight, - Qt::Orientation labelOrientation = Qt::Horizontal, - bool drawLine = false, - bool contrastTextColor = false ); + void addMarker( double posX, + double depth, + int size, + RiuPlotCurveSymbol::PointSymbolEnum symbolType, + cvf::Color4f baseColor, + const QString& label = QString( "" ), + Qt::Alignment labelAlignment = Qt::AlignVCenter | Qt::AlignRight, + Qt::Orientation labelOrientation = Qt::Horizontal, + bool drawLine = false, + bool contrastTextColor = false ); + QwtPlotItem* createMarker( double posX, + double depth, + int size, + RiuPlotCurveSymbol::PointSymbolEnum symbolType, + cvf::Color4f baseColor, + const QString& label = QString( "" ), + Qt::Alignment labelAlignment = Qt::AlignVCenter | Qt::AlignRight, + Qt::Orientation labelOrientation = Qt::Horizontal, + bool drawLine = false, + bool contrastTextColor = false ); void addColumnFeature( double startX, double endX, double startDepth, diff --git a/CMakeLists.txt b/CMakeLists.txt index 475c1a9071..85b1010c4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -394,18 +394,27 @@ find_package( Script ScriptTools Widgets - OPTIONAL_COMPONENTS Charts ) -if(Qt5Charts_FOUND) - message(STATUS "QtCharts found: ${Qt5Charts_LIBRARIES}") - add_definitions(-DUSE_QTCHARTS) -else() - message(STATUS "QtCharts missing.") -endif() # Open GL find_package(OpenGL) +# ############################################################################## +# QtCharts +# ############################################################################## +option(RESINSIGHT_USE_QT_CHARTS "Enable QtCharts in the code" ON) +if(RESINSIGHT_USE_QT_CHARTS) + find_package(Qt5 OPTIONAL_COMPONENTS Charts) + + if(Qt5Charts_FOUND) + message(STATUS "QtCharts found: ${Qt5Charts_LIBRARIES}") + add_definitions(-DUSE_QTCHARTS) + else() + message(STATUS "QtCharts not found.") + set(RESINSIGHT_USE_QT_CHARTS OFF) + endif() +endif() + # ############################################################################## # Qwt # ############################################################################## diff --git a/doc/qwtplot.plantuml b/doc/qwtplot.plantuml index 9ca60b088e..a4442853da 100644 --- a/doc/qwtplot.plantuml +++ b/doc/qwtplot.plantuml @@ -1,25 +1,31 @@ @startuml package Rim { - PdmObject <|-- RimViewWindow package plots { -RimViewWindow <|-- RimGridCrossPlot -RimViewWindow <|-- RimSummaryPlot -RimRiuQwtPlotOwnerInterface <|-- RimGridCrossPlot -RimRiuQwtPlotOwnerInterface <|-- RimSummaryPlot +RimViewWindow <|-- RimPlotWindow +RimPlotWindow <|-- RimPlot +RimPlot <|-- RimSummaryPlot +} } -package Qwt { -QWidget <|-- QwtPlot +package RiuQwt { +class RiuSummaryQwtPlot +class RiuQwtPlotWidget } -package RiuQwt -{ -QwtPlot <|--- RiuQwtPlot -RiuQwtPlot <|--- RiuSummaryQwtPlot -RiuQwtPlot -r-> RimRiuQwtPlotOwnerInterface +package RiuQtCharts { +class RiuSummaryQtChartsPlot +class RiuQtChartsPlotWidget } -RimSummaryPlot -r-> RiuSummaryQwtPlot -RimGridCrossPlot -r-> RiuQwtPlot +RiuPlotWidget <|--- RiuQwtPlotWidget +RiuSummaryPlot <|-- RiuSummaryQwtPlot + +RiuSummaryQwtPlot --> RiuQwtPlotWidget +RiuSummaryQtChartsPlot --> RiuQtChartsPlotWidget + +RiuSummaryPlot <|-- RiuSummaryQtChartsPlot +RiuPlotWidget <|--- RiuQtChartsPlotWidget + +RimSummaryPlot --> RiuSummaryPlot @enduml From f996b5383adead3513f9727283ccf5aa56d17bc9 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 17 Jan 2022 15:22:27 +0100 Subject: [PATCH 084/406] #8453 Fix crash when changing plot type (QtCharts <-> Qwt). --- .../ProjectDataModel/RimPlotCurve.cpp | 7 +++++- .../ProjectDataModel/RimPlotCurve.h | 2 +- .../Summary/RimEnsembleCurveSet.cpp | 4 ++-- .../Summary/RimEnsembleCurveSet.h | 2 +- .../Summary/RimSummaryPlot.cpp | 23 +++++++++++++++++++ 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index 6249b67cc1..4a51cbe128 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -1011,11 +1011,16 @@ void RimPlotCurve::attach( RiuPlotWidget* plotWidget ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::detach() +void RimPlotCurve::detach( bool deletePlotCurve ) { if ( m_plotCurve ) { m_plotCurve->detach(); + if ( deletePlotCurve ) + { + delete m_plotCurve; + m_plotCurve = nullptr; + } } replotParentPlot(); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h index fac7435d08..fb034ad6c4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h @@ -122,7 +122,7 @@ class RimPlotCurve : public caf::PdmObject void setParentPlotAndReplot( RiuPlotWidget* ); void attach( RiuPlotWidget* ); - void detach(); + void detach( bool deletePlotCurve = false ); void reattach(); bool isSameCurve( const RiuPlotCurve* plotCurve ) const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 0a027bf986..2973996fd1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -310,11 +310,11 @@ void RimEnsembleCurveSet::setParentPlotNoReplot( RiuPlotWidget* plot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSet::detachPlotCurves() +void RimEnsembleCurveSet::detachPlotCurves( bool deletePlotCurve ) { for ( RimSummaryCurve* curve : m_curves ) { - curve->detach(); + curve->detach( deletePlotCurve ); } if ( m_plotCurveForLegendText ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index d8a648104e..2bb87b6688 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -95,7 +95,7 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt void loadDataAndUpdate( bool updateParentPlot ); void setParentPlotNoReplot( RiuPlotWidget* plot ); - void detachPlotCurves(); + void detachPlotCurves( bool deletePlotCurve = false ); void reattachPlotCurves(); void addCurve( RimSummaryCurve* curve ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 235bbce5a3..7923819e2f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1525,6 +1525,29 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, } } +#ifdef USE_QTCHARTS + if ( changedField == &m_useQtChartsPlot ) + { + // Hide window + setShowWindow( false ); + + // Detach and destroy plot curves + for ( auto c : summaryCurves() ) + { + c->detach( true ); + } + + for ( auto& curveSet : this->ensembleCurveSetCollection()->curveSets() ) + { + curveSet->detachPlotCurves( true ); + } + + // Destroy viewer + removeMdiWindowFromMdiArea(); + cleanupBeforeClose(); + } +#endif + if ( changedField == &m_normalizeCurveYValues ) { this->loadDataAndUpdate(); From 8f75dcb29fbbb4d613805b9e05d84f318d1cf310 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 18 Jan 2022 09:03:07 +0100 Subject: [PATCH 085/406] #8456 Early reject if no plot is created --- .../ProjectDataModel/Flow/RimWellAllocationPlot.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 6e88e85305..4b6fb36b0a 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -951,6 +951,9 @@ void RimWellAllocationPlot::onLoadDataAndUpdate() return; } + // Other plot functions depend on a valid plot widget, early reject to avoid a lot of testing on valid widget + if ( !m_wellAllocationPlotWidget ) return; + updateFromWell(); m_accumulatedWellFlowPlot->loadDataAndUpdate(); updateFormationNamesData(); From 5ff9f36448735b89cc5386a132e30fbfe7febd94 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 20 Jan 2022 12:52:36 +0100 Subject: [PATCH 086/406] Merge pull request #8461 from OPM/8460-plot-curve-fixes Guard access to QtCharts objects that might be null Fix visibility of items in legend based on state in parent plot --- .../ProjectDataModel/RimPlotCurve.cpp | 6 ++- .../Summary/RimSummaryCurve.cpp | 10 +++-- .../Summary/RimSummaryCurveCollection.cpp | 2 +- .../Summary/RimSummaryPlot.cpp | 9 +++- .../UserInterface/RiuQtChartsPlotCurve.cpp | 43 +++++++++++++++++-- .../UserInterface/RiuQtChartsPlotCurve.h | 4 +- 6 files changed, 62 insertions(+), 12 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index 4a51cbe128..2daad80109 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -982,11 +982,13 @@ void RimPlotCurve::setParentPlotNoReplot( RiuPlotWidget* plotWidget ) if ( !plotWidget ) return; m_parentPlot = plotWidget; - if ( !m_plotCurve ) + if ( m_plotCurve ) { - m_plotCurve = m_parentPlot->createPlotCurve( this, "", RiaColorTools::toQColor( m_curveAppearance->color() ) ); + m_plotCurve->attachToPlot( plotWidget ); + return; } + m_plotCurve = m_parentPlot->createPlotCurve( this, "", RiaColorTools::toQColor( m_curveAppearance->color() ) ); m_plotCurve->attachToPlot( plotWidget ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 9a2b728fa0..871c343e6e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -500,10 +500,12 @@ QString RimSummaryCurve::createCurveAutoName() std::vector nameHelpers; { RimSummaryPlot* plot = nullptr; - firstAncestorOrThisOfTypeAsserted( plot ); - auto nameHelper = plot->plotTitleHelper(); - - if ( nameHelper ) nameHelpers.push_back( nameHelper ); + firstAncestorOrThisOfType( plot ); + if ( plot ) + { + auto nameHelper = plot->plotTitleHelper(); + if ( nameHelper ) nameHelpers.push_back( nameHelper ); + } } { RimSummaryMultiPlot* summaryMultiPlot = nullptr; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index f5e1b4d672..75fb86cf7c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -151,7 +151,7 @@ void RimSummaryCurveCollection::reattachPlotCurves() { for ( RimSummaryCurve* curve : m_curves ) { - curve->reattach(); + if ( curve->isCurveVisible() ) curve->reattach(); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 7923819e2f..957125130a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -761,6 +761,11 @@ void RimSummaryPlot::updateLegend() if ( plotWidget() ) { plotWidget()->setInternalLegendVisible( m_showPlotLegends && !isSubPlot() ); + + for ( auto c : summaryCurves() ) + { + c->updateLegendEntryVisibilityNoPlotUpdate(); + } } reattachAllCurves(); @@ -1525,6 +1530,8 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, } } + if ( changedField == &m_showPlotLegends ) updateLegend(); + #ifdef USE_QTCHARTS if ( changedField == &m_useQtChartsPlot ) { @@ -2172,7 +2179,7 @@ void RimSummaryPlot::updateCurveNames() { for ( auto c : summaryCurves() ) { - c->updateCurveNameNoLegendUpdate(); + if ( c->isCurveVisible() ) c->updateCurveNameNoLegendUpdate(); } } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index a12684eb25..5f497e0869 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -69,6 +69,8 @@ RiuQtChartsPlotCurve::~RiuQtChartsPlotCurve() //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotCurve::setTitle( const QString& title ) { + if ( !isQtChartObjectsPresent() ) return; + lineSeries()->setName( title ); scatterSeries()->setName( title ); } @@ -82,6 +84,8 @@ void RiuQtChartsPlotCurve::setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum const QColor& curveColor, const QBrush& fillBrush /* = QBrush( Qt::NoBrush )*/ ) { + if ( !isQtChartObjectsPresent() ) return; + Qt::PenStyle penStyle = RiuQwtPlotCurveDefines::convertToPenStyle( lineStyle ); QPen curvePen( curveColor ); @@ -97,6 +101,8 @@ void RiuQtChartsPlotCurve::setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotCurve::setBrush( const QBrush& brush ) { + if ( !isQtChartObjectsPresent() ) return; + lineSeries()->setBrush( brush ); } @@ -116,7 +122,10 @@ void RiuQtChartsPlotCurve::attachToPlot( RiuPlotWidget* plotWidget ) } else { - m_plotWidget->attach( this, lineSeries(), scatterSeries(), m_axisX, m_axisY ); + if ( !m_lineSeries ) m_lineSeries = new QtCharts::QLineSeries(); + if ( !m_scatterSeries ) m_scatterSeries = new QtCharts::QScatterSeries(); + + m_plotWidget->attach( this, m_lineSeries, m_scatterSeries, m_axisX, m_axisY ); // Plot widget takes ownership. m_lineSeries = nullptr; m_scatterSeries = nullptr; @@ -175,6 +184,8 @@ void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, const std::vector& yValues, int numValues ) { + if ( !isQtChartObjectsPresent() ) return; + CAF_ASSERT( xValues.size() == yValues.size() ); CAF_ASSERT( numValues <= static_cast( xValues.size() ) ); CAF_ASSERT( numValues >= 0 ); @@ -191,6 +202,16 @@ void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuQtChartsPlotCurve::isQtChartObjectsPresent() const +{ + if ( !lineSeries() ) return false; + + return true; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -243,6 +264,8 @@ void RiuQtChartsPlotCurve::setYAxis( RiaDefines::PlotAxis axis ) //-------------------------------------------------------------------------------------------------- int RiuQtChartsPlotCurve::numSamples() const { + if ( !lineSeries() ) return 0; + return lineSeries()->count(); } @@ -298,13 +321,27 @@ void RiuQtChartsPlotCurve::setVisibleInLegend( bool isVisibleInLegend ) CAF_ASSERT( m_plotWidget->qtChart() ); CAF_ASSERT( m_plotWidget->qtChart()->legend() ); + // The markers can be set visible independent to the visibility state of the containing legend. Use the visibility + // state of the legend to override the visibility flag + if ( !m_plotWidget->qtChart()->legend()->isAttachedToChart() ) isVisibleInLegend = false; + if ( !m_plotWidget->qtChart()->legend()->isVisible() ) isVisibleInLegend = false; + + bool showScatterMarker = isVisibleInLegend; + if ( !m_symbol ) showScatterMarker = false; + if ( scatterSeries() ) { auto markers = m_plotWidget->qtChart()->legend()->markers( scatterSeries() ); - if ( !markers.isEmpty() ) markers[0]->setVisible( isVisibleInLegend ); + if ( !markers.isEmpty() ) markers[0]->setVisible( showScatterMarker ); + } + bool showLineMarker = isVisibleInLegend; + if ( showScatterMarker ) showLineMarker = false; + + if ( lineSeries() ) + { auto lineSeriesMarkers = m_plotWidget->qtChart()->legend()->markers( lineSeries() ); - if ( !lineSeriesMarkers.isEmpty() ) lineSeriesMarkers[0]->setVisible( false ); + if ( !lineSeriesMarkers.isEmpty() ) lineSeriesMarkers[0]->setVisible( showLineMarker ); } } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h index 07c7bac9ea..634739e02c 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h @@ -77,14 +77,16 @@ class RiuQtChartsPlotCurve : public RiuPlotCurve RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override; -protected: +private: void setSamplesInPlot( const std::vector&, const std::vector&, int ) override; + bool isQtChartObjectsPresent() const; QtCharts::QLineSeries* lineSeries() const; QtCharts::QScatterSeries* scatterSeries() const; cvf::BoundingBox computeBoundingBox() const; +private: QtCharts::QLineSeries* m_lineSeries; QtCharts::QScatterSeries* m_scatterSeries; std::shared_ptr m_symbol; From 99fde63af1b5b30c9d9baaad5042319fb1b69766 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 17 Jan 2022 16:50:43 +0100 Subject: [PATCH 087/406] Janitor: remove assert(this) warnings. The c++ standard guarantees that "this" is nonnull in valid programs. So this check is unneccessary, and gcc warns in debug mode. --- Fwk/VizFwk/LibCore/cvfArray.inl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Fwk/VizFwk/LibCore/cvfArray.inl b/Fwk/VizFwk/LibCore/cvfArray.inl index 6f76a71919..1a45775764 100644 --- a/Fwk/VizFwk/LibCore/cvfArray.inl +++ b/Fwk/VizFwk/LibCore/cvfArray.inl @@ -169,7 +169,7 @@ Array::~Array() template inline const T& Array::operator[] (size_t index) const { - CVF_TIGHT_ASSERT(this && m_data); + CVF_TIGHT_ASSERT(m_data); CVF_TIGHT_ASSERT(index < m_size); return m_data[index]; @@ -182,7 +182,7 @@ inline const T& Array::operator[] (size_t index) const template inline T& Array::operator[] (size_t index) { - CVF_TIGHT_ASSERT(this && m_data); + CVF_TIGHT_ASSERT(m_data); CVF_TIGHT_ASSERT(index < m_size); return m_data[index]; @@ -338,7 +338,6 @@ T cvf::Array::val(size_t index) const template inline const T* Array::ptr() const { - CVF_TIGHT_ASSERT(this); return m_data; } @@ -349,7 +348,6 @@ inline const T* Array::ptr() const template inline T* Array::ptr() { - CVF_TIGHT_ASSERT(this); return m_data; } @@ -361,7 +359,6 @@ inline T* Array::ptr() template inline const T* Array::ptr(size_t index) const { - CVF_TIGHT_ASSERT(this); CVF_TIGHT_ASSERT(index < m_size); return &m_data[index]; @@ -374,7 +371,6 @@ inline const T* Array::ptr(size_t index) const template inline T* Array::ptr(size_t index) { - CVF_TIGHT_ASSERT(this); CVF_TIGHT_ASSERT(index < m_size); return &m_data[index]; From 40d59b7bdc4a156e12a94e0130b2dcddb4097767 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 20 Jan 2022 13:21:32 +0100 Subject: [PATCH 088/406] Regression Test : Make it possible to override plot engine Add GUI to override plot engine to either Qwt or QtCharts in regression test dialog --- .../Application/Tools/RiaRegressionTest.cpp | 16 +++++++++++++--- .../Application/Tools/RiaRegressionTest.h | 14 ++++++++++++-- .../Tools/RiaRegressionTestRunner.cpp | 8 ++++++++ .../Application/Tools/RiaRegressionTestRunner.h | 3 ++- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 14 +++++++++++++- 5 files changed, 48 insertions(+), 7 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp index 2370946cb6..731e5a85aa 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTest.cpp @@ -22,12 +22,21 @@ #include "cafPdmUiFilePathEditor.h" #include "cafPdmUiTextEditor.h" +template <> +void caf::AppEnum::setUp() +{ + addItem( RiaRegressionTest::PlotEngine::USE_QWT, "USE_QWT", "Use Qwt" ); + addItem( RiaRegressionTest::PlotEngine::USER_QTCHARTS, "USER_QTCHARTS", "Use QtCharts" ); + addItem( RiaRegressionTest::PlotEngine::NONE, "NONE", "None" ); + setDefault( RiaRegressionTest::PlotEngine::NONE ); +} + CAF_PDM_SOURCE_INIT( RiaRegressionTest, "RiaRegressionTest" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaRegressionTest::RiaRegressionTest( void ) +RiaRegressionTest::RiaRegressionTest() { CAF_PDM_InitFieldNoDefault( &folderContainingCompareTool, "workingFolder", @@ -73,12 +82,13 @@ RiaRegressionTest::RiaRegressionTest( void ) CAF_PDM_InitField( &appendTestsAfterTestFilter, "appendTestsAfterTestFilter", false, "Append All Tests After Test Filter" ); CAF_PDM_InitField( &invalidateExternalFilePaths, "invalidateExternalFilePaths", false, "Invalidate External File Paths" ); + CAF_PDM_InitFieldNoDefault( &overridePlotEngine, "forcePlotEngine", "Force Plot Engine" ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaRegressionTest::~RiaRegressionTest( void ) +RiaRegressionTest::~RiaRegressionTest() { } @@ -108,7 +118,7 @@ void RiaRegressionTest::defineEditorAttribute( const caf::PdmFieldHandle* field, if ( field == &folderContainingDiffTool || field == &folderContainingCompareTool || field == ®ressionTestFolder || field == &folderContainingGitTool ) { - caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast( attribute ); + auto* myAttr = dynamic_cast( attribute ); if ( myAttr ) { myAttr->m_selectDirectory = true; diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTest.h b/ApplicationLibCode/Application/Tools/RiaRegressionTest.h index 2c05962587..e99b3b0c8a 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTest.h +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTest.h @@ -27,8 +27,16 @@ class RiaRegressionTest : public caf::PdmObject CAF_PDM_HEADER_INIT; public: - RiaRegressionTest( void ); - ~RiaRegressionTest( void ) override; + enum class PlotEngine + { + USE_QWT, + USER_QTCHARTS, + NONE + }; + +public: + RiaRegressionTest(); + ~RiaRegressionTest() override; void writeSettingsToApplicationStore() const; void readSettingsFromApplicationStore(); @@ -45,6 +53,8 @@ class RiaRegressionTest : public caf::PdmObject caf::PdmField appendTestsAfterTestFilter; caf::PdmField invalidateExternalFilePaths; + caf::PdmField> overridePlotEngine; + protected: void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp index f58d1249e7..c06375c720 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp @@ -643,6 +643,14 @@ bool RiaRegressionTestRunner::useOpenMPForGeometryCreation() const return m_regressionTestSettings.useOpenMPForGeometryCreation; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaRegressionTest::PlotEngine RiaRegressionTestRunner::overridePlotEngine() const +{ + return m_regressionTestSettings.overridePlotEngine(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h index 0ee6005a8b..afd4e5af76 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h @@ -25,7 +25,6 @@ #include class QDir; -class RiaRegressionTest; //================================================================================================== // @@ -41,6 +40,8 @@ class RiaRegressionTestRunner bool isRunningRegressionTests() const; bool useOpenMPForGeometryCreation() const; + RiaRegressionTest::PlotEngine overridePlotEngine() const; + static void updateRegressionTest( const QString& testRootPath ); static void setDefaultSnapshotSizeFor3dViews(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 957125130a..ea40bcc679 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -22,6 +22,7 @@ #include "RiaDefines.h" #include "RiaFieldHandleTools.h" #include "RiaPlotDefines.h" +#include "RiaRegressionTestRunner.h" #include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryCurveDefinition.h" #include "RiaSummaryTools.h" @@ -2017,7 +2018,18 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent if ( !plotWidget() ) { #ifdef USE_QTCHARTS - if ( m_useQtChartsPlot ) + bool useQtCharts = m_useQtChartsPlot; + + auto regTestRunner = RiaRegressionTestRunner::instance(); + if ( regTestRunner->isRunningRegressionTests() ) + { + if ( regTestRunner->overridePlotEngine() == RiaRegressionTest::PlotEngine::USE_QWT ) + useQtCharts = false; + else if ( regTestRunner->overridePlotEngine() == RiaRegressionTest::PlotEngine::USER_QTCHARTS ) + useQtCharts = true; + } + + if ( useQtCharts ) { m_summaryPlot = std::make_unique( this, mainWindowParent ); } From b0470d38eed99fc747710788d58d5c2588fb6517 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 20 Jan 2022 20:32:59 +0100 Subject: [PATCH 089/406] #8463 Plotting : Add command line parameter to show 2D main window --- ApplicationLibCode/Application/RiaGuiApplication.cpp | 6 ++++++ ApplicationLibCode/Application/Tools/RiaArgumentParser.cpp | 1 + 2 files changed, 7 insertions(+) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 449a2578d3..c9d3aa0359 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -562,6 +562,12 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( cvfqt::Utils::toQStringList( o.values() ) ); } + if ( cvf::Option o = progOpt->option( "openplotwindow" ) ) + { + m_mainWindow->hide(); + getOrCreateAndShowMainPlotWindow(); + } + QString projectFileName; if ( progOpt->hasOption( "last" ) ) diff --git a/ApplicationLibCode/Application/Tools/RiaArgumentParser.cpp b/ApplicationLibCode/Application/Tools/RiaArgumentParser.cpp index 868fb49870..640e37d2fa 100644 --- a/ApplicationLibCode/Application/Tools/RiaArgumentParser.cpp +++ b/ApplicationLibCode/Application/Tools/RiaArgumentParser.cpp @@ -143,6 +143,7 @@ bool RiaArgumentParser::parseArguments( cvf::ProgramOptions* progOpt ) progOpt->registerOption( "generate", "[]", "Generate code or documentation", cvf::ProgramOptions::SINGLE_VALUE ); progOpt->registerOption( "ignoreArgs", "", "System command. Ignore all arguments. Mostly for testing purposes" ); progOpt->registerOption( "version", "", "Display the application version string" ); + progOpt->registerOption( "openplotwindow", "", "Open the 2D plot window. By default, the 3D window is displayed." ); progOpt->setOptionPrefix( cvf::ProgramOptions::DOUBLE_DASH ); From d5b17976ed28e3be93afc95a81f632768e889f75 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 21 Jan 2022 14:32:51 +0100 Subject: [PATCH 090/406] Merge pull request #8459 from OPM/8458-summary-drop-target Closes #8458 --- .../Application/Tools/RiaSummaryTools.cpp | 19 +++++ .../Application/Tools/RiaSummaryTools.h | 2 + .../ProjectDataModel/RimPlot.cpp | 15 ++++ ApplicationLibCode/ProjectDataModel/RimPlot.h | 3 +- .../Summary/RimSummaryPlot.cpp | 36 ++++++++ .../ProjectDataModel/Summary/RimSummaryPlot.h | 1 + .../UserInterface/RiuDragDrop.cpp | 27 +++++- .../UserInterface/RiuDragDrop.h | 10 ++- .../UserInterface/RiuPlotWidget.cpp | 83 +++++++++++++++++++ .../UserInterface/RiuPlotWidget.h | 2 + .../UserInterface/RiuQtChartsPlotCurve.cpp | 25 +++--- .../UserInterface/RiuQtChartsPlotWidget.cpp | 28 +++++++ .../UserInterface/RiuQtChartsPlotWidget.h | 4 + .../UserInterface/RiuQwtPlotWidget.cpp | 7 +- .../cafPdmUiDragDropInterface.h | 2 + .../cafPdmUiTreeViewQModel.cpp | 31 ++++++- 16 files changed, 271 insertions(+), 24 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp index f5a6c83acb..8b8e53f739 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp @@ -30,6 +30,7 @@ #include "RimSummaryCalculation.h" #include "RimSummaryCalculationCollection.h" #include "RimSummaryCalculationVariable.h" +#include "RimSummaryCase.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCrossPlot.h" #include "RimSummaryCrossPlotCollection.h" @@ -238,3 +239,21 @@ std::pair, std::vector> return { resampler.resampledTimeSteps(), resampler.resampledValues() }; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCase* RiaSummaryTools::summaryCaseById( int caseId ) +{ + auto summaryCases = RimProject::current()->allSummaryCases(); + + for ( auto summaryCase : summaryCases ) + { + if ( summaryCase->caseId() == caseId ) + { + return summaryCase; + } + } + + return nullptr; +} diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.h b/ApplicationLibCode/Application/Tools/RiaSummaryTools.h index 91072498b7..ed0d8f2f68 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.h +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.h @@ -69,4 +69,6 @@ class RiaSummaryTools const std::vector& timeSteps, std::vector& values, RiaQDateTimeTools::DateTimePeriod period ); + + static RimSummaryCase* summaryCaseById( int caseId ); }; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index 1880414555..c8db87e8a9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -274,6 +274,21 @@ void RimPlot::updateZoomFromParentPlot() { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmObject* RimPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const +{ + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlot::handleDroppedObjects( const std::vector& objects ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.h b/ApplicationLibCode/ProjectDataModel/RimPlot.h index 7a9a6e1559..5f84ce8d9b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.h @@ -98,7 +98,8 @@ class RimPlot : public QObject, public RimPlotWindow virtual void updateZoomInParentPlot(); virtual void updateZoomFromParentPlot(); - virtual caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const { return nullptr; }; + virtual caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const; + virtual void handleDroppedObjects( const std::vector& objects ); protected: virtual RiuPlotWidget* doCreatePlotViewWidget( QWidget* parent ) = 0; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index ea40bcc679..25f383eccb 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -42,6 +42,7 @@ #include "RimPlotAxisLogRangeCalculator.h" #include "RimPlotAxisProperties.h" #include "RimProject.h" +#include "RimSummaryAddress.h" #include "RimSummaryCase.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" @@ -1957,6 +1958,41 @@ void RimSummaryPlot::setAsCrossPlot() m_isCrossPlot = true; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::handleDroppedObjects( const std::vector& objects ) +{ + for ( auto obj : objects ) + { + auto summaryAdr = dynamic_cast( obj ); + if ( summaryAdr ) + { + if ( summaryAdr->isEnsemble() ) + { + // TODO: Add drop support for ensemble curves + } + else + { + auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAdr->caseId() ); + if ( summaryCase ) + { + auto* newCurve = new RimSummaryCurve(); + + newCurve->setSummaryCaseY( summaryCase ); + newCurve->setSummaryAddressYAndApplyInterpolation( summaryAdr->address() ); + + addCurveNoUpdate( newCurve ); + + newCurve->loadDataAndUpdate( true ); + } + } + } + } + + updateConnectedEditors(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 9cbee46ffc..e2d708d52a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -216,6 +216,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void onLoadDataAndUpdate() override; + void handleDroppedObjects( const std::vector& objects ) override; QImage snapshotWindowContent() override; diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index 999d8002c1..b45e31d6b1 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -184,6 +184,26 @@ RiuDragDrop::~RiuDragDrop() { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiuDragDrop::draggedObjectsFromTreeView( caf::PdmUiTreeView* dragSource, + const QMimeData* data ) +{ + const MimeDataWithIndexes* myMimeData = qobject_cast( data ); + if ( myMimeData ) + { + caf::PdmObjectGroup draggedObjects; + QModelIndexList indices = myMimeData->indexes(); + + objectGroupFromModelIndexes( dragSource, &draggedObjects, indices ); + + return draggedObjects.objects; + } + + return {}; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -352,7 +372,7 @@ bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, in if ( myMimeData && dropTargetIndex.isValid() ) { QModelIndexList indices = myMimeData->indexes(); - objectGroupFromModelIndexes( &draggedObjects, indices ); + objectGroupFromModelIndexes( uiTreeView, &draggedObjects, indices ); } else { @@ -656,12 +676,13 @@ bool RiuDragDrop::handleSummaryCaseMainCollectionDrop( Qt::DropAction //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuDragDrop::objectGroupFromModelIndexes( caf::PdmObjectGroup* objectGroup, const QModelIndexList& indexes ) +void RiuDragDrop::objectGroupFromModelIndexes( caf::PdmUiTreeView* uiTreeView, + caf::PdmObjectGroup* objectGroup, + const QModelIndexList& indexes ) { CVF_ASSERT( objectGroup ); objectGroup->objects.clear(); - caf::PdmUiTreeView* uiTreeView = RiuMainWindow::instance()->projectTreeView(); for ( int i = 0; i < indexes.size(); i++ ) { diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.h b/ApplicationLibCode/UserInterface/RiuDragDrop.h index a61443dd59..1da8781272 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.h +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.h @@ -27,7 +27,8 @@ namespace caf { class PdmObjectHandle; -} +class PdmUiTreeView; +} // namespace caf class RimMultiPlot; class RimIdenticalGridCaseGroup; @@ -49,6 +50,9 @@ class RiuDragDrop : public caf::PdmUiDragDropInterface RiuDragDrop(); ~RiuDragDrop() override; + static std::vector draggedObjectsFromTreeView( caf::PdmUiTreeView* dragSource, + const QMimeData* data ); + protected: Qt::DropActions supportedDropActions() const override; Qt::ItemFlags flags( const QModelIndex& index ) const override; @@ -96,7 +100,9 @@ class RiuDragDrop : public caf::PdmUiDragDropInterface caf::PdmObjectGroup& objectGroup, RimSurfaceCollection* surfaceCollection ); - static void objectGroupFromModelIndexes( caf::PdmObjectGroup* objectGroup, const QModelIndexList& indexes ); + static void objectGroupFromModelIndexes( caf::PdmUiTreeView* uiTreeView, + caf::PdmObjectGroup* objectGroup, + const QModelIndexList& indexes ); static std::vector> objectHandlesFromSelection(); private: diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp index cb88347f48..795a2e659f 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp @@ -19,14 +19,23 @@ #include "RiuQwtPlotWidget.h" +#include "RiaGuiApplication.h" #include "RiaPlotDefines.h" #include "RiaPlotWindowRedrawScheduler.h" + +#include "RimMimeData.h" #include "RimPlot.h" +#include "RimProject.h" +#include "RiuDragDrop.h" #include "RiuDraggableOverlayFrame.h" +#include "RiuPlotMainWindow.h" #include "cafAssert.h" +#include +#include + #include #include @@ -217,6 +226,80 @@ void RiuPlotWidget::updateOverlayFrameLayout() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuPlotWidget::handleDragDropEvent( QEvent* event ) +{ + if ( !event ) return false; + + if ( event->type() == QEvent::DragEnter ) + { + auto dragEnterEvent = dynamic_cast( event ); + if ( dragEnterEvent ) + { + dragEnterEvent->acceptProposedAction(); + + return true; + } + } + + const MimeDataWithIndexes* mimeData = nullptr; + + if ( event->type() == QEvent::Drop ) + { + // These drop events come from Qwt + auto dropEvent = dynamic_cast( event ); + if ( dropEvent ) + { + mimeData = qobject_cast( dropEvent->mimeData() ); + + dropEvent->acceptProposedAction(); + } + } + + if ( event->type() == QEvent::GraphicsSceneDrop ) + { + // These drop events come from QtChart + auto dropEvent = dynamic_cast( event ); + if ( dropEvent ) + { + mimeData = qobject_cast( dropEvent->mimeData() ); + + dropEvent->acceptProposedAction(); + } + } + + if ( mimeData ) + { + std::vector objects; + + QString mimeType = caf::PdmUiDragDropInterface::mimeTypeForObjectReferenceList(); + + auto data = mimeData->data( mimeType ); + + QStringList objectReferences; + QDataStream in( &data, QIODevice::ReadOnly ); + in >> objectReferences; + + auto proj = RimProject::current(); + for ( const auto& objRef : objectReferences ) + { + auto obj = caf::PdmReferenceHelper::objectFromReference( proj, objRef ); + if ( obj ) objects.push_back( obj ); + } + + if ( m_plotDefinition ) + { + m_plotDefinition->handleDroppedObjects( objects ); + } + + return true; + } + + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.h b/ApplicationLibCode/UserInterface/RiuPlotWidget.h index 9217ae2a29..efabe9d962 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.h @@ -180,6 +180,8 @@ class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow protected: void updateOverlayFrameLayout(); + bool handleDragDropEvent( QEvent* event ); + static int defaultMinimumWidth(); caf::PdmPointer m_plotDefinition; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index 5f497e0869..9f3c3eb4eb 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -158,10 +158,9 @@ void RiuQtChartsPlotCurve::detach() line->hide(); } - QtCharts::QScatterSeries* scatter = scatterSeries(); - if ( scatter ) + if ( scatterSeries() ) { - scatter->hide(); + scatterSeries()->hide(); } if ( m_plotWidget ) setVisibleInLegend( false ); @@ -350,12 +349,10 @@ void RiuQtChartsPlotCurve::setVisibleInLegend( bool isVisibleInLegend ) //-------------------------------------------------------------------------------------------------- QtCharts::QLineSeries* RiuQtChartsPlotCurve::lineSeries() const { - if ( m_lineSeries ) - return m_lineSeries; - else if ( m_plotWidget ) - return dynamic_cast( m_plotWidget->getLineSeries( this ) ); - else - return nullptr; + if ( m_lineSeries ) return m_lineSeries; + if ( m_plotWidget ) return dynamic_cast( m_plotWidget->getLineSeries( this ) ); + + return nullptr; } //-------------------------------------------------------------------------------------------------- @@ -363,12 +360,10 @@ QtCharts::QLineSeries* RiuQtChartsPlotCurve::lineSeries() const //-------------------------------------------------------------------------------------------------- QtCharts::QScatterSeries* RiuQtChartsPlotCurve::scatterSeries() const { - if ( m_scatterSeries ) - return m_scatterSeries; - else if ( m_plotWidget ) - return dynamic_cast( m_plotWidget->getScatterSeries( this ) ); - else - return nullptr; + if ( m_scatterSeries ) return m_scatterSeries; + if ( m_plotWidget ) return dynamic_cast( m_plotWidget->getScatterSeries( this ) ); + + return nullptr; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 4621f666ee..d0ac1153ad 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -62,6 +62,8 @@ RiuQtChartsPlotWidget::RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* QtCharts::QChart* chart = new QtCharts::QChart(); chart->layout()->setContentsMargins( 0, 0, 0, 0 ); chart->setBackgroundRoundness( 0 ); + chart->setAcceptDrops( true ); + chart->installEventFilter( this ); m_viewer = new RiuQtChartView( nullptr, parent ); m_viewer->setChart( chart ); @@ -986,6 +988,22 @@ Qt::Orientation RiuQtChartsPlotWidget::orientation( RiaDefines::PlotAxis axis ) return Qt::Orientation::Vertical; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::dragEnterEvent( QDragEnterEvent* event ) +{ + RiuPlotWidget::handleDragDropEvent( event ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::dropEvent( QDropEvent* event ) +{ + RiuPlotWidget::handleDragDropEvent( event ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1010,6 +1028,16 @@ void RiuQtChartsPlotWidget::wheelEvent( QWheelEvent* event ) event->accept(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuQtChartsPlotWidget::eventFilter( QObject* watched, QEvent* event ) +{ + if ( RiuPlotWidget::handleDragDropEvent( event ) ) return true; + + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index cbe52cb4f7..132fb8ad42 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -176,6 +176,7 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget void resizeEvent( QResizeEvent* event ) override; void keyPressEvent( QKeyEvent* event ) override; void wheelEvent( QWheelEvent* event ) override; + bool eventFilter( QObject* watched, QEvent* event ) override; void applyPlotTitleToPlot(); void applyAxisTitleToPlot( RiaDefines::PlotAxis axis ); @@ -190,6 +191,9 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget QtCharts::QAbstractAxis* plotAxis( RiaDefines::PlotAxis axis ) const; Qt::Orientation orientation( RiaDefines::PlotAxis axis ) const; + void dragEnterEvent( QDragEnterEvent* event ) override; + void dropEvent( QDropEvent* event ) override; + signals: void plotZoomed(); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 5d75b89f59..25353fe22f 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -79,11 +79,12 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent ) setLayout( layout ); m_plot = new QwtPlot( this ); + m_plot->setAcceptDrops( true ); layout->addWidget( m_plot ); RiuQwtPlotTools::setCommonPlotBehaviour( m_plot ); - m_plot->installEventFilter( m_plot ); + m_plot->installEventFilter( this ); m_plot->canvas()->installEventFilter( this ); setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); @@ -171,7 +172,7 @@ void RiuQwtPlotWidget::setAxisFontsAndAlignment( RiaDefines::PlotAxis axis, //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int valueFontSize, bool titleBold, int alignment ) { - for ( auto axisTitlePair : m_axisTitles ) + for ( const auto& axisTitlePair : m_axisTitles ) { setAxisFontsAndAlignment( axisTitlePair.first, titleFontSize, valueFontSize, titleBold, alignment ); } @@ -534,6 +535,8 @@ void RiuQwtPlotWidget::updateLegend() //-------------------------------------------------------------------------------------------------- bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event ) { + if ( RiuPlotWidget::handleDragDropEvent( event ) ) return true; + QWheelEvent* wheelEvent = dynamic_cast( event ); if ( wheelEvent && watched == m_plot->canvas() ) { diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiDragDropInterface.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiDragDropInterface.h index 43bf610306..02db7b3201 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiDragDropInterface.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiDragDropInterface.h @@ -50,6 +50,8 @@ class PdmUiDragDropInterface public: virtual ~PdmUiDragDropInterface() = 0; + static QString mimeTypeForObjectReferenceList() { return "ObjectReferenceList"; } + protected: friend class PdmUiTreeViewQModel; friend class PdmUiTreeViewWidget; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp index 40a6a1ec36..a3247bbfc7 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp @@ -45,6 +45,7 @@ #include "cafPdmUiTreeViewEditor.h" #include +#include #include namespace caf @@ -852,7 +853,35 @@ QMimeData* PdmUiTreeViewQModel::mimeData( const QModelIndexList& indexes ) const { if ( m_dragDropInterface ) { - return m_dragDropInterface->mimeData( indexes ); + QStringList objectPaths; + + for ( const auto& i : indexes ) + { + auto uiObjHandle = dynamic_cast( uiItemFromModelIndex( i ) ); + if ( uiObjHandle && uiObjHandle->objectHandle() ) + { + auto objHandle = uiObjHandle->objectHandle(); + + auto root = PdmReferenceHelper::findRoot( objHandle ); + auto path = PdmReferenceHelper::referenceFromRootToObject( root, objHandle ); + + objectPaths.push_back( path ); + } + } + + auto mimeDataObject = m_dragDropInterface->mimeData( indexes ); + + QByteArray data; + QDataStream dataStreamWrite( &data, QIODevice::WriteOnly ); + dataStreamWrite << objectPaths; + + QString mimeType = PdmUiDragDropInterface::mimeTypeForObjectReferenceList(); + + // The QModelIndexList is useful for drag and drop internally in one tree widget. If we + // drag from a tree into other widgets, it is useful to have the full path as text from root to object. + mimeDataObject->setData( mimeType, data ); + + return mimeDataObject; } else { From 2d2bf0bbc76e39b4a4da7e2d76fb522048549688 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 26 Jan 2022 10:08:28 +0100 Subject: [PATCH 091/406] CMake : Improve handling of compiler flags (#8486) #8478 Code cleanup to fix some warnings Several adjustments to improve the specification and usage of compile flags. --- ApplicationLibCode/CMakeLists.txt | 58 +++++++++------ ApplicationLibCode/Commands/CMakeLists.txt | 33 ++++++++- .../Summary/RimEnsembleStatisticsCase.cpp | 2 +- .../WellPath/RimWellPathGroup.cpp | 2 +- .../UnitTests/RigSlice2D-Test.cpp | 4 +- .../UserInterface/RiuCadNavigation.cpp | 6 +- .../UserInterface/RiuGeoQuestNavigation.cpp | 4 +- .../UserInterface/RiuGridCrossQwtPlot.cpp | 2 +- .../UserInterface/RiuQwtPlotCurve.cpp | 2 +- .../UserInterface/RiuRmsNavigation.cpp | 4 +- .../UserInterface/RiuSummaryQwtPlot.cpp | 2 +- CMakeLists.txt | 73 ++++++++++++++++++- Fwk/AppFwk/CommonCode/cafMouseState.cpp | 2 +- .../cafPdmUiCommandSystemProxy.cpp | 3 +- .../cafPdmUiFieldEditorHelper.cpp | 3 +- .../cafUserInterface/cafPdmUiTreeViewEditor.h | 3 +- Fwk/AppFwk/cafViewer/cafCadNavigation.cpp | 6 +- Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp | 2 +- .../cafViewer/cafCeetronPlusNavigation.cpp | 4 +- Fwk/VizFwk/LibGuiQt/cvfqtMouseState.cpp | 2 +- GrpcInterface/CMakeLists.txt | 13 ++-- ThirdParty/clipper/CMakeLists.txt | 4 + ThirdParty/custom-opm-common/CMakeLists.txt | 16 ++-- .../custom-opm-flowdiag-app/CMakeLists.txt | 4 + 24 files changed, 190 insertions(+), 64 deletions(-) diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index 564ddf3e3b..586d91e4b1 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -339,30 +339,42 @@ if(RESINSIGHT_ENABLE_PRECOMPILED_HEADERS) ) endif() -if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") - set_target_properties( - ${PROJECT_NAME} - PROPERTIES - COMPILE_FLAGS - "-Wall -Wno-unused-parameter -Wno-reorder -Wno-parentheses -Wno-switch" +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options( + ApplicationLibCode PRIVATE -Wall -Wno-unused-parameter -Wno-reorder + -Wno-parentheses -Wno-switch ) - # Treat warnings as errors if asked to do so - if(RESINSIGHT_TREAT_WARNINGS_AS_ERRORS) - set_target_properties( - ${PROJECT_NAME} - PROPERTIES - COMPILE_FLAGS - "-Wall -Wno-unused-parameter -Wno-reorder -Wno-parentheses -Wno-switch -Werror" - ) - endif() +endif() - if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set_target_properties( - ${PROJECT_NAME} - PROPERTIES - COMPILE_FLAGS - "-Wall -Wno-unused-parameter -Wno-reorder -Wno-parentheses -Wno-switch -Wno-delete-abstract-non-virtual-dtor -Wno-undefined-var-template -Wno-invalid-source-encoding -Wno-enum-compare -Wno-call-to-pure-virtual-from-ctor-dtor -Wno-unused-variable -Wno-unused-private-field -Wno-unused-lambda-capture -Wno-delete-non-abstract-non-virtual-dtor -Wno-braced-scalar-init -Wno-tautological-constant-out-of-range-compare" - ) +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + + target_compile_options( + ApplicationLibCode + PRIVATE -Wall + -Wno-unused-parameter + -Wno-reorder + -Wno-parentheses + -Wno-switch + -Wno-delete-abstract-non-virtual-dtor + -Wno-undefined-var-template + -Wno-invalid-source-encoding + -Wno-enum-compare + -Wno-call-to-pure-virtual-from-ctor-dtor + -Wno-unused-variable + -Wno-unused-private-field + -Wno-unused-lambda-capture + -Wno-delete-non-abstract-non-virtual-dtor + -Wno-braced-scalar-init + -Wno-tautological-constant-out-of-range-compare + -Wno-undefined-var-template + ) +endif() + +if(RESINSIGHT_TREAT_WARNINGS_AS_ERRORS) + if(MSVC) + target_compile_options(ApplicationLibCode PRIVATE /WX) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_compile_options(ApplicationLibCode PRIVATE -Werror) endif() endif() @@ -376,7 +388,7 @@ if(MSVC) # set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/W3 /wd4190 # /wd4100 /wd4127") - set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005") + set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005 /wd4251") if(Qt5Core_VERSION_STRING GREATER_EQUAL 5.10) # Disable warning for deprecated functions in newer versions of Qt diff --git a/ApplicationLibCode/Commands/CMakeLists.txt b/ApplicationLibCode/Commands/CMakeLists.txt index a4ad719315..fdc96a1fbc 100644 --- a/ApplicationLibCode/Commands/CMakeLists.txt +++ b/ApplicationLibCode/Commands/CMakeLists.txt @@ -67,6 +67,37 @@ target_include_directories( ${CMAKE_SOURCE_DIR}/ThirdParty/custom-opm-common/opm-common ) +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_compile_options( + Commands + PRIVATE -Wall + -Wno-unused-parameter + -Wno-reorder + -Wno-parentheses + -Wno-switch + -Wno-delete-abstract-non-virtual-dtor + -Wno-undefined-var-template + -Wno-invalid-source-encoding + -Wno-enum-compare + -Wno-call-to-pure-virtual-from-ctor-dtor + -Wno-unused-variable + -Wno-unused-private-field + -Wno-unused-lambda-capture + -Wno-delete-non-abstract-non-virtual-dtor + -Wno-braced-scalar-init + -Wno-tautological-constant-out-of-range-compare + -Wno-undefined-var-template + ) +endif() + +if(RESINSIGHT_TREAT_WARNINGS_AS_ERRORS) + if(MSVC) + target_compile_options(Commands PRIVATE /WX) + elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux") + target_compile_options(Commands PRIVATE -Werror) + endif() +endif() + if(MSVC) # The following warnings are supposed to be used in ResInsight, but # temporarily disabled to avoid too much noise warning C4245: 'return': @@ -77,7 +108,7 @@ if(MSVC) # set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/W3 /wd4190 # /wd4100 /wd4127") - set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005") + set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005 /wd4573") if(Qt5Core_VERSION_STRING GREATER_EQUAL 5.10) # Disable warning for deprecated functions in newer versions of Qt diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp index 30113951f4..8fd7c45f0a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp @@ -253,7 +253,7 @@ std::vector RimEnsembleStatisticsCase::validSummaryCases( const } } - for ( const auto [sumCase, lastTimeStep] : times ) + for ( const auto& [sumCase, lastTimeStep] : times ) { // Previous versions tested on identical first time step, this test is now removed. For large simulations with // numerical issues the first time step can be slightly different diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp index 6a54d448b3..febc831b98 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp @@ -252,7 +252,7 @@ void RimWellPathGroup::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin std::vector RimWellPathGroup::wellPathGeometries() const { std::vector allGeometries; - for ( const auto child : m_childWellPaths() ) + for ( const auto& child : m_childWellPaths() ) { if ( child->wellPathGeometry() ) { diff --git a/ApplicationLibCode/UnitTests/RigSlice2D-Test.cpp b/ApplicationLibCode/UnitTests/RigSlice2D-Test.cpp index ddc639f4d7..1019551755 100644 --- a/ApplicationLibCode/UnitTests/RigSlice2D-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigSlice2D-Test.cpp @@ -16,9 +16,9 @@ TEST( RigSlice2DTest, GetAndSet ) for ( size_t y = 0; y < ny; y++ ) for ( size_t x = 0; x < nx; x++ ) - slice.setValue( x, y, x * y ); + slice.setValue( x, y, static_cast( x * y ) ); for ( size_t y = 0; y < ny; y++ ) for ( size_t x = 0; x < nx; x++ ) - EXPECT_EQ( x * y, slice.getValue( x, y ) ); + EXPECT_EQ( static_cast( x * y ), slice.getValue( x, y ) ); } diff --git a/ApplicationLibCode/UserInterface/RiuCadNavigation.cpp b/ApplicationLibCode/UserInterface/RiuCadNavigation.cpp index c849a27821..1b2bda65de 100644 --- a/ApplicationLibCode/UserInterface/RiuCadNavigation.cpp +++ b/ApplicationLibCode/UserInterface/RiuCadNavigation.cpp @@ -57,7 +57,7 @@ bool RiuCadNavigation::handleInputEvent( QInputEvent* inputEvent ) int translatedMousePosX, translatedMousePosY; cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY ); - if ( me->button() == Qt::MidButton && me->modifiers() == Qt::NoModifier && isRotationEnabled() ) + if ( me->button() == Qt::MiddleButton && me->modifiers() == Qt::NoModifier && isRotationEnabled() ) { this->pickAndSetPointOfInterest( me->x(), me->y() ); @@ -67,7 +67,7 @@ bool RiuCadNavigation::handleInputEvent( QInputEvent* inputEvent ) isEventHandled = true; } else if ( me->button() == Qt::LeftButton || - ( me->button() == Qt::MidButton && ( me->modifiers() & Qt::ShiftModifier ) ) ) + ( me->button() == Qt::MiddleButton && ( me->modifiers() & Qt::ShiftModifier ) ) ) { m_trackball->startNavigation( cvf::ManipulatorTrackball::PAN, translatedMousePosX, translatedMousePosY ); m_isNavigating = true; @@ -82,7 +82,7 @@ bool RiuCadNavigation::handleInputEvent( QInputEvent* inputEvent ) if ( m_isNavigating ) { QMouseEvent* me = static_cast( inputEvent ); - if ( me->button() == Qt::MidButton || me->button() == Qt::LeftButton ) + if ( me->button() == Qt::MiddleButton || me->button() == Qt::LeftButton ) { m_trackball->endNavigation(); diff --git a/ApplicationLibCode/UserInterface/RiuGeoQuestNavigation.cpp b/ApplicationLibCode/UserInterface/RiuGeoQuestNavigation.cpp index eb44867d0c..72c810824a 100644 --- a/ApplicationLibCode/UserInterface/RiuGeoQuestNavigation.cpp +++ b/ApplicationLibCode/UserInterface/RiuGeoQuestNavigation.cpp @@ -66,7 +66,7 @@ bool RiuGeoQuestNavigation::handleInputEvent( QInputEvent* inputEvent ) m_hasMovedMouseDuringNavigation = false; isEventHandled = true; } - else if ( me->button() == Qt::MidButton ) + else if ( me->button() == Qt::MiddleButton ) { if ( me->modifiers() == Qt::NoModifier ) { @@ -84,7 +84,7 @@ bool RiuGeoQuestNavigation::handleInputEvent( QInputEvent* inputEvent ) if ( m_isNavigating ) { QMouseEvent* me = static_cast( inputEvent ); - if ( me->button() == Qt::LeftButton || me->button() == Qt::MidButton ) + if ( me->button() == Qt::LeftButton || me->button() == Qt::MiddleButton ) { m_trackball->endNavigation(); diff --git a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp index d67923ca52..e7a13fb9da 100644 --- a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp @@ -76,7 +76,7 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* paren // MidButton for the panning QwtPlotPanner* panner = new QwtPlotPanner( qwtPlot()->canvas() ); - panner->setMouseButton( Qt::MidButton ); + panner->setMouseButton( Qt::MiddleButton ); auto wheelZoomer = new RiuQwtPlotWheelZoomer( qwtPlot() ); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index babf2fee97..8ec169e04f 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -381,7 +381,7 @@ void RiuQwtPlotCurve::clearErrorBars() //-------------------------------------------------------------------------------------------------- int RiuQwtPlotCurve::numSamples() const { - return dataSize(); + return static_cast( dataSize() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuRmsNavigation.cpp b/ApplicationLibCode/UserInterface/RiuRmsNavigation.cpp index ec4b1a757b..945bfa186c 100644 --- a/ApplicationLibCode/UserInterface/RiuRmsNavigation.cpp +++ b/ApplicationLibCode/UserInterface/RiuRmsNavigation.cpp @@ -57,7 +57,7 @@ bool RiuRmsNavigation::handleInputEvent( QInputEvent* inputEvent ) int translatedMousePosX, translatedMousePosY; cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY ); - if ( me->button() == Qt::MidButton && isRotationEnabled() ) + if ( me->button() == Qt::MiddleButton && isRotationEnabled() ) { this->pickAndSetPointOfInterest( me->x(), me->y() ); @@ -100,7 +100,7 @@ bool RiuRmsNavigation::handleInputEvent( QInputEvent* inputEvent ) if ( m_isNavigating ) { QMouseEvent* me = static_cast( inputEvent ); - if ( me->button() == Qt::RightButton || me->button() == Qt::MidButton ) + if ( me->button() == Qt::RightButton || me->button() == Qt::MiddleButton ) { m_trackball->endNavigation(); diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp index c99f8f7f3c..12296d82cf 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -113,7 +113,7 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*= // MidButton for the panning QwtPlotPanner* panner = new QwtPlotPanner( m_plotWidget->qwtPlot()->canvas() ); - panner->setMouseButton( Qt::MidButton ); + panner->setMouseButton( Qt::MiddleButton ); m_wheelZoomer = new RiuQwtPlotWheelZoomer( m_plotWidget->qwtPlot() ); diff --git a/CMakeLists.txt b/CMakeLists.txt index 85b1010c4b..62303eabc9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,12 +226,25 @@ else() COMPILE_FLAGS "/wd4244 /wd4267 /wd4013 /wd4190 /wd4018 /wd4477 /wd4098 /wd4293 /wd4305 /wd4020 /wd4028 /wd4715 /wd4245 /wd4804 /wd4100 /wd4456 /wd4458 /wd4090 /wd4297 /wd4701 /wd4101 /wd4702 /wd4457" ) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set_target_properties( + ecl + PROPERTIES + COMPILE_FLAGS + "-Wno-deprecated -Wno-deprecated-declarations -Wno-sign-compare" + ) else() set_target_properties( ecl - PROPERTIES COMPILE_FLAGS - "-Wno-deprecated -Wno-deprecated-declarations -Wno-clobbered" + PROPERTIES + COMPILE_FLAGS + "-Wno-deprecated -Wno-deprecated-declarations -Wno-clobbered -Wno-int-in-bool-context" ) + + target_compile_options( + ecl PRIVATE $<$:-Wno-class-memaccess> + ) + endif() list(APPEND THIRD_PARTY_LIBRARIES ecl) @@ -421,6 +434,12 @@ endif() add_subdirectory(ThirdParty/qwt) +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_compile_options(qwt PRIVATE -Wno-deprecated-copy) +elseif(MSVC) + target_compile_options(qwt PRIVATE /wd4996 /wd4005) +endif() + if(RESINSIGHT_ENABLE_UNITY_BUILD) message("Cmake Unity build is enabled on : qwt") set_property(TARGET qwt PROPERTY UNITY_BUILD true) @@ -437,6 +456,9 @@ list(APPEND THIRD_PARTY_LIBRARIES qwt) # ############################################################################## add_subdirectory(ThirdParty/nightcharts) +if(MSVC) + target_compile_options(nightcharts PRIVATE /wd4996) +endif() list(APPEND THIRD_PARTY_LIBRARIES nightcharts) @@ -446,6 +468,10 @@ list(APPEND THIRD_PARTY_LIBRARIES nightcharts) add_subdirectory(ThirdParty/expressionparser) +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(expressionparser PUBLIC -Wno-overloaded-virtual) +endif() + list(APPEND THIRD_PARTY_LIBRARIES expressionparser) # ############################################################################## @@ -454,6 +480,10 @@ list(APPEND THIRD_PARTY_LIBRARIES expressionparser) add_subdirectory(ThirdParty/clipper) +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(clipper PUBLIC -Wno-deprecated-copy) +endif() + list(APPEND THIRD_PARTY_LIBRARIES clipper) # ############################################################################## @@ -509,6 +539,17 @@ list( LibCore ) +if(MSVC) + target_compile_options(LibGuiQt PRIVATE /wd4996) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_compile_options( + LibRender PRIVATE -Wno-undefined-var-template -Wno-invalid-source-encoding + -Wno-null-pointer-arithmetic + ) +endif() + set_property(TARGET ${VIZ_FWK_LIBRARIES} PROPERTY FOLDER "VizFwk") # ############################################################################## @@ -526,8 +567,10 @@ add_subdirectory(Fwk/AppFwk/cafProjectDataModel) add_subdirectory(Fwk/AppFwk/cafCommand) add_subdirectory(Fwk/AppFwk/cafUserInterface) add_subdirectory(Fwk/AppFwk/cafPdmCvf) + add_subdirectory(Fwk/AppFwk/CommonCode) add_subdirectory(Fwk/AppFwk/cafVizExtensions) + option(CAF_CVF_SCRIPTING "" ON) add_subdirectory(Fwk/AppFwk/cafPdmScripting) set_property(TARGET cafPdmScripting PROPERTY FOLDER "AppFwk") @@ -538,6 +581,32 @@ set_property(TARGET cafCommandFeatures PROPERTY FOLDER "AppFwk") add_subdirectory(Fwk/AppFwk/cafTensor) add_subdirectory(Fwk/AppFwk/cafHexInterpolator) +if(MSVC) + target_compile_options(cafViewer PRIVATE /wd4996) + target_compile_options(cafPdmCore PRIVATE /wd4996) + target_compile_options(cafPdmCore PRIVATE /wd4996) + target_compile_options(cafPdmXml PRIVATE /wd4996) + target_compile_options(cafUserInterface PRIVATE /wd4996) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(cafCommandFeatures PRIVATE -Wno-deprecated-copy) +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + target_compile_options( + CommonCode PRIVATE -Wno-deprecated-copy -Wno-undefined-var-template + ) + target_compile_options( + cafCommandFeatures PRIVATE -Wno-deprecated-copy -Wno-undefined-var-template + ) + target_compile_options( + cafVizExtensions PRIVATE -Wno-deprecated-copy -Wno-undefined-var-template + -Wno-invalid-source-encoding + ) + target_compile_options(cafUserInterface PRIVATE -Wno-null-pointer-arithmetic) +endif() + list( APPEND APP_FWK_LIBRARIES diff --git a/Fwk/AppFwk/CommonCode/cafMouseState.cpp b/Fwk/AppFwk/CommonCode/cafMouseState.cpp index db8d7b09c3..53348763e2 100644 --- a/Fwk/AppFwk/CommonCode/cafMouseState.cpp +++ b/Fwk/AppFwk/CommonCode/cafMouseState.cpp @@ -237,7 +237,7 @@ int QtMouseState::numMouseButtonsInState( Qt::MouseButtons buttonState ) if ( buttonState & Qt::LeftButton ) iNum++; if ( buttonState & Qt::RightButton ) iNum++; - if ( buttonState & Qt::MidButton ) iNum++; + if ( buttonState & Qt::MiddleButton ) iNum++; return iNum; } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp index 2f0b719b17..0fd4b8feb4 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp @@ -164,7 +164,8 @@ std::vector PdmUiCommandSystemProxy::fieldsFromSelection( PdmFi if ( items.size() < 2 ) return {}; const auto fieldKeyword = editorField->keyword(); - const auto& fieldOwnerTypeId = typeid( *editorField->ownerObject() ); + auto ownerObject = editorField->ownerObject(); + const auto& fieldOwnerTypeId = typeid( *ownerObject ); std::vector additionalFieldsToUpdate; for ( auto& item : items ) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp index deec96180f..1760042bc4 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp @@ -60,7 +60,8 @@ caf::PdmUiFieldEditorHandle* caf::PdmUiFieldEditorHelper::createFieldEditorForFi else { // Find the default field editor - QString fieldTypeName = qStringTypeName( *( field->fieldHandle() ) ); + auto fieldHandle = field->fieldHandle(); + QString fieldTypeName = qStringTypeName( *fieldHandle ); if ( fieldTypeName.indexOf( "PdmPtrField" ) != -1 ) { diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h index 6391c04ef7..9c74240959 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h @@ -129,8 +129,7 @@ class PdmUiTreeViewItemAttribute : public PdmUiEditorAttribute static std::unique_ptr create() { return std::unique_ptr( new Tag ); } private: - Tag( const Tag& rhs ) = default; - Tag& operator =( const Tag& rhs ) { return *this; } + Tag& operator=( const Tag& rhs ) { return *this; } }; std::vector> tags; diff --git a/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp b/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp index e785945581..483e9fd5ec 100644 --- a/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp +++ b/Fwk/AppFwk/cafViewer/cafCadNavigation.cpp @@ -74,7 +74,7 @@ bool caf::CadNavigation::handleInputEvent( QInputEvent* inputEvent ) int translatedMousePosX, translatedMousePosY; cvfEventPos( me->x(), me->y(), &translatedMousePosX, &translatedMousePosY ); - if ( me->button() == Qt::MidButton && me->modifiers() == Qt::NoModifier && isRotationEnabled() ) + if ( me->button() == Qt::MiddleButton && me->modifiers() == Qt::NoModifier && isRotationEnabled() ) { this->pickAndSetPointOfInterest( me->x(), me->y() ); @@ -85,7 +85,7 @@ bool caf::CadNavigation::handleInputEvent( QInputEvent* inputEvent ) m_hasMovedMouseDuringNavigation = false; isEventHandled = true; } - else if ( me->button() == Qt::MidButton && ( me->modifiers() & Qt::ShiftModifier ) ) + else if ( me->button() == Qt::MiddleButton && ( me->modifiers() & Qt::ShiftModifier ) ) { m_trackball->startNavigation( cvf::ManipulatorTrackball::PAN, translatedMousePosX, translatedMousePosY ); m_isNavigating = true; @@ -100,7 +100,7 @@ bool caf::CadNavigation::handleInputEvent( QInputEvent* inputEvent ) if ( m_isNavigating ) { QMouseEvent* me = static_cast( inputEvent ); - if ( me->button() == Qt::MidButton ) + if ( me->button() == Qt::MiddleButton ) { m_trackball->endNavigation(); diff --git a/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp b/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp index 8e77a1d3b8..bdd52b41be 100644 --- a/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp +++ b/Fwk/AppFwk/cafViewer/cafCeetronNavigation.cpp @@ -229,7 +229,7 @@ ManipulatorTrackball::NavigationType caf::CeetronNavigation::getNavigationTypeFr { return ManipulatorTrackball::ROTATE; } - else if ( mouseButtons == Qt::MidButton || mouseButtons == ( Qt::LeftButton | Qt::RightButton ) ) + else if ( mouseButtons == Qt::MiddleButton || mouseButtons == ( Qt::LeftButton | Qt::RightButton ) ) { return ManipulatorTrackball::WALK; } diff --git a/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp b/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp index ebce016cf3..e6df70a6d0 100644 --- a/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp +++ b/Fwk/AppFwk/cafViewer/cafCeetronPlusNavigation.cpp @@ -98,7 +98,7 @@ bool caf::CeetronPlusNavigation::handleInputEvent( QInputEvent* inputEvent ) isEventHandled = true; } } - else if ( me->button() == Qt::MidButton ) + else if ( me->button() == Qt::MiddleButton ) { if ( me->modifiers() == Qt::NoModifier ) { @@ -130,7 +130,7 @@ bool caf::CeetronPlusNavigation::handleInputEvent( QInputEvent* inputEvent ) if ( m_hasMovedMouseDuringNavigation ) isEventHandled = true; m_hasMovedMouseDuringNavigation = false; } - else if ( me->button() == Qt::MidButton ) + else if ( me->button() == Qt::MiddleButton ) { m_isZooming = false; diff --git a/Fwk/VizFwk/LibGuiQt/cvfqtMouseState.cpp b/Fwk/VizFwk/LibGuiQt/cvfqtMouseState.cpp index 72a7d0bcda..cc28ad140b 100644 --- a/Fwk/VizFwk/LibGuiQt/cvfqtMouseState.cpp +++ b/Fwk/VizFwk/LibGuiQt/cvfqtMouseState.cpp @@ -246,7 +246,7 @@ int MouseState::numMouseButtonsInState(Qt::MouseButtons buttonState) if (buttonState & Qt::LeftButton) iNum++; if (buttonState & Qt::RightButton) iNum++; - if (buttonState & Qt::MidButton) iNum++; + if (buttonState & Qt::MiddleButton) iNum++; return iNum; } diff --git a/GrpcInterface/CMakeLists.txt b/GrpcInterface/CMakeLists.txt index b3b7d65bc5..a1bf143c16 100644 --- a/GrpcInterface/CMakeLists.txt +++ b/GrpcInterface/CMakeLists.txt @@ -231,13 +231,14 @@ target_include_directories(${PROJECT_NAME} PUBLIC target_link_libraries(${PROJECT_NAME} PRIVATE ${_LINK_LIBRARIES}) if(MSVC) - # GRPC generates a lot of harmless warnings on MSVC - set_target_properties( - ${PROJECT_NAME} - PROPERTIES COMPILE_FLAGS "/wd4251 /wd4702 /wd4005 /wd4244 /wd4125 /wd4267") + target_compile_options( + GrpcInterface + PRIVATE /wd4251 /wd4244 /wd4267) else() - set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS - "-Wno-overloaded-virtual") + target_compile_options( + GrpcInterface + PRIVATE -Wno-switch -Wno-overloaded-virtual + ) endif() # install gRPC Python files diff --git a/ThirdParty/clipper/CMakeLists.txt b/ThirdParty/clipper/CMakeLists.txt index 300964eeb3..9f84a5e20b 100644 --- a/ThirdParty/clipper/CMakeLists.txt +++ b/ThirdParty/clipper/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required (VERSION 2.8.12) +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-copy") +endif() + project (clipper) set(project_source_files diff --git a/ThirdParty/custom-opm-common/CMakeLists.txt b/ThirdParty/custom-opm-common/CMakeLists.txt index c1e0e3d2a9..3428bb6a50 100644 --- a/ThirdParty/custom-opm-common/CMakeLists.txt +++ b/ThirdParty/custom-opm-common/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required (VERSION 2.8) -# -DBOOST_FILESYSTEM_VERSION=3 -DBOOST_TEST_DYN_LINK -DHAVE_CASE_SENSITIVE_FILESYSTEM=1 -DHAVE_REGEX=1 -DOPM_PARSER_DECK_API=1 -Wall -std=c++11 -fopenmp -Wall -g -O0 -DDEBUG -ggdb3 - - # Languages and global compiler settings if(CMAKE_VERSION VERSION_LESS 3.8) message(WARNING "CMake version does not support c++17, guessing -std=c++17") @@ -13,12 +10,19 @@ else() set(CMAKE_CXX_EXTENSIONS OFF) endif() - if(MSVC) - add_definitions( "/wd4996 /wd4244 /wd4267" ) + add_definitions( "/wd4996 /wd4244 /wd4267 /wd4101 /wd4477" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /permissive-") endif(MSVC) +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-parameter -Wno-switch -Wno-sign-compare -Wno-deprecated-copy -Wno-missing-field-initializers") +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare -Wno-missing-field-initializers -Wno-deprecated-copy") +endif() + project (custom-opm-common) find_package(Boost) @@ -111,12 +115,12 @@ if(RESINSIGHT_ENABLE_UNITY_BUILD) endforeach(fileToExclude) endif() - find_path(BOOST_SPIRIT_INCLUDE_DIRS "boost/spirit.hpp" HINTS ${Boost_INCLUDE_DIRS}) target_link_libraries(custom-opm-common ${ADDITIONAL_LINK_LIBRARIES} ) + target_include_directories(custom-opm-common PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/opm-common diff --git a/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt b/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt index a3cfcd3d34..a44c68d824 100644 --- a/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt +++ b/ThirdParty/custom-opm-flowdiag-app/CMakeLists.txt @@ -6,6 +6,10 @@ if (CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-deprecated-declarations") endif() +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-deprecated-declarations -Wno-delete-abstract-non-virtual-dtor -Wno-deprecated-copy") +endif() + include_directories( ../custom-opm-flowdiagnostics/opm-flowdiagnostics opm-flowdiagnostics-applications From ffc77516e86187c2de44561b25aa38f03ef42d3d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 28 Jan 2022 13:18:46 +0100 Subject: [PATCH 092/406] Summary Import : Support cases with one file per time step (#8493) --- .../Application/RiaEclipseFileNameTools.cpp | 48 ------------------- .../Application/RiaEclipseFileNameTools.h | 5 -- .../Summary/RimSummaryCaseMainCollection.cpp | 8 ++-- .../Python/rips/tests/test_summary_cases.py | 17 ------- 4 files changed, 3 insertions(+), 75 deletions(-) diff --git a/ApplicationLibCode/Application/RiaEclipseFileNameTools.cpp b/ApplicationLibCode/Application/RiaEclipseFileNameTools.cpp index c2fcb91d61..048e9774f9 100644 --- a/ApplicationLibCode/Application/RiaEclipseFileNameTools.cpp +++ b/ApplicationLibCode/Application/RiaEclipseFileNameTools.cpp @@ -77,54 +77,6 @@ QString RiaEclipseFileNameTools::findRelatedDataFile() return relatedFilePath( EclipseFileType::ECLIPSE_DATA ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RiaEclipseFileNameTools::isProjectFile( const QString& fileName ) -{ - return hasMatchingSuffix( fileName, EclipseFileType::RESINSIGHT_PROJECT ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RiaEclipseFileNameTools::isGridFile( const QString& fileName ) -{ - if ( hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_EGRID ) ) - { - return true; - } - - return hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_GRID ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RiaEclipseFileNameTools::isSummarySpecFile( const QString& fileName ) -{ - return hasMatchingSuffix( fileName, EclipseFileType::ECLIPSE_SMSPEC ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RiaEclipseFileNameTools::isSummaryDataFilePresent( const QString& smspecFileName ) -{ - QFileInfo fi( smspecFileName ); - { - QString candidateFileName = fi.absolutePath() + '/' + fi.baseName() + ".UNSMRY"; - if ( QFile::exists( candidateFileName ) ) return true; - } - - { - QString candidateFileName = fi.absolutePath() + '/' + fi.baseName() + ".FUNSMRY"; - if ( QFile::exists( candidateFileName ) ) return true; - } - - return false; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaEclipseFileNameTools.h b/ApplicationLibCode/Application/RiaEclipseFileNameTools.h index 17f8faaa62..745a3d3ad0 100644 --- a/ApplicationLibCode/Application/RiaEclipseFileNameTools.h +++ b/ApplicationLibCode/Application/RiaEclipseFileNameTools.h @@ -49,11 +49,6 @@ class RiaEclipseFileNameTools QString findRelatedSummarySpecFile(); QString findRelatedDataFile(); - static bool isProjectFile( const QString& fileName ); - static bool isGridFile( const QString& fileName ); - static bool isSummarySpecFile( const QString& fileName ); - static bool isSummaryDataFilePresent( const QString& smspecFileName ); - private: QString relatedFilePath( EclipseFileType fileType ) const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index dd13a74e2a..3464a09cc8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -635,14 +635,12 @@ std::vector RimSummaryCaseMainCollection::createSummaryCasesFro { const QString& smspecFileName = fileInfo.summaryFileName(); - bool isEsmryFile = smspecFileName.endsWith( "ESMRY" ); - bool foundDataFile = RiaEclipseFileNameTools::isSummaryDataFilePresent( smspecFileName ); - if ( foundDataFile || isEsmryFile ) + if ( !smspecFileName.isEmpty() ) { - RimFileSummaryCase* newSumCase = new RimFileSummaryCase(); + auto newSumCase = new RimFileSummaryCase(); newSumCase->setIncludeRestartFiles( fileInfo.includeRestartFiles() ); - newSumCase->setSummaryHeaderFileName( fileInfo.summaryFileName() ); + newSumCase->setSummaryHeaderFileName( smspecFileName ); newSumCase->updateOptionSensitivity(); project->assignCaseIdToSummaryCase( newSumCase ); newSumCase->refreshMetaData(); diff --git a/GrpcInterface/Python/rips/tests/test_summary_cases.py b/GrpcInterface/Python/rips/tests/test_summary_cases.py index 2537db245f..de988d5abd 100644 --- a/GrpcInterface/Python/rips/tests/test_summary_cases.py +++ b/GrpcInterface/Python/rips/tests/test_summary_cases.py @@ -93,23 +93,6 @@ def cleanup(): yield dirpath -# This test ensures that missing unsmry file is handeled gracefully -def test_summary_no_unsmry(rips_instance, initialize_test): - casePathRelative = dataroot.PATH + "/flow_diagnostics_test/SIMPLE_SUMMARY2.SMSPEC" - - # create an absolute path, as the helper functions used to create a temporary folder does not work - # with the relative (..\..\) part of the file path - casePath = os.path.abspath(casePathRelative) - - with tempdir() as dirpath: - base_path = os.path.basename(casePath) - temp_path = os.path.join(dirpath, base_path) - shutil.copy2(casePath, temp_path) - - summary_case = rips_instance.project.import_summary_case(temp_path) - assert summary_case is None - - def test_summary_set_values(rips_instance, initialize_test): casePath = dataroot.PATH + "/flow_diagnostics_test/SIMPLE_SUMMARY2.SMSPEC" summary_case = rips_instance.project.import_summary_case(casePath) From 66fd79175c67c6c9a0d4d43feb243ae765c4e880 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Fri, 28 Jan 2022 13:19:52 +0100 Subject: [PATCH 093/406] Project Tree updates (#8490) Split project tree into multiple dockable tree views for plots, keeping one for 3d views. --- ApplicationLibCode/Application/RiaDefines.cpp | 8 ++ ApplicationLibCode/Application/RiaDefines.h | 2 + .../Application/RiaGuiApplication.cpp | 62 ++++---- .../RicMoveItemsToTopFeature.cpp | 11 +- .../RicToggleItemsFeatureImpl.cpp | 27 ++-- .../ProjectDataModel/RimProject.cpp | 109 +++++++------- .../ProjectDataModel/RimProject.h | 8 +- .../UserInterface/RiuDockWidgetTools.cpp | 20 ++- .../UserInterface/RiuDockWidgetTools.h | 5 +- .../UserInterface/RiuDragDrop.cpp | 11 +- .../UserInterface/RiuDragDrop.h | 6 +- .../UserInterface/RiuMainWindow.cpp | 83 +++++------ .../UserInterface/RiuMainWindow.h | 3 - .../UserInterface/RiuMainWindowBase.cpp | 113 +++++++++++++-- .../UserInterface/RiuMainWindowBase.h | 21 ++- .../UserInterface/RiuMainWindowTools.cpp | 58 ++++---- .../UserInterface/RiuPlotMainWindow.cpp | 135 ++++++++++-------- .../UserInterface/RiuPlotMainWindow.h | 8 +- .../UserInterface/RiuProjectPropertyView.cpp | 2 +- .../UserInterface/RiuTreeViewEventFilter.cpp | 12 +- .../UserInterface/RiuTreeViewEventFilter.h | 8 +- .../UserInterface/RiuViewerCommands.cpp | 2 +- .../cafUserInterface/cafPdmUiTreeView.cpp | 9 ++ .../cafUserInterface/cafPdmUiTreeView.h | 6 +- .../cafPdmUiTreeViewEditor.cpp | 3 +- ResInsightVersion.cmake | 2 +- 26 files changed, 433 insertions(+), 301 deletions(-) diff --git a/ApplicationLibCode/Application/RiaDefines.cpp b/ApplicationLibCode/Application/RiaDefines.cpp index 30641e323a..14b776c50a 100644 --- a/ApplicationLibCode/Application/RiaDefines.cpp +++ b/ApplicationLibCode/Application/RiaDefines.cpp @@ -314,3 +314,11 @@ bool RiaDefines::isInjector( WellProductionType wellProductionType ) return false; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::stringListSeparator() +{ + return "|"; +} diff --git a/ApplicationLibCode/Application/RiaDefines.h b/ApplicationLibCode/Application/RiaDefines.h index a32beee91a..6bf6a1e3a9 100644 --- a/ApplicationLibCode/Application/RiaDefines.h +++ b/ApplicationLibCode/Application/RiaDefines.h @@ -185,4 +185,6 @@ enum class WellProductionType : short bool isInjector( WellProductionType wellProductionType ); +QString stringListSeparator(); + }; // namespace RiaDefines diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index c9d3aa0359..5df1652551 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -22,6 +22,7 @@ #include "RiaArgumentParser.h" #include "RiaBaseDefs.h" +#include "RiaDefines.h" #include "RiaFilePathTools.h" #include "RiaFontCache.h" #include "RiaImportEclipseCaseTools.h" @@ -294,39 +295,46 @@ bool RiaGuiApplication::saveProjectAs( const QString& fileName ) //-------------------------------------------------------------------------------------------------- void RiaGuiApplication::storeTreeViewState() { + if ( m_mainWindow ) { - if ( mainPlotWindow() && mainPlotWindow()->projectTreeView() ) - { - caf::PdmUiTreeView* projectTreeView = mainPlotWindow()->projectTreeView(); + QStringList treeStates; + QStringList treeIndexes; + for ( auto& tv : mainWindow()->projectTreeViews() ) + { QString treeViewState; - caf::QTreeViewStateSerializer::storeTreeViewStateToString( projectTreeView->treeView(), treeViewState ); + caf::QTreeViewStateSerializer::storeTreeViewStateToString( tv->treeView(), treeViewState ); + treeStates.append( treeViewState ); - QModelIndex mi = projectTreeView->treeView()->currentIndex(); - - QString encodedModelIndexString; + QModelIndex mi = tv->treeView()->currentIndex(); + QString encodedModelIndexString; caf::QTreeViewStateSerializer::encodeStringFromModelIndex( mi, encodedModelIndexString ); - - project()->plotWindowTreeViewState = treeViewState; - project()->plotWindowCurrentModelIndexPath = encodedModelIndexString; + treeIndexes.append( encodedModelIndexString ); } + + project()->mainWindowTreeViewStates = treeStates.join( RiaDefines::stringListSeparator() ); + project()->mainWindowCurrentModelIndexPaths = treeIndexes.join( RiaDefines::stringListSeparator() ); } + if ( m_mainPlotWindow ) { - caf::PdmUiTreeView* projectTreeView = m_mainWindow->projectTreeView(); - if ( projectTreeView ) + QStringList treeStates; + QStringList treeIndexes; + + for ( auto& tv : mainPlotWindow()->projectTreeViews() ) { QString treeViewState; - caf::QTreeViewStateSerializer::storeTreeViewStateToString( projectTreeView->treeView(), treeViewState ); - - QModelIndex mi = projectTreeView->treeView()->currentIndex(); + caf::QTreeViewStateSerializer::storeTreeViewStateToString( tv->treeView(), treeViewState ); + treeStates.append( treeViewState ); - QString encodedModelIndexString; + QModelIndex mi = tv->treeView()->currentIndex(); + QString encodedModelIndexString; caf::QTreeViewStateSerializer::encodeStringFromModelIndex( mi, encodedModelIndexString ); - - project()->mainWindowTreeViewState = treeViewState; - project()->mainWindowCurrentModelIndexPath = encodedModelIndexString; + treeIndexes.append( encodedModelIndexString ); } + + project()->plotWindowTreeViewStates = treeStates.join( RiaDefines::stringListSeparator() ); + project()->plotWindowCurrentModelIndexPaths = treeIndexes.join( RiaDefines::stringListSeparator() ); } } @@ -1380,13 +1388,19 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* caf::EffectGenerator::setRenderingMode( caf::EffectGenerator::FIXED_FUNCTION ); } - if ( m_mainWindow && m_mainWindow->projectTreeView() ) + if ( m_mainWindow ) { - m_mainWindow->projectTreeView()->enableAppendOfClassNameToUiItemText( - RiaPreferencesSystem::current()->appendClassNameToUiText() ); + for ( auto& tv : mainWindow()->projectTreeViews() ) + { + tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); + } if ( mainPlotWindow() ) - mainPlotWindow()->projectTreeView()->enableAppendOfClassNameToUiItemText( - RiaPreferencesSystem::current()->appendClassNameToUiText() ); + { + for ( auto& tv : mainPlotWindow()->projectTreeViews() ) + { + tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); + } + } } for ( auto fontObject : defaultFontObjects ) diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicMoveItemsToTopFeature.cpp b/ApplicationLibCode/Commands/ToggleCommands/RicMoveItemsToTopFeature.cpp index 50f73fc464..d9d11e4549 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicMoveItemsToTopFeature.cpp +++ b/ApplicationLibCode/Commands/ToggleCommands/RicMoveItemsToTopFeature.cpp @@ -31,6 +31,7 @@ #include "cafSelectionManager.h" #include +#include CAF_CMD_SOURCE_INIT( RicMoveItemsToTopFeature, "RicMoveItemsToTopFeature" ); @@ -113,17 +114,17 @@ void RicMoveItemsToTopFeature::onActionTriggered( bool isChecked ) constSelectedItems.push_back( s ); } - caf::PdmUiTreeView* uiTreeView = RiaGuiApplication::activeMainWindow()->projectTreeView(); - if ( !constSelectedItems.empty() ) { + caf::PdmUiTreeView* uiTreeView = + RiaGuiApplication::activeMainWindow()->getTreeViewWithItem( constSelectedItems[0] ); QModelIndex itemIndex = uiTreeView->findModelIndex( constSelectedItems[0] ); QModelIndex parentIndex = itemIndex.parent(); uiTreeView->updateSubTree( parentIndex ); - } - // Restore selection highlight after reordering - uiTreeView->selectItems( constSelectedItems ); + // Restore selection highlight after reordering + uiTreeView->selectItems( constSelectedItems ); + } } } } diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp index bf65b0f534..8424b6c79b 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp @@ -158,31 +158,24 @@ void RicToggleItemsFeatureImpl::setObjectToggleStateForSelection( SelectionToggl //-------------------------------------------------------------------------------------------------- caf::PdmUiTreeView* RicToggleItemsFeatureImpl::findTreeView( const caf::PdmUiItem* uiItem ) { - { - RiaFeatureCommandContext* context = RiaFeatureCommandContext::instance(); - - caf::PdmUiTreeView* customActiveTreeView = dynamic_cast( context->object() ); - if ( customActiveTreeView ) - { - return customActiveTreeView; - } - } + RiaFeatureCommandContext* context = RiaFeatureCommandContext::instance(); + caf::PdmUiTreeView* customActiveTreeView = dynamic_cast( context->object() ); + if ( customActiveTreeView ) { - QModelIndex modIndex = RiuMainWindow::instance()->projectTreeView()->findModelIndex( uiItem ); - if ( modIndex.isValid() ) - { - return RiuMainWindow::instance()->projectTreeView(); - } + return customActiveTreeView; } + caf::PdmUiTreeView* activeTree = RiuMainWindow::instance()->getTreeViewWithItem( uiItem ); + if ( activeTree ) return activeTree; + RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); if ( mainPlotWindow ) { - QModelIndex modIndex = mainPlotWindow->projectTreeView()->findModelIndex( uiItem ); - if ( modIndex.isValid() ) + activeTree = mainPlotWindow->getTreeViewWithItem( uiItem ); + if ( activeTree ) { - return mainPlotWindow->projectTreeView(); + return activeTree; } } diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 00a1eee3aa..c38ab0dc05 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -167,19 +167,18 @@ RimProject::RimProject( void ) calculationCollection = new RimSummaryCalculationCollection; CAF_PDM_InitFieldNoDefault( &commandObjects, "CommandObjects", "Command Objects" ); - // wellPathImport.uiCapability()->setUiHidden(true); CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions" ); - CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewState, "TreeViewState", "" ); - mainWindowTreeViewState.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &mainWindowCurrentModelIndexPath, "TreeViewCurrentModelIndexPath", "" ); - mainWindowCurrentModelIndexPath.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &mainWindowTreeViewStates, "TreeViewStates", "" ); + mainWindowTreeViewStates.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &mainWindowCurrentModelIndexPaths, "TreeViewCurrentModelIndexPaths", "" ); + mainWindowCurrentModelIndexPaths.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &plotWindowTreeViewState, "PlotWindowTreeViewState", "" ); - plotWindowTreeViewState.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &plotWindowCurrentModelIndexPath, "PlotWindowTreeViewCurrentModelIndexPath", "" ); - plotWindowCurrentModelIndexPath.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &plotWindowTreeViewStates, "PlotWindowTreeViewStates", "" ); + plotWindowTreeViewStates.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &plotWindowCurrentModelIndexPaths, "PlotWindowTreeViewCurrentModelIndexPaths", "" ); + plotWindowCurrentModelIndexPaths.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &m_show3DWindow, "show3DWindow", true, "Show 3D Window" ); m_show3DWindow.uiCapability()->setUiHidden( true ); @@ -271,10 +270,10 @@ void RimProject::close() fileName = ""; - mainWindowCurrentModelIndexPath = ""; - mainWindowTreeViewState = ""; - plotWindowCurrentModelIndexPath = ""; - plotWindowTreeViewState = ""; + mainWindowCurrentModelIndexPaths = ""; + mainWindowTreeViewStates = ""; + plotWindowCurrentModelIndexPaths = ""; + plotWindowTreeViewStates = ""; m_nextValidCaseId = 0; m_nextValidCaseGroupId = 0; @@ -308,7 +307,6 @@ void RimProject::initAfterRead() if ( analysisModels ) { analysisModels->caseGroups.push_back( sourceCaseGroup ); - // printf("Moved m_project->caseGroupsObsolete[%i] to first oil fields analysis models\n", cgIdx); movedOneRimIdenticalGridCaseGroup = true; // moved at least one so assume the others will be moved too... } } @@ -326,7 +324,6 @@ void RimProject::initAfterRead() RimEclipseCase* sourceCase = casesObsolete[cIdx]; casesObsolete.set( cIdx, nullptr ); analysisModels->cases.push_back( sourceCase ); - // printf("Moved m_project->casesObsolete[%i] to first oil fields analysis models\n", cIdx); movedOneRimCase = true; // moved at least one so assume the others will be moved too... } } @@ -336,13 +333,6 @@ void RimProject::initAfterRead() casesObsolete.clear(); } - if ( casesObsolete().size() > 0 || caseGroupsObsolete.size() > 0 ) - { - // printf("RimProject::initAfterRead: Was not able to move all cases (%i left) or caseGroups (%i left) from - // Project to analysisModels", - // casesObsolete().size(), caseGroupsObsolete.size()); - } - // Set project pointer to each well path for ( size_t oilFieldIdx = 0; oilFieldIdx < oilFields().size(); oilFieldIdx++ ) { @@ -1387,101 +1377,79 @@ void RimProject::reloadCompletionTypeResultsForEclipseCase( RimEclipseCase* ecli //-------------------------------------------------------------------------------------------------- void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) { - if ( uiConfigName == "PlotWindow" ) + if ( uiConfigName == "PlotWindow.Plots" ) { - { - auto itemCollection = uiTreeOrdering.add( "Data Sources", ":/Folder.png" ); - - RimOilField* oilField = activeOilField(); - if ( oilField ) - { - if ( oilField->summaryCaseMainCollection() ) - { - itemCollection->add( oilField->summaryCaseMainCollection() ); - } - if ( oilField->observedDataCollection() ) - { - itemCollection->add( oilField->observedDataCollection() ); - } - if ( oilField->ensembleWellLogsCollection() ) - { - itemCollection->add( oilField->ensembleWellLogsCollection() ); - } - } - } - if ( mainPlotCollection ) { - auto itemCollection = uiTreeOrdering.add( "Plots", ":/Folder.png" ); if ( mainPlotCollection->summaryPlotCollection() ) { - itemCollection->add( mainPlotCollection->summaryPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->summaryPlotCollection() ); } if ( mainPlotCollection->analysisPlotCollection() ) { - itemCollection->add( mainPlotCollection->analysisPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->analysisPlotCollection() ); } if ( mainPlotCollection->correlationPlotCollection() ) { - itemCollection->add( mainPlotCollection->correlationPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->correlationPlotCollection() ); } if ( mainPlotCollection->summaryCrossPlotCollection() ) { - itemCollection->add( mainPlotCollection->summaryCrossPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->summaryCrossPlotCollection() ); } if ( mainPlotCollection->wellLogPlotCollection() ) { - itemCollection->add( mainPlotCollection->wellLogPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->wellLogPlotCollection() ); } if ( mainPlotCollection->rftPlotCollection() ) { - itemCollection->add( mainPlotCollection->rftPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->rftPlotCollection() ); } if ( mainPlotCollection->pltPlotCollection() ) { - itemCollection->add( mainPlotCollection->pltPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->pltPlotCollection() ); } if ( mainPlotCollection->flowPlotCollection() ) { - itemCollection->add( mainPlotCollection->flowPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->flowPlotCollection() ); } if ( mainPlotCollection->gridCrossPlotCollection() ) { - itemCollection->add( mainPlotCollection->gridCrossPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->gridCrossPlotCollection() ); } if ( mainPlotCollection->saturationPressurePlotCollection() ) { - itemCollection->add( mainPlotCollection->saturationPressurePlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->saturationPressurePlotCollection() ); } if ( mainPlotCollection->multiPlotCollection() ) { - itemCollection->add( mainPlotCollection->multiPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->multiPlotCollection() ); } if ( mainPlotCollection->stimPlanModelPlotCollection() ) { - itemCollection->add( mainPlotCollection->stimPlanModelPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->stimPlanModelPlotCollection() ); } if ( mainPlotCollection->vfpPlotCollection() ) { - itemCollection->add( mainPlotCollection->vfpPlotCollection() ); + uiTreeOrdering.add( mainPlotCollection->vfpPlotCollection() ); } #ifdef USE_QTCHARTS if ( mainPlotCollection->gridStatisticsPlotCollection() || mainPlotCollection->ensembleFractureStatisticsPlotCollection() ) { - auto statisticsItemCollection = itemCollection->add( "Statistics Plots", ":/Folder.png" ); + auto statisticsItemCollection = uiTreeOrdering.add( "Statistics Plots", ":/Folder.png" ); if ( mainPlotCollection->gridStatisticsPlotCollection() ) statisticsItemCollection->add( mainPlotCollection->gridStatisticsPlotCollection() ); @@ -1490,7 +1458,28 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q } #endif } - + } + else if ( uiConfigName == "PlotWindow.DataSources" ) + { + RimOilField* oilField = activeOilField(); + if ( oilField ) + { + if ( oilField->summaryCaseMainCollection() ) + { + uiTreeOrdering.add( oilField->summaryCaseMainCollection() ); + } + if ( oilField->observedDataCollection() ) + { + uiTreeOrdering.add( oilField->observedDataCollection() ); + } + if ( oilField->ensembleWellLogsCollection() ) + { + uiTreeOrdering.add( oilField->ensembleWellLogsCollection() ); + } + } + } + else if ( uiConfigName == "PlotWindow.Scripts" ) + { uiTreeOrdering.add( scriptCollection() ); } else diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index dff2e37f00..8198b062d7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -103,11 +103,11 @@ class RimProject : public caf::PdmDocument caf::PdmChildArrayField multiSnapshotDefinitions; - caf::PdmField mainWindowTreeViewState; - caf::PdmField mainWindowCurrentModelIndexPath; + caf::PdmField mainWindowTreeViewStates; + caf::PdmField mainWindowCurrentModelIndexPaths; - caf::PdmField plotWindowTreeViewState; - caf::PdmField plotWindowCurrentModelIndexPath; + caf::PdmField plotWindowTreeViewStates; + caf::PdmField plotWindowCurrentModelIndexPaths; bool writeProjectFile(); diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index f53a356257..bc8eb32451 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -111,9 +111,25 @@ QString RiuDockWidgetTools::summaryPlotManagerName() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiuDockWidgetTools::plotMainWindowProjectTreeName() +QString RiuDockWidgetTools::plotMainWindowDataSourceTreeName() { - return "plotMainWindow_dockProjectTree"; + return "plotMainWindow_dockDataSourceTree"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::plotMainWindowPlotsTreeName() +{ + return "plotMainWindow_dockPlotsTree"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::plotMainWindowScriptsTreeName() +{ + return "plotMainWindow_dockScriptsTree"; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index b7a58c1084..196014e0ab 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -48,7 +48,10 @@ class RiuDockWidgetTools static QString undoStackName(); static QString summaryPlotManagerName(); - static QString plotMainWindowProjectTreeName(); + static QString plotMainWindowDataSourceTreeName(); + static QString plotMainWindowPlotsTreeName(); + static QString plotMainWindowScriptsTreeName(); + static QString plotMainWindowPropertyEditorName(); static QString plotMainWindowMessagesName(); static QString plotMainWindowUndoStackName(); diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index b45e31d6b1..e5c00d5faa 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -172,9 +172,10 @@ class RiuTypedPdmObjects //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuDragDrop::RiuDragDrop() +RiuDragDrop::RiuDragDrop( caf::PdmUiTreeView* treeView ) + : m_projectTreeView( treeView ) + , m_proposedDropAction( Qt::MoveAction ) { - m_proposedDropAction = Qt::MoveAction; } //-------------------------------------------------------------------------------------------------- @@ -237,8 +238,7 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const if ( index.isValid() && RiaGuiApplication::activeMainWindow() ) { - caf::PdmUiTreeView* uiTreeView = RiaGuiApplication::activeMainWindow()->projectTreeView(); - caf::PdmUiItem* uiItem = uiTreeView->uiItemFromModelIndex( index ); + caf::PdmUiItem* uiItem = m_projectTreeView->uiItemFromModelIndex( index ); caf::PdmObject* pdmObj = dynamic_cast( uiItem ); if ( pdmObj ) @@ -361,7 +361,8 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& dropTargetIndex ) { CVF_ASSERT( RiaGuiApplication::activeMainWindow() ); - caf::PdmUiTreeView* uiTreeView = RiaGuiApplication::activeMainWindow()->projectTreeView(); + + caf::PdmUiTreeView* uiTreeView = m_projectTreeView; caf::PdmUiItem* dropTargetUiItem = uiTreeView->uiItemFromModelIndex( dropTargetIndex ); caf::PdmObjectHandle* dropTarget = dynamic_cast( dropTargetUiItem ); diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.h b/ApplicationLibCode/UserInterface/RiuDragDrop.h index 1da8781272..36a7dd980a 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.h +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.h @@ -47,7 +47,7 @@ class RimWellLogCurve; class RiuDragDrop : public caf::PdmUiDragDropInterface { public: - RiuDragDrop(); + RiuDragDrop( caf::PdmUiTreeView* treeView ); ~RiuDragDrop() override; static std::vector draggedObjectsFromTreeView( caf::PdmUiTreeView* dragSource, @@ -107,5 +107,7 @@ class RiuDragDrop : public caf::PdmUiDragDropInterface private: mutable std::vector> m_dragItems; - Qt::DropAction m_proposedDropAction; + + Qt::DropAction m_proposedDropAction; + caf::PdmUiTreeView* m_projectTreeView; }; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 6fff52198d..b79b966276 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -48,7 +48,6 @@ #include "RimViewWindow.h" #include "RiuDockWidgetTools.h" -#include "RiuDragDrop.h" #include "RiuMdiSubWindow.h" #include "RiuMessagePanel.h" #include "RiuMohrsCirclePlot.h" @@ -70,7 +69,6 @@ #include "cafPdmUiPropertyView.h" #include "cafPdmUiPropertyViewDialog.h" #include "cafPdmUiTreeView.h" -#include "cafQTreeViewStateSerializer.h" #include "cafSelectionManager.h" #include "cafUtils.h" @@ -132,8 +130,6 @@ RiuMainWindow::RiuMainWindow() createToolBars(); createDockPanels(); - m_dragDropInterface = std::unique_ptr( new RiuDragDrop() ); - if ( m_undoView ) { m_undoView->setStack( caf::CmdExecCommandManager::instance()->undoStack() ); @@ -710,36 +706,40 @@ void RiuMainWindow::createToolBars() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::createDockPanels() { + const int nTreeViews = 1; + + createTreeViews( nTreeViews ); + { QDockWidget* dockWidget = new QDockWidget( "Project Tree", this ); dockWidget->setObjectName( RiuDockWidgetTools::projectTreeName() ); dockWidget->setAllowedAreas( Qt::AllDockWidgetAreas ); - m_projectTreeView = new caf::PdmUiTreeView( this ); - m_projectTreeView->enableSelectionManagerUpdating( true ); + caf::PdmUiTreeView* projectTree = projectTreeView( 0 ); + projectTree->enableSelectionManagerUpdating( true ); - m_projectTreeView->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); + projectTree->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); - dockWidget->setWidget( m_projectTreeView ); + dockWidget->setWidget( projectTree ); - m_projectTreeView->treeView()->setHeaderHidden( true ); - m_projectTreeView->treeView()->setSelectionMode( QAbstractItemView::ExtendedSelection ); + projectTree->treeView()->setHeaderHidden( true ); + projectTree->treeView()->setSelectionMode( QAbstractItemView::ExtendedSelection ); // Drag and drop configuration - m_projectTreeView->treeView()->setDragEnabled( true ); - m_projectTreeView->treeView()->viewport()->setAcceptDrops( true ); - m_projectTreeView->treeView()->setDropIndicatorShown( true ); - m_projectTreeView->treeView()->setDragDropMode( QAbstractItemView::DragDrop ); + projectTree->treeView()->setDragEnabled( true ); + projectTree->treeView()->viewport()->setAcceptDrops( true ); + projectTree->treeView()->setDropIndicatorShown( true ); + projectTree->treeView()->setDragDropMode( QAbstractItemView::DragDrop ); // Install event filter used to handle key press events - RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this ); - m_projectTreeView->treeView()->installEventFilter( treeViewEventFilter ); + RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this, projectTree ); + projectTree->treeView()->installEventFilter( treeViewEventFilter ); addDockWidget( Qt::LeftDockWidgetArea, dockWidget ); - connect( m_projectTreeView, SIGNAL( selectionChanged() ), this, SLOT( selectedObjectsChanged() ) ); - m_projectTreeView->treeView()->setContextMenuPolicy( Qt::CustomContextMenu ); - connect( m_projectTreeView->treeView(), + connect( projectTree, SIGNAL( selectionChanged() ), this, SLOT( selectedObjectsChanged() ) ); + projectTree->treeView()->setContextMenuPolicy( Qt::CustomContextMenu ); + connect( projectTree->treeView(), SIGNAL( customContextMenuRequested( const QPoint& ) ), SLOT( customMenuRequested( const QPoint& ) ) ); } @@ -1173,9 +1173,10 @@ void RiuMainWindow::setPdmRoot( caf::PdmObject* pdmRoot ) { m_pdmRoot = pdmRoot; - m_projectTreeView->setPdmItem( pdmRoot ); - // For debug only : m_projectTreeView->treeView()->expandAll(); - m_projectTreeView->setDragDropInterface( m_dragDropInterface.get() ); + for ( auto tv : projectTreeViews() ) + { + tv->setPdmItem( pdmRoot ); + } for ( auto& additionalProjectView : m_additionalProjectViews ) { @@ -1301,15 +1302,15 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim if ( is3dViewCurrentlySelected && ( previousActiveReservoirView != activatedView ) ) { - QModelIndex newViewModelIndex = m_projectTreeView->findModelIndex( activatedView ); + QModelIndex newViewModelIndex = projectTreeView( 0 )->findModelIndex( activatedView ); QModelIndex newSelectionIndex = newViewModelIndex; if ( previousActiveReservoirView && is3dViewCurrentlySelected ) { // Try to select the same entry in the new View, as was selected in the previous - QModelIndex previousViewModelIndex = m_projectTreeView->findModelIndex( previousActiveReservoirView ); - QModelIndex currentSelectionIndex = m_projectTreeView->treeView()->selectionModel()->currentIndex(); + QModelIndex previousViewModelIndex = projectTreeView( 0 )->findModelIndex( previousActiveReservoirView ); + QModelIndex currentSelectionIndex = projectTreeView( 0 )->treeView()->selectionModel()->currentIndex(); if ( currentSelectionIndex != newViewModelIndex && currentSelectionIndex.isValid() ) { @@ -1333,7 +1334,7 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim if ( newSelectionIndex.isValid() ) { newSelectionIndex = - m_projectTreeView->treeView()->model()->index( tmp.row(), tmp.column(), newSelectionIndex ); + projectTreeView( 0 )->treeView()->model()->index( tmp.row(), tmp.column(), newSelectionIndex ); } } @@ -1345,10 +1346,10 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim } } - m_projectTreeView->treeView()->setCurrentIndex( newSelectionIndex ); + projectTreeView( 0 )->treeView()->setCurrentIndex( newSelectionIndex ); if ( newSelectionIndex != newViewModelIndex ) { - m_projectTreeView->treeView()->setExpanded( newViewModelIndex, true ); + projectTreeView( 0 )->treeView()->setExpanded( newViewModelIndex, true ); } } } @@ -1441,7 +1442,7 @@ void RiuMainWindow::slotBuildWindowActions() void RiuMainWindow::selectedObjectsChanged() { std::vector uiItems; - m_projectTreeView->selectedUiItems( uiItems ); + projectTreeView( 0 )->selectedUiItems( uiItems ); caf::PdmObjectHandle* firstSelectedObject = nullptr; if ( !uiItems.empty() ) @@ -1499,7 +1500,7 @@ void RiuMainWindow::selectedObjectsChanged() // The only way to get to this code is by selection change initiated from the project tree view // As we are activating an MDI-window, the focus is given to this MDI-window // Set focus back to the tree view to be able to continue keyboard tree view navigation - m_projectTreeView->treeView()->setFocus(); + projectTreeView( 0 )->treeView()->setFocus(); } } } @@ -1687,24 +1688,8 @@ void RiuMainWindow::slotToggleLightingAction( bool enable ) //-------------------------------------------------------------------------------------------------- void RiuMainWindow::restoreTreeViewState() { - if ( m_projectTreeView ) - { - QString stateString = RimProject::current()->mainWindowTreeViewState; - if ( !stateString.isEmpty() ) - { - m_projectTreeView->treeView()->collapseAll(); - caf::QTreeViewStateSerializer::applyTreeViewStateFromString( m_projectTreeView->treeView(), stateString ); - } - - QString currentIndexString = RimProject::current()->mainWindowCurrentModelIndexPath; - if ( !currentIndexString.isEmpty() ) - { - QModelIndex mi = - caf::QTreeViewStateSerializer::getModelIndexFromString( m_projectTreeView->treeView()->model(), - currentIndexString ); - m_projectTreeView->treeView()->setCurrentIndex( mi ); - } - } + restoreTreeViewStates( RimProject::current()->mainWindowTreeViewStates(), + RimProject::current()->mainWindowCurrentModelIndexPaths() ); } //-------------------------------------------------------------------------------------------------- @@ -1879,7 +1864,7 @@ void RiuMainWindow::slotCreateCommandObject() if ( !app->project() ) return; std::vector selectedUiItems; - m_projectTreeView->selectedUiItems( selectedUiItems ); + projectTreeView( 0 )->selectedUiItems( selectedUiItems ); caf::PdmObjectGroup selectedObjects; for ( auto* selectedUiItem : selectedUiItems ) diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index ca3ec7a1e7..a10c332832 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -24,7 +24,6 @@ #include "RiuMdiArea.h" #include "cafPdmObjectHandle.h" -#include "cafPdmUiDragDropInterface.h" #include #include @@ -247,8 +246,6 @@ private slots: void setPdmRoot( caf::PdmObject* pdmRoot ); private: - std::unique_ptr m_dragDropInterface; - caf::PdmObject* m_pdmRoot; caf::PdmUiPropertyView* m_pdmUiPropertyView; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index ed7e4aad1b..947e4ca483 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -19,25 +19,28 @@ #include "RiuMainWindowBase.h" #include "RiaApplication.h" +#include "RiaDefines.h" #include "RiaPreferences.h" #include "RiaVersionInfo.h" #include "RiuDockWidgetTools.h" +#include "RiuDragDrop.h" #include "RiuMdiSubWindow.h" #include "RimProject.h" #include "RimViewWindow.h" +#include "cafCmdFeatureManager.h" #include "cafPdmObject.h" #include "cafPdmUiTreeView.h" - -#include "cafCmdFeatureManager.h" +#include "cafQTreeViewStateSerializer.h" #include #include #include #include #include +#include #include #include @@ -45,8 +48,7 @@ /// //-------------------------------------------------------------------------------------------------- RiuMainWindowBase::RiuMainWindowBase() - : m_projectTreeView( nullptr ) - , m_allowActiveViewChangeFromSelection( true ) + : m_allowActiveViewChangeFromSelection( true ) , m_showFirstVisibleWindowMaximized( true ) , m_blockSubWindowActivation( false ) , m_blockSubWindowProjectTreeSelection( false ) @@ -238,7 +240,10 @@ QString RiuMainWindowBase::registryFolderName() void RiuMainWindowBase::selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange ) { m_allowActiveViewChangeFromSelection = allowActiveViewChange; - m_projectTreeView->selectAsCurrentItem( object ); + + auto tv = getTreeViewWithItem( object ); + if ( tv ) tv->selectAsCurrentItem( object ); + m_allowActiveViewChangeFromSelection = true; } @@ -247,11 +252,15 @@ void RiuMainWindowBase::selectAsCurrentItem( const caf::PdmObject* object, bool //-------------------------------------------------------------------------------------------------- void RiuMainWindowBase::toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange ) { + auto tv = getTreeViewWithItem( object ); + if ( !tv ) return; + m_allowActiveViewChangeFromSelection = allowActiveViewChange; std::vector currentSelection; - m_projectTreeView->selectedUiItems( currentSelection ); + tv->selectedUiItems( currentSelection ); std::vector updatedSelection; - bool alreadySelected = false; + + bool alreadySelected = false; for ( caf::PdmUiItem* uiItem : currentSelection ) { if ( object == uiItem ) @@ -267,7 +276,7 @@ void RiuMainWindowBase::toggleItemInSelection( const caf::PdmObject* object, boo { updatedSelection.push_back( object ); } - m_projectTreeView->selectItems( updatedSelection ); + tv->selectItems( updatedSelection ); m_allowActiveViewChangeFromSelection = true; } @@ -364,7 +373,8 @@ void RiuMainWindowBase::removeViewerFromMdiArea( QMdiArea* mdiArea, QWidget* vie //-------------------------------------------------------------------------------------------------- void RiuMainWindowBase::setExpanded( const caf::PdmUiItem* uiItem, bool expanded ) { - m_projectTreeView->setExpanded( uiItem, expanded ); + caf::PdmUiTreeView* tv = getTreeViewWithItem( uiItem ); + if ( tv ) tv->setExpanded( uiItem, expanded ); } //-------------------------------------------------------------------------------------------------- @@ -470,3 +480,88 @@ void RiuMainWindowBase::slotRefreshUndoRedoActions() m_redoAction->setDisabled( !m_undoView->stack()->canRedo() ); m_undoAction->setDisabled( !m_undoView->stack()->canUndo() ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindowBase::createTreeViews( int numberOfTrees ) +{ + CVF_ASSERT( m_projectTreeViews.empty() ); + + for ( int i = 0; i < numberOfTrees; i++ ) + { + auto tv = new caf::PdmUiTreeView(); + caf::PdmUiDragDropInterface* dragDropInterface = new RiuDragDrop( tv ); + tv->setDragDropInterface( dragDropInterface ); + m_projectTreeViews.push_back( tv ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmUiTreeView* RiuMainWindowBase::projectTreeView( int treeId ) +{ + CVF_ASSERT( treeId >= 0 ); + CVF_ASSERT( treeId < (int)m_projectTreeViews.size() ); + + return m_projectTreeViews[treeId]; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmUiTreeView* RiuMainWindowBase::getTreeViewWithItem( const caf::PdmUiItem* uiItem ) +{ + for ( auto tv : m_projectTreeViews ) + { + QModelIndex qmi = tv->findModelIndex( uiItem ); + if ( qmi.isValid() ) + { + return tv; + } + } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiuMainWindowBase::projectTreeViews() +{ + return m_projectTreeViews; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindowBase::restoreTreeViewStates( QString treeStateString, QString treeIndexeString ) +{ + QStringList treeStates = treeStateString.split( RiaDefines::stringListSeparator() ); + QStringList treeIndexes = treeIndexeString.split( RiaDefines::stringListSeparator() ); + + const int nTreeViews = (int)projectTreeViews().size(); + + if ( treeStates.size() < nTreeViews ) return; + if ( treeIndexes.size() < nTreeViews ) return; + + for ( int treeId = 0; treeId < nTreeViews; treeId++ ) + { + auto tv = projectTreeView( treeId ); + + QString stateString = treeStates[treeId]; + if ( !stateString.isEmpty() ) + { + tv->treeView()->collapseAll(); + caf::QTreeViewStateSerializer::applyTreeViewStateFromString( tv->treeView(), stateString ); + } + + QString currentIndexString = treeIndexes[treeId]; + if ( !currentIndexString.isEmpty() ) + { + QModelIndex mi = + caf::QTreeViewStateSerializer::getModelIndexFromString( tv->treeView()->model(), currentIndexString ); + tv->treeView()->setCurrentIndex( mi ); + } + } +} diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 81f255a93c..f7a6739615 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -20,6 +20,11 @@ #include +#include "cafPdmUiDragDropInterface.h" + +#include +#include + class QMdiArea; struct RimMdiWindowGeometry; @@ -65,8 +70,11 @@ class RiuMainWindowBase : public QMainWindow void hideAllDockWidgets(); - caf::PdmUiTreeView* projectTreeView() { return m_projectTreeView; } - void setExpanded( const caf::PdmUiItem* uiItem, bool expanded = true ); + std::vector projectTreeViews(); + caf::PdmUiTreeView* projectTreeView( int treeId ); + caf::PdmUiTreeView* getTreeViewWithItem( const caf::PdmUiItem* item ); + + void setExpanded( const caf::PdmUiItem* uiItem, bool expanded = true ); void selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange = true ); void toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange = true ); @@ -85,12 +93,15 @@ class RiuMainWindowBase : public QMainWindow bool isBlockingViewSelectionOnSubWindowActivated() const; protected: + void createTreeViews( int numberOfTrees ); void removeViewerFromMdiArea( QMdiArea* mdiArea, QWidget* viewer ); void initializeSubWindow( QMdiArea* mdiArea, QMdiSubWindow* mdiSubWindow, const QPoint& subWindowPos, const QSize& subWindowSize ); + void restoreTreeViewStates( QString treeStateString, QString treeIndexString ); + protected slots: void slotDockWidgetToggleViewActionTriggered(); void slotRefreshHelpActions(); @@ -100,8 +111,7 @@ protected slots: void slotRefreshUndoRedoActions(); protected: - caf::PdmUiTreeView* m_projectTreeView; - bool m_allowActiveViewChangeFromSelection; // To be used in selectedObjectsChanged() to control + bool m_allowActiveViewChangeFromSelection; // To be used in selectedObjectsChanged() to control // whether to select the corresponding active view or not QAction* m_undoAction; @@ -112,6 +122,9 @@ protected slots: QString registryFolderName(); private: + std::vector m_projectTreeViews; + std::vector> m_dragDropInterfaces; + bool m_showFirstVisibleWindowMaximized; bool m_blockSubWindowActivation; bool m_blockSubWindowProjectTreeSelection; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp index b38549ebbb..3af557ab68 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp @@ -37,6 +37,7 @@ #include #include +#include //-------------------------------------------------------------------------------------------------- /// @@ -47,49 +48,38 @@ void RiuMainWindowTools::collapseSiblings( const caf::PdmUiItem* sourceUiItem ) if ( !RiaGuiApplication::isRunning() ) return; - { - caf::PdmUiTreeView* sourceTreeView = nullptr; - caf::PdmUiTreeOrdering* sourceTreeOrderingItem = nullptr; + caf::PdmUiTreeView* sourceTreeView = nullptr; + if ( RiuMainWindow::instance() ) + { + sourceTreeView = RiuMainWindow::instance()->getTreeViewWithItem( sourceUiItem ); + } + if ( !sourceTreeView ) + { + RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); + if ( mpw ) { - QModelIndex modIndex; + sourceTreeView = mpw->getTreeViewWithItem( sourceUiItem ); + } + } - if ( RiuMainWindow::instance() ) - { - modIndex = RiuMainWindow::instance()->projectTreeView()->findModelIndex( sourceUiItem ); - } + if ( !sourceTreeView ) return; - if ( modIndex.isValid() ) - { - sourceTreeView = RiuMainWindow::instance()->projectTreeView(); - } - else - { - RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); - if ( mpw ) - { - modIndex = mpw->projectTreeView()->findModelIndex( sourceUiItem ); - if ( modIndex.isValid() ) - { - sourceTreeView = mpw->projectTreeView(); - } - } - } + caf::PdmUiTreeOrdering* sourceTreeOrderingItem = nullptr; + QModelIndex modIndex = sourceTreeView->findModelIndex( sourceUiItem ); - if ( !modIndex.isValid() ) return; + if ( !modIndex.isValid() ) return; - sourceTreeOrderingItem = static_cast( modIndex.internalPointer() ); - } + sourceTreeOrderingItem = static_cast( modIndex.internalPointer() ); - if ( sourceTreeView && sourceTreeOrderingItem && sourceTreeOrderingItem->parent() ) + if ( sourceTreeOrderingItem && sourceTreeOrderingItem->parent() ) + { + for ( int i = 0; i < sourceTreeOrderingItem->parent()->childCount(); i++ ) { - for ( int i = 0; i < sourceTreeOrderingItem->parent()->childCount(); i++ ) + auto siblingTreeOrderingItem = sourceTreeOrderingItem->parent()->child( i ); + if ( siblingTreeOrderingItem != sourceTreeOrderingItem ) { - auto siblingTreeOrderingItem = sourceTreeOrderingItem->parent()->child( i ); - if ( siblingTreeOrderingItem != sourceTreeOrderingItem ) - { - sourceTreeView->setExpanded( siblingTreeOrderingItem->activeItem(), false ); - } + sourceTreeView->setExpanded( siblingTreeOrderingItem->activeItem(), false ); } } } diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index b142698224..72f8581c79 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -45,7 +45,6 @@ #include "SummaryPlotCommands/RicSummaryPlotEditorDialog.h" #include "RiuDockWidgetTools.h" -#include "RiuDragDrop.h" #include "RiuMdiSubWindow.h" #include "RiuMessagePanel.h" #include "RiuMultiPlotPage.h" @@ -59,7 +58,6 @@ #include "cafPdmUiPropertyView.h" #include "cafPdmUiToolBarEditor.h" #include "cafPdmUiTreeView.h" -#include "cafQTreeViewStateSerializer.h" #include "cafSelectionManager.h" #include @@ -90,8 +88,6 @@ RiuPlotMainWindow::RiuPlotMainWindow() // Store the layout so we can offer reset option m_initialDockAndToolbarLayout = saveState( 0 ); - m_dragDropInterface = std::unique_ptr( new RiuDragDrop() ); - if ( m_undoView ) { m_undoView->setStack( caf::CmdExecCommandManager::instance()->undoStack() ); @@ -455,40 +451,64 @@ void RiuPlotMainWindow::refreshToolbars() //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::createDockPanels() { + const int nTreeViews = 3; + const std::vector treeViewTitles = { "Plots", "Data Sources", "Scripts" }; + const std::vector treeViewConfigs = { "PlotWindow.Plots", "PlotWindow.DataSources", "PlotWindow.Scripts" }; + const std::vector treeViewDockNames = { RiuDockWidgetTools::plotMainWindowPlotsTreeName(), + RiuDockWidgetTools::plotMainWindowDataSourceTreeName(), + RiuDockWidgetTools::plotMainWindowScriptsTreeName() }; + + createTreeViews( nTreeViews ); + + QDockWidget* dockOntopOfWidget = nullptr; + + for ( int i = 0; i < nTreeViews; i++ ) { - QDockWidget* dockWidget = new QDockWidget( "Plot Project Tree", this ); - dockWidget->setObjectName( RiuDockWidgetTools::plotMainWindowProjectTreeName() ); + QDockWidget* dockWidget = new QDockWidget( treeViewTitles[i], this ); + dockWidget->setObjectName( treeViewDockNames[i] ); dockWidget->setAllowedAreas( Qt::AllDockWidgetAreas ); - m_projectTreeView = new caf::PdmUiTreeView( this ); - m_projectTreeView->enableSelectionManagerUpdating( true ); + caf::PdmUiTreeView* projectTree = projectTreeView( i ); + projectTree->enableSelectionManagerUpdating( true ); - m_projectTreeView->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); + projectTree->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); - dockWidget->setWidget( m_projectTreeView ); + dockWidget->setWidget( projectTree ); - m_projectTreeView->treeView()->setHeaderHidden( true ); - m_projectTreeView->treeView()->setSelectionMode( QAbstractItemView::ExtendedSelection ); + projectTree->treeView()->setHeaderHidden( true ); + projectTree->treeView()->setSelectionMode( QAbstractItemView::ExtendedSelection ); // Drag and drop configuration - m_projectTreeView->treeView()->setDragEnabled( true ); - m_projectTreeView->treeView()->viewport()->setAcceptDrops( true ); - m_projectTreeView->treeView()->setDropIndicatorShown( true ); - m_projectTreeView->treeView()->setDragDropMode( QAbstractItemView::DragDrop ); + projectTree->treeView()->setDragEnabled( true ); + projectTree->treeView()->viewport()->setAcceptDrops( true ); + projectTree->treeView()->setDropIndicatorShown( true ); + projectTree->treeView()->setDragDropMode( QAbstractItemView::DragDrop ); // Install event filter used to handle key press events - RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this ); - m_projectTreeView->treeView()->installEventFilter( treeViewEventFilter ); + RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this, projectTree ); + projectTree->treeView()->installEventFilter( treeViewEventFilter ); addDockWidget( Qt::LeftDockWidgetArea, dockWidget ); - connect( m_projectTreeView, SIGNAL( selectionChanged() ), this, SLOT( selectedObjectsChanged() ) ); - m_projectTreeView->treeView()->setContextMenuPolicy( Qt::CustomContextMenu ); - connect( m_projectTreeView->treeView(), + if ( dockOntopOfWidget ) + { + tabifyDockWidget( dockOntopOfWidget, dockWidget ); + } + else + { + dockOntopOfWidget = dockWidget; + } + + connect( dockWidget, SIGNAL( visibilityChanged( bool ) ), projectTree, SLOT( treeVisibilityChanged( bool ) ) ); + + connect( projectTree, SIGNAL( selectionChanged() ), this, SLOT( selectedObjectsChanged() ) ); + + projectTree->treeView()->setContextMenuPolicy( Qt::CustomContextMenu ); + connect( projectTree->treeView(), SIGNAL( customContextMenuRequested( const QPoint& ) ), SLOT( customMenuRequested( const QPoint& ) ) ); - m_projectTreeView->setUiConfigurationName( "PlotWindow" ); + projectTree->setUiConfigurationName( treeViewConfigs[i] ); } { @@ -813,13 +833,14 @@ void RiuPlotMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* vie } //-------------------------------------------------------------------------------------------------- -/// This method needs to handle memory deallocation !!! +/// //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::setPdmRoot( caf::PdmObject* pdmRoot ) { - m_projectTreeView->setPdmItem( pdmRoot ); - // For debug only : m_projectTreeView->treeView()->expandAll(); - m_projectTreeView->setDragDropInterface( m_dragDropInterface.get() ); + for ( auto tv : projectTreeViews() ) + { + tv->setPdmItem( pdmRoot ); + } } //-------------------------------------------------------------------------------------------------- @@ -836,28 +857,32 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow ) if ( !isBlockingViewSelectionOnSubWindowActivated() ) { - std::vector currentSelection; - m_projectTreeView->selectedUiItems( currentSelection ); - bool childSelected = false; - for ( caf::PdmUiItem* uiItem : currentSelection ) + caf::PdmUiTreeView* projectTree = getTreeViewWithItem( activatedView ); + if ( projectTree ) { - caf::PdmObject* pdmObject = dynamic_cast( uiItem ); - if ( pdmObject ) + std::vector currentSelection; + projectTree->selectedUiItems( currentSelection ); + bool childSelected = false; + for ( caf::PdmUiItem* uiItem : currentSelection ) { - std::vector ancestralViews; - pdmObject->allAncestorsOrThisOfType( ancestralViews ); - for ( auto ancestralView : ancestralViews ) + caf::PdmObject* pdmObject = dynamic_cast( uiItem ); + if ( pdmObject ) { - if ( ancestralView == activatedView ) + std::vector ancestralViews; + pdmObject->allAncestorsOrThisOfType( ancestralViews ); + for ( auto ancestralView : ancestralViews ) { - childSelected = true; + if ( ancestralView == activatedView ) + { + childSelected = true; + } } } } - } - if ( !childSelected ) - { - selectAsCurrentItem( activatedView ); + if ( !childSelected ) + { + selectAsCurrentItem( activatedView ); + } } } @@ -911,8 +936,11 @@ void RiuPlotMainWindow::slotBuildWindowActions() //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::selectedObjectsChanged() { + caf::PdmUiTreeView* projectTree = dynamic_cast( sender() ); + if ( !projectTree ) return; + std::vector uiItems; - m_projectTreeView->selectedUiItems( uiItems ); + projectTree->selectedUiItems( uiItems ); caf::PdmObjectHandle* firstSelectedObject = nullptr; if ( !uiItems.empty() ) @@ -974,7 +1002,8 @@ void RiuPlotMainWindow::selectedObjectsChanged() // The only way to get to this code is by selection change initiated from the project tree view // As we are activating an MDI-window, the focus is given to this MDI-window // Set focus back to the tree view to be able to continue keyboard tree view navigation - m_projectTreeView->treeView()->setFocus(); + projectTree->raise(); + projectTree->treeView()->setFocus(); } } } @@ -984,24 +1013,8 @@ void RiuPlotMainWindow::selectedObjectsChanged() //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::restoreTreeViewState() { - if ( m_projectTreeView ) - { - QString stateString = RimProject::current()->plotWindowTreeViewState; - if ( !stateString.isEmpty() ) - { - m_projectTreeView->treeView()->collapseAll(); - caf::QTreeViewStateSerializer::applyTreeViewStateFromString( m_projectTreeView->treeView(), stateString ); - } - - QString currentIndexString = RimProject::current()->plotWindowCurrentModelIndexPath; - if ( !currentIndexString.isEmpty() ) - { - QModelIndex mi = - caf::QTreeViewStateSerializer::getModelIndexFromString( m_projectTreeView->treeView()->model(), - currentIndexString ); - m_projectTreeView->treeView()->setCurrentIndex( mi ); - } - } + restoreTreeViewStates( RimProject::current()->plotWindowTreeViewStates(), + RimProject::current()->plotWindowCurrentModelIndexPaths() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 046ebc6599..83696c784e 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -22,7 +22,6 @@ #include "RiuMdiArea.h" #include "cafPdmPointer.h" -#include "cafPdmUiDragDropInterface.h" #include @@ -133,10 +132,9 @@ private slots: QMenu* m_windowMenu; - caf::PdmUiToolBarEditor* m_wellLogPlotToolBarEditor; - caf::PdmUiToolBarEditor* m_multiPlotToolBarEditor; - caf::PdmUiToolBarEditor* m_summaryPlotToolBarEditor; - std::unique_ptr m_dragDropInterface; + caf::PdmUiToolBarEditor* m_wellLogPlotToolBarEditor; + caf::PdmUiToolBarEditor* m_multiPlotToolBarEditor; + caf::PdmUiToolBarEditor* m_summaryPlotToolBarEditor; caf::PdmUiPropertyView* m_pdmUiPropertyView; caf::PdmUiPropertyView* m_summaryPlotManagerView; diff --git a/ApplicationLibCode/UserInterface/RiuProjectPropertyView.cpp b/ApplicationLibCode/UserInterface/RiuProjectPropertyView.cpp index b157e60876..eb38dcf905 100644 --- a/ApplicationLibCode/UserInterface/RiuProjectPropertyView.cpp +++ b/ApplicationLibCode/UserInterface/RiuProjectPropertyView.cpp @@ -43,7 +43,7 @@ RiuProjectAndPropertyView::RiuProjectAndPropertyView( QWidget* parent, Qt::Windo m_projectTreeView->enableSelectionManagerUpdating( true ); // Install event filter used to handle key press events - RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this ); + RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this, m_projectTreeView ); m_projectTreeView->treeView()->installEventFilter( treeViewEventFilter ); // Drag and drop configuration diff --git a/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp b/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp index e2faad723c..a7e57e7d13 100644 --- a/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp +++ b/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.cpp @@ -44,8 +44,9 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuTreeViewEventFilter::RiuTreeViewEventFilter( QObject* parent ) +RiuTreeViewEventFilter::RiuTreeViewEventFilter( QObject* parent, caf::PdmUiTreeView* treeView ) : QObject( parent ) + , m_projectTreeView( treeView ) { } @@ -141,14 +142,7 @@ bool RiuTreeViewEventFilter::eventFilter( QObject* obj, QEvent* event ) // Do not toggle state if currently editing a name in the tree view bool toggleStateForSelection = true; - if ( RiuMainWindow::instance()->projectTreeView() && - RiuMainWindow::instance()->projectTreeView()->isTreeItemEditWidgetActive() ) - { - toggleStateForSelection = false; - } - else if ( RiaGuiApplication::instance()->mainPlotWindow() && - RiaGuiApplication::instance()->mainPlotWindow()->projectTreeView() && - RiaGuiApplication::instance()->mainPlotWindow()->projectTreeView()->isTreeItemEditWidgetActive() ) + if ( m_projectTreeView && m_projectTreeView->isTreeItemEditWidgetActive() ) { toggleStateForSelection = false; } diff --git a/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.h b/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.h index be6756ca9e..0c27e0b247 100644 --- a/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.h +++ b/ApplicationLibCode/UserInterface/RiuTreeViewEventFilter.h @@ -29,18 +29,22 @@ class QKeyEvent; namespace caf { class CmdFeature; -} +class PdmUiTreeView; +} // namespace caf //-------------------------------------------------------------------------------------------------- class RiuTreeViewEventFilter : public QObject { Q_OBJECT public: - explicit RiuTreeViewEventFilter( QObject* parent ); + explicit RiuTreeViewEventFilter( QObject* parent, caf::PdmUiTreeView* treeView ); static bool activateFeatureFromKeyEvent( QKeyEvent* keyEvent ); static bool activateFirstEnabledFeature( const std::vector& features ); protected: bool eventFilter( QObject* obj, QEvent* event ) override; + +private: + caf::PdmUiTreeView* m_projectTreeView; }; diff --git a/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp b/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp index 71956a5b94..2d67366dc6 100644 --- a/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewerCommands.cpp @@ -769,7 +769,7 @@ void RiuViewerCommands::handlePickAction( int winPosX, int winPosY, Qt::Keyboard { std::vector uiItems; - RiuMainWindow::instance()->projectTreeView()->selectedUiItems( uiItems ); + RiuMainWindow::instance()->projectTreeView( 0 )->selectedUiItems( uiItems ); if ( uiItems.size() == 1 ) { diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp index c8355f1a28..907e2fc30d 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp @@ -38,6 +38,7 @@ #include "cafPdmObject.h" #include "cafPdmUiDefaultObjectEditor.h" +#include "cafPdmUiDragDropInterface.h" #include "cafPdmUiTreeViewEditor.h" #include @@ -228,4 +229,12 @@ void PdmUiTreeView::enableAppendOfClassNameToUiItemText( bool enable ) m_treeViewEditor->enableAppendOfClassNameToUiItemText( enable ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTreeView::treeVisibilityChanged( bool visible ) +{ + if ( visible ) slotOnSelectionChanged(); +} + } // End of namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h index ec60d2040d..519db621f3 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h @@ -38,6 +38,8 @@ #include #include +#include "cafPdmUiDragDropInterface.h" + class QVBoxLayout; class QTreeView; class QItemSelection; @@ -48,7 +50,6 @@ namespace caf { class PdmUiItem; class PdmUiTreeViewEditor; -class PdmUiDragDropInterface; class PdmObjectHandle; //================================================================================================== @@ -90,6 +91,9 @@ class PdmUiTreeView : public QWidget // Convenience signal for use with PdmUiPropertyView void selectedObjectChanged( caf::PdmObjectHandle* object ); // Signal/Slot system needs caf:: prefix in some cases +public slots: + void treeVisibilityChanged( bool visible ); + private slots: void slotOnSelectionChanged(); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp index 74473d5976..7ee9945c85 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp @@ -479,6 +479,7 @@ bool PdmUiTreeViewEditor::eventFilter( QObject* obj, QEvent* event ) if ( event->type() == QEvent::FocusIn ) { this->updateSelectionManager(); + emit selectionChanged(); } // standard event processing @@ -504,7 +505,7 @@ void PdmUiTreeViewEditor::updateSelectionManager() void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& modelIndex /*= QModelIndex()*/ ) { auto allIndices = m_treeViewModel->allIndicesRecursive(); - for ( QModelIndex index : allIndices ) + for ( QModelIndex& index : allIndices ) { m_delegate->clearTags( index ); diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 2fa97a542b..4bf8cb8ee8 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".01") +set(RESINSIGHT_DEV_VERSION ".02") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 35adae926f67ea85fe715055f16891420957c113 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Mon, 31 Jan 2022 14:49:01 +0100 Subject: [PATCH 094/406] Add well angles in degrees, not radians. --- .../ProjectDataModel/WellPath/RimWellIASettings.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp index 1b99bfa0df..7dfb0627d0 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp @@ -47,6 +47,8 @@ #include "cafPdmUiFilePathEditor.h" #include "cafPdmUiTableViewEditor.h" +#include "cvfMath.h" + #include #include @@ -495,8 +497,8 @@ bool RimWellIASettings::updateResInsightParameters() auto angles = RigWellPathGeometryTools::calculateAzimuthAndInclinationAtMd( ( m_startMD + m_endMD ) / 2.0, wellPath()->wellPathGeometry() ); - initialStress->addParameter( "azimuth_well", angles.first ); - initialStress->addParameter( "inclination_well", angles.second ); + initialStress->addParameter( "azimuth_well", cvf::Math::toDegrees( angles.first ) ); + initialStress->addParameter( "inclination_well", cvf::Math::toDegrees( angles.second ) ); m_parametersRI.push_back( initialStress ); From 8fe5d18765bd5fcb5c7fc15b1b6dc7bc9b111f61 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Mon, 31 Jan 2022 14:10:51 +0000 Subject: [PATCH 095/406] Python code linting changes detected by black --- GrpcInterface/Python/rips/retry_policy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GrpcInterface/Python/rips/retry_policy.py b/GrpcInterface/Python/rips/retry_policy.py index 7ea1baa4f2..a2fe047286 100644 --- a/GrpcInterface/Python/rips/retry_policy.py +++ b/GrpcInterface/Python/rips/retry_policy.py @@ -68,7 +68,7 @@ def sleep(self, retry_num): # Add a random component to avoid synchronized retries wiggle = random.randint(0, 100) sleep_ms = min( - self.min_backoff + self.multiplier ** retry_num + wiggle, self.max_backoff + self.min_backoff + self.multiplier**retry_num + wiggle, self.max_backoff ) time.sleep(sleep_ms / 1000) From 69e627cac9a8b2615f114afae814100f0518ad0b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 3 Feb 2022 11:01:41 +0100 Subject: [PATCH 096/406] Update ResInsightWithCache.yml --- .github/workflows/ResInsightWithCache.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 864b63fba6..64fcaaa0d0 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -22,7 +22,7 @@ jobs: config: - { name: "Windows Latest MSVC", - os: windows-latest, + os: windows-2019, cc: "cl", cxx: "cl", environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", vcpkg-response-file: vcpkg_x64-windows.txt, From 94a541f9664efe76871ad786d66c8582655449d9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 3 Feb 2022 09:17:54 +0100 Subject: [PATCH 097/406] #8513 Use cell face when leaving cell when well path starts inside cell --- .../RicWellPathExportMswCompletionsImpl.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp index ce8e00a655..34f0d1564d 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp @@ -1126,14 +1126,13 @@ std::vector WellPathCellIntersectionInfo extraIntersection; - extraIntersection.globCellIndex = std::numeric_limits::max(); - extraIntersection.startPoint = intersectionPoint; - extraIntersection.endPoint = firstIntersection.startPoint; - extraIntersection.startMD = initialMD; - extraIntersection.endMD = firstIntersection.startMD; - extraIntersection.intersectedCellFaceIn = cvf::StructGridInterface::NO_FACE; - extraIntersection.intersectedCellFaceOut = - cvf::StructGridInterface::oppositeFace( firstIntersection.intersectedCellFaceIn ); + extraIntersection.globCellIndex = std::numeric_limits::max(); + extraIntersection.startPoint = intersectionPoint; + extraIntersection.endPoint = firstIntersection.startPoint; + extraIntersection.startMD = initialMD; + extraIntersection.endMD = firstIntersection.startMD; + extraIntersection.intersectedCellFaceIn = cvf::StructGridInterface::NO_FACE; + extraIntersection.intersectedCellFaceOut = firstIntersection.intersectedCellFaceOut; extraIntersection.intersectionLengthsInCellCS = cvf::Vec3d::ZERO; filteredIntersections.push_back( extraIntersection ); From 2c0ebfd14ca101b64cb196e5d96a330d41ff5a93 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 3 Feb 2022 10:05:46 +0100 Subject: [PATCH 098/406] Make face test robust --- .../RicWellPathExportMswCompletionsImpl.cpp | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp index 34f0d1564d..39f1f55ec1 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportMswCompletionsImpl.cpp @@ -1126,13 +1126,24 @@ std::vector WellPathCellIntersectionInfo extraIntersection; - extraIntersection.globCellIndex = std::numeric_limits::max(); - extraIntersection.startPoint = intersectionPoint; - extraIntersection.endPoint = firstIntersection.startPoint; - extraIntersection.startMD = initialMD; - extraIntersection.endMD = firstIntersection.startMD; - extraIntersection.intersectedCellFaceIn = cvf::StructGridInterface::NO_FACE; - extraIntersection.intersectedCellFaceOut = firstIntersection.intersectedCellFaceOut; + extraIntersection.globCellIndex = std::numeric_limits::max(); + extraIntersection.startPoint = intersectionPoint; + extraIntersection.endPoint = firstIntersection.startPoint; + extraIntersection.startMD = initialMD; + extraIntersection.endMD = firstIntersection.startMD; + extraIntersection.intersectedCellFaceIn = cvf::StructGridInterface::NO_FACE; + + if ( firstIntersection.intersectedCellFaceIn != cvf::StructGridInterface::NO_FACE ) + + { + extraIntersection.intersectedCellFaceOut = + cvf::StructGridInterface::oppositeFace( firstIntersection.intersectedCellFaceIn ); + } + else if ( firstIntersection.intersectedCellFaceOut != cvf::StructGridInterface::NO_FACE ) + { + extraIntersection.intersectedCellFaceOut = firstIntersection.intersectedCellFaceOut; + } + extraIntersection.intersectionLengthsInCellCS = cvf::Vec3d::ZERO; filteredIntersections.push_back( extraIntersection ); From 358c11264ab91ca53f51999f4380837e03ddc35e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Feb 2022 08:45:38 +0100 Subject: [PATCH 099/406] Merge pull request #8519 from magnesj/simplify-windows-env Simplify GitHub Action and support windows-2022 --- .github/workflows/ResInsightWithCache.yml | 47 ++++--------------- .../RifEclipseUserDataParserTools.cpp | 5 +- 2 files changed, 12 insertions(+), 40 deletions(-) diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 64fcaaa0d0..83628dad04 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -22,12 +22,10 @@ jobs: config: - { name: "Windows Latest MSVC", - os: windows-2019, + os: windows-latest, cc: "cl", cxx: "cl", - environment_script: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat", vcpkg-response-file: vcpkg_x64-windows.txt, vcpkg-triplet: x64-windows, - cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake', build-python-module: true, execute-unit-tests: true } @@ -37,7 +35,6 @@ jobs: cc: "gcc", cxx: "g++", vcpkg-response-file: vcpkg_x64-linux.txt, vcpkg-triplet: x64-linux, - cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake', build-python-module: true, execute-unit-tests: true } @@ -47,7 +44,6 @@ jobs: cc: "clang", cxx: "clang++", vcpkg-response-file: vcpkg_x64-linux.txt, vcpkg-triplet: x64-linux, - cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake', build-python-module: true, execute-unit-tests: true } @@ -57,7 +53,6 @@ jobs: cc: "clang", cxx: "clang++", vcpkg-response-file: vcpkg_x64-osx.txt, vcpkg-triplet: x64-osx, - cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake', build-python-module: false, execute-unit-tests: false } @@ -73,9 +68,12 @@ jobs: - name: Display Python version run: python -c "import sys; print(sys.version)" - # workaround a poor interaction between github actions/cmake/vcpkg, see https://github.com/lukka/run-vcpkg/issues/88#issuecomment-885758902 - - name: Use CMake 3.20.1 - uses: lukka/get-cmake@v3.20.1 + - name: Use CMake + uses: lukka/get-cmake@latest + + - name: Use MSVC (Windows) + if: matrix.config.os == 'windows-latest' + uses: ilammy/msvc-dev-cmd@v1 - name: Download buildcache id: buildcache-download @@ -171,23 +169,6 @@ jobs: run: | set(ENV{CC} ${{ matrix.config.cc }}) set(ENV{CXX} ${{ matrix.config.cxx }}) - if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") - execute_process( - COMMAND "${{ matrix.config.environment_script }}" && set - OUTPUT_FILE environment_script_output.txt - ) - file(STRINGS environment_script_output.txt output_lines) - foreach(line IN LISTS output_lines) - if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") - set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") - endif() - endforeach() - endif() - set(path_separator ":") - if ("${{ runner.os }}" STREQUAL "Windows") - set(path_separator ";") - endif() - set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") execute_process( COMMAND cmake @@ -201,7 +182,7 @@ jobs: -D RESINSIGHT_ENABLE_GRPC=${{ matrix.config.build-python-module }} -D RESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -D RESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true - -D CMAKE_TOOLCHAIN_FILE=${{ matrix.config.cmake-toolchain }} + -D CMAKE_TOOLCHAIN_FILE=ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake -G Ninja RESULT_VARIABLE result ) @@ -212,18 +193,6 @@ jobs: shell: cmake -P {0} run: | set(ENV{NINJA_STATUS} "[%f/%t %o/sec] ") - if ("${{ runner.os }}" STREQUAL "Windows" AND NOT "x${{ matrix.config.environment_script }}" STREQUAL "x") - file(STRINGS environment_script_output.txt output_lines) - foreach(line IN LISTS output_lines) - if (line MATCHES "^([a-zA-Z0-9_-]+)=(.*)$") - set(ENV{${CMAKE_MATCH_1}} "${CMAKE_MATCH_2}") - endif() - endforeach() - endif() - set(path_separator ":") - if ("${{ runner.os }}" STREQUAL "Windows") - set(path_separator ";") - endif() execute_process( COMMAND cmake --build cmakebuild --target install RESULT_VARIABLE result diff --git a/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp index 6b3f620d6e..5b76161106 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp @@ -32,6 +32,7 @@ #include #include +#include #include //-------------------------------------------------------------------------------------------------- @@ -186,7 +187,9 @@ bool RifEclipseUserDataParserTools::isANumber( const std::string& line ) { try { - std::stod( line ); + auto value = std::stod( line ); + if ( std::isinf( value ) || std::isnan( value ) ) return false; + return true; } catch ( ... ) { From a3ad9d2c1e8467767fedc9ce37de7f3a07a4c547 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Fri, 4 Feb 2022 15:49:22 +0100 Subject: [PATCH 100/406] Merge pull request #8524 from OPM/tree_filter Add Project Tree filter support --- .../Application/RiaGuiApplication.cpp | 4 +- .../RimWellPathImport.cpp | 1 + .../RiuWellImportWizard.cpp | 1 + .../RicToggleItemsFeatureImpl.cpp | 2 +- .../ProjectDataModel/RimViewWindow.cpp | 1 + .../Summary/RimSummaryCurveCollection.cpp | 1 + .../ProjectDataModel/WellPath/RimWellPath.cpp | 1 + .../UserInterface/RiuMainWindow.cpp | 2 + .../UserInterface/RiuMainWindowTools.cpp | 4 +- .../cafToggleItemsFeatureImpl.cpp | 4 +- Fwk/AppFwk/cafUserInterface/CMakeLists.txt | 3 + .../cafUserInterface/cafPdmUiTreeAttributes.h | 104 +++++ .../cafUserInterface/cafPdmUiTreeView.cpp | 85 +++- .../cafUserInterface/cafPdmUiTreeView.h | 16 +- .../cafPdmUiTreeViewEditor.cpp | 362 ++++-------------- .../cafUserInterface/cafPdmUiTreeViewEditor.h | 101 +---- .../cafPdmUiTreeViewItemDelegate.cpp | 320 ++++++++++++++++ .../cafPdmUiTreeViewItemDelegate.h | 84 ++++ 18 files changed, 715 insertions(+), 381 deletions(-) create mode 100644 Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h create mode 100644 Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp create mode 100644 Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.h diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 5df1652551..f30535d1c4 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -303,7 +303,7 @@ void RiaGuiApplication::storeTreeViewState() for ( auto& tv : mainWindow()->projectTreeViews() ) { QString treeViewState; - caf::QTreeViewStateSerializer::storeTreeViewStateToString( tv->treeView(), treeViewState ); + tv->storeTreeViewStateToString( treeViewState ); treeStates.append( treeViewState ); QModelIndex mi = tv->treeView()->currentIndex(); @@ -324,7 +324,7 @@ void RiaGuiApplication::storeTreeViewState() for ( auto& tv : mainPlotWindow()->projectTreeViews() ) { QString treeViewState; - caf::QTreeViewStateSerializer::storeTreeViewStateToString( tv->treeView(), treeViewState ); + tv->storeTreeViewStateToString( treeViewState ); treeStates.append( treeViewState ); QModelIndex mi = tv->treeView()->currentIndex(); diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp index 06b9541b0a..7bc7edda62 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp @@ -25,6 +25,7 @@ #include "RimWellPath.h" #include "RimWellPathCollection.h" +#include "cafPdmUiTreeAttributes.h" #include "cafPdmUiTreeViewEditor.h" #include diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp index 0f61ccfc01..e441f07a84 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp @@ -32,6 +32,7 @@ #include "cafPdmObjectGroup.h" #include "cafPdmUiListView.h" #include "cafPdmUiPropertyView.h" +#include "cafPdmUiTreeAttributes.h" #include "cafPdmUiTreeView.h" #include "cafPdmUiTreeViewEditor.h" #include "cafUtils.h" diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp index 8424b6c79b..3d19b992a4 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp @@ -192,7 +192,7 @@ caf::PdmUiTreeOrdering* RicToggleItemsFeatureImpl::findTreeItemFromSelectedUiIte if ( pdmUiTreeView ) { QModelIndex modIndex = pdmUiTreeView->findModelIndex( uiItem ); - return static_cast( modIndex.internalPointer() ); + return pdmUiTreeView->uiTreeOrderingFromModelIndex( modIndex ); } return nullptr; diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index 1c6e03d842..44608748bf 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -29,6 +29,7 @@ #include "RimMdiWindowController.h" #include "RimProject.h" +#include "cafPdmUiTreeAttributes.h" #include "cafPdmUiTreeViewEditor.h" #include diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index 75fb86cf7c..bd019f859c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -34,6 +34,7 @@ #include "cafPdmFieldReorderCapability.h" #include "cafPdmUiPushButtonEditor.h" +#include "cafPdmUiTreeAttributes.h" #include "cafPdmUiTreeViewEditor.h" #include "qwt_plot.h" diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp index a52b4916db..b6844825ca 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp @@ -57,6 +57,7 @@ #include "RiuMainWindow.h" #include "cafPdmFieldScriptingCapability.h" +#include "cafPdmUiTreeAttributes.h" #include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeViewEditor.h" #include "cafUtils.h" diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index b79b966276..7b2eda76be 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1303,6 +1303,8 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim if ( is3dViewCurrentlySelected && ( previousActiveReservoirView != activatedView ) ) { QModelIndex newViewModelIndex = projectTreeView( 0 )->findModelIndex( activatedView ); + if ( !newViewModelIndex.isValid() ) return; + QModelIndex newSelectionIndex = newViewModelIndex; if ( previousActiveReservoirView && is3dViewCurrentlySelected ) diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp index 3af557ab68..9bce9f176d 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp @@ -67,10 +67,10 @@ void RiuMainWindowTools::collapseSiblings( const caf::PdmUiItem* sourceUiItem ) caf::PdmUiTreeOrdering* sourceTreeOrderingItem = nullptr; QModelIndex modIndex = sourceTreeView->findModelIndex( sourceUiItem ); - if ( !modIndex.isValid() ) return; - sourceTreeOrderingItem = static_cast( modIndex.internalPointer() ); + sourceTreeOrderingItem = sourceTreeView->uiTreeOrderingFromModelIndex( modIndex ); + if ( sourceTreeOrderingItem == nullptr ) return; if ( sourceTreeOrderingItem && sourceTreeOrderingItem->parent() ) { diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.cpp b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.cpp index 5444d7b91e..4a91543dd8 100644 --- a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.cpp +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsFeatureImpl.cpp @@ -194,10 +194,10 @@ caf::PdmUiTreeOrdering* ToggleItemsFeatureImpl::findTreeItemFromSelectedUiItem( if ( pdmUiTreeView ) { QModelIndex modIndex = pdmUiTreeView->findModelIndex( uiItem ); - return static_cast( modIndex.internalPointer() ); + return pdmUiTreeView->uiTreeOrderingFromModelIndex( modIndex ); } return nullptr; } -} // namespace caf \ No newline at end of file +} // namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt index 15d71efcd3..8d558685b2 100644 --- a/Fwk/AppFwk/cafUserInterface/CMakeLists.txt +++ b/Fwk/AppFwk/cafUserInterface/CMakeLists.txt @@ -165,6 +165,9 @@ set(PROJECT_FILES cafStyleSheetTools.cpp cafPdmUiTabbedPropertyViewDialog.h cafPdmUiTabbedPropertyViewDialog.cpp + cafPdmUiTreeViewItemDelegate.h + cafPdmUiTreeViewItemDelegate.cpp + cafPdmUiTreeAttributes.h ) add_library( diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h new file mode 100644 index 0000000000..5c692a2084 --- /dev/null +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeAttributes.h @@ -0,0 +1,104 @@ + + +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2011-2013 Ceetron AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library 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. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library 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 Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#pragma once + +#include "cafPdmUiFieldEditorHandle.h" +#include "cafSignal.h" + +namespace caf +{ +class PdmUiTreeViewItemAttribute : public PdmUiEditorAttribute +{ +public: + struct Tag : public SignalEmitter + { + enum Position + { + IN_FRONT, + AT_END + }; + Tag() + : text() + , position( AT_END ) + , bgColor( Qt::red ) + , fgColor( Qt::white ) + , selectedOnly( false ) + , clicked( this ) + { + } + QString text; + IconProvider icon; + Position position; + QColor bgColor; + QColor fgColor; + bool selectedOnly; + + caf::Signal clicked; + + static std::unique_ptr create() { return std::unique_ptr( new Tag ); } + + private: + Tag& operator=( const Tag& rhs ) { return *this; } + }; + + std::vector> tags; +}; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class PdmUiTreeViewEditorAttribute : public PdmUiEditorAttribute +{ +public: + PdmUiTreeViewEditorAttribute() + : currentObject( nullptr ) + , objectForUpdateOfUiTree( nullptr ) + { + } + +public: + QStringList columnHeaders; + + /// This object is set as current item in the tree view in configureAndUpdateUi() + caf::PdmObjectHandle* currentObject; + + caf::PdmObjectHandle* objectForUpdateOfUiTree; +}; + +} // namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp index 907e2fc30d..a1324aac56 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp @@ -39,10 +39,16 @@ #include "cafPdmObject.h" #include "cafPdmUiDefaultObjectEditor.h" #include "cafPdmUiDragDropInterface.h" - +#include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeViewEditor.h" +#include "cafQTreeViewStateSerializer.h" + #include +#include +#include +#include #include +#include namespace caf { @@ -52,16 +58,30 @@ namespace caf PdmUiTreeView::PdmUiTreeView( QWidget* parent, Qt::WindowFlags f ) : QWidget( parent, f ) { - m_layout = new QVBoxLayout( this ); + m_layout = new QVBoxLayout(); m_layout->setContentsMargins( 0, 0, 0, 0 ); setLayout( m_layout ); - m_treeViewEditor = new PdmUiTreeViewEditor(); + QHBoxLayout* searchLayout = new QHBoxLayout(); + + m_searchBox = new QLineEdit( this ); + m_searchBox->setPlaceholderText( "Type here to search in tree." ); + searchLayout->addWidget( m_searchBox ); + m_clearSearchButton = new QPushButton( "X" ); + m_clearSearchButton->setMaximumSize( 30, 30 ); + searchLayout->addWidget( m_clearSearchButton ); - QWidget* widget = m_treeViewEditor->getOrCreateWidget( this ); +#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 ) + m_layout->addLayout( searchLayout ); + connect( m_searchBox, SIGNAL( textChanged( QString ) ), SLOT( slotOnSearchTextChanged() ) ); + connect( m_clearSearchButton, SIGNAL( clicked() ), SLOT( slotOnClearSearchBox() ) ); +#endif - this->m_layout->insertWidget( 0, widget ); + m_treeViewEditor = new PdmUiTreeViewEditor(); + QWidget* treewidget = m_treeViewEditor->getOrCreateWidget( this ); + + m_layout->addWidget( treewidget ); connect( m_treeViewEditor, SIGNAL( selectionChanged() ), SLOT( slotOnSelectionChanged() ) ); } @@ -144,6 +164,53 @@ void PdmUiTreeView::slotOnSelectionChanged() emit selectedObjectChanged( objHandle ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTreeView::slotOnClearSearchBox() +{ + m_searchBox->setText( "" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTreeView::slotOnSearchTextChanged() +{ + QString searchText = m_searchBox->text().trimmed(); + if ( searchText.isEmpty() ) + { + m_treeViewEditor->setFilterString( searchText ); + if ( !m_treeStateString.isEmpty() ) + { + m_treeViewEditor->treeView()->collapseAll(); + QTreeViewStateSerializer::applyTreeViewStateFromString( m_treeViewEditor->treeView(), m_treeStateString ); + m_treeStateString = ""; + } + return; + } + else if ( m_treeStateString.isEmpty() ) + { + QTreeViewStateSerializer::storeTreeViewStateToString( m_treeViewEditor->treeView(), m_treeStateString ); + } + m_treeViewEditor->setFilterString( searchText ); + m_treeViewEditor->treeView()->expandAll(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTreeView::storeTreeViewStateToString( QString& treeViewState ) const +{ + QString searchText = m_searchBox->text().trimmed(); + if ( !searchText.isEmpty() ) + { + treeViewState = m_treeStateString; + return; + } + QTreeViewStateSerializer::storeTreeViewStateToString( m_treeViewEditor->treeView(), treeViewState ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -193,6 +260,14 @@ PdmUiItem* PdmUiTreeView::uiItemFromModelIndex( const QModelIndex& index ) const return m_treeViewEditor->uiItemFromModelIndex( index ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +PdmUiTreeOrdering* PdmUiTreeView::uiTreeOrderingFromModelIndex( const QModelIndex& index ) const +{ + return m_treeViewEditor->uiTreeOrderingFromModelIndex( index ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h index 519db621f3..a26cde58ae 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h @@ -45,12 +45,16 @@ class QTreeView; class QItemSelection; class QMenu; class QModelIndex; +class QLineEdit; +class QPushButton; +class QSortFilterProxyModel; namespace caf { class PdmUiItem; class PdmUiTreeViewEditor; class PdmObjectHandle; +class PdmUiTreeOrdering; //================================================================================================== /// @@ -84,7 +88,12 @@ class PdmUiTreeView : public QWidget PdmUiItem* uiItemFromModelIndex( const QModelIndex& index ) const; QModelIndex findModelIndex( const PdmUiItem* object ) const; void updateSubTree( const QModelIndex& index ); - void setDragDropInterface( PdmUiDragDropInterface* dragDropInterface ); + + PdmUiTreeOrdering* uiTreeOrderingFromModelIndex( const QModelIndex& index ) const; + + void setDragDropInterface( PdmUiDragDropInterface* dragDropInterface ); + + void storeTreeViewStateToString( QString& treeViewState ) const; signals: void selectionChanged(); @@ -96,11 +105,16 @@ public slots: private slots: void slotOnSelectionChanged(); + void slotOnClearSearchBox(); + void slotOnSearchTextChanged(); private: PdmUiTreeViewEditor* m_treeViewEditor; QString m_uiConfigName; QVBoxLayout* m_layout; + QLineEdit* m_searchBox; + QPushButton* m_clearSearchButton; + QString m_treeStateString; }; } // End of namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp index 7ee9945c85..d2c6f92012 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp @@ -45,6 +45,7 @@ #include "cafPdmUiDragDropInterface.h" #include "cafPdmUiEditorHandle.h" #include "cafPdmUiTreeOrdering.h" +#include "cafPdmUiTreeViewItemDelegate.h" #include "cafPdmUiTreeViewQModel.h" #include "cafSelectionManager.h" @@ -149,6 +150,7 @@ PdmUiTreeViewEditor::PdmUiTreeViewEditor() m_treeView = nullptr; m_treeViewModel = nullptr; m_delegate = nullptr; + m_filterModel = nullptr; } //-------------------------------------------------------------------------------------------------- @@ -156,6 +158,7 @@ PdmUiTreeViewEditor::PdmUiTreeViewEditor() //-------------------------------------------------------------------------------------------------- PdmUiTreeViewEditor::~PdmUiTreeViewEditor() { + m_treeView->removeEventFilter( this ); m_treeViewModel->setPdmItemRoot( nullptr ); } @@ -170,11 +173,20 @@ QWidget* PdmUiTreeViewEditor::createWidget( QWidget* parent ) m_mainWidget->setLayout( m_layout ); m_treeViewModel = new caf::PdmUiTreeViewQModel( this ); - m_treeView = new PdmUiTreeViewWidget( m_mainWidget ); - m_treeView->setModel( m_treeViewModel ); + m_filterModel = new QSortFilterProxyModel( this ); + m_filterModel->setFilterKeyColumn( 0 ); + m_filterModel->setFilterCaseSensitivity( Qt::CaseInsensitive ); + +#if QT_VERSION >= QT_VERSION_CHECK( 5, 10, 0 ) + m_filterModel->setRecursiveFilteringEnabled( true ); +#endif + + m_filterModel->setSourceModel( m_treeViewModel ); + m_treeView = new PdmUiTreeViewWidget( m_mainWidget ); + m_treeView->setModel( m_filterModel ); m_treeView->installEventFilter( this ); - m_delegate = new PdmUiTreeViewItemDelegate( this, m_treeViewModel ); + m_delegate = new PdmUiTreeViewItemDelegate( this, m_filterModel ); m_treeView->setItemDelegate( m_delegate ); @@ -256,10 +268,16 @@ void PdmUiTreeViewEditor::selectedUiItems( std::vector& objects ) if ( !this->treeView() ) return; QModelIndexList idxList = this->treeView()->selectionModel()->selectedIndexes(); + QModelIndexList proxyList; for ( int i = 0; i < idxList.size(); i++ ) { - caf::PdmUiItem* item = this->m_treeViewModel->uiItemFromModelIndex( idxList[i] ); + proxyList.append( m_filterModel->mapToSource( idxList[i] ) ); + } + + for ( int i = 0; i < proxyList.size(); i++ ) + { + caf::PdmUiItem* item = this->m_treeViewModel->uiItemFromModelIndex( proxyList[i] ); if ( item ) { objects.push_back( item ); @@ -289,8 +307,8 @@ void PdmUiTreeViewEditor::updateMySubTree( PdmUiItem* uiItem ) } m_treeViewModel->updateSubTree( itemToUpdate ); - QModelIndex index = m_treeViewModel->findModelIndex( itemToUpdate ); - updateItemDelegateForSubTree( index ); + QModelIndex itemIndex = m_treeViewModel->findModelIndex( itemToUpdate ); + updateItemDelegateForSubTree( itemIndex ); } } @@ -393,11 +411,11 @@ PdmChildArrayFieldHandle* PdmUiTreeViewEditor::currentChildArrayFieldHandle() void PdmUiTreeViewEditor::selectAsCurrentItem( const PdmUiItem* uiItem ) { QModelIndex index = m_treeViewModel->findModelIndex( uiItem ); - QModelIndex currentIndex = m_treeView->currentIndex(); + QModelIndex currentIndex = m_filterModel->mapFromSource( index ); m_treeView->clearSelection(); - m_treeView->setCurrentIndex( index ); + m_treeView->setCurrentIndex( currentIndex ); } //-------------------------------------------------------------------------------------------------- @@ -438,13 +456,34 @@ void PdmUiTreeViewEditor::slotOnSelectionChanged( const QItemSelection& selected //-------------------------------------------------------------------------------------------------- void PdmUiTreeViewEditor::setExpanded( const PdmUiItem* uiItem, bool doExpand ) const { - QModelIndex index = m_treeViewModel->findModelIndex( uiItem ); - m_treeView->setExpanded( index, doExpand ); + QModelIndex index = m_treeViewModel->findModelIndex( uiItem ); + QModelIndex filterIndex = m_filterModel->mapFromSource( index ); + + if ( filterIndex.isValid() ) + { + m_treeView->setExpanded( filterIndex, doExpand ); + + if ( doExpand ) + { + m_treeView->scrollTo( filterIndex ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QModelIndex PdmUiTreeViewEditor::mapIndexIfNecessary( QModelIndex index ) const +{ + const QAbstractProxyModel* proxyModel = dynamic_cast( index.model() ); - if ( doExpand ) + QModelIndex returnIndex = index; + if ( proxyModel ) { - m_treeView->scrollTo( index ); + returnIndex = proxyModel->mapToSource( index ); } + + return returnIndex; } //-------------------------------------------------------------------------------------------------- @@ -452,7 +491,18 @@ void PdmUiTreeViewEditor::setExpanded( const PdmUiItem* uiItem, bool doExpand ) //-------------------------------------------------------------------------------------------------- PdmUiItem* PdmUiTreeViewEditor::uiItemFromModelIndex( const QModelIndex& index ) const { - return m_treeViewModel->uiItemFromModelIndex( index ); + QModelIndex realIndex = mapIndexIfNecessary( index ); + return m_treeViewModel->uiItemFromModelIndex( realIndex ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +PdmUiTreeOrdering* PdmUiTreeViewEditor::uiTreeOrderingFromModelIndex( const QModelIndex& index ) const +{ + QModelIndex realIndex = mapIndexIfNecessary( index ); + if ( realIndex.isValid() ) return static_cast( realIndex.internalPointer() ); + return nullptr; } //-------------------------------------------------------------------------------------------------- @@ -460,7 +510,8 @@ PdmUiItem* PdmUiTreeViewEditor::uiItemFromModelIndex( const QModelIndex& index ) //-------------------------------------------------------------------------------------------------- QModelIndex PdmUiTreeViewEditor::findModelIndex( const PdmUiItem* object ) const { - return m_treeViewModel->findModelIndex( object ); + QModelIndex index = m_treeViewModel->findModelIndex( object ); + return m_filterModel->mapFromSource( index ); } //-------------------------------------------------------------------------------------------------- @@ -471,6 +522,14 @@ void PdmUiTreeViewEditor::setDragDropInterface( PdmUiDragDropInterface* dragDrop m_treeViewModel->setDragDropInterface( dragDropInterface ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTreeViewEditor::setFilterString( QString filterString ) +{ + m_filterModel->setFilterWildcard( filterString ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -502,12 +561,15 @@ void PdmUiTreeViewEditor::updateSelectionManager() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& modelIndex /*= QModelIndex()*/ ) +void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& subRootIndex /* = QModelIndex() */ ) { - auto allIndices = m_treeViewModel->allIndicesRecursive(); + auto allIndices = m_treeViewModel->allIndicesRecursive( subRootIndex ); for ( QModelIndex& index : allIndices ) { - m_delegate->clearTags( index ); + QModelIndex filterIndex = m_filterModel->mapFromSource( index ); + if ( !filterIndex.isValid() ) continue; + + m_delegate->clearTags( filterIndex ); PdmUiItem* uiItem = m_treeViewModel->uiItemFromModelIndex( index ); PdmUiObjectHandle* uiObjectHandle = dynamic_cast( uiItem ); @@ -523,9 +585,9 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& model std::vector selection; selectedUiItems( selection ); - if ( reorderability && index.row() >= 0 && selection.size() == 1u && selection.front() == uiItem ) + if ( reorderability && filterIndex.row() >= 0 && selection.size() == 1u && selection.front() == uiItem ) { - size_t indexInParent = static_cast( index.row() ); + size_t indexInParent = static_cast( filterIndex.row() ); { auto tag = PdmUiTreeViewItemAttribute::Tag::create(); tag->icon = caf::IconProvider( ":/caf/Up16x16.png" ); @@ -539,7 +601,7 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& model tag->icon.setActive( false ); } - m_delegate->addTag( index, std::move( tag ) ); + m_delegate->addTag( filterIndex, std::move( tag ) ); } { auto tag = PdmUiTreeViewItemAttribute::Tag::create(); @@ -553,7 +615,7 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& model { tag->icon.setActive( false ); } - m_delegate->addTag( index, std::move( tag ) ); + m_delegate->addTag( filterIndex, std::move( tag ) ); } } } @@ -564,7 +626,7 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& model { if ( !tag->text.isEmpty() || tag->icon.valid() ) { - m_delegate->addTag( index, std::move( tag ) ); + m_delegate->addTag( filterIndex, std::move( tag ) ); } } } @@ -587,260 +649,4 @@ bool PdmUiTreeViewEditor::isAppendOfClassNameToUiItemTextEnabled() return m_appendClassNameToUiItemText; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -PdmUiTreeViewItemDelegate::PdmUiTreeViewItemDelegate( PdmUiTreeViewEditor* parent, PdmUiTreeViewQModel* model ) - : QStyledItemDelegate( parent->treeView() ) - , m_treeView( parent ) - , m_model( model ) -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void PdmUiTreeViewItemDelegate::clearTags( QModelIndex index ) -{ - m_tags.erase( index ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void PdmUiTreeViewItemDelegate::clearAllTags() -{ - m_tags.clear(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void PdmUiTreeViewItemDelegate::addTag( QModelIndex index, std::unique_ptr tag ) -{ - std::vector>& tagList = m_tags[index]; - tagList.push_back( std::move( tag ) ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QRect PdmUiTreeViewItemDelegate::tagRect( const QRect& itemRect, QModelIndex index, size_t tagIndex ) const -{ - auto it = m_tags.find( index ); - if ( it == m_tags.end() ) return QRect(); - - QSize fullSize = itemRect.size(); - - QPoint offset( 0, 0 ); - - for ( size_t i = 0; i < it->second.size(); ++i ) - { - const PdmUiTreeViewItemAttribute::Tag* tag = it->second[i].get(); - if ( tag->icon.valid() ) - { - auto icon = tag->icon.icon(); - QSize iconSize = icon->actualSize( fullSize ); - QRect iconRect; - if ( tag->position == PdmUiTreeViewItemAttribute::Tag::AT_END ) - { - QPoint bottomRight = itemRect.bottomRight() - offset; - QPoint topLeft = bottomRight - QPoint( iconSize.width(), iconSize.height() ); - iconRect = QRect( topLeft, bottomRight ); - } - else - { - QPoint topLeft = itemRect.topLeft() + offset; - QPoint bottomRight = topLeft + QPoint( iconSize.width(), iconSize.height() ); - iconRect = QRect( topLeft, bottomRight ); - } - offset += QPoint( iconSize.width() + 2, 0 ); - - if ( i == tagIndex ) return iconRect; - } - } - return QRect(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void PdmUiTreeViewItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const -{ - QStyledItemDelegate::paint( painter, option, index ); - - auto it = m_tags.find( index ); - if ( it == m_tags.end() ) return; - - // Save painter so we can restore it - painter->save(); - - QRect rect = option.rect; - QPoint center = rect.center(); - - QSize fullSize = rect.size(); - - QPoint offset( 0, 0 ); - - for ( const std::unique_ptr& tag : it->second ) - { - if ( tag->selectedOnly && !( option.state & QStyle::State_Selected ) ) continue; - - if ( tag->icon.valid() ) - { - auto icon = tag->icon.icon(); - QSize iconSize = icon->actualSize( fullSize ); - QRect iconRect; - if ( tag->position == PdmUiTreeViewItemAttribute::Tag::AT_END ) - { - QPoint bottomRight( rect.bottomRight().x() - offset.x(), center.y() + iconSize.height() / 2 ); - QPoint topLeft( bottomRight.x() - iconSize.width(), bottomRight.y() - iconSize.height() ); - iconRect = QRect( topLeft, bottomRight ); - } - else - { - QPoint topLeft( rect.topLeft().x() + offset.x(), center.y() - iconSize.height() / 2 ); - QPoint bottomRight( topLeft.x() + iconSize.width(), topLeft.y() + iconSize.height() ); - iconRect = QRect( topLeft, bottomRight ); - } - offset += QPoint( iconSize.width() + 2, 0 ); - icon->paint( painter, iconRect ); - } - else - { - const int insideTopBottomMargins = 1; - const int insideleftRightMargins = 6; - const int outsideLeftRightMargins = 4; - - QFont font = QApplication::font(); - if ( font.pixelSize() > 0 ) - { - font.setPixelSize( std::max( 1, font.pixelSize() - 1 ) ); - } - else - { - font.setPointSize( std::max( 1, font.pointSize() - 1 ) ); - } - painter->setFont( font ); - - QString text = tag->text; - QColor bgColor = tag->bgColor; - QColor fgColor = tag->fgColor; - - QSize textSize( QFontMetrics( font ).size( Qt::TextSingleLine, text ) ); - int textDiff = ( fullSize.height() - textSize.height() ); - - QRect textRect; - if ( tag->position == PdmUiTreeViewItemAttribute::Tag::AT_END ) - { - QPoint bottomRight = rect.bottomRight() - QPoint( outsideLeftRightMargins, 0 ) - offset; - QPoint textBottomRight = bottomRight - QPoint( insideleftRightMargins, textDiff / 2 ); - QPoint textTopLeft = textBottomRight - QPoint( textSize.width(), textSize.height() ); - textRect = QRect( textTopLeft, textBottomRight ); - } - else - { - QPoint textTopLeft = QPoint( 0, rect.topLeft().y() ) + offset + - QPoint( outsideLeftRightMargins + insideleftRightMargins, +textDiff / 2 ); - QPoint textBottomRight = textTopLeft + QPoint( textSize.width(), textSize.height() ); - textRect = QRect( textTopLeft, textBottomRight ); - } - - QRect tagRect = textRect.marginsAdded( - QMargins( insideleftRightMargins, insideTopBottomMargins, insideleftRightMargins, insideTopBottomMargins ) ); - - offset += QPoint( tagRect.width() + 2, 0 ); - - QBrush brush( bgColor ); - - painter->setBrush( brush ); - painter->setPen( bgColor ); - painter->setRenderHint( QPainter::Antialiasing ); - const double xRoundingRadiusPercent = 50.0; - const double yRoundingRadiusPercent = 25.0; - painter->drawRoundedRect( tagRect, xRoundingRadiusPercent, yRoundingRadiusPercent, Qt::RelativeSize ); - - painter->setPen( fgColor ); - painter->drawText( textRect, Qt::AlignCenter, text ); - } - } - // Restore painter - painter->restore(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector PdmUiTreeViewItemDelegate::tags( QModelIndex index ) const -{ - std::vector tagPtrVector; - - auto it = m_tags.find( index ); - if ( it != m_tags.end() ) - { - for ( const auto& tag : it->second ) - { - tagPtrVector.push_back( tag.get() ); - } - } - return tagPtrVector; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool PdmUiTreeViewItemDelegate::editorEvent( QEvent* event, - QAbstractItemModel* model, - const QStyleOptionViewItem& option, - const QModelIndex& itemIndex ) -{ - if ( event->type() == QEvent::MouseButtonPress ) - { - QMouseEvent* mouseEvent = static_cast( event ); - - if ( mouseEvent->button() == Qt::LeftButton && mouseEvent->modifiers() == Qt::NoModifier ) - { - const PdmUiTreeViewItemAttribute::Tag* tag; - if ( tagClicked( mouseEvent->pos(), option.rect, itemIndex, &tag ) ) - { - QModelIndex parentIndex = itemIndex.parent(); - - auto uiItem = m_treeView->uiItemFromModelIndex( itemIndex ); - auto parentUiItem = m_treeView->uiItemFromModelIndex( parentIndex ); - - tag->clicked.send( (size_t)itemIndex.row() ); - - m_treeView->updateSubTree( parentUiItem ); - m_treeView->selectAsCurrentItem( uiItem ); - } - } - } - - return QStyledItemDelegate::editorEvent( event, model, option, itemIndex ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool PdmUiTreeViewItemDelegate::tagClicked( const QPoint& pos, - const QRect& itemRect, - const QModelIndex& itemIndex, - const PdmUiTreeViewItemAttribute::Tag** tag ) const -{ - if ( itemIndex.isValid() ) - { - auto itemTags = tags( itemIndex ); - - for ( size_t i = 0; i < itemTags.size(); ++i ) - { - QRect rect = tagRect( itemRect, itemIndex, i ); - if ( rect.contains( pos ) ) - { - *tag = itemTags[i]; - return true; - } - } - } - return false; -} } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h index 9c74240959..7409ef6b18 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h @@ -47,14 +47,13 @@ #include #include #include +#include #include #include #include #include -class MySortFilterProxyModel; - class QGridLayout; class QMenu; class QTreeView; @@ -68,6 +67,7 @@ class PdmUiItem; class PdmUiTreeViewEditor; class PdmUiTreeViewQModel; class PdmUiTreeViewWidget; +class PdmUiTreeViewItemDelegate; class PdmUiTreeViewStyle : public QProxyStyle { @@ -98,91 +98,6 @@ class PdmUiTreeViewWidget : public QTreeView void dragLeaveEvent( QDragLeaveEvent* event ) override; }; -class PdmUiTreeViewItemAttribute : public PdmUiEditorAttribute -{ -public: - struct Tag : public SignalEmitter - { - enum Position - { - IN_FRONT, - AT_END - }; - Tag() - : text() - , position( AT_END ) - , bgColor( Qt::red ) - , fgColor( Qt::white ) - , selectedOnly( false ) - , clicked( this ) - { - } - QString text; - IconProvider icon; - Position position; - QColor bgColor; - QColor fgColor; - bool selectedOnly; - - caf::Signal clicked; - - static std::unique_ptr create() { return std::unique_ptr( new Tag ); } - - private: - Tag& operator=( const Tag& rhs ) { return *this; } - }; - - std::vector> tags; -}; - -class PdmUiTreeViewItemDelegate : public QStyledItemDelegate -{ -public: - PdmUiTreeViewItemDelegate( PdmUiTreeViewEditor* parent, PdmUiTreeViewQModel* model ); - void clearTags( QModelIndex index ); - void clearAllTags(); - void addTag( QModelIndex index, std::unique_ptr tag ); - void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override; - std::vector tags( QModelIndex index ) const; - -protected: - bool editorEvent( QEvent* event, - QAbstractItemModel* model, - const QStyleOptionViewItem& option, - const QModelIndex& itemIndex ) override; - bool tagClicked( const QPoint& clickPos, - const QRect& itemRect, - const QModelIndex& itemIndex, - const PdmUiTreeViewItemAttribute::Tag** tag ) const; - QRect tagRect( const QRect& itemRect, QModelIndex itemIndex, size_t tagIndex ) const; - -private: - PdmUiTreeViewEditor* m_treeView; - PdmUiTreeViewQModel* m_model; - std::map>> m_tags; -}; - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class PdmUiTreeViewEditorAttribute : public PdmUiEditorAttribute -{ -public: - PdmUiTreeViewEditorAttribute() - : currentObject( nullptr ) - , objectForUpdateOfUiTree( nullptr ) - { - } - -public: - QStringList columnHeaders; - - /// This object is set as current item in the tree view in configureAndUpdateUi() - caf::PdmObjectHandle* currentObject; - - caf::PdmObjectHandle* objectForUpdateOfUiTree; -}; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -208,13 +123,16 @@ class PdmUiTreeViewEditor : public PdmUiTreeEditorHandle void selectedUiItems( std::vector& objects ); void setExpanded( const PdmUiItem* uiItem, bool doExpand ) const; - PdmUiItem* uiItemFromModelIndex( const QModelIndex& index ) const; - QModelIndex findModelIndex( const PdmUiItem* object ) const; + PdmUiItem* uiItemFromModelIndex( const QModelIndex& index ) const; + PdmUiTreeOrdering* uiTreeOrderingFromModelIndex( const QModelIndex& index ) const; + QModelIndex findModelIndex( const PdmUiItem* object ) const; QWidget* createWidget( QWidget* parent ) override; void setDragDropInterface( PdmUiDragDropInterface* dragDropInterface ); + void setFilterString( QString filterStr ); + signals: void selectionChanged(); @@ -231,8 +149,10 @@ private slots: private: PdmChildArrayFieldHandle* currentChildArrayFieldHandle(); + QModelIndex mapIndexIfNecessary( QModelIndex index ) const; + void updateSelectionManager(); - void updateItemDelegateForSubTree( const QModelIndex& modelIndex = QModelIndex() ); + void updateItemDelegateForSubTree( const QModelIndex& subRootIndex = QModelIndex() ); bool eventFilter( QObject* obj, QEvent* event ) override; @@ -243,6 +163,7 @@ private slots: PdmUiTreeViewWidget* m_treeView; PdmUiTreeViewQModel* m_treeViewModel; PdmUiTreeViewItemDelegate* m_delegate; + QSortFilterProxyModel* m_filterModel; bool m_useDefaultContextMenu; bool m_updateSelectionManager; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp new file mode 100644 index 0000000000..1b9c23c29e --- /dev/null +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp @@ -0,0 +1,320 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2011-2013 Ceetron AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library 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. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library 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 Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#include "cafPdmUiTreeViewItemDelegate.h" + +#include "cafPdmChildArrayField.h" +#include "cafPdmField.h" +#include "cafPdmFieldReorderCapability.h" +#include "cafPdmObject.h" +#include "cafPdmPtrArrayFieldHandle.h" +#include "cafPdmUiCommandSystemProxy.h" +#include "cafPdmUiDragDropInterface.h" +#include "cafPdmUiEditorHandle.h" +#include "cafPdmUiTreeOrdering.h" +#include "cafPdmUiTreeViewEditor.h" +#include "cafPdmUiTreeViewQModel.h" +#include "cafSelectionManager.h" + +#include +#include +#include +#include +#include +#include +#include + +namespace caf +{ +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +PdmUiTreeViewItemDelegate::PdmUiTreeViewItemDelegate( PdmUiTreeViewEditor* parent, QAbstractItemModel* model ) + : QStyledItemDelegate( parent->treeView() ) + , m_treeView( parent ) + , m_model( model ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTreeViewItemDelegate::clearTags( QModelIndex index ) +{ + m_tags.erase( index ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTreeViewItemDelegate::clearAllTags() +{ + m_tags.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTreeViewItemDelegate::addTag( QModelIndex index, std::unique_ptr tag ) +{ + std::vector>& tagList = m_tags[index]; + tagList.push_back( std::move( tag ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QRect PdmUiTreeViewItemDelegate::tagRect( const QRect& itemRect, QModelIndex index, size_t tagIndex ) const +{ + auto it = m_tags.find( index ); + if ( it == m_tags.end() ) return QRect(); + + QSize fullSize = itemRect.size(); + + QPoint offset( 0, 0 ); + + for ( size_t i = 0; i < it->second.size(); ++i ) + { + const PdmUiTreeViewItemAttribute::Tag* tag = it->second[i].get(); + if ( tag->icon.valid() ) + { + auto icon = tag->icon.icon(); + QSize iconSize = icon->actualSize( fullSize ); + QRect iconRect; + if ( tag->position == PdmUiTreeViewItemAttribute::Tag::AT_END ) + { + QPoint bottomRight = itemRect.bottomRight() - offset; + QPoint topLeft = bottomRight - QPoint( iconSize.width(), iconSize.height() ); + iconRect = QRect( topLeft, bottomRight ); + } + else + { + QPoint topLeft = itemRect.topLeft() + offset; + QPoint bottomRight = topLeft + QPoint( iconSize.width(), iconSize.height() ); + iconRect = QRect( topLeft, bottomRight ); + } + offset += QPoint( iconSize.width() + 2, 0 ); + + if ( i == tagIndex ) return iconRect; + } + } + return QRect(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTreeViewItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const +{ + QStyledItemDelegate::paint( painter, option, index ); + + auto it = m_tags.find( index ); + if ( it == m_tags.end() ) return; + + // Save painter so we can restore it + painter->save(); + + QRect rect = option.rect; + QPoint center = rect.center(); + + QSize fullSize = rect.size(); + + QPoint offset( 0, 0 ); + + for ( const std::unique_ptr& tag : it->second ) + { + if ( tag->selectedOnly && !( option.state & QStyle::State_Selected ) ) continue; + + if ( tag->icon.valid() ) + { + auto icon = tag->icon.icon(); + QSize iconSize = icon->actualSize( fullSize ); + QRect iconRect; + if ( tag->position == PdmUiTreeViewItemAttribute::Tag::AT_END ) + { + QPoint bottomRight( rect.bottomRight().x() - offset.x(), center.y() + iconSize.height() / 2 ); + QPoint topLeft( bottomRight.x() - iconSize.width(), bottomRight.y() - iconSize.height() ); + iconRect = QRect( topLeft, bottomRight ); + } + else + { + QPoint topLeft( rect.topLeft().x() + offset.x(), center.y() - iconSize.height() / 2 ); + QPoint bottomRight( topLeft.x() + iconSize.width(), topLeft.y() + iconSize.height() ); + iconRect = QRect( topLeft, bottomRight ); + } + offset += QPoint( iconSize.width() + 2, 0 ); + icon->paint( painter, iconRect ); + } + else + { + const int insideTopBottomMargins = 1; + const int insideleftRightMargins = 6; + const int outsideLeftRightMargins = 4; + + QFont font = QApplication::font(); + if ( font.pixelSize() > 0 ) + { + font.setPixelSize( std::max( 1, font.pixelSize() - 1 ) ); + } + else + { + font.setPointSize( std::max( 1, font.pointSize() - 1 ) ); + } + painter->setFont( font ); + + QString text = tag->text; + QColor bgColor = tag->bgColor; + QColor fgColor = tag->fgColor; + + QSize textSize( QFontMetrics( font ).size( Qt::TextSingleLine, text ) ); + int textDiff = ( fullSize.height() - textSize.height() ); + + QRect textRect; + if ( tag->position == PdmUiTreeViewItemAttribute::Tag::AT_END ) + { + QPoint bottomRight = rect.bottomRight() - QPoint( outsideLeftRightMargins, 0 ) - offset; + QPoint textBottomRight = bottomRight - QPoint( insideleftRightMargins, textDiff / 2 ); + QPoint textTopLeft = textBottomRight - QPoint( textSize.width(), textSize.height() ); + textRect = QRect( textTopLeft, textBottomRight ); + } + else + { + QPoint textTopLeft = QPoint( 0, rect.topLeft().y() ) + offset + + QPoint( outsideLeftRightMargins + insideleftRightMargins, +textDiff / 2 ); + QPoint textBottomRight = textTopLeft + QPoint( textSize.width(), textSize.height() ); + textRect = QRect( textTopLeft, textBottomRight ); + } + + QRect tagRect = textRect.marginsAdded( + QMargins( insideleftRightMargins, insideTopBottomMargins, insideleftRightMargins, insideTopBottomMargins ) ); + + offset += QPoint( tagRect.width() + 2, 0 ); + + QBrush brush( bgColor ); + + painter->setBrush( brush ); + painter->setPen( bgColor ); + painter->setRenderHint( QPainter::Antialiasing ); + const double xRoundingRadiusPercent = 50.0; + const double yRoundingRadiusPercent = 25.0; + painter->drawRoundedRect( tagRect, xRoundingRadiusPercent, yRoundingRadiusPercent, Qt::RelativeSize ); + + painter->setPen( fgColor ); + painter->drawText( textRect, Qt::AlignCenter, text ); + } + } + // Restore painter + painter->restore(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector PdmUiTreeViewItemDelegate::tags( QModelIndex index ) const +{ + std::vector tagPtrVector; + + auto it = m_tags.find( index ); + if ( it != m_tags.end() ) + { + for ( const auto& tag : it->second ) + { + tagPtrVector.push_back( tag.get() ); + } + } + return tagPtrVector; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool PdmUiTreeViewItemDelegate::editorEvent( QEvent* event, + QAbstractItemModel* model, + const QStyleOptionViewItem& option, + const QModelIndex& itemIndex ) +{ + if ( event->type() == QEvent::MouseButtonPress ) + { + QMouseEvent* mouseEvent = static_cast( event ); + + if ( mouseEvent->button() == Qt::LeftButton && mouseEvent->modifiers() == Qt::NoModifier ) + { + const PdmUiTreeViewItemAttribute::Tag* tag; + if ( tagClicked( mouseEvent->pos(), option.rect, itemIndex, &tag ) ) + { + QModelIndex parentIndex = itemIndex.parent(); + + auto uiItem = m_treeView->uiItemFromModelIndex( itemIndex ); + auto parentUiItem = m_treeView->uiItemFromModelIndex( parentIndex ); + + tag->clicked.send( (size_t)itemIndex.row() ); + + m_treeView->updateSubTree( parentUiItem ); + m_treeView->selectAsCurrentItem( uiItem ); + return true; + } + } + } + + return QStyledItemDelegate::editorEvent( event, model, option, itemIndex ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool PdmUiTreeViewItemDelegate::tagClicked( const QPoint& pos, + const QRect& itemRect, + const QModelIndex& itemIndex, + const PdmUiTreeViewItemAttribute::Tag** tag ) const +{ + if ( itemIndex.isValid() ) + { + auto itemTags = tags( itemIndex ); + + for ( size_t i = 0; i < itemTags.size(); ++i ) + { + QRect rect = tagRect( itemRect, itemIndex, i ); + if ( rect.contains( pos ) ) + { + *tag = itemTags[i]; + return true; + } + } + } + return false; +} + +} // namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.h new file mode 100644 index 0000000000..b63d5e2fae --- /dev/null +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.h @@ -0,0 +1,84 @@ + +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2011-2013 Ceetron AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library 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. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library 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 Lesser General Public License at <> +// for more details. +// +//################################################################################################## + +#pragma once + +#include "cafPdmUiFieldEditorHandle.h" +#include "cafPdmUiTreeAttributes.h" +#include "cafPdmUiTreeEditorHandle.h" + +#include +#include +#include +#include +#include +#include + +#include + +namespace caf +{ +class PdmUiTreeViewEditor; + +class PdmUiTreeViewItemDelegate : public QStyledItemDelegate +{ +public: + PdmUiTreeViewItemDelegate( PdmUiTreeViewEditor* parent, QAbstractItemModel* model ); + void clearTags( QModelIndex index ); + void clearAllTags(); + void addTag( QModelIndex index, std::unique_ptr tag ); + void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override; + std::vector tags( QModelIndex index ) const; + +protected: + bool editorEvent( QEvent* event, + QAbstractItemModel* model, + const QStyleOptionViewItem& option, + const QModelIndex& itemIndex ) override; + bool tagClicked( const QPoint& clickPos, + const QRect& itemRect, + const QModelIndex& itemIndex, + const PdmUiTreeViewItemAttribute::Tag** tag ) const; + QRect tagRect( const QRect& itemRect, QModelIndex itemIndex, size_t tagIndex ) const; + +private: + PdmUiTreeViewEditor* m_treeView; + QAbstractItemModel* m_model; + + std::map>> m_tags; +}; +} // namespace caf From e92e2e87649abdbda6911b4cd34dfaddba2a12d5 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 19 Jan 2022 09:50:28 +0100 Subject: [PATCH 101/406] Summary Plot: Add support for multiple plot axis. --- .../RicPlotProductionRateFeature.cpp | 2 +- .../RicSummaryCurveSwitchAxisFeature.cpp | 14 +- .../RicSummaryPlotEditorUi.cpp | 3 +- .../AnalysisPlots/RimAnalysisPlot.cpp | 10 +- .../RimCorrelationMatrixPlot.cpp | 24 +- .../CorrelationPlots/RimCorrelationPlot.cpp | 20 +- .../RimParameterResultCrossPlot.cpp | 16 +- .../Flow/RimWellDistributionPlot.cpp | 16 +- .../GridCrossPlots/RimGridCrossPlot.cpp | 30 +- .../RimSaturationPressurePlot.cpp | 2 +- .../RimGridTimeHistoryCurve.cpp | 6 +- .../RimGridTimeHistoryCurve.h | 18 +- .../RimPlotAxisProperties.cpp | 81 ++- .../ProjectDataModel/RimPlotAxisProperties.h | 48 +- .../RimPlotAxisPropertiesInterface.cpp | 31 +- .../RimPlotAxisPropertiesInterface.h | 26 +- .../ProjectDataModel/RimPlotCurve.cpp | 2 +- .../ProjectDataModel/RimPlotCurve.h | 3 +- .../ProjectDataModel/RimVfpPlot.cpp | 16 +- .../Summary/RimAsciiDataCurve.cpp | 4 +- .../Summary/RimAsciiDataCurve.h | 6 +- .../Summary/RimEnsembleCurveSet.cpp | 52 +- .../Summary/RimEnsembleCurveSet.h | 12 +- .../Summary/RimSummaryCrossPlot.cpp | 3 +- .../Summary/RimSummaryCurve.cpp | 45 +- .../Summary/RimSummaryCurve.h | 9 +- .../Summary/RimSummaryPlot.cpp | 553 +++++++++--------- .../ProjectDataModel/Summary/RimSummaryPlot.h | 49 +- .../Summary/RimSummaryPlotAxisFormatter.cpp | 8 +- .../Summary/RimSummaryTimeAxisProperties.cpp | 12 +- .../Summary/RimSummaryTimeAxisProperties.h | 20 +- .../WellLog/RimWellLogCurve.cpp | 4 +- .../WellLog/RimWellLogExtractionCurve.cpp | 2 +- .../WellLog/RimWellLogRftCurve.cpp | 8 +- .../WellLog/RimWellLogTrack.cpp | 38 +- .../UserInterface/CMakeLists_files.cmake | 2 + .../UserInterface/RiuMultiPlotPage.cpp | 6 +- .../UserInterface/RiuPlotAxis.cpp | 120 ++++ .../UserInterface/RiuPlotAxis.h | 46 ++ .../UserInterface/RiuPlotCurve.h | 4 +- .../UserInterface/RiuPlotWidget.h | 91 +-- .../UserInterface/RiuQtChartsPlotCurve.cpp | 8 +- .../UserInterface/RiuQtChartsPlotCurve.h | 8 +- .../UserInterface/RiuQtChartsPlotTools.cpp | 14 +- .../UserInterface/RiuQtChartsPlotWidget.cpp | 197 ++++--- .../UserInterface/RiuQtChartsPlotWidget.h | 106 ++-- .../UserInterface/RiuQwtPlotCurve.cpp | 8 +- .../UserInterface/RiuQwtPlotCurve.h | 4 +- .../UserInterface/RiuQwtPlotWidget.cpp | 154 ++--- .../UserInterface/RiuQwtPlotWidget.h | 85 +-- .../RiuRelativePermeabilityPlotPanel.cpp | 2 +- .../UserInterface/RiuSummaryQtChartsPlot.cpp | 4 +- .../UserInterface/RiuSummaryQwtPlot.cpp | 2 +- .../UserInterface/RiuWellLogTrack.cpp | 2 +- 54 files changed, 1225 insertions(+), 831 deletions(-) create mode 100644 ApplicationLibCode/UserInterface/RiuPlotAxis.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuPlotAxis.h diff --git a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp index c5239638d9..1902028c74 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp @@ -278,7 +278,7 @@ RimSummaryCurve* RicPlotProductionRateFeature::addSummaryCurve( RimSummaryPlot* newCurve->setSummaryCaseY( gridSummaryCase ); newCurve->setSummaryAddressYAndApplyInterpolation( addr ); newCurve->setColor( color ); - newCurve->setLeftOrRightAxisY( plotAxis ); + newCurve->setLeftOrRightAxisY( RiuPlotAxis( plotAxis ) ); newCurve->loadDataAndUpdate( true ); return newCurve; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp index 196e27cd7c..02680d09dd 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.cpp @@ -56,15 +56,15 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered( bool isChecked ) for ( RimSummaryCurve* summaryCurve : summaryCurves ) { - RiaDefines::PlotAxis plotAxis = summaryCurve->axisY(); + RiaDefines::PlotAxis plotAxis = summaryCurve->axisY().axis(); if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) { - summaryCurve->setLeftOrRightAxisY( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); + summaryCurve->setLeftOrRightAxisY( RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) ); } else { - summaryCurve->setLeftOrRightAxisY( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); + summaryCurve->setLeftOrRightAxisY( RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) ); } summaryCurve->updatePlotAxis(); @@ -77,9 +77,9 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered( bool isChecked ) for ( RimAsciiDataCurve* asciiCurve : asciiDataCurves ) { - RiaDefines::PlotAxis plotAxis = asciiCurve->yAxis(); + RiuPlotAxis plotAxis = asciiCurve->yAxis(); - if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) + if ( plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) { asciiCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); } @@ -98,9 +98,9 @@ void RicSummaryCurveSwitchAxisFeature::onActionTriggered( bool isChecked ) for ( RimGridTimeHistoryCurve* timeHistoryCurve : gridTimeHistoryCurves ) { - RiaDefines::PlotAxis plotAxis = timeHistoryCurve->yAxis(); + RiuPlotAxis plotAxis = timeHistoryCurve->yAxis(); - if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) + if ( plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) { timeHistoryCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index 00c738e84c..6d485b7b33 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -713,7 +713,8 @@ void RicSummaryPlotEditorUi::copyCurveAndAddToPlot( const RimSummaryCurve* curve curveCopy->setCurveVisibility( true ); } - plot->addCurveNoUpdate( curveCopy ); + plot->addCurveNoUpdate( curveCopy, false ); + curveCopy->setLeftOrRightAxisY( curve->axisY() ); // The curve creator is not a descendant of the project, and need to be set manually curveCopy->setSummaryCaseY( curve->summaryCaseY() ); diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index 69933ea188..5c26851b52 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -873,22 +873,22 @@ void RimAnalysisPlot::updateAxes() { if ( !m_plotWidget ) return; - RiaDefines::PlotAxis axis = RiaDefines::PlotAxis::PLOT_AXIS_LEFT; + RiuPlotAxis axis = RiuPlotAxis::defaultLeft(); if ( m_barOrientation == BARS_HORIZONTAL ) { - axis = RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM; - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, false ); + axis = RiuPlotAxis::defaultBottom(); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), false ); } else { - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, false ); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), false ); } RimPlotAxisProperties* valAxisProperties = m_valueAxisProperties(); if ( valAxisProperties->isActive() ) { m_plotWidget->enableAxis( axis, true ); - m_valueAxisProperties->setNameAndAxis( "Value-Axis", axis ); + m_valueAxisProperties->setNameAndAxis( "Value-Axis", axis.axis() ); RimSummaryPlotAxisFormatter calc( valAxisProperties, {}, curveDefinitions(), {}, {} ); calc.applyAxisPropertiesToPlot( m_plotWidget ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index face4acc3a..3b5cdcaecc 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -402,16 +402,16 @@ void RimCorrelationMatrixPlot::updateAxes() m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::yLeft, new TextScaleDraw( m_resultLabels ) ); m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new RiuQwtLinearScaleEngine ); - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "Result Vector" ); - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); - m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), "Result Vector" ); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true ); + m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultLeft(), axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter ); - m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true, false ); - m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0.0, (double)m_resultLabels.size() + 1 ); - m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultLeft(), true, false ); + m_plotWidget->setAxisRange( RiuPlotAxis::defaultLeft(), 0.0, (double)m_resultLabels.size() + 1 ); + m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis::defaultLeft(), 1.0, 0.0, 0.5, @@ -423,16 +423,16 @@ void RimCorrelationMatrixPlot::updateAxes() scaleDraw->setLabelRotation( 30.0 ); m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::xBottom, scaleDraw ); m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine ); - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Ensemble Parameter" ); - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "Ensemble Parameter" ); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true ); + m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(), axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter | Qt::AlignTop ); - m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true, false ); - m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0.0, (double)m_paramLabels.size() + 1 ); - m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, + m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultBottom(), true, false ); + m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), 0.0, (double)m_paramLabels.size() + 1 ); + m_plotWidget->setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis::defaultBottom(), 1.0, 0.0, 0.5, diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp index 3d36441293..9d5ad0e1fe 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp @@ -206,30 +206,30 @@ void RimCorrelationPlot::updateAxes() { if ( !m_plotWidget ) return; - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "Parameter" ); - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); - m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), "Parameter" ); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true ); + m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultLeft(), axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter ); - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Pearson Correlation Coefficient" ); - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "Pearson Correlation Coefficient" ); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true ); + m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(), axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter ); if ( m_showAbsoluteValues ) { - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Pearson Correlation Coefficient ABS" ); - m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0.0, 1.0 ); + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "Pearson Correlation Coefficient ABS" ); + m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), 0.0, 1.0 ); } else { - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "Pearson Correlation Coefficient" ); - m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, -1.0, 1.0 ); + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "Pearson Correlation Coefficient" ); + m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), -1.0, 1.0 ); } } diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp index 23d7af2481..0f9c6abc51 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp @@ -188,29 +188,29 @@ void RimParameterResultCrossPlot::updateAxes() { if ( !m_plotWidget ) return; - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, completeAddressText() ); - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); - m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), completeAddressText() ); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true ); + m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultLeft(), axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter ); double yRangeWidth = m_yRange.second - m_yRange.first; - m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + m_plotWidget->setAxisRange( RiuPlotAxis::defaultLeft(), m_yRange.first - yRangeWidth * 0.1, m_yRange.second + yRangeWidth * 0.1 ); - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_ensembleParameter ); - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - m_plotWidget->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), m_ensembleParameter ); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true ); + m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(), axisTitleFontSize(), axisValueFontSize(), false, Qt::AlignCenter ); double xRangeWidth = m_xRange.second - m_xRange.first; - m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, + m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), m_xRange.first - xRangeWidth * 0.1, m_xRange.second + xRangeWidth * 0.1 ); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp index 6c2c861097..b7d01acf39 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp @@ -376,10 +376,10 @@ void RimWellDistributionPlot::onLoadDataAndUpdate() QString( "%1 Distribution: %2, %3" ).arg( phaseString ).arg( m_wellName ).arg( timeStepName ); m_plotWidget->setPlotTitle( plotTitleStr ); - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, "TOF [years]" ); - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "Reservoir Volume [m3]" ); - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "TOF [years]" ); + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), "Reservoir Volume [m3]" ); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true ); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true ); m_plotWidget->scheduleReplot(); } @@ -398,10 +398,10 @@ void RimWellDistributionPlot::populatePlotWidgetWithCurveData( const RigTofWellD const double baseCurveZValue = 9.5; plotWidget->qwtPlot()->detachItems( QwtPlotItem::Rtti_PlotCurve ); - plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0, 1 ); - plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0, 1 ); - plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); + plotWidget->setAxisScale( RiuPlotAxis::defaultBottom(), 0, 1 ); + plotWidget->setAxisScale( RiuPlotAxis::defaultLeft(), 0, 1 ); + plotWidget->setAxisAutoScale( RiuPlotAxis::defaultBottom(), true ); + plotWidget->setAxisAutoScale( RiuPlotAxis::defaultLeft(), true ); const std::vector& tofValuesDays = calculator.sortedUniqueTofValues(); if ( tofValuesDays.size() == 0 ) diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index e600e90909..87821173b8 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -641,10 +641,10 @@ void RimGridCrossPlot::swapAxes() RimPlotAxisProperties* xAxisProperties = m_xAxisProperties(); RimPlotAxisProperties* yAxisProperties = m_yAxisProperties(); - QString tmpName = xAxisProperties->name(); - RiaDefines::PlotAxis tmpAxis = xAxisProperties->plotAxisType(); - xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->plotAxisType() ); - yAxisProperties->setNameAndAxis( tmpName, tmpAxis ); + QString tmpName = xAxisProperties->name(); + RiuPlotAxis tmpAxis = xAxisProperties->plotAxisType(); + xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->plotAxisType().axis() ); + yAxisProperties->setNameAndAxis( tmpName, tmpAxis.axis() ); m_xAxisProperties.removeChildObject( xAxisProperties ); m_yAxisProperties.removeChildObject( yAxisProperties ); @@ -851,7 +851,7 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType ) axisParameterString = yAxisParameterString(); } - RiaDefines::PlotAxis axis = axisProperties->plotAxisType(); + RiuPlotAxis axis = axisProperties->plotAxisType(); if ( axisProperties->isActive() ) { m_plotWidget->enableAxis( axis, true ); @@ -869,7 +869,7 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType ) m_plotWidget->setAxisTitleText( axis, axisParameterString ); m_plotWidget->setAxisTitleEnabled( axis, true ); - if ( axisProperties->isLogarithmicScaleEnabled ) + if ( axisProperties->isLogarithmicScaleEnabled() ) { bool isLogScale = m_plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC; if ( !isLogScale ) @@ -878,12 +878,12 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType ) m_plotWidget->setAxisMaxMinor( axis, 5 ); } - double min = axisProperties->visibleRangeMin; - double max = axisProperties->visibleRangeMax; + double min = axisProperties->visibleRangeMin(); + double max = axisProperties->visibleRangeMax(); if ( axisProperties->isAutoZoom() ) { std::vector plotCurves = visibleCurves(); - RimPlotAxisLogRangeCalculator logRangeCalculator( axis, plotCurves ); + RimPlotAxisLogRangeCalculator logRangeCalculator( axis.axis(), plotCurves ); logRangeCalculator.computeAxisRange( &min, &max ); } @@ -909,8 +909,8 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType ) } else { - double min = axisProperties->visibleRangeMin; - double max = axisProperties->visibleRangeMax; + double min = axisProperties->visibleRangeMin(); + double max = axisProperties->visibleRangeMax(); if ( axisProperties->isAxisInverted() ) { std::swap( min, max ); @@ -933,7 +933,7 @@ void RimGridCrossPlot::updateAxisFromQwt( RiaDefines::PlotAxis axisType ) { if ( !m_plotWidget ) return; - auto [xAxisRangeMin, xAxisRangeMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); + auto [xAxisRangeMin, xAxisRangeMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultBottom() ); RimPlotAxisProperties* axisProperties = m_xAxisProperties(); double axisRangeMin = xAxisRangeMin; @@ -942,14 +942,14 @@ void RimGridCrossPlot::updateAxisFromQwt( RiaDefines::PlotAxis axisType ) if ( axisType == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) { axisProperties = m_yAxisProperties(); - auto [yAxisRangeMin, yAxisRangeMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); + auto [yAxisRangeMin, yAxisRangeMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultLeft() ); axisRangeMin = yAxisRangeMin; axisRangeMax = yAxisRangeMax; } - axisProperties->visibleRangeMin = std::min( axisRangeMin, axisRangeMax ); - axisProperties->visibleRangeMax = std::max( axisRangeMin, axisRangeMax ); + axisProperties->setVisibleRangeMin( std::min( axisRangeMin, axisRangeMax ) ); + axisProperties->setVisibleRangeMax( std::max( axisRangeMin, axisRangeMax ) ); axisProperties->updateConnectedEditors(); } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp index 19c38dd986..dcf050ed69 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlot.cpp @@ -169,7 +169,7 @@ void RimSaturationPressurePlot::assignCaseAndEquilibriumRegion( RiaDefines::Poro } RimPlotAxisProperties* yAxisProps = yAxisProperties(); - yAxisProps->setInvertedAxis( true ); + yAxisProps->setAxisInverted( true ); { RimEquilibriumAxisAnnotation* annotation = new RimEquilibriumAxisAnnotation; diff --git a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp index ed4fc2da8b..0dd04af733 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp @@ -189,9 +189,9 @@ RigGridCellResultAddress RimGridTimeHistoryCurve::resultAddress() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaDefines::PlotAxis RimGridTimeHistoryCurve::yAxis() const +RiuPlotAxis RimGridTimeHistoryCurve::yAxis() const { - return m_plotAxis(); + return RiuPlotAxis( m_plotAxis() ); } //-------------------------------------------------------------------------------------------------- @@ -408,7 +408,7 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate( bool updateParentPlot ) RimSummaryPlot* plot = nullptr; firstAncestorOrThisOfType( plot ); - bool isLogCurve = plot->isLogarithmicScaleEnabled( this->yAxis() ); + bool isLogCurve = plot->isLogarithmicScaleEnabled( yAxis() ); if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.h b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.h index e6a4f3622b..88c68b9f35 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.h @@ -53,15 +53,15 @@ class RimGridTimeHistoryCurve : public RimPlotCurve RimGridTimeHistoryCurve(); ~RimGridTimeHistoryCurve() override; - void setFromSelectionItem( const RiuSelectionItem* selectionItem ); - void setFromEclipseCellAndResult( RimEclipseCase* eclCase, - size_t gridIdx, - size_t i, - size_t j, - size_t k, - const RigEclipseResultAddress& resAddr ); - RiaDefines::PlotAxis yAxis() const; - void setYAxis( RiaDefines::PlotAxis plotAxis ); + void setFromSelectionItem( const RiuSelectionItem* selectionItem ); + void setFromEclipseCellAndResult( RimEclipseCase* eclCase, + size_t gridIdx, + size_t i, + size_t j, + size_t k, + const RigEclipseResultAddress& resAddr ); + RiuPlotAxis yAxis() const; + void setYAxis( RiaDefines::PlotAxis plotAxis ); std::vector yValues() const; std::vector timeStepValues() const; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index e5067bbb03..276c3451f3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -70,17 +70,21 @@ RimPlotAxisProperties::RimPlotAxisProperties() CAF_PDM_InitFieldNoDefault( &customTitle, "CustomTitle", "Title" ); - CAF_PDM_InitField( &visibleRangeMax, "VisibleRangeMax", RiaDefines::maximumDefaultValuePlot(), "Max" ); - CAF_PDM_InitField( &visibleRangeMin, "VisibleRangeMin", RiaDefines::minimumDefaultValuePlot(), "Min" ); + CAF_PDM_InitField( &m_visibleRangeMax, "VisibleRangeMax", RiaDefines::maximumDefaultValuePlot(), "Max" ); + CAF_PDM_InitField( &m_visibleRangeMin, "VisibleRangeMin", RiaDefines::minimumDefaultValuePlot(), "Min" ); CAF_PDM_InitFieldNoDefault( &numberFormat, "NumberFormat", "Number Format" ); CAF_PDM_InitField( &numberOfDecimals, "Decimals", 2, "Number of Decimals" ); CAF_PDM_InitField( &scaleFactor, "ScaleFactor", 1.0, "Scale Factor" ); CAF_PDM_InitField( &m_isAutoZoom, "AutoZoom", true, "Set Range Automatically" ); - CAF_PDM_InitField( &isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale" ); + CAF_PDM_InitField( &m_isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale" ); CAF_PDM_InitField( &m_isAxisInverted, "AxisInverted", false, "Invert Axis" ); + auto defaultPlotAxis = caf::AppEnum( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); + CAF_PDM_InitField( &m_plotAxis, "PlotAxis", defaultPlotAxis, "Plot Axis" ); + CAF_PDM_InitField( &m_plotAxisIndex, "PlotAxisIndex", 0, "Plot Axis Index" ); + CAF_PDM_InitFieldNoDefault( &m_titlePositionEnum, "TitlePosition", "Title Position" ); CAF_PDM_InitFieldNoDefault( &m_titleFontSize, "TitleDeltaFontSize", "Font Size" ); @@ -178,7 +182,7 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr caf::PdmUiGroup& scaleGroup = *( uiOrdering.addNewGroup( "Axis Values" ) ); if ( m_isRangeSettingsEnabled ) { - scaleGroup.add( &isLogarithmicScaleEnabled ); + scaleGroup.add( &m_isLogarithmicScaleEnabled ); scaleGroup.add( &m_isAxisInverted ); } scaleGroup.add( &numberFormat ); @@ -190,8 +194,8 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr scaleGroup.add( &scaleFactor ); if ( m_isRangeSettingsEnabled ) { - scaleGroup.add( &visibleRangeMin ); - scaleGroup.add( &visibleRangeMax ); + scaleGroup.add( &m_visibleRangeMin ); + scaleGroup.add( &m_visibleRangeMax ); } scaleGroup.add( &m_valuesFontSize ); @@ -201,13 +205,16 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotAxisProperties::setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis ) +void RimPlotAxisProperties::setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis, int axisIndex ) { - m_name = name; - m_axis = axis; + m_name = name; + m_plotAxis = axis; + m_plotAxisIndex = axisIndex; + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) this->setUiIconFromResourceString( ":/LeftAxis16x16.png" ); if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) this->setUiIconFromResourceString( ":/RightAxis16x16.png" ); if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) this->setUiIconFromResourceString( ":/BottomAxis16x16.png" ); + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_TOP ) this->setUiIconFromResourceString( ":/TopAxis16x16.png" ); } //-------------------------------------------------------------------------------------------------- @@ -237,17 +244,17 @@ int RimPlotAxisProperties::valuesFontSize() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimPlotAxisProperties::name() const +const QString& RimPlotAxisProperties::name() const { - return m_name; + return m_name(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaDefines::PlotAxis RimPlotAxisProperties::plotAxisType() const +RiuPlotAxis RimPlotAxisProperties::plotAxisType() const { - return m_axis; + return RiuPlotAxis( m_plotAxis.value(), m_plotAxisIndex ); } //-------------------------------------------------------------------------------------------------- @@ -349,9 +356,33 @@ bool RimPlotAxisProperties::isActive() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotAxisProperties::setInvertedAxis( bool enable ) +double RimPlotAxisProperties::visibleRangeMin() const +{ + return m_visibleRangeMin; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimPlotAxisProperties::visibleRangeMax() const +{ + return m_visibleRangeMax; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::setVisibleRangeMin( double value ) { - m_isAxisInverted = enable; + m_visibleRangeMin = value; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::setVisibleRangeMax( double value ) +{ + m_visibleRangeMax = value; } //-------------------------------------------------------------------------------------------------- @@ -373,22 +404,22 @@ void RimPlotAxisProperties::fieldChangedByUi( const caf::PdmFieldHandle* changed { updateOptionSensitivity(); } - else if ( changedField == &visibleRangeMax ) + else if ( changedField == &m_visibleRangeMax ) { - if ( visibleRangeMin > visibleRangeMax ) visibleRangeMax = oldValue.toDouble(); + if ( m_visibleRangeMin > m_visibleRangeMax ) m_visibleRangeMax = oldValue.toDouble(); m_isAutoZoom = false; } - else if ( changedField == &visibleRangeMin ) + else if ( changedField == &m_visibleRangeMin ) { - if ( visibleRangeMin > visibleRangeMax ) visibleRangeMin = oldValue.toDouble(); + if ( m_visibleRangeMin > m_visibleRangeMax ) m_visibleRangeMin = oldValue.toDouble(); m_isAutoZoom = false; } - if ( changedField == &isLogarithmicScaleEnabled ) + if ( changedField == &m_isLogarithmicScaleEnabled ) { - logarithmicChanged.send( isLogarithmicScaleEnabled() ); + logarithmicChanged.send( m_isLogarithmicScaleEnabled() ); } else { @@ -427,3 +458,11 @@ caf::PdmFieldHandle* RimPlotAxisProperties::objectToggleField() { return &m_isActive; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotAxisProperties::isLogarithmicScaleEnabled() const +{ + return m_isLogarithmicScaleEnabled; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index 26f4994945..58057966b8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -22,6 +22,8 @@ #include "RiaDefines.h" #include "RimPlotAxisPropertiesInterface.h" +#include "RiuPlotAxis.h" + #include "cafAppEnum.h" #include "cafFontTools.h" #include "cafPdmChildArrayField.h" @@ -36,7 +38,7 @@ class RimPlotAxisAnnotation; /// /// //================================================================================================== -class RimPlotAxisProperties : public caf::PdmObject, public RimPlotAxisPropertiesInterface +class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface { CAF_PDM_HEADER_INIT; @@ -57,22 +59,22 @@ class RimPlotAxisProperties : public caf::PdmObject, public RimPlotAxisPropertie void setEnableTitleTextSettings( bool enable ); void enableRangeSettings( bool enable ); - void setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis ); + void setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis, int axisIndex = 0 ); AxisTitlePositionType titlePosition() const override; int titleFontSize() const override; int valuesFontSize() const override; - QString name() const; - RiaDefines::PlotAxis plotAxisType() const override; - bool useAutoTitle() const; - bool showDescription() const; - bool showAcronym() const; - bool showUnitText() const; - bool isAutoZoom() const; - void setAutoZoom( bool enableAutoZoom ); - bool isAxisInverted() const; - void setAxisInverted( bool inverted ); + const QString& name() const override; + RiuPlotAxis plotAxisType() const override; + bool useAutoTitle() const; + bool showDescription() const; + bool showAcronym() const; + bool showUnitText() const; + bool isAutoZoom() const override; + void setAutoZoom( bool enableAutoZoom ) override; + bool isAxisInverted() const override; + void setAxisInverted( bool inverted ); std::vector annotations() const override; void appendAnnotation( RimPlotAxisAnnotation* annotation ) override; @@ -80,19 +82,21 @@ class RimPlotAxisProperties : public caf::PdmObject, public RimPlotAxisPropertie caf::PdmField customTitle; - caf::PdmField visibleRangeMin; - caf::PdmField visibleRangeMax; - caf::PdmField> numberFormat; caf::PdmField numberOfDecimals; caf::PdmField scaleFactor; - caf::PdmField isLogarithmicScaleEnabled; - bool isActive() const; + bool isLogarithmicScaleEnabled() const override; + bool isActive() const override; - void setInvertedAxis( bool enable ); void showAnnotationObjectsInProjectTree(); + double visibleRangeMin() const override; + double visibleRangeMax() const override; + + void setVisibleRangeMin( double value ) override; + void setVisibleRangeMax( double value ) override; + protected: void initAfterRead() override; caf::PdmFieldHandle* userDescriptionField() override; @@ -117,8 +121,14 @@ class RimPlotAxisProperties : public caf::PdmObject, public RimPlotAxisPropertie caf::PdmField m_isAutoZoom; caf::PdmField m_isAxisInverted; + caf::PdmField m_visibleRangeMin; + caf::PdmField m_visibleRangeMax; + caf::PdmField m_name; - RiaDefines::PlotAxis m_axis; + caf::PdmField> m_plotAxis; + caf::PdmField m_plotAxisIndex; + + caf::PdmField m_isLogarithmicScaleEnabled; bool m_enableTitleTextSettings; bool m_isRangeSettingsEnabled; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp index c07e154f7c..2421e4599c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp @@ -19,25 +19,44 @@ #include "cafAppEnum.h" -// clang-format off +CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotAxisPropertiesInterface, + "PlotAxisPropertiesInterface", + "RimPlotAxisPropertiesInterface" ); + namespace caf { -template<> +template <> void caf::AppEnum::setUp() { - addItem(RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER, "AXIS_TITLE_CENTER", "Center"); - addItem(RimPlotAxisPropertiesInterface::AXIS_TITLE_END, "AXIS_TITLE_END", "At End"); + addItem( RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER, "AXIS_TITLE_CENTER", "Center" ); + addItem( RimPlotAxisPropertiesInterface::AXIS_TITLE_END, "AXIS_TITLE_END", "At End" ); - setDefault(RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER); + setDefault( RimPlotAxisPropertiesInterface::AXIS_TITLE_CENTER ); } template <> void RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum::setUp() { - addItem(RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW, "VERY_FEW", "Very Few"); + addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW, "VERY_FEW", "Very Few" ); addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW, "Few", "Few" ); addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT, "Default", "Default" ); addItem( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_MANY, "Many", "Many" ); setDefault( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT ); } } // namespace caf + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotAxisPropertiesInterface::isAxisInverted() const +{ + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotAxisPropertiesInterface::isLogarithmicScaleEnabled() const +{ + return false; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h index 39ac415775..eb5462f622 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h @@ -20,12 +20,17 @@ #include "RiaPlotDefines.h" +#include "RiuPlotAxis.h" + #include "cafAppEnum.h" +#include "cafPdmObject.h" class RimPlotAxisAnnotation; -class RimPlotAxisPropertiesInterface +class RimPlotAxisPropertiesInterface : public caf::PdmObject { + CAF_PDM_HEADER_INIT; + public: enum AxisTitlePositionType { @@ -45,7 +50,24 @@ class RimPlotAxisPropertiesInterface virtual std::vector annotations() const = 0; virtual void appendAnnotation( RimPlotAxisAnnotation* annotation ) = 0; virtual void removeAllAnnotations() = 0; - virtual RiaDefines::PlotAxis plotAxisType() const = 0; + virtual RiuPlotAxis plotAxisType() const = 0; + + virtual double visibleRangeMin() const = 0; + virtual double visibleRangeMax() const = 0; + + virtual void setVisibleRangeMin( double value ) = 0; + virtual void setVisibleRangeMax( double value ) = 0; + + virtual bool isAutoZoom() const = 0; + virtual void setAutoZoom( bool enableAutoZoom ) = 0; + + virtual bool isActive() const = 0; + + virtual const QString& name() const = 0; + + virtual bool isAxisInverted() const; + + virtual bool isLogarithmicScaleEnabled() const; public: virtual AxisTitlePositionType titlePosition() const = 0; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index 2daad80109..08b66460f5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -736,7 +736,7 @@ void RimPlotCurve::setSamplesFromXYErrorValues( const std::vector& xVa //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotCurve::updateAxisInPlot( RiaDefines::PlotAxis plotAxis ) +void RimPlotCurve::updateAxisInPlot( RiuPlotAxis plotAxis ) { if ( m_plotCurve ) m_plotCurve->setYAxis( plotAxis ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h index fb034ad6c4..f070c889dc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h @@ -24,6 +24,7 @@ #include "RiaCurveDataTools.h" #include "RiaPlotDefines.h" +#include "RiuPlotAxis.h" #include "RiuQwtPlotCurveDefines.h" #include "RiuQwtSymbol.h" @@ -170,7 +171,7 @@ class RimPlotCurve : public caf::PdmObject virtual void clearErrorBars(); void checkAndApplyDefaultFillColor(); - virtual void updateAxisInPlot( RiaDefines::PlotAxis plotAxis ); + virtual void updateAxisInPlot( RiuPlotAxis plotAxis ); protected: caf::PdmField m_showCurve; diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp index 0e3caef211..370e228031 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp @@ -465,8 +465,8 @@ void RimVfpPlot::onLoadDataAndUpdate() m_primaryVariable(), m_familyVariable() ) ); - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - m_plotWidget->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true ); + m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true ); } m_plotWidget->scheduleReplot(); @@ -551,12 +551,12 @@ void RimVfpPlot::populatePlotWidgetWithCurveData( RiuPlotWidget* void RimVfpPlot::populatePlotWidgetWithPlotData( RiuPlotWidget* plotWidget, const VfpPlotData& plotData ) { plotWidget->detachItems( RiuPlotWidget::PlotItemType::CURVE ); - plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0, 1 ); - plotWidget->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0, 1 ); - plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - plotWidget->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); - plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, plotData.xAxisTitle() ); - plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, plotData.yAxisTitle() ); + plotWidget->setAxisScale( RiuPlotAxis::defaultBottom(), 0, 1 ); + plotWidget->setAxisScale( RiuPlotAxis::defaultLeft(), 0, 1 ); + plotWidget->setAxisAutoScale( RiuPlotAxis::defaultBottom(), true ); + plotWidget->setAxisAutoScale( RiuPlotAxis::defaultLeft(), true ); + plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), plotData.xAxisTitle() ); + plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), plotData.yAxisTitle() ); for ( auto idx = 0u; idx < plotData.size(); idx++ ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp index cd49e4e8ff..6d6b6a5e71 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp @@ -96,9 +96,9 @@ void RimAsciiDataCurve::setYAxis( RiaDefines::PlotAxis plotAxis ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaDefines::PlotAxis RimAsciiDataCurve::yAxis() const +RiuPlotAxis RimAsciiDataCurve::yAxis() const { - return m_plotAxis(); + return RiuPlotAxis( m_plotAxis() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h index 1fab04ea7e..8ad41e539d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.h @@ -52,9 +52,9 @@ class RimAsciiDataCurve : public RimPlotCurve std::vector yValues() const; const std::vector& timeSteps() const; - void setYAxis( RiaDefines::PlotAxis plotAxis ); - RiaDefines::PlotAxis yAxis() const; - void updateQwtPlotAxis(); + void setYAxis( RiaDefines::PlotAxis plotAxis ); + RiuPlotAxis yAxis() const; + void updateQwtPlotAxis(); void setTimeSteps( const std::vector& timeSteps ); void setValues( const std::vector& values ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 2973996fd1..9be8b37b13 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -41,6 +41,7 @@ #include "RimEnsembleStatisticsCase.h" #include "RimObjectiveFunction.h" #include "RimObjectiveFunctionTools.h" +#include "RimPlotAxisPropertiesInterface.h" #include "RimProject.h" #include "RimRegularLegendConfig.h" #include "RimSummaryAddress.h" @@ -160,7 +161,10 @@ RimEnsembleCurveSet::RimEnsembleCurveSet() m_selectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_selectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); - CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis" ); + CAF_PDM_InitFieldNoDefault( &m_plotAxis_OBSOLETE, "PlotAxis", "Axis" ); + m_plotAxis_OBSOLETE.xmlCapability()->setIOWritable( false ); + + CAF_PDM_InitFieldNoDefault( &m_plotAxisProperties, "Axis", "Axis" ); CAF_PDM_InitFieldNoDefault( &m_legendConfig, "LegendConfig", "" ); m_legendConfig = new RimRegularLegendConfig(); @@ -619,7 +623,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi if ( changedField == &m_showCurves ) { - if ( !m_showCurves() ) + if ( !m_showCurves() && m_plotCurveForLegendText ) { // Need to detach the legend since the plot type might change from Qwt to QtCharts. // The plot curve for legend text needs to be recreated when curves are shown next time. @@ -740,11 +744,11 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi updateCurveColors(); updateTimeAnnotations(); } - else if ( changedField == &m_plotAxis ) + else if ( changedField == &m_plotAxisProperties ) { for ( RimSummaryCurve* curve : curves() ) { - curve->setLeftOrRightAxisY( m_plotAxis() ); + curve->setLeftOrRightAxisY( axisY() ); } updatePlotAxis(); @@ -865,7 +869,7 @@ void RimEnsembleCurveSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde curveDataGroup->add( &m_yValuesSummaryAddressUiField ); curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } ); curveDataGroup->add( &m_resampling ); - curveDataGroup->add( &m_plotAxis ); + curveDataGroup->add( &m_plotAxisProperties ); } appendColorGroup( uiOrdering ); @@ -1208,6 +1212,16 @@ QList RimEnsembleCurveSet::calculateValueOptions( const options.push_back( caf::PdmOptionItemInfo( name, objFunc ) ); } } + else if ( fieldNeedingOptions == &m_plotAxisProperties ) + { + RimSummaryPlot* plot = nullptr; + firstAncestorOrThisOfTypeAsserted( plot ); + + for ( auto axis : plot->plotAxes() ) + { + options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) ); + } + } return options; } @@ -1682,11 +1696,11 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectorsetSummaryCaseY( sumCase ); curve->setSummaryAddressYAndApplyInterpolation( addr->address() ); - curve->setLeftOrRightAxisY( m_plotAxis() ); curve->setResampling( m_resampling() ); addCurve( curve ); + curve->setLeftOrRightAxisY( axisY() ); curve->updateCurveVisibility(); newSummaryCurves.push_back( curve ); @@ -1793,7 +1807,7 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vectorsetLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); curve->setSummaryCaseY( m_ensembleStatCase.get() ); curve->setSummaryAddressYAndApplyInterpolation( address ); - curve->setLeftOrRightAxisY( m_plotAxis() ); + curve->setLeftOrRightAxisY( axisY() ); curve->updateCurveVisibility(); curve->loadDataAndUpdate( false ); @@ -2065,3 +2079,27 @@ int statisticsCurveSymbolSize( RiuPlotCurveSymbol::PointSymbolEnum symbol ) if ( symbol == RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE ) return 7; return 6; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RimEnsembleCurveSet::axisY() const +{ + if ( m_plotAxisProperties ) + return m_plotAxisProperties->plotAxisType(); + else + return RiuPlotAxis::defaultLeft(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEnsembleCurveSet::initAfterRead() +{ + if ( m_plotAxisProperties.value() == nullptr ) + { + RimSummaryPlot* plot = nullptr; + firstAncestorOrThisOfTypeAsserted( plot ); + m_plotAxisProperties = plot->axisPropertiesForPlotAxis( RiuPlotAxis( m_plotAxis_OBSOLETE() ) ); + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index 2bb87b6688..9f69a2c564 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -34,6 +34,8 @@ #include "RigEnsembleParameter.h" +#include "RiuPlotAxis.h" + #include "cafAppEnum.h" #include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" @@ -63,6 +65,7 @@ class RiaSummaryCurveDefinition; class RiuSummaryVectorSelectionDialog; class RiuPlotWidget; class RiuPlotCurve; +class RimPlotAxisPropertiesInterface; class QwtPlot; class QwtPlotCurve; @@ -164,6 +167,9 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt std::vector generateColorsForCases( const std::vector& summaryCases ) const; +protected: + void initAfterRead() override; + private: void updateEnsembleCurves( const std::vector& sumCases ); void updateStatisticsCurves( const std::vector& sumCases ); @@ -186,7 +192,8 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - void updatePlotAxis(); + void updatePlotAxis(); + RiuPlotAxis axisY() const; QString createAutoName() const; @@ -228,7 +235,8 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt caf::PdmField m_timeStepFilter; caf::PdmField> m_selectedTimeSteps; - caf::PdmField> m_plotAxis; + caf::PdmField> m_plotAxis_OBSOLETE; + caf::PdmPtrField m_plotAxisProperties; caf::PdmChildField m_legendConfig; caf::PdmChildField m_curveFilters; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp index cf0ccea526..6abeb75401 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlot.cpp @@ -27,10 +27,9 @@ CAF_PDM_SOURCE_INIT( RimSummaryCrossPlot, "SummaryCrossPlot" ); /// //-------------------------------------------------------------------------------------------------- RimSummaryCrossPlot::RimSummaryCrossPlot() + : RimSummaryPlot( true ) { CAF_PDM_InitObject( "Summary Cross Plot", ":/SummaryXPlotLight16x16.png" ); - - setAsCrossPlot(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 871c343e6e..22d021c7e3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -22,6 +22,7 @@ #include "RiaCurveMerger.h" #include "RiaGuiApplication.h" #include "RiaLogging.h" +#include "RiaPlotDefines.h" #include "RiaPreferencesSummary.h" #include "RiaResultNames.h" #include "RiaSummaryCurveDefinition.h" @@ -31,6 +32,7 @@ #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" #include "RimMultipleSummaryPlotNameHelper.h" +#include "RimPlotAxisProperties.h" #include "RimProject.h" #include "RimSummaryAddress.h" #include "RimSummaryCalculationCollection.h" @@ -45,6 +47,7 @@ #include "RimSummaryTimeAxisProperties.h" #include "RimTools.h" +#include "RiuPlotAxis.h" #include "RiuPlotMainWindow.h" #include "RiuQwtPlotCurve.h" #include "RiuSummaryVectorSelectionDialog.h" @@ -111,7 +114,10 @@ RimSummaryCurve::RimSummaryCurve() CAF_PDM_InitFieldNoDefault( &m_isEnsembleCurve, "IsEnsembleCurve", "Ensemble Curve" ); m_isEnsembleCurve.v() = caf::Tristate::State::PartiallyTrue; - CAF_PDM_InitFieldNoDefault( &m_plotAxis, "PlotAxis", "Axis" ); + CAF_PDM_InitFieldNoDefault( &m_plotAxis_OBSOLETE, "PlotAxis", "Axis" ); + m_plotAxis_OBSOLETE.xmlCapability()->setIOWritable( false ); + + CAF_PDM_InitFieldNoDefault( &m_plotAxisProperties, "Axis", "Axis" ); CAF_PDM_InitFieldNoDefault( &m_curveNameConfig, "SummaryCurveNameConfig", "SummaryCurveNameConfig" ); m_curveNameConfig.uiCapability()->setUiTreeHidden( true ); @@ -424,17 +430,24 @@ RimSummaryCase* RimSummaryCurve::summaryCaseX() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryCurve::setLeftOrRightAxisY( RiaDefines::PlotAxis plotAxis ) +void RimSummaryCurve::setLeftOrRightAxisY( RiuPlotAxis plotAxis ) { - m_plotAxis = plotAxis; + m_plotAxis_OBSOLETE = plotAxis.axis(); + + RimSummaryPlot* plot = nullptr; + firstAncestorOrThisOfTypeAsserted( plot ); + m_plotAxisProperties = plot->axisPropertiesForPlotAxis( plotAxis ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaDefines::PlotAxis RimSummaryCurve::axisY() const +RiuPlotAxis RimSummaryCurve::axisY() const { - return m_plotAxis(); + if ( m_plotAxisProperties ) + return m_plotAxisProperties->plotAxisType(); + else + return RiuPlotAxis::defaultLeft(); } //-------------------------------------------------------------------------------------------------- @@ -489,6 +502,17 @@ QList RimSummaryCurve::calculateValueOptions( const caf: { appendOptionItemsForSummaryAddresses( &options, m_xValuesSummaryCase() ); } + else if ( fieldNeedingOptions == &m_plotAxisProperties ) + { + RimSummaryPlot* plot = nullptr; + firstAncestorOrThisOfTypeAsserted( plot ); + + for ( auto axis : plot->plotAxes() ) + { + options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) ); + } + } + return options; } @@ -746,6 +770,13 @@ void RimSummaryCurve::initAfterRead() { RimStackablePlotCurve::initAfterRead(); + if ( m_plotAxisProperties.value() == nullptr ) + { + RimSummaryPlot* plot = nullptr; + firstAncestorOrThisOfType( plot ); + if ( plot ) m_plotAxisProperties = plot->axisPropertiesForPlotAxis( RiuPlotAxis( m_plotAxis_OBSOLETE() ) ); + } + if ( m_isEnsembleCurve().isPartiallyTrue() ) { m_isEnsembleCurve.v() = ( summaryCaseY() && summaryCaseY()->ensemble() ) ? caf::Tristate::State::True @@ -785,7 +816,7 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering curveDataGroup->add( &m_yValuesSummaryAddressUiField, { true, 2, 1 } ); curveDataGroup->add( &m_yPushButtonSelectSummaryAddress, { false, 1, 0 } ); curveDataGroup->add( &m_resampling, { true, 3, 1 } ); - curveDataGroup->add( &m_plotAxis, { true, 3, 1 } ); + curveDataGroup->add( &m_plotAxisProperties, { true, 3, 1 } ); if ( isCrossPlotCurve() ) m_showErrorBars = false; @@ -1047,7 +1078,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, // Update the summary curve collection to make sure the curve names are updated in curve creator UI visibilityChanged.send( m_showCurve() ); } - else if ( changedField == &m_plotAxis ) + else if ( changedField == &m_plotAxisProperties ) { updateAxisInPlot( axisY() ); plot->updateAxes(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h index 44c2c06ca7..4713c53ba1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -35,10 +35,10 @@ class RifSummaryReaderInterface; class RimSummaryCase; -class RiuQwtPlotCurve; class RimSummaryCurveAutoName; class RimSummaryAddress; class RiaSummaryCurveDefinition; +class RimPlotAxisPropertiesInterface; //================================================================================================== /// @@ -67,8 +67,8 @@ class RimSummaryCurve : public RimStackablePlotCurve RifEclipseSummaryAddress errorSummaryAddressY() const; std::vector errorValuesY() const; - void setLeftOrRightAxisY( RiaDefines::PlotAxis plotAxis ); - RiaDefines::PlotAxis axisY() const; + void setLeftOrRightAxisY( RiuPlotAxis plotAxis ); + RiuPlotAxis axisY() const; const std::vector& timeStepsY() const; double yValueAtTimeT( time_t time ) const; void setOverrideCurveDataY( const std::vector& xValues, const std::vector& yValues ); @@ -145,6 +145,7 @@ class RimSummaryCurve : public RimStackablePlotCurve caf::PdmField m_isEnsembleCurve; caf::PdmChildField m_curveNameConfig; - caf::PdmField> m_plotAxis; + caf::PdmField> m_plotAxis_OBSOLETE; + caf::PdmPtrField m_plotAxisProperties; caf::PdmField m_isTopZWithinCategory; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 25f383eccb..841fd046c9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -52,6 +52,7 @@ #include "RimSummaryPlotNameHelper.h" #include "RimSummaryTimeAxisProperties.h" +#include "RiuPlotAxis.h" #include "RiuPlotMainWindowTools.h" #include "RiuSummaryQwtPlot.h" #include "RiuTreeViewEventFilter.h" @@ -202,8 +203,9 @@ CurvesData concatCurvesData( const std::vector& curvesData ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryPlot::RimSummaryPlot() +RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) : RimPlot() + , m_isCrossPlot( isCrossPlot ) { CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" ); @@ -228,35 +230,34 @@ RimSummaryPlot::RimSummaryPlot() CAF_PDM_InitFieldNoDefault( &m_asciiDataCurves, "AsciiDataCurves", "" ); m_asciiDataCurves.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_leftYAxisProperties, "LeftYAxisProperties", "Left Y Axis" ); - m_leftYAxisProperties.uiCapability()->setUiTreeHidden( true ); - m_leftYAxisProperties = new RimPlotAxisProperties; - m_leftYAxisProperties->setNameAndAxis( "Left Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); + CAF_PDM_InitFieldNoDefault( &m_axisProperties, "AxisProperties", "Axes", ":/Axes16x16.png" ); - CAF_PDM_InitFieldNoDefault( &m_rightYAxisProperties, "RightYAxisProperties", "Right Y Axis" ); - m_rightYAxisProperties.uiCapability()->setUiTreeHidden( true ); - m_rightYAxisProperties = new RimPlotAxisProperties; - m_rightYAxisProperties->setNameAndAxis( "Right Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); + RimPlotAxisProperties* leftYAxisProperties = new RimPlotAxisProperties; + leftYAxisProperties->setNameAndAxis( "Left", RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0 ); + m_axisProperties.push_back( leftYAxisProperties ); + connectAxisSignals( leftYAxisProperties ); - CAF_PDM_InitFieldNoDefault( &m_bottomAxisProperties, "BottomAxisProperties", "Bottom X Axis" ); - m_bottomAxisProperties.uiCapability()->setUiTreeHidden( true ); - m_bottomAxisProperties = new RimPlotAxisProperties; - m_bottomAxisProperties->setNameAndAxis( "Bottom X-Axis", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); + RimPlotAxisProperties* rightYAxisProperties = new RimPlotAxisProperties; + rightYAxisProperties->setNameAndAxis( "Right", RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, 0 ); + m_axisProperties.push_back( rightYAxisProperties ); + connectAxisSignals( rightYAxisProperties ); - connectAxisSignals( m_leftYAxisProperties() ); - connectAxisSignals( m_rightYAxisProperties() ); - connectAxisSignals( m_bottomAxisProperties() ); - - CAF_PDM_InitFieldNoDefault( &m_timeAxisProperties, "TimeAxisProperties", "Time Axis" ); - m_timeAxisProperties.uiCapability()->setUiTreeHidden( true ); - m_timeAxisProperties = new RimSummaryTimeAxisProperties; + if ( m_isCrossPlot ) + { + RimPlotAxisProperties* bottomAxisProperties = new RimPlotAxisProperties; + bottomAxisProperties->setNameAndAxis( "Bottom", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0 ); + m_axisProperties.push_back( bottomAxisProperties ); + } + else + { + RimSummaryTimeAxisProperties* timeAxisProperties = new RimSummaryTimeAxisProperties; + m_axisProperties.push_back( timeAxisProperties ); + } CAF_PDM_InitFieldNoDefault( &m_textCurveSetEditor, "SummaryPlotFilterTextCurveSetEditor", "Text Filter Curve Creator" ); m_textCurveSetEditor.uiCapability()->setUiTreeHidden( true ); m_textCurveSetEditor = new RimSummaryPlotFilterTextCurveSetEditor; - m_isCrossPlot = false; - m_nameHelperAllCurves.reset( new RimSummaryPlotNameHelper ); CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); @@ -268,6 +269,27 @@ RimSummaryPlot::RimSummaryPlot() m_sourceStepping.xmlCapability()->disableIO(); setPlotInfoLabel( "Filters Active" ); + + // Obsolete axis fields + CAF_PDM_InitFieldNoDefault( &m_leftYAxisProperties_OBSOLETE, "LeftYAxisProperties", "Left Y Axis" ); + m_leftYAxisProperties_OBSOLETE.uiCapability()->setUiTreeHidden( true ); + m_leftYAxisProperties_OBSOLETE.xmlCapability()->setIOWritable( false ); + m_leftYAxisProperties_OBSOLETE = new RimPlotAxisProperties; + + CAF_PDM_InitFieldNoDefault( &m_rightYAxisProperties_OBSOLETE, "RightYAxisProperties", "Right Y Axis" ); + m_rightYAxisProperties_OBSOLETE.uiCapability()->setUiTreeHidden( true ); + m_rightYAxisProperties_OBSOLETE.xmlCapability()->setIOWritable( false ); + m_rightYAxisProperties_OBSOLETE = new RimPlotAxisProperties; + + CAF_PDM_InitFieldNoDefault( &m_bottomAxisProperties_OBSOLETE, "BottomAxisProperties", "Bottom X Axis" ); + m_bottomAxisProperties_OBSOLETE.uiCapability()->setUiTreeHidden( true ); + m_bottomAxisProperties_OBSOLETE.xmlCapability()->setIOWritable( false ); + m_bottomAxisProperties_OBSOLETE = new RimPlotAxisProperties; + + CAF_PDM_InitFieldNoDefault( &m_timeAxisProperties_OBSOLETE, "TimeAxisProperties", "Time Axis" ); + m_timeAxisProperties_OBSOLETE.uiCapability()->setUiTreeHidden( true ); + m_timeAxisProperties_OBSOLETE.xmlCapability()->setIOWritable( false ); + m_timeAxisProperties_OBSOLETE = new RimSummaryTimeAxisProperties; } //-------------------------------------------------------------------------------------------------- @@ -288,25 +310,27 @@ RimSummaryPlot::~RimSummaryPlot() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updateAxes() { - updateYAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); - updateYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); + updateAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); + updateAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); - if ( m_timeAxisProperties() && plotWidget() ) + if ( timeAxisProperties() && plotWidget() ) { - m_summaryPlot->updateAnnotationObjects( m_timeAxisProperties() ); + m_summaryPlot->updateAnnotationObjects( timeAxisProperties() ); } - if ( m_leftYAxisProperties() && plotWidget() ) + + RimPlotAxisPropertiesInterface* leftYAxisProperties = axisPropertiesForPlotAxis( RiuPlotAxis::defaultLeft() ); + if ( leftYAxisProperties && plotWidget() ) { - m_summaryPlot->updateAnnotationObjects( m_leftYAxisProperties() ); + m_summaryPlot->updateAnnotationObjects( leftYAxisProperties ); } if ( m_isCrossPlot ) { - updateBottomXAxis(); + updateAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); } else { - updateTimeAxis(); + updateTimeAxis( timeAxisProperties() ); } plotWidget()->scheduleReplot(); @@ -317,9 +341,9 @@ void RimSummaryPlot::updateAxes() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimSummaryPlot::isLogarithmicScaleEnabled( RiaDefines::PlotAxis plotAxis ) const +bool RimSummaryPlot::isLogarithmicScaleEnabled( RiuPlotAxis plotAxis ) const { - return yAxisPropertiesLeftOrRight( plotAxis )->isLogarithmicScaleEnabled(); + return axisPropertiesForPlotAxis( plotAxis )->isLogarithmicScaleEnabled(); } //-------------------------------------------------------------------------------------------------- @@ -327,7 +351,14 @@ bool RimSummaryPlot::isLogarithmicScaleEnabled( RiaDefines::PlotAxis plotAxis ) //-------------------------------------------------------------------------------------------------- RimSummaryTimeAxisProperties* RimSummaryPlot::timeAxisProperties() { - return m_timeAxisProperties(); + // Find the first time axis (which is correct since there is only one). + for ( auto ap : m_axisProperties ) + { + RimSummaryTimeAxisProperties* timeAxis = dynamic_cast( ap.p() ); + if ( timeAxis ) return timeAxis; + } + + return nullptr; } //-------------------------------------------------------------------------------------------------- @@ -484,21 +515,21 @@ void RimSummaryPlot::onAxisSelected( int axis, bool toggle ) caf::PdmObject* itemToSelect = nullptr; if ( axis == QwtPlot::yLeft ) { - itemToSelect = m_leftYAxisProperties; + itemToSelect = m_leftYAxisProperties_OBSOLETE; } else if ( axis == QwtPlot::yRight ) { - itemToSelect = m_rightYAxisProperties; + itemToSelect = m_rightYAxisProperties_OBSOLETE; } else if ( axis == QwtPlot::xBottom ) { if ( m_isCrossPlot ) { - itemToSelect = m_bottomAxisProperties; + itemToSelect = m_bottomAxisProperties_OBSOLETE; } else { - itemToSelect = m_timeAxisProperties; + itemToSelect = m_timeAxisProperties_OBSOLETE; } } @@ -653,7 +684,7 @@ RimSummaryCurveCollection* RimSummaryPlot::summaryCurveCollection() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimSummaryPlot::visibleStackedSummaryCurvesForAxis( RiaDefines::PlotAxis plotAxis ) +std::vector RimSummaryPlot::visibleStackedSummaryCurvesForAxis( RiuPlotAxis plotAxis ) { auto visibleCurves = visibleSummaryCurvesForAxis( plotAxis ); @@ -727,17 +758,11 @@ QString RimSummaryPlot::generatedPlotTitleFromAllCurves() const //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot ) { + for ( auto ap : sourceSummaryPlot.plotAxes() ) { - QString data = - sourceSummaryPlot.yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis::PLOT_AXIS_LEFT )->writeObjectToXmlString(); - yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) - ->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() ); - } + QString data = ap->writeObjectToXmlString(); - { - QString data = - sourceSummaryPlot.yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )->writeObjectToXmlString(); - yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) + axisPropertiesForPlotAxis( ap->plotAxisType() ) ->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() ); } } @@ -898,131 +923,105 @@ bool RimSummaryPlot::isNormalizationEnabled() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::updateYAxis( RiaDefines::PlotAxis plotAxis ) +void RimSummaryPlot::updateAxis( RiaDefines::PlotAxis plotAxis ) { if ( !plotWidget() ) return; - RimPlotAxisProperties* yAxisProperties = yAxisPropertiesLeftOrRight( plotAxis ); - if ( yAxisProperties->isActive() && hasVisibleCurvesForAxis( plotAxis ) ) + for ( RimPlotAxisPropertiesInterface* yAxisProperties : m_axisProperties ) { - plotWidget()->enableAxis( plotAxis, true ); + RiuPlotAxis riuPlotAxis = yAxisProperties->plotAxisType(); + if ( riuPlotAxis.axis() == plotAxis ) + { + RimPlotAxisProperties* axisProperties = dynamic_cast( yAxisProperties ); + if ( yAxisProperties->isActive() && hasVisibleCurvesForAxis( riuPlotAxis ) && axisProperties ) + { + plotWidget()->enableAxis( riuPlotAxis, true ); - std::set timeHistoryQuantities; + std::set timeHistoryQuantities; - for ( auto c : visibleTimeHistoryCurvesForAxis( plotAxis ) ) - { - timeHistoryQuantities.insert( c->quantityName() ); - } + for ( auto c : visibleTimeHistoryCurvesForAxis( riuPlotAxis ) ) + { + timeHistoryQuantities.insert( c->quantityName() ); + } - RimSummaryPlotAxisFormatter calc( yAxisProperties, - visibleSummaryCurvesForAxis( plotAxis ), - {}, - visibleAsciiDataCurvesForAxis( plotAxis ), - timeHistoryQuantities ); - calc.applyAxisPropertiesToPlot( plotWidget() ); - } - else - { - plotWidget()->enableAxis( plotAxis, false ); + RimSummaryPlotAxisFormatter calc( axisProperties, + visibleSummaryCurvesForAxis( riuPlotAxis ), + {}, + visibleAsciiDataCurvesForAxis( riuPlotAxis ), + timeHistoryQuantities ); + calc.applyAxisPropertiesToPlot( plotWidget() ); + } + else + { + plotWidget()->enableAxis( riuPlotAxis, false ); + } + } } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::updateZoomForAxis( RiaDefines::PlotAxis plotAxis ) +void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis ) { - if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) + RimPlotAxisPropertiesInterface* yAxisProps = axisPropertiesForPlotAxis( plotAxis ); + if ( yAxisProps->isAutoZoom() ) { - if ( m_isCrossPlot ) + if ( yAxisProps->isLogarithmicScaleEnabled() ) { - if ( m_bottomAxisProperties->isAutoZoom() ) - { - plotWidget()->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - } - else - { - plotWidget()->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, - m_bottomAxisProperties->visibleRangeMin(), - m_bottomAxisProperties->visibleRangeMax() ); - } - } - else - { - if ( m_timeAxisProperties->isAutoZoom() ) + plotWidget()->setAxisScaleType( yAxisProps->plotAxisType(), RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC ); + + std::vector plotCurves; + + for ( RimSummaryCurve* c : visibleSummaryCurvesForAxis( plotAxis ) ) { - plotWidget()->setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + plotCurves.push_back( c ); } - else + + for ( RimGridTimeHistoryCurve* c : visibleTimeHistoryCurvesForAxis( plotAxis ) ) { - plotWidget()->setAxisScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, - m_timeAxisProperties->visibleRangeMin(), - m_timeAxisProperties->visibleRangeMax() ); + plotCurves.push_back( c ); } - } - } - else - { - RimPlotAxisProperties* yAxisProps = yAxisPropertiesLeftOrRight( plotAxis ); - if ( yAxisProps->isAutoZoom() ) - { - if ( yAxisProps->isLogarithmicScaleEnabled ) + for ( RimAsciiDataCurve* c : visibleAsciiDataCurvesForAxis( plotAxis ) ) { - plotWidget()->setAxisScaleType( yAxisProps->plotAxisType(), RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC ); - - std::vector plotCurves; - - for ( RimSummaryCurve* c : visibleSummaryCurvesForAxis( plotAxis ) ) - { - plotCurves.push_back( c ); - } - - for ( RimGridTimeHistoryCurve* c : visibleTimeHistoryCurvesForAxis( plotAxis ) ) - { - plotCurves.push_back( c ); - } - - for ( RimAsciiDataCurve* c : visibleAsciiDataCurvesForAxis( plotAxis ) ) - { - plotCurves.push_back( c ); - } - - double min, max; - RimPlotAxisLogRangeCalculator calc( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, plotCurves ); - calc.computeAxisRange( &min, &max ); + plotCurves.push_back( c ); + } - if ( yAxisProps->isAxisInverted() ) - { - std::swap( min, max ); - } + double min, max; + RimPlotAxisLogRangeCalculator calc( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, plotCurves ); + calc.computeAxisRange( &min, &max ); - plotWidget()->setAxisScale( yAxisProps->plotAxisType(), min, max ); - } - else + if ( yAxisProps->isAxisInverted() ) { - plotWidget()->setAxisAutoScale( yAxisProps->plotAxisType(), true ); + std::swap( min, max ); } + + plotWidget()->setAxisScale( yAxisProps->plotAxisType(), min, max ); } else { - plotWidget()->setAxisScale( yAxisProps->plotAxisType(), - yAxisProps->visibleRangeMin(), - yAxisProps->visibleRangeMax() ); + plotWidget()->setAxisAutoScale( yAxisProps->plotAxisType(), true ); } - - plotWidget()->setAxisInverted( yAxisProps->plotAxisType(), yAxisProps->isAxisInverted() ); } + else + { + plotWidget()->setAxisScale( yAxisProps->plotAxisType(), + yAxisProps->visibleRangeMin(), + yAxisProps->visibleRangeMax() ); + } + + plotWidget()->setAxisInverted( yAxisProps->plotAxisType(), yAxisProps->isAxisInverted() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimSummaryPlot::visibleSummaryCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const +std::vector RimSummaryPlot::visibleSummaryCurvesForAxis( RiuPlotAxis plotAxis ) const { std::vector curves; - if ( plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) + if ( plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) { if ( m_summaryCurveCollection && m_summaryCurveCollection->isCurvesVisible() ) { @@ -1069,7 +1068,7 @@ std::vector RimSummaryPlot::visibleSummaryCurvesForAxis( RiaDe //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimSummaryPlot::hasVisibleCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const +bool RimSummaryPlot::hasVisibleCurvesForAxis( RiuPlotAxis plotAxis ) const { if ( visibleSummaryCurvesForAxis( plotAxis ).size() > 0 ) { @@ -1092,28 +1091,22 @@ bool RimSummaryPlot::hasVisibleCurvesForAxis( RiaDefines::PlotAxis plotAxis ) co //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimPlotAxisProperties* RimSummaryPlot::yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis leftOrRightPlotAxis ) const +RimPlotAxisPropertiesInterface* RimSummaryPlot::axisPropertiesForPlotAxis( RiuPlotAxis plotAxis ) const { - RimPlotAxisProperties* yAxisProps = nullptr; - - if ( leftOrRightPlotAxis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) + for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisProperties ) { - yAxisProps = m_leftYAxisProperties(); - } - else - { - yAxisProps = m_rightYAxisProperties(); + if ( axisProperties->plotAxisType() == plotAxis ) return axisProperties; } - CVF_ASSERT( yAxisProps ); + CVF_ASSERT( false && "No axis properties found for axis" ); - return yAxisProps; + return nullptr; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimSummaryPlot::visibleTimeHistoryCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const +std::vector RimSummaryPlot::visibleTimeHistoryCurvesForAxis( RiuPlotAxis plotAxis ) const { std::vector curves; @@ -1121,7 +1114,7 @@ std::vector RimSummaryPlot::visibleTimeHistoryCurvesFo { if ( c->isCurveVisible() ) { - if ( c->yAxis() == plotAxis || plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) + if ( c->yAxis() == plotAxis || plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) { curves.push_back( c ); } @@ -1134,7 +1127,7 @@ std::vector RimSummaryPlot::visibleTimeHistoryCurvesFo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimSummaryPlot::visibleAsciiDataCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const +std::vector RimSummaryPlot::visibleAsciiDataCurvesForAxis( RiuPlotAxis plotAxis ) const { std::vector curves; @@ -1142,7 +1135,7 @@ std::vector RimSummaryPlot::visibleAsciiDataCurvesForAxis( R { if ( c->isCurveVisible() ) { - if ( c->yAxis() == plotAxis || plotAxis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) + if ( c->yAxis() == plotAxis || plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) { curves.push_back( c ); } @@ -1155,24 +1148,24 @@ std::vector RimSummaryPlot::visibleAsciiDataCurvesForAxis( R //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::updateTimeAxis() +void RimSummaryPlot::updateTimeAxis( RimSummaryTimeAxisProperties* timeAxisProperties ) { if ( !plotWidget() ) return; - if ( !m_timeAxisProperties->isActive() ) + if ( !timeAxisProperties->isActive() ) { - plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, false ); + plotWidget()->enableAxis( RiuPlotAxis::defaultBottom(), false ); return; } - if ( m_timeAxisProperties->timeMode() == RimSummaryTimeAxisProperties::DATE ) + if ( timeAxisProperties->timeMode() == RimSummaryTimeAxisProperties::DATE ) { - RiaQDateTimeTools::DateFormatComponents dateComponents = m_timeAxisProperties->dateComponents(); - RiaQDateTimeTools::TimeFormatComponents timeComponents = m_timeAxisProperties->timeComponents(); + RiaQDateTimeTools::DateFormatComponents dateComponents = timeAxisProperties->dateComponents(); + RiaQDateTimeTools::TimeFormatComponents timeComponents = timeAxisProperties->timeComponents(); - QString dateFormat = m_timeAxisProperties->dateFormat(); - QString timeFormat = m_timeAxisProperties->timeFormat(); + QString dateFormat = timeAxisProperties->dateFormat(); + QString timeFormat = timeAxisProperties->timeFormat(); m_summaryPlot->useDateBasedTimeAxis( dateFormat, timeFormat, dateComponents, timeComponents ); } @@ -1181,26 +1174,25 @@ void RimSummaryPlot::updateTimeAxis() m_summaryPlot->useTimeBasedTimeAxis(); } - plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); + plotWidget()->enableAxis( RiuPlotAxis::defaultBottom(), true ); { Qt::AlignmentFlag alignment = Qt::AlignCenter; - if ( m_timeAxisProperties->titlePosition() == RimPlotAxisPropertiesInterface::AXIS_TITLE_END ) + if ( timeAxisProperties->titlePosition() == RimPlotAxisPropertiesInterface::AXIS_TITLE_END ) { alignment = Qt::AlignRight; } - plotWidget()->setAxisFontsAndAlignment( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, - m_timeAxisProperties->titleFontSize(), - m_timeAxisProperties->valuesFontSize(), + plotWidget()->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(), + timeAxisProperties->titleFontSize(), + timeAxisProperties->valuesFontSize(), true, alignment ); - plotWidget()->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_timeAxisProperties->title() ); - plotWidget()->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, m_timeAxisProperties->showTitle ); + plotWidget()->setAxisTitleText( RiuPlotAxis::defaultBottom(), timeAxisProperties->title() ); + plotWidget()->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), timeAxisProperties->showTitle ); { - RimSummaryTimeAxisProperties::LegendTickmarkCount tickmarkCountEnum = - m_timeAxisProperties->majorTickmarkCount(); + RimSummaryTimeAxisProperties::LegendTickmarkCount tickmarkCountEnum = timeAxisProperties->majorTickmarkCount(); int maxTickmarkCount = 8; @@ -1222,39 +1214,11 @@ void RimSummaryPlot::updateTimeAxis() break; } - plotWidget()->setAxisMaxMajor( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, maxTickmarkCount ); + plotWidget()->setAxisMaxMajor( RiuPlotAxis::defaultBottom(), maxTickmarkCount ); } } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::updateBottomXAxis() -{ - if ( !plotWidget() ) return; - - RimPlotAxisProperties* bottomAxisProperties = m_bottomAxisProperties(); - - if ( bottomAxisProperties->isActive() ) - { - plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - - std::set timeHistoryQuantities; - - RimSummaryPlotAxisFormatter calc( bottomAxisProperties, - visibleSummaryCurvesForAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ), - {}, - visibleAsciiDataCurvesForAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ), - timeHistoryQuantities ); - calc.applyAxisPropertiesToPlot( plotWidget() ); - } - else - { - plotWidget()->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, false ); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1300,9 +1264,7 @@ void RimSummaryPlot::addTimeRangeAnnotation( time_t startTime, time_t endTime ) void RimSummaryPlot::removeAllTimeAnnotations() { RimSummaryTimeAxisProperties* axisProps = timeAxisProperties(); - { - axisProps->removeAllAnnotations(); - } + axisProps->removeAllAnnotations(); } //-------------------------------------------------------------------------------------------------- @@ -1318,33 +1280,24 @@ void RimSummaryPlot::zoomAll() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::addCurveAndUpdate( RimSummaryCurve* curve ) +void RimSummaryPlot::addCurveAndUpdate( RimSummaryCurve* curve, bool autoAssignPlotAxis ) { if ( curve ) { m_summaryCurveCollection->addCurve( curve ); - connectCurveSignals( curve ); - if ( plotWidget() ) - { - curve->setParentPlotAndReplot( plotWidget() ); - this->updateAxes(); - } + connectCurveToPlot( curve, true, autoAssignPlotAxis ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::addCurveNoUpdate( RimSummaryCurve* curve ) +void RimSummaryPlot::addCurveNoUpdate( RimSummaryCurve* curve, bool autoAssignPlotAxis ) { if ( curve ) { m_summaryCurveCollection->addCurve( curve ); - connectCurveSignals( curve ); - if ( plotWidget() ) - { - curve->setParentPlotNoReplot( plotWidget() ); - } + connectCurveToPlot( curve, false, autoAssignPlotAxis ); } } @@ -1356,8 +1309,26 @@ void RimSummaryPlot::insertCurve( RimSummaryCurve* curve, size_t insertAtPositio if ( curve ) { m_summaryCurveCollection->insertCurve( curve, insertAtPosition ); - connectCurveSignals( curve ); - if ( plotWidget() ) + connectCurveToPlot( curve, false, true ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis ) +{ + if ( autoAssignPlotAxis ) assignPlotAxis( curve ); + + connectCurveSignals( curve ); + if ( plotWidget() ) + { + if ( update ) + { + curve->setParentPlotAndReplot( plotWidget() ); + this->updateAxes(); + } + else { curve->setParentPlotNoReplot( plotWidget() ); } @@ -1576,8 +1547,12 @@ void RimSummaryPlot::childFieldChangedByUi( const caf::PdmFieldHandle* changedCh //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updateStackedCurveData() { - updateStackedCurveDataForAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); - updateStackedCurveDataForAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); + for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisProperties ) + { + if ( axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || + axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) + updateStackedCurveDataForAxis( axisProperties->plotAxisType() ); + } if ( plotWidget() ) { @@ -1589,7 +1564,7 @@ void RimSummaryPlot::updateStackedCurveData() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::updateStackedCurveDataForAxis( RiaDefines::PlotAxis plotAxis ) +void RimSummaryPlot::updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ) { std::map curvePhaseCount; @@ -1645,6 +1620,7 @@ void RimSummaryPlot::updateStackedCurveDataForAxis( RiaDefines::PlotAxis plotAxi } } } + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1676,18 +1652,7 @@ void RimSummaryPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin } else { - caf::PdmUiTreeOrdering* axisFolder = uiTreeOrdering.add( "Axes", ":/Axes16x16.png" ); - - if ( m_isCrossPlot ) - { - axisFolder->add( &m_bottomAxisProperties ); - } - else - { - axisFolder->add( &m_timeAxisProperties ); - } - axisFolder->add( &m_leftYAxisProperties ); - axisFolder->add( &m_rightYAxisProperties ); + uiTreeOrdering.add( &m_axisProperties ); uiTreeOrdering.add( &m_summaryCurveCollection ); if ( !m_isCrossPlot ) @@ -1746,9 +1711,10 @@ void RimSummaryPlot::updateZoomInParentPlot() { if ( plotWidget() ) { - updateZoomForAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); - updateZoomForAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); - updateZoomForAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); + for ( auto axisProperty : m_axisProperties ) + { + updateZoomForAxis( axisProperty->plotAxisType() ); + } plotWidget()->updateAxes(); updateZoomFromParentPlot(); @@ -1763,40 +1729,15 @@ void RimSummaryPlot::updateZoomFromParentPlot() { if ( !plotWidget() ) return; - auto [leftAxisMin, leftAxisMax] = plotWidget()->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); - auto [rightAxisMin, rightAxisMax] = plotWidget()->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); - auto [timeAxisMin, timeAxisMax] = plotWidget()->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); - - m_leftYAxisProperties->visibleRangeMax = leftAxisMax; - m_leftYAxisProperties->visibleRangeMin = leftAxisMin; - m_leftYAxisProperties->updateConnectedEditors(); - - m_rightYAxisProperties->visibleRangeMax = rightAxisMax; - m_rightYAxisProperties->visibleRangeMin = rightAxisMin; - m_rightYAxisProperties->updateConnectedEditors(); - - if ( m_isCrossPlot ) - { - m_bottomAxisProperties->visibleRangeMax = timeAxisMax; - m_bottomAxisProperties->visibleRangeMin = timeAxisMin; - m_bottomAxisProperties->updateConnectedEditors(); - } - else + for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisProperties ) { - m_timeAxisProperties->setVisibleRangeMin( timeAxisMin ); - m_timeAxisProperties->setVisibleRangeMax( timeAxisMax ); - m_timeAxisProperties->updateConnectedEditors(); + auto [axisMin, axisMax] = plotWidget()->axisRange( axisProperties->plotAxisType() ); + axisProperties->setVisibleRangeMax( axisMax ); + axisProperties->setVisibleRangeMin( axisMin ); + axisProperties->updateConnectedEditors(); } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::set RimSummaryPlot::allPlotAxes() const -{ - return { m_timeAxisProperties, m_bottomAxisProperties, m_leftYAxisProperties, m_rightYAxisProperties }; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1950,14 +1891,6 @@ bool RimSummaryPlot::autoPlotTitle() const return m_useAutoPlotTitle; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::setAsCrossPlot() -{ - m_isCrossPlot = true; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -2120,6 +2053,31 @@ void RimSummaryPlot::initAfterRead() { RimViewWindow::initAfterRead(); + if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2021.10.2" ) ) + { + auto copyAxis = [this]( RiuPlotAxis axis, auto axisProperties ) { + QString data = axisProperties->writeObjectToXmlString(); + axisPropertiesForPlotAxis( axis )->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() ); + }; + + copyAxis( RiuPlotAxis::defaultLeft(), m_leftYAxisProperties_OBSOLETE.v() ); + copyAxis( RiuPlotAxis::defaultRight(), m_rightYAxisProperties_OBSOLETE.v() ); + + if ( m_isCrossPlot ) + copyAxis( RiuPlotAxis::defaultBottom(), m_bottomAxisProperties_OBSOLETE.v() ); + else + copyAxis( RiuPlotAxis::defaultBottom(), m_timeAxisProperties_OBSOLETE.v() ); + } + + for ( auto axisProperties : m_axisProperties ) + { + auto plotAxisProperties = dynamic_cast( axisProperties.p() ); + if ( plotAxisProperties ) + { + connectAxisSignals( plotAxisProperties ); + } + } + for ( auto curve : summaryCurves() ) { connectCurveSignals( curve ); @@ -2381,13 +2339,13 @@ std::vector RimSummaryPlot::fieldsToShowInToolbar() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::setAutoScaleXEnabled( bool enabled ) { - if ( m_isCrossPlot ) - { - m_bottomAxisProperties->setAutoZoom( enabled ); - } - else + for ( auto ap : m_axisProperties ) { - m_timeAxisProperties->setAutoZoom( enabled ); + if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_TOP || + ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) + { + ap->setAutoZoom( enabled ); + } } } @@ -2396,8 +2354,14 @@ void RimSummaryPlot::setAutoScaleXEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::setAutoScaleYEnabled( bool enabled ) { - m_leftYAxisProperties->setAutoZoom( enabled ); - m_rightYAxisProperties->setAutoZoom( enabled ); + for ( auto ap : m_axisProperties ) + { + if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || + ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) + { + ap->setAutoZoom( enabled ); + } + } } //-------------------------------------------------------------------------------------------------- @@ -2767,3 +2731,38 @@ CurvesData concatCurvesData( const std::vector& curvesData ) } return resultCurvesData; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryPlot::plotAxes() const +{ + std::vector axisProps; + for ( auto ap : m_axisProperties ) + { + axisProps.push_back( ap ); + } + + return axisProps; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* curve ) +{ + RiaDefines::PlotAxis plotAxis = RiaDefines::PlotAxis::PLOT_AXIS_LEFT; + + RiuPlotAxis newPlotAxis = RiuPlotAxis::defaultLeft(); + if ( plotWidget() && plotWidget()->isMultiAxisSupported() ) + { + newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); + + RimPlotAxisProperties* newAxisProperties = new RimPlotAxisProperties; + newAxisProperties->setNameAndAxis( "New Axis", newPlotAxis.axis(), newPlotAxis.index() ); + m_axisProperties.push_back( newAxisProperties ); + connectAxisSignals( newAxisProperties ); + } + + curve->setLeftOrRightAxisY( newPlotAxis ); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index e2d708d52a..4354d82de5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -74,7 +74,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping CAF_PDM_HEADER_INIT; public: - RimSummaryPlot(); + RimSummaryPlot( bool isCrossPlot = false ); ~RimSummaryPlot() override; void setDescription( const QString& description ); @@ -83,8 +83,8 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void enableAutoPlotTitle( bool enable ); bool autoPlotTitle() const; - void addCurveAndUpdate( RimSummaryCurve* curve ); - void addCurveNoUpdate( RimSummaryCurve* curve ); + void addCurveAndUpdate( RimSummaryCurve* curve, bool autoAssignPlotAxis = true ); + void addCurveNoUpdate( RimSummaryCurve* curve, bool autoAssignPlotAxis = true ); void insertCurve( RimSummaryCurve* curve, size_t insertAtPosition ); @@ -117,7 +117,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void updateAxes() override; - bool isLogarithmicScaleEnabled( RiaDefines::PlotAxis plotAxis ) const; + bool isLogarithmicScaleEnabled( RiuPlotAxis plotAxis ) const; RimSummaryTimeAxisProperties* timeAxisProperties(); time_t firstTimeStepOfFirstCurve(); @@ -185,6 +185,10 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping std::vector curveSets() const override; std::vector allCurves( RimSummaryDataSourceStepping::Axis axis ) const override; + std::vector plotAxes() const; + + RimPlotAxisPropertiesInterface* axisPropertiesForPlotAxis( RiuPlotAxis plotAxis ) const; + public: // RimViewWindow overrides void deleteViewWidget() override; @@ -205,13 +209,15 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void onCurveCollectionChanged( const SignalEmitter* emitter ); + void connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis ); + protected: // Overridden PDM methods caf::PdmFieldHandle* userDescriptionField() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override; void updateStackedCurveData(); - void updateStackedCurveDataForAxis( RiaDefines::PlotAxis plotAxis ); + void updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ); void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; @@ -220,27 +226,21 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping QImage snapshotWindowContent() override; - void setAsCrossPlot(); - private slots: void onPlotZoomed(); private: - std::vector visibleSummaryCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const; - std::vector visibleTimeHistoryCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const; - std::vector visibleAsciiDataCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const; - bool hasVisibleCurvesForAxis( RiaDefines::PlotAxis plotAxis ) const; - std::vector visibleStackedSummaryCurvesForAxis( RiaDefines::PlotAxis plotAxis ); - - RimPlotAxisProperties* yAxisPropertiesLeftOrRight( RiaDefines::PlotAxis leftOrRightPlotAxis ) const; - void updateYAxis( RiaDefines::PlotAxis plotAxis ); + std::vector visibleSummaryCurvesForAxis( RiuPlotAxis plotAxis ) const; + std::vector visibleTimeHistoryCurvesForAxis( RiuPlotAxis plotAxis ) const; + std::vector visibleAsciiDataCurvesForAxis( RiuPlotAxis plotAxis ) const; + bool hasVisibleCurvesForAxis( RiuPlotAxis plotAxis ) const; + std::vector visibleStackedSummaryCurvesForAxis( RiuPlotAxis plotAxis ); - void updateZoomForAxis( RiaDefines::PlotAxis plotAxis ); + void updateAxis( RiaDefines::PlotAxis plotAxis ); - void updateTimeAxis(); - void updateBottomXAxis(); + void updateZoomForAxis( RiuPlotAxis plotAxis ); - std::set allPlotAxes() const; + void updateTimeAxis( RimSummaryTimeAxisProperties* timeAxisProperties ); void cleanupBeforeClose(); @@ -256,6 +256,7 @@ private slots: void connectAxisSignals( RimPlotAxisProperties* axis ); void axisSettingsChanged( const caf::SignalEmitter* emitter ); void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic ); + void assignPlotAxis( RimSummaryCurve* curve ); private: #ifdef USE_QTCHARTS @@ -272,11 +273,13 @@ private slots: caf::PdmChildArrayField m_asciiDataCurves; - caf::PdmChildField m_leftYAxisProperties; - caf::PdmChildField m_rightYAxisProperties; + caf::PdmChildField m_leftYAxisProperties_OBSOLETE; + caf::PdmChildField m_rightYAxisProperties_OBSOLETE; + + caf::PdmChildField m_bottomAxisProperties_OBSOLETE; + caf::PdmChildField m_timeAxisProperties_OBSOLETE; - caf::PdmChildField m_bottomAxisProperties; - caf::PdmChildField m_timeAxisProperties; + caf::PdmChildArrayField m_axisProperties; caf::PdmChildField m_textCurveSetEditor; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index 687a7c9f7a..343cfc9e7e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -118,7 +118,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot { if ( !plotWidget ) return; - RiaDefines::PlotAxis axis = m_axisProperties->plotAxisType(); + RiuPlotAxis axis = m_axisProperties->plotAxisType(); { QString axisTitle = m_axisProperties->customTitle; if ( m_axisProperties->useAutoTitle() ) axisTitle = autoAxisTitle(); @@ -140,7 +140,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot auto qwtPlotWidget = dynamic_cast( plotWidget ); if ( qwtPlotWidget ) { - QwtPlot::Axis qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QwtPlot::Axis qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); if ( m_axisProperties->numberFormat == RimPlotAxisProperties::NUMBER_FORMAT_AUTO && m_axisProperties->scaleFactor() == 1.0 ) @@ -178,7 +178,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot #endif { - if ( m_axisProperties->isLogarithmicScaleEnabled ) + if ( m_axisProperties->isLogarithmicScaleEnabled() ) { bool isLogScale = plotWidget->axisScaleType( axis ) == RiuQwtPlotWidget::AxisScaleType::LOGARITHMIC; if ( !isLogScale ) @@ -254,7 +254,7 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const RifEclipseSummaryAddress sumAddress; std::string unitText; - if ( m_axisProperties->plotAxisType() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) + if ( m_axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) { sumAddress = rimCurve->summaryAddressX(); unitText = rimCurve->unitNameX(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index 357349041b..557c640986 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -132,9 +132,9 @@ RimPlotAxisPropertiesInterface::AxisTitlePositionType RimSummaryTimeAxisProperti //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaDefines::PlotAxis RimSummaryTimeAxisProperties::plotAxisType() const +RiuPlotAxis RimSummaryTimeAxisProperties::plotAxisType() const { - return RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM; + return RiuPlotAxis::defaultBottom(); } //-------------------------------------------------------------------------------------------------- @@ -698,3 +698,11 @@ void RimSummaryTimeAxisProperties::defineEditorAttribute( const caf::PdmFieldHan } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QString& RimSummaryTimeAxisProperties::name() const +{ + return title(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h index ca592ab561..02336e1d4f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h @@ -36,7 +36,7 @@ /// /// //================================================================================================== -class RimSummaryTimeAxisProperties : public caf::PdmObject, public RimPlotAxisPropertiesInterface +class RimSummaryTimeAxisProperties : public RimPlotAxisPropertiesInterface { CAF_PDM_HEADER_INIT; @@ -66,7 +66,7 @@ class RimSummaryTimeAxisProperties : public caf::PdmObject, public RimPlotAxisPr caf::PdmField title; caf::PdmField showTitle; - RiaDefines::PlotAxis plotAxisType() const override; + RiuPlotAxis plotAxisType() const override; AxisTitlePositionType titlePosition() const override; int titleFontSize() const override; int valuesFontSize() const override; @@ -88,16 +88,16 @@ class RimSummaryTimeAxisProperties : public caf::PdmObject, public RimPlotAxisPr const QString& dateFormat() const; const QString& timeFormat() const; - double visibleRangeMin() const; - double visibleRangeMax() const; + double visibleRangeMin() const override; + double visibleRangeMax() const override; - void setVisibleRangeMin( double value ); - void setVisibleRangeMax( double value ); + void setVisibleRangeMin( double value ) override; + void setVisibleRangeMax( double value ) override; - bool isAutoZoom() const; - void setAutoZoom( bool enableAutoZoom ); + bool isAutoZoom() const override; + void setAutoZoom( bool enableAutoZoom ) override; - bool isActive() const; + bool isActive() const override; QDateTime visibleDateTimeMin() const; QDateTime visibleDateTimeMax() const; @@ -108,6 +108,8 @@ class RimSummaryTimeAxisProperties : public caf::PdmObject, public RimPlotAxisPr LegendTickmarkCount majorTickmarkCount() const; void setMajorTickmarkCount( LegendTickmarkCount count ); + const QString& name() const override; + protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp index a4a7909752..28b827251a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp @@ -179,8 +179,8 @@ void RimWellLogCurve::updateCurveAppearance() if ( m_plotCurve ) { - m_plotCurve->setXAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP ); - m_plotCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); + m_plotCurve->setXAxis( RiuPlotAxis::defaultTop() ); + m_plotCurve->setYAxis( RiuPlotAxis::defaultLeft() ); } if ( fillStyle() != Qt::BrushStyle::NoBrush ) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 934a4d3224..d37a99f095 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -375,7 +375,7 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot ) RiuQwtPlotWidget* viewer = wellLogTrack->viewer(); if ( viewer ) { - viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "PL/" + wellLogPlot->depthAxisTitle() ); + viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "PL/" + wellLogPlot->depthAxisTitle() ); } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index 1635602f4d..2a39938361 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -496,18 +496,16 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) { if ( derivedMDSource == WELL_PATH ) { - viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, - "WELL/" + wellLogPlot->depthAxisTitle() ); + viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "WELL/" + wellLogPlot->depthAxisTitle() ); } else { - viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, - "OBS/" + wellLogPlot->depthAxisTitle() ); + viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "OBS/" + wellLogPlot->depthAxisTitle() ); } } else // Standard depth title set from plot { - viewer->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, wellLogPlot->depthAxisTitle() ); + viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), wellLogPlot->depthAxisTitle() ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index fc87841764..1cf2bcb881 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -493,7 +493,7 @@ void RimWellLogTrack::updateXZoom() componentRangeMax *= 1.5; } - m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, componentRangeMin, componentRangeMax ); + m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), componentRangeMin, componentRangeMax ); } //-------------------------------------------------------------------------------------------------- @@ -503,7 +503,7 @@ void RimWellLogTrack::updateYZoom() { if ( !m_plotWidget ) return; - m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, m_visibleDepthRangeMin(), m_visibleDepthRangeMax() ); + m_plotWidget->setAxisRange( RiuPlotAxis::defaultLeft(), m_visibleDepthRangeMin(), m_visibleDepthRangeMax() ); } //-------------------------------------------------------------------------------------------------- @@ -540,8 +540,8 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { if ( m_plotWidget ) { - m_majorTickInterval = m_plotWidget->majorTickInterval( RiaDefines::PlotAxis::PLOT_AXIS_TOP ); - m_minorTickInterval = m_plotWidget->minorTickInterval( RiaDefines::PlotAxis::PLOT_AXIS_TOP ); + m_majorTickInterval = m_plotWidget->majorTickInterval( RiuPlotAxis::defaultTop() ); + m_minorTickInterval = m_plotWidget->minorTickInterval( RiuPlotAxis::defaultTop() ); } m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); @@ -762,13 +762,13 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() bool emptyRange = isEmptyVisibleXRange(); if ( emptyRange ) { - m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false, false ); - m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP, 0.0, 1.0 ); - m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false, false ); + m_plotWidget->enableGridLines( RiuPlotAxis::defaultTop(), false, false ); + m_plotWidget->setAxisRange( RiuPlotAxis::defaultTop(), 0.0, 1.0 ); + m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultTop(), false, false ); } else { - m_plotWidget->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_TOP, true, true ); + m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultTop(), true, true ); if ( m_minAndMaxTicksOnly ) { auto roundToDigits = []( double value, int numberOfDigits, bool useFloor ) { @@ -807,7 +807,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() } else if ( m_explicitTickIntervals ) { - m_plotWidget->setMajorAndMinorTickIntervals( RiaDefines::PlotAxis::PLOT_AXIS_TOP, + m_plotWidget->setMajorAndMinorTickIntervals( RiuPlotAxis::defaultTop(), m_majorTickInterval(), m_minorTickInterval(), m_visibleXRangeMin(), @@ -817,13 +817,11 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() { int majorTickIntervals = 5; int minorTickIntervals = 10; - m_plotWidget->setAutoTickIntervalCounts( RiaDefines::PlotAxis::PLOT_AXIS_TOP, - majorTickIntervals, - minorTickIntervals ); - m_plotWidget->setAxisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP, m_visibleXRangeMin, m_visibleXRangeMax ); + m_plotWidget->setAutoTickIntervalCounts( RiuPlotAxis::defaultTop(), majorTickIntervals, minorTickIntervals ); + m_plotWidget->setAxisRange( RiuPlotAxis::defaultTop(), m_visibleXRangeMin, m_visibleXRangeMax ); } - m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_TOP, + m_plotWidget->enableGridLines( RiuPlotAxis::defaultTop(), m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR, m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR ); } @@ -832,7 +830,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() this->firstAncestorOrThisOfType( wellLogPlot ); if ( wellLogPlot ) { - m_plotWidget->enableGridLines( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + m_plotWidget->enableGridLines( RiuPlotAxis::defaultLeft(), wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MAJOR, wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MINOR ); } @@ -1008,8 +1006,8 @@ QString RimWellLogTrack::asciiDataForPlotExport() const //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::updateZoomFromParentPlot() { - auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_TOP ); - auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); + auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultTop() ); + auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultLeft() ); m_visibleXRangeMin = xIntervalMin; m_visibleXRangeMax = xIntervalMax; @@ -1228,8 +1226,8 @@ void RimWellLogTrack::onLoadDataAndUpdate() if ( wellLogPlot && m_plotWidget ) { - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_TOP, m_xAxisTitle ); - m_plotWidget->setAxisTitleText( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, wellLogPlot->depthAxisTitle() ); + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultTop(), m_xAxisTitle ); + m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), wellLogPlot->depthAxisTitle() ); } for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx ) @@ -1507,7 +1505,7 @@ RiuPlotWidget* RimWellLogTrack::doCreatePlotViewWidget( QWidget* mainWindowParen if ( m_plotWidget == nullptr ) { m_plotWidget = new RiuWellLogTrack( this, mainWindowParent ); - m_plotWidget->setAxisInverted( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); + m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), true ); updateAxisScaleEngine(); for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx ) diff --git a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake index 688c9a2ce4..375dcf73b4 100644 --- a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake @@ -57,6 +57,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.h ${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.h + ${CMAKE_CURRENT_LIST_DIR}/RiuPlotAxis.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.h ${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.h @@ -156,6 +157,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuPlotAxis.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotLegend.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuPlotAnnotationTool.cpp diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 52f728eaee..aa21512750 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -620,10 +620,10 @@ void RiuMultiPlotPage::reinsertPlotWidgets() subTitleFont.setPixelSize( m_subTitleFontPixelSize ); subTitles[visibleIndex]->setFont( subTitleFont ); - plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultLeft(), showYAxis( row, column ), showYAxis( row, column ) ); - plotWidgets[visibleIndex]->setAxisTitleEnabled( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, showYAxis( row, column ) ); + plotWidgets[visibleIndex]->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), showYAxis( row, column ) ); plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize ); { @@ -698,7 +698,7 @@ int RiuMultiPlotPage::alignCanvasTops() if ( qwtPlotWidget ) { int row = visibleIndex / rowAndColumnCount.second; - if ( plotWidgets[visibleIndex]->axisEnabled( RiaDefines::PlotAxis::PLOT_AXIS_TOP ) ) + if ( plotWidgets[visibleIndex]->axisEnabled( RiuPlotAxis::defaultTop() ) ) { QFont font = qwtPlotWidget->qwtPlot()->axisFont( QwtPlot::xTop ); maxExtents[row] = std::max( maxExtents[row], diff --git a/ApplicationLibCode/UserInterface/RiuPlotAxis.cpp b/ApplicationLibCode/UserInterface/RiuPlotAxis.cpp new file mode 100644 index 0000000000..6504d22db5 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuPlotAxis.cpp @@ -0,0 +1,120 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuPlotAxis.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis::RiuPlotAxis() + : m_axis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) + , m_index( 0 ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis::RiuPlotAxis( RiaDefines::PlotAxis axis ) + : m_axis( axis ) + , m_index( 0 ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis::RiuPlotAxis( RiaDefines::PlotAxis axis, int index ) + : m_axis( axis ) + , m_index( index ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis::~RiuPlotAxis() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RiuPlotAxis::defaultLeft() +{ + return RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RiuPlotAxis::defaultRight() +{ + return RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RiuPlotAxis::defaultTop() +{ + return RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RiuPlotAxis::defaultBottom() +{ + return RiuPlotAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::PlotAxis RiuPlotAxis::axis() const +{ + return m_axis; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuPlotAxis::index() const +{ + return m_index; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuPlotAxis::operator<( const RiuPlotAxis& rhs ) const +{ + if ( m_axis != rhs.m_axis ) + return m_axis < rhs.m_axis; + else + return m_index < rhs.m_index; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuPlotAxis::operator==( const RiuPlotAxis& rhs ) +{ + return m_axis == rhs.m_axis && m_index == rhs.m_index; +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotAxis.h b/ApplicationLibCode/UserInterface/RiuPlotAxis.h new file mode 100644 index 0000000000..15255bcc76 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuPlotAxis.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaPlotDefines.h" + +class RiuPlotAxis +{ +public: + explicit RiuPlotAxis(); + explicit RiuPlotAxis( RiaDefines::PlotAxis axis ); + explicit RiuPlotAxis( RiaDefines::PlotAxis axis, int index ); + virtual ~RiuPlotAxis(); + + static RiuPlotAxis defaultLeft(); + static RiuPlotAxis defaultRight(); + static RiuPlotAxis defaultTop(); + static RiuPlotAxis defaultBottom(); + + RiaDefines::PlotAxis axis() const; + + int index() const; + + bool operator<( const RiuPlotAxis& rhs ) const; + bool operator==( const RiuPlotAxis& rhs ); + +private: + RiaDefines::PlotAxis m_axis; + int m_index; +}; diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurve.h b/ApplicationLibCode/UserInterface/RiuPlotCurve.h index a1eed61b76..56c6964667 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuPlotCurve.h @@ -122,8 +122,8 @@ class RiuPlotCurve virtual std::pair xDataRange() const = 0; virtual std::pair yDataRange() const = 0; - virtual void setXAxis( RiaDefines::PlotAxis axis ) = 0; - virtual void setYAxis( RiaDefines::PlotAxis axis ) = 0; + virtual void setXAxis( RiuPlotAxis axis ) = 0; + virtual void setYAxis( RiuPlotAxis axis ) = 0; virtual void setSymbol( RiuPlotCurveSymbol* symbol ) = 0; diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.h b/ApplicationLibCode/UserInterface/RiuPlotWidget.h index efabe9d962..dc5fa7b13e 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.h @@ -20,8 +20,8 @@ #pragma once #include "RiaPlotDefines.h" - #include "RiuInterfaceToViewWindow.h" +#include "RiuPlotAxis.h" #include "cafPdmObject.h" #include "cafPdmPointer.h" @@ -80,9 +80,9 @@ class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow int colSpan() const; int rowSpan() const; - virtual int axisTitleFontSize( RiaDefines::PlotAxis axis ) const = 0; - virtual int axisValueFontSize( RiaDefines::PlotAxis axis ) const = 0; - virtual void setAxisFontsAndAlignment( RiaDefines::PlotAxis, + virtual int axisTitleFontSize( RiuPlotAxis axis ) const = 0; + virtual int axisValueFontSize( RiuPlotAxis axis ) const = 0; + virtual void setAxisFontsAndAlignment( RiuPlotAxis, int titleFontSize, int valueFontSize, bool titleBold = false, @@ -92,20 +92,23 @@ class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow bool titleBold = false, int alignment = (int)Qt::AlignCenter ) = 0; - virtual void enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) = 0; - virtual bool axisEnabled( RiaDefines::PlotAxis axis ) const = 0; + virtual void enableAxis( RiuPlotAxis axis, bool isEnabled ) = 0; + virtual bool axisEnabled( RiuPlotAxis axis ) const = 0; + + virtual void setAxisScale( RiuPlotAxis axis, double min, double max ) = 0; + virtual void setAxisAutoScale( RiuPlotAxis axis, bool enable ) = 0; - virtual void setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) = 0; - virtual void setAxisAutoScale( RiaDefines::PlotAxis axis, bool enable ) = 0; + virtual void setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) = 0; + virtual void setAxisMaxMajor( RiuPlotAxis axis, int maxMajor ) = 0; - virtual void setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) = 0; - virtual void setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) = 0; + virtual RiuPlotWidget::AxisScaleType axisScaleType( RiuPlotAxis axis ) const = 0; + virtual void setAxisScaleType( RiuPlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) = 0; - virtual RiuPlotWidget::AxisScaleType axisScaleType( RiaDefines::PlotAxis axis ) const = 0; - virtual void setAxisScaleType( RiaDefines::PlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) = 0; + virtual void setAxisTitleText( RiuPlotAxis axis, const QString& title ) = 0; + virtual void setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) = 0; - virtual void setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) = 0; - virtual void setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) = 0; + virtual bool isMultiAxisSupported() const = 0; + virtual RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) = 0; virtual void setPlotTitle( const QString& plotTitle ) = 0; const QString& plotTitle() const; @@ -121,34 +124,34 @@ class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow virtual void detachItems( RiuPlotWidget::PlotItemType plotItemType ) = 0; - virtual std::pair axisRange( RiaDefines::PlotAxis axis ) const = 0; - virtual void setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) = 0; + virtual std::pair axisRange( RiuPlotAxis axis ) const = 0; + virtual void setAxisRange( RiuPlotAxis axis, double min, double max ) = 0; + + virtual void setAxisInverted( RiuPlotAxis axis, bool isInverted ) = 0; + virtual void setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks ) = 0; - virtual void setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) = 0; - virtual void setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) = 0; + virtual void enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) = 0; - virtual void enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) = 0; + virtual void setMajorAndMinorTickIntervals( RiuPlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minValue, + double maxValue ) = 0; + virtual void setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minTickValue, + double maxTickValue, + double rangeMin, + double rangeMax ) = 0; - virtual void setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis, - double majorTickInterval, - double minorTickInterval, - double minValue, - double maxValue ) = 0; - virtual void setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis, - double majorTickInterval, - double minorTickInterval, - double minTickValue, - double maxTickValue, - double rangeMin, - double rangeMax ) = 0; + virtual void + setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) = 0; - virtual void setAutoTickIntervalCounts( RiaDefines::PlotAxis axis, - int maxMajorTickIntervalCount, - int maxMinorTickIntervalCount ) = 0; - virtual double majorTickInterval( RiaDefines::PlotAxis axis ) const = 0; - virtual double minorTickInterval( RiaDefines::PlotAxis axis ) const = 0; + virtual double majorTickInterval( RiuPlotAxis axis ) const = 0; + virtual double minorTickInterval( RiuPlotAxis axis ) const = 0; - virtual int axisExtent( RiaDefines::PlotAxis axis ) const = 0; + virtual int axisExtent( RiuPlotAxis axis ) const = 0; QPoint dragStartPosition() const; @@ -184,13 +187,13 @@ class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow static int defaultMinimumWidth(); - caf::PdmPointer m_plotDefinition; - QPoint m_clickPosition; - std::map m_axisTitles; - std::map m_axisTitlesEnabled; - const int m_overlayMargins; - QString m_plotTitle; - bool m_plotTitleEnabled; + caf::PdmPointer m_plotDefinition; + QPoint m_clickPosition; + std::map m_axisTitles; + std::map m_axisTitlesEnabled; + const int m_overlayMargins; + QString m_plotTitle; + bool m_plotTitleEnabled; QList> m_overlayFrames; }; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index 9f3c3eb4eb..cbe1e3f5e2 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -45,8 +45,8 @@ RiuQtChartsPlotCurve::RiuQtChartsPlotCurve( RimPlotCurve* ownerRimCurve, const Q m_scatterSeries = new QtCharts::QScatterSeries(); m_scatterSeries->setName( title ); - m_axisX = RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM; - m_axisY = RiaDefines::PlotAxis::PLOT_AXIS_LEFT; + m_axisX = RiuPlotAxis::defaultBottom(); + m_axisY = RiuPlotAxis::defaultLeft(); } //-------------------------------------------------------------------------------------------------- @@ -235,7 +235,7 @@ void RiuQtChartsPlotCurve::updateErrorBarsAppearance( bool showErrorBars, const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotCurve::setXAxis( RiaDefines::PlotAxis axis ) +void RiuQtChartsPlotCurve::setXAxis( RiuPlotAxis axis ) { m_axisX = axis; if ( m_plotWidget ) @@ -248,7 +248,7 @@ void RiuQtChartsPlotCurve::setXAxis( RiaDefines::PlotAxis axis ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotCurve::setYAxis( RiaDefines::PlotAxis axis ) +void RiuQtChartsPlotCurve::setYAxis( RiuPlotAxis axis ) { m_axisY = axis; if ( m_plotWidget ) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h index 634739e02c..9b95e94953 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h @@ -68,8 +68,8 @@ class RiuQtChartsPlotCurve : public RiuPlotCurve void detach() override; - void setXAxis( RiaDefines::PlotAxis axis ) override; - void setYAxis( RiaDefines::PlotAxis axis ) override; + void setXAxis( RiuPlotAxis axis ) override; + void setYAxis( RiuPlotAxis axis ) override; void setVisibleInLegend( bool isVisibleInLegend ) override; @@ -91,6 +91,6 @@ class RiuQtChartsPlotCurve : public RiuPlotCurve QtCharts::QScatterSeries* m_scatterSeries; std::shared_ptr m_symbol; RiuQtChartsPlotWidget* m_plotWidget; - RiaDefines::PlotAxis m_axisX; - RiaDefines::PlotAxis m_axisY; + RiuPlotAxis m_axisX; + RiuPlotAxis m_axisY; }; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp index 34395a0314..8413298644 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp @@ -60,13 +60,13 @@ void RiuQtChartsPlotTools::setCommonPlotBehaviour( RiuQtChartsPlotWidget* plot ) //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotTools::setDefaultAxes( RiuQtChartsPlotWidget* plot ) { - plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); - plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false ); - plot->enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, false ); + plot->enableAxis( RiuPlotAxis::defaultBottom(), true ); + plot->enableAxis( RiuPlotAxis::defaultLeft(), true ); + plot->enableAxis( RiuPlotAxis::defaultTop(), false ); + plot->enableAxis( RiuPlotAxis::defaultRight(), false ); - plot->setAxisMaxMinor( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 2 ); - plot->setAxisMaxMinor( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 3 ); + plot->setAxisMaxMinor( RiuPlotAxis::defaultBottom(), 2 ); + plot->setAxisMaxMinor( RiuPlotAxis::defaultLeft(), 3 ); } //-------------------------------------------------------------------------------------------------- @@ -79,7 +79,7 @@ void RiuQtChartsPlotTools::enableDateBasedBottomXAxis( RiuQtChartsPlotWidget* RiaQDateTimeTools::TimeFormatComponents timeComponents ) { QString format = dateTimeFormatForInterval( dateFormat, timeFormat, dateComponents, timeComponents ); - plot->setAxisFormat( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, format ); + plot->setAxisFormat( RiuPlotAxis::defaultBottom(), format ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index d0ac1153ad..9c3f02901a 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -71,31 +71,10 @@ RiuQtChartsPlotWidget::RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* layout->addWidget( m_viewer ); - QValueAxis* axisBottom = new QValueAxis(); - chart->addAxis( axisBottom, Qt::AlignBottom ); - m_axes[RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM] = axisBottom; - - QValueAxis* axisTop = new QValueAxis(); - chart->addAxis( axisTop, Qt::AlignTop ); - m_axes[RiaDefines::PlotAxis::PLOT_AXIS_TOP] = axisTop; - - QValueAxis* axisLeft = new QValueAxis(); - chart->addAxis( axisLeft, Qt::AlignLeft ); - m_axes[RiaDefines::PlotAxis::PLOT_AXIS_LEFT] = axisLeft; - - QValueAxis* axisRight = new QValueAxis(); - chart->addAxis( axisRight, Qt::AlignRight ); - m_axes[RiaDefines::PlotAxis::PLOT_AXIS_RIGHT] = axisRight; - - enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); - enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, false ); - enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - enableAxis( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false ); - - setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, true ); - setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, false ); - setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, true ); - setAxisAutoScale( RiaDefines::PlotAxis::PLOT_AXIS_TOP, false ); + addAxis( RiuPlotAxis::defaultBottom(), true, true ); + addAxis( RiuPlotAxis::defaultLeft(), true, true ); + addAxis( RiuPlotAxis::defaultRight(), true, true ); + addAxis( RiuPlotAxis::defaultTop(), false, false ); m_viewer->setRubberBand( QChartView::RectangleRubberBand ); @@ -124,7 +103,7 @@ void RiuQtChartsPlotWidget::axisRangeChanged() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuQtChartsPlotWidget::axisTitleFontSize( RiaDefines::PlotAxis axis ) const +int RiuQtChartsPlotWidget::axisTitleFontSize( RiuPlotAxis axis ) const { if ( axisEnabled( axis ) ) { @@ -137,7 +116,7 @@ int RiuQtChartsPlotWidget::axisTitleFontSize( RiaDefines::PlotAxis axis ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuQtChartsPlotWidget::axisValueFontSize( RiaDefines::PlotAxis axis ) const +int RiuQtChartsPlotWidget::axisValueFontSize( RiuPlotAxis axis ) const { if ( axisEnabled( axis ) ) { @@ -150,11 +129,11 @@ int RiuQtChartsPlotWidget::axisValueFontSize( RiaDefines::PlotAxis axis ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisFontsAndAlignment( RiaDefines::PlotAxis axis, - int titleFontSize, - int valueFontSize, - bool titleBold, - int alignment ) +void RiuQtChartsPlotWidget::setAxisFontsAndAlignment( RiuPlotAxis axis, + int titleFontSize, + int valueFontSize, + bool titleBold, + int alignment ) { int titleFontPixelSize = caf::FontTools::pointSizeToPixelSize( titleFontSize ); int valueFontPixelSize = caf::FontTools::pointSizeToPixelSize( valueFontSize ); @@ -188,7 +167,7 @@ void RiuQtChartsPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int val //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) +void RiuQtChartsPlotWidget::setAxisTitleText( RiuPlotAxis axis, const QString& title ) { m_axisTitles[axis] = title; applyAxisTitleToPlot( axis ); @@ -197,7 +176,7 @@ void RiuQtChartsPlotWidget::setAxisTitleText( RiaDefines::PlotAxis axis, const Q //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) +void RiuQtChartsPlotWidget::setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) { m_axisTitlesEnabled[axis] = enable; applyAxisTitleToPlot( axis ); @@ -206,7 +185,7 @@ void RiuQtChartsPlotWidget::setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisFormat( RiaDefines::PlotAxis axis, const QString& format ) +void RiuQtChartsPlotWidget::setAxisFormat( RiuPlotAxis axis, const QString& format ) { auto ax = plotAxis( axis ); @@ -330,7 +309,7 @@ void RiuQtChartsPlotWidget::clearLegend() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::pair RiuQtChartsPlotWidget::axisRange( RiaDefines::PlotAxis axis ) const +std::pair RiuQtChartsPlotWidget::axisRange( RiuPlotAxis axis ) const { auto ax = plotAxis( axis ); @@ -349,7 +328,7 @@ std::pair RiuQtChartsPlotWidget::axisRange( RiaDefines::PlotAxis //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) +void RiuQtChartsPlotWidget::setAxisRange( RiuPlotAxis axis, double min, double max ) { // Note: Especially the Y-axis may be inverted if ( plotAxis( axis )->isReverse() ) @@ -365,7 +344,7 @@ void RiuQtChartsPlotWidget::setAxisRange( RiaDefines::PlotAxis axis, double min, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) +void RiuQtChartsPlotWidget::setAxisInverted( RiuPlotAxis axis, bool isInverted ) { auto ax = plotAxis( axis ); ax->setReverse( isInverted ); @@ -374,7 +353,7 @@ void RiuQtChartsPlotWidget::setAxisInverted( RiaDefines::PlotAxis axis, bool isI //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) +void RiuQtChartsPlotWidget::setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks ) { plotAxis( axis )->setLabelsVisible( enableLabels ); plotAxis( axis )->setGridLineVisible( enableTicks ); @@ -383,7 +362,7 @@ void RiuQtChartsPlotWidget::setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis a //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) +void RiuQtChartsPlotWidget::enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) { plotAxis( axis )->setGridLineVisible( majorGridLines ); plotAxis( axis )->setMinorGridLineVisible( minorGridLines ); @@ -398,33 +377,33 @@ void RiuQtChartsPlotWidget::enableGridLines( RiaDefines::PlotAxis axis, bool maj //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis, - double majorTickInterval, - double minorTickInterval, - double minValue, - double maxValue ) +void RiuQtChartsPlotWidget::setMajorAndMinorTickIntervals( RiuPlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minValue, + double maxValue ) { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis, - double majorTickInterval, - double minorTickInterval, - double minTickValue, - double maxTickValue, - double rangeMin, - double rangeMax ) +void RiuQtChartsPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minTickValue, + double maxTickValue, + double rangeMin, + double rangeMax ) { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAutoTickIntervalCounts( RiaDefines::PlotAxis axis, - int maxMajorTickIntervalCount, - int maxMinorTickIntervalCount ) +void RiuQtChartsPlotWidget::setAutoTickIntervalCounts( RiuPlotAxis axis, + int maxMajorTickIntervalCount, + int maxMinorTickIntervalCount ) { setAxisMaxMajor( axis, maxMajorTickIntervalCount ); setAxisMaxMinor( axis, maxMinorTickIntervalCount ); @@ -433,7 +412,7 @@ void RiuQtChartsPlotWidget::setAutoTickIntervalCounts( RiaDefines::PlotAxis axis //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RiuQtChartsPlotWidget::majorTickInterval( RiaDefines::PlotAxis axis ) const +double RiuQtChartsPlotWidget::majorTickInterval( RiuPlotAxis axis ) const { #if QT_VERSION >= QT_VERSION_CHECK( 5, 12, 0 ) // QValueAxis::tickInterval was introduced in 5.12 @@ -447,7 +426,7 @@ double RiuQtChartsPlotWidget::majorTickInterval( RiaDefines::PlotAxis axis ) con //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RiuQtChartsPlotWidget::minorTickInterval( RiaDefines::PlotAxis axis ) const +double RiuQtChartsPlotWidget::minorTickInterval( RiuPlotAxis axis ) const { return 0.0; } @@ -455,7 +434,7 @@ double RiuQtChartsPlotWidget::minorTickInterval( RiaDefines::PlotAxis axis ) con //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuQtChartsPlotWidget::axisExtent( RiaDefines::PlotAxis axis ) const +int RiuQtChartsPlotWidget::axisExtent( RiuPlotAxis axis ) const { CAF_ASSERT( false && "Not implemented" ); return 100; @@ -535,7 +514,7 @@ void RiuQtChartsPlotWidget::applyPlotTitleToPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::applyAxisTitleToPlot( RiaDefines::PlotAxis axis ) +void RiuQtChartsPlotWidget::applyAxisTitleToPlot( RiuPlotAxis axis ) { QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" ); plotAxis( axis )->setTitleText( titleToApply ); @@ -636,7 +615,7 @@ void RiuQtChartsPlotWidget::replot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) +void RiuQtChartsPlotWidget::enableAxis( RiuPlotAxis axis, bool isEnabled ) { m_axesEnabled[axis] = isEnabled; plotAxis( axis )->setVisible( isEnabled ); @@ -645,7 +624,7 @@ void RiuQtChartsPlotWidget::enableAxis( RiaDefines::PlotAxis axis, bool isEnable //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RiuQtChartsPlotWidget::axisEnabled( RiaDefines::PlotAxis axis ) const +bool RiuQtChartsPlotWidget::axisEnabled( RiuPlotAxis axis ) const { auto it = m_axesEnabled.find( axis ); if ( it != m_axesEnabled.end() ) @@ -657,7 +636,7 @@ bool RiuQtChartsPlotWidget::axisEnabled( RiaDefines::PlotAxis axis ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) +void RiuQtChartsPlotWidget::setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) { QAbstractAxis* ax = plotAxis( axis ); QValueAxis* valueAxis = dynamic_cast( ax ); @@ -675,7 +654,7 @@ void RiuQtChartsPlotWidget::setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxM //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) +void RiuQtChartsPlotWidget::setAxisMaxMajor( RiuPlotAxis axis, int maxMajor ) { QAbstractAxis* ax = plotAxis( axis ); QValueAxis* valueAxis = dynamic_cast( ax ); @@ -693,7 +672,7 @@ void RiuQtChartsPlotWidget::setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxM //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisAutoScale( RiaDefines::PlotAxis axis, bool autoScale ) +void RiuQtChartsPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale ) { m_axesAutoScale[axis] = autoScale; @@ -706,7 +685,7 @@ void RiuQtChartsPlotWidget::setAxisAutoScale( RiaDefines::PlotAxis axis, bool au //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) +void RiuQtChartsPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max ) { plotAxis( axis )->setRange( min, max ); } @@ -714,7 +693,7 @@ void RiuQtChartsPlotWidget::setAxisScale( RiaDefines::PlotAxis axis, double min, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQtChartsPlotWidget::AxisScaleType RiuQtChartsPlotWidget::axisScaleType( RiaDefines::PlotAxis axis ) const +RiuQtChartsPlotWidget::AxisScaleType RiuQtChartsPlotWidget::axisScaleType( RiuPlotAxis axis ) const { if ( plotAxis( axis )->type() == QAbstractAxis::AxisTypeLogValue ) return AxisScaleType::LOGARITHMIC; if ( plotAxis( axis )->type() == QAbstractAxis::AxisTypeDateTime ) return AxisScaleType::DATE; @@ -724,7 +703,7 @@ RiuQtChartsPlotWidget::AxisScaleType RiuQtChartsPlotWidget::axisScaleType( RiaDe //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxisScaleType( RiaDefines::PlotAxis axis, RiuQtChartsPlotWidget::AxisScaleType axisScaleType ) +void RiuQtChartsPlotWidget::setAxisScaleType( RiuPlotAxis axis, RiuQtChartsPlotWidget::AxisScaleType axisScaleType ) { QAbstractAxis* removeaxis = plotAxis( axis ); QAbstractAxis* insertaxis = nullptr; @@ -742,16 +721,9 @@ void RiuQtChartsPlotWidget::setAxisScaleType( RiaDefines::PlotAxis axis, RiuQtCh insertaxis = new QValueAxis; } - QChart* chart = qtChart(); - auto mapToAlignment = []( auto axis ) { - if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) return Qt::AlignBottom; - if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_TOP ) return Qt::AlignTop; - if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) return Qt::AlignLeft; - return Qt::AlignRight; - }; - + QChart* chart = qtChart(); if ( chart->axes().contains( removeaxis ) ) chart->removeAxis( removeaxis ); - chart->addAxis( insertaxis, mapToAlignment( axis ) ); + chart->addAxis( insertaxis, mapPlotAxisToQtAlignment( axis.axis() ) ); m_axes[axis] = insertaxis; for ( auto serie : chart->series() ) @@ -791,8 +763,8 @@ QtCharts::QChart* RiuQtChartsPlotWidget::qtChart() void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, QtCharts::QAbstractSeries* lineSeries, QtCharts::QAbstractSeries* scatterSeries, - RiaDefines::PlotAxis xAxis, - RiaDefines::PlotAxis yAxis ) + RiuPlotAxis xAxis, + RiuPlotAxis yAxis ) { auto addToChart = [this]( std::map& curveSeriesMap, auto plotCurve, @@ -860,7 +832,7 @@ void RiuQtChartsPlotWidget::detachItems( RiuPlotWidget::PlotItemType plotItemTyp //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setXAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ) +void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) { setAxis( axis, series ); } @@ -868,7 +840,7 @@ void RiuQtChartsPlotWidget::setXAxis( RiaDefines::PlotAxis axis, QtCharts::QAbst //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setYAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ) +void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) { setAxis( axis, series ); } @@ -876,8 +848,14 @@ void RiuQtChartsPlotWidget::setYAxis( RiaDefines::PlotAxis axis, QtCharts::QAbst //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ) +void RiuQtChartsPlotWidget::setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) { + // Make sure the axis we are about to set exists. + if ( m_axes.find( axis ) == m_axes.end() ) + { + addAxis( axis, true, true ); + } + if ( qtChart()->series().contains( series ) && !series->attachedAxes().contains( plotAxis( axis ) ) ) { auto newAxis = plotAxis( axis ); @@ -885,7 +863,7 @@ void RiuQtChartsPlotWidget::setAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstr // Detach any other axis for the same orientation for ( auto ax : series->attachedAxes() ) { - if ( ax->orientation() == orientation( axis ) ) + if ( ax->orientation() == orientation( axis.axis() ) ) { series->detachAxis( ax ); } @@ -907,12 +885,50 @@ void RiuQtChartsPlotWidget::setAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::rescaleAxis( RiaDefines::PlotAxis axis ) +void RiuQtChartsPlotWidget::addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool isAutoScale ) +{ + QValueAxis* axis = new QValueAxis(); + qtChart()->addAxis( axis, mapPlotAxisToQtAlignment( plotAxis.axis() ) ); + m_axes[plotAxis] = axis; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RiuQtChartsPlotWidget::createNextPlotAxis( RiaDefines::PlotAxis axis ) +{ + int minIdx = -1; + for ( auto a : m_axes ) + { + if ( a.first.axis() == axis ) + { + minIdx = std::max( a.first.index(), minIdx ); + } + } + + RiuPlotAxis plotAxis( axis, minIdx + 1 ); + + addAxis( plotAxis, true, true ); + return plotAxis; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuQtChartsPlotWidget::isMultiAxisSupported() const +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::rescaleAxis( RiuPlotAxis axis ) { if ( !m_axesAutoScale[axis] ) return; QAbstractAxis* pAxis = plotAxis( axis ); - Qt::Orientation orr = orientation( axis ); + Qt::Orientation orr = orientation( axis.axis() ); double min = std::numeric_limits::max(); double max = -std::numeric_limits::max(); @@ -966,7 +982,7 @@ void RiuQtChartsPlotWidget::rescaleAxis( RiaDefines::PlotAxis axis ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QAbstractAxis* RiuQtChartsPlotWidget::plotAxis( RiaDefines::PlotAxis axis ) const +QAbstractAxis* RiuQtChartsPlotWidget::plotAxis( RiuPlotAxis axis ) const { const auto ax = m_axes.find( axis ); if ( ax != m_axes.end() ) @@ -1053,3 +1069,14 @@ std::pair RiuQtChartsPlotWidget::findClosestCurve( const QPo { return std::make_pair( nullptr, -1 ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +Qt::Alignment RiuQtChartsPlotWidget::mapPlotAxisToQtAlignment( RiaDefines::PlotAxis axis ) +{ + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) return Qt::AlignBottom; + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_TOP ) return Qt::AlignTop; + if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) return Qt::AlignLeft; + return Qt::AlignRight; +} diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index 132fb8ad42..9b06fc8d45 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -63,9 +63,9 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* parent = nullptr ); ~RiuQtChartsPlotWidget() override; - int axisTitleFontSize( RiaDefines::PlotAxis axis ) const override; - int axisValueFontSize( RiaDefines::PlotAxis axis ) const override; - void setAxisFontsAndAlignment( RiaDefines::PlotAxis, + int axisTitleFontSize( RiuPlotAxis axis ) const override; + int axisValueFontSize( RiuPlotAxis axis ) const override; + void setAxisFontsAndAlignment( RiuPlotAxis, int titleFontSize, int valueFontSize, bool titleBold = false, @@ -75,22 +75,25 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget bool titleBold = false, int alignment = (int)Qt::AlignCenter ) override; - void enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) override; - bool axisEnabled( RiaDefines::PlotAxis axis ) const override; + void enableAxis( RiuPlotAxis axis, bool isEnabled ) override; + bool axisEnabled( RiuPlotAxis axis ) const override; - void setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) override; - void setAxisAutoScale( RiaDefines::PlotAxis axis, bool enable ) override; + void setAxisScale( RiuPlotAxis axis, double min, double max ) override; + void setAxisAutoScale( RiuPlotAxis axis, bool enable ) override; - void setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) override; - void setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) override; + void setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) override; + void setAxisMaxMajor( RiuPlotAxis axis, int maxMajor ) override; - RiuPlotWidget::AxisScaleType axisScaleType( RiaDefines::PlotAxis axis ) const override; - void setAxisScaleType( RiaDefines::PlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) override; + RiuPlotWidget::AxisScaleType axisScaleType( RiuPlotAxis axis ) const override; + void setAxisScaleType( RiuPlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) override; - void setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) override; - void setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) override; + void setAxisTitleText( RiuPlotAxis axis, const QString& title ) override; + void setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) override; - void setAxisFormat( RiaDefines::PlotAxis axis, const QString& format ); + void setAxisFormat( RiuPlotAxis axis, const QString& format ); + + RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) override; + bool isMultiAxisSupported() const override; void setPlotTitle( const QString& plotTitle ) override; const QString& plotTitle() const; @@ -103,35 +106,33 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget void insertLegend( RiuPlotWidget::Legend ) override; void clearLegend() override; - std::pair axisRange( RiaDefines::PlotAxis axis ) const override; - void setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) override; - - void setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) override; - void setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) override; - - void enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) override; - - void setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis, - double majorTickInterval, - double minorTickInterval, - double minValue, - double maxValue ) override; - void setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis, - double majorTickInterval, - double minorTickInterval, - double minTickValue, - double maxTickValue, - double rangeMin, - double rangeMax ) override; - void setAutoTickIntervalCounts( RiaDefines::PlotAxis axis, - int maxMajorTickIntervalCount, - int maxMinorTickIntervalCount ) override; - double majorTickInterval( RiaDefines::PlotAxis axis ) const override; - double minorTickInterval( RiaDefines::PlotAxis axis ) const override; + std::pair axisRange( RiuPlotAxis axis ) const override; + void setAxisRange( RiuPlotAxis axis, double min, double max ) override; + + void setAxisInverted( RiuPlotAxis axis, bool isInverted ) override; + void setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks ) override; + + void enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) override; + + void setMajorAndMinorTickIntervals( RiuPlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minValue, + double maxValue ) override; + void setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minTickValue, + double maxTickValue, + double rangeMin, + double rangeMax ) override; + void setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) override; + double majorTickInterval( RiuPlotAxis axis ) const override; + double minorTickInterval( RiuPlotAxis axis ) const override; void detachItems( RiuPlotWidget::PlotItemType plotItemType ) override; - int axisExtent( RiaDefines::PlotAxis axis ) const override; + int axisExtent( RiuPlotAxis axis ) const override; QPoint dragStartPosition() const; @@ -155,14 +156,14 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget void attach( RiuPlotCurve* plotCurve, QtCharts::QAbstractSeries* lineseries, QtCharts::QAbstractSeries* scatterSeries, - RiaDefines::PlotAxis xAxis, - RiaDefines::PlotAxis yAxis ); + RiuPlotAxis xAxis, + RiuPlotAxis yAxis ); QtCharts::QAbstractSeries* getLineSeries( const RiuPlotCurve* plotCurve ) const; QtCharts::QAbstractSeries* getScatterSeries( const RiuPlotCurve* plotCurve ) const; - void setXAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ); - void setYAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ); + void setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ); + void setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ); const QColor& backgroundColor() const override; @@ -171,7 +172,7 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget std::pair findClosestCurve( const QPoint& pos, double& distanceToClick ) const override; protected: - void setAxis( RiaDefines::PlotAxis axis, QtCharts::QAbstractSeries* series ); + void setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ); void resizeEvent( QResizeEvent* event ) override; void keyPressEvent( QKeyEvent* event ) override; @@ -179,7 +180,7 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget bool eventFilter( QObject* watched, QEvent* event ) override; void applyPlotTitleToPlot(); - void applyAxisTitleToPlot( RiaDefines::PlotAxis axis ); + void applyAxisTitleToPlot( RiuPlotAxis axis ); QSize sizeHint() const override; QSize minimumSizeHint() const override; @@ -187,8 +188,8 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget virtual bool isZoomerActive() const; virtual void endZoomOperations(); - void rescaleAxis( RiaDefines::PlotAxis axis ); - QtCharts::QAbstractAxis* plotAxis( RiaDefines::PlotAxis axis ) const; + void rescaleAxis( RiuPlotAxis axis ); + QtCharts::QAbstractAxis* plotAxis( RiuPlotAxis axis ) const; Qt::Orientation orientation( RiaDefines::PlotAxis axis ) const; void dragEnterEvent( QDragEnterEvent* event ) override; @@ -201,14 +202,17 @@ private slots: void axisRangeChanged(); private: + void addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool isAutoScale ); + static Qt::Alignment mapPlotAxisToQtAlignment( RiaDefines::PlotAxis axis ); + static int defaultMinimumWidth(); void replot() override; QPointer m_viewer; - std::map m_axes; - std::map m_axesEnabled; - std::map m_axesAutoScale; + std::map m_axes; + std::map m_axesEnabled; + std::map m_axesAutoScale; std::map m_lineSeriesMap; std::map m_scatterSeriesMap; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index 8ec169e04f..56bd6311dc 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -476,17 +476,17 @@ void RiuQwtPlotCurve::setSamplesFromXYErrorValues( const std::vector& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotCurve::setXAxis( RiaDefines::PlotAxis axis ) +void RiuQwtPlotCurve::setXAxis( RiuPlotAxis axis ) { - QwtPlotCurve::setXAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + QwtPlotCurve::setXAxis( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotCurve::setYAxis( RiaDefines::PlotAxis axis ) +void RiuQwtPlotCurve::setYAxis( RiuPlotAxis axis ) { - QwtPlotCurve::setYAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + QwtPlotCurve::setYAxis( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h index e44aec3a39..7fffa6b7b1 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h @@ -74,8 +74,8 @@ class RiuQwtPlotCurve : public RiuPlotCurve, public QwtPlotCurve bool keepOnlyPositiveValues, RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ) override; - void setXAxis( RiaDefines::PlotAxis axis ) override; - void setYAxis( RiaDefines::PlotAxis axis ) override; + void setXAxis( RiuPlotAxis axis ) override; + void setYAxis( RiuPlotAxis axis ) override; void setSymbol( RiuPlotCurveSymbol* symbol ) override; RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 25353fe22f..0ae8b6a5f2 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -28,6 +28,7 @@ #include "RiuDraggableOverlayFrame.h" #include "RiuGuiTheme.h" +#include "RiuPlotAxis.h" #include "RiuPlotMainWindowTools.h" #include "RiuPlotWidget.h" #include "RiuQwtCurvePointTracker.h" @@ -114,11 +115,11 @@ RiuQwtPlotWidget::~RiuQwtPlotWidget() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuQwtPlotWidget::axisTitleFontSize( RiaDefines::PlotAxis axis ) const +int RiuQwtPlotWidget::axisTitleFontSize( RiuPlotAxis axis ) const { if ( axisEnabled( axis ) ) { - return m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).pointSize(); + return m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ).pointSize(); } return -1; } @@ -126,11 +127,11 @@ int RiuQwtPlotWidget::axisTitleFontSize( RiaDefines::PlotAxis axis ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuQwtPlotWidget::axisValueFontSize( RiaDefines::PlotAxis axis ) const +int RiuQwtPlotWidget::axisValueFontSize( RiuPlotAxis axis ) const { if ( axisEnabled( axis ) ) { - return m_plot->axisTitle( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).font().pointSize(); + return m_plot->axisTitle( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ).font().pointSize(); } return -1; } @@ -138,18 +139,14 @@ int RiuQwtPlotWidget::axisValueFontSize( RiaDefines::PlotAxis axis ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisFontsAndAlignment( RiaDefines::PlotAxis axis, - int titleFontSize, - int valueFontSize, - bool titleBold, - int alignment ) +void RiuQwtPlotWidget::setAxisFontsAndAlignment( RiuPlotAxis axis, int titleFontSize, int valueFontSize, bool titleBold, int alignment ) { int titleFontPixelSize = caf::FontTools::pointSizeToPixelSize( titleFontSize ); int valueFontPixelSize = caf::FontTools::pointSizeToPixelSize( valueFontSize ); // Axis number font - int qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + int qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); QFont axisFont = m_plot->axisFont( qwtAxis ); axisFont.setPixelSize( valueFontPixelSize ); axisFont.setBold( false ); @@ -181,7 +178,7 @@ void RiuQwtPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int valueFon //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) +void RiuQwtPlotWidget::setAxisTitleText( RiuPlotAxis axis, const QString& title ) { m_axisTitles[axis] = title; applyAxisTitleToQwt( axis ); @@ -190,7 +187,7 @@ void RiuQwtPlotWidget::setAxisTitleText( RiaDefines::PlotAxis axis, const QStrin //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) +void RiuQwtPlotWidget::setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) { m_axisTitlesEnabled[axis] = enable; applyAxisTitleToQwt( axis ); @@ -299,19 +296,19 @@ void RiuQwtPlotWidget::clearLegend() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::pair RiuQwtPlotWidget::axisRange( RiaDefines::PlotAxis axis ) const +std::pair RiuQwtPlotWidget::axisRange( RiuPlotAxis axis ) const { - QwtInterval interval = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).interval(); + QwtInterval interval = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ).interval(); return std::make_pair( interval.minValue(), interval.maxValue() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) +void RiuQwtPlotWidget::setAxisRange( RiuPlotAxis axis, double min, double max ) { // Note: Especially the Y-axis may be inverted - if ( m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->testAttribute( QwtScaleEngine::Inverted ) ) + if ( m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) )->testAttribute( QwtScaleEngine::Inverted ) ) { setAxisScale( axis, max, min ); } @@ -324,28 +321,30 @@ void RiuQwtPlotWidget::setAxisRange( RiaDefines::PlotAxis axis, double min, doub //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) +void RiuQwtPlotWidget::setAxisInverted( RiuPlotAxis axis, bool isInverted ) { - m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->setAttribute( QwtScaleEngine::Inverted, isInverted ); + m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) )->setAttribute( QwtScaleEngine::Inverted, isInverted ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) +void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks ) { - m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Ticks, enableTicks ); - m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Labels, enableLabels ); + m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ) + ->enableComponent( QwtAbstractScaleDraw::Ticks, enableTicks ); + m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ) + ->enableComponent( QwtAbstractScaleDraw::Labels, enableLabels ); recalculateAxisExtents( axis ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) +void RiuQwtPlotWidget::enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) { QwtPlotItemList plotItems = m_plot->itemList( QwtPlotItem::Rtti_PlotGrid ); - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); for ( QwtPlotItem* plotItem : plotItems ) { QwtPlotGrid* grid = static_cast( plotItem ); @@ -369,13 +368,13 @@ void RiuQwtPlotWidget::enableGridLines( RiaDefines::PlotAxis axis, bool majorGri //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis, - double majorTickInterval, - double minorTickInterval, - double minValue, - double maxValue ) +void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiuPlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minValue, + double maxValue ) { - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); if ( scaleEngine ) { @@ -389,15 +388,15 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis, - double majorTickInterval, - double minorTickInterval, - double minTickValue, - double maxTickValue, - double rangeMin, - double rangeMax ) +void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minTickValue, + double maxTickValue, + double rangeMin, + double rangeMax ) { - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); if ( scaleEngine ) { @@ -415,23 +414,21 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAx //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAutoTickIntervalCounts( RiaDefines::PlotAxis axis, - int maxMajorTickIntervalCount, - int maxMinorTickIntervalCount ) +void RiuQwtPlotWidget::setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) { - m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMajorTickIntervalCount ); - m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMinorTickIntervalCount ); + m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMajorTickIntervalCount ); + m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMinorTickIntervalCount ); // Reapply axis limits to force Qwt to use the tick settings. - QwtInterval currentRange = m_plot->axisInterval( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + QwtInterval currentRange = m_plot->axisInterval( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); setAxisScale( axis, currentRange.minValue(), currentRange.maxValue() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RiuQwtPlotWidget::majorTickInterval( RiaDefines::PlotAxis axis ) const +double RiuQwtPlotWidget::majorTickInterval( RiuPlotAxis axis ) const { - QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); QList majorTicks = scaleDiv.ticks( QwtScaleDiv::MajorTick ); if ( majorTicks.size() < 2 ) return 0.0; @@ -441,7 +438,7 @@ double RiuQwtPlotWidget::majorTickInterval( RiaDefines::PlotAxis axis ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RiuQwtPlotWidget::minorTickInterval( RiaDefines::PlotAxis axis ) const +double RiuQwtPlotWidget::minorTickInterval( RiuPlotAxis axis ) const { QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( QwtPlot::xTop ); QList minorTicks = scaleDiv.ticks( QwtScaleDiv::MinorTick ); @@ -453,13 +450,13 @@ double RiuQwtPlotWidget::minorTickInterval( RiaDefines::PlotAxis axis ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RiuQwtPlotWidget::axisExtent( RiaDefines::PlotAxis axis ) const +int RiuQwtPlotWidget::axisExtent( RiuPlotAxis axis ) const { auto [rangeMin, rangeMax] = axisRange( axis ); if ( std::abs( rangeMax - rangeMin ) < 1.0e-14 ) return 0; int lineExtent = 0; - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Ticks ) ) { @@ -468,11 +465,11 @@ int RiuQwtPlotWidget::axisExtent( RiaDefines::PlotAxis axis ) const if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Labels ) ) { - QFont tickLabelFont = m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + QFont tickLabelFont = m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); // Make space for a fairly long value label QSize labelSize = QFontMetrics( tickLabelFont ).boundingRect( QString( "9.9e-9" ) ).size(); - if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) + if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) { lineExtent = labelSize.width(); } @@ -654,10 +651,10 @@ void RiuQwtPlotWidget::applyPlotTitleToQwt() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::applyAxisTitleToQwt( RiaDefines::PlotAxis axis ) +void RiuQwtPlotWidget::applyAxisTitleToQwt( RiuPlotAxis axis ) { QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" ); - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); QwtText axisTitle = m_plot->axisTitle( qwtAxis ); if ( titleToApply != axisTitle.text() ) { @@ -794,9 +791,9 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::recalculateAxisExtents( RiaDefines::PlotAxis axis ) +void RiuQwtPlotWidget::recalculateAxisExtents( RiuPlotAxis axis ) { - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); if ( qwtAxis == QwtPlot::yLeft || qwtAxis == QwtPlot::yRight ) { int extent = axisExtent( axis ); @@ -1054,33 +1051,33 @@ QwtPlot* RiuQwtPlotWidget::qwtPlot() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) +void RiuQwtPlotWidget::enableAxis( RiuPlotAxis axis, bool isEnabled ) { - m_plot->enableAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ), isEnabled ); + m_plot->enableAxis( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), isEnabled ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RiuQwtPlotWidget::axisEnabled( RiaDefines::PlotAxis axis ) const +bool RiuQwtPlotWidget::axisEnabled( RiuPlotAxis axis ) const { - return m_plot->axisEnabled( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + return m_plot->axisEnabled( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) +void RiuQwtPlotWidget::setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) { - m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMinor ); + m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMinor ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) +void RiuQwtPlotWidget::setAxisMaxMajor( RiuPlotAxis axis, int maxMajor ) { - m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMajor ); + m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMajor ); } //-------------------------------------------------------------------------------------------------- @@ -1095,25 +1092,25 @@ void RiuQwtPlotWidget::removeEventFilter() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisAutoScale( RiaDefines::PlotAxis axis, bool autoScale ) +void RiuQwtPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale ) { - m_plot->setAxisAutoScale( RiuQwtPlotTools::toQwtPlotAxis( axis ), autoScale ); + m_plot->setAxisAutoScale( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), autoScale ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) +void RiuQwtPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max ) { - m_plot->setAxisScale( RiuQwtPlotTools::toQwtPlotAxis( axis ), min, max ); + m_plot->setAxisScale( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), min, max ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiaDefines::PlotAxis axis ) const +RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiuPlotAxis axis ) const { - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); QwtLogScaleEngine* logScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); QwtDateScaleEngine* dateScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); @@ -1128,9 +1125,9 @@ RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiaDefines::Plo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::setAxisScaleType( RiaDefines::PlotAxis axis, RiuQwtPlotWidget::AxisScaleType axisScaleType ) +void RiuQwtPlotWidget::setAxisScaleType( RiuPlotAxis axis, RiuQwtPlotWidget::AxisScaleType axisScaleType ) { - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); if ( axisScaleType == AxisScaleType::LOGARITHMIC ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLogScaleEngine ); if ( axisScaleType == AxisScaleType::LINEAR ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLinearScaleEngine ); @@ -1145,6 +1142,15 @@ void RiuQwtPlotWidget::updateAxes() m_plot->updateAxes(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RiuQwtPlotWidget::createNextPlotAxis( RiaDefines::PlotAxis axis ) +{ + // Qwt does not support multiaxis. Just use the default on the given side. + return RiuPlotAxis( axis ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1169,3 +1175,11 @@ const QColor& RiuQwtPlotWidget::backgroundColor() const { return m_plot->canvasBackground().color(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuQwtPlotWidget::isMultiAxisSupported() const +{ + return false; +} diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index 342c0dd182..f0e13b7d5e 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -64,9 +64,9 @@ class RiuQwtPlotWidget : public RiuPlotWidget RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent = nullptr ); ~RiuQwtPlotWidget() override; - int axisTitleFontSize( RiaDefines::PlotAxis axis ) const override; - int axisValueFontSize( RiaDefines::PlotAxis axis ) const override; - void setAxisFontsAndAlignment( RiaDefines::PlotAxis, + int axisTitleFontSize( RiuPlotAxis axis ) const override; + int axisValueFontSize( RiuPlotAxis axis ) const override; + void setAxisFontsAndAlignment( RiuPlotAxis, int titleFontSize, int valueFontSize, bool titleBold = false, @@ -76,20 +76,23 @@ class RiuQwtPlotWidget : public RiuPlotWidget bool titleBold = false, int alignment = (int)Qt::AlignCenter ) override; - void enableAxis( RiaDefines::PlotAxis axis, bool isEnabled ) override; - bool axisEnabled( RiaDefines::PlotAxis axis ) const override; + void enableAxis( RiuPlotAxis axis, bool isEnabled ) override; + bool axisEnabled( RiuPlotAxis axis ) const override; - void setAxisScale( RiaDefines::PlotAxis axis, double min, double max ) override; - void setAxisAutoScale( RiaDefines::PlotAxis axis, bool enable ) override; + void setAxisScale( RiuPlotAxis axis, double min, double max ) override; + void setAxisAutoScale( RiuPlotAxis axis, bool enable ) override; - void setAxisMaxMinor( RiaDefines::PlotAxis axis, int maxMinor ) override; - void setAxisMaxMajor( RiaDefines::PlotAxis axis, int maxMajor ) override; + void setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) override; + void setAxisMaxMajor( RiuPlotAxis axis, int maxMajor ) override; - RiuPlotWidget::AxisScaleType axisScaleType( RiaDefines::PlotAxis axis ) const override; - void setAxisScaleType( RiaDefines::PlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) override; + RiuPlotWidget::AxisScaleType axisScaleType( RiuPlotAxis axis ) const override; + void setAxisScaleType( RiuPlotAxis axis, RiuPlotWidget::AxisScaleType axisScaleType ) override; - void setAxisTitleText( RiaDefines::PlotAxis axis, const QString& title ) override; - void setAxisTitleEnabled( RiaDefines::PlotAxis axis, bool enable ) override; + void setAxisTitleText( RiuPlotAxis axis, const QString& title ) override; + void setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) override; + + RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) override; + bool isMultiAxisSupported() const override; void setPlotTitle( const QString& plotTitle ) override; const QString& plotTitle() const; @@ -102,33 +105,31 @@ class RiuQwtPlotWidget : public RiuPlotWidget void insertLegend( RiuPlotWidget::Legend ) override; void clearLegend() override; - std::pair axisRange( RiaDefines::PlotAxis axis ) const override; - void setAxisRange( RiaDefines::PlotAxis axis, double min, double max ) override; - - void setAxisInverted( RiaDefines::PlotAxis axis, bool isInverted ) override; - void setAxisLabelsAndTicksEnabled( RiaDefines::PlotAxis axis, bool enableLabels, bool enableTicks ) override; - - void enableGridLines( RiaDefines::PlotAxis axis, bool majorGridLines, bool minorGridLines ) override; - - void setMajorAndMinorTickIntervals( RiaDefines::PlotAxis axis, - double majorTickInterval, - double minorTickInterval, - double minValue, - double maxValue ) override; - void setMajorAndMinorTickIntervalsAndRange( RiaDefines::PlotAxis axis, - double majorTickInterval, - double minorTickInterval, - double minTickValue, - double maxTickValue, - double rangeMin, - double rangeMax ) override; - void setAutoTickIntervalCounts( RiaDefines::PlotAxis axis, - int maxMajorTickIntervalCount, - int maxMinorTickIntervalCount ) override; - double majorTickInterval( RiaDefines::PlotAxis axis ) const override; - double minorTickInterval( RiaDefines::PlotAxis axis ) const override; - - int axisExtent( RiaDefines::PlotAxis axis ) const override; + std::pair axisRange( RiuPlotAxis axis ) const override; + void setAxisRange( RiuPlotAxis axis, double min, double max ) override; + + void setAxisInverted( RiuPlotAxis axis, bool isInverted ) override; + void setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks ) override; + + void enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) override; + + void setMajorAndMinorTickIntervals( RiuPlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minValue, + double maxValue ) override; + void setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis, + double majorTickInterval, + double minorTickInterval, + double minTickValue, + double maxTickValue, + double rangeMin, + double rangeMax ) override; + void setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) override; + double majorTickInterval( RiuPlotAxis axis ) const override; + double minorTickInterval( RiuPlotAxis axis ) const override; + + int axisExtent( RiuPlotAxis axis ) const override; QPoint dragStartPosition() const; @@ -180,7 +181,7 @@ class RiuQwtPlotWidget : public RiuPlotWidget void keyPressEvent( QKeyEvent* event ) override; void applyPlotTitleToQwt(); - void applyAxisTitleToQwt( RiaDefines::PlotAxis axis ); + void applyAxisTitleToQwt( RiuPlotAxis axis ); QSize sizeHint() const override; QSize minimumSizeHint() const override; @@ -196,7 +197,7 @@ class RiuQwtPlotWidget : public RiuPlotWidget void highlightPlotItem( const QwtPlotItem* closestItem ); void resetPlotItemHighlighting(); void onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection ); - void recalculateAxisExtents( RiaDefines::PlotAxis axis ); + void recalculateAxisExtents( RiuPlotAxis axis ); private: struct CurveColors diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index 6e9a38430a..7e8562050d 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -415,7 +415,7 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS if ( plotOnWhichYAxis == RIGHT_YAXIS ) { - qwtCurve->setYAxis( RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); + qwtCurve->setYAxis( RiuPlotAxis::defaultRight() ); shouldEnableRightYAxis = true; } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp index 24e663dc77..1ba4ccb8e4 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp @@ -59,7 +59,7 @@ void RiuSummaryQtChartsPlot::useDateBasedTimeAxis( const QString& RiaQDateTimeTools::DateFormatComponents dateComponents, RiaQDateTimeTools::TimeFormatComponents timeComponents ) { - m_plotWidget->setAxisScaleType( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, RiuPlotWidget::AxisScaleType::DATE ); + m_plotWidget->setAxisScaleType( RiuPlotAxis::defaultBottom(), RiuPlotWidget::AxisScaleType::DATE ); RiuQtChartsPlotTools::enableDateBasedBottomXAxis( m_plotWidget, dateFormat, timeFormat, dateComponents, timeComponents ); } @@ -68,7 +68,7 @@ void RiuSummaryQtChartsPlot::useDateBasedTimeAxis( const QString& //-------------------------------------------------------------------------------------------------- void RiuSummaryQtChartsPlot::useTimeBasedTimeAxis() { - m_plotWidget->setAxisScaleType( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, RiuPlotWidget::AxisScaleType::DATE ); + m_plotWidget->setAxisScaleType( RiuPlotAxis::defaultBottom(), RiuPlotWidget::AxisScaleType::DATE ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp index 12296d82cf..2c82457439 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -166,7 +166,7 @@ void RiuSummaryQwtPlot::useTimeBasedTimeAxis() void RiuSummaryQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties ) { RiuPlotAnnotationTool::Orientation orientation = RiuPlotAnnotationTool::Orientation::HORIZONTAL; - if ( axisProperties->plotAxisType() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) + if ( axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) { orientation = RiuPlotAnnotationTool::Orientation::VERTICAL; } diff --git a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp index cab731c8e9..1cf1a08779 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp @@ -139,7 +139,7 @@ RiuWellLogTrack::~RiuWellLogTrack() //-------------------------------------------------------------------------------------------------- void RiuWellLogTrack::setAxisEnabled( QwtPlot::Axis axis, bool enabled ) { - RiaDefines::PlotAxis plotAxis = RiuQwtPlotTools::fromQwtPlotAxis( axis ); + RiuPlotAxis plotAxis = RiuPlotAxis( RiuQwtPlotTools::fromQwtPlotAxis( axis ) ); RiuQwtPlotWidget::enableAxis( plotAxis, enabled ); if ( enabled ) From 15797bd73920059acb1a9f40e8d0d8af49d34f58 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Feb 2022 10:48:55 +0100 Subject: [PATCH 102/406] Preferences : Add flag for default plot type QtCharts or Qwt --- ApplicationLibCode/Application/RiaPreferences.cpp | 13 +++++++++++++ ApplicationLibCode/Application/RiaPreferences.h | 2 ++ .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index b658098346..c846d52c19 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -230,6 +230,9 @@ RiaPreferences::RiaPreferences() CAF_PDM_InitField( &m_openExportedPdfInViewer, "openExportedPdfInViewer", false, "Open Exported PDF in Viewer" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_openExportedPdfInViewer ); + CAF_PDM_InitField( &m_useQtChartsPlotByDefault, "useQtChartsPlotByDefault", false, "Use QtChart as Default Plot Type" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useQtChartsPlotByDefault ); + CAF_PDM_InitField( &m_surfaceImportResamplingDistance, "SurfaceImportResamplingDistance", 100.0, @@ -389,6 +392,8 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& pageSetup->add( &m_pageTopMargin ); pageSetup->add( &m_pageBottomMargin, false ); + uiOrdering.add( &m_useQtChartsPlotByDefault ); + QString unitLabel = " [mm]"; if ( QPageSize( m_pageSize() ).definitionUnits() == QPageSize::Inch ) { @@ -729,6 +734,14 @@ bool RiaPreferences::openExportedPdfInViewer() const return m_openExportedPdfInViewer; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaPreferences::useQtChartsAsDefaultPlotType() const +{ + return m_useQtChartsPlotByDefault; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferences.h b/ApplicationLibCode/Application/RiaPreferences.h index eff3d69aac..272148b53b 100644 --- a/ApplicationLibCode/Application/RiaPreferences.h +++ b/ApplicationLibCode/Application/RiaPreferences.h @@ -84,6 +84,7 @@ class RiaPreferences : public caf::PdmObject QString defaultPlotTemplateAbsolutePath() const; void setDefaultPlotTemplatePath( const QString& templatePath ); bool openExportedPdfInViewer() const; + bool useQtChartsAsDefaultPlotType() const; RiaDefines::ThemeEnum guiTheme() const; @@ -187,6 +188,7 @@ class RiaPreferences : public caf::PdmObject caf::PdmField m_plotTemplateFolders; caf::PdmField m_searchPlotTemplateFoldersRecursively; caf::PdmField m_defaultPlotTemplate; + caf::PdmField m_useQtChartsPlotByDefault; // Script paths caf::PdmField m_octaveExecutable; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 841fd046c9..071b7cda0e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -22,6 +22,7 @@ #include "RiaDefines.h" #include "RiaFieldHandleTools.h" #include "RiaPlotDefines.h" +#include "RiaPreferences.h" #include "RiaRegressionTestRunner.h" #include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryCurveDefinition.h" @@ -213,7 +214,8 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) CAF_PDM_InitScriptableField( &m_description, "PlotDescription", QString( "Summary Plot" ), "Name" ); CAF_PDM_InitScriptableField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves" ); #ifdef USE_QTCHARTS - CAF_PDM_InitScriptableField( &m_useQtChartsPlot, "useQtChartsPlot", false, "Use Qt Charts" ); + bool useQtChart = RiaPreferences::current()->useQtChartsAsDefaultPlotType(); + CAF_PDM_InitScriptableField( &m_useQtChartsPlot, "useQtChartsPlot", useQtChart, "Use Qt Charts" ); #endif CAF_PDM_InitFieldNoDefault( &m_summaryCurveCollection, "SummaryCurveCollection", "" ); m_summaryCurveCollection.uiCapability()->setUiTreeHidden( true ); From 2b39b9501126464ba9dc61e8f245f021278d1d71 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Feb 2022 12:30:49 +0100 Subject: [PATCH 103/406] Add new axis object the side with least axes --- .../Summary/RimSummaryPlot.cpp | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 071b7cda0e..50def6e6b4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2753,15 +2753,50 @@ std::vector RimSummaryPlot::plotAxes() const //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* curve ) { + enum class AxisAssignmentStrategy + { + ALL_TO_LEFT, + ALL_TO_RIGHT, + ALTERNATING + }; + RiaDefines::PlotAxis plotAxis = RiaDefines::PlotAxis::PLOT_AXIS_LEFT; + auto strategy = AxisAssignmentStrategy::ALTERNATING; + if ( strategy == AxisAssignmentStrategy::ALTERNATING ) + { + size_t axisCountLeft = 0; + size_t axisCountRight = 0; + for ( const auto& ap : m_axisProperties ) + { + if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) + axisCountLeft++; + else if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) + axisCountRight++; + } + + if ( axisCountLeft > axisCountRight ) plotAxis = RiaDefines::PlotAxis::PLOT_AXIS_RIGHT; + } + else if ( strategy == AxisAssignmentStrategy::ALL_TO_LEFT ) + { + plotAxis = RiaDefines::PlotAxis::PLOT_AXIS_LEFT; + } + else if ( strategy == AxisAssignmentStrategy::ALL_TO_RIGHT ) + { + plotAxis = RiaDefines::PlotAxis::PLOT_AXIS_RIGHT; + } + RiuPlotAxis newPlotAxis = RiuPlotAxis::defaultLeft(); if ( plotWidget() && plotWidget()->isMultiAxisSupported() ) { newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); - RimPlotAxisProperties* newAxisProperties = new RimPlotAxisProperties; - newAxisProperties->setNameAndAxis( "New Axis", newPlotAxis.axis(), newPlotAxis.index() ); + QString axisObjectName = "New Axis"; + if ( !curve->summaryAddressY().uiText().empty() ) + axisObjectName = QString::fromStdString( curve->summaryAddressY().uiText() ); + + auto* newAxisProperties = new RimPlotAxisProperties; + newAxisProperties->setNameAndAxis( axisObjectName, newPlotAxis.axis(), newPlotAxis.index() ); m_axisProperties.push_back( newAxisProperties ); connectAxisSignals( newAxisProperties ); } From ef4eb63bb97d39a6ca161f0f198b27cf08125f1f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Feb 2022 13:07:40 +0100 Subject: [PATCH 104/406] Janitor: Clean up includes --- .../Application/Tools/RiaQDateTimeTools.cpp | 1 - .../Application/Tools/RiaQDateTimeTools.h | 11 ++--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp index bf398267de..ce0ef34965 100644 --- a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp @@ -22,7 +22,6 @@ #include #include -#include "cafAppEnum.h" #include "cafPdmUiItem.h" #include diff --git a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h index 9dd9f88b15..fe62adfd74 100644 --- a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h +++ b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h @@ -18,20 +18,13 @@ #pragma once -#include "cafAppEnum.h" - -#include -#include - #include -#include -#include -#include -#include #include #include +#include "cafAppEnum.h" + class QDateTime; class QDate; class QTime; From 4ea4479a34832ffdb96844fb9bc4f94b9765e537 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Feb 2022 13:08:02 +0100 Subject: [PATCH 105/406] Move code to RimSummaryCurvesData --- .../Summary/CMakeLists_files.cmake | 2 + .../Summary/RimSummaryCurvesData.cpp | 474 +++++++++++++++++ .../Summary/RimSummaryCurvesData.h | 95 ++++ .../Summary/RimSummaryPlot.cpp | 501 +----------------- 4 files changed, 593 insertions(+), 479 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.h diff --git a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake index ea3b2fff7b..d87ee1e678 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -6,6 +6,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCaseMainCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCaseCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurve.h + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurvesData.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveAppearanceCalculator.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveAutoName.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotAxisFormatter.h @@ -52,6 +53,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCaseMainCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCaseCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurve.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurvesData.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveAppearanceCalculator.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCurveAutoName.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotAxisFormatter.cpp diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp new file mode 100644 index 0000000000..7b809a5d87 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp @@ -0,0 +1,474 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 Equinor +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimSummaryCurvesData.h" + +#include "RiaSummaryCurveDefinition.h" +#include "RiaSummaryTools.h" +#include "RiaTimeHistoryCurveResampler.h" +#include "RimAsciiDataCurve.h" +#include "RimGridTimeHistoryCurve.h" +#include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" +#include "RimSummaryCurve.h" + +#include "RimSummaryPlot.h" +#include "cvfAssert.h" +#include "cvfMath.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurvesData::populateTimeHistoryCurvesData( std::vector curves, + RimSummaryCurvesData* curvesData ) +{ + CVF_ASSERT( curvesData ); + + curvesData->clear(); + + for ( RimGridTimeHistoryCurve* curve : curves ) + { + if ( !curve->isCurveVisible() ) continue; + QString curveCaseName = curve->caseName(); + + CurveData curveData = { curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues() }; + + curvesData->addCurveData( curveCaseName, "", curve->timeStepValues(), curveData ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurvesData::populateAsciiDataCurvesData( std::vector curves, + RimSummaryCurvesData* curvesData ) +{ + CVF_ASSERT( curvesData ); + + curvesData->clear(); + + for ( RimAsciiDataCurve* curve : curves ) + { + if ( !curve->isCurveVisible() ) continue; + + CurveData curveData = { curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues() }; + + curvesData->addCurveDataNoSearch( "", "", curve->timeSteps(), { curveData } ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCurvesData::RimSummaryCurvesData() + : resamplePeriod( RiaQDateTimeTools::DateTimePeriod::NONE ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurvesData::clear() +{ + caseIds.clear(); + timeSteps.clear(); + allCurveData.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurvesData::addCurveData( const QString& caseName, + const QString& ensembleName, + const std::vector& curvetimeSteps, + const CurveData& curveData ) +{ + QString caseId = createCaseId( caseName, ensembleName ); + size_t existingCaseIndex = findCaseIndexForCaseId( caseId, curvetimeSteps.size() ); + + if ( existingCaseIndex == cvf::UNDEFINED_SIZE_T ) + { + caseIds.push_back( caseId ); + timeSteps.push_back( curvetimeSteps ); + allCurveData.push_back( { curveData } ); + } + else + { + CVF_ASSERT( timeSteps[existingCaseIndex].size() == curveData.values.size() ); + + allCurveData[existingCaseIndex].push_back( curveData ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurvesData::addCurveDataNoSearch( const QString& caseName, + const QString& ensembleName, + const std::vector& curvetimeSteps, + const std::vector& curveDataVector ) +{ + QString caseId = createCaseId( caseName, ensembleName ); + + caseIds.push_back( caseId ); + timeSteps.push_back( curvetimeSteps ); + allCurveData.push_back( curveDataVector ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurvesData::populateSummaryCurvesData( std::vector curves, + SummaryCurveType curveType, + RimSummaryCurvesData* curvesData ) +{ + CVF_ASSERT( curvesData ); + + curvesData->clear(); + + for ( RimSummaryCurve* curve : curves ) + { + bool isObservedCurve = curve->summaryCaseY() ? curve->summaryCaseY()->isObservedData() : false; + + if ( !curve->isCurveVisible() ) continue; + if ( isObservedCurve && ( curveType & CURVE_TYPE_OBSERVED ) == 0 ) continue; + if ( !isObservedCurve && ( curveType & CURVE_TYPE_GRID ) == 0 ) continue; + if ( !curve->summaryCaseY() ) continue; + + QString curveCaseName = curve->summaryCaseY()->displayCaseName(); + QString ensembleName; + if ( curve->curveDefinitionY().ensemble() ) + { + ensembleName = curve->curveDefinitionY().ensemble()->name(); + } + + CurveData curveData = { curve->curveExportDescription(), curve->summaryAddressY(), curve->valuesY() }; + CurveData errorCurveData; + + // Error data + auto errorValues = curve->errorValuesY(); + bool hasErrorData = !errorValues.empty(); + + if ( hasErrorData ) + { + errorCurveData.name = curve->curveExportDescription( curve->errorSummaryAddressY() ); + errorCurveData.address = curve->errorSummaryAddressY(); + errorCurveData.values = errorValues; + } + + auto curveDataList = std::vector( { curveData } ); + if ( hasErrorData ) curveDataList.push_back( errorCurveData ); + if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED ) + { + // We have calculated data, and it we cannot assume identical time axis + curvesData->addCurveDataNoSearch( curveCaseName, ensembleName, curve->timeStepsY(), curveDataList ); + } + else + { + for ( auto cd : curveDataList ) + { + curvesData->addCurveData( curveCaseName, ensembleName, curve->timeStepsY(), cd ); + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurvesData::prepareCaseCurvesForExport( RiaQDateTimeTools::DateTimePeriod period, + ResampleAlgorithm algorithm, + const RimSummaryCurvesData& inputCurvesData, + RimSummaryCurvesData* resultCurvesData ) +{ + RiaTimeHistoryCurveResampler resampler; + + resultCurvesData->clear(); + + if ( period != RiaQDateTimeTools::DateTimePeriod::NONE ) + { + // Prepare result data + resultCurvesData->resamplePeriod = period; + + for ( size_t i = 0; i < inputCurvesData.caseIds.size(); i++ ) + { + // Shortcuts to input data + auto& caseId = inputCurvesData.caseIds[i]; + auto& caseTimeSteps = inputCurvesData.timeSteps[i]; + auto& caseCurveData = inputCurvesData.allCurveData[i]; + + // Prepare result data + + for ( auto& curveDataItem : caseCurveData ) + { + resampler.setCurveData( curveDataItem.values, caseTimeSteps ); + + if ( RiaSummaryTools::hasAccumulatedData( curveDataItem.address ) || + algorithm == ResampleAlgorithm::PERIOD_END ) + { + resampler.resampleAndComputePeriodEndValues( period ); + } + else + { + resampler.resampleAndComputeWeightedMeanValues( period ); + } + + auto cd = curveDataItem; + cd.values = resampler.resampledValues(); + + resultCurvesData->addCurveData( caseId, "", resampler.resampledTimeSteps(), cd ); + } + } + } + else + { + *resultCurvesData = inputCurvesData; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurvesData::appendToExportDataForCase( QString& out, + const std::vector& timeSteps, + const std::vector& curveData ) +{ + for ( size_t j = 0; j < timeSteps.size(); j++ ) // time steps & data points + { + if ( j == 0 ) + { + out += "Date and time"; + for ( size_t k = 0; k < curveData.size(); k++ ) // curves + { + out += "\t" + ( curveData[k].name ); + } + } + out += "\n"; + out += QDateTime::fromSecsSinceEpoch( timeSteps[j] ).toUTC().toString( "yyyy-MM-dd hh:mm:ss " ); + + for ( size_t k = 0; k < curveData.size(); k++ ) // curves + { + QString valueText; + if ( j < curveData[k].values.size() ) + { + valueText = QString::number( curveData[k].values[j], 'g', RimSummaryPlot::precision() ); + } + out += "\t" + valueText.rightJustified( 13 ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurvesData::appendToExportData( QString& out, + const std::vector& curvesData, + bool showTimeAsLongString ) +{ + RimSummaryCurvesData data = RimSummaryCurvesData::concatCurvesData( curvesData ); + + if ( data.resamplePeriod != RiaQDateTimeTools::DateTimePeriod::NONE ) + { + time_t minTimeStep = std::numeric_limits::max(); + time_t maxTimeStep = 0; + + for ( auto& timeSteps : data.timeSteps ) + { + if ( !timeSteps.empty() ) + { + if ( timeSteps.front() < minTimeStep ) minTimeStep = timeSteps.front(); + if ( timeSteps.back() > maxTimeStep ) maxTimeStep = timeSteps.back(); + } + } + + auto allTimeSteps = + RiaTimeHistoryCurveResampler::timeStepsFromTimeRange( data.resamplePeriod, minTimeStep, maxTimeStep ); + + out += "\n\n"; + out += "Date and time"; + for ( size_t i = 0; i < data.caseIds.size(); i++ ) + { + for ( size_t j = 0; j < data.allCurveData[i].size(); j++ ) + { + out += "\t" + data.allCurveData[i][j].name; + } + } + out += "\n"; + + std::vector currIndexes( data.caseIds.size() ); + for ( auto& i : currIndexes ) + i = 0; + + for ( auto timeStep : allTimeSteps ) + { + QDateTime timseStepUtc = QDateTime::fromSecsSinceEpoch( timeStep ).toUTC(); + QString timeText; + + if ( showTimeAsLongString ) + { + timeText = timseStepUtc.toString( "yyyy-MM-dd hh:mm:ss " ); + } + else + { + // Subtract one day to make sure the period is reported using the previous period as label + QDateTime oneDayEarlier = timseStepUtc.addDays( -1 ); + + QChar zeroChar( 48 ); + + switch ( data.resamplePeriod ) + { + default: + // Fall through to NONE + case RiaQDateTimeTools::DateTimePeriod::NONE: + timeText = timseStepUtc.toString( "yyyy-MM-dd hh:mm:ss " ); + break; + case RiaQDateTimeTools::DateTimePeriod::DAY: + timeText = oneDayEarlier.toString( "yyyy-MM-dd " ); + break; + case RiaQDateTimeTools::DateTimePeriod::WEEK: + { + timeText = oneDayEarlier.toString( "yyyy" ); + int weekNumber = oneDayEarlier.date().weekNumber(); + timeText += QString( "-W%1" ).arg( weekNumber, 2, 10, zeroChar ); + break; + } + case RiaQDateTimeTools::DateTimePeriod::MONTH: + timeText = oneDayEarlier.toString( "yyyy-MM" ); + break; + case RiaQDateTimeTools::DateTimePeriod::QUARTER: + { + int quarterNumber = oneDayEarlier.date().month() / 3; + timeText = oneDayEarlier.toString( "yyyy" ); + timeText += QString( "-Q%1" ).arg( quarterNumber ); + break; + } + case RiaQDateTimeTools::DateTimePeriod::HALFYEAR: + { + int halfYearNumber = oneDayEarlier.date().month() / 6; + timeText = oneDayEarlier.toString( "yyyy" ); + timeText += QString( "-H%1" ).arg( halfYearNumber ); + break; + } + case RiaQDateTimeTools::DateTimePeriod::YEAR: + timeText = oneDayEarlier.toString( "yyyy" ); + break; + case RiaQDateTimeTools::DateTimePeriod::DECADE: + timeText = oneDayEarlier.toString( "yyyy" ); + break; + } + } + out += timeText; + + for ( size_t i = 0; i < data.caseIds.size(); i++ ) // cases + { + // Check is time step exists in curr case + size_t& currIndex = currIndexes[i]; + bool timeStepExists = currIndex < data.timeSteps[i].size() && timeStep == data.timeSteps[i][currIndex]; + + for ( size_t j = 0; j < data.allCurveData[i].size(); j++ ) // vectors + { + QString valueText; + if ( timeStepExists ) + { + valueText = + QString::number( data.allCurveData[i][j].values[currIndex], 'g', RimSummaryPlot::precision() ); + } + else + { + valueText = "NULL"; + } + out += "\t" + valueText.rightJustified( 13 ); + } + + if ( timeStepExists && currIndex < data.timeSteps[i].size() ) currIndex++; + } + out += "\n"; + } + } + else + { + for ( size_t i = 0; i < data.caseIds.size(); i++ ) + { + out += "\n\n"; + if ( !data.caseIds[i].isEmpty() ) + { + out += "Case: " + data.caseIds[i]; + out += "\n"; + } + + appendToExportDataForCase( out, data.timeSteps[i], data.allCurveData[i] ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCurvesData RimSummaryCurvesData::concatCurvesData( const std::vector& curvesData ) +{ + CVF_ASSERT( !curvesData.empty() ); + + RiaQDateTimeTools::DateTimePeriod period = curvesData.front().resamplePeriod; + RimSummaryCurvesData resultCurvesData; + + resultCurvesData.resamplePeriod = period; + + for ( auto curvesDataItem : curvesData ) + { + if ( curvesDataItem.caseIds.empty() ) continue; + + CVF_ASSERT( curvesDataItem.resamplePeriod == period ); + + resultCurvesData.caseIds.insert( resultCurvesData.caseIds.end(), + curvesDataItem.caseIds.begin(), + curvesDataItem.caseIds.end() ); + resultCurvesData.timeSteps.insert( resultCurvesData.timeSteps.end(), + curvesDataItem.timeSteps.begin(), + curvesDataItem.timeSteps.end() ); + resultCurvesData.allCurveData.insert( resultCurvesData.allCurveData.end(), + curvesDataItem.allCurveData.begin(), + curvesDataItem.allCurveData.end() ); + } + return resultCurvesData; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RimSummaryCurvesData::findCaseIndexForCaseId( const QString& caseId, size_t timeStepCount ) +{ + size_t casePosInList = cvf::UNDEFINED_SIZE_T; + + for ( size_t i = 0; i < caseIds.size(); i++ ) + { + if ( caseId == caseIds[i] && timeSteps[i].size() == timeStepCount ) casePosInList = i; + } + + return casePosInList; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryCurvesData::createCaseId( const QString& caseName, const QString& ensembleName ) +{ + QString caseId = caseName; + if ( !ensembleName.isEmpty() ) caseId += QString( " (%1)" ).arg( ensembleName ); + + return caseId; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.h new file mode 100644 index 0000000000..5811567215 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.h @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 Equinor +// +// ResInsight is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaQDateTimeTools.h" +#include "RifEclipseSummaryAddress.h" + +#include + +class RimSummaryCurve; +class RimGridTimeHistoryCurve; +class RimAsciiDataCurve; + +struct CurveData +{ + QString name; + RifEclipseSummaryAddress address; + std::vector values; +}; + +enum SummaryCurveType +{ + CURVE_TYPE_GRID = 0x1, + CURVE_TYPE_OBSERVED = 0x2 +}; + +enum class ResampleAlgorithm +{ + NONE, + DATA_DECIDES, + PERIOD_END +}; + +class RimSummaryCurvesData +{ +public: + RimSummaryCurvesData(); + void clear(); + + void addCurveData( const QString& caseName, + const QString& ensembleName, + const std::vector& curvetimeSteps, + const CurveData& curveData ); + + void addCurveDataNoSearch( const QString& caseName, + const QString& ensembleName, + const std::vector& curvetimeSteps, + const std::vector& curveDataVector ); + + static void populateSummaryCurvesData( std::vector curves, + SummaryCurveType curveType, + RimSummaryCurvesData* curvesData ); + static void populateTimeHistoryCurvesData( std::vector curves, + RimSummaryCurvesData* curvesData ); + static void populateAsciiDataCurvesData( std::vector curves, RimSummaryCurvesData* curvesData ); + + static void prepareCaseCurvesForExport( RiaQDateTimeTools::DateTimePeriod period, + ResampleAlgorithm algorithm, + const RimSummaryCurvesData& inputCurvesData, + RimSummaryCurvesData* resultCurvesData ); + + static void appendToExportDataForCase( QString& out, + const std::vector& timeSteps, + const std::vector& curveData ); + static void + appendToExportData( QString& out, const std::vector& curvesData, bool showTimeAsLongString ); + RimSummaryCurvesData static concatCurvesData( const std::vector& curvesData ); + +private: + size_t findCaseIndexForCaseId( const QString& caseId, size_t timeStepCount ); + + QString createCaseId( const QString& caseName, const QString& ensembleName ); + +public: + RiaQDateTimeTools::DateTimePeriod resamplePeriod; + std::vector caseIds; + std::vector> timeSteps; + std::vector> allCurveData; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 50def6e6b4..059695890c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -47,6 +47,7 @@ #include "RimSummaryCase.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" +#include "RimSummaryCurvesData.h" #include "RimSummaryPlotAxisFormatter.h" #include "RimSummaryPlotCollection.h" #include "RimSummaryPlotFilterTextCurveSetEditor.h" @@ -86,121 +87,6 @@ CAF_PDM_SOURCE_INIT( RimSummaryPlot, "SummaryPlot" ); -//-------------------------------------------------------------------------------------------------- -/// Internal types -//-------------------------------------------------------------------------------------------------- -enum class ResampleAlgorithm -{ - NONE, - DATA_DECIDES, - PERIOD_END -}; - -struct CurveData -{ - QString name; - RifEclipseSummaryAddress address; - std::vector values; -}; - -class CurvesData -{ -public: - CurvesData() - : resamplePeriod( RiaQDateTimeTools::DateTimePeriod::NONE ) - { - } - void clear() - { - caseIds.clear(); - timeSteps.clear(); - allCurveData.clear(); - } - - void addCurveData( const QString& caseName, - const QString& ensembleName, - const std::vector& curvetimeSteps, - const CurveData& curveData ) - { - QString caseId = createCaseId( caseName, ensembleName ); - size_t existingCaseIndex = findCaseIndexForCaseId( caseId, curvetimeSteps.size() ); - - if ( existingCaseIndex == cvf::UNDEFINED_SIZE_T ) - { - caseIds.push_back( caseId ); - timeSteps.push_back( curvetimeSteps ); - allCurveData.push_back( { curveData } ); - } - else - { - CVF_ASSERT( timeSteps[existingCaseIndex].size() == curveData.values.size() ); - - allCurveData[existingCaseIndex].push_back( curveData ); - } - } - - void addCurveDataNoSearch( const QString& caseName, - const QString& ensembleName, - const std::vector& curvetimeSteps, - const std::vector& curveDataVector ) - { - QString caseId = createCaseId( caseName, ensembleName ); - - caseIds.push_back( caseId ); - timeSteps.push_back( curvetimeSteps ); - allCurveData.push_back( curveDataVector ); - } - -private: - size_t findCaseIndexForCaseId( const QString& caseId, size_t timeStepCount ) - { - size_t casePosInList = cvf::UNDEFINED_SIZE_T; - - for ( size_t i = 0; i < caseIds.size(); i++ ) - { - if ( caseId == caseIds[i] && timeSteps[i].size() == timeStepCount ) casePosInList = i; - } - - return casePosInList; - } - - QString createCaseId( const QString& caseName, const QString& ensembleName ) - { - QString caseId = caseName; - if ( !ensembleName.isEmpty() ) caseId += QString( " (%1)" ).arg( ensembleName ); - - return caseId; - } - -public: - RiaQDateTimeTools::DateTimePeriod resamplePeriod; - std::vector caseIds; - std::vector> timeSteps; - std::vector> allCurveData; -}; - -//-------------------------------------------------------------------------------------------------- -/// Internal functions -//-------------------------------------------------------------------------------------------------- -enum SummaryCurveType -{ - CURVE_TYPE_GRID = 0x1, - CURVE_TYPE_OBSERVED = 0x2 -}; - -void populateSummaryCurvesData( std::vector curves, SummaryCurveType curveType, CurvesData* curvesData ); -void populateTimeHistoryCurvesData( std::vector curves, CurvesData* curvesData ); -void populateAsciiDataCurvesData( std::vector curves, CurvesData* curvesData ); - -void prepareCaseCurvesForExport( RiaQDateTimeTools::DateTimePeriod period, - ResampleAlgorithm algorithm, - const CurvesData& inputCurvesData, - CurvesData* resultCurvesData ); - -void appendToExportDataForCase( QString& out, const std::vector& timeSteps, const std::vector& curveData ); -void appendToExportData( QString& out, const std::vector& curvesData, bool showTimeAsLongString ); -CurvesData concatCurvesData( const std::vector& curvesData ); - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -428,35 +314,42 @@ QString RimSummaryPlot::asciiDataForSummaryPlotExport( RiaQDateTimeTools::DateTi std::vector curves; this->descendantsIncludingThisOfType( curves ); - CurvesData summaryCurvesGridData; - CurvesData summaryCurvesObsData; - populateSummaryCurvesData( curves, CURVE_TYPE_GRID, &summaryCurvesGridData ); - populateSummaryCurvesData( curves, CURVE_TYPE_OBSERVED, &summaryCurvesObsData ); + RimSummaryCurvesData summaryCurvesGridData; + RimSummaryCurvesData summaryCurvesObsData; + RimSummaryCurvesData::populateSummaryCurvesData( curves, CURVE_TYPE_GRID, &summaryCurvesGridData ); + RimSummaryCurvesData::populateSummaryCurvesData( curves, CURVE_TYPE_OBSERVED, &summaryCurvesObsData ); - CurvesData timeHistoryCurvesData; - populateTimeHistoryCurvesData( m_gridTimeHistoryCurves.childObjects(), &timeHistoryCurvesData ); + RimSummaryCurvesData timeHistoryCurvesData; + RimSummaryCurvesData::populateTimeHistoryCurvesData( m_gridTimeHistoryCurves.childObjects(), + &timeHistoryCurvesData ); // Export observed data - appendToExportData( out, { summaryCurvesObsData }, showTimeAsLongString ); + RimSummaryCurvesData::appendToExportData( out, { summaryCurvesObsData }, showTimeAsLongString ); - std::vector exportData( 2 ); + std::vector exportData( 2 ); // Summary grid data for export - prepareCaseCurvesForExport( resamplingPeriod, ResampleAlgorithm::DATA_DECIDES, summaryCurvesGridData, &exportData[0] ); + RimSummaryCurvesData::prepareCaseCurvesForExport( resamplingPeriod, + ResampleAlgorithm::DATA_DECIDES, + summaryCurvesGridData, + &exportData[0] ); // Time history data for export - prepareCaseCurvesForExport( resamplingPeriod, ResampleAlgorithm::PERIOD_END, timeHistoryCurvesData, &exportData[1] ); + RimSummaryCurvesData::prepareCaseCurvesForExport( resamplingPeriod, + ResampleAlgorithm::PERIOD_END, + timeHistoryCurvesData, + &exportData[1] ); // Export resampled summary and time history data - appendToExportData( out, exportData, showTimeAsLongString ); + RimSummaryCurvesData::appendToExportData( out, exportData, showTimeAsLongString ); } // Pasted observed data { - CurvesData asciiCurvesData; - populateAsciiDataCurvesData( m_asciiDataCurves.childObjects(), &asciiCurvesData ); + RimSummaryCurvesData asciiCurvesData; + RimSummaryCurvesData::populateAsciiDataCurvesData( m_asciiDataCurves.childObjects(), &asciiCurvesData ); - appendToExportData( out, { asciiCurvesData }, showTimeAsLongString ); + RimSummaryCurvesData::appendToExportData( out, { asciiCurvesData }, showTimeAsLongString ); } return out; @@ -2384,356 +2277,6 @@ bool RimSummaryPlot::isDeletable() const return plotWindow == nullptr; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void populateTimeHistoryCurvesData( std::vector curves, CurvesData* curvesData ) -{ - CVF_ASSERT( curvesData ); - - curvesData->clear(); - - for ( RimGridTimeHistoryCurve* curve : curves ) - { - if ( !curve->isCurveVisible() ) continue; - QString curveCaseName = curve->caseName(); - - CurveData curveData = { curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues() }; - - curvesData->addCurveData( curveCaseName, "", curve->timeStepValues(), curveData ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void populateAsciiDataCurvesData( std::vector curves, CurvesData* curvesData ) -{ - CVF_ASSERT( curvesData ); - - curvesData->clear(); - - for ( RimAsciiDataCurve* curve : curves ) - { - if ( !curve->isCurveVisible() ) continue; - - CurveData curveData = { curve->curveExportDescription(), RifEclipseSummaryAddress(), curve->yValues() }; - - curvesData->addCurveDataNoSearch( "", "", curve->timeSteps(), { curveData } ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void populateSummaryCurvesData( std::vector curves, SummaryCurveType curveType, CurvesData* curvesData ) -{ - CVF_ASSERT( curvesData ); - - curvesData->clear(); - - for ( RimSummaryCurve* curve : curves ) - { - bool isObservedCurve = curve->summaryCaseY() ? curve->summaryCaseY()->isObservedData() : false; - - if ( !curve->isCurveVisible() ) continue; - if ( isObservedCurve && ( curveType & CURVE_TYPE_OBSERVED ) == 0 ) continue; - if ( !isObservedCurve && ( curveType & CURVE_TYPE_GRID ) == 0 ) continue; - if ( !curve->summaryCaseY() ) continue; - - QString curveCaseName = curve->summaryCaseY()->displayCaseName(); - QString ensembleName; - if ( curve->curveDefinitionY().ensemble() ) - { - ensembleName = curve->curveDefinitionY().ensemble()->name(); - } - - CurveData curveData = { curve->curveExportDescription(), curve->summaryAddressY(), curve->valuesY() }; - CurveData errorCurveData; - - // Error data - auto errorValues = curve->errorValuesY(); - bool hasErrorData = !errorValues.empty(); - - if ( hasErrorData ) - { - errorCurveData.name = curve->curveExportDescription( curve->errorSummaryAddressY() ); - errorCurveData.address = curve->errorSummaryAddressY(); - errorCurveData.values = errorValues; - } - - auto curveDataList = std::vector( { curveData } ); - if ( hasErrorData ) curveDataList.push_back( errorCurveData ); - if ( curve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED ) - { - // We have calculated data, and it we cannot assume identical time axis - curvesData->addCurveDataNoSearch( curveCaseName, ensembleName, curve->timeStepsY(), curveDataList ); - } - else - { - for ( auto cd : curveDataList ) - { - curvesData->addCurveData( curveCaseName, ensembleName, curve->timeStepsY(), cd ); - } - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void prepareCaseCurvesForExport( RiaQDateTimeTools::DateTimePeriod period, - ResampleAlgorithm algorithm, - const CurvesData& inputCurvesData, - CurvesData* resultCurvesData ) -{ - RiaTimeHistoryCurveResampler resampler; - - resultCurvesData->clear(); - - if ( period != RiaQDateTimeTools::DateTimePeriod::NONE ) - { - // Prepare result data - resultCurvesData->resamplePeriod = period; - - for ( size_t i = 0; i < inputCurvesData.caseIds.size(); i++ ) - { - // Shortcuts to input data - auto& caseId = inputCurvesData.caseIds[i]; - auto& caseTimeSteps = inputCurvesData.timeSteps[i]; - auto& caseCurveData = inputCurvesData.allCurveData[i]; - - // Prepare result data - - for ( auto& curveDataItem : caseCurveData ) - { - resampler.setCurveData( curveDataItem.values, caseTimeSteps ); - - if ( RiaSummaryTools::hasAccumulatedData( curveDataItem.address ) || - algorithm == ResampleAlgorithm::PERIOD_END ) - { - resampler.resampleAndComputePeriodEndValues( period ); - } - else - { - resampler.resampleAndComputeWeightedMeanValues( period ); - } - - auto cd = curveDataItem; - cd.values = resampler.resampledValues(); - - resultCurvesData->addCurveData( caseId, "", resampler.resampledTimeSteps(), cd ); - } - } - } - else - { - *resultCurvesData = inputCurvesData; - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void appendToExportDataForCase( QString& out, const std::vector& timeSteps, const std::vector& curveData ) -{ - for ( size_t j = 0; j < timeSteps.size(); j++ ) // time steps & data points - { - if ( j == 0 ) - { - out += "Date and time"; - for ( size_t k = 0; k < curveData.size(); k++ ) // curves - { - out += "\t" + ( curveData[k].name ); - } - } - out += "\n"; - out += QDateTime::fromSecsSinceEpoch( timeSteps[j] ).toUTC().toString( "yyyy-MM-dd hh:mm:ss " ); - - for ( size_t k = 0; k < curveData.size(); k++ ) // curves - { - QString valueText; - if ( j < curveData[k].values.size() ) - { - valueText = QString::number( curveData[k].values[j], 'g', RimSummaryPlot::precision() ); - } - out += "\t" + valueText.rightJustified( 13 ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void appendToExportData( QString& out, const std::vector& curvesData, bool showTimeAsLongString ) -{ - CurvesData data = concatCurvesData( curvesData ); - - if ( data.resamplePeriod != RiaQDateTimeTools::DateTimePeriod::NONE ) - { - time_t minTimeStep = std::numeric_limits::max(); - time_t maxTimeStep = 0; - - for ( auto& timeSteps : data.timeSteps ) - { - if ( !timeSteps.empty() ) - { - if ( timeSteps.front() < minTimeStep ) minTimeStep = timeSteps.front(); - if ( timeSteps.back() > maxTimeStep ) maxTimeStep = timeSteps.back(); - } - } - - auto allTimeSteps = - RiaTimeHistoryCurveResampler::timeStepsFromTimeRange( data.resamplePeriod, minTimeStep, maxTimeStep ); - - out += "\n\n"; - out += "Date and time"; - for ( size_t i = 0; i < data.caseIds.size(); i++ ) - { - for ( size_t j = 0; j < data.allCurveData[i].size(); j++ ) - { - out += "\t" + data.allCurveData[i][j].name; - } - } - out += "\n"; - - std::vector currIndexes( data.caseIds.size() ); - for ( auto& i : currIndexes ) - i = 0; - - for ( auto timeStep : allTimeSteps ) - { - QDateTime timseStepUtc = QDateTime::fromSecsSinceEpoch( timeStep ).toUTC(); - QString timeText; - - if ( showTimeAsLongString ) - { - timeText = timseStepUtc.toString( "yyyy-MM-dd hh:mm:ss " ); - } - else - { - // Subtract one day to make sure the period is reported using the previous period as label - QDateTime oneDayEarlier = timseStepUtc.addDays( -1 ); - - QChar zeroChar( 48 ); - - switch ( data.resamplePeriod ) - { - default: - // Fall through to NONE - case RiaQDateTimeTools::DateTimePeriod::NONE: - timeText = timseStepUtc.toString( "yyyy-MM-dd hh:mm:ss " ); - break; - case RiaQDateTimeTools::DateTimePeriod::DAY: - timeText = oneDayEarlier.toString( "yyyy-MM-dd " ); - break; - case RiaQDateTimeTools::DateTimePeriod::WEEK: - { - timeText = oneDayEarlier.toString( "yyyy" ); - int weekNumber = oneDayEarlier.date().weekNumber(); - timeText += QString( "-W%1" ).arg( weekNumber, 2, 10, zeroChar ); - break; - } - case RiaQDateTimeTools::DateTimePeriod::MONTH: - timeText = oneDayEarlier.toString( "yyyy-MM" ); - break; - case RiaQDateTimeTools::DateTimePeriod::QUARTER: - { - int quarterNumber = oneDayEarlier.date().month() / 3; - timeText = oneDayEarlier.toString( "yyyy" ); - timeText += QString( "-Q%1" ).arg( quarterNumber ); - break; - } - case RiaQDateTimeTools::DateTimePeriod::HALFYEAR: - { - int halfYearNumber = oneDayEarlier.date().month() / 6; - timeText = oneDayEarlier.toString( "yyyy" ); - timeText += QString( "-H%1" ).arg( halfYearNumber ); - break; - } - case RiaQDateTimeTools::DateTimePeriod::YEAR: - timeText = oneDayEarlier.toString( "yyyy" ); - break; - case RiaQDateTimeTools::DateTimePeriod::DECADE: - timeText = oneDayEarlier.toString( "yyyy" ); - break; - } - } - out += timeText; - - for ( size_t i = 0; i < data.caseIds.size(); i++ ) // cases - { - // Check is time step exists in curr case - size_t& currIndex = currIndexes[i]; - bool timeStepExists = currIndex < data.timeSteps[i].size() && timeStep == data.timeSteps[i][currIndex]; - - for ( size_t j = 0; j < data.allCurveData[i].size(); j++ ) // vectors - { - QString valueText; - if ( timeStepExists ) - { - valueText = - QString::number( data.allCurveData[i][j].values[currIndex], 'g', RimSummaryPlot::precision() ); - } - else - { - valueText = "NULL"; - } - out += "\t" + valueText.rightJustified( 13 ); - } - - if ( timeStepExists && currIndex < data.timeSteps[i].size() ) currIndex++; - } - out += "\n"; - } - } - else - { - for ( size_t i = 0; i < data.caseIds.size(); i++ ) - { - out += "\n\n"; - if ( !data.caseIds[i].isEmpty() ) - { - out += "Case: " + data.caseIds[i]; - out += "\n"; - } - - appendToExportDataForCase( out, data.timeSteps[i], data.allCurveData[i] ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -CurvesData concatCurvesData( const std::vector& curvesData ) -{ - CVF_ASSERT( !curvesData.empty() ); - - RiaQDateTimeTools::DateTimePeriod period = curvesData.front().resamplePeriod; - CurvesData resultCurvesData; - - resultCurvesData.resamplePeriod = period; - - for ( auto curvesDataItem : curvesData ) - { - if ( curvesDataItem.caseIds.empty() ) continue; - - CVF_ASSERT( curvesDataItem.resamplePeriod == period ); - - resultCurvesData.caseIds.insert( resultCurvesData.caseIds.end(), - curvesDataItem.caseIds.begin(), - curvesDataItem.caseIds.end() ); - resultCurvesData.timeSteps.insert( resultCurvesData.timeSteps.end(), - curvesDataItem.timeSteps.begin(), - curvesDataItem.timeSteps.end() ); - resultCurvesData.allCurveData.insert( resultCurvesData.allCurveData.end(), - curvesDataItem.allCurveData.begin(), - curvesDataItem.allCurveData.end() ); - } - return resultCurvesData; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- From f2b6291a6b9224059e3783ae554368e471138a62 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Feb 2022 13:27:00 +0100 Subject: [PATCH 106/406] Refactor RimSummaryCurvesData --- .../Summary/RimSummaryCurvesData.cpp | 78 +++++++++++++++---- .../Summary/RimSummaryCurvesData.h | 9 ++- .../Summary/RimSummaryPlot.cpp | 50 ++---------- 3 files changed, 79 insertions(+), 58 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp index 7b809a5d87..1cbcba7995 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp @@ -21,13 +21,14 @@ #include "RiaSummaryCurveDefinition.h" #include "RiaSummaryTools.h" #include "RiaTimeHistoryCurveResampler.h" + #include "RimAsciiDataCurve.h" #include "RimGridTimeHistoryCurve.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" - #include "RimSummaryPlot.h" + #include "cvfAssert.h" #include "cvfMath.h" @@ -130,6 +131,56 @@ void RimSummaryCurvesData::addCurveDataNoSearch( const QString& c allCurveData.push_back( curveDataVector ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryCurvesData::createTextForExport( const std::vector& curves, + const std::vector& asciiCurves, + const std::vector& gridCurves, + RiaQDateTimeTools::DateTimePeriod resamplingPeriod, + bool showTimeAsLongString ) +{ + QString out; + + RimSummaryCurvesData summaryCurvesGridData; + RimSummaryCurvesData summaryCurvesObsData; + RimSummaryCurvesData::populateSummaryCurvesData( curves, SummaryCurveType::CURVE_TYPE_GRID, &summaryCurvesGridData ); + RimSummaryCurvesData::populateSummaryCurvesData( curves, SummaryCurveType::CURVE_TYPE_OBSERVED, &summaryCurvesObsData ); + + RimSummaryCurvesData timeHistoryCurvesData; + RimSummaryCurvesData::populateTimeHistoryCurvesData( gridCurves, &timeHistoryCurvesData ); + + // Export observed data + RimSummaryCurvesData::appendToExportData( out, { summaryCurvesObsData }, showTimeAsLongString ); + + std::vector exportData( 2 ); + + // Summary grid data for export + RimSummaryCurvesData::prepareCaseCurvesForExport( resamplingPeriod, + ResampleAlgorithm::DATA_DECIDES, + summaryCurvesGridData, + &exportData[0] ); + + // Time history data for export + RimSummaryCurvesData::prepareCaseCurvesForExport( resamplingPeriod, + ResampleAlgorithm::PERIOD_END, + timeHistoryCurvesData, + &exportData[1] ); + + // Export resampled summary and time history data + RimSummaryCurvesData::appendToExportData( out, exportData, showTimeAsLongString ); + + // Pasted observed data + { + RimSummaryCurvesData asciiCurvesData; + RimSummaryCurvesData::populateAsciiDataCurvesData( asciiCurves, &asciiCurvesData ); + + RimSummaryCurvesData::appendToExportData( out, { asciiCurvesData }, showTimeAsLongString ); + } + + return out; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -146,8 +197,8 @@ void RimSummaryCurvesData::populateSummaryCurvesData( std::vectorsummaryCaseY() ? curve->summaryCaseY()->isObservedData() : false; if ( !curve->isCurveVisible() ) continue; - if ( isObservedCurve && ( curveType & CURVE_TYPE_OBSERVED ) == 0 ) continue; - if ( !isObservedCurve && ( curveType & CURVE_TYPE_GRID ) == 0 ) continue; + if ( isObservedCurve && ( curveType != SummaryCurveType::CURVE_TYPE_OBSERVED ) ) continue; + if ( !isObservedCurve && ( curveType != SummaryCurveType::CURVE_TYPE_GRID ) ) continue; if ( !curve->summaryCaseY() ) continue; QString curveCaseName = curve->summaryCaseY()->displayCaseName(); @@ -180,7 +231,7 @@ void RimSummaryCurvesData::populateSummaryCurvesData( std::vectoraddCurveData( curveCaseName, ensembleName, curve->timeStepsY(), cd ); } @@ -253,20 +304,20 @@ void RimSummaryCurvesData::appendToExportDataForCase( QString& if ( j == 0 ) { out += "Date and time"; - for ( size_t k = 0; k < curveData.size(); k++ ) // curves + for ( const auto& k : curveData ) // curves { - out += "\t" + ( curveData[k].name ); + out += "\t" + ( k.name ); } } out += "\n"; out += QDateTime::fromSecsSinceEpoch( timeSteps[j] ).toUTC().toString( "yyyy-MM-dd hh:mm:ss " ); - for ( size_t k = 0; k < curveData.size(); k++ ) // curves + for ( const auto& k : curveData ) // curves { QString valueText; - if ( j < curveData[k].values.size() ) + if ( j < k.values.size() ) { - valueText = QString::number( curveData[k].values[j], 'g', RimSummaryPlot::precision() ); + valueText = QString::number( k.values[j], 'g', RimSummaryPlot::precision() ); } out += "\t" + valueText.rightJustified( 13 ); } @@ -303,9 +354,9 @@ void RimSummaryCurvesData::appendToExportData( QString& out += "Date and time"; for ( size_t i = 0; i < data.caseIds.size(); i++ ) { - for ( size_t j = 0; j < data.allCurveData[i].size(); j++ ) + for ( auto& j : data.allCurveData[i] ) { - out += "\t" + data.allCurveData[i][j].name; + out += "\t" + j.name; } } out += "\n"; @@ -380,13 +431,12 @@ void RimSummaryCurvesData::appendToExportData( QString& size_t& currIndex = currIndexes[i]; bool timeStepExists = currIndex < data.timeSteps[i].size() && timeStep == data.timeSteps[i][currIndex]; - for ( size_t j = 0; j < data.allCurveData[i].size(); j++ ) // vectors + for ( auto& j : data.allCurveData[i] ) // vectors { QString valueText; if ( timeStepExists ) { - valueText = - QString::number( data.allCurveData[i][j].values[currIndex], 'g', RimSummaryPlot::precision() ); + valueText = QString::number( j.values[currIndex], 'g', RimSummaryPlot::precision() ); } else { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.h index 5811567215..23e4f225c9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.h @@ -34,7 +34,7 @@ struct CurveData std::vector values; }; -enum SummaryCurveType +enum class SummaryCurveType { CURVE_TYPE_GRID = 0x1, CURVE_TYPE_OBSERVED = 0x2 @@ -63,6 +63,13 @@ class RimSummaryCurvesData const std::vector& curvetimeSteps, const std::vector& curveDataVector ); + static QString createTextForExport( const std::vector& curves, + const std::vector& asciiCurves, + const std::vector& gridCurves, + RiaQDateTimeTools::DateTimePeriod resamplingPeriod, + bool showTimeAsLongString ); + +private: static void populateSummaryCurvesData( std::vector curves, SummaryCurveType curveType, RimSummaryCurvesData* curvesData ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 059695890c..b86b8d565a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -307,52 +307,16 @@ QString RimSummaryPlot::asciiDataForPlotExport() const QString RimSummaryPlot::asciiDataForSummaryPlotExport( RiaQDateTimeTools::DateTimePeriod resamplingPeriod, bool showTimeAsLongString ) const { - QString out; - - // Summary and time history (from grid) curves - { - std::vector curves; - this->descendantsIncludingThisOfType( curves ); - - RimSummaryCurvesData summaryCurvesGridData; - RimSummaryCurvesData summaryCurvesObsData; - RimSummaryCurvesData::populateSummaryCurvesData( curves, CURVE_TYPE_GRID, &summaryCurvesGridData ); - RimSummaryCurvesData::populateSummaryCurvesData( curves, CURVE_TYPE_OBSERVED, &summaryCurvesObsData ); - - RimSummaryCurvesData timeHistoryCurvesData; - RimSummaryCurvesData::populateTimeHistoryCurvesData( m_gridTimeHistoryCurves.childObjects(), - &timeHistoryCurvesData ); - - // Export observed data - RimSummaryCurvesData::appendToExportData( out, { summaryCurvesObsData }, showTimeAsLongString ); - - std::vector exportData( 2 ); - - // Summary grid data for export - RimSummaryCurvesData::prepareCaseCurvesForExport( resamplingPeriod, - ResampleAlgorithm::DATA_DECIDES, - summaryCurvesGridData, - &exportData[0] ); - - // Time history data for export - RimSummaryCurvesData::prepareCaseCurvesForExport( resamplingPeriod, - ResampleAlgorithm::PERIOD_END, - timeHistoryCurvesData, - &exportData[1] ); - - // Export resampled summary and time history data - RimSummaryCurvesData::appendToExportData( out, exportData, showTimeAsLongString ); - } + std::vector curves; + this->descendantsIncludingThisOfType( curves ); - // Pasted observed data - { - RimSummaryCurvesData asciiCurvesData; - RimSummaryCurvesData::populateAsciiDataCurvesData( m_asciiDataCurves.childObjects(), &asciiCurvesData ); + auto gridCurves = m_gridTimeHistoryCurves.childObjects(); + auto asciiCurves = m_asciiDataCurves.childObjects(); - RimSummaryCurvesData::appendToExportData( out, { asciiCurvesData }, showTimeAsLongString ); - } + QString text = + RimSummaryCurvesData::createTextForExport( curves, asciiCurves, gridCurves, resamplingPeriod, showTimeAsLongString ); - return out; + return text; } //-------------------------------------------------------------------------------------------------- From 316cb222d9b1aae4abb7f5e746ee34b93cdbce3a Mon Sep 17 00:00:00 2001 From: Eirik Marthinsen Date: Mon, 7 Feb 2022 12:01:28 +0100 Subject: [PATCH 107/406] CMake: Add fast_float to list of submodules to init CMake is set to import submodules by default but fast_float was missing from the list. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 62303eabc9..a24dd8b881 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -264,7 +264,7 @@ set(CMAKE_CXX_COMPILER_LAUNCHER ${TEMP_CMAKE_CXX_COMPILER_LAUNCHER}) # ############################################################################## # Go through required git submodules # # ############################################################################## -list(APPEND THIRD_PARTY_SUBMODULES qwt) +list(APPEND THIRD_PARTY_SUBMODULES fast_float qwt) # ############################################################################## # Init GIT submodules if they haven't already # From 64bed86f8fadf524b6afd1f076cd2425e0472f18 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 7 Feb 2022 18:38:19 +0100 Subject: [PATCH 108/406] Intersection : Add Python support for triangle and result values (#8505) #8508 Python : Make sure an empty list will be received as empty list in Python Co-authored-by: magnesj --- ...udedCurveIntersectionGeometryGenerator.cpp | 34 ++ ...trudedCurveIntersectionGeometryGenerator.h | 4 + ...ivIntersectionGeometryGeneratorInterface.h | 7 +- .../RimExtrudedCurveIntersection.cpp | 25 +- .../RimIntersectionCollection.cpp | 14 +- .../Intersections/RimIntersectionCollection.h | 2 + .../CMakeLists_files.cmake | 2 + .../RimcDataContainerDouble.cpp | 11 + .../RimcDataContainerDouble.h | 2 + .../RimcElasticProperties.cpp | 2 +- .../RimcIntersection.cpp | 365 ++++++++++++++++++ .../RimcIntersection.h | 117 ++++++ .../RimcStimPlanModelTemplateCollection.cpp | 2 +- .../RimcSummaryCase.cpp | 5 +- .../RimcSurfaceCollection.cpp | 2 +- .../RiuTimeStepChangedHandler.cpp | 11 +- .../cafPdmScripting/cafPdmPythonGenerator.cpp | 15 +- .../PythonExamples/create_intersection.py | 56 +++ GrpcInterface/Python/rips/pdmobject.py | 3 + GrpcInterface/Python/rips/tests/test_wells.py | 69 ++++ ResInsightVersion.cmake | 2 +- 21 files changed, 722 insertions(+), 28 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.cpp create mode 100644 ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.h create mode 100644 GrpcInterface/Python/rips/PythonExamples/create_intersection.py diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp index 50ae5d6874..5564cd9ced 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.cpp @@ -478,6 +478,15 @@ void RivExtrudedCurveIntersectionGeometryGenerator::calculateArrays() point1 = point1.getTransformedPoint( invSectionCS ); point2 = point2.getTransformedPoint( invSectionCS ); + if ( m_isFlattened ) + { + // The points are transformed in to the XZ-plane with Y = zero. + // Set all y values to zero to avoid numerical issues + point0.y() = 0.0; + point1.y() = 0.0; + point2.y() = 0.0; + } + triangleVertices.emplace_back( point0 ); triangleVertices.emplace_back( point1 ); triangleVertices.emplace_back( point2 ); @@ -765,6 +774,31 @@ const cvf::Vec3fArray* RivExtrudedCurveIntersectionGeometryGenerator::triangleVx return m_triangleVxes.p(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const cvf::Vec3fArray* RivExtrudedCurveIntersectionGeometryGenerator::cellMeshVxes() const +{ + CVF_ASSERT( m_cellBorderLineVxes->size() ); + return m_cellBorderLineVxes.p(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const cvf::Vec3fArray* RivExtrudedCurveIntersectionGeometryGenerator::faultMeshVxes() const +{ + return m_faultCellBorderLineVxes.p(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RivExtrudedCurveIntersectionGeometryGenerator::ensureGeometryIsCalculated() +{ + calculateArrays(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.h b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.h index 14c75d1038..5ef8bec7c0 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.h +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionGeometryGenerator.h @@ -81,6 +81,10 @@ class RivExtrudedCurveIntersectionGeometryGenerator : public cvf::Object, public const std::vector& triangleToCellIndex() const override; const std::vector& triangleVxToCellCornerInterpolationWeights() const override; const cvf::Vec3fArray* triangleVxes() const override; + const cvf::Vec3fArray* cellMeshVxes() const override; + const cvf::Vec3fArray* faultMeshVxes() const override; + + void ensureGeometryIsCalculated(); private: void calculateArrays(); diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionGeometryGeneratorInterface.h b/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionGeometryGeneratorInterface.h index e3e42259eb..41c5f42096 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionGeometryGeneratorInterface.h +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivIntersectionGeometryGeneratorInterface.h @@ -27,8 +27,11 @@ class RivIntersectionGeometryGeneratorInterface { public: - virtual bool isAnyGeometryPresent() const = 0; - virtual const std::vector& triangleToCellIndex() const = 0; + virtual ~RivIntersectionGeometryGeneratorInterface() = default; + virtual bool isAnyGeometryPresent() const = 0; + virtual const std::vector& triangleToCellIndex() const = 0; virtual const std::vector& triangleVxToCellCornerInterpolationWeights() const = 0; virtual const cvf::Vec3fArray* triangleVxes() const = 0; + virtual const cvf::Vec3fArray* cellMeshVxes() const { return nullptr; }; + virtual const cvf::Vec3fArray* faultMeshVxes() const { return nullptr; }; }; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp index 1372cd0315..bcbd45105e 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp @@ -52,12 +52,14 @@ #include "cafCmdFeature.h" #include "cafCmdFeatureManager.h" +#include "cafPdmFieldScriptingCapability.h" +#include "cafPdmFieldScriptingCapabilityCvfVec3d.h" +#include "cafPdmObjectScriptingCapability.h" #include "cafPdmUiCheckBoxEditor.h" #include "cafPdmUiDoubleSliderEditor.h" #include "cafPdmUiListEditor.h" #include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiSliderEditor.h" - #include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeSelectionEditor.h" #include "cvfBoundingBox.h" @@ -73,7 +75,7 @@ void caf::AppEnum::setUp() addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_SIMULATION_WELL, "CS_SIMULATION_WELL", "Simulation Well" ); addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE, "CS_POLYLINE", "Polyline" ); addItem( RimExtrudedCurveIntersection::CrossSectionEnum::CS_AZIMUTHLINE, "CS_AZIMUTHLINE", "Azimuth and Dip" ); - setDefault( RimExtrudedCurveIntersection::CrossSectionEnum::CS_WELL_PATH ); + setDefault( RimExtrudedCurveIntersection::CrossSectionEnum::CS_POLYLINE ); } template <> @@ -87,7 +89,7 @@ void caf::AppEnum::setUp() } // namespace caf -CAF_PDM_SOURCE_INIT( RimExtrudedCurveIntersection, "CrossSection" ); +CAF_PDM_SOURCE_INIT( RimExtrudedCurveIntersection, "CurveIntersection", "CrossSection" ); //-------------------------------------------------------------------------------------------------- /// @@ -196,14 +198,19 @@ void RimExtrudedCurveIntersection::configureForAzimuthLine() //-------------------------------------------------------------------------------------------------- RimExtrudedCurveIntersection::RimExtrudedCurveIntersection() { - CAF_PDM_InitObject( "Intersection", ":/CrossSection16x16.png" ); - CAF_PDM_InitField( &m_name, "UserDescription", QString( "Intersection Name" ), "Name" ); + CAF_PDM_InitScriptableObject( "Intersection", ":/CrossSection16x16.png" ); + CAF_PDM_InitScriptableFieldWithScriptKeyword( &m_name, "UserDescription", "Name", QString( "Intersection Name" ), "Name" ); - CAF_PDM_InitFieldNoDefault( &m_type, "Type", "Type" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_type, "Type", "Type" ); CAF_PDM_InitFieldNoDefault( &m_direction, "Direction", "Direction" ); - CAF_PDM_InitFieldNoDefault( &m_wellPath, "WellPath", "Well Path " ); - CAF_PDM_InitFieldNoDefault( &m_simulationWell, "SimulationWell", "Simulation Well" ); - CAF_PDM_InitFieldNoDefault( &m_userPolylineXyz, "Points", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_wellPath, "WellPath", "Well Path " ); + CAF_PDM_InitScriptableFieldNoDefault( &m_simulationWell, "SimulationWell", "Simulation Well" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_userPolylineXyz, + "Points", + "Points", + "", + "Use Ctrl-C for copy and Ctrl-V for paste", + "" ); CAF_PDM_InitFieldNoDefault( &m_userPolylineXydForUi, "PointsUi", "Points", "", "Use Ctrl-C for copy and Ctrl-V for paste", "" ); m_userPolylineXydForUi.registerSetMethod( this, &RimExtrudedCurveIntersection::setPointsFromXYD ); diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp index 8fa52c288f..850c9668e8 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp @@ -38,19 +38,20 @@ #include "RivBoxIntersectionPartMgr.h" #include "RivExtrudedCurveIntersectionPartMgr.h" +#include "cafPdmObjectScriptingCapability.h" #include "cafPdmUiCheckBoxEditor.h" #include "cafPdmUiDoubleSliderEditor.h" #include "cafPdmUiTreeOrdering.h" #include "cvfModelBasicList.h" -CAF_PDM_SOURCE_INIT( RimIntersectionCollection, "CrossSectionCollection" ); +CAF_PDM_SOURCE_INIT( RimIntersectionCollection, "IntersectionCollection", "CrossSectionCollection" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimIntersectionCollection::RimIntersectionCollection() { - CAF_PDM_InitObject( "Intersections", ":/CrossSections16x16.png" ); + CAF_PDM_InitScriptableObject( "Intersections", ":/CrossSections16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_intersections, "CrossSections", "Intersections" ); m_intersections.uiCapability()->setUiTreeHidden( true ); @@ -404,6 +405,15 @@ void RimIntersectionCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* rebuild3dView(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimIntersectionCollection::onChildAdded( caf::PdmFieldHandle* containerForNewObject ) +{ + syncronize2dIntersectionViews(); + rebuild3dView(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h index d15a23c0d4..cb48b86ecc 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.h @@ -83,6 +83,8 @@ class RimIntersectionCollection : public caf::PdmObject void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector& referringObjects ) override; + void onChildAdded( caf::PdmFieldHandle* containerForNewObject ) override; + protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; caf::PdmFieldHandle* objectToggleField() override; diff --git a/ApplicationLibCode/ProjectDataModelCommands/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModelCommands/CMakeLists_files.cmake index 46472a002b..ce24800ff7 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModelCommands/CMakeLists_files.cmake @@ -20,6 +20,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimcModeledWellPath.h ${CMAKE_CURRENT_LIST_DIR}/RimcWellPath.h ${CMAKE_CURRENT_LIST_DIR}/RimcFractureTemplateCollection.h + ${CMAKE_CURRENT_LIST_DIR}/RimcIntersection.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -44,6 +45,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimcModeledWellPath.cpp ${CMAKE_CURRENT_LIST_DIR}/RimcWellPath.cpp ${CMAKE_CURRENT_LIST_DIR}/RimcFractureTemplateCollection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimcIntersection.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.cpp index 0627fb5239..e2c5729761 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.cpp @@ -32,3 +32,14 @@ RimcDataContainerDouble::RimcDataContainerDouble() CAF_PDM_InitScriptableObject( "Data Container Float" ); CAF_PDM_InitScriptableFieldNoDefault( &m_doubleValues, "values", "Float Values" ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimcDataContainerDouble* RimcDataContainerDouble::create( const std::vector& values ) +{ + auto obj = new RimcDataContainerDouble; + obj->m_doubleValues = values; + + return obj; +} diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.h b/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.h index a90fbb94aa..348ed07681 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.h +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcDataContainerDouble.h @@ -31,5 +31,7 @@ class RimcDataContainerDouble : public caf::PdmObject public: RimcDataContainerDouble(); + static RimcDataContainerDouble* create( const std::vector& values ); + caf::PdmField> m_doubleValues; }; diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcElasticProperties.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcElasticProperties.cpp index a04474689d..24a47cc18a 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcElasticProperties.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcElasticProperties.cpp @@ -37,7 +37,7 @@ RimcElasticProperties_addPropertyScaling::RimcElasticProperties_addPropertyScali CAF_PDM_InitScriptableFieldNoDefault( &m_formation, "Formation", "", "", "", "Formation" ); CAF_PDM_InitScriptableFieldNoDefault( &m_facies, "Facies", "", "", "", "Facies" ); CAF_PDM_InitScriptableFieldNoDefault( &m_property, "Property", "", "", "", "Property" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_scale, "Scale", "", "", "", "Scale" ); + CAF_PDM_InitScriptableField( &m_scale, "Scale", 1.0, "", "", "", "Scale" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.cpp new file mode 100644 index 0000000000..266190e12c --- /dev/null +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.cpp @@ -0,0 +1,365 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimcIntersection.h" + +#include "RiaLogging.h" + +#include "RigResultAccessor.h" +#include "RigResultAccessorFactory.h" + +#include "Rim2dIntersectionView.h" +#include "RimEclipseCase.h" +#include "RimEclipseCellColors.h" +#include "RimEclipseResultDefinition.h" +#include "RimEclipseView.h" +#include "RimExtrudedCurveIntersection.h" +#include "RimIntersectionResultDefinition.h" + +#include "RimcDataContainerDouble.h" + +#include "RivExtrudedCurveIntersectionGeometryGenerator.h" +#include "RivExtrudedCurveIntersectionPartMgr.h" +#include "RivIntersectionGeometryGeneratorInterface.h" +#include "RivIntersectionHexGridInterface.h" + +#include "cafPdmAbstractFieldScriptingCapability.h" +#include "cafPdmFieldScriptingCapability.h" +#include "cafPdmFieldScriptingCapabilityCvfVec3d.h" +#include "cafPdmObjectScriptingCapability.h" + +#include + +namespace caf +{ +template <> +void caf::AppEnum::setUp() +{ + addItem( RimcTriangleGeometry::GeometryType::FULL_3D, "FULL_3D", "Full 3DDynamic" ); + addItem( RimcTriangleGeometry::GeometryType::PROJECTED_TO_PLANE, "PROJECTED_TO_PLANE", "Projected To Plane" ); + setDefault( RimcTriangleGeometry::GeometryType::FULL_3D ); +} +}; // namespace caf + +CAF_PDM_SOURCE_INIT( RimcTriangleGeometry, "TriangleGeometry" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimcTriangleGeometry::RimcTriangleGeometry() +{ + CAF_PDM_InitScriptableObject( "Triangle Geometry" ); + + CAF_PDM_InitScriptableFieldNoDefault( &m_x, "XCoords", "X coords" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_y, "YCoords", "Y coords" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_z, "ZCoords", "Z coords" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_connections, "Connections", "Indices to triangle vertices" ); + + CAF_PDM_InitScriptableFieldNoDefault( &m_meshX, "MeshXCoords", "Mesh X coords" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_meshY, "MeshYCoords", "Mesh Y coords" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_meshZ, "MeshZCoords", "Mesh Z coords" ); + + CAF_PDM_InitScriptableFieldNoDefault( &m_faultMeshX, "FaultMeshXCoords", "Fault Mesh X coords" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_faultMeshY, "FaultmeshYCoords", "Fault Mesh Y coords" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_faultMeshZ, "FaultmeshZCoords", "Fault Mesh Z coords" ); + + CAF_PDM_InitScriptableFieldNoDefault( &m_displayModelOffset, "DisplayModelOffset", "Display Model Offset" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimcTriangleGeometry* RimcTriangleGeometry::createFromVertices( const std::vector& vertices ) +{ + std::vector conn; + if ( !vertices.empty() ) + { + conn.resize( vertices.size() ); + std::iota( conn.begin(), conn.end(), 0 ); + } + + return createFromVerticesAndConnections( vertices, conn ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimcTriangleGeometry* RimcTriangleGeometry::createFromVerticesAndConnections( const std::vector& vertices, + const std::vector& connections ) +{ + auto [xVals, yVals, zVals] = assignCoordinatesToSeparateVectors( vertices ); + + auto obj = new RimcTriangleGeometry; + obj->m_x = xVals; + obj->m_y = yVals; + obj->m_z = zVals; + + obj->m_connections = connections; + + return obj; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimcTriangleGeometry::setMeshVertices( const std::vector& vertices ) +{ + auto [xVals, yVals, zVals] = assignCoordinatesToSeparateVectors( vertices ); + + m_meshX = xVals; + m_meshY = yVals; + m_meshZ = zVals; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimcTriangleGeometry::setFaultMeshVertices( const std::vector& faultMeshVertices ) +{ + auto [xVals, yVals, zVals] = assignCoordinatesToSeparateVectors( faultMeshVertices ); + + m_faultMeshX = xVals; + m_faultMeshY = yVals; + m_faultMeshZ = zVals; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimcTriangleGeometry::setDisplayModelOffset( const cvf::Vec3d& offset ) +{ + m_displayModelOffset = offset; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::tuple, std::vector, std::vector> + RimcTriangleGeometry::assignCoordinatesToSeparateVectors( const std::vector& vertices ) +{ + std::vector xVals; + std::vector yVals; + std::vector zVals; + + if ( !vertices.empty() ) + { + xVals.reserve( vertices.size() ); + yVals.reserve( vertices.size() ); + zVals.reserve( vertices.size() ); + + for ( const auto& v : vertices ) + { + xVals.push_back( v.x() ); + yVals.push_back( v.y() ); + zVals.push_back( v.z() ); + } + } + + return { xVals, yVals, zVals }; +} + +CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimExtrudedCurveIntersection, RimcExtrudedCurveIntersection_geometry, "geometry" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimcExtrudedCurveIntersection_geometry::RimcExtrudedCurveIntersection_geometry( caf::PdmObjectHandle* self ) + : caf::PdmObjectMethod( self ) +{ + CAF_PDM_InitObject( "Intersection Geometry" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_geometryType, "GeometryType", "Geometry Type" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmObjectHandle* RimcExtrudedCurveIntersection_geometry::execute() +{ + auto intersection = self(); + + auto geoGenerator = RimcExtrudedCurveIntersection_geometry::createGeometryGenerator( intersection, m_geometryType() ); + if ( geoGenerator && geoGenerator->isAnyGeometryPresent() ) + { + std::vector coords; + geoGenerator->triangleVxes()->toStdVector( &coords ); + + auto triangleGeometry = RimcTriangleGeometry::createFromVertices( coords ); + + { + auto cellMeshVertices = geoGenerator->cellMeshVxes(); + if ( cellMeshVertices ) + { + std::vector meshCoords; + cellMeshVertices->toStdVector( &meshCoords ); + triangleGeometry->setMeshVertices( meshCoords ); + } + } + + { + auto faultMeshVertices = geoGenerator->faultMeshVxes(); + if ( faultMeshVertices ) + { + std::vector meshCoords; + faultMeshVertices->toStdVector( &meshCoords ); + triangleGeometry->setFaultMeshVertices( meshCoords ); + } + } + + { + RimEclipseView* eclView = nullptr; + intersection->firstAncestorOfType( eclView ); + if ( eclView && eclView->eclipseCase() ) + { + auto offset = eclView->eclipseCase()->displayModelOffset(); + triangleGeometry->setDisplayModelOffset( offset ); + } + } + + return triangleGeometry; + } + + return new RimcTriangleGeometry; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimcExtrudedCurveIntersection_geometry::resultIsPersistent() const +{ + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::unique_ptr RimcExtrudedCurveIntersection_geometry::defaultResult() const +{ + return std::unique_ptr( new RimcTriangleGeometry ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::unique_ptr + RimcExtrudedCurveIntersection_geometry::createGeometryGenerator( RimExtrudedCurveIntersection* intersection, + RimcTriangleGeometry::GeometryType geometryType ) +{ + bool isFlat = false; + if ( geometryType == RimcTriangleGeometry::GeometryType::PROJECTED_TO_PLANE ) isFlat = true; + + cvf::Vec3d flattenedPolylineStartPoint; + auto polyLines = intersection->polyLines( &flattenedPolylineStartPoint ); + if ( !polyLines.empty() ) + { + auto direction = intersection->extrusionDirection(); + auto hexGrid = intersection->createHexGridInterface(); + auto intersectionGeoGenerator = + std::make_unique( intersection, + polyLines, + direction, + hexGrid.p(), + isFlat, + flattenedPolylineStartPoint ); + + intersectionGeoGenerator->ensureGeometryIsCalculated(); + + return intersectionGeoGenerator; + } + + return nullptr; +} + +CAF_PDM_OBJECT_METHOD_SOURCE_INIT( RimExtrudedCurveIntersection, + RimcExtrudedCurveIntersection_geometryResult, + "geometryResult" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimcExtrudedCurveIntersection_geometryResult::RimcExtrudedCurveIntersection_geometryResult( caf::PdmObjectHandle* self ) + : caf::PdmObjectMethod( self ) +{ + CAF_PDM_InitObject( "Geometry Result" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_geometryType, "GeometryType", "Geometry Type" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmObjectHandle* RimcExtrudedCurveIntersection_geometryResult::execute() +{ + auto intersection = self(); + + auto geoGenerator = RimcExtrudedCurveIntersection_geometry::createGeometryGenerator( intersection, m_geometryType() ); + if ( geoGenerator && geoGenerator->isAnyGeometryPresent() ) + { + RimEclipseView* eclView = nullptr; + intersection->firstAncestorOfType( eclView ); + if ( !eclView ) + { + RiaLogging::error( "No Eclipse view found. Extraction of intersection result is only supported for " + "Eclipse view." ); + return nullptr; + } + + RimEclipseResultDefinition* eclResultDef = nullptr; + + auto intersectionResultDef = intersection->activeSeparateResultDefinition(); + if ( intersectionResultDef ) eclResultDef = intersectionResultDef->eclipseResultDefinition(); + + if ( !eclResultDef ) eclResultDef = eclView->cellResult(); + + RigEclipseCaseData* eclipseCase = eclView->eclipseCase()->eclipseCaseData(); + + size_t gridIndex = 0; + cvf::ref resultAccessor = + RigResultAccessorFactory::createFromResultDefinition( eclipseCase, + gridIndex, + eclView->currentTimeStep(), + eclResultDef ); + + auto triToCellIndex = geoGenerator->triangleToCellIndex(); + std::vector values; + values.reserve( triToCellIndex.size() ); + for ( const auto& i : triToCellIndex ) + { + auto value = resultAccessor->cellScalar( i ); + values.push_back( value ); + } + + return RimcDataContainerDouble::create( values ); + } + + return new RimcDataContainerDouble(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimcExtrudedCurveIntersection_geometryResult::resultIsPersistent() const +{ + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::unique_ptr RimcExtrudedCurveIntersection_geometryResult::defaultResult() const +{ + return std::unique_ptr( new RimcDataContainerDouble ); +} diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.h b/ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.h new file mode 100644 index 0000000000..025a4558fd --- /dev/null +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.h @@ -0,0 +1,117 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObjectHandle.h" +#include "cafPdmObjectMethod.h" +#include "cafPdmPtrField.h" + +#include + +#include "cvfVector3.h" + +class RivIntersectionGeometryGeneratorInterface; +class RimExtrudedCurveIntersection; + +//================================================================================================== +/// +//================================================================================================== +class RimcTriangleGeometry : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + enum class GeometryType + { + FULL_3D, + PROJECTED_TO_PLANE, + }; + +public: + RimcTriangleGeometry(); + + static RimcTriangleGeometry* createFromVertices( const std::vector& vertices ); + static RimcTriangleGeometry* createFromVerticesAndConnections( const std::vector& vertices, + const std::vector& connections ); + + void setMeshVertices( const std::vector& meshVertices ); + void setFaultMeshVertices( const std::vector& faultMeshVertices ); + void setDisplayModelOffset( const cvf::Vec3d& offset ); + +private: + static std::tuple, std::vector, std::vector> + assignCoordinatesToSeparateVectors( const std::vector& vertices ); + +private: + caf::PdmField> m_x; + caf::PdmField> m_y; + caf::PdmField> m_z; + caf::PdmField> m_connections; + + caf::PdmField> m_meshX; + caf::PdmField> m_meshY; + caf::PdmField> m_meshZ; + + caf::PdmField> m_faultMeshX; + caf::PdmField> m_faultMeshY; + caf::PdmField> m_faultMeshZ; + + caf::PdmField m_displayModelOffset; +}; + +//================================================================================================== +/// +//================================================================================================== +class RimcExtrudedCurveIntersection_geometry : public caf::PdmObjectMethod +{ + CAF_PDM_HEADER_INIT; + +public: + RimcExtrudedCurveIntersection_geometry( caf::PdmObjectHandle* self ); + + caf::PdmObjectHandle* execute() override; + bool resultIsPersistent() const override; + std::unique_ptr defaultResult() const override; + + static std::unique_ptr + createGeometryGenerator( RimExtrudedCurveIntersection* intersection, + RimcTriangleGeometry::GeometryType geometryType ); + +private: + caf::PdmField> m_geometryType; +}; + +//================================================================================================== +/// +//================================================================================================== +class RimcExtrudedCurveIntersection_geometryResult : public caf::PdmObjectMethod +{ + CAF_PDM_HEADER_INIT; + +public: + RimcExtrudedCurveIntersection_geometryResult( caf::PdmObjectHandle* self ); + + caf::PdmObjectHandle* execute() override; + bool resultIsPersistent() const override; + std::unique_ptr defaultResult() const override; + +private: + caf::PdmField> m_geometryType; +}; diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcStimPlanModelTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcStimPlanModelTemplateCollection.cpp index 5c9c667231..cc79650c68 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcStimPlanModelTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcStimPlanModelTemplateCollection.cpp @@ -43,7 +43,7 @@ RimcStimPlanModelTemplateCollection_appendStimPlanModelTemplate::RimcStimPlanMod { CAF_PDM_InitObject( "Create StimPlan Model Template", "", "", "Create a new StimPlan Model Template" ); CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "", "", "", "Eclipse Case" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_timeStep, "TimeStep", "", "", "", "Time Step" ); + CAF_PDM_InitScriptableField( &m_timeStep, "TimeStep", 0, "", "", "", "Time Step" ); CAF_PDM_InitScriptableFieldNoDefault( &m_faciesPropertiesFilePath, "FaciesPropertiesFilePath", diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp index e1fda8b2f1..d772a811c8 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp @@ -66,10 +66,7 @@ caf::PdmObjectHandle* RimSummaryCase_summaryVectorValues::execute() } } - auto dataObject = new RimcDataContainerDouble(); - dataObject->m_doubleValues = values; - - return dataObject; + return RimcDataContainerDouble::create( values ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSurfaceCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSurfaceCollection.cpp index 237dcf061d..deaa6f7bd2 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSurfaceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSurfaceCollection.cpp @@ -142,7 +142,7 @@ RimcSurfaceCollection_newSurface::RimcSurfaceCollection_newSurface( caf::PdmObje { CAF_PDM_InitObject( "New Surface", "", "", "Create a new surface" ); CAF_PDM_InitScriptableFieldNoDefault( &m_case, "Case", "" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_kIndex, "KIndex", "" ); + CAF_PDM_InitScriptableField( &m_kIndex, "KIndex", 0, "" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuTimeStepChangedHandler.cpp b/ApplicationLibCode/UserInterface/RiuTimeStepChangedHandler.cpp index c6e23b36dd..89e1800d8c 100644 --- a/ApplicationLibCode/UserInterface/RiuTimeStepChangedHandler.cpp +++ b/ApplicationLibCode/UserInterface/RiuTimeStepChangedHandler.cpp @@ -18,6 +18,10 @@ #include "RiuTimeStepChangedHandler.h" +#include "RiaGuiApplication.h" + +#include "Rim3dView.h" + #include "RiuMainWindow.h" #include "RiuMohrsCirclePlot.h" #include "RiuPvtPlotPanel.h" @@ -25,8 +29,6 @@ #include "RiuRelativePermeabilityPlotPanel.h" #include "RiuRelativePermeabilityPlotUpdater.h" -#include "Rim3dView.h" - #include "cvfDebugTimer.h" #include "cvfTrace.h" @@ -59,8 +61,7 @@ RiuTimeStepChangedHandler* RiuTimeStepChangedHandler::instance() //-------------------------------------------------------------------------------------------------- void RiuTimeStepChangedHandler::handleTimeStepChanged( Rim3dView* changedView ) const { - // cvf::Trace::show("handleTimeStepChanged() viewName: %s timeStep:%d", changedView->name().toLatin1().data(), - // changedView->currentTimeStep()); cvf::DebugTimer tim("handleTimeStepChanged()"); + if ( !RiaGuiApplication::isRunning() ) return; RiuRelativePermeabilityPlotUpdater* relPermPlotUpdater = RiuMainWindow::instance()->relativePermeabilityPlotPanel()->plotUpdater(); @@ -71,6 +72,4 @@ void RiuTimeStepChangedHandler::handleTimeStepChanged( Rim3dView* changedView ) RiuMohrsCirclePlot* mohrsCirclePlot = RiuMainWindow::instance()->mohrsCirclePlot(); if ( mohrsCirclePlot ) mohrsCirclePlot->updateOnTimeStepChanged( changedView ); - - // tim.reportTimeMS("done"); } diff --git a/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp b/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp index ed8ff99fff..e6fc0518b6 100644 --- a/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp +++ b/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp @@ -282,10 +282,20 @@ QString caf::PdmPythonGenerator::generate( PdmObjectFactory* factory, std::vecto QString defaultValue = getDefaultValue( field ); + QString commentOrEnumDescription = field->uiCapability()->uiWhatsThis(); + + QStringList enumTexts = scriptability->enumScriptTexts(); + if ( !enumTexts.empty() ) + { + // Replace the comment text with enum values + // The space is limited for the generation of documentation + commentOrEnumDescription = "One of [" + enumTexts.join( ", " ) + "]"; + } + inputArgumentStrings.push_back( QString( "%1=%2" ).arg( argumentName ).arg( defaultValue ) ); outputArgumentStrings.push_back( QString( "%1=%1" ).arg( argumentName ) ); argumentComments.push_back( - QString( "%1 (%2): %3" ).arg( argumentName ).arg( dataType ).arg( field->uiCapability()->uiWhatsThis() ) ); + QString( "%1 (%2): %3" ).arg( argumentName ).arg( dataType ).arg( commentOrEnumDescription ) ); } QString fullComment = QString( " \"\"\"\n %1\n\n Arguments:\n " "%2\n Returns:\n %3\n \"\"\"" ) @@ -468,6 +478,9 @@ QString PdmPythonGenerator::dataTypeString( const PdmFieldHandle* field, bool us { auto xmlObj = field->capability(); + auto scriptability = field->capability(); + if ( scriptability && !scriptability->enumScriptTexts().empty() ) return "str"; + QString dataType = xmlObj->dataTypeName(); std::map builtins = { { QString::fromStdString( typeid( double ).name() ), "float" }, diff --git a/GrpcInterface/Python/rips/PythonExamples/create_intersection.py b/GrpcInterface/Python/rips/PythonExamples/create_intersection.py new file mode 100644 index 0000000000..7a4aa786bf --- /dev/null +++ b/GrpcInterface/Python/rips/PythonExamples/create_intersection.py @@ -0,0 +1,56 @@ +# Load ResInsight Processing Server Client Library +import math, time +import rips + +resinsight = rips.Instance.find() + +# The coordinates in this example is based on the Drogon test case from Equinor +file_path = "e:/models/from_equinor_sftp/drogon-real0-iter3/DROGON-0.EGRID" + +case = resinsight.project.load_case(file_path) + +view = case.create_view() +view.set_time_step(2) + +intersection_coll = resinsight.project.descendants(rips.IntersectionCollection)[0] + +# Add a CurveIntersection and set coordinates for the polyline +intersection = intersection_coll.add_new_object(rips.CurveIntersection) +intersection.points = [ + [45854, 595757, 1500], + [46493, 534259.1, 1500], + [46598, 590044.1, 1500], +] +intersection.update() + +# Add a new modeled well path +well_path_coll = resinsight.project.descendants(rips.WellPathCollection)[0] +well_path = well_path_coll.add_new_object(rips.ModeledWellPath) +well_path.name = "Test Well-1" +well_path.update() + +# Set reference coordinate +geometry = well_path.well_path_geometry() +reference_point = geometry.reference_point +reference_point[0] = 458580 +reference_point[1] = 5935514 +reference_point[2] = 1742 +geometry.update() # Commit updates back to ResInsight + +# Create the first well target at the reference point +coord = [0, 0, 0] +geometry.append_well_target(coord) + +# Append new well targets relative the the reference point +coord = [2229.10, -833.74, -74.70] +target = geometry.append_well_target(coord) + +coord = [4577.21, -3043.47, -87.15] +target = geometry.append_well_target(coord) +geometry.update() + +# Add a curve intersection based on the modeled well path +well_path_intersection = intersection_coll.add_new_object(rips.CurveIntersection) +well_path_intersection.type = "CS_WELL_PATH" +well_path_intersection.well_path = well_path +well_path_intersection.update() diff --git a/GrpcInterface/Python/rips/pdmobject.py b/GrpcInterface/Python/rips/pdmobject.py index e919cd96c1..89d2c9404e 100644 --- a/GrpcInterface/Python/rips/pdmobject.py +++ b/GrpcInterface/Python/rips/pdmobject.py @@ -223,6 +223,9 @@ def __islist(self, value): def __makelist(self, list_string): list_string = list_string.lstrip("[") list_string = list_string.rstrip("]") + if not list_string: + # Return empty list if empty string. Otherwise, the split function will return [''] + return [] strings = list_string.split(", ") values = [] for string in strings: diff --git a/GrpcInterface/Python/rips/tests/test_wells.py b/GrpcInterface/Python/rips/tests/test_wells.py index 5cefc3bf06..f096c54d16 100644 --- a/GrpcInterface/Python/rips/tests/test_wells.py +++ b/GrpcInterface/Python/rips/tests/test_wells.py @@ -21,3 +21,72 @@ def test_10k(rips_instance, initialize_test): assert len(wells) == 2 assert wells[0].name == "Well Path A" assert wells[1].name == "Well Path B" + + +def test_10k_intersection(rips_instance, initialize_test): + case_root_path = dataroot.PATH + "/TEST10K_FLT_LGR_NNC" + case_path = case_root_path + "/TEST10K_FLT_LGR_NNC.EGRID" + case = rips_instance.project.load_case(path=case_path) + assert len(case.grids()) == 2 + well_path_files = [ + case_root_path + "/wellpath_a.dev", + ] + + view = case.create_view() + view.set_time_step(1) + + well_path_names = rips_instance.project.import_well_paths(well_path_files) + wells = rips_instance.project.well_paths() + well_path = wells[0] + + # Add a curve intersection based on the well path + intersection_coll = rips_instance.project.descendants(rips.IntersectionCollection)[ + 0 + ] + well_path_intersection = intersection_coll.add_new_object(rips.CurveIntersection) + well_path_intersection.type = "CS_WELL_PATH" + well_path_intersection.well_path = well_path + well_path_intersection.update() + + # Three coords per triangle + geometry = well_path_intersection.geometry() + coord_count = len(geometry.x_coords) + assert coord_count == 13254 + + # One value per triangle + geometry_result_values = well_path_intersection.geometry_result() + result_count = len(geometry_result_values.values) + assert result_count == 4418 + + # Three coords per triangle, one result value per triangle + assert (result_count * 3) == coord_count + + +def test_empty_well_intersection(rips_instance, initialize_test): + case_root_path = dataroot.PATH + "/TEST10K_FLT_LGR_NNC" + case_path = case_root_path + "/TEST10K_FLT_LGR_NNC.EGRID" + case = rips_instance.project.load_case(path=case_path) + + view = case.create_view() + view.set_time_step(1) + + # Add a curve intersection based on the well path + intersection_coll = rips_instance.project.descendants(rips.IntersectionCollection)[ + 0 + ] + + well_path_intersection = intersection_coll.add_new_object(rips.CurveIntersection) + well_path_intersection.type = "CS_WELL_PATH" + well_path_intersection.well_path = None + well_path_intersection.update() + + # Test with empty geometry. This will also test that an empty list in CAF is converted to an empty list in Python + # See __makelist in pdmobject.py + geometry = well_path_intersection.geometry() + coord_count = len(geometry.x_coords) + assert coord_count == 0 + + # One value per triangle + geometry_result_values = well_path_intersection.geometry_result() + result_count = len(geometry_result_values.values) + assert result_count == 0 diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 4bf8cb8ee8..0d85868824 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".02") +set(RESINSIGHT_DEV_VERSION ".03") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 43d890697df8a52a619258ccd1d1d15cc7812606 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 9 Feb 2022 08:54:17 +0100 Subject: [PATCH 109/406] Multiaxis: Avoid transformation of the right axis to a left axis --- .../Summary/RimSummaryPlot.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index b86b8d565a..b7e1a4bbfe 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1914,9 +1914,21 @@ void RimSummaryPlot::initAfterRead() if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2021.10.2" ) ) { - auto copyAxis = [this]( RiuPlotAxis axis, auto axisProperties ) { - QString data = axisProperties->writeObjectToXmlString(); - axisPropertiesForPlotAxis( axis )->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() ); + auto copyAxis = [this]( RiuPlotAxis axis, auto sourceObject ) { + auto axisProperties = dynamic_cast( axisPropertiesForPlotAxis( axis ) ); + if ( axisProperties ) + { + QString data = sourceObject->writeObjectToXmlString(); + + // This operation will overwrite the plot axis side, default is left + axisProperties->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() ); + + if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) + { + // Reset the plot axis for the right axis + axisProperties->setNameAndAxis( "Right", RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, 0 ); + } + } }; copyAxis( RiuPlotAxis::defaultLeft(), m_leftYAxisProperties_OBSOLETE.v() ); From 3e9d2a0af0072fd92d26b97c5617737b7c6e0e62 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 10 Feb 2022 08:06:32 +0100 Subject: [PATCH 110/406] Intersection Python API: Fix typo --- .../ProjectDataModelCommands/RimcIntersection.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.cpp index 266190e12c..5d357c9081 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcIntersection.cpp @@ -75,8 +75,8 @@ RimcTriangleGeometry::RimcTriangleGeometry() CAF_PDM_InitScriptableFieldNoDefault( &m_meshZ, "MeshZCoords", "Mesh Z coords" ); CAF_PDM_InitScriptableFieldNoDefault( &m_faultMeshX, "FaultMeshXCoords", "Fault Mesh X coords" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_faultMeshY, "FaultmeshYCoords", "Fault Mesh Y coords" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_faultMeshZ, "FaultmeshZCoords", "Fault Mesh Z coords" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_faultMeshY, "FaultMeshYCoords", "Fault Mesh Y coords" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_faultMeshZ, "FaultMeshZCoords", "Fault Mesh Z coords" ); CAF_PDM_InitScriptableFieldNoDefault( &m_displayModelOffset, "DisplayModelOffset", "Display Model Offset" ); } From 6591de716bf56f6d2ab07c0a81ccc33cccc143e6 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 9 Feb 2022 15:14:32 +0100 Subject: [PATCH 111/406] #8521 Summary Plot: Allow moving axis to other side of plot. --- .../RimPlotAxisProperties.cpp | 8 ++++ .../ProjectDataModel/RimPlotAxisProperties.h | 9 ++-- .../Summary/RimSummaryPlot.cpp | 44 +++++++++++++++++-- .../ProjectDataModel/Summary/RimSummaryPlot.h | 5 +++ .../UserInterface/RiuPlotAxis.cpp | 10 ++++- .../UserInterface/RiuPlotAxis.h | 3 +- 6 files changed, 70 insertions(+), 9 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 276c3451f3..6d1d9ceabb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -51,6 +51,7 @@ CAF_PDM_SOURCE_INIT( RimPlotAxisProperties, "SummaryYAxisProperties" ); RimPlotAxisProperties::RimPlotAxisProperties() : settingsChanged( this ) , logarithmicChanged( this ) + , axisPositionChanged( this ) , m_enableTitleTextSettings( true ) , m_isRangeSettingsEnabled( true ) { @@ -199,6 +200,8 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr } scaleGroup.add( &m_valuesFontSize ); + scaleGroup.add( &m_plotAxis ); + uiOrdering.skipRemainingFields( true ); } @@ -421,6 +424,11 @@ void RimPlotAxisProperties::fieldChangedByUi( const caf::PdmFieldHandle* changed { logarithmicChanged.send( m_isLogarithmicScaleEnabled() ); } + else if ( changedField == &m_plotAxis ) + { + RiuPlotAxis oldPlotAxis = RiuPlotAxis( (RiaDefines::PlotAxis)oldValue.toInt(), m_plotAxisIndex ); + axisPositionChanged.send( this, oldPlotAxis, plotAxisType() ); + } else { settingsChanged.send(); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index 58057966b8..6fb452b2f0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -51,8 +51,9 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface }; public: - caf::Signal<> settingsChanged; - caf::Signal logarithmicChanged; + caf::Signal<> settingsChanged; + caf::Signal logarithmicChanged; + caf::Signal axisPositionChanged; public: RimPlotAxisProperties(); @@ -124,9 +125,9 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface caf::PdmField m_visibleRangeMin; caf::PdmField m_visibleRangeMax; - caf::PdmField m_name; + caf::PdmField m_name; caf::PdmField> m_plotAxis; - caf::PdmField m_plotAxisIndex; + caf::PdmField m_plotAxisIndex; caf::PdmField m_isLogarithmicScaleEnabled; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index b7e1a4bbfe..8514c770a1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -231,7 +231,10 @@ void RimSummaryPlot::updateAxes() //-------------------------------------------------------------------------------------------------- bool RimSummaryPlot::isLogarithmicScaleEnabled( RiuPlotAxis plotAxis ) const { - return axisPropertiesForPlotAxis( plotAxis )->isLogarithmicScaleEnabled(); + auto axisProperties = axisPropertiesForPlotAxis( plotAxis ); + if ( !axisProperties ) return false; + + return axisProperties->isLogarithmicScaleEnabled(); } //-------------------------------------------------------------------------------------------------- @@ -824,6 +827,8 @@ void RimSummaryPlot::updateAxis( RiaDefines::PlotAxis plotAxis ) void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis ) { RimPlotAxisPropertiesInterface* yAxisProps = axisPropertiesForPlotAxis( plotAxis ); + if ( !yAxisProps ) return; + if ( yAxisProps->isAutoZoom() ) { if ( yAxisProps->isLogarithmicScaleEnabled() ) @@ -957,8 +962,6 @@ RimPlotAxisPropertiesInterface* RimSummaryPlot::axisPropertiesForPlotAxis( RiuPl if ( axisProperties->plotAxisType() == plotAxis ) return axisProperties; } - CVF_ASSERT( false && "No axis properties found for axis" ); - return nullptr; } @@ -1692,6 +1695,7 @@ void RimSummaryPlot::connectAxisSignals( RimPlotAxisProperties* axis ) { axis->settingsChanged.connect( this, &RimSummaryPlot::axisSettingsChanged ); axis->logarithmicChanged.connect( this, &RimSummaryPlot::axisLogarithmicChanged ); + axis->axisPositionChanged.connect( this, &RimSummaryPlot::axisPositionChanged ); } //-------------------------------------------------------------------------------------------------- @@ -1710,6 +1714,40 @@ void RimSummaryPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter, loadDataAndUpdate(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::axisPositionChanged( const caf::SignalEmitter* emitter, + RimPlotAxisProperties* axisProperties, + RiuPlotAxis oldPlotAxis, + RiuPlotAxis newPlotAxis ) +{ + if ( !axisProperties ) return; + + if ( plotWidget() && plotWidget()->isMultiAxisSupported() ) + { + // Make sure the new axis on the correct side exists. + RiuPlotAxis fixedUpPlotAxis = plotWidget()->createNextPlotAxis( newPlotAxis.axis() ); + // The index can change so need to update. + axisProperties->setNameAndAxis( axisProperties->name(), fixedUpPlotAxis.axis(), fixedUpPlotAxis.index() ); + + // Move all attached curves + for ( auto curve : summaryCurves() ) + { + if ( curve->axisY() == oldPlotAxis ) curve->setLeftOrRightAxisY( fixedUpPlotAxis ); + } + + // Remove the now unused axis (but keep the default axis) + if ( oldPlotAxis != RiuPlotAxis::defaultLeft() && oldPlotAxis != RiuPlotAxis::defaultRight() ) + { + auto oldAxisProperties = axisPropertiesForPlotAxis( oldPlotAxis ); + if ( oldAxisProperties ) m_axisProperties.removeChildObject( oldAxisProperties ); + } + } + + updateAxes(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 4354d82de5..4778503e58 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -256,6 +256,11 @@ private slots: void connectAxisSignals( RimPlotAxisProperties* axis ); void axisSettingsChanged( const caf::SignalEmitter* emitter ); void axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic ); + void axisPositionChanged( const caf::SignalEmitter* emitter, + RimPlotAxisProperties* axisProperties, + RiuPlotAxis oldPlotAxis, + RiuPlotAxis newPlotAxis ); + void assignPlotAxis( RimSummaryCurve* curve ); private: diff --git a/ApplicationLibCode/UserInterface/RiuPlotAxis.cpp b/ApplicationLibCode/UserInterface/RiuPlotAxis.cpp index 6504d22db5..47d7569c73 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotAxis.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotAxis.cpp @@ -114,7 +114,15 @@ bool RiuPlotAxis::operator<( const RiuPlotAxis& rhs ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RiuPlotAxis::operator==( const RiuPlotAxis& rhs ) +bool RiuPlotAxis::operator==( const RiuPlotAxis& rhs ) const { return m_axis == rhs.m_axis && m_index == rhs.m_index; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuPlotAxis::operator!=( const RiuPlotAxis& rhs ) const +{ + return !( *this == rhs ); +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotAxis.h b/ApplicationLibCode/UserInterface/RiuPlotAxis.h index 15255bcc76..d3a1460350 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotAxis.h +++ b/ApplicationLibCode/UserInterface/RiuPlotAxis.h @@ -38,7 +38,8 @@ class RiuPlotAxis int index() const; bool operator<( const RiuPlotAxis& rhs ) const; - bool operator==( const RiuPlotAxis& rhs ); + bool operator==( const RiuPlotAxis& rhs ) const; + bool operator!=( const RiuPlotAxis& rhs ) const; private: RiaDefines::PlotAxis m_axis; From 6c922068936220874b1eb244d4c2c11ee16d0c0e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 11 Feb 2022 13:18:36 +0100 Subject: [PATCH 112/406] Make curve drawing more robust (#8537) * Janitor : Improve robustness * Guard nullptr access * Limit the curve points to incoming from/to curve point index range Co-authored-by: magnesj --- .../Application/Tools/RiaWellLogUnitTools.inl | 14 +++++++++ .../RimGridTimeHistoryCurve.cpp | 2 +- .../UserInterface/RiuQwtPlotCurve.cpp | 31 +++++++++---------- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaWellLogUnitTools.inl b/ApplicationLibCode/Application/Tools/RiaWellLogUnitTools.inl index 97e0893743..45c345ca30 100644 --- a/ApplicationLibCode/Application/Tools/RiaWellLogUnitTools.inl +++ b/ApplicationLibCode/Application/Tools/RiaWellLogUnitTools.inl @@ -178,6 +178,8 @@ std::vector> RiaDefines::DepthUnitType unitsIn, RiaDefines::DepthUnitType unitsOut ) { + if ( depthsIn.empty() ) return {}; + std::vector> convertedDepths( depthsIn.size() ); double factor = 1.0; if ( unitsOut == RiaDefines::DepthUnitType::UNIT_METER && unitsIn == RiaDefines::DepthUnitType::UNIT_FEET ) @@ -335,6 +337,8 @@ template std::vector RiaWellLogUnitTools::tvdRKBs( const std::vector& measuredDepths, const RigWellPath* wellPath ) { + if ( measuredDepths.empty() ) return {}; + std::vector tvdRKBs( measuredDepths.size(), 0.0 ); for ( size_t i = 0; i < measuredDepths.size(); ++i ) { @@ -351,6 +355,8 @@ template std::vector RiaWellLogUnitTools::convertGpcm3ToBar( const std::vector& tvdRKBs, const std::vector& valuesInGpcm3 ) { + if ( tvdRKBs.empty() ) return {}; + CAF_ASSERT( tvdRKBs.size() == valuesInGpcm3.size() ); std::vector valuesInBar( valuesInGpcm3.size(), 0.0 ); @@ -378,6 +384,8 @@ template std::vector RiaWellLogUnitTools::convertBarToGpcm3( const std::vector& tvdRKBs, const std::vector& valuesInBar ) { + if ( tvdRKBs.empty() ) return {}; + CAF_ASSERT( tvdRKBs.size() == valuesInBar.size() ); std::vector valuesInGpcm3( valuesInBar.size(), 0.0 ); @@ -406,6 +414,8 @@ std::vector RiaWellLogUnitTools::convertNormalizedByPPToBar( const std::vector& tvdRKBs, const std::vector& normalizedValues ) { + if ( tvdRKBs.empty() ) return {}; + CAF_ASSERT( tvdRKBs.size() == normalizedValues.size() ); std::vector valuesInBar( tvdRKBs.size(), 0.0 ); @@ -424,6 +434,8 @@ std::vector RiaWellLogUnitTools::convertBarToNormalizedByPP( const std::vector& tvdRKBs, const std::vector& valuesInBar ) { + if ( tvdRKBs.empty() ) return {}; + CAF_ASSERT( tvdRKBs.size() == valuesInBar.size() ); std::vector normalizedValues( tvdRKBs.size(), 0.0 ); @@ -440,6 +452,8 @@ std::vector template std::vector RiaWellLogUnitTools::multiply( const std::vector& valuesIn, FloatType factor ) { + if ( valuesIn.empty() ) return {}; + std::vector valuesOut( valuesIn.size(), std::numeric_limits::infinity() ); for ( size_t i = 0; i < valuesIn.size(); ++i ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp index 0dd04af733..654b6e88f9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp @@ -388,7 +388,7 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate( bool updateParentPlot ) { this->RimPlotCurve::updateCurvePresentation( updateParentPlot ); - if ( isCurveVisible() ) + if ( isCurveVisible() && m_plotCurve ) { std::vector values; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index 56bd6311dc..fbc9ac951c 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -93,9 +93,17 @@ void RiuQwtPlotCurve::drawCurve( QPainter* p, size_t intervalCount = m_polyLineStartStopIndices.size(); if ( intervalCount > 0 ) { - for ( size_t intIdx = 0; intIdx < intervalCount; intIdx++ ) + for ( const auto& [segmentFromCandiate, segmentToCandidate] : m_polyLineStartStopIndices ) { - if ( m_polyLineStartStopIndices[intIdx].first == m_polyLineStartStopIndices[intIdx].second ) + // Skip segments outside the requested index range + if ( static_cast( segmentToCandidate ) < from ) continue; + if ( static_cast( segmentFromCandiate ) > to ) continue; + + // Draw the curve points limited to incoming from/to indices + auto actualFromIndex = std::max( from, static_cast( segmentFromCandiate ) ); + auto actualToIndex = std::min( to, static_cast( segmentToCandidate ) ); + + if ( actualFromIndex == actualToIndex ) { // Use a symbol to draw a single value, as a single value will not be visible // when using QwtPlotCurve::drawCurve without symbols activated @@ -103,23 +111,14 @@ void RiuQwtPlotCurve::drawCurve( QPainter* p, QwtSymbol symbol( QwtSymbol::XCross ); symbol.setSize( 10, 10 ); - QwtPlotCurve::drawSymbols( p, - symbol, - xMap, - yMap, - canvasRect, - (int)m_polyLineStartStopIndices[intIdx].first, - (int)m_polyLineStartStopIndices[intIdx].second ); + QwtPlotCurve::drawSymbols( p, symbol, xMap, yMap, canvasRect, actualFromIndex, actualToIndex ); } else { - QwtPlotCurve::drawCurve( p, - style, - xMap, - yMap, - canvasRect, - (int)m_polyLineStartStopIndices[intIdx].first, - (int)m_polyLineStartStopIndices[intIdx].second ); + if ( actualFromIndex < actualToIndex ) + { + QwtPlotCurve::drawCurve( p, style, xMap, yMap, canvasRect, actualFromIndex, actualToIndex ); + } } } } From 654116c57350a620d14239500b06da556bdcb461 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 11 Feb 2022 12:51:42 +0100 Subject: [PATCH 113/406] QtChartView: fix missing rubber bands zoom. Mouse release event was also not properly handled. --- ApplicationLibCode/UserInterface/RiuQtChartView.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartView.cpp b/ApplicationLibCode/UserInterface/RiuQtChartView.cpp index d96617eff1..edfd66821d 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartView.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartView.cpp @@ -50,7 +50,7 @@ RimViewWindow* RiuQtChartView::ownerViewWindow() const //-------------------------------------------------------------------------------------------------- void RiuQtChartView::mousePressEvent( QMouseEvent* event ) { - if ( event->buttons() & Qt::MiddleButton ) + if ( event->button() == Qt::MiddleButton ) { m_isPanning = true; m_panStartPosition = event->pos(); @@ -59,7 +59,7 @@ void RiuQtChartView::mousePressEvent( QMouseEvent* event ) } else { - event->ignore(); + QtCharts::QChartView::mousePressEvent( event ); } } @@ -68,7 +68,7 @@ void RiuQtChartView::mousePressEvent( QMouseEvent* event ) //-------------------------------------------------------------------------------------------------- void RiuQtChartView::mouseReleaseEvent( QMouseEvent* event ) { - if ( event->buttons() & Qt::MiddleButton ) + if ( event->button() == Qt::MiddleButton ) { m_isPanning = false; setCursor( Qt::ArrowCursor ); @@ -76,7 +76,7 @@ void RiuQtChartView::mouseReleaseEvent( QMouseEvent* event ) } else { - event->ignore(); + QtCharts::QChartView::mouseReleaseEvent( event ); } } @@ -95,6 +95,6 @@ void RiuQtChartView::mouseMoveEvent( QMouseEvent* event ) } else { - event->ignore(); + QtCharts::QChartView::mouseMoveEvent( event ); } } From 8253cfae2d0fa1f6d0c1e8b0ac2e24974bb41866 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 11 Feb 2022 15:56:56 +0100 Subject: [PATCH 114/406] #8531 QtCharts: Fix performance degradation on ensemble of curves. The axes signals and slots were connected multiple time leading to a large number of RiuQtChartsPlotWidget::plotZoomed() calls. --- .../UserInterface/RiuQtChartsPlotWidget.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 9c3f02901a..dde8aa6c40 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -873,11 +873,15 @@ void RiuQtChartsPlotWidget::setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries if ( qobject_cast( newAxis ) || qobject_cast( newAxis ) ) { - connect( newAxis, SIGNAL( rangeChanged( double, double ) ), this, SLOT( axisRangeChanged() ) ); + connect( newAxis, SIGNAL( rangeChanged( double, double ) ), this, SLOT( axisRangeChanged() ), Qt::UniqueConnection ); } else if ( qobject_cast( newAxis ) ) { - connect( newAxis, SIGNAL( rangeChanged( QDateTime, QDateTime ) ), this, SLOT( axisRangeChanged() ) ); + connect( newAxis, + SIGNAL( rangeChanged( QDateTime, QDateTime ) ), + this, + SLOT( axisRangeChanged() ), + Qt::UniqueConnection ); } } } From 1488eec8553a39426bdd4926afb1d9ab9f623e50 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 11 Feb 2022 14:04:50 +0100 Subject: [PATCH 115/406] Rename to isLogCurve --- .../GridCrossPlots/RimGridCrossPlotCurve.cpp | 3 ++- .../ProjectDataModel/RimPlotCurve.cpp | 16 ++++++++-------- .../ProjectDataModel/RimPlotCurve.h | 10 ++++------ .../ProjectDataModel/RimVfpPlot.cpp | 5 ++--- .../WellLog/RimWellLogExtractionCurve.cpp | 11 ++++++++++- .../WellLog/RimWellLogRftCurve.cpp | 6 +++--- .../RimWellMeasurementCurve.cpp | 3 ++- .../RiuFlowCharacteristicsPlot.cpp | 8 +++++--- .../UserInterface/RiuPlotCurve.cpp | 18 +++++++++--------- .../UserInterface/RiuPlotCurve.h | 10 +++++----- .../UserInterface/RiuQwtPlotCurve.cpp | 4 ++-- .../UserInterface/RiuQwtPlotCurve.h | 2 +- 12 files changed, 53 insertions(+), 43 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp index 7130e6f6fd..abd2f86bea 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp @@ -57,7 +57,8 @@ void RimGridCrossPlotCurve::setSamples( const std::vector& xValues, cons if ( xValues.empty() || yValues.empty() || !m_plotCurve ) return; - m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, false ); + bool isLogCurve = false; + m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, isLogCurve ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index 08b66460f5..bc24d94bd7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -684,11 +684,11 @@ bool RimPlotCurve::hasParentPlot() const //-------------------------------------------------------------------------------------------------- void RimPlotCurve::setSamplesFromXYValues( const std::vector& xValues, const std::vector& yValues, - bool keepOnlyPositiveValues ) + bool isLogCurve ) { if ( m_plotCurve ) { - m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, keepOnlyPositiveValues ); + m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, isLogCurve ); } } @@ -697,11 +697,11 @@ void RimPlotCurve::setSamplesFromXYValues( const std::vector& xValues, //-------------------------------------------------------------------------------------------------- void RimPlotCurve::setSamplesFromDatesAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool keepOnlyPositiveValues ) + bool isLogCurve ) { if ( m_plotCurve ) { - m_plotCurve->setSamplesFromDatesAndYValues( dateTimes, yValues, keepOnlyPositiveValues ); + m_plotCurve->setSamplesFromDatesAndYValues( dateTimes, yValues, isLogCurve ); } } @@ -710,11 +710,11 @@ void RimPlotCurve::setSamplesFromDatesAndYValues( const std::vector& //-------------------------------------------------------------------------------------------------- void RimPlotCurve::setSamplesFromTimeTAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool keepOnlyPositiveValues ) + bool isLogCurve ) { if ( m_plotCurve ) { - m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, yValues, keepOnlyPositiveValues ); + m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, yValues, isLogCurve ); } } @@ -724,12 +724,12 @@ void RimPlotCurve::setSamplesFromTimeTAndYValues( const std::vector& dat void RimPlotCurve::setSamplesFromXYErrorValues( const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool keepOnlyPositiveValues, + bool isLogCurve, RiaCurveDataTools::ErrorAxis errorAxis ) { if ( m_plotCurve ) { - m_plotCurve->setSamplesFromXYErrorValues( xValues, yValues, errorValues, keepOnlyPositiveValues, errorAxis ); + m_plotCurve->setSamplesFromXYErrorValues( xValues, yValues, errorValues, isLogCurve, errorAxis ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h index f070c889dc..dc54be2993 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h @@ -141,20 +141,18 @@ class RimPlotCurve : public caf::PdmObject void setSamplesFromXYErrorValues( const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool keepOnlyPositiveValues, + bool isLogCurve, RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ); - void setSamplesFromXYValues( const std::vector& xValues, - const std::vector& yValues, - bool keepOnlyPositiveValues ); + void setSamplesFromXYValues( const std::vector& xValues, const std::vector& yValues, bool isLogCurve ); void setSamplesFromDatesAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool keepOnlyPositiveValues ); + bool isLogCurve ); void setSamplesFromTimeTAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool keepOnlyPositiveValues ); + bool isLogCurve ); protected: // Overridden PDM methods diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp index 370e228031..e4ffe06f58 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp @@ -573,9 +573,8 @@ void RimVfpPlot::populatePlotWidgetWithPlotData( RiuPlotWidget* plotWidget, cons symbol->setSize( 6, 6 ); curve->setSymbol( symbol ); - curve->setSamplesFromXValuesAndYValues( plotData.xData( idx ), - plotData.yData( idx ), - static_cast( plotData.curveSize( idx ) ) ); + bool isLogCurve = false; + curve->setSamplesFromXValuesAndYValues( plotData.xData( idx ), plotData.yData( idx ), isLogCurve ); curve->attachToPlot( plotWidget ); curve->showInPlot(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index d37a99f095..8096482aef 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -357,10 +357,19 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot ) isUsingPseudoLength = false; } + bool isLogCurve = false; + + RimWellLogTrack* track = nullptr; + firstAncestorOfType( track ); + if ( track ) + { + isLogCurve = track->isLogarithmicScale(); + } + std::vector xPlotValues = curveData()->xPlotValues(); std::vector depthPlotValues = curveData()->depthPlotValues( depthType, displayUnit ); CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() ); - m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, static_cast( xPlotValues.size() ) ); + m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, isLogCurve ); m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index 2a39938361..a51268f849 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -470,19 +470,19 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) auto xValues = this->curveData()->xPlotValues(); auto yValues = this->curveData()->depthPlotValues( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit ); - bool keepOnlyPositiveValues = false; + bool isLogCurve = false; if ( !errors.empty() ) { this->setSamplesFromXYErrorValues( xValues, yValues, errors, - keepOnlyPositiveValues, + isLogCurve, RiaCurveDataTools::ErrorAxis::ERROR_ALONG_X_AXIS ); } else { - m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, keepOnlyPositiveValues ); + m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, isLogCurve ); } RimWellLogTrack* wellLogTrack; diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp index fc02d7b22c..26e79e126e 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp @@ -156,9 +156,10 @@ void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot ) depthType = wellLogPlot->depthType(); } + bool isLogCurve = false; m_plotCurve->setSamplesFromXValuesAndYValues( this->curveData()->xPlotValues(), this->curveData()->depthPlotValues( depthType, displayUnit ), - static_cast( this->curveData()->xPlotValues().size() ) ); + isLogCurve ); m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); } diff --git a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp index a42392024c..f63b998a68 100644 --- a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp @@ -239,7 +239,8 @@ void RiuFlowCharacteristicsPlot::addFlowCapStorageCapCurve( const QDateTime& RiuQwtPlotCurve* plotCurve = createEmptyCurve( m_flowCapVsStorageCapPlot, dateTime.toString(), m_dateToColorMap[dateTime] ); - plotCurve->setSamplesFromXValuesAndYValues( xVals, yVals, false ); + bool isLogCurve = false; + plotCurve->setSamplesFromXValuesAndYValues( xVals, yVals, isLogCurve ); m_flowCapVsStorageCapPlot->replot(); } @@ -252,8 +253,9 @@ void RiuFlowCharacteristicsPlot::addSweepEfficiencyCurve( const QDateTime& { CVF_ASSERT( !m_dateToColorMap.empty() ); - RiuQwtPlotCurve* plotCurve = createEmptyCurve( m_sweepEffPlot, dateTime.toString(), m_dateToColorMap[dateTime] ); - plotCurve->setSamplesFromXValuesAndYValues( xVals, yVals, false ); + RiuQwtPlotCurve* plotCurve = createEmptyCurve( m_sweepEffPlot, dateTime.toString(), m_dateToColorMap[dateTime] ); + bool isLogCurve = false; + plotCurve->setSamplesFromXValuesAndYValues( xVals, yVals, isLogCurve ); m_sweepEffPlot->replot(); } diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuPlotCurve.cpp index ab9ce18781..e528ab9497 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotCurve.cpp @@ -57,9 +57,9 @@ void RiuPlotCurve::setSamplesValues( const std::vector& xValues, const s //-------------------------------------------------------------------------------------------------- void RiuPlotCurve::setSamplesFromXValuesAndYValues( const std::vector& xValues, const std::vector& yValues, - bool keepOnlyPositiveValues ) + bool isLogCurve ) { - computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues ); + computeValidIntervalsAndSetCurveData( xValues, yValues, isLogCurve ); } //-------------------------------------------------------------------------------------------------- @@ -67,11 +67,11 @@ void RiuPlotCurve::setSamplesFromXValuesAndYValues( const std::vector& x //-------------------------------------------------------------------------------------------------- void RiuPlotCurve::setSamplesFromDatesAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool keepOnlyPositiveValues ) + bool isLogCurve ) { auto xValues = RiuPlotCurve::fromQDateTime( dateTimes ); - computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues ); + computeValidIntervalsAndSetCurveData( xValues, yValues, isLogCurve ); } //-------------------------------------------------------------------------------------------------- @@ -79,11 +79,11 @@ void RiuPlotCurve::setSamplesFromDatesAndYValues( const std::vector& //-------------------------------------------------------------------------------------------------- void RiuPlotCurve::setSamplesFromTimeTAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool keepOnlyPositiveValues ) + bool isLogCurve ) { auto xValues = RiuPlotCurve::fromTime_t( dateTimes ); - computeValidIntervalsAndSetCurveData( xValues, yValues, keepOnlyPositiveValues ); + computeValidIntervalsAndSetCurveData( xValues, yValues, isLogCurve ); } //-------------------------------------------------------------------------------------------------- @@ -123,9 +123,9 @@ void RiuPlotCurve::setBlackAndWhiteLegendIcon( bool blackAndWhite ) //-------------------------------------------------------------------------------------------------- void RiuPlotCurve::computeValidIntervalsAndSetCurveData( const std::vector& xValues, const std::vector& yValues, - bool keepOnlyPositiveValues ) + bool isLogCurve ) { - auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, keepOnlyPositiveValues ); + auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, isLogCurve ); std::vector validYValues; std::vector validXValues; @@ -184,7 +184,7 @@ std::vector RiuPlotCurve::fromTime_t( const std::vector& timeSte void RiuPlotCurve::setSamplesFromXYErrorValues( const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool keepOnlyPositiveValues, + bool isLogCurve, RiaCurveDataTools::ErrorAxis errorAxis ) { } diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurve.h b/ApplicationLibCode/UserInterface/RiuPlotCurve.h index 56c6964667..47144a35d5 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuPlotCurve.h @@ -65,21 +65,21 @@ class RiuPlotCurve void setSamplesFromXValuesAndYValues( const std::vector& xValues, const std::vector& yValues, - bool keepOnlyPositiveValues ); + bool isLogCurve ); void setSamplesFromDatesAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool keepOnlyPositiveValues ); + bool isLogCurve ); void setSamplesFromTimeTAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool keepOnlyPositiveValues ); + bool isLogCurve ); virtual void setSamplesFromXYErrorValues( const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool keepOnlyPositiveValues, + bool isLogCurve, RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ); void setLineSegmentStartStopIndices( const std::vector>& lineSegmentStartStopIndices ); @@ -136,7 +136,7 @@ class RiuPlotCurve private: void computeValidIntervalsAndSetCurveData( const std::vector& xValues, const std::vector& yValues, - bool keepOnlyPositiveValues ); + bool isLogCurve ); protected: float m_symbolSkipPixelDistance; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index fbc9ac951c..2d670f15d1 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -415,13 +415,13 @@ std::pair RiuQwtPlotCurve::yDataRange() const void RiuQwtPlotCurve::setSamplesFromXYErrorValues( const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool keepOnlyPositiveValues, + bool isLogCurve, RiaCurveDataTools::ErrorAxis errorAxis ) { CVF_ASSERT( xValues.size() == yValues.size() ); CVF_ASSERT( xValues.size() == errorValues.size() ); - auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, keepOnlyPositiveValues ); + auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, isLogCurve ); std::vector filteredYValues; std::vector filteredXValues; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h index 7fffa6b7b1..538d1cca13 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h @@ -71,7 +71,7 @@ class RiuQwtPlotCurve : public RiuPlotCurve, public QwtPlotCurve const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool keepOnlyPositiveValues, + bool isLogCurve, RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ) override; void setXAxis( RiuPlotAxis axis ) override; From 5c9bf502e7899a1f26da5b4ca28489a75112471f Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 7 Feb 2022 11:44:20 +0100 Subject: [PATCH 116/406] Well Log Plot: Add option to plot depth horizontally. --- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 1 + .../ProjectDataModel/RimDepthTrackPlot.cpp | 23 +++++++ .../ProjectDataModel/RimDepthTrackPlot.h | 10 +++ .../WellLog/RimWellLogExtractionCurve.cpp | 11 +++- .../WellLog/RimWellLogTrack.cpp | 64 ++++++++++++++----- .../WellLog/RimWellLogTrack.h | 5 ++ 6 files changed, 96 insertions(+), 18 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index 970fe4b760..5ca8ea8455 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -974,6 +974,7 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& plotLayoutGroup->setCollapsedByDefault( true ); RimWellLogPlot::uiOrderingForAutoName( uiConfigName, *plotLayoutGroup ); RimWellLogPlot::uiOrderingForPlotLayout( uiConfigName, *plotLayoutGroup ); + plotLayoutGroup->add( &m_depthOrientation ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index e02d18c582..f1f3122462 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -74,6 +74,14 @@ void RimDepthTrackPlot::AxisGridEnum::setUp() setDefault( RimDepthTrackPlot::AXIS_GRID_MAJOR ); } +template <> +void caf::AppEnum::setUp() +{ + addItem( RimDepthTrackPlot::DepthOrientation::HORIZONTAL, "HORIZONTAL", "Horizontal" ); + addItem( RimDepthTrackPlot::DepthOrientation::VERTICAL, "VERTICAL", "Vertical" ); + setDefault( RimDepthTrackPlot::DepthOrientation::VERTICAL ); +} + } // End namespace caf CAF_PDM_SOURCE_INIT( RimDepthTrackPlot, "DepthTrackPlot" ); @@ -131,6 +139,8 @@ RimDepthTrackPlot::RimDepthTrackPlot() auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots ); reorderability->orderChanged.connect( this, &RimDepthTrackPlot::onPlotsReordered ); + CAF_PDM_InitFieldNoDefault( &m_depthOrientation, "DepthOrientation", "Orientation" ); + m_availableDepthUnits = { RiaDefines::DepthUnitType::UNIT_METER, RiaDefines::DepthUnitType::UNIT_FEET }; m_availableDepthTypes = { RiaDefines::DepthTypeEnum::MEASURED_DEPTH, RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, @@ -829,6 +839,10 @@ void RimDepthTrackPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel m_isAutoScaleDepthEnabled = true; onLoadDataAndUpdate(); } + else if ( changedField == &m_depthOrientation ) + { + onLoadDataAndUpdate(); + } else if ( changedField == &m_subTitleFontSize || changedField == &m_axisTitleFontSize || changedField == &m_axisValueFontSize ) { @@ -883,6 +897,7 @@ void RimDepthTrackPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi plotLayoutGroup->add( &m_subTitleFontSize ); plotLayoutGroup->add( &m_axisTitleFontSize ); plotLayoutGroup->add( &m_axisValueFontSize ); + plotLayoutGroup->add( &m_depthOrientation ); std::vector ensembleWellLogCurveSets; descendantsOfType( ensembleWellLogCurveSets ); @@ -1141,6 +1156,14 @@ RimDepthTrackPlot::AxisGridVisibility RimDepthTrackPlot::depthAxisGridLinesEnabl return m_depthAxisGridVisibility(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimDepthTrackPlot::DepthOrientation RimDepthTrackPlot::depthOrientation() const +{ + return m_depthOrientation(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h index 92e69c2f2e..9cc6d1cabb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h @@ -65,6 +65,12 @@ class RimDepthTrackPlot : public RimTypedPlotCollection, public RimPlot typedef caf::AppEnum AxisGridEnum; using DepthTypeEnum = RiaDefines::DepthTypeEnum; + enum class DepthOrientation + { + HORIZONTAL, + VERTICAL + }; + public: RimDepthTrackPlot(); ~RimDepthTrackPlot() override; @@ -94,6 +100,8 @@ class RimDepthTrackPlot : public RimTypedPlotCollection, public RimPlot void enableDepthAxisGridLines( AxisGridVisibility gridVisibility ); AxisGridVisibility depthAxisGridLinesEnabled() const; + RimDepthTrackPlot::DepthOrientation depthOrientation() const; + void setAutoScaleXEnabled( bool enabled ); void setAutoScaleDepthEnabled( bool enabled ); @@ -183,6 +191,8 @@ class RimDepthTrackPlot : public RimTypedPlotCollection, public RimPlot caf::PdmField> m_depthEqualization; caf::PdmPtrField m_ensembleCurveSet; + caf::PdmField> m_depthOrientation; + QPointer m_viewer; std::set m_availableDepthUnits; std::set m_availableDepthTypes; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 8096482aef..8dec8a7ca2 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -369,7 +369,16 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot ) std::vector xPlotValues = curveData()->xPlotValues(); std::vector depthPlotValues = curveData()->depthPlotValues( depthType, displayUnit ); CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() ); - m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, isLogCurve ); + + if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL ) + m_plotCurve->setSamplesFromXValuesAndYValues( depthPlotValues, + xPlotValues, + isLogCurve ); + + else + m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, + depthPlotValues, + isLogCurve ); m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 1cf2bcb881..1289dc303b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -23,6 +23,7 @@ #include "RiaExtractionTools.h" #include "RiaGuiApplication.h" #include "RiaLogging.h" +#include "RiaPlotDefines.h" #include "RiaPreferences.h" #include "RiaSimWellBranchTools.h" #include "RiaWellLogCurveMerger.h" @@ -77,6 +78,7 @@ #include "RiuMainWindow.h" #include "RiuPlotAnnotationTool.h" +#include "RiuPlotAxis.h" #include "RiuPlotMainWindow.h" #include "RiuPlotMainWindowTools.h" #include "RiuQwtLinearScaleEngine.h" @@ -503,7 +505,7 @@ void RimWellLogTrack::updateYZoom() { if ( !m_plotWidget ) return; - m_plotWidget->setAxisRange( RiuPlotAxis::defaultLeft(), m_visibleDepthRangeMin(), m_visibleDepthRangeMax() ); + m_plotWidget->setAxisRange( getDepthAxis(), m_visibleDepthRangeMin(), m_visibleDepthRangeMax() ); } //-------------------------------------------------------------------------------------------------- @@ -540,8 +542,8 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { if ( m_plotWidget ) { - m_majorTickInterval = m_plotWidget->majorTickInterval( RiuPlotAxis::defaultTop() ); - m_minorTickInterval = m_plotWidget->minorTickInterval( RiuPlotAxis::defaultTop() ); + m_majorTickInterval = m_plotWidget->majorTickInterval( getValueAxis() ); + m_minorTickInterval = m_plotWidget->minorTickInterval( getValueAxis() ); } m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); @@ -762,13 +764,13 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() bool emptyRange = isEmptyVisibleXRange(); if ( emptyRange ) { - m_plotWidget->enableGridLines( RiuPlotAxis::defaultTop(), false, false ); - m_plotWidget->setAxisRange( RiuPlotAxis::defaultTop(), 0.0, 1.0 ); - m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultTop(), false, false ); + m_plotWidget->enableGridLines( getValueAxis(), false, false ); + m_plotWidget->setAxisRange( getValueAxis(), 0.0, 1.0 ); + m_plotWidget->setAxisLabelsAndTicksEnabled( getValueAxis(), false, false ); } else { - m_plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultTop(), true, true ); + m_plotWidget->setAxisLabelsAndTicksEnabled( getValueAxis(), true, true ); if ( m_minAndMaxTicksOnly ) { auto roundToDigits = []( double value, int numberOfDigits, bool useFloor ) { @@ -807,7 +809,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() } else if ( m_explicitTickIntervals ) { - m_plotWidget->setMajorAndMinorTickIntervals( RiuPlotAxis::defaultTop(), + m_plotWidget->setMajorAndMinorTickIntervals( getValueAxis(), m_majorTickInterval(), m_minorTickInterval(), m_visibleXRangeMin(), @@ -817,11 +819,11 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() { int majorTickIntervals = 5; int minorTickIntervals = 10; - m_plotWidget->setAutoTickIntervalCounts( RiuPlotAxis::defaultTop(), majorTickIntervals, minorTickIntervals ); - m_plotWidget->setAxisRange( RiuPlotAxis::defaultTop(), m_visibleXRangeMin, m_visibleXRangeMax ); + m_plotWidget->setAutoTickIntervalCounts( getValueAxis(), majorTickIntervals, minorTickIntervals ); + m_plotWidget->setAxisRange( getValueAxis(), m_visibleXRangeMin, m_visibleXRangeMax ); } - m_plotWidget->enableGridLines( RiuPlotAxis::defaultTop(), + m_plotWidget->enableGridLines( getValueAxis(), m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR, m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR ); } @@ -830,7 +832,7 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() this->firstAncestorOrThisOfType( wellLogPlot ); if ( wellLogPlot ) { - m_plotWidget->enableGridLines( RiuPlotAxis::defaultLeft(), + m_plotWidget->enableGridLines( getDepthAxis(), wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MAJOR, wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MINOR ); } @@ -1006,8 +1008,8 @@ QString RimWellLogTrack::asciiDataForPlotExport() const //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::updateZoomFromParentPlot() { - auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultTop() ); - auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( RiuPlotAxis::defaultLeft() ); + auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( getValueAxis() ); + auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( getDepthAxis() ); m_visibleXRangeMin = xIntervalMin; m_visibleXRangeMax = xIntervalMax; @@ -1226,8 +1228,8 @@ void RimWellLogTrack::onLoadDataAndUpdate() if ( wellLogPlot && m_plotWidget ) { - m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultTop(), m_xAxisTitle ); - m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), wellLogPlot->depthAxisTitle() ); + m_plotWidget->setAxisTitleText( getValueAxis(), m_xAxisTitle ); + m_plotWidget->setAxisTitleText( getDepthAxis(), wellLogPlot->depthAxisTitle() ); } for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx ) @@ -1505,7 +1507,7 @@ RiuPlotWidget* RimWellLogTrack::doCreatePlotViewWidget( QWidget* mainWindowParen if ( m_plotWidget == nullptr ) { m_plotWidget = new RiuWellLogTrack( this, mainWindowParent ); - m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), true ); + m_plotWidget->setAxisInverted( getDepthAxis(), true ); updateAxisScaleEngine(); for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx ) @@ -3212,3 +3214,31 @@ void RimWellLogTrack::setEnsembleWellLogCurveSet( RimEnsembleWellLogCurveSet* cu { m_ensembleWellLogCurveSet = curveSet; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RimWellLogTrack::getDepthAxis() const +{ + RimDepthTrackPlot* wellLogPlot; + this->firstAncestorOrThisOfTypeAsserted( wellLogPlot ); + + if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + return RiuPlotAxis::defaultLeft(); + else + return RiuPlotAxis::defaultTop(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RimWellLogTrack::getValueAxis() const +{ + RimDepthTrackPlot* wellLogPlot; + this->firstAncestorOrThisOfTypeAsserted( wellLogPlot ); + + if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + return RiuPlotAxis::defaultTop(); + else + return RiuPlotAxis::defaultLeft(); +} diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index c6172b81d4..125b313736 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -26,6 +26,8 @@ #include "RimPlot.h" +#include "RiuPlotAxis.h" + #include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" @@ -248,6 +250,9 @@ class RimWellLogTrack : public RimPlot void updateXZoom(); void updateYZoom(); + RiuPlotAxis getDepthAxis() const; + RiuPlotAxis getValueAxis() const; + int axisFontSize() const; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; From 377df9ab3af5f633313168494d2639c010242120 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 7 Feb 2022 14:45:14 +0100 Subject: [PATCH 117/406] Well Log Plot: have multiple rows of plots for horizontal depth orientation. --- .../ProjectDataModel/RimDepthTrackPlot.cpp | 12 ++++++++++++ .../ProjectDataModel/RimDepthTrackPlot.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index f1f3122462..4649a113ed 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -36,6 +36,7 @@ #include "RimMainPlotCollection.h" #include "RimOilField.h" #include "RimPlot.h" +#include "RimPlotWindow.h" #include "RimProject.h" #include "RimWellAllocationPlot.h" #include "RimWellLogCurve.h" @@ -286,6 +287,17 @@ std::vector RimDepthTrackPlot::visiblePlots() const return allVisiblePlots; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimDepthTrackPlot::columnCount() const +{ + if ( depthOrientation() == DepthOrientation::VERTICAL ) + return RimPlotWindow::columnCount(); + else + return 1; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h index 9cc6d1cabb..bfb3677d58 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h @@ -85,6 +85,8 @@ class RimDepthTrackPlot : public RimTypedPlotCollection, public RimPlot size_t plotIndex( const RimPlot* plot ) const; RimPlot* plotByIndex( size_t index ) const; + int columnCount() const override; + std::vector plots() const override; std::vector visiblePlots() const; void insertPlot( RimPlot* plot, size_t index ) final; From 5973dde70c673141856a42e101c047193e166e62 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 7 Feb 2022 14:59:16 +0100 Subject: [PATCH 118/406] Well Measurement: fix duplication in property editor. --- .../WellMeasurement/RimWellMeasurementCurve.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp index 26e79e126e..b7781a5371 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp @@ -226,6 +226,8 @@ void RimWellMeasurementCurve::defineUiOrdering( QString uiConfigName, caf::PdmUi caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" ); nameGroup->add( &m_showLegend ); RimPlotCurve::curveNameUiOrdering( *nameGroup ); + + uiOrdering.skipRemainingFields( true ); } //-------------------------------------------------------------------------------------------------- From e85bba901464cd41b508d1deb2c52694e2587138 Mon Sep 17 00:00:00 2001 From: magnesj Date: Sat, 12 Feb 2022 13:38:03 +0000 Subject: [PATCH 119/406] Fixes by clang-format --- .../WellLog/RimWellLogExtractionCurve.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 8dec8a7ca2..91fe5fdb6c 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -371,14 +371,10 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot ) CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() ); if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL ) - m_plotCurve->setSamplesFromXValuesAndYValues( depthPlotValues, - xPlotValues, - isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( depthPlotValues, xPlotValues, isLogCurve ); else - m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, - depthPlotValues, - isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, isLogCurve ); m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() ); From 4d0b94570ec09b6a7879270d7de421d7a942edf4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sat, 12 Feb 2022 17:54:38 +0100 Subject: [PATCH 120/406] Qt : Bump build version to 5.12.12 (#8544) * Qt : Bump build version to 5.12.12 * Bump cache key --- .github/workflows/AppFwkUnitTest.yml | 23 +-- .github/workflows/ResInsightWithCache.yml | 116 ++++++------- .../ResInsightWithCacheManualPaths.yml | 44 ++--- .github/workflows/centos7.yml | 152 +++++++++--------- 4 files changed, 175 insertions(+), 160 deletions(-) diff --git a/.github/workflows/AppFwkUnitTest.yml b/.github/workflows/AppFwkUnitTest.yml index c3c96b78ca..e187311735 100644 --- a/.github/workflows/AppFwkUnitTest.yml +++ b/.github/workflows/AppFwkUnitTest.yml @@ -11,38 +11,44 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 + - name: Cache Qt id: cache-qt uses: actions/cache@v2 with: path: ${{ github.workspace }}/Qt/ - key: ${{ runner.os }}-QtCache + key: ${{ runner.os }}-QtCache-5-12-12 + - name: Install Qt uses: jurplel/install-qt-action@v2 with: - version: 5.9.9 - modules: qtscript - dir: '${{ github.workspace }}/Qt/' + version: 5.12.12 + modules: qtscript + dir: "${{ github.workspace }}/Qt/" cached: ${{ steps.cache-qt.outputs.cache-hit }} + - name: Install Linux dependencies if: "contains( matrix.os, 'ubuntu')" run: sudo apt-get install libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev + - name: Build AppFwk with Unit Tests uses: lukka/run-cmake@v1 with: cmakeListsOrSettingsJson: CMakeListsTxtAdvanced - cmakeListsTxtPath: '${{ github.workspace }}/Fwk/AppFwk/CMakeLists.txt' - cmakeAppendedArgs: + cmakeListsTxtPath: "${{ github.workspace }}/Fwk/AppFwk/CMakeLists.txt" + cmakeAppendedArgs: buildDirectory: ${{ github.workspace }}/cmakebuild - buildWithCMakeArgs: '--config Release' + buildWithCMakeArgs: "--config Release" useVcpkgToolchainFile: false + - name: Run Unit Tests Windows - if: contains( matrix.os, 'windows') + if: contains( matrix.os, 'windows') shell: bash run: | cmakebuild/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/Release/cafPdmCore_UnitTests cmakebuild/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/Release/cafPdmXml_UnitTests cmakebuild/cafProjectDataModel/cafProjectDataModel_UnitTests/Release/cafProjectDataModel_UnitTests + - name: Run Unit Tests Linux if: "!contains( matrix.os, 'windows')" shell: bash @@ -50,4 +56,3 @@ jobs: cmakebuild/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmCore_UnitTests cmakebuild/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXml_UnitTests cmakebuild/cafProjectDataModel/cafProjectDataModel_UnitTests/cafProjectDataModel_UnitTests - diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 83628dad04..63e4c4586c 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -5,11 +5,11 @@ on: pull_request: schedule: # Every day at 1am to make sure we have a build cache for the current date - # build cache is - - cron: '0 1 * * * ' + # build cache is + - cron: "0 1 * * * " env: BUILD_TYPE: Release - BUILDCACHE_VERSION: 0.24.4 + BUILDCACHE_VERSION: 0.27.6 BUILDCACHE_DIR: ${{ github.workspace }}/buildcache_dir BUILDCACHE_ACCURACY: SLOPPY @@ -20,57 +20,62 @@ jobs: fail-fast: false matrix: config: - - { - name: "Windows Latest MSVC", - os: windows-latest, - cc: "cl", cxx: "cl", - vcpkg-response-file: vcpkg_x64-windows.txt, - vcpkg-triplet: x64-windows, - build-python-module: true, - execute-unit-tests: true - } - - { - name: "Ubuntu Latest gcc", - os: ubuntu-latest, - cc: "gcc", cxx: "g++", - vcpkg-response-file: vcpkg_x64-linux.txt, - vcpkg-triplet: x64-linux, - build-python-module: true, - execute-unit-tests: true - } - - { - name: "Ubuntu Latest clang", - os: ubuntu-latest, - cc: "clang", cxx: "clang++", - vcpkg-response-file: vcpkg_x64-linux.txt, - vcpkg-triplet: x64-linux, - build-python-module: true, - execute-unit-tests: true - } - - { - name: "Mac OS", - os: macos-latest, - cc: "clang", cxx: "clang++", - vcpkg-response-file: vcpkg_x64-osx.txt, - vcpkg-triplet: x64-osx, - build-python-module: false, - execute-unit-tests: false - } + - { + name: "Windows Latest MSVC", + os: windows-latest, + cc: "cl", + cxx: "cl", + vcpkg-response-file: vcpkg_x64-windows.txt, + vcpkg-triplet: x64-windows, + build-python-module: true, + execute-unit-tests: true, + } + - { + name: "Ubuntu Latest gcc", + os: ubuntu-latest, + cc: "gcc", + cxx: "g++", + vcpkg-response-file: vcpkg_x64-linux.txt, + vcpkg-triplet: x64-linux, + build-python-module: true, + execute-unit-tests: true, + } + - { + name: "Ubuntu Latest clang", + os: ubuntu-latest, + cc: "clang", + cxx: "clang++", + vcpkg-response-file: vcpkg_x64-linux.txt, + vcpkg-triplet: x64-linux, + build-python-module: true, + execute-unit-tests: true, + } + - { + name: "Mac OS", + os: macos-latest, + cc: "clang", + cxx: "clang++", + vcpkg-response-file: vcpkg_x64-osx.txt, + vcpkg-triplet: x64-osx, + build-python-module: false, + execute-unit-tests: false, + } steps: - name: Checkout uses: actions/checkout@v2 with: submodules: true + - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.8' + python-version: "3.8" - name: Display Python version run: python -c "import sys; print(sys.version)" - + - name: Use CMake uses: lukka/get-cmake@latest - + - name: Use MSVC (Windows) if: matrix.config.os == 'windows-latest' uses: ilammy/msvc-dev-cmd@v1 @@ -80,7 +85,7 @@ jobs: shell: cmake -P {0} run: | if ("${{ runner.os }}" STREQUAL "Windows") - set(buildcache_suffix "win-msvc.zip") + set(buildcache_suffix "windows.zip") elseif ("${{ runner.os }}" STREQUAL "macOS") set(buildcache_suffix "macos.zip") elseif ("${{ runner.os }}" STREQUAL "Linux") @@ -97,7 +102,7 @@ jobs: COMMAND chmod +x buildcache/bin/buildcache ) endif() - + - name: Prepare cache timestamp id: cache_timestamp_string shell: cmake -P {0} @@ -111,28 +116,30 @@ jobs: path: ${{ env.BUILDCACHE_DIR }} key: ${{ matrix.config.os }}-${{ matrix.config.cc }}-cache-v02-${{ steps.cache_timestamp_string.outputs.timestamp }} - name: Create Folder for buildcache - run: New-Item ${{ env.BUILDCACHE_DIR }} -ItemType "directory" -Force + run: New-Item ${{ env.BUILDCACHE_DIR }} -ItemType "directory" -Force shell: pwsh - name: Add buildcache to system path run: echo "${{github.workspace}}/buildcache/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 shell: pwsh - - - name: Cache Qt + + - name: Cache Qt id: cache-qt uses: actions/cache@v2 with: path: ${{ github.workspace }}/Qt/ - key: ${{ matrix.config.os }}-QtCache-v03 + key: ${{ matrix.config.os }}-QtCache-5-12-12 - name: Install Qt uses: jurplel/install-qt-action@v2 with: - version: 5.9.9 + version: 5.12.12 modules: qtscript qtcharts - dir: '${{ github.workspace }}/Qt/' + dir: "${{ github.workspace }}/Qt/" cached: ${{ steps.cache-qt.outputs.cache-hit }} + - name: Install Linux dependencies if: "contains( matrix.config.os, 'ubuntu')" run: sudo apt-get install libxkbcommon-x11-0 libgl1-mesa-dev mesa-common-dev libglfw3-dev libglu1-mesa-dev libhdf5-dev + - name: Get Python executable path id: python-path run: echo "::set-output name=PYTHON_EXECUTABLE::$(python -c 'import sys; import pathlib; print (pathlib.PurePath(sys.executable).as_posix())')" @@ -147,9 +154,10 @@ jobs: uses: lukka/run-vcpkg@v7 id: runvcpkg with: - vcpkgArguments: '@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}' - vcpkgDirectory: '${{ github.workspace }}/ThirdParty/vcpkg' - # Ensure the cache key changes any time the content of the response file changes. + vcpkgArguments: "@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}" + vcpkgDirectory: + "${{ github.workspace }}/ThirdParty/vcpkg" + # Ensure the cache key changes any time the content of the response file changes. appendedCacheKey: ${{ hashFiles(env.VCPKGRESPONSEFILE) }}-cache-key-v2 - name: Cache dynamic version of OpenSSL (Linux) @@ -169,7 +177,7 @@ jobs: run: | set(ENV{CC} ${{ matrix.config.cc }}) set(ENV{CXX} ${{ matrix.config.cxx }}) - + execute_process( COMMAND cmake -S . diff --git a/.github/workflows/ResInsightWithCacheManualPaths.yml b/.github/workflows/ResInsightWithCacheManualPaths.yml index 7b98fb5b8e..8008815cb7 100644 --- a/.github/workflows/ResInsightWithCacheManualPaths.yml +++ b/.github/workflows/ResInsightWithCacheManualPaths.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: schedule: # Once every night - - cron: '0 1 * * * ' + - cron: "0 1 * * * " env: NINJA_VERSION: 1.9.0 BUILD_TYPE: Release @@ -18,14 +18,15 @@ jobs: fail-fast: false matrix: config: - - { - name: "Ubuntu 20.04", - os: ubuntu-20.04, - cc: "gcc", cxx: "g++", - vcpkg-response-file: vcpkg_x64-linux.txt, - vcpkg-triplet: x64-linux, - cmake-toolchain: 'ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake' - } + - { + name: "Ubuntu 20.04", + os: ubuntu-20.04, + cc: "gcc", + cxx: "g++", + vcpkg-response-file: vcpkg_x64-linux.txt, + vcpkg-triplet: x64-linux, + cmake-toolchain: "ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake", + } steps: - name: Checkout uses: actions/checkout@v2 @@ -34,7 +35,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 with: - python-version: '3.8' + python-version: "3.8" - name: Display Python version run: python -c "import sys; print(sys.version)" - name: Download Ninja @@ -61,7 +62,7 @@ jobs: COMMAND chmod +x buildcache/bin/buildcache ) endif() - + - name: Prepare cache timestamp id: cache_timestamp_string shell: cmake -P {0} @@ -75,24 +76,24 @@ jobs: path: ${{ env.BUILDCACHE_DIR }} key: ${{ matrix.config.name }}-cache-v02-${{ steps.cache_timestamp_string.outputs.timestamp }} - name: Create Folder for buildcache - run: New-Item ${{ env.BUILDCACHE_DIR }} -ItemType "directory" -Force + run: New-Item ${{ env.BUILDCACHE_DIR }} -ItemType "directory" -Force shell: pwsh - name: Add buildcache to system path run: echo "${{github.workspace}}/buildcache/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 shell: pwsh - - - name: Cache Qt + + - name: Cache Qt id: cache-qt uses: actions/cache@v2 with: path: ${{ github.workspace }}/Qt/ - key: ${{ matrix.config.os }}-QtCache-v03 + key: ${{ matrix.config.os }}-QtCache-5-12-12 - name: Install Qt uses: jurplel/install-qt-action@v2 with: - version: 5.9.9 + version: 5.12.12 modules: qtscript qtcharts - dir: '${{ github.workspace }}/Qt/' + dir: "${{ github.workspace }}/Qt/" cached: ${{ steps.cache-qt.outputs.cache-hit }} - name: Install Linux dependencies if: "contains( matrix.config.os, 'ubuntu')" @@ -111,9 +112,10 @@ jobs: uses: lukka/run-vcpkg@v5 id: runvcpkg with: - vcpkgArguments: '@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}' - vcpkgDirectory: '${{ github.workspace }}/ThirdParty/vcpkg' - # Ensure the cache key changes any time the content of the response file changes. + vcpkgArguments: "@${{ github.workspace }}/${{ matrix.config.vcpkg-response-file }}" + vcpkgDirectory: + "${{ github.workspace }}/ThirdParty/vcpkg" + # Ensure the cache key changes any time the content of the response file changes. appendedCacheKey: ${{ hashFiles(env.VCPKGRESPONSEFILE) }} - name: Configure @@ -138,7 +140,7 @@ jobs: set(path_separator ";") endif() set(ENV{PATH} "$ENV{GITHUB_WORKSPACE}${path_separator}$ENV{PATH}") - + execute_process( COMMAND cmake -S . diff --git a/.github/workflows/centos7.yml b/.github/workflows/centos7.yml index 486e7da5be..ada2355853 100644 --- a/.github/workflows/centos7.yml +++ b/.github/workflows/centos7.yml @@ -4,93 +4,93 @@ on: workflow_dispatch: schedule: # Once every night - - cron: '0 1 * * * ' + - cron: "0 1 * * * " jobs: build_on_centos7: runs-on: ubuntu-latest container: image: centos:7 steps: - - name: Install Dependencies - run: | - yum install -y centos-release-scl - yum-config-manager --enable rhel-server-rhscl-7-rpms - - yum install -y https://repo.ius.io/ius-release-el7.rpm - yum install -y git222 + - name: Install Dependencies + run: | + yum install -y centos-release-scl + yum-config-manager --enable rhel-server-rhscl-7-rpms - yum install -y qt5-qtbase - yum install -y qt5-qtbase-devel - yum install -y qt5-qtscript-devel - yum install -y qt5-qtsvg-devel + yum install -y https://repo.ius.io/ius-release-el7.rpm + yum install -y git222 - yum install -y cmake3 - yum install -y make + yum install -y qt5-qtbase + yum install -y qt5-qtbase-devel + yum install -y qt5-qtscript-devel + yum install -y qt5-qtsvg-devel - yum install -y mesa-libGL-devel - yum install -y freeglut-devel + yum install -y cmake3 + yum install -y make - yum install -y devtoolset-10 - - yum install -y rh-python36 - - name: Build QtCharts - run: | - source /opt/rh/devtoolset-10/enable - git clone git://code.qt.io/qt/qtcharts.git - cd qtcharts/ - git checkout v5.9.7 - qmake-qt5 --version - qmake-qt5 -makefile - make -j 4 - make install - - name: Checkout - uses: actions/checkout@v2 - with: - submodules: true - - name: Set up Python - id: python-path - run: | - source /opt/rh/rh-python36/enable - python -c "import sys; print(sys.version)" - echo "::set-output name=PYTHON_EXECUTABLE::$(python -c 'import sys; import pathlib; print (pathlib.PurePath(sys.executable).as_posix())')" - - name: Build ResInsight - run: | - source /opt/rh/devtoolset-10/enable - source /opt/rh/rh-python36/enable + yum install -y mesa-libGL-devel + yum install -y freeglut-devel - cmake3 --version - git --version - g++ --version - ${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} --version + yum install -y devtoolset-10 - ${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pip install --upgrade pip - ${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pip install grpcio-tools + yum install -y rh-python36 + - name: Build QtCharts + run: | + source /opt/rh/devtoolset-10/enable + git clone git://code.qt.io/qt/qtcharts.git + cd qtcharts/ + git checkout v5.12.12 + qmake-qt5 --version + qmake-qt5 -makefile + make -j 4 + make install + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true + - name: Set up Python + id: python-path + run: | + source /opt/rh/rh-python36/enable + python -c "import sys; print(sys.version)" + echo "::set-output name=PYTHON_EXECUTABLE::$(python -c 'import sys; import pathlib; print (pathlib.PurePath(sys.executable).as_posix())')" + - name: Build ResInsight + run: | + source /opt/rh/devtoolset-10/enable + source /opt/rh/rh-python36/enable - ThirdParty/vcpkg/bootstrap-vcpkg.sh - ThirdParty/vcpkg/vcpkg install grpc boost-filesystem boost-spirit eigen3 - - mkdir cmakebuild - cd cmakebuild - cmake3 \ - -DRESINSIGHT_QT5_BUNDLE_LIBRARIES=ON \ - -DRESINSIGHT_ENABLE_GRPC=true \ - -DRESINSIGHT_ENABLE_UNITY_BUILD=true \ - -DVCPKG_TARGET_TRIPLET=x64-linux \ - -DCMAKE_TOOLCHAIN_FILE=../ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake \ - -DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} \ - -DRESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true \ - .. - - make -j8 - make package - rm -rf packages/_CPack_Packages - - # Show file structure - pwd - ls + cmake3 --version + git --version + g++ --version + ${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} --version - - name: Upload artifact - uses: actions/upload-artifact@v2 - with: - name: ResInsight - path: ./cmakebuild/packages + ${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pip install --upgrade pip + ${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} -m pip install grpcio-tools + + ThirdParty/vcpkg/bootstrap-vcpkg.sh + ThirdParty/vcpkg/vcpkg install grpc boost-filesystem boost-spirit eigen3 + + mkdir cmakebuild + cd cmakebuild + cmake3 \ + -DRESINSIGHT_QT5_BUNDLE_LIBRARIES=ON \ + -DRESINSIGHT_ENABLE_GRPC=true \ + -DRESINSIGHT_ENABLE_UNITY_BUILD=true \ + -DVCPKG_TARGET_TRIPLET=x64-linux \ + -DCMAKE_TOOLCHAIN_FILE=../ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DRESINSIGHT_GRPC_PYTHON_EXECUTABLE=${{ steps.python-path.outputs.PYTHON_EXECUTABLE }} \ + -DRESINSIGHT_GRPC_DOWNLOAD_PYTHON_MODULE=true \ + .. + + make -j8 + make package + rm -rf packages/_CPack_Packages + + # Show file structure + pwd + ls + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: ResInsight + path: ./cmakebuild/packages From 3d6b7bdb0e600df2ec1aad8cf9d99bebb2e5ce42 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sat, 12 Feb 2022 18:07:40 +0100 Subject: [PATCH 121/406] Janitor: Roll back to 5.9.7 for centos7 --- .github/workflows/centos7.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/centos7.yml b/.github/workflows/centos7.yml index ada2355853..2e4de20260 100644 --- a/.github/workflows/centos7.yml +++ b/.github/workflows/centos7.yml @@ -38,7 +38,7 @@ jobs: source /opt/rh/devtoolset-10/enable git clone git://code.qt.io/qt/qtcharts.git cd qtcharts/ - git checkout v5.12.12 + git checkout v5.9.7 qmake-qt5 --version qmake-qt5 -makefile make -j 4 From a8a3d3332b3dadb2827f3982f198f1cc1eeda589 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 14 Feb 2022 09:56:08 +0100 Subject: [PATCH 122/406] #8536 Summary Plot: Fix axis position for legacy projects. The axis property position has to be reassigned for all axis types. --- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 8514c770a1..2816449962 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1961,11 +1961,8 @@ void RimSummaryPlot::initAfterRead() // This operation will overwrite the plot axis side, default is left axisProperties->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() ); - if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) - { - // Reset the plot axis for the right axis - axisProperties->setNameAndAxis( "Right", RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, 0 ); - } + // Reset the plot axis for the axis property + axisProperties->setNameAndAxis( axisProperties->name(), axis.axis(), 0 ); } }; From 477ae02382891542b4a3edec39ab7bf4a44623e3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 14 Feb 2022 11:49:37 +0100 Subject: [PATCH 123/406] Logarithmic curve support and renaming (#8546) * Add test for both positive and negative numbers * Remove redundant sample count from parameter list * Propagate useLogarithmicScale * Renaming --- .../RicNewStimPlanModelPlotFeature.cpp | 28 +- .../RicNewWellBoreStabilityPlotFeature.cpp | 26 +- .../RicWellLogPlotTrackFeatureImpl.cpp | 4 +- .../AnalysisPlots/RimAnalysisPlot.h | 4 +- .../RimAbstractCorrelationPlot.h | 4 +- .../Flow/RimWellAllocationPlot.cpp | 2 +- .../Flow/RimWellDistributionPlot.cpp | 4 +- .../Flow/RimWellDistributionPlot.h | 4 +- .../Flow/RimWellFlowRateCurve.cpp | 9 +- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 8 +- .../GridCrossPlots/RimGridCrossPlot.cpp | 12 +- .../GridCrossPlots/RimGridCrossPlot.h | 4 +- .../GridCrossPlots/RimGridCrossPlotCurve.cpp | 4 +- .../ProjectDataModel/RimDepthTrackPlot.cpp | 4 +- .../RimGridTimeHistoryCurve.cpp | 14 +- .../ProjectDataModel/RimMultiPlot.cpp | 4 +- ApplicationLibCode/ProjectDataModel/RimPlot.h | 6 +- .../ProjectDataModel/RimPlotCurve.cpp | 16 +- .../ProjectDataModel/RimPlotCurve.h | 10 +- .../ProjectDataModel/RimVfpPlot.cpp | 8 +- .../ProjectDataModel/RimVfpPlot.h | 4 +- .../StimPlanModel/RimStimPlanModelCurve.cpp | 12 +- .../Summary/RimAsciiDataCurve.cpp | 8 +- .../Summary/RimSummaryCurve.cpp | 18 +- .../Summary/RimSummaryPlot.cpp | 12 +- .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 +- .../WellLog/Rim3dWellLogRftCurve.cpp | 2 +- .../RimEnsembleWellLogStatisticsCurve.cpp | 3 +- .../WellLog/RimWellLogCurve.cpp | 98 ++++--- .../WellLog/RimWellLogCurve.h | 59 ++-- .../WellLog/RimWellLogExtractionCurve.cpp | 51 ++-- .../WellLog/RimWellLogFileCurve.cpp | 14 +- .../WellLog/RimWellLogRftCurve.cpp | 35 +-- .../WellLog/RimWellLogTrack.cpp | 264 +++++++++--------- .../WellLog/RimWellLogTrack.h | 46 +-- .../RimWellMeasurementCollection.cpp | 2 +- .../RimWellMeasurementCurve.cpp | 36 +-- .../RimcWellLogPlot.cpp | 4 +- .../RimcWellLogTrack.cpp | 4 +- .../ReservoirDataModel/RigLasFileExporter.cpp | 8 +- .../RigWellLogCurveData.cpp | 85 +++--- .../ReservoirDataModel/RigWellLogCurveData.h | 31 +- .../RimWellLogExtractionCurveImpl-Test.cpp | 34 ++- .../RiuFlowCharacteristicsPlot.cpp | 10 +- .../UserInterface/RiuPlotCurve.cpp | 22 +- .../UserInterface/RiuPlotCurve.h | 13 +- .../UserInterface/RiuQtChartsPlotCurve.cpp | 8 +- .../UserInterface/RiuQtChartsPlotCurve.h | 2 +- .../UserInterface/RiuQwtPlotCurve.cpp | 12 +- .../UserInterface/RiuQwtPlotCurve.h | 4 +- 50 files changed, 598 insertions(+), 482 deletions(-) diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp index 8dcd3badb9..184768440d 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp @@ -224,15 +224,15 @@ void RicNewStimPlanModelPlotFeature::createFormationTrack( RimStimPlanModelPlot* formationTrack->setFormationWellPath( stimPlanModel->thicknessDirectionWellPath() ); formationTrack->setFormationCase( eclipseCase ); formationTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS ); - formationTrack->setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility::AXIS_GRID_NONE ); + formationTrack->setPropertyValueAxisGridVisibility( RimWellLogPlot::AxisGridVisibility::AXIS_GRID_NONE ); formationTrack->setShowWellPathAttributes( true ); formationTrack->setShowBothSidesOfWell( false ); formationTrack->setWellPathAttributesSource( stimPlanModel->thicknessDirectionWellPath() ); - formationTrack->setVisibleXRange( 0.0, 0.0 ); + formationTrack->setVisiblePropertyValueRange( 0.0, 0.0 ); formationTrack->setOverburdenHeight( stimPlanModel->overburdenHeight() ); formationTrack->setUnderburdenHeight( stimPlanModel->underburdenHeight() ); formationTrack->setColSpan( RimPlot::ONE ); - formationTrack->setXAxisTitle( stimPlanModel->unitForProperty( RiaDefines::CurveProperty::FORMATIONS ) ); + formationTrack->setPropertyValueAxisTitle( stimPlanModel->unitForProperty( RiaDefines::CurveProperty::FORMATIONS ) ); formationTrack->setLegendsVisible( true ); } @@ -260,18 +260,18 @@ void RicNewStimPlanModelPlotFeature::createFaciesTrack( RimStimPlanModelPlot* pl faciesTrack->setAnnotationDisplay( RiuPlotAnnotationTool::COLOR_SHADING ); faciesTrack->setOverburdenHeight( stimPlanModel->overburdenHeight() ); faciesTrack->setUnderburdenHeight( stimPlanModel->underburdenHeight() ); - faciesTrack->setXAxisTitle( stimPlanModel->unitForProperty( RiaDefines::CurveProperty::FACIES ) ); + faciesTrack->setPropertyValueAxisTitle( stimPlanModel->unitForProperty( RiaDefines::CurveProperty::FACIES ) ); faciesTrack->setLegendsVisible( false ); faciesTrack->setPlotTitleVisible( true ); RimColorLegend* faciesColors = faciesProperties->colorLegend(); if ( faciesColors ) faciesTrack->setColorShadingLegend( faciesColors ); - faciesTrack->setVisibleXRange( 0.0, 0.0 ); + faciesTrack->setVisiblePropertyValueRange( 0.0, 0.0 ); faciesTrack->setColSpan( RimPlot::ONE ); - faciesTrack->setAutoScaleXEnabled( false ); - faciesTrack->setVisibleXRange( 0.0, 0.0 ); - faciesTrack->setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility::AXIS_GRID_NONE ); + faciesTrack->setAutoScalePropertyValuesEnabled( false ); + faciesTrack->setVisiblePropertyValueRange( 0.0, 0.0 ); + faciesTrack->setPropertyValueAxisGridVisibility( RimWellLogPlot::AxisGridVisibility::AXIS_GRID_NONE ); caf::ColorTable colors = RiaColorTables::wellLogPlotPaletteColors(); @@ -320,7 +320,7 @@ void RicNewStimPlanModelPlotFeature::createLayersTrack( RimStimPlanModelPlot* pl RimColorLegend* faciesColors = faciesProperties->colorLegend(); if ( faciesColors ) faciesTrack->setColorShadingLegend( faciesColors ); - faciesTrack->setVisibleXRange( 0.0, 0.0 ); + faciesTrack->setVisiblePropertyValueRange( 0.0, 0.0 ); faciesTrack->setColSpan( RimPlot::ONE ); caf::ColorTable colors = RiaColorTables::wellLogPlotPaletteColors(); @@ -334,8 +334,8 @@ void RicNewStimPlanModelPlotFeature::createLayersTrack( RimStimPlanModelPlot* pl curve->setAutoNameComponents( false, true, false, false, false ); faciesTrack->addCurve( curve ); - faciesTrack->setAutoScaleXEnabled( true ); - faciesTrack->setXAxisTitle( stimPlanModel->unitForProperty( RiaDefines::CurveProperty::LAYERS ) ); + faciesTrack->setAutoScalePropertyValuesEnabled( true ); + faciesTrack->setPropertyValueAxisTitle( stimPlanModel->unitForProperty( RiaDefines::CurveProperty::LAYERS ) ); curve->loadDataAndUpdate( true ); @@ -420,12 +420,12 @@ void RicNewStimPlanModelPlotFeature::createParametersTrack( RimStimPlanModelPlot colorIndex++; } - plotTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR ); + plotTrack->setPropertyValueAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR ); plotTrack->setShowRegionLabels( true ); plotTrack->setLogarithmicScale( isPlotLogarithmic ); - plotTrack->setAutoScaleXEnabled( true ); + plotTrack->setAutoScalePropertyValuesEnabled( true ); plotTrack->setMinAndMaxTicksOnly( useMinMaxTicksOnly( propertyTypes[0] ) ); - plotTrack->setXAxisTitle( stimPlanModel->unitForProperty( propertyTypes[0] ) ); + plotTrack->setPropertyValueAxisTitle( stimPlanModel->unitForProperty( propertyTypes[0] ) ); plotTrack->updateConnectedEditors(); plot->updateConnectedEditors(); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp index b0841f9dca..7891b7fe54 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp @@ -220,7 +220,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil formationTrack->setFormationWellPath( wellPath ); formationTrack->setFormationCase( geoMechCase ); formationTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS ); - formationTrack->setVisibleXRange( 0.0, 0.0 ); + formationTrack->setVisiblePropertyValueRange( 0.0, 0.0 ); formationTrack->setColSpan( RimPlot::ONE ); } @@ -242,8 +242,8 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi casingShoeTrack->setShowBothSidesOfWell( false ); casingShoeTrack->setAnnotationTransparency( 90 ); casingShoeTrack->setWellPathAttributesSource( wellPath ); - casingShoeTrack->setVisibleXRange( 0.0, 0.0 ); - casingShoeTrack->setAutoScaleXEnabled( true ); + casingShoeTrack->setVisiblePropertyValueRange( 0.0, 0.0 ); + casingShoeTrack->setAutoScalePropertyValuesEnabled( true ); casingShoeTrack->loadDataAndUpdate(); } @@ -258,10 +258,10 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi RimWellLogTrack* paramCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "WBS Parameters", plot ); paramCurvesTrack->setColSpan( RimPlot::TWO ); - paramCurvesTrack->setVisibleXRange( 0.0, 2.0 ); - paramCurvesTrack->setAutoScaleXEnabled( true ); + paramCurvesTrack->setVisiblePropertyValueRange( 0.0, 2.0 ); + paramCurvesTrack->setAutoScalePropertyValuesEnabled( true ); paramCurvesTrack->setTickIntervals( 1.0, 0.2 ); - paramCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); + paramCurvesTrack->setPropertyValueAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); paramCurvesTrack->setFormationWellPath( wellPath ); paramCurvesTrack->setFormationCase( geoMechCase ); paramCurvesTrack->setShowRegionLabels( true ); @@ -290,7 +290,7 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi curve->setCustomName( param.name() ); i++; } - paramCurvesTrack->setAutoScaleXEnabled( true ); + paramCurvesTrack->setAutoScalePropertyValuesEnabled( true ); } //-------------------------------------------------------------------------------------------------- @@ -305,11 +305,11 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore "Stability Curves", plot ); - stabilityCurvesTrack->setVisibleXRange( 0.0, 2.5 ); + stabilityCurvesTrack->setVisiblePropertyValueRange( 0.0, 2.5 ); stabilityCurvesTrack->setColSpan( RimPlot::THREE ); - stabilityCurvesTrack->setAutoScaleXEnabled( true ); + stabilityCurvesTrack->setAutoScalePropertyValuesEnabled( true ); stabilityCurvesTrack->setTickIntervals( 1.0, 0.2 ); - stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); + stabilityCurvesTrack->setPropertyValueAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); stabilityCurvesTrack->setFormationWellPath( wellPath ); stabilityCurvesTrack->setFormationCase( geoMechCase ); stabilityCurvesTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS ); @@ -368,7 +368,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore } } - stabilityCurvesTrack->setAutoScaleXEnabled( true ); + stabilityCurvesTrack->setAutoScalePropertyValuesEnabled( true ); } //-------------------------------------------------------------------------------------------------- @@ -426,9 +426,9 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability minValue = cvf::Math::clamp( minValue, 0.0, maxValue - 90.0 ); } wellPathAnglesTrack->setColSpan( RimPlot::TWO ); - wellPathAnglesTrack->setVisibleXRange( minValue, maxValue ); + wellPathAnglesTrack->setVisiblePropertyValueRange( minValue, maxValue ); wellPathAnglesTrack->setTickIntervals( 180.0, 45.0 ); - wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); + wellPathAnglesTrack->setPropertyValueAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); wellPathAnglesTrack->setFormationWellPath( wellPath ); wellPathAnglesTrack->setFormationCase( geoMechCase ); wellPathAnglesTrack->setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType::FORMATION_ANNOTATIONS ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp index c940cdaa7e..a09e17fb77 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicWellLogPlotTrackFeatureImpl.cpp @@ -73,7 +73,7 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( RimWellLogTra for ( auto track : srcTracks ) { - track->setAutoScaleXEnabled( true ); + track->setAutoScalePropertyValuesEnabled( true ); track->updateParentPlotZoom(); track->updateStackedCurveData(); track->updateConnectedEditors(); @@ -86,7 +86,7 @@ void RicWellLogPlotTrackFeatureImpl::moveCurvesToWellLogPlotTrack( RimWellLogTra destTrack->loadDataAndUpdate(); destTrack->updateStackedCurveData(); - destTrack->setAutoScaleXEnabled( true ); + destTrack->setAutoScalePropertyValuesEnabled( true ); destTrack->updateParentPlotZoom(); destTrack->updateConnectedEditors(); } diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h index 53a70a0636..f104e69bb4 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h @@ -136,8 +136,8 @@ class RimAnalysisPlot : public RimPlot void reattachAllCurves() override {} void updateAxes() override; void onAxisSelected( int axis, bool toggle ) override; - void setAutoScaleXEnabled( bool enabled ) override {} - void setAutoScaleYEnabled( bool enabled ) override {} + void setAutoScalePropertyValuesEnabled( bool enabled ) override {} + void setAutoScaleDepthValuesEnabled( bool enabled ) override {} void updateLegend() override{}; QString asciiDataForPlotExport() const override { return ""; } diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h index f134284d07..f764d7f118 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h @@ -107,8 +107,8 @@ class RimAbstractCorrelationPlot : public RimPlot RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; void reattachAllCurves() override {} - void setAutoScaleXEnabled( bool enabled ) override {} - void setAutoScaleYEnabled( bool enabled ) override {} + void setAutoScalePropertyValuesEnabled( bool enabled ) override {} + void setAutoScaleDepthValuesEnabled( bool enabled ) override {} void updateLegend() override; QString asciiDataForPlotExport() const override { return ""; } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 4b6fb36b0a..39164c138e 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -481,7 +481,7 @@ void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotT : RimWellLogFile::WELL_FLOW_COND_STANDARD; QString axisTitle = RimWellPlotTools::flowPlotAxisTitle( condition, unitSet ); - plotTrack->setXAxisTitle( axisTitle ); + plotTrack->setPropertyValueAxisTitle( axisTitle ); #if 0 if (m_flowDiagSolution) diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp index b7d01acf39..71f9872698 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp @@ -127,7 +127,7 @@ RiuPlotWidget* RimWellDistributionPlot::plotWidget() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellDistributionPlot::setAutoScaleXEnabled( bool /*enabled*/ ) +void RimWellDistributionPlot::setAutoScalePropertyValuesEnabled( bool /*enabled*/ ) { // cvf::Trace::show("RimWellDistributionPlot::setAutoScaleXEnabled()"); } @@ -135,7 +135,7 @@ void RimWellDistributionPlot::setAutoScaleXEnabled( bool /*enabled*/ ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellDistributionPlot::setAutoScaleYEnabled( bool /*enabled*/ ) +void RimWellDistributionPlot::setAutoScaleDepthValuesEnabled( bool /*enabled*/ ) { // cvf::Trace::show("RimWellDistributionPlot::setAutoScaleYEnabled()"); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h index 1949837277..879ccb39f3 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h @@ -50,8 +50,8 @@ class RimWellDistributionPlot : public RimPlot // RimPlot implementations RiuPlotWidget* plotWidget() override; - void setAutoScaleXEnabled( bool enabled ) override; - void setAutoScaleYEnabled( bool enabled ) override; + void setAutoScalePropertyValuesEnabled( bool enabled ) override; + void setAutoScaleDepthValuesEnabled( bool enabled ) override; void updateAxes() override; void updateLegend() override; void updateZoomInParentPlot() override; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp index 0574c63a42..83d18d5af3 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellFlowRateCurve.cpp @@ -300,7 +300,14 @@ void RimWellFlowRateCurve::setFlowValuesPrDepthValue( const QString& const std::vector& depthValues, const std::vector& flowRates ) { - this->setValuesAndDepths( flowRates, depthValues, depthType, 0.0, RiaDefines::DepthUnitType::UNIT_NONE, false ); + bool useLogarithmicScale = false; + this->setPropertyValuesAndDepths( flowRates, + depthValues, + depthType, + 0.0, + RiaDefines::DepthUnitType::UNIT_NONE, + false, + useLogarithmicScale ); m_curveAutoName = curveName; } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 87cc43993b..4fb250e1d8 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -188,7 +188,7 @@ void RimWellPltPlot::setPlotXAxisTitles( RimWellLogTrack* plotTrack ) if ( m_useStandardConditionCurves ) axisTitle += RimWellPlotTools::flowPlotAxisTitle( RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet ); - plotTrack->setXAxisTitle( axisTitle ); + plotTrack->setPropertyValueAxisTitle( axisTitle ); #if 0 QString unitText; @@ -685,7 +685,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection() curveGroupId++; } - plotTrack->setAutoScaleXEnabled( true ); + plotTrack->setAutoScalePropertyValuesEnabled( true ); RimWellLogPlot::onLoadDataAndUpdate(); } @@ -918,7 +918,7 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, RimWellLogTrack* const plotTrack = dynamic_cast( plotByIndex( 0 ) ); if ( plotTrack ) { - plotTrack->setAutoScaleXEnabled( true ); + plotTrack->setAutoScalePropertyValuesEnabled( true ); } updateZoom(); } @@ -931,7 +931,7 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, RimWellLogTrack* const plotTrack = dynamic_cast( plotByIndex( 0 ) ); if ( plotTrack ) { - plotTrack->setAutoScaleXEnabled( true ); + plotTrack->setAutoScalePropertyValuesEnabled( true ); } updateZoom(); } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index 87821173b8..9103c6c967 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -183,8 +183,8 @@ QImage RimGridCrossPlot::snapshotWindowContent() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlot::zoomAll() { - setAutoScaleXEnabled( true ); - setAutoScaleYEnabled( true ); + setAutoScalePropertyValuesEnabled( true ); + setAutoScaleDepthValuesEnabled( true ); updateZoomInParentPlot(); } @@ -338,7 +338,7 @@ void RimGridCrossPlot::detachAllCurves() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlot::setAutoScaleXEnabled( bool enabled ) +void RimGridCrossPlot::setAutoScalePropertyValuesEnabled( bool enabled ) { m_xAxisProperties->setAutoZoom( enabled ); } @@ -346,7 +346,7 @@ void RimGridCrossPlot::setAutoScaleXEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlot::setAutoScaleYEnabled( bool enabled ) +void RimGridCrossPlot::setAutoScaleDepthValuesEnabled( bool enabled ) { m_yAxisProperties->setAutoZoom( enabled ); } @@ -457,8 +457,8 @@ void RimGridCrossPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter //-------------------------------------------------------------------------------------------------- void RimGridCrossPlot::onPlotZoomed() { - setAutoScaleXEnabled( false ); - setAutoScaleYEnabled( false ); + setAutoScalePropertyValuesEnabled( false ); + setAutoScaleDepthValuesEnabled( false ); updateZoomFromParentPlot(); } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h index 36d460f79d..f50d2c0d09 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h @@ -102,8 +102,8 @@ class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface void updateZoomInParentPlot() override; void updateZoomFromParentPlot() override; - void setAutoScaleXEnabled( bool enabled ) override; - void setAutoScaleYEnabled( bool enabled ) override; + void setAutoScalePropertyValuesEnabled( bool enabled ) override; + void setAutoScaleDepthValuesEnabled( bool enabled ) override; caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; void onAxisSelected( int axis, bool toggle ) override; diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp index abd2f86bea..6c079924c3 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCurve.cpp @@ -57,8 +57,8 @@ void RimGridCrossPlotCurve::setSamples( const std::vector& xValues, cons if ( xValues.empty() || yValues.empty() || !m_plotCurve ) return; - bool isLogCurve = false; - m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, isLogCurve ); + bool useLogarithmicScale = false; + m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, useLogarithmicScale ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index 4649a113ed..f9fed18592 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -315,7 +315,7 @@ void RimDepthTrackPlot::updateZoom() for ( RimPlot* plot : plots() ) { - static_cast( plot )->setVisibleYRange( m_minVisibleDepth(), m_maxVisibleDepth() ); + static_cast( plot )->setVisibleDepthRange( m_minVisibleDepth(), m_maxVisibleDepth() ); plot->updateZoomInParentPlot(); } @@ -1183,7 +1183,7 @@ void RimDepthTrackPlot::setAutoScaleXEnabled( bool enabled ) { for ( RimPlot* plot : plots() ) { - plot->setAutoScaleXEnabled( enabled ); + plot->setAutoScalePropertyValuesEnabled( enabled ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp index 654b6e88f9..40fae50a12 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridTimeHistoryCurve.cpp @@ -408,18 +408,20 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate( bool updateParentPlot ) RimSummaryPlot* plot = nullptr; firstAncestorOrThisOfType( plot ); - bool isLogCurve = plot->isLogarithmicScaleEnabled( yAxis() ); + bool useLogarithmicScale = plot->isLogarithmicScaleEnabled( yAxis() ); if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE ) { std::vector dateTimes = timeStepValues(); if ( dateTimes.size() > 0 && dateTimes.size() == values.size() ) { - m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, values, isLogCurve ); + m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, values, useLogarithmicScale ); } else { - m_plotCurve->setSamplesFromTimeTAndYValues( std::vector(), std::vector(), isLogCurve ); + m_plotCurve->setSamplesFromTimeTAndYValues( std::vector(), + std::vector(), + useLogarithmicScale ); } } else @@ -435,11 +437,13 @@ void RimGridTimeHistoryCurve::onLoadDataAndUpdate( bool updateParentPlot ) times.push_back( timeScale * day ); } - m_plotCurve->setSamplesFromXValuesAndYValues( times, values, isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( times, values, useLogarithmicScale ); } else { - m_plotCurve->setSamplesFromTimeTAndYValues( std::vector(), std::vector(), isLogCurve ); + m_plotCurve->setSamplesFromTimeTAndYValues( std::vector(), + std::vector(), + useLogarithmicScale ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 15d9c5248d..fe263fd2e9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -406,7 +406,7 @@ void RimMultiPlot::setAutoScaleXEnabled( bool enabled ) { for ( RimPlot* plot : plots() ) { - plot->setAutoScaleXEnabled( enabled ); + plot->setAutoScalePropertyValuesEnabled( enabled ); } } @@ -417,7 +417,7 @@ void RimMultiPlot::setAutoScaleYEnabled( bool enabled ) { for ( RimPlot* plot : plots() ) { - plot->setAutoScaleYEnabled( enabled ); + plot->setAutoScaleDepthValuesEnabled( enabled ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.h b/ApplicationLibCode/ProjectDataModel/RimPlot.h index 5f84ce8d9b..d792075e98 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.h @@ -71,9 +71,9 @@ class RimPlot : public QObject, public RimPlotWindow void updateAfterInsertingIntoMultiPlot(); // Pure virtual interface methods - virtual void setAutoScaleXEnabled( bool enabled ) = 0; - virtual void setAutoScaleYEnabled( bool enabled ) = 0; - virtual void updateAxes() = 0; + virtual void setAutoScalePropertyValuesEnabled( bool enabled ) = 0; + virtual void setAutoScaleDepthValuesEnabled( bool enabled ) = 0; + virtual void updateAxes() = 0; virtual void updateLegend() = 0; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index bc24d94bd7..c144df4a13 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -684,11 +684,11 @@ bool RimPlotCurve::hasParentPlot() const //-------------------------------------------------------------------------------------------------- void RimPlotCurve::setSamplesFromXYValues( const std::vector& xValues, const std::vector& yValues, - bool isLogCurve ) + bool useLogarithmicScale ) { if ( m_plotCurve ) { - m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, useLogarithmicScale ); } } @@ -697,11 +697,11 @@ void RimPlotCurve::setSamplesFromXYValues( const std::vector& xValues, //-------------------------------------------------------------------------------------------------- void RimPlotCurve::setSamplesFromDatesAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool isLogCurve ) + bool useLogarithmicScale ) { if ( m_plotCurve ) { - m_plotCurve->setSamplesFromDatesAndYValues( dateTimes, yValues, isLogCurve ); + m_plotCurve->setSamplesFromDatesAndYValues( dateTimes, yValues, useLogarithmicScale ); } } @@ -710,11 +710,11 @@ void RimPlotCurve::setSamplesFromDatesAndYValues( const std::vector& //-------------------------------------------------------------------------------------------------- void RimPlotCurve::setSamplesFromTimeTAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool isLogCurve ) + bool useLogarithmicScale ) { if ( m_plotCurve ) { - m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, yValues, isLogCurve ); + m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, yValues, useLogarithmicScale ); } } @@ -724,12 +724,12 @@ void RimPlotCurve::setSamplesFromTimeTAndYValues( const std::vector& dat void RimPlotCurve::setSamplesFromXYErrorValues( const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool isLogCurve, + bool useLogarithmicScale, RiaCurveDataTools::ErrorAxis errorAxis ) { if ( m_plotCurve ) { - m_plotCurve->setSamplesFromXYErrorValues( xValues, yValues, errorValues, isLogCurve, errorAxis ); + m_plotCurve->setSamplesFromXYErrorValues( xValues, yValues, errorValues, useLogarithmicScale, errorAxis ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h index dc54be2993..bb367a6ebe 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h @@ -141,18 +141,20 @@ class RimPlotCurve : public caf::PdmObject void setSamplesFromXYErrorValues( const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool isLogCurve, + bool useLogarithmicScale, RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ); - void setSamplesFromXYValues( const std::vector& xValues, const std::vector& yValues, bool isLogCurve ); + void setSamplesFromXYValues( const std::vector& xValues, + const std::vector& yValues, + bool useLogarithmicScale ); void setSamplesFromDatesAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool isLogCurve ); + bool useLogarithmicScale ); void setSamplesFromTimeTAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool isLogCurve ); + bool useLogarithmicScale ); protected: // Overridden PDM methods diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp index e4ffe06f58..78f5d39043 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp @@ -175,14 +175,14 @@ RiuPlotWidget* RimVfpPlot::plotWidget() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimVfpPlot::setAutoScaleXEnabled( bool /*enabled*/ ) +void RimVfpPlot::setAutoScalePropertyValuesEnabled( bool /*enabled*/ ) { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimVfpPlot::setAutoScaleYEnabled( bool /*enabled*/ ) +void RimVfpPlot::setAutoScaleDepthValuesEnabled( bool /*enabled*/ ) { } @@ -573,8 +573,8 @@ void RimVfpPlot::populatePlotWidgetWithPlotData( RiuPlotWidget* plotWidget, cons symbol->setSize( 6, 6 ); curve->setSymbol( symbol ); - bool isLogCurve = false; - curve->setSamplesFromXValuesAndYValues( plotData.xData( idx ), plotData.yData( idx ), isLogCurve ); + bool useLogarithmicScale = false; + curve->setSamplesFromXValuesAndYValues( plotData.xData( idx ), plotData.yData( idx ), useLogarithmicScale ); curve->attachToPlot( plotWidget ); curve->showInPlot(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h index ca832c04b7..991391e107 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h @@ -48,8 +48,8 @@ class RimVfpPlot : public RimPlot // RimPlot implementations RiuPlotWidget* plotWidget() override; - void setAutoScaleXEnabled( bool enabled ) override; - void setAutoScaleYEnabled( bool enabled ) override; + void setAutoScalePropertyValuesEnabled( bool enabled ) override; + void setAutoScaleDepthValuesEnabled( bool enabled ) override; void updateAxes() override; void updateLegend() override; QString asciiDataForPlotExport() const override; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCurve.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCurve.cpp index 0ed60b1d52..c4ccf87eb8 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCurve.cpp @@ -158,7 +158,17 @@ void RimStimPlanModelCurve::performDataExtraction( bool* isUsingPseudoLength ) filterInvalidValuesForLogarithmicScale( values ); } - this->setValuesWithMdAndTVD( values, measuredDepthValues, tvDepthValues, rkbDiff, depthUnit, !performDataSmoothing, xUnits ); + // TOOD: Consider rewrite, as RigWellLogCurveData can do logarithmic filtering + + bool useLogarithmicScale = false; + this->setPropertyValuesWithMdAndTVD( values, + measuredDepthValues, + tvDepthValues, + rkbDiff, + depthUnit, + !performDataSmoothing, + useLogarithmicScale, + xUnits ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp index 6d6b6a5e71..993a2280ae 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimAsciiDataCurve.cpp @@ -134,13 +134,13 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot ) RimSummaryPlot* plot = nullptr; firstAncestorOrThisOfType( plot ); - bool isLogCurve = plot->isLogarithmicScaleEnabled( this->yAxis() ); + bool useLogarithmicScale = plot->isLogarithmicScaleEnabled( this->yAxis() ); if ( dateTimes.size() > 0 && dateTimes.size() == values.size() ) { if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE ) { - m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, values, isLogCurve ); + m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, values, useLogarithmicScale ); } else { @@ -156,12 +156,12 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot ) } } - m_plotCurve->setSamplesFromXValuesAndYValues( times, values, isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( times, values, useLogarithmicScale ); } } else { - m_plotCurve->setSamplesFromTimeTAndYValues( std::vector(), std::vector(), isLogCurve ); + m_plotCurve->setSamplesFromTimeTAndYValues( std::vector(), std::vector(), useLogarithmicScale ); } updateZoomInParentPlot(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 22d021c7e3..38e627f727 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -601,7 +601,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot ) RimSummaryPlot* plot = nullptr; firstAncestorOrThisOfTypeAsserted( plot ); - bool isLogCurve = plot->isLogarithmicScaleEnabled( this->axisY() ); + bool useLogarithmicScale = plot->isLogarithmicScaleEnabled( this->axisY() ); bool shouldPopulateViewWithEmptyData = false; @@ -627,7 +627,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot ) { this->setSamplesFromXYValues( curveMerger.interpolatedYValuesForAllXValues( 0 ), curveMerger.interpolatedYValuesForAllXValues( 1 ), - isLogCurve ); + useLogarithmicScale ); } else { @@ -655,11 +655,11 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot ) if ( !errValues.empty() ) { - this->setSamplesFromXYErrorValues( timeSteps, curveValuesY, errValues, isLogCurve ); + this->setSamplesFromXYErrorValues( timeSteps, curveValuesY, errValues, useLogarithmicScale ); } else { - this->setSamplesFromXYValues( timeSteps, curveValuesY, isLogCurve ); + this->setSamplesFromXYValues( timeSteps, curveValuesY, useLogarithmicScale ); } } else @@ -681,12 +681,14 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot ) resampledTimeSteps.insert( resampledTimeSteps.begin(), curveTimeStepsY.front() ); resampledValues.insert( resampledValues.begin(), resampledValues.front() ); - this->setSamplesFromTimeTAndYValues( resampledTimeSteps, resampledValues, isLogCurve ); + this->setSamplesFromTimeTAndYValues( resampledTimeSteps, + resampledValues, + useLogarithmicScale ); } } else { - this->setSamplesFromTimeTAndYValues( curveTimeStepsY, curveValuesY, isLogCurve ); + this->setSamplesFromTimeTAndYValues( curveTimeStepsY, curveValuesY, useLogarithmicScale ); } } } @@ -705,7 +707,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot ) } } - this->setSamplesFromXYValues( timeFromSimulationStart, curveValuesY, isLogCurve ); + this->setSamplesFromXYValues( timeFromSimulationStart, curveValuesY, useLogarithmicScale ); } } else @@ -716,7 +718,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot ) if ( shouldPopulateViewWithEmptyData ) { - this->setSamplesFromXYValues( std::vector(), std::vector(), isLogCurve ); + this->setSamplesFromXYValues( std::vector(), std::vector(), useLogarithmicScale ); } if ( updateParentPlot && hasParentPlot() ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 2816449962..09bd36d1dd 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1134,8 +1134,8 @@ void RimSummaryPlot::removeAllTimeAnnotations() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::zoomAll() { - setAutoScaleXEnabled( true ); - setAutoScaleYEnabled( true ); + setAutoScalePropertyValuesEnabled( true ); + setAutoScaleDepthValuesEnabled( true ); updateZoomInParentPlot(); } @@ -1828,8 +1828,8 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector RimSummaryPlot::fieldsToShowInToolbar() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::setAutoScaleXEnabled( bool enabled ) +void RimSummaryPlot::setAutoScalePropertyValuesEnabled( bool enabled ) { for ( auto ap : m_axisProperties ) { @@ -2258,7 +2258,7 @@ void RimSummaryPlot::setAutoScaleXEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::setAutoScaleYEnabled( bool enabled ) +void RimSummaryPlot::setAutoScaleDepthValuesEnabled( bool enabled ) { for ( auto ap : m_axisProperties ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 4778503e58..0f640ca81e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -161,8 +161,8 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping virtual RimSummaryPlotSourceStepping* sourceSteppingObjectForKeyEventHandling() const; virtual std::vector fieldsToShowInToolbar(); - void setAutoScaleXEnabled( bool enabled ) override; - void setAutoScaleYEnabled( bool enabled ) override; + void setAutoScalePropertyValuesEnabled( bool enabled ) override; + void setAutoScaleDepthValuesEnabled( bool enabled ) override; RiuPlotWidget* plotWidget() override; void zoomAll() override; void updateZoomInParentPlot() override; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp index 66cb1f11b0..7461dd2745 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp @@ -79,7 +79,7 @@ void Rim3dWellLogRftCurve::curveValuesAndMds( std::vector* values, std:: const RigWellLogCurveData* curveData = m_2dWellLogRftCurve->curveData(); // These values are for a simulation well - *values = curveData->xValues(); + *values = curveData->propertyValues(); *measuredDepthValues = curveData->depths( RiaDefines::DepthTypeEnum::MEASURED_DEPTH ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatisticsCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatisticsCurve.cpp index 27d3932da5..c35d643e78 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatisticsCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogStatisticsCurve.cpp @@ -150,7 +150,8 @@ void RimEnsembleWellLogStatisticsCurve::performDataExtraction( bool* isUsingPseu validDepths.insert( std::make_pair( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB, tvDepthValues ) ); } - this->setValuesAndDepths( values, validDepths, rkbDiff, depthUnit, false ); + bool useLogarithmicScale = false; + this->setPropertyValuesAndDepths( values, validDepths, rkbDiff, depthUnit, false, useLogarithmicScale ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp index 28b827251a..19da3c84d7 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp @@ -49,7 +49,8 @@ RimWellLogCurve::RimWellLogCurve() m_curveData = new RigWellLogCurveData; - m_curveDataXRange = std::make_pair( std::numeric_limits::infinity(), -std::numeric_limits::infinity() ); + m_curveDataPropertyValueRange = + std::make_pair( std::numeric_limits::infinity(), -std::numeric_limits::infinity() ); setDeletable( true ); } @@ -72,7 +73,7 @@ void RimWellLogCurve::setDepthUnit( RiaDefines::DepthUnitType depthUnit ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimWellLogCurve::xValueRangeInData( double* minimumValue, double* maximumValue ) const +bool RimWellLogCurve::propertyValueRangeInData( double* minimumValue, double* maximumValue ) const { CAF_ASSERT( minimumValue && maximumValue ); @@ -81,14 +82,14 @@ bool RimWellLogCurve::xValueRangeInData( double* minimumValue, double* maximumVa return false; } - if ( m_curveDataXRange.first == -std::numeric_limits::infinity() || - m_curveDataXRange.second == std::numeric_limits::infinity() ) + if ( m_curveDataPropertyValueRange.first == -std::numeric_limits::infinity() || + m_curveDataPropertyValueRange.second == std::numeric_limits::infinity() ) { return false; } - *minimumValue = m_curveDataXRange.first; - *maximumValue = m_curveDataXRange.second; + *minimumValue = m_curveDataPropertyValueRange.first; + *maximumValue = m_curveDataPropertyValueRange.second; return true; } @@ -96,7 +97,7 @@ bool RimWellLogCurve::xValueRangeInData( double* minimumValue, double* maximumVa //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimWellLogCurve::yValueRangeInData( double* minimumValue, double* maximumValue ) const +bool RimWellLogCurve::depthValueRangeInData( double* minimumValue, double* maximumValue ) const { CAF_ASSERT( minimumValue && maximumValue ); @@ -116,50 +117,54 @@ bool RimWellLogCurve::yValueRangeInData( double* minimumValue, double* maximumVa //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogCurve::setValuesAndDepths( const std::vector& xValues, - const std::vector& depths, - RiaDefines::DepthTypeEnum depthType, - double rkbDiff, - RiaDefines::DepthUnitType depthUnit, - bool isExtractionCurve, - const QString& xUnits ) +void RimWellLogCurve::setPropertyValuesAndDepths( const std::vector& propertyValues, + const std::vector& depths, + RiaDefines::DepthTypeEnum depthType, + double rkbDiff, + RiaDefines::DepthUnitType depthUnit, + bool isExtractionCurve, + bool useLogarithmicScale, + const QString& propertyUnit ) { - m_curveData->setValuesAndDepths( xValues, depths, depthType, rkbDiff, depthUnit, isExtractionCurve ); - m_curveData->setXUnits( xUnits ); - calculateCurveDataXRange(); + m_curveData->setValuesAndDepths( propertyValues, depths, depthType, rkbDiff, depthUnit, isExtractionCurve, useLogarithmicScale ); + m_curveData->setPropertyValueUnit( propertyUnit ); + calculateCurveDataPropertyValueRange(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogCurve::setValuesAndDepths( const std::vector& xValues, - const std::map>& depths, - double rkbDiff, - RiaDefines::DepthUnitType depthUnit, - bool isExtractionCurve, - const QString& xUnits ) +void RimWellLogCurve::setPropertyValuesAndDepths( const std::vector& propertyValues, + const std::map>& depths, + double rkbDiff, + RiaDefines::DepthUnitType depthUnit, + bool isExtractionCurve, + bool useLogarithmicScale, + + const QString& propertyUnit ) { - m_curveData->setValuesAndDepths( xValues, depths, rkbDiff, depthUnit, isExtractionCurve ); - m_curveData->setXUnits( xUnits ); - calculateCurveDataXRange(); + m_curveData->setValuesAndDepths( propertyValues, depths, rkbDiff, depthUnit, isExtractionCurve, useLogarithmicScale ); + m_curveData->setPropertyValueUnit( propertyUnit ); + calculateCurveDataPropertyValueRange(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogCurve::setValuesWithMdAndTVD( const std::vector& xValues, - const std::vector& measuredDepths, - const std::vector& tvdMSL, - double rkbDiff, - RiaDefines::DepthUnitType depthUnit, - bool isExtractionCurve, - const QString& xUnits ) +void RimWellLogCurve::setPropertyValuesWithMdAndTVD( const std::vector& propertyValues, + const std::vector& measuredDepths, + const std::vector& tvdMSL, + double rkbDiff, + RiaDefines::DepthUnitType depthUnit, + bool isExtractionCurve, + bool useLogarithmicScale, + const QString& propertyUnit ) { std::map> depths = { { RiaDefines::DepthTypeEnum::MEASURED_DEPTH, measuredDepths }, { RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, tvdMSL } }; - setValuesAndDepths( xValues, depths, rkbDiff, depthUnit, isExtractionCurve, xUnits ); + setPropertyValuesAndDepths( propertyValues, depths, rkbDiff, depthUnit, isExtractionCurve, useLogarithmicScale, propertyUnit ); } //-------------------------------------------------------------------------------------------------- @@ -214,15 +219,15 @@ QString RimWellLogCurve::wellLogCurveIconName() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogCurve::setOverrideCurveData( const std::vector& xValues, +void RimWellLogCurve::setOverrideCurveData( const std::vector& propertyValues, const std::vector& depthValues, const RiaCurveDataTools::CurveIntervals& curveIntervals ) { - auto minmax_it = std::minmax_element( xValues.begin(), xValues.end() ); - this->setOverrideCurveDataXRange( *( minmax_it.first ), *( minmax_it.second ) ); + auto minmax_it = std::minmax_element( propertyValues.begin(), propertyValues.end() ); + this->setOverrideCurveDataPropertyValueRange( *( minmax_it.first ), *( minmax_it.second ) ); if ( m_plotCurve ) { - m_plotCurve->setSamplesValues( xValues, depthValues ); + m_plotCurve->setSamplesValues( propertyValues, depthValues ); m_plotCurve->setLineSegmentStartStopIndices( curveIntervals ); } } @@ -247,7 +252,7 @@ void RimWellLogCurve::updateZoomInParentPlot() if ( wellLogTrack ) { - wellLogTrack->setAutoScaleXIfNecessary(); + wellLogTrack->setAutoScalePropertyValuesIfNecessary(); RimDepthTrackPlot* wellLogPlot; wellLogTrack->firstAncestorOrThisOfType( wellLogPlot ); @@ -299,24 +304,25 @@ void RimWellLogCurve::updateLegendsInPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogCurve::setOverrideCurveDataXRange( double minimumValue, double maximumValue ) +void RimWellLogCurve::setOverrideCurveDataPropertyValueRange( double minimumValue, double maximumValue ) { - m_curveDataXRange = std::make_pair( minimumValue, maximumValue ); + m_curveDataPropertyValueRange = std::make_pair( minimumValue, maximumValue ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogCurve::calculateCurveDataXRange() +void RimWellLogCurve::calculateCurveDataPropertyValueRange() { // Invalidate range first - m_curveDataXRange = std::make_pair( std::numeric_limits::infinity(), -std::numeric_limits::infinity() ); - for ( double xValue : m_curveData->xValues() ) + m_curveDataPropertyValueRange = + std::make_pair( std::numeric_limits::infinity(), -std::numeric_limits::infinity() ); + for ( double xValue : m_curveData->propertyValues() ) { if ( RiaCurveDataTools::isValidValue( xValue, false ) ) { - m_curveDataXRange.first = std::min( m_curveDataXRange.first, xValue ); - m_curveDataXRange.second = std::max( m_curveDataXRange.second, xValue ); + m_curveDataPropertyValueRange.first = std::min( m_curveDataPropertyValueRange.first, xValue ); + m_curveDataPropertyValueRange.second = std::max( m_curveDataPropertyValueRange.second, xValue ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h index 578a4641a3..e4398f3c80 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h @@ -42,29 +42,34 @@ class RimWellLogCurve : public RimStackablePlotCurve void setDepthUnit( RiaDefines::DepthUnitType depthUnit ); - bool xValueRangeInData( double* minimumValue, double* maximumValue ) const; - bool yValueRangeInData( double* minimumValue, double* maximumValue ) const; - - void setValuesAndDepths( const std::vector& xValues, - const std::vector& depths, - RiaDefines::DepthTypeEnum depthType, - double rkbDiff, - RiaDefines::DepthUnitType depthUnit, - bool isExtractionCurve, - const QString& xUnits = RiaWellLogUnitTools::noUnitString() ); - void setValuesWithMdAndTVD( const std::vector& xValues, - const std::vector& measuredDepths, - const std::vector& tvDepths, - double rkbDiff, - RiaDefines::DepthUnitType depthUnit, - bool isExtractionCurve, - const QString& xUnits = RiaWellLogUnitTools::noUnitString() ); - void setValuesAndDepths( const std::vector& xValues, - const std::map>& depths, - double rkbDiff, - RiaDefines::DepthUnitType depthUnit, - bool isExtractionCurve, - const QString& xUnits = RiaWellLogUnitTools::noUnitString() ); + bool propertyValueRangeInData( double* minimumValue, double* maximumValue ) const; + bool depthValueRangeInData( double* minimumValue, double* maximumValue ) const; + + void setPropertyValuesAndDepths( const std::vector& propertyValues, + const std::vector& depths, + RiaDefines::DepthTypeEnum depthType, + double rkbDiff, + RiaDefines::DepthUnitType depthUnit, + bool isExtractionCurve, + bool useLogarithmicScale, + const QString& propertyUnit = RiaWellLogUnitTools::noUnitString() ); + + void setPropertyValuesWithMdAndTVD( const std::vector& propertyValues, + const std::vector& measuredDepths, + const std::vector& tvDepths, + double rkbDiff, + RiaDefines::DepthUnitType depthUnit, + bool isExtractionCurve, + bool useLogarithmicScale, + const QString& propertyUnit = RiaWellLogUnitTools::noUnitString() ); + + void setPropertyValuesAndDepths( const std::vector& propertyValues, + const std::map>& depths, + double rkbDiff, + RiaDefines::DepthUnitType depthUnit, + bool isExtractionCurve, + bool useLogarithmicScale, + const QString& propertyUnit = RiaWellLogUnitTools::noUnitString() ); const RigWellLogCurveData* curveData() const; @@ -78,7 +83,7 @@ class RimWellLogCurve : public RimStackablePlotCurve static QString wellLogCurveIconName(); - void setOverrideCurveData( const std::vector& xValues, + void setOverrideCurveData( const std::vector& propertyValues, const std::vector& depthValues, const RiaCurveDataTools::CurveIntervals& curveIntervals ); @@ -87,11 +92,11 @@ class RimWellLogCurve : public RimStackablePlotCurve protected: void updateZoomInParentPlot() override; void updateLegendsInPlot() override; - void setOverrideCurveDataXRange( double minimumValue, double maximumValue ); - void calculateCurveDataXRange(); + void setOverrideCurveDataPropertyValueRange( double minimumValue, double maximumValue ); + void calculateCurveDataPropertyValueRange(); void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; private: cvf::ref m_curveData; - std::pair m_curveDataXRange; + std::pair m_curveDataPropertyValueRange; }; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 91fe5fdb6c..0fcd109ffd 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -357,24 +357,24 @@ void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot ) isUsingPseudoLength = false; } - bool isLogCurve = false; + bool useLogarithmicScale = false; RimWellLogTrack* track = nullptr; firstAncestorOfType( track ); if ( track ) { - isLogCurve = track->isLogarithmicScale(); + useLogarithmicScale = track->isLogarithmicScale(); } - std::vector xPlotValues = curveData()->xPlotValues(); - std::vector depthPlotValues = curveData()->depthPlotValues( depthType, displayUnit ); + std::vector xPlotValues = curveData()->propertyValuesByIntervals(); + std::vector depthPlotValues = curveData()->depthValuesByIntervals( depthType, displayUnit ); CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() ); if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL ) - m_plotCurve->setSamplesFromXValuesAndYValues( depthPlotValues, xPlotValues, isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( depthPlotValues, xPlotValues, useLogarithmicScale ); else - m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, useLogarithmicScale ); m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() ); @@ -539,25 +539,36 @@ void RimWellLogExtractionCurve::extractData( bool* isUsingPseudoLength, if ( !values.empty() && !measuredDepthValues.empty() ) { + bool useLogarithmicScale = false; + + RimWellLogTrack* track = nullptr; + firstAncestorOfType( track ); + if ( track ) + { + useLogarithmicScale = track->isLogarithmicScale(); + } + if ( tvDepthValues.empty() ) { - this->setValuesAndDepths( values, - measuredDepthValues, - RiaDefines::DepthTypeEnum::MEASURED_DEPTH, - 0.0, - depthUnit, - !performDataSmoothing, - xUnits ); + this->setPropertyValuesAndDepths( values, + measuredDepthValues, + RiaDefines::DepthTypeEnum::MEASURED_DEPTH, + 0.0, + depthUnit, + !performDataSmoothing, + useLogarithmicScale, + xUnits ); } else { - this->setValuesWithMdAndTVD( values, - measuredDepthValues, - tvDepthValues, - rkbDiff, - depthUnit, - !performDataSmoothing, - xUnits ); + this->setPropertyValuesWithMdAndTVD( values, + measuredDepthValues, + tvDepthValues, + rkbDiff, + depthUnit, + !performDataSmoothing, + useLogarithmicScale, + xUnits ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp index 751eba2695..80cc39f649 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp @@ -150,7 +150,15 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot ) validDepths.insert( std::make_pair( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB, tvdRkbValues ) ); } - this->setValuesAndDepths( values, validDepths, rkbDiff, wellLogFile->depthUnit(), false ); + bool useLogarithmicScale = false; + RimWellLogTrack* track = nullptr; + firstAncestorOfType( track ); + if ( track ) + { + useLogarithmicScale = track->isLogarithmicScale(); + } + + this->setPropertyValuesAndDepths( values, validDepths, rkbDiff, wellLogFile->depthUnit(), false, useLogarithmicScale ); QString errMsg; if ( wellLogPlot && !this->curveData()->availableDepthTypes().count( wellLogPlot->depthType() ) ) @@ -188,8 +196,8 @@ void RimWellLogFileCurve::onLoadDataAndUpdate( bool updateParentPlot ) depthType = wellLogPlot->depthType(); } - m_plotCurve->setSamplesValues( this->curveData()->xPlotValues(), - this->curveData()->depthPlotValues( depthType, displayUnit ) ); + m_plotCurve->setSamplesValues( this->curveData()->propertyValuesByIntervals(), + this->curveData()->depthValuesByIntervals( depthType, displayUnit ) ); m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); if ( updateParentPlot ) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index a51268f849..b295dbf6c4 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -451,12 +451,14 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) rkbDiff = wellPath->wellPathGeometry()->rkbDiff(); } - this->setValuesWithMdAndTVD( values, - measuredDepthVector, - tvDepthVector, - rkbDiff, - RiaDefines::fromEclipseUnit( unitSystem ), - false ); + bool useLogarithmicScale = false; + this->setPropertyValuesWithMdAndTVD( values, + measuredDepthVector, + tvDepthVector, + rkbDiff, + RiaDefines::fromEclipseUnit( unitSystem ), + false, + useLogarithmicScale ); RiaDefines::DepthUnitType displayUnit = RiaDefines::DepthUnitType::UNIT_METER; if ( wellLogPlot ) @@ -468,21 +470,22 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) { m_plotCurve->setPerPointLabels( perPointLabels ); - auto xValues = this->curveData()->xPlotValues(); - auto yValues = this->curveData()->depthPlotValues( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit ); - bool isLogCurve = false; + auto xValues = this->curveData()->propertyValuesByIntervals(); + auto yValues = + this->curveData()->depthValuesByIntervals( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit ); + bool useLogarithmicScale = false; if ( !errors.empty() ) { this->setSamplesFromXYErrorValues( xValues, yValues, errors, - isLogCurve, + useLogarithmicScale, RiaCurveDataTools::ErrorAxis::ERROR_ALONG_X_AXIS ); } else { - m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, useLogarithmicScale ); } RimWellLogTrack* wellLogTrack; @@ -513,22 +516,22 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) { m_plotCurve->setPerPointLabels( perPointLabels ); - auto xValues = this->curveData()->xPlotValues(); + auto xValues = this->curveData()->propertyValuesByIntervals(); auto yValues = - this->curveData()->depthPlotValues( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, displayUnit ); - bool isLogCurve = false; + this->curveData()->depthValuesByIntervals( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, displayUnit ); + bool useLogarithmicScale = false; if ( !errors.empty() ) { this->setSamplesFromXYErrorValues( xValues, yValues, errors, - isLogCurve, + useLogarithmicScale, RiaCurveDataTools::ErrorAxis::ERROR_ALONG_X_AXIS ); } else { - m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, isLogCurve ); + m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, useLogarithmicScale ); } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 1289dc303b..893b4bd838 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -119,9 +119,9 @@ void AppEnum::setUp() template <> void AppEnum::setUp() { - addItem( RimWellLogTrack::CASE, "CASE", "Case" ); - addItem( RimWellLogTrack::WELL_PICK_FILTER, "WELL_PICK_FILTER", "Well Picks for Well Path" ); - setDefault( RimWellLogTrack::CASE ); + addItem( RimWellLogTrack::FormationSource::CASE, "CASE", "Case" ); + addItem( RimWellLogTrack::FormationSource::WELL_PICK_FILTER, "WELL_PICK_FILTER", "Well Picks for Well Path" ); + setDefault( RimWellLogTrack::FormationSource::CASE ); } template <> @@ -170,8 +170,8 @@ void AppEnum::setUp() /// //-------------------------------------------------------------------------------------------------- RimWellLogTrack::RimWellLogTrack() - : m_availableXRangeMin( RI_LOGPLOTTRACK_MINX_DEFAULT ) - , m_availableXRangeMax( RI_LOGPLOTTRACK_MAXX_DEFAULT ) + : m_availablePropertyValueRangeMin( RI_LOGPLOTTRACK_MINX_DEFAULT ) + , m_availablePropertyValueRangeMax( RI_LOGPLOTTRACK_MAXX_DEFAULT ) , m_availableDepthRangeMin( RI_LOGPLOTTRACK_MINX_DEFAULT ) , m_availableDepthRangeMax( RI_LOGPLOTTRACK_MAXX_DEFAULT ) @@ -187,8 +187,8 @@ RimWellLogTrack::RimWellLogTrack() auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_curves ); reorderability->orderChanged.connect( this, &RimWellLogTrack::curveDataChanged ); - CAF_PDM_InitField( &m_visibleXRangeMin, "VisibleXRangeMin", RI_LOGPLOTTRACK_MINX_DEFAULT, "Min" ); - CAF_PDM_InitField( &m_visibleXRangeMax, "VisibleXRangeMax", RI_LOGPLOTTRACK_MAXX_DEFAULT, "Max" ); + CAF_PDM_InitField( &m_visiblePropertyValueRangeMin, "VisibleXRangeMin", RI_LOGPLOTTRACK_MINX_DEFAULT, "Min" ); + CAF_PDM_InitField( &m_visiblePropertyValueRangeMax, "VisibleXRangeMax", RI_LOGPLOTTRACK_MAXX_DEFAULT, "Max" ); CAF_PDM_InitField( &m_visibleDepthRangeMin, "VisibleYRangeMin", RI_LOGPLOTTRACK_MINX_DEFAULT, "Min" ); CAF_PDM_InitField( &m_visibleDepthRangeMax, "VisibleYRangeMax", RI_LOGPLOTTRACK_MAXX_DEFAULT, "Max" ); m_visibleDepthRangeMin.uiCapability()->setUiHidden( true ); @@ -196,12 +196,12 @@ RimWellLogTrack::RimWellLogTrack() m_visibleDepthRangeMax.uiCapability()->setUiHidden( true ); m_visibleDepthRangeMax.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_isAutoScaleXEnabled, "AutoScaleX", true, "Auto Scale" ); - m_isAutoScaleXEnabled.uiCapability()->setUiHidden( true ); + CAF_PDM_InitField( &m_isAutoScalePropertyValuesEnabled, "AutoScaleX", true, "Auto Scale" ); + m_isAutoScalePropertyValuesEnabled.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &m_isLogarithmicScaleEnabled, "LogarithmicScaleX", false, "Logarithmic Scale" ); - CAF_PDM_InitFieldNoDefault( &m_xAxisGridVisibility, "ShowXGridLines", "Show Grid Lines" ); + CAF_PDM_InitFieldNoDefault( &m_propertyValueAxisGridVisibility, "ShowXGridLines", "Show Grid Lines" ); CAF_PDM_InitField( &m_explicitTickIntervals, "ExplicitTickIntervals", false, "Manually Set Tick Intervals" ); CAF_PDM_InitField( &m_minAndMaxTicksOnly, "MinAndMaxTicksOnly", false, "Show Ticks at Min and Max" ); @@ -357,7 +357,7 @@ void RimWellLogTrack::detachAllPlotItems() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::calculateXZoomRange() +void RimWellLogTrack::calculatePropertyValueZoomRange() { updateStackedCurveData(); @@ -373,7 +373,7 @@ void RimWellLogTrack::calculateXZoomRange() if ( curve->isCurveVisible() ) { visibleCurves++; - if ( curve->xValueRangeInData( &minCurveValue, &maxCurveValue ) ) + if ( curve->propertyValueRangeInData( &minCurveValue, &maxCurveValue ) ) { if ( minCurveValue < minValue ) { @@ -399,14 +399,14 @@ void RimWellLogTrack::calculateXZoomRange() std::tie( minValue, maxValue ) = adjustXRange( minValue, maxValue, m_minorTickInterval() ); } - m_availableXRangeMin = minValue; - m_availableXRangeMax = maxValue; + m_availablePropertyValueRangeMin = minValue; + m_availablePropertyValueRangeMax = maxValue; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::calculateYZoomRange() +void RimWellLogTrack::calculateDepthZoomRange() { double minDepth = HUGE_VAL; double maxDepth = -HUGE_VAL; @@ -416,7 +416,7 @@ void RimWellLogTrack::calculateYZoomRange() double minCurveDepth = HUGE_VAL; double maxCurveDepth = -HUGE_VAL; - if ( curve->isCurveVisible() && curve->yValueRangeInData( &minCurveDepth, &maxCurveDepth ) ) + if ( curve->isCurveVisible() && curve->depthValueRangeInData( &minCurveDepth, &maxCurveDepth ) ) { if ( minCurveDepth < minDepth ) { @@ -458,28 +458,28 @@ void RimWellLogTrack::calculateYZoomRange() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::updateXZoom() +void RimWellLogTrack::updatePropertyValueZoom() { if ( !m_plotWidget ) return; - calculateXZoomRange(); + calculatePropertyValueZoomRange(); - if ( m_isAutoScaleXEnabled ) + if ( m_isAutoScalePropertyValuesEnabled ) { - m_visibleXRangeMin = m_availableXRangeMin; - m_visibleXRangeMax = m_availableXRangeMax; + m_visiblePropertyValueRangeMin = m_availablePropertyValueRangeMin; + m_visiblePropertyValueRangeMax = m_availablePropertyValueRangeMax; if ( !visibleStackedCurves().empty() && !m_isLogarithmicScaleEnabled ) { // Try to ensure we include the base line whether the values are negative or positive. - m_visibleXRangeMin = std::min( m_visibleXRangeMin(), 0.0 ); - m_visibleXRangeMax = std::max( m_visibleXRangeMax(), 0.0 ); + m_visiblePropertyValueRangeMin = std::min( m_visiblePropertyValueRangeMin(), 0.0 ); + m_visiblePropertyValueRangeMax = std::max( m_visiblePropertyValueRangeMax(), 0.0 ); } - computeAndSetXRangeMinForLogarithmicScale(); + computeAndSetPropertyValueRangeMinForLogarithmicScale(); updateEditors(); } - updateXAxisAndGridTickIntervals(); + updatePropertyValueAxisAndGridTickIntervals(); // Attribute range. Fixed range where well components are positioned [-1, 1]. // Set an extended range here to allow for some label space. @@ -501,7 +501,7 @@ void RimWellLogTrack::updateXZoom() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::updateYZoom() +void RimWellLogTrack::updateDepthZoom() { if ( !m_plotWidget ) return; @@ -549,32 +549,32 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); if ( !m_explicitTickIntervals() ) { - updateXAxisAndGridTickIntervals(); + updatePropertyValueAxisAndGridTickIntervals(); } } - else if ( changedField == &m_xAxisGridVisibility || changedField == &m_majorTickInterval || + else if ( changedField == &m_propertyValueAxisGridVisibility || changedField == &m_majorTickInterval || changedField == &m_minorTickInterval || changedField == &m_minAndMaxTicksOnly ) { - updateXAxisAndGridTickIntervals(); + updatePropertyValueAxisAndGridTickIntervals(); } - else if ( changedField == &m_visibleXRangeMin || changedField == &m_visibleXRangeMax ) + else if ( changedField == &m_visiblePropertyValueRangeMin || changedField == &m_visiblePropertyValueRangeMax ) { bool emptyRange = isEmptyVisibleXRange(); m_explicitTickIntervals.uiCapability()->setUiReadOnly( emptyRange ); - m_xAxisGridVisibility.uiCapability()->setUiReadOnly( emptyRange ); + m_propertyValueAxisGridVisibility.uiCapability()->setUiReadOnly( emptyRange ); - m_isAutoScaleXEnabled = false; + m_isAutoScalePropertyValuesEnabled = false; - updateXZoom(); + updatePropertyValueZoom(); m_plotWidget->scheduleReplot(); updateEditors(); } - else if ( changedField == &m_isAutoScaleXEnabled ) + else if ( changedField == &m_isAutoScalePropertyValuesEnabled ) { - if ( m_isAutoScaleXEnabled() ) + if ( m_isAutoScalePropertyValuesEnabled() ) { - updateXZoom(); + updatePropertyValueZoom(); m_plotWidget->scheduleReplot(); } } @@ -587,14 +587,14 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, } m_explicitTickIntervals.uiCapability()->setUiHidden( m_isLogarithmicScaleEnabled() ); - updateXZoom(); + updatePropertyValueZoom(); loadDataAndUpdate(); } else if ( changedField == &m_regionAnnotationType || changedField == &m_regionAnnotationDisplay || changedField == &m_formationSource || changedField == &m_colorShadingTransparency || changedField == &m_colorShadingLegend ) { - if ( changedField == &m_formationSource && m_formationSource == WELL_PICK_FILTER ) + if ( changedField == &m_formationSource && m_formationSource == FormationSource::WELL_PICK_FILTER ) { std::vector wellPaths; RimTools::wellPathWithFormations( &wellPaths ); @@ -749,15 +749,15 @@ void RimWellLogTrack::curveStackingChanged( const caf::SignalEmitter* emitter, b { updateStackedCurveData(); - m_isAutoScaleXEnabled = true; - updateXZoom(); + m_isAutoScalePropertyValuesEnabled = true; + updatePropertyValueZoom(); m_plotWidget->scheduleReplot(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::updateXAxisAndGridTickIntervals() +void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() { if ( !m_plotWidget ) return; @@ -788,16 +788,16 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() return std::ceil( value * factor ) / factor; }; - auto div = QwtScaleDiv( m_visibleXRangeMin(), m_visibleXRangeMax() ); + auto div = QwtScaleDiv( m_visiblePropertyValueRangeMin(), m_visiblePropertyValueRangeMax() ); QList majorTicks; - auto min = roundToDigits( m_visibleXRangeMin(), 2, false ); - auto max = roundToDigits( m_visibleXRangeMax(), 2, true ); + auto min = roundToDigits( m_visiblePropertyValueRangeMin(), 2, false ); + auto max = roundToDigits( m_visiblePropertyValueRangeMax(), 2, true ); if ( min == max ) { - min = roundToDigits( m_visibleXRangeMin(), 3, false ); - max = roundToDigits( m_visibleXRangeMax(), 3, true ); + min = roundToDigits( m_visiblePropertyValueRangeMin(), 3, false ); + max = roundToDigits( m_visiblePropertyValueRangeMax(), 3, true ); } majorTicks.push_back( min ); @@ -812,20 +812,20 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() m_plotWidget->setMajorAndMinorTickIntervals( getValueAxis(), m_majorTickInterval(), m_minorTickInterval(), - m_visibleXRangeMin(), - m_visibleXRangeMax() ); + m_visiblePropertyValueRangeMin(), + m_visiblePropertyValueRangeMax() ); } else { int majorTickIntervals = 5; int minorTickIntervals = 10; m_plotWidget->setAutoTickIntervalCounts( getValueAxis(), majorTickIntervals, minorTickIntervals ); - m_plotWidget->setAxisRange( getValueAxis(), m_visibleXRangeMin, m_visibleXRangeMax ); + m_plotWidget->setAxisRange( getValueAxis(), m_visiblePropertyValueRangeMin, m_visiblePropertyValueRangeMax ); } m_plotWidget->enableGridLines( getValueAxis(), - m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR, - m_xAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR ); + m_propertyValueAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR, + m_propertyValueAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR ); } RimDepthTrackPlot* wellLogPlot = nullptr; @@ -887,10 +887,10 @@ QString RimWellLogTrack::asciiDataForPlotExport() const if ( curveNames.size() == 1 ) { - curveDepths = curveData->depthPlotValues( depthType, depthUnit ); + curveDepths = curveData->depthValuesByIntervals( depthType, depthUnit ); } - std::vector xPlotValues = curveData->xPlotValues(); + std::vector xPlotValues = curveData->propertyValuesByIntervals(); if ( xPlotValues.empty() ) { curveNames.pop_back(); @@ -907,7 +907,7 @@ QString RimWellLogTrack::asciiDataForPlotExport() const foundNonMatchingDepths = true; } - std::vector depths = curveData->depthPlotValues( depthType, depthUnit ); + std::vector depths = curveData->depthValuesByIntervals( depthType, depthUnit ); curveMerger.addCurveData( depths, xPlotValues ); curvesPlotXValues.push_back( xPlotValues ); @@ -1011,10 +1011,10 @@ void RimWellLogTrack::updateZoomFromParentPlot() auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( getValueAxis() ); auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( getDepthAxis() ); - m_visibleXRangeMin = xIntervalMin; - m_visibleXRangeMax = xIntervalMax; - m_visibleDepthRangeMin = depthIntervalMin; - m_visibleDepthRangeMax = depthIntervalMax; + m_visiblePropertyValueRangeMin = xIntervalMin; + m_visiblePropertyValueRangeMax = xIntervalMax; + m_visibleDepthRangeMin = depthIntervalMin; + m_visibleDepthRangeMax = depthIntervalMax; } //-------------------------------------------------------------------------------------------------- @@ -1037,7 +1037,7 @@ void RimWellLogTrack::onAxisSelected( int axis, bool toggle ) //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::updateAxes() { - updateXZoom(); + updatePropertyValueZoom(); } //-------------------------------------------------------------------------------------------------- @@ -1172,11 +1172,11 @@ void RimWellLogTrack::deleteAllCurves() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::availableXAxisRange( double* minX, double* maxX ) +void RimWellLogTrack::availablePropertyValueRange( double* minX, double* maxX ) { - calculateXZoomRange(); - *minX = m_availableXRangeMin; - *maxX = m_availableXRangeMax; + calculatePropertyValueZoomRange(); + *minX = m_availablePropertyValueRangeMin; + *maxX = m_availablePropertyValueRangeMax; } //-------------------------------------------------------------------------------------------------- @@ -1184,7 +1184,7 @@ void RimWellLogTrack::availableXAxisRange( double* minX, double* maxX ) //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::availableDepthRange( double* minimumDepth, double* maximumDepth ) { - calculateYZoomRange(); + calculateDepthZoomRange(); *minimumDepth = m_availableDepthRangeMin; *maximumDepth = m_availableDepthRangeMax; } @@ -1192,11 +1192,11 @@ void RimWellLogTrack::availableDepthRange( double* minimumDepth, double* maximum //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::visibleXAxisRange( double* minX, double* maxX ) +void RimWellLogTrack::visiblePropertyValueRange( double* minX, double* maxX ) { CAF_ASSERT( minX && maxX ); - *minX = m_visibleXRangeMin; - *maxX = m_visibleXRangeMax; + *minX = m_visiblePropertyValueRangeMin; + *maxX = m_visiblePropertyValueRangeMax; } //-------------------------------------------------------------------------------------------------- @@ -1214,8 +1214,8 @@ void RimWellLogTrack::visibleDepthRange( double* minDepth, double* maxDepth ) //-------------------------------------------------------------------------------------------------- bool RimWellLogTrack::isEmptyVisibleXRange() const { - return std::abs( m_visibleXRangeMax() - m_visibleXRangeMin ) < - 1.0e-6 * std::max( 1.0, std::max( m_visibleXRangeMax(), m_visibleXRangeMin() ) ); + return std::abs( m_visiblePropertyValueRangeMax() - m_visiblePropertyValueRangeMin ) < + 1.0e-6 * std::max( 1.0, std::max( m_visiblePropertyValueRangeMax(), m_visiblePropertyValueRangeMin() ) ); } //-------------------------------------------------------------------------------------------------- @@ -1228,7 +1228,7 @@ void RimWellLogTrack::onLoadDataAndUpdate() if ( wellLogPlot && m_plotWidget ) { - m_plotWidget->setAxisTitleText( getValueAxis(), m_xAxisTitle ); + m_plotWidget->setAxisTitleText( getValueAxis(), m_propertyValueAxisTitle ); m_plotWidget->setAxisTitleText( getDepthAxis(), wellLogPlot->depthAxisTitle() ); } @@ -1259,16 +1259,16 @@ void RimWellLogTrack::onLoadDataAndUpdate() this->updateAxisScaleEngine(); this->updateRegionAnnotationsOnPlot(); - this->updateXZoom(); + this->updatePropertyValueZoom(); } - this->updateXAxisAndGridTickIntervals(); + this->updatePropertyValueAxisAndGridTickIntervals(); m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); bool emptyRange = isEmptyVisibleXRange(); m_explicitTickIntervals.uiCapability()->setUiReadOnly( emptyRange ); - m_xAxisGridVisibility.uiCapability()->setUiReadOnly( emptyRange ); + m_propertyValueAxisGridVisibility.uiCapability()->setUiReadOnly( emptyRange ); updateLegend(); } @@ -1327,15 +1327,15 @@ void RimWellLogTrack::setAndUpdateSimWellFormationNamesData( RimCase* rimCase, c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::setAutoScaleXEnabled( bool enabled ) +void RimWellLogTrack::setAutoScalePropertyValuesEnabled( bool enabled ) { - m_isAutoScaleXEnabled = enabled; + m_isAutoScalePropertyValuesEnabled = enabled; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::setAutoScaleYEnabled( bool enabled ) +void RimWellLogTrack::setAutoScaleDepthValuesEnabled( bool enabled ) { if ( enabled ) { @@ -1347,41 +1347,42 @@ void RimWellLogTrack::setAutoScaleYEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::setAutoScaleXIfNecessary() +void RimWellLogTrack::setAutoScalePropertyValuesIfNecessary() { // Avoid resetting if visible range has set to empty by user bool emptyRange = isEmptyVisibleXRange(); - if ( !m_isAutoScaleXEnabled && emptyRange ) return; + if ( !m_isAutoScalePropertyValuesEnabled && emptyRange ) return; const double eps = 1.0e-8; - calculateXZoomRange(); + calculatePropertyValueZoomRange(); - double maxRange = std::max( m_visibleXRangeMax - m_visibleXRangeMin, m_availableXRangeMax - m_availableXRangeMin ); + double maxRange = std::max( m_visiblePropertyValueRangeMax - m_visiblePropertyValueRangeMin, + m_availablePropertyValueRangeMax - m_availablePropertyValueRangeMin ); - double maxLow = std::max( m_visibleXRangeMin(), m_availableXRangeMin ); - double minHigh = std::min( m_visibleXRangeMax(), m_availableXRangeMax ); + double maxLow = std::max( m_visiblePropertyValueRangeMin(), m_availablePropertyValueRangeMin ); + double minHigh = std::min( m_visiblePropertyValueRangeMax(), m_availablePropertyValueRangeMax ); double overlap = minHigh - maxLow; if ( maxRange < eps || overlap < eps * maxRange ) { - setAutoScaleXEnabled( true ); + setAutoScalePropertyValuesEnabled( true ); } - updateXZoom(); + updatePropertyValueZoom(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::setXAxisTitle( const QString& text ) +void RimWellLogTrack::setPropertyValueAxisTitle( const QString& text ) { - m_xAxisTitle = text; + m_propertyValueAxisTitle = text; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimWellLogTrack::yAxisTitle() const +QString RimWellLogTrack::depthAxisTitle() const { RimDepthTrackPlot* parent; this->firstAncestorOrThisOfType( parent ); @@ -1581,17 +1582,17 @@ void RimWellLogTrack::updateEditors() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::setVisibleXRange( double minValue, double maxValue ) +void RimWellLogTrack::setVisiblePropertyValueRange( double minValue, double maxValue ) { - this->setAutoScaleXEnabled( false ); - m_visibleXRangeMin = minValue; - m_visibleXRangeMax = maxValue; + this->setAutoScalePropertyValuesEnabled( false ); + m_visiblePropertyValueRangeMin = minValue; + m_visiblePropertyValueRangeMax = maxValue; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::setVisibleYRange( double minValue, double maxValue ) +void RimWellLogTrack::setVisibleDepthRange( double minValue, double maxValue ) { m_visibleDepthRangeMin = minValue; m_visibleDepthRangeMax = maxValue; @@ -1602,8 +1603,8 @@ void RimWellLogTrack::setVisibleYRange( double minValue, double maxValue ) //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::updateZoomInParentPlot() { - updateXZoom(); - updateYZoom(); + updatePropertyValueZoom(); + updateDepthZoom(); m_plotWidget->scheduleReplot(); } @@ -1628,9 +1629,9 @@ void RimWellLogTrack::setMinAndMaxTicksOnly( bool enable ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines ) +void RimWellLogTrack::setPropertyValueAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines ) { - m_xAxisGridVisibility = gridLines; + m_propertyValueAxisGridVisibility = gridLines; } //-------------------------------------------------------------------------------------------------- @@ -1799,8 +1800,8 @@ QImage RimWellLogTrack::snapshotWindowContent() //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::zoomAll() { - setAutoScaleXEnabled( true ); - setAutoScaleYEnabled( true ); + setAutoScalePropertyValuesEnabled( true ); + setAutoScaleDepthValuesEnabled( true ); updateZoomInParentPlot(); } @@ -1852,10 +1853,10 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering } else { - m_formationSource = CASE; + m_formationSource = FormationSource::CASE; } - if ( m_formationSource() == CASE ) + if ( m_formationSource() == FormationSource::CASE ) { annotationGroup->add( &m_formationCase ); @@ -1879,7 +1880,7 @@ void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering m_formationBranchIndex ); } } - else if ( m_formationSource() == WELL_PICK_FILTER ) + else if ( m_formationSource() == FormationSource::WELL_PICK_FILTER ) { annotationGroup->add( &m_formationWellPathForSourceWellPath ); if ( m_formationWellPathForSourceWellPath() ) @@ -1922,9 +1923,9 @@ void RimWellLogTrack::initAfterRead() m_resultDefinition->setEclipseCase( dynamic_cast( eclipseCase ) ); } - if ( m_xAxisGridVisibility() == RimWellLogPlot::AXIS_GRID_MINOR ) + if ( m_propertyValueAxisGridVisibility() == RimWellLogPlot::AXIS_GRID_MINOR ) { - m_xAxisGridVisibility = RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR; + m_propertyValueAxisGridVisibility = RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR; } for ( auto curve : m_curves ) @@ -2115,9 +2116,9 @@ void RimWellLogTrack::connectCurveSignals( RimWellLogCurve* curve ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::computeAndSetXRangeMinForLogarithmicScale() +void RimWellLogTrack::computeAndSetPropertyValueRangeMinForLogarithmicScale() { - if ( m_isAutoScaleXEnabled && m_isLogarithmicScaleEnabled ) + if ( m_isAutoScalePropertyValuesEnabled && m_isLogarithmicScaleEnabled ) { double pos = HUGE_VAL; double neg = -HUGE_VAL; @@ -2126,13 +2127,15 @@ void RimWellLogTrack::computeAndSetXRangeMinForLogarithmicScale() { if ( m_curves[cIdx]->isCurveVisible() && m_curves[cIdx]->curveData() ) { - RigStatisticsCalculator::posNegClosestToZero( m_curves[cIdx]->curveData()->xPlotValues(), pos, neg ); + RigStatisticsCalculator::posNegClosestToZero( m_curves[cIdx]->curveData()->propertyValuesByIntervals(), + pos, + neg ); } } if ( pos != HUGE_VAL ) { - m_visibleXRangeMin = pos; + m_visiblePropertyValueRangeMin = pos; } } } @@ -2145,7 +2148,7 @@ void RimWellLogTrack::setLogarithmicScale( bool enable ) m_isLogarithmicScaleEnabled = enable; updateAxisScaleEngine(); - computeAndSetXRangeMinForLogarithmicScale(); + computeAndSetPropertyValueRangeMinForLogarithmicScale(); } //-------------------------------------------------------------------------------------------------- @@ -2217,11 +2220,11 @@ void RimWellLogTrack::uiOrderingForRftPltFormations( caf::PdmUiOrdering& uiOrder formationGroup->add( &m_regionAnnotationType ); formationGroup->add( &m_regionAnnotationDisplay ); formationGroup->add( &m_formationSource ); - if ( m_formationSource == CASE ) + if ( m_formationSource == FormationSource::CASE ) { formationGroup->add( &m_formationCase ); } - if ( m_formationSource == WELL_PICK_FILTER ) + if ( m_formationSource == FormationSource::WELL_PICK_FILTER ) { if ( m_formationWellPathForSourceWellPath() && m_formationWellPathForSourceWellPath()->hasFormations() ) { @@ -2238,9 +2241,9 @@ void RimWellLogTrack::uiOrderingForXAxisSettings( caf::PdmUiOrdering& uiOrdering { caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "X Axis Settings" ); gridGroup->add( &m_isLogarithmicScaleEnabled ); - gridGroup->add( &m_visibleXRangeMin ); - gridGroup->add( &m_visibleXRangeMax ); - gridGroup->add( &m_xAxisGridVisibility ); + gridGroup->add( &m_visiblePropertyValueRangeMin ); + gridGroup->add( &m_visiblePropertyValueRangeMax ); + gridGroup->add( &m_propertyValueAxisGridVisibility ); gridGroup->add( &m_minAndMaxTicksOnly ); // TODO Revisit if these settings are required @@ -2490,7 +2493,7 @@ void RimWellLogTrack::updateStackedCurveData() for ( auto curve : stackedCurvesInGroup ) { auto interpolatedCurveValues = curve->curveData()->calculateResampledCurveData( depthType, allDepthValues ); - auto xValues = interpolatedCurveValues->xValues(); + auto xValues = interpolatedCurveValues->propertyValues(); for ( size_t i = 0; i < xValues.size(); ++i ) { if ( xValues[i] != HUGE_VAL ) @@ -2500,8 +2503,15 @@ void RimWellLogTrack::updateStackedCurveData() } RigWellLogCurveData tempCurveData; - tempCurveData.setValuesAndDepths( allStackedValues, allDepthValues, depthType, 0.0, displayUnit, false ); - auto plotDepthValues = tempCurveData.depthPlotValues( depthType, displayUnit ); + tempCurveData.setValuesAndDepths( allStackedValues, + allDepthValues, + depthType, + 0.0, + displayUnit, + false, + m_isLogarithmicScaleEnabled ); + + auto plotDepthValues = tempCurveData.depthValuesByIntervals( depthType, displayUnit ); auto polyLineStartStopIndices = tempCurveData.polylineStartStopIndices(); curve->setOverrideCurveData( allStackedValues, plotDepthValues, polyLineStartStopIndices ); @@ -2583,7 +2593,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot() RiaDefines::DepthUnitType fromDepthUnit = plot->caseDepthUnit(); RiaDefines::DepthUnitType toDepthUnit = plot->depthUnit(); - if ( m_formationSource() == WELL_PICK_FILTER ) + if ( m_formationSource() == FormationSource::WELL_PICK_FILTER ) { if ( m_formationWellPathForSourceWellPath == nullptr ) return; @@ -2676,7 +2686,8 @@ void RimWellLogTrack::updateFormationNamesOnPlot() if ( geoMechWellLogExtractor ) { // Attach water and rock base formations - const std::pair xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() ); + const std::pair xRange = + std::make_pair( m_visiblePropertyValueRangeMin(), m_visiblePropertyValueRangeMax() ); const caf::ColorTable waterAndRockColors = RiaColorTables::waterAndRockPaletteColors(); const std::vector> waterAndRockIntervals = @@ -2697,7 +2708,7 @@ void RimWellLogTrack::updateFormationNamesOnPlot() { Qt::SolidPattern, Qt::Dense6Pattern } ); } - if ( m_formationSource == CASE && m_plotWidget ) + if ( m_formationSource == FormationSource::CASE && m_plotWidget ) { if ( ( m_formationSimWellName == QString( "None" ) && m_formationWellPathForSourceCase == nullptr ) || m_formationCase == nullptr ) @@ -2724,7 +2735,8 @@ void RimWellLogTrack::updateFormationNamesOnPlot() &formationNamesToPlot, &yValues ); - const std::pair xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() ); + const std::pair xRange = + std::make_pair( m_visiblePropertyValueRangeMin(), m_visiblePropertyValueRangeMax() ); std::vector> convertedYValues = RiaWellLogUnitTools::convertDepths( yValues, fromDepthUnit, toDepthUnit ); @@ -2785,9 +2797,10 @@ void RimWellLogTrack::updateResultPropertyNamesOnPlot() CurveSamplingPointData curveData = RimWellLogTrack::curveSamplingPointData( eclWellLogExtractor, resultAccessor.p() ); // Attach water and rock base formations - const std::pair xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() ); + const std::pair xRange = + std::make_pair( m_visiblePropertyValueRangeMin(), m_visiblePropertyValueRangeMax() ); - if ( m_formationSource == CASE ) + if ( m_formationSource == FormationSource::CASE ) { if ( ( m_formationSimWellName == QString( "None" ) && m_formationWellPathForSourceCase == nullptr ) || m_formationCase == nullptr ) @@ -2896,7 +2909,8 @@ void RimWellLogTrack::updateCurveDataRegionsOnPlot() RiaExtractionTools::findOrCreateWellLogExtractor( wellPath, dynamic_cast( geoMechCase ) ); if ( !geoMechWellLogExtractor ) return; - std::pair xRange = std::make_pair( m_visibleXRangeMin(), m_visibleXRangeMax() ); + std::pair xRange = + std::make_pair( m_visiblePropertyValueRangeMin(), m_visiblePropertyValueRangeMax() ); CurveSamplingPointData curveData; curveData.md = geoMechWellLogExtractor->cellIntersectionMDs(); @@ -3098,7 +3112,7 @@ void RimWellLogTrack::updateWellPathAttributesOnPlot() attributePlotObject->setParentPlotNoReplot( m_plotWidget->qwtPlot() ); } } - updateXZoom(); + updatePropertyValueZoom(); } //-------------------------------------------------------------------------------------------------- @@ -3127,7 +3141,7 @@ void RimWellLogTrack::doUpdateLayout() void RimWellLogTrack::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector& referringObjects ) { - setAutoScaleXEnabled( true ); + setAutoScalePropertyValuesEnabled( true ); updateZoomInParentPlot(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); mainPlotWindow->updateWellLogPlotToolBar(); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index 125b313736..a15aaf3ff8 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -111,8 +111,8 @@ class RimWellLogTrack : public RimPlot size_t curveIndex( RimWellLogCurve* curve ); size_t curveCount() { return m_curves.size(); } - void setXAxisTitle( const QString& text ); - QString yAxisTitle() const; + void setPropertyValueAxisTitle( const QString& text ); + QString depthAxisTitle() const; void setFormationWellPath( RimWellPath* wellPath ); RimWellPath* formationWellPath() const; @@ -139,18 +139,18 @@ class RimWellLogTrack : public RimPlot bool useBranchDetection ); void setAndUpdateSimWellFormationNamesData( RimCase* rimCase, const QString& simWellName ); - void setAutoScaleXEnabled( bool enabled ) override; - void setAutoScaleYEnabled( bool enabled ) override; - void setAutoScaleXIfNecessary(); + void setAutoScalePropertyValuesEnabled( bool enabled ) override; + void setAutoScaleDepthValuesEnabled( bool enabled ) override; + void setAutoScalePropertyValuesIfNecessary(); - void availableXAxisRange( double* minX, double* maxX ); + void availablePropertyValueRange( double* minX, double* maxX ); void availableDepthRange( double* minimumDepth, double* maximumDepth ); - void visibleXAxisRange( double* minX, double* maxX ); + void visiblePropertyValueRange( double* minX, double* maxX ); void visibleDepthRange( double* minimumDepth, double* maximumDepth ); - void setVisibleXRange( double minValue, double maxValue ); - void setVisibleYRange( double minValue, double maxValue ); + void setVisiblePropertyValueRange( double minValue, double maxValue ); + void setVisibleDepthRange( double minValue, double maxValue ); void updateZoomInParentPlot() override; void updateZoomFromParentPlot() override; @@ -161,7 +161,7 @@ class RimWellLogTrack : public RimPlot void setTickIntervals( double majorTickInterval, double minorTickInterval ); void setMinAndMaxTicksOnly( bool enable ); - void setXAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines ); + void setPropertyValueAxisGridVisibility( RimWellLogPlot::AxisGridVisibility gridLines ); void setAnnotationType( RiuPlotAnnotationTool::RegionAnnotationType annotationType ); void setAnnotationDisplay( RiuPlotAnnotationTool::RegionDisplay annotationDisplay ); @@ -201,7 +201,7 @@ class RimWellLogTrack : public RimPlot void uiOrderingForXAxisSettings( caf::PdmUiOrdering& uiOrdering ); void setFormationsForCaseWithSimWellOnly( bool caseWithSimWellOnly ); - void updateXAxisAndGridTickIntervals(); + void updatePropertyValueAxisAndGridTickIntervals(); void updateLegend() override; @@ -244,11 +244,11 @@ class RimWellLogTrack : public RimPlot void cleanupBeforeClose(); void detachAllPlotItems(); - void calculateXZoomRange(); - void calculateYZoomRange(); + void calculatePropertyValueZoomRange(); + void calculateDepthZoomRange(); - void updateXZoom(); - void updateYZoom(); + void updatePropertyValueZoom(); + void updateDepthZoom(); RiuPlotAxis getDepthAxis() const; RiuPlotAxis getValueAxis() const; @@ -272,7 +272,7 @@ class RimWellLogTrack : public RimPlot caf::PdmFieldHandle* userDescriptionField() override; - void computeAndSetXRangeMinForLogarithmicScale(); + void computeAndSetPropertyValueRangeMinForLogarithmicScale(); static void simWellOptionItems( QList* options, RimCase* eclCase ); @@ -308,19 +308,19 @@ class RimWellLogTrack : public RimPlot bool isEmptyVisibleXRange() const; private: - QString m_xAxisTitle; + QString m_propertyValueAxisTitle; caf::PdmField m_description; caf::PdmChildArrayField m_curves; - caf::PdmField m_visibleXRangeMin; - caf::PdmField m_visibleXRangeMax; + caf::PdmField m_visiblePropertyValueRangeMin; + caf::PdmField m_visiblePropertyValueRangeMax; caf::PdmField m_visibleDepthRangeMin; caf::PdmField m_visibleDepthRangeMax; - caf::PdmField m_isAutoScaleXEnabled; + caf::PdmField m_isAutoScalePropertyValuesEnabled; caf::PdmField m_isLogarithmicScaleEnabled; - caf::PdmField m_xAxisGridVisibility; + caf::PdmField m_propertyValueAxisGridVisibility; caf::PdmField m_explicitTickIntervals; caf::PdmField m_minAndMaxTicksOnly; @@ -365,8 +365,8 @@ class RimWellLogTrack : public RimPlot QPointer m_plotWidget; std::unique_ptr m_annotationTool; - double m_availableXRangeMin; - double m_availableXRangeMax; + double m_availablePropertyValueRangeMin; + double m_availablePropertyValueRangeMax; double m_availableDepthRangeMin; double m_availableDepthRangeMax; }; diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp index ac44380a75..84741e2120 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp @@ -89,7 +89,7 @@ void RimWellMeasurementCollection::deleteAllEmptyCurves() for ( auto curve : measurementCurves ) { - if ( curve->curveData()->xValues().empty() ) + if ( curve->curveData()->propertyValues().empty() ) { RimWellLogTrack* track = nullptr; curve->firstAncestorOrThisOfTypeAsserted( track ); diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp index b7781a5371..20107e572c 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp @@ -116,21 +116,25 @@ void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot ) -rigWellPath->interpolatedPointAlongWellPath( measuredDepthValue ).z() ); } - this->setValuesWithMdAndTVD( values, - measuredDepthValues, - trueVerticalDepthValues, - m_wellPath->wellPathGeometry()->rkbDiff(), - RiaDefines::DepthUnitType::UNIT_METER, - false ); + bool useLogarithmicScale = false; + this->setPropertyValuesWithMdAndTVD( values, + measuredDepthValues, + trueVerticalDepthValues, + m_wellPath->wellPathGeometry()->rkbDiff(), + RiaDefines::DepthUnitType::UNIT_METER, + false, + useLogarithmicScale ); } else { - this->setValuesAndDepths( values, - measuredDepthValues, - RiaDefines::DepthTypeEnum::MEASURED_DEPTH, - 0.0, - RiaDefines::DepthUnitType::UNIT_METER, - false ); + bool useLogarithmicScale = false; + this->setPropertyValuesAndDepths( values, + measuredDepthValues, + RiaDefines::DepthTypeEnum::MEASURED_DEPTH, + 0.0, + RiaDefines::DepthUnitType::UNIT_METER, + false, + useLogarithmicScale ); } } @@ -156,10 +160,10 @@ void RimWellMeasurementCurve::onLoadDataAndUpdate( bool updateParentPlot ) depthType = wellLogPlot->depthType(); } - bool isLogCurve = false; - m_plotCurve->setSamplesFromXValuesAndYValues( this->curveData()->xPlotValues(), - this->curveData()->depthPlotValues( depthType, displayUnit ), - isLogCurve ); + bool useLogarithmicScale = false; + m_plotCurve->setSamplesFromXValuesAndYValues( this->curveData()->propertyValuesByIntervals(), + this->curveData()->depthValuesByIntervals( depthType, displayUnit ), + useLogarithmicScale ); m_plotCurve->setLineSegmentStartStopIndices( this->curveData()->polylineStartStopIndices() ); } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlot.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlot.cpp index 9f3176f494..f791049b21 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlot.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlot.cpp @@ -74,9 +74,9 @@ RimWellLogTrack* RimcWellLogPlot_newWellLogTrack::createWellLogTrack( RimWellLog plotTrack->setLegendsVisible( true ); plotTrack->setPlotTitleVisible( true ); plotTrack->setShowWindow( true ); - plotTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR ); + plotTrack->setPropertyValueAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR ); plotTrack->setShowRegionLabels( true ); - plotTrack->setAutoScaleXEnabled( true ); + plotTrack->setAutoScalePropertyValuesEnabled( true ); plotTrack->updateConnectedEditors(); wellLogPlot->setShowWindow( true ); wellLogPlot->updateConnectedEditors(); diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogTrack.cpp index 61e2d26a81..49fba32210 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogTrack.cpp @@ -100,9 +100,9 @@ RimWellLogExtractionCurve* curve->updateConnectedEditors(); - wellLogTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR ); + wellLogTrack->setPropertyValueAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR ); wellLogTrack->setShowRegionLabels( true ); - wellLogTrack->setAutoScaleXEnabled( true ); + wellLogTrack->setAutoScalePropertyValuesEnabled( true ); wellLogTrack->updateConnectedEditors(); wellLogTrack->setShowWindow( true ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp b/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp index a761724fc5..ef6f64a1c9 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigLasFileExporter.cpp @@ -60,9 +60,9 @@ class SingleChannelData { CVF_ASSERT( lasFile ); - if ( !m_curveData->xValues().empty() ) + if ( !m_curveData->propertyValues().empty() ) { - std::vector wellLogValues = m_curveData->xValues( QString::fromStdString( m_unit ) ); + std::vector wellLogValues = m_curveData->propertyValues( QString::fromStdString( m_unit ) ); for ( size_t vIdx = 0; vIdx < wellLogValues.size(); vIdx++ ) { double value = wellLogValues[vIdx]; @@ -119,7 +119,7 @@ class SingleLasFileMetaData { m_logCurveData.push_back( SingleChannelData( channelName, unit, comment, curveData ) ); - for ( double xValue : curveData->xValues() ) + for ( double xValue : curveData->propertyValues() ) { if ( xValue < m_minimumCurveValue ) { @@ -536,7 +536,7 @@ void RigLasFileExporter::appendLasFileDescriptions( const std::vectorcurveData(); } - QString units = curve->curveData()->xUnits(); + QString units = curve->curveData()->propertyValueUnit(); if ( convertCurveUnits || units == RiaWellLogUnitTools::barX100UnitString() ) { diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.cpp index f4b929ce8b..aa30bbc07b 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.cpp @@ -31,11 +31,13 @@ /// //-------------------------------------------------------------------------------------------------- RigWellLogCurveData::RigWellLogCurveData() + : m_isExtractionCurve( false ) + , m_rkbDiff( 0.0 ) + , m_useLogarithmicScale( false ) + , m_depthUnit( RiaDefines::DepthUnitType::UNIT_METER ) + , m_propertyValueUnitString( RiaWellLogUnitTools::noUnitString() ) + { - m_isExtractionCurve = false; - m_rkbDiff = 0.0; - m_depthUnit = RiaDefines::DepthUnitType::UNIT_METER; - m_xUnitString = RiaWellLogUnitTools::noUnitString(); } //-------------------------------------------------------------------------------------------------- @@ -61,14 +63,16 @@ void RigWellLogCurveData::setValuesAndDepths( const std::vector& xValues RiaDefines::DepthTypeEnum depthType, double rkbDiff, RiaDefines::DepthUnitType depthUnit, - bool isExtractionCurve ) + bool isExtractionCurve, + bool useLogarithmicScale ) { CVF_ASSERT( xValues.size() == depths.size() ); - m_xValues = xValues; - m_depths[depthType] = depths; - m_depthUnit = depthUnit; - m_rkbDiff = rkbDiff; + m_propertyValues = xValues; + m_depths[depthType] = depths; + m_depthUnit = depthUnit; + m_rkbDiff = rkbDiff; + m_useLogarithmicScale = useLogarithmicScale; // Disable depth value filtering is intended to be used for // extraction curve data @@ -84,17 +88,19 @@ void RigWellLogCurveData::setValuesAndDepths( const std::vector& const std::map>& depths, double rkbDiff, RiaDefines::DepthUnitType depthUnit, - bool isExtractionCurve ) + bool isExtractionCurve, + bool useLogarithmicScale ) { for ( auto it = depths.begin(); it != depths.end(); ++it ) { CVF_ASSERT( xValues.size() == it->second.size() ); } - m_xValues = xValues; - m_depths = depths; - m_depthUnit = depthUnit; - m_rkbDiff = rkbDiff; + m_propertyValues = xValues; + m_depths = depths; + m_depthUnit = depthUnit; + m_rkbDiff = rkbDiff; + m_useLogarithmicScale = useLogarithmicScale; // Disable depth value filtering is intended to be used for // extraction curve data @@ -106,43 +112,43 @@ void RigWellLogCurveData::setValuesAndDepths( const std::vector& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigWellLogCurveData::setXUnits( const QString& xUnitString ) +void RigWellLogCurveData::setPropertyValueUnit( const QString& propertyValueUnitString ) { - m_xUnitString = xUnitString; + m_propertyValueUnitString = propertyValueUnitString; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigWellLogCurveData::xValues() const +std::vector RigWellLogCurveData::propertyValues() const { - return m_xValues; + return m_propertyValues; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigWellLogCurveData::xValues( const QString& units ) const +std::vector RigWellLogCurveData::propertyValues( const QString& units ) const { std::vector convertedValues; - if ( units != m_xUnitString && + if ( units != m_propertyValueUnitString && RiaWellLogUnitTools::convertValues( depths( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB ), - m_xValues, + m_propertyValues, &convertedValues, - m_xUnitString, + m_propertyValueUnitString, units ) ) { return convertedValues; } - return m_xValues; + return m_propertyValues; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RigWellLogCurveData::xUnits() const +QString RigWellLogCurveData::propertyValueUnit() const { - return m_xUnitString; + return m_propertyValueUnitString; } //-------------------------------------------------------------------------------------------------- @@ -212,10 +218,10 @@ std::set RigWellLogCurveData::availableDepthTypes() c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigWellLogCurveData::xPlotValues() const +std::vector RigWellLogCurveData::propertyValuesByIntervals() const { std::vector filteredValues; - RiaCurveDataTools::getValuesByIntervals( m_xValues, m_intervalsOfContinousValidValues, &filteredValues ); + RiaCurveDataTools::getValuesByIntervals( m_propertyValues, m_intervalsOfContinousValidValues, &filteredValues ); return filteredValues; } @@ -223,8 +229,8 @@ std::vector RigWellLogCurveData::xPlotValues() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RigWellLogCurveData::depthPlotValues( RiaDefines::DepthTypeEnum depthType, - RiaDefines::DepthUnitType destinationDepthUnit ) const +std::vector RigWellLogCurveData::depthValuesByIntervals( RiaDefines::DepthTypeEnum depthType, + RiaDefines::DepthUnitType destinationDepthUnit ) const { std::vector filteredValues; @@ -279,8 +285,8 @@ cvf::ref RigWellLogCurveData::calculateResampledCurveData( { double segmentStartMd = mdIt->second[segmentStartIdx]; double segmentEndMd = mdIt->second[segmentStartIdx + 1]; - double segmentStartX = m_xValues[segmentStartIdx]; - double segmentEndX = m_xValues[segmentStartIdx + 1]; + double segmentStartX = m_propertyValues[segmentStartIdx]; + double segmentEndX = m_propertyValues[segmentStartIdx + 1]; double segmentStartTvd = 0.0; double segmentEndTvd = 0.0; @@ -318,7 +324,7 @@ cvf::ref RigWellLogCurveData::calculateResampledCurveData( std::map> resampledDepths = { { RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, tvDepths }, { RiaDefines::DepthTypeEnum::MEASURED_DEPTH, measuredDepths } }; - reSampledData->setValuesAndDepths( xValues, resampledDepths, m_rkbDiff, m_depthUnit, true ); + reSampledData->setValuesAndDepths( xValues, resampledDepths, m_rkbDiff, m_depthUnit, true, m_useLogarithmicScale ); } else { @@ -327,7 +333,8 @@ cvf::ref RigWellLogCurveData::calculateResampledCurveData( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, 0.0, m_depthUnit, - m_isExtractionCurve ); + m_isExtractionCurve, + m_useLogarithmicScale ); } return reSampledData; @@ -346,8 +353,8 @@ void RigWellLogCurveData::interpolateSegment( RiaDefines::DepthTypeEnum resampli double depth0 = depthIt->second[firstIndex]; double depth1 = depthIt->second[secondIndex]; - double x0 = m_xValues[firstIndex]; - double x1 = m_xValues[secondIndex]; + double x0 = m_propertyValues[firstIndex]; + double x1 = m_propertyValues[secondIndex]; double slope = 0.0; if ( std::fabs( depth1 - depth0 ) > eps ) { @@ -412,7 +419,7 @@ cvf::ref RigWellLogCurveData::calculateResampledCurveData( if ( std::fabs( depthIt->second[segmentStartIdx] - depth ) < eps ) // already have this depth point, // reuse it { - xValues.push_back( m_xValues[segmentStartIdx] ); + xValues.push_back( m_propertyValues[segmentStartIdx] ); // Copy all depth types for this segment for ( auto depthTypeValuesPair : m_depths ) { @@ -458,7 +465,7 @@ cvf::ref RigWellLogCurveData::calculateResampledCurveData( CAF_ASSERT( foundPoint ); } - reSampledData->setValuesAndDepths( xValues, resampledDepths, m_rkbDiff, m_depthUnit, true ); + reSampledData->setValuesAndDepths( xValues, resampledDepths, m_rkbDiff, m_depthUnit, true, m_useLogarithmicScale ); return reSampledData; } @@ -468,7 +475,7 @@ cvf::ref RigWellLogCurveData::calculateResampledCurveData( void RigWellLogCurveData::calculateIntervalsOfContinousValidValues() { std::vector> intervalsOfValidValues = - RiaCurveDataTools::calculateIntervalsOfValidValues( m_xValues, false ); + RiaCurveDataTools::calculateIntervalsOfValidValues( m_propertyValues, m_useLogarithmicScale ); m_intervalsOfContinousValidValues.clear(); @@ -557,7 +564,7 @@ bool RigWellLogCurveData::calculateDepthRange( RiaDefines::DepthTypeEnum depthTy double minValue = HUGE_VAL; double maxValue = -HUGE_VAL; - std::vector depthValues = depthPlotValues( depthType, depthUnit ); + std::vector depthValues = depthValuesByIntervals( depthType, depthUnit ); for ( size_t vIdx = 0; vIdx < depthValues.size(); vIdx++ ) { double value = depthValues[vIdx]; diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.h b/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.h index 20194c5126..807b7c9d96 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.h +++ b/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.h @@ -43,22 +43,26 @@ class RigWellLogCurveData : public cvf::Object void setDepthUnit( RiaDefines::DepthUnitType depthUnit ); - void setValuesAndDepths( const std::vector& xValues, + void setValuesAndDepths( const std::vector& propertyValues, const std::vector& depths, RiaDefines::DepthTypeEnum depthType, double rkbDiff, RiaDefines::DepthUnitType depthUnit, - bool isExtractionCurve ); - void setValuesAndDepths( const std::vector& xValues, + bool isExtractionCurve, + bool useLogarithmicScale ); + + void setValuesAndDepths( const std::vector& propertyValues, const std::map>& depths, double rkbDiff, RiaDefines::DepthUnitType depthUnit, - bool isExtractionCurve ); - void setXUnits( const QString& xUnitString ); + bool isExtractionCurve, + bool useLogarithmicScale ); + + void setPropertyValueUnit( const QString& propertyValueUnitString ); - std::vector xValues() const; - std::vector xValues( const QString& units ) const; - QString xUnits() const; + std::vector propertyValues() const; + std::vector propertyValues( const QString& units ) const; + QString propertyValueUnit() const; std::vector depths( RiaDefines::DepthTypeEnum depthType ) const; @@ -71,9 +75,9 @@ class RigWellLogCurveData : public cvf::Object RiaDefines::DepthUnitType depthUnit() const; - std::vector xPlotValues() const; - std::vector depthPlotValues( RiaDefines::DepthTypeEnum depthType, - RiaDefines::DepthUnitType destinationDepthUnit ) const; + std::vector propertyValuesByIntervals() const; + std::vector depthValuesByIntervals( RiaDefines::DepthTypeEnum depthType, + RiaDefines::DepthUnitType destinationDepthUnit ) const; std::vector> polylineStartStopIndices() const; cvf::ref calculateResampledCurveData( double newMeasuredDepthStepSize ) const; @@ -95,13 +99,14 @@ class RigWellLogCurveData : public cvf::Object std::vector>* intervals ); private: - std::vector m_xValues; + std::vector m_propertyValues; std::map> m_depths; bool m_isExtractionCurve; double m_rkbDiff; + bool m_useLogarithmicScale; std::vector> m_intervalsOfContinousValidValues; RiaDefines::DepthUnitType m_depthUnit; - QString m_xUnitString; + QString m_propertyValueUnitString; }; diff --git a/ApplicationLibCode/UnitTests/RimWellLogExtractionCurveImpl-Test.cpp b/ApplicationLibCode/UnitTests/RimWellLogExtractionCurveImpl-Test.cpp index 274557a9d5..cd7400679f 100644 --- a/ApplicationLibCode/UnitTests/RimWellLogExtractionCurveImpl-Test.cpp +++ b/ApplicationLibCode/UnitTests/RimWellLogExtractionCurveImpl-Test.cpp @@ -18,7 +18,8 @@ TEST( RimWellLogExtractionCurveImplTest, StripOffInvalidValAtEndsOfVector ) values.push_back( 3.0 ); values.push_back( HUGE_VAL ); - auto valuesIntervals = RiaCurveDataTools::calculateIntervalsOfValidValues( values, false ); + bool includePositiveValuesOnly = false; + auto valuesIntervals = RiaCurveDataTools::calculateIntervalsOfValidValues( values, includePositiveValuesOnly ); EXPECT_EQ( 1, static_cast( valuesIntervals.size() ) ); EXPECT_EQ( 2, static_cast( valuesIntervals[0].first ) ); @@ -40,7 +41,8 @@ TEST( RimWellLogExtractionCurveImplTest, StripOffHugeValAtEndsAndInteriorOfVecto values.push_back( 3.0 ); values.push_back( HUGE_VAL ); - auto valuesIntervals = RiaCurveDataTools::calculateIntervalsOfValidValues( values, false ); + bool includePositiveValuesOnly = false; + auto valuesIntervals = RiaCurveDataTools::calculateIntervalsOfValidValues( values, includePositiveValuesOnly ); EXPECT_EQ( 2, static_cast( valuesIntervals.size() ) ); EXPECT_EQ( 2, static_cast( valuesIntervals[0].first ) ); @@ -48,3 +50,31 @@ TEST( RimWellLogExtractionCurveImplTest, StripOffHugeValAtEndsAndInteriorOfVecto EXPECT_EQ( 5, static_cast( valuesIntervals[1].first ) ); EXPECT_EQ( 6, static_cast( valuesIntervals[1].second ) ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( RimWellLogExtractionCurveImplTest, PositiveValuesOnly ) +{ + std::vector values; + values.push_back( HUGE_VAL ); + values.push_back( HUGE_VAL ); + values.push_back( -1.0 ); + values.push_back( 0.0 ); + values.push_back( 0.1 ); + values.push_back( 0.2 ); + values.push_back( -1.0 ); + values.push_back( HUGE_VAL ); + values.push_back( 2.0 ); + values.push_back( 3.0 ); + values.push_back( HUGE_VAL ); + + bool includePositiveValuesOnly = true; + auto valuesIntervals = RiaCurveDataTools::calculateIntervalsOfValidValues( values, includePositiveValuesOnly ); + + EXPECT_EQ( 2, static_cast( valuesIntervals.size() ) ); + EXPECT_EQ( 4, static_cast( valuesIntervals[0].first ) ); + EXPECT_EQ( 5, static_cast( valuesIntervals[0].second ) ); + EXPECT_EQ( 8, static_cast( valuesIntervals[1].first ) ); + EXPECT_EQ( 9, static_cast( valuesIntervals[1].second ) ); +} diff --git a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp index f63b998a68..324e217fa7 100644 --- a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp @@ -239,8 +239,8 @@ void RiuFlowCharacteristicsPlot::addFlowCapStorageCapCurve( const QDateTime& RiuQwtPlotCurve* plotCurve = createEmptyCurve( m_flowCapVsStorageCapPlot, dateTime.toString(), m_dateToColorMap[dateTime] ); - bool isLogCurve = false; - plotCurve->setSamplesFromXValuesAndYValues( xVals, yVals, isLogCurve ); + bool useLogarithmicScale = false; + plotCurve->setSamplesFromXValuesAndYValues( xVals, yVals, useLogarithmicScale ); m_flowCapVsStorageCapPlot->replot(); } @@ -253,9 +253,9 @@ void RiuFlowCharacteristicsPlot::addSweepEfficiencyCurve( const QDateTime& { CVF_ASSERT( !m_dateToColorMap.empty() ); - RiuQwtPlotCurve* plotCurve = createEmptyCurve( m_sweepEffPlot, dateTime.toString(), m_dateToColorMap[dateTime] ); - bool isLogCurve = false; - plotCurve->setSamplesFromXValuesAndYValues( xVals, yVals, isLogCurve ); + RiuQwtPlotCurve* plotCurve = createEmptyCurve( m_sweepEffPlot, dateTime.toString(), m_dateToColorMap[dateTime] ); + bool useLogarithmicScale = false; + plotCurve->setSamplesFromXValuesAndYValues( xVals, yVals, useLogarithmicScale ); m_sweepEffPlot->replot(); } diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuPlotCurve.cpp index e528ab9497..7de827ffa1 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotCurve.cpp @@ -49,7 +49,7 @@ RiuPlotCurve::~RiuPlotCurve() //-------------------------------------------------------------------------------------------------- void RiuPlotCurve::setSamplesValues( const std::vector& xValues, const std::vector& yValues ) { - setSamplesInPlot( xValues, yValues, static_cast( xValues.size() ) ); + setSamplesInPlot( xValues, yValues ); } //-------------------------------------------------------------------------------------------------- @@ -57,9 +57,9 @@ void RiuPlotCurve::setSamplesValues( const std::vector& xValues, const s //-------------------------------------------------------------------------------------------------- void RiuPlotCurve::setSamplesFromXValuesAndYValues( const std::vector& xValues, const std::vector& yValues, - bool isLogCurve ) + bool useLogarithmicScale ) { - computeValidIntervalsAndSetCurveData( xValues, yValues, isLogCurve ); + computeValidIntervalsAndSetCurveData( xValues, yValues, useLogarithmicScale ); } //-------------------------------------------------------------------------------------------------- @@ -67,11 +67,11 @@ void RiuPlotCurve::setSamplesFromXValuesAndYValues( const std::vector& x //-------------------------------------------------------------------------------------------------- void RiuPlotCurve::setSamplesFromDatesAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool isLogCurve ) + bool useLogarithmicScale ) { auto xValues = RiuPlotCurve::fromQDateTime( dateTimes ); - computeValidIntervalsAndSetCurveData( xValues, yValues, isLogCurve ); + computeValidIntervalsAndSetCurveData( xValues, yValues, useLogarithmicScale ); } //-------------------------------------------------------------------------------------------------- @@ -79,11 +79,11 @@ void RiuPlotCurve::setSamplesFromDatesAndYValues( const std::vector& //-------------------------------------------------------------------------------------------------- void RiuPlotCurve::setSamplesFromTimeTAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool isLogCurve ) + bool useLogarithmicScale ) { auto xValues = RiuPlotCurve::fromTime_t( dateTimes ); - computeValidIntervalsAndSetCurveData( xValues, yValues, isLogCurve ); + computeValidIntervalsAndSetCurveData( xValues, yValues, useLogarithmicScale ); } //-------------------------------------------------------------------------------------------------- @@ -123,9 +123,9 @@ void RiuPlotCurve::setBlackAndWhiteLegendIcon( bool blackAndWhite ) //-------------------------------------------------------------------------------------------------- void RiuPlotCurve::computeValidIntervalsAndSetCurveData( const std::vector& xValues, const std::vector& yValues, - bool isLogCurve ) + bool useLogarithmicScale ) { - auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, isLogCurve ); + auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, useLogarithmicScale ); std::vector validYValues; std::vector validXValues; @@ -133,7 +133,7 @@ void RiuPlotCurve::computeValidIntervalsAndSetCurveData( const std::vector( validXValues.size() ) ); + setSamplesInPlot( validXValues, validYValues ); setLineSegmentStartStopIndices( RiaCurveDataTools::computePolyLineStartStopIndices( intervalsOfValidValues ) ); } @@ -184,7 +184,7 @@ std::vector RiuPlotCurve::fromTime_t( const std::vector& timeSte void RiuPlotCurve::setSamplesFromXYErrorValues( const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool isLogCurve, + bool useLogarithmicScale, RiaCurveDataTools::ErrorAxis errorAxis ) { } diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurve.h b/ApplicationLibCode/UserInterface/RiuPlotCurve.h index 47144a35d5..f770b52fa4 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuPlotCurve.h @@ -65,21 +65,21 @@ class RiuPlotCurve void setSamplesFromXValuesAndYValues( const std::vector& xValues, const std::vector& yValues, - bool isLogCurve ); + bool useLogarithmicScale ); void setSamplesFromDatesAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool isLogCurve ); + bool useLogarithmicScale ); void setSamplesFromTimeTAndYValues( const std::vector& dateTimes, const std::vector& yValues, - bool isLogCurve ); + bool useLogarithmicScale ); virtual void setSamplesFromXYErrorValues( const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool isLogCurve, + bool useLogarithmicScale, RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ); void setLineSegmentStartStopIndices( const std::vector>& lineSegmentStartStopIndices ); @@ -130,13 +130,12 @@ class RiuPlotCurve virtual RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const = 0; protected: - virtual void - setSamplesInPlot( const std::vector& xValues, const std::vector& yValues, int numSamples ) = 0; + virtual void setSamplesInPlot( const std::vector& xValues, const std::vector& yValues ) = 0; private: void computeValidIntervalsAndSetCurveData( const std::vector& xValues, const std::vector& yValues, - bool isLogCurve ); + bool useLogarithmicScale ); protected: float m_symbolSkipPixelDistance; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index cbe1e3f5e2..7fa055b28b 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -179,22 +179,18 @@ void RiuQtChartsPlotCurve::showInPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, - const std::vector& yValues, - int numValues ) +void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, const std::vector& yValues ) { if ( !isQtChartObjectsPresent() ) return; CAF_ASSERT( xValues.size() == yValues.size() ); - CAF_ASSERT( numValues <= static_cast( xValues.size() ) ); - CAF_ASSERT( numValues >= 0 ); QtCharts::QLineSeries* line = lineSeries(); QtCharts::QScatterSeries* scatter = scatterSeries(); line->clear(); scatter->clear(); - for ( int i = 0; i < numValues; i++ ) + for ( int i = 0; i < static_cast( xValues.size() ); i++ ) { line->append( xValues[i], yValues[i] ); scatter->append( xValues[i], yValues[i] ); diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h index 9b95e94953..4c2c476c20 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h @@ -78,7 +78,7 @@ class RiuQtChartsPlotCurve : public RiuPlotCurve RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override; private: - void setSamplesInPlot( const std::vector&, const std::vector&, int ) override; + void setSamplesInPlot( const std::vector&, const std::vector& ) override; bool isQtChartObjectsPresent() const; QtCharts::QLineSeries* lineSeries() const; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index 2d670f15d1..5a352fdb0e 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -337,9 +337,11 @@ void RiuQwtPlotCurve::showInPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotCurve::setSamplesInPlot( const std::vector& xValues, const std::vector& yValues, int numValues ) +void RiuQwtPlotCurve::setSamplesInPlot( const std::vector& xValues, const std::vector& yValues ) { - setSamples( xValues.data(), yValues.data(), numValues ); + CAF_ASSERT( xValues.size() == yValues.size() ); + + setSamples( xValues.data(), yValues.data(), static_cast( xValues.size() ) ); } //-------------------------------------------------------------------------------------------------- @@ -415,13 +417,13 @@ std::pair RiuQwtPlotCurve::yDataRange() const void RiuQwtPlotCurve::setSamplesFromXYErrorValues( const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool isLogCurve, + bool useLogarithmicScale, RiaCurveDataTools::ErrorAxis errorAxis ) { CVF_ASSERT( xValues.size() == yValues.size() ); CVF_ASSERT( xValues.size() == errorValues.size() ); - auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, isLogCurve ); + auto intervalsOfValidValues = RiaCurveDataTools::calculateIntervalsOfValidValues( yValues, useLogarithmicScale ); std::vector filteredYValues; std::vector filteredXValues; @@ -454,7 +456,7 @@ void RiuQwtPlotCurve::setSamplesFromXYErrorValues( const std::vector& } } - setSamplesInPlot( filteredXValues, filteredYValues, static_cast( filteredXValues.size() ) ); + setSamplesInPlot( filteredXValues, filteredYValues ); setLineSegmentStartStopIndices( intervalsOfValidValues ); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h index 538d1cca13..13ee0a5a68 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h @@ -71,7 +71,7 @@ class RiuQwtPlotCurve : public RiuPlotCurve, public QwtPlotCurve const std::vector& xValues, const std::vector& yValues, const std::vector& errorValues, - bool isLogCurve, + bool useLogarithmicScale, RiaCurveDataTools::ErrorAxis errorAxis = RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ) override; void setXAxis( RiuPlotAxis axis ) override; @@ -97,7 +97,7 @@ class RiuQwtPlotCurve : public RiuPlotCurve, public QwtPlotCurve int from, int to ) const override; - void setSamplesInPlot( const std::vector&, const std::vector&, int ) override; + void setSamplesInPlot( const std::vector&, const std::vector& ) override; QwtPlotIntervalCurve* m_qwtCurveErrorBars; bool m_showErrorBars; From 79614e09e930a71276dd33316784f7deffafd559 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 15 Feb 2022 15:43:44 +0100 Subject: [PATCH 124/406] #8555 Well Log Extraction : Fix missing curve data for no console --- .../WellLog/RimWellLogExtractionCurve.cpp | 97 ++++++++++--------- .../rips/tests/test_well_log_extraction.py | 46 +++++++++ 2 files changed, 98 insertions(+), 45 deletions(-) create mode 100644 GrpcInterface/Python/rips/tests/test_well_log_extraction.py diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 0fcd109ffd..35dfb407fc 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -340,69 +340,75 @@ void RimWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* cha //-------------------------------------------------------------------------------------------------- void RimWellLogExtractionCurve::onLoadDataAndUpdate( bool updateParentPlot ) { - if ( isCurveVisible() && m_plotCurve ) + if ( isCurveVisible() ) { bool isUsingPseudoLength = false; performDataExtraction( &isUsingPseudoLength ); - RimDepthTrackPlot* wellLogPlot; - firstAncestorOrThisOfType( wellLogPlot ); - if ( !wellLogPlot ) return; - - RiaDefines::DepthTypeEnum depthType = wellLogPlot->depthType(); - RiaDefines::DepthUnitType displayUnit = wellLogPlot->depthUnit(); - if ( depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH || - depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB ) + if ( m_plotCurve ) { - isUsingPseudoLength = false; - } + bool isUsingPseudoLength = false; + performDataExtraction( &isUsingPseudoLength ); - bool useLogarithmicScale = false; + RimDepthTrackPlot* wellLogPlot; + firstAncestorOrThisOfType( wellLogPlot ); + if ( !wellLogPlot ) return; - RimWellLogTrack* track = nullptr; - firstAncestorOfType( track ); - if ( track ) - { - useLogarithmicScale = track->isLogarithmicScale(); - } + RiaDefines::DepthTypeEnum depthType = wellLogPlot->depthType(); + RiaDefines::DepthUnitType displayUnit = wellLogPlot->depthUnit(); + if ( depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH || + depthType == RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB ) + { + isUsingPseudoLength = false; + } - std::vector xPlotValues = curveData()->propertyValuesByIntervals(); - std::vector depthPlotValues = curveData()->depthValuesByIntervals( depthType, displayUnit ); - CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() ); + bool useLogarithmicScale = false; - if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL ) - m_plotCurve->setSamplesFromXValuesAndYValues( depthPlotValues, xPlotValues, useLogarithmicScale ); + RimWellLogTrack* track = nullptr; + firstAncestorOfType( track ); + if ( track ) + { + useLogarithmicScale = track->isLogarithmicScale(); + } - else - m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, useLogarithmicScale ); + std::vector xPlotValues = curveData()->propertyValuesByIntervals(); + std::vector depthPlotValues = curveData()->depthValuesByIntervals( depthType, displayUnit ); + CAF_ASSERT( xPlotValues.size() == depthPlotValues.size() ); - m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() ); + if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL ) + m_plotCurve->setSamplesFromXValuesAndYValues( depthPlotValues, xPlotValues, useLogarithmicScale ); - this->RimPlotCurve::updateCurvePresentation( updateParentPlot ); + else + m_plotCurve->setSamplesFromXValuesAndYValues( xPlotValues, depthPlotValues, useLogarithmicScale ); - if ( isUsingPseudoLength ) - { - RimWellLogTrack* wellLogTrack; - firstAncestorOrThisOfType( wellLogTrack ); - CVF_ASSERT( wellLogTrack ); + m_plotCurve->setLineSegmentStartStopIndices( curveData()->polylineStartStopIndices() ); - RiuQwtPlotWidget* viewer = wellLogTrack->viewer(); - if ( viewer ) + this->RimPlotCurve::updateCurvePresentation( updateParentPlot ); + + if ( isUsingPseudoLength ) { - viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "PL/" + wellLogPlot->depthAxisTitle() ); + RimWellLogTrack* wellLogTrack; + firstAncestorOrThisOfType( wellLogTrack ); + CVF_ASSERT( wellLogTrack ); + + RiuQwtPlotWidget* viewer = wellLogTrack->viewer(); + if ( viewer ) + { + viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "PL/" + wellLogPlot->depthAxisTitle() ); + } } - } - if ( updateParentPlot ) - { - updateZoomInParentPlot(); - } + if ( updateParentPlot ) + { + updateZoomInParentPlot(); + } - setLogScaleFromSelectedResult(); + setLogScaleFromSelectedResult(); - if ( m_parentPlot ) - { - m_parentPlot->replot(); + if ( m_parentPlot ) + { + m_parentPlot->replot(); + } } } } @@ -692,7 +698,8 @@ void RimWellLogExtractionCurve::clearGeneratedSimWellPaths() { RimWellLogPlotCollection* wellLogCollection = nullptr; - // Need to use this approach, and not firstAnchestor because the curve might not be inside the hierarchy when deleted. + // Need to use this approach, and not firstAnchestor because the curve might not be inside the hierarchy when + // deleted. RimProject* proj = RimProject::current(); if ( proj && proj->mainPlotCollection() ) wellLogCollection = proj->mainPlotCollection()->wellLogPlotCollection(); diff --git a/GrpcInterface/Python/rips/tests/test_well_log_extraction.py b/GrpcInterface/Python/rips/tests/test_well_log_extraction.py new file mode 100644 index 0000000000..b411bbbfcf --- /dev/null +++ b/GrpcInterface/Python/rips/tests/test_well_log_extraction.py @@ -0,0 +1,46 @@ +import sys +import os +import tempfile + +sys.path.insert(1, os.path.join(sys.path[0], "../../")) +import rips + +import dataroot + + +def test_10k_well_log_extraction(rips_instance, initialize_test): + case_root_path = dataroot.PATH + "/TEST10K_FLT_LGR_NNC" + case_path = case_root_path + "/TEST10K_FLT_LGR_NNC.EGRID" + case = rips_instance.project.load_case(path=case_path) + assert len(case.grids()) == 2 + well_path_files = [ + case_root_path + "/wellpath_a.dev", + ] + + view = case.create_view() + view.set_time_step(1) + + well_path_names = rips_instance.project.import_well_paths(well_path_files) + wells = rips_instance.project.well_paths() + well_path = wells[0] + + properties = [ + ("STATIC_NATIVE", "INDEX_K", 0), + ("STATIC_NATIVE", "PORO", 0), + ("STATIC_NATIVE", "PERMX", 0), + ("DYNAMIC_NATIVE", "PRESSURE", 0), + ] + + well_log_plot_collection = rips_instance.project.descendants( + rips.WellLogPlotCollection + )[0] + + well_log_plot = well_log_plot_collection.new_well_log_plot(case, well_path) + + # Create a track for each property + for (prop_type, prop_name, time_step) in properties: + track = well_log_plot.new_well_log_track("Track: " + prop_name, case, well_path) + c = track.add_extraction_curve(case, well_path, prop_type, prop_name, time_step) + + with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname: + well_log_plot.export_data_as_las(export_folder=tmpdirname) From 2bea99eb5f759addb6c13cbdb9aa7d2528d17a62 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 14 Feb 2022 11:39:23 +0100 Subject: [PATCH 125/406] #8450 Qt Charts: generate nicer numbers when auto scaling. --- ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index dde8aa6c40..a4f8ae998a 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -679,6 +679,12 @@ void RiuQtChartsPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale ) if ( autoScale ) { rescaleAxis( axis ); + QAbstractAxis* ax = plotAxis( axis ); + QValueAxis* valueAxis = dynamic_cast( ax ); + if ( valueAxis ) + { + valueAxis->applyNiceNumbers(); + } } } From 7fbff9d58b81be19ee7ae4e858d8098ed62c2b99 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 14 Feb 2022 11:40:16 +0100 Subject: [PATCH 126/406] Qt Charts: Add more major grid lines. --- ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp | 2 +- ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp index 8413298644..bb64a0e03b 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp @@ -66,7 +66,7 @@ void RiuQtChartsPlotTools::setDefaultAxes( RiuQtChartsPlotWidget* plot ) plot->enableAxis( RiuPlotAxis::defaultRight(), false ); plot->setAxisMaxMinor( RiuPlotAxis::defaultBottom(), 2 ); - plot->setAxisMaxMinor( RiuPlotAxis::defaultLeft(), 3 ); + plot->setAxisMaxMinor( RiuPlotAxis::defaultLeft(), 0 ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index a4f8ae998a..80d0626739 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -642,12 +642,7 @@ void RiuQtChartsPlotWidget::setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) QValueAxis* valueAxis = dynamic_cast( ax ); if ( valueAxis ) { - valueAxis->setTickCount( maxMinor ); - } - else - { - QDateTimeAxis* dateAxis = dynamic_cast( ax ); - if ( dateAxis ) dateAxis->setTickCount( maxMinor ); + valueAxis->setMinorTickCount( maxMinor ); } } From 4a3d9470b410788ac64731bc4b52b1ea1f1ce69f Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Wed, 16 Feb 2022 16:36:50 +0100 Subject: [PATCH 127/406] Summary Plots: Support dragging wells, groups and regions into plots (#8550) Support dropping wells, wellgroups and regions into summary plots. --- .../Summary/RimSummaryAddress.cpp | 8 ++ .../Summary/RimSummaryAddress.h | 2 + .../Summary/RimSummaryAddressCollection.cpp | 126 ++++++++++++++++-- .../Summary/RimSummaryAddressCollection.h | 37 ++++- .../Summary/RimSummaryPlot.cpp | 106 +++++++++++++-- .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 + .../UserInterface/RiuDragDrop.cpp | 17 ++- 7 files changed, 275 insertions(+), 23 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp index 932e938aea..0acf69eca1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp @@ -253,3 +253,11 @@ bool RimSummaryAddress::isEnsemble() const { return m_ensembleId >= 0; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryAddress::canBeDragged() const +{ + return !isEnsemble(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h index 5a1fb208d3..c15687975b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h @@ -57,6 +57,8 @@ class RimSummaryAddress : public caf::PdmObject int ensembleId() const; bool isEnsemble() const; + bool canBeDragged() const; + QString quantityName() const; void ensureCalculationIdIsAssigned(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index 5be61624a9..02240c8f73 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -24,6 +24,18 @@ #include "cafPdmUiTreeOrdering.h" +template <> +void caf::AppEnum::setUp() +{ + addItem( RimSummaryAddressCollection::CollectionContentType::NOT_DEFINED, "NOT_DEFINED", "Not Defined" ); + addItem( RimSummaryAddressCollection::CollectionContentType::WELL, "WELL", "Well" ); + addItem( RimSummaryAddressCollection::CollectionContentType::WELL_GROUP, "WELL_GROUP", "Well Group" ); + addItem( RimSummaryAddressCollection::CollectionContentType::REGION, "REGION", "Region" ); + addItem( RimSummaryAddressCollection::CollectionContentType::MISC, "MISC", "Miscellaneous" ); + addItem( RimSummaryAddressCollection::CollectionContentType::FIELD, "FIELD", "Field" ); + setDefault( RimSummaryAddressCollection::CollectionContentType::NOT_DEFINED ); +} + CAF_PDM_SOURCE_INIT( RimSummaryAddressCollection, "RimSummaryAddressCollection" ); //-------------------------------------------------------------------------------------------------- @@ -33,12 +45,23 @@ RimSummaryAddressCollection::RimSummaryAddressCollection() { CAF_PDM_InitObject( "Folder", ":/Folder.png", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_contentType, "ContentsType", "Contents" ); + m_contentType = RimSummaryAddressCollection::CollectionContentType::NOT_DEFINED; + m_contentType.uiCapability()->setUiReadOnly( true ); + m_contentType.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_adresses, "SummaryAddresses", "Addresses" ); m_adresses.uiCapability()->setUiTreeHidden( true ); CAF_PDM_InitFieldNoDefault( &m_subfolders, "AddressSubfolders", "Subfolders" ); m_subfolders.uiCapability()->setUiTreeHidden( true ); + CAF_PDM_InitField( &m_caseId, "CaseId", -1, "CaseId" ); + m_caseId.uiCapability()->setUiHidden( true ); + + CAF_PDM_InitField( &m_ensembleId, "EnsembleId", -1, "EnsembleId" ); + m_ensembleId.uiCapability()->setUiHidden( true ); + nameField()->uiCapability()->setUiHidden( true ); } @@ -77,6 +100,8 @@ void RimSummaryAddressCollection::addAddress( const RifEclipseSummaryAddress& ad if ( !hasDataVector( address.quantityName() ) ) { m_adresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, caseId, ensembleId ) ); + if ( m_caseId == -1 ) m_caseId = caseId; + if ( m_ensembleId == -1 ) m_ensembleId = ensembleId; } } @@ -84,11 +109,12 @@ void RimSummaryAddressCollection::addAddress( const RifEclipseSummaryAddress& ad /// //-------------------------------------------------------------------------------------------------- void RimSummaryAddressCollection::addToSubfolder( QString foldername, + CollectionContentType folderType, const RifEclipseSummaryAddress& address, int caseId, int ensembleId ) { - RimSummaryAddressCollection* folder = getOrCreateSubfolder( foldername ); + RimSummaryAddressCollection* folder = getOrCreateSubfolder( foldername, folderType ); folder->addAddress( address, caseId, ensembleId ); } @@ -101,11 +127,11 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::setaddToSubfolder( QString::number( address.regionNumber() ), address, caseId, ensembleId ); + regions->addToSubfolder( QString::number( address.regionNumber() ), + CollectionContentType::REGION, + address, + caseId, + ensembleId ); break; case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_GROUP: - groups->addToSubfolder( QString::fromStdString( address.wellGroupName() ), address, caseId, ensembleId ); + groups->addToSubfolder( QString::fromStdString( address.wellGroupName() ), + CollectionContentType::WELL_GROUP, + address, + caseId, + ensembleId ); break; case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL: - wells->addToSubfolder( QString::fromStdString( address.wellName() ), address, caseId, ensembleId ); + wells->addToSubfolder( QString::fromStdString( address.wellName() ), + CollectionContentType::WELL, + address, + caseId, + ensembleId ); break; default: @@ -140,7 +178,8 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::setsetName( folderName ); + newFolder->setContentType( createFolderType ); m_subfolders.push_back( newFolder ); return newFolder; } @@ -173,6 +213,20 @@ bool RimSummaryAddressCollection::isEmpty() const return ( ( m_adresses.size() == 0 ) && ( m_subfolders.size() == 0 ) ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryAddressCollection::canBeDragged() const +{ + bool ok = m_subfolders.size() == 0; + ok = ok && !isEnsemble(); + + ok = ok && ( m_contentType == CollectionContentType::WELL || m_contentType == CollectionContentType::WELL_GROUP || + m_contentType == CollectionContentType::REGION ); + + return ok; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -188,3 +242,59 @@ void RimSummaryAddressCollection::updateUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering.add( address ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddressCollection::setContentType( CollectionContentType content ) +{ + m_contentType = content; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryAddressCollection::CollectionContentType RimSummaryAddressCollection::contentType() const +{ + return m_contentType(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddressCollection::setEnsembleId( int ensembleId ) +{ + m_ensembleId = ensembleId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddressCollection::setCaseId( int caseId ) +{ + m_caseId = caseId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryAddressCollection::isEnsemble() const +{ + return m_ensembleId >= 0; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimSummaryAddressCollection::ensembleId() const +{ + return m_ensembleId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimSummaryAddressCollection::caseId() const +{ + return m_caseId; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h index c4f2619b40..b8e1060fde 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -32,28 +32,59 @@ class RimSummaryAddressCollection : public RimNamedObject { CAF_PDM_HEADER_INIT; +public: + enum class CollectionContentType + { + NOT_DEFINED, + WELL, + WELL_GROUP, + REGION, + FIELD, + MISC + }; + public: RimSummaryAddressCollection(); ~RimSummaryAddressCollection() override; - void updateFolderStructure( const std::set& addresses, int caseid, int ensembleId = -1 ); + void updateFolderStructure( const std::set& addresses, int caseId, int ensembleId = -1 ); void clear(); bool isEmpty() const; + bool isEnsemble() const; + + bool canBeDragged() const; void updateUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering ) const; + void setContentType( CollectionContentType content ); + CollectionContentType contentType() const; + + void setCaseId( int caseId ); + int caseId() const; + void setEnsembleId( int ensembleId ); + int ensembleId() const; + private: - RimSummaryAddressCollection* getOrCreateSubfolder( const QString folderName ); + RimSummaryAddressCollection* + getOrCreateSubfolder( const QString folderName, + CollectionContentType createFolderType = CollectionContentType::NOT_DEFINED ); bool hasDataVector( const QString quantityName ) const; bool hasDataVector( const std::string quantityName ) const; void addAddress( const RifEclipseSummaryAddress& address, int caseId, int ensembleId = -1 ); - void addToSubfolder( QString foldername, const RifEclipseSummaryAddress& address, int caseId, int ensembleId = -1 ); + void addToSubfolder( QString foldername, + CollectionContentType folderType, + const RifEclipseSummaryAddress& address, + int caseId, + int ensembleId = -1 ); private: caf::PdmChildArrayField m_adresses; caf::PdmChildArrayField m_subfolders; + caf::PdmField> m_contentType; + caf::PdmField m_caseId; + caf::PdmField m_ensembleId; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 09bd36d1dd..244d86dac1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -44,6 +44,7 @@ #include "RimPlotAxisProperties.h" #include "RimProject.h" #include "RimSummaryAddress.h" +#include "RimSummaryAddressCollection.h" #include "RimSummaryCase.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" @@ -1793,36 +1794,121 @@ bool RimSummaryPlot::autoPlotTitle() const //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::handleDroppedObjects( const std::vector& objects ) { + int newCurves = 0; + for ( auto obj : objects ) { auto summaryAdr = dynamic_cast( obj ); if ( summaryAdr ) { - if ( summaryAdr->isEnsemble() ) + if ( summaryAdr->isEnsemble() ) continue; + + auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAdr->caseId() ); + if ( summaryCase ) { - // TODO: Add drop support for ensemble curves + addNewCurveY( summaryAdr->address(), summaryCase ); + newCurves++; } - else + continue; + } + + auto addressCollection = dynamic_cast( obj ); + if ( addressCollection ) + { + auto droppedName = addressCollection->name().toStdString(); + + if ( addressCollection->isEnsemble() ) continue; + + auto summaryCase = RiaSummaryTools::summaryCaseById( addressCollection->caseId() ); + if ( summaryCase ) { - auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAdr->caseId() ); - if ( summaryCase ) + if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) + { + std::map> dataVectorMap; + + for ( auto& curve : summaryCurves() ) + { + const auto curveAddress = curve->summaryAddressY(); + if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL ) + { + dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellName() ); + } + } + + for ( auto& [vectorName, wellNames] : dataVectorMap ) + { + if ( wellNames.count( droppedName ) > 0 ) continue; + + addNewCurveY( RifEclipseSummaryAddress::wellAddress( vectorName, droppedName ), summaryCase ); + newCurves++; + } + } + else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) + { + std::map> dataVectorMap; + + for ( auto& curve : summaryCurves() ) + { + const auto curveAddress = curve->summaryAddressY(); + if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_GROUP ) + { + dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellGroupName() ); + } + } + + for ( auto& [vectorName, wellGroupNames] : dataVectorMap ) + { + if ( wellGroupNames.count( droppedName ) > 0 ) continue; + + addNewCurveY( RifEclipseSummaryAddress::wellGroupAddress( vectorName, droppedName ), summaryCase ); + newCurves++; + } + } + else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) { - auto* newCurve = new RimSummaryCurve(); + std::map> dataVectorMap; + + for ( auto& curve : summaryCurves() ) + { + const auto curveAddress = curve->summaryAddressY(); + if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_REGION ) + { + dataVectorMap[curveAddress.quantityName()].insert( curveAddress.regionNumber() ); + } + } - newCurve->setSummaryCaseY( summaryCase ); - newCurve->setSummaryAddressYAndApplyInterpolation( summaryAdr->address() ); + int droppedRegion = std::stoi( droppedName ); - addCurveNoUpdate( newCurve ); + for ( auto& [vectorName, regionNumbers] : dataVectorMap ) + { + if ( regionNumbers.count( droppedRegion ) > 0 ) continue; - newCurve->loadDataAndUpdate( true ); + addNewCurveY( RifEclipseSummaryAddress::regionAddress( vectorName, droppedRegion ), summaryCase ); + newCurves++; + } } } + continue; } } + if ( newCurves > 0 ) applyDefaultCurveAppearances(); + updateConnectedEditors(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase ) +{ + RimSummaryCurve* newCurve = new RimSummaryCurve(); + newCurve->setSummaryCaseY( summaryCase ); + newCurve->setSummaryAddressYAndApplyInterpolation( address ); + addCurveNoUpdate( newCurve ); + newCurve->loadDataAndUpdate( true ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 0f640ca81e..582a31d58c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -263,6 +263,8 @@ private slots: void assignPlotAxis( RimSummaryCurve* curve ); + void addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase ); + private: #ifdef USE_QTCHARTS caf::PdmField m_useQtChartsPlot; diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index e5c00d5faa..0a753f4161 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -34,6 +34,7 @@ #include "RimMultiPlot.h" #include "RimPlot.h" #include "RimSummaryAddress.h" +#include "RimSummaryAddressCollection.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" @@ -251,11 +252,23 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const if ( dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || dynamic_cast( uiItem ) || - dynamic_cast( uiItem ) || dynamic_cast( uiItem ) ) + dynamic_cast( uiItem ) ) { - // TODO: Remember to handle reservoir holding the main grid itemflags |= Qt::ItemIsDragEnabled; } + else + { + auto sumAdrColl = dynamic_cast( uiItem ); + if ( sumAdrColl && sumAdrColl->canBeDragged() ) + { + itemflags |= Qt::ItemIsDragEnabled; + } + auto sumAdr = dynamic_cast( uiItem ); + if ( sumAdr && sumAdr->canBeDragged() ) + { + itemflags |= Qt::ItemIsDragEnabled; + } + } if ( m_dragItems.empty() ) return itemflags; From 79f427f64bc8114180951f25315b0e6c1b67556a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 16 Feb 2022 15:37:12 +0100 Subject: [PATCH 128/406] #8558 Fix reading of simulation dates for restart case The date import was wrong for some restart cases. --- ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp index c6346b1ed8..8a897a0b23 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -200,7 +200,8 @@ void RifEclipseOutputFileTools::timeSteps( const ecl_file_type* ecl_file, // Some simulations might end up with wrong data reported for day/month/year. If this situation is detected, // base all time step on double values and use start of simulation as first date // See https://github.com/OPM/ResInsight/issues/4850 - if ( uniqueDays.size() == dayValues.size() ) useStartOfSimulationDate = false; + // https://github.com/OPM/ResInsight/issues/8558 + if ( uniqueDays.size() == uniqueDayValues.size() ) useStartOfSimulationDate = false; } std::set existingTimesteps; From 0879f3748b36cc8d67d9bcec18ed5b29917f07f4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 17 Feb 2022 08:37:50 +0100 Subject: [PATCH 129/406] #8558 Use both conditions to disable use of start of simulation GeoMech cases require this test condition --- ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp index 8a897a0b23..3880e7d296 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -202,6 +202,7 @@ void RifEclipseOutputFileTools::timeSteps( const ecl_file_type* ecl_file, // See https://github.com/OPM/ResInsight/issues/4850 // https://github.com/OPM/ResInsight/issues/8558 if ( uniqueDays.size() == uniqueDayValues.size() ) useStartOfSimulationDate = false; + if ( uniqueDays.size() == dayValues.size() ) useStartOfSimulationDate = false; } std::set existingTimesteps; From 491367795592c2d54cf5cddc17599449bf3ab488 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Thu, 17 Feb 2022 10:47:54 +0100 Subject: [PATCH 130/406] 8549 qtcharts fix time axis (#8564) * #8549 QtCharts: Fix time axis range setting * #8549 QtCharts: Fix 'zoom all' behavior --- .../UserInterface/RiuQtChartsPlotWidget.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 80d0626739..8a5c0b617c 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -674,11 +674,15 @@ void RiuQtChartsPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale ) if ( autoScale ) { rescaleAxis( axis ); + QAbstractAxis* ax = plotAxis( axis ); QValueAxis* valueAxis = dynamic_cast( ax ); if ( valueAxis ) { + // Block signals to avoid triggering RimSummaryPlot::onPlotZoomed + valueAxis->blockSignals( true ); valueAxis->applyNiceNumbers(); + valueAxis->blockSignals( false ); } } } @@ -688,7 +692,14 @@ void RiuQtChartsPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale ) //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max ) { - plotAxis( axis )->setRange( min, max ); + if ( axisScaleType( axis ) == RiuPlotWidget::AxisScaleType::DATE ) + { + plotAxis( axis )->setRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) ); + } + else + { + plotAxis( axis )->setRange( min, max ); + } } //-------------------------------------------------------------------------------------------------- @@ -974,6 +985,9 @@ void RiuQtChartsPlotWidget::rescaleAxis( RiuPlotAxis axis ) } } + // Block signals to avoid triggering RimSummaryPlot::onPlotZoomed + pAxis->blockSignals( true ); + if ( axisScaleType( axis ) == RiuPlotWidget::AxisScaleType::DATE ) { pAxis->setRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) ); @@ -982,6 +996,8 @@ void RiuQtChartsPlotWidget::rescaleAxis( RiuPlotAxis axis ) { pAxis->setRange( min, max ); } + + pAxis->blockSignals( false ); } //-------------------------------------------------------------------------------------------------- From 0b5bc2ba68d6049523c52281cfeba92f64052e71 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Thu, 17 Feb 2022 15:13:08 +0100 Subject: [PATCH 131/406] Change ouput model name --- .../GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp | 4 ++-- .../ProjectDataModel/WellPath/RimWellIASettings.cpp | 4 ++-- .../ProjectDataModel/WellPath/RimWellIASettings.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp b/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp index b0cc93ba4f..ceaf621b6e 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicRunWellIntegrityAnalysisFeature.cpp @@ -120,11 +120,11 @@ void RicRunWellIntegrityAnalysisFeature::onActionTriggered( bool isChecked ) runProgress.setProgressDescription( "Loading modeling results." ); RiaApplication* app = RiaApplication::instance(); - if ( !app->openOdbCaseFromFile( modelSettings->outputHeatOdbFilename() ) ) + if ( !app->openOdbCaseFromFile( modelSettings->outputDrillingOdbFilename() ) ) { QMessageBox::critical( nullptr, wiaTitle, - "Failed to load modeling results from file \"" + modelSettings->outputHeatOdbFilename() + + "Failed to load modeling results from file \"" + modelSettings->outputDrillingOdbFilename() + "\". Check log window for additional information." ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp index 7dfb0627d0..7c7ae03ee2 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp @@ -328,9 +328,9 @@ QString RimWellIASettings::outputOdbFilename() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimWellIASettings::outputHeatOdbFilename() const +QString RimWellIASettings::outputDrillingOdbFilename() const { - return m_baseDir() + "/" + name() + "_heat.odb"; + return m_baseDir() + "/" + name() + "_drilling.odb"; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.h index 4dd168c2af..1ce2f839d1 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.h @@ -63,7 +63,7 @@ class RimWellIASettings : public RimCheckableNamedObject void setOutputBaseDirectory( QString baseDir ); QString outputBaseDirectory() const; QString outputOdbFilename() const; - QString outputHeatOdbFilename() const; + QString outputDrillingOdbFilename() const; bool showBox() const; void setShowBox( bool show ); From 5c72d31cc9833636fbd8ead1813ce4d55e0f6c72 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sat, 19 Feb 2022 13:18:49 +0100 Subject: [PATCH 132/406] Improve well path target configuration (#8570) Improve the scripting possibilities for well targets Added tests and examples --- .../RiaLineArcWellPathCalculator.cpp | 115 +++++---- .../RiaLineArcWellPathCalculator.h | 14 +- .../WellPath/RimWellPathGeometryDef.cpp | 28 +-- .../WellPath/RimWellPathTarget.cpp | 224 +++++++++--------- .../WellPath/RimWellPathTarget.h | 67 +++--- .../RimcWellPathGeometryDef.cpp | 16 ++ .../RimcWellPathGeometryDef.h | 5 + .../PythonExamples/create_intersection.py | 23 +- .../Python/rips/tests/create_well_path.py | 35 --- .../rips/tests/test_create_well_path.py | 66 ++++++ 10 files changed, 328 insertions(+), 265 deletions(-) delete mode 100644 GrpcInterface/Python/rips/tests/create_well_path.py create mode 100644 GrpcInterface/Python/rips/tests/test_create_well_path.py diff --git a/ApplicationLibCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.cpp b/ApplicationLibCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.cpp index 3102720abf..4dcba331c0 100644 --- a/ApplicationLibCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.cpp +++ b/ApplicationLibCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.cpp @@ -43,8 +43,7 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& { m_lineArcEndpoints.push_back( activeWellPathTargets[0].targetPointXYZ + referencePointXyz ); m_targetStatuses.resize( activeWellPathTargets.size(), - { !activeWellPathTargets[0].isTangentConstrained, - 0.0, + { 0.0, 0.0, false, true, @@ -58,8 +57,7 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& } m_targetStatuses.resize( activeWellPathTargets.size(), - { false, - 0.0, + { 0.0, 0.0, false, false, @@ -76,20 +74,22 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& { for ( size_t tIdx = 0; tIdx < activeWellPathTargets.size() - 2; ++tIdx ) { - if ( !activeWellPathTargets[tIdx + 1].isTangentConstrained ) - { - cvf::Vec3d tangent = smootheningTargetTangent( activeWellPathTargets[tIdx].targetPointXYZ, - activeWellPathTargets[tIdx + 1].targetPointXYZ, - activeWellPathTargets[tIdx + 2].targetPointXYZ ); - RiaOffshoreSphericalCoords tangentSphCS( tangent ); - adjustedWellPathTargets[tIdx + 1].azimuth = tangentSphCS.azi(); - adjustedWellPathTargets[tIdx + 1].inclination = tangentSphCS.inc(); - adjustedWellPathTargets[tIdx + 1].isTangentConstrained = true; - - m_targetStatuses[tIdx + 1].hasDerivedTangent = true; - m_targetStatuses[tIdx + 1].resultAzimuth = tangentSphCS.azi(); - m_targetStatuses[tIdx + 1].resultInclination = tangentSphCS.inc(); - } + cvf::Vec3d tangent = smootheningTargetTangent( activeWellPathTargets[tIdx].targetPointXYZ, + activeWellPathTargets[tIdx + 1].targetPointXYZ, + activeWellPathTargets[tIdx + 2].targetPointXYZ ); + + RiaOffshoreSphericalCoords tangentSphCS( tangent ); + if ( !adjustedWellPathTargets[tIdx + 1].isAzimuthConstrained ) + adjustedWellPathTargets[tIdx + 1].azimuthRadians = tangentSphCS.azi(); + + if ( !adjustedWellPathTargets[tIdx + 1].isInclinationConstrained ) + adjustedWellPathTargets[tIdx + 1].inclinationRadians = tangentSphCS.inc(); + + adjustedWellPathTargets[tIdx + 1].isAzimuthConstrained = true; + adjustedWellPathTargets[tIdx + 1].isInclinationConstrained = true; + + m_targetStatuses[tIdx + 1].resultAzimuthRadians = adjustedWellPathTargets[tIdx + 1].azimuthRadians; + m_targetStatuses[tIdx + 1].resultInclinationRadians = adjustedWellPathTargets[tIdx + 1].inclinationRadians; } } @@ -100,7 +100,7 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& size_t startSSegmentIdx = 0; size_t endSSegementIdx = activeWellPathTargets.size() - 1; - if ( !adjustedWellPathTargets[0].isTangentConstrained ) + if ( !adjustedWellPathTargets[0].isAnyDirectionFixed() ) { startSSegmentIdx = 1; @@ -109,13 +109,13 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& WellTargetStatus& target1Status = m_targetStatuses[0]; WellTargetStatus& target2Status = m_targetStatuses[1]; - if ( adjustedWellPathTargets[1].isTangentConstrained ) + if ( adjustedWellPathTargets[1].isAnyDirectionFixed() ) { // Create an upside down J curve from target 2 back to 1 RiaJCurveCalculator jCurve( target2.targetPointXYZ, - target2.azimuth + M_PI, - M_PI - target2.inclination, + target2.azimuthRadians + M_PI, + M_PI - target2.inclinationRadians, target2.radius1, target1.targetPointXYZ ); @@ -126,14 +126,13 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& else if ( jCurve.curveStatus() == RiaJCurveCalculator::FAILED_RADIUS_TOO_LARGE ) { target2Status.hasOverriddenRadius1 = true; - target2Status.resultRadius1 = jCurve.radius(); } + target2Status.resultRadius1 = jCurve.radius(); m_lineArcEndpoints.push_back( target2.targetPointXYZ + referencePointXyz ); - target1Status.hasDerivedTangent = true; - target1Status.resultAzimuth = jCurve.endAzimuth() + M_PI; - target1Status.resultInclination = M_PI - jCurve.endInclination(); + target1Status.resultAzimuthRadians = jCurve.endAzimuth() + M_PI; + target1Status.resultInclinationRadians = M_PI - jCurve.endInclination(); target2Status.isRadius1Editable = true; } @@ -143,25 +142,23 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& cvf::Vec3d t12 = target2.targetPointXYZ - target1.targetPointXYZ; RiaOffshoreSphericalCoords t12Sph( t12 ); - target1Status.hasDerivedTangent = true; - target1Status.resultAzimuth = t12Sph.azi(); - target1Status.resultInclination = t12Sph.inc(); + target1Status.resultAzimuthRadians = t12Sph.azi(); + target1Status.resultInclinationRadians = t12Sph.inc(); - target2Status.hasDerivedTangent = true; - target2Status.resultAzimuth = t12Sph.azi(); - target2Status.resultInclination = t12Sph.inc(); + target2Status.resultAzimuthRadians = t12Sph.azi(); + target2Status.resultInclinationRadians = t12Sph.inc(); } - m_startTangent = RiaOffshoreSphericalCoords::unitVectorFromAziInc( target1Status.resultAzimuth, - target1Status.resultInclination ); + m_startTangent = RiaOffshoreSphericalCoords::unitVectorFromAziInc( target1Status.resultAzimuthRadians, + target1Status.resultInclinationRadians ); } else { - m_startTangent = RiaOffshoreSphericalCoords::unitVectorFromAziInc( activeWellPathTargets[0].azimuth, - activeWellPathTargets[0].inclination ); + m_startTangent = RiaOffshoreSphericalCoords::unitVectorFromAziInc( activeWellPathTargets[0].azimuthRadians, + activeWellPathTargets[0].inclinationRadians ); } - if ( !adjustedWellPathTargets.back().isTangentConstrained ) + if ( !adjustedWellPathTargets.back().isAnyDirectionFixed() ) { endSSegementIdx -= 1; } @@ -180,45 +177,44 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& // Ignore targets in the same place if ( ( target1.targetPointXYZ - target2.targetPointXYZ ).length() < 1e-6 ) continue; - if ( target1.isTangentConstrained && target2.isTangentConstrained ) + if ( target1.isAnyDirectionFixed() && target2.isAnyDirectionFixed() ) { RiaSCurveCalculator sCurveCalc( target1.targetPointXYZ, - target1.azimuth, - target1.inclination, + target1.azimuthRadians, + target1.inclinationRadians, target1.radius2, target2.targetPointXYZ, - target2.azimuth, - target2.inclination, + target2.azimuthRadians, + target2.inclinationRadians, target2.radius1 ); if ( sCurveCalc.solveStatus() != RiaSCurveCalculator::CONVERGED ) { double p1p2Length = ( target2.targetPointXYZ - target1.targetPointXYZ ).length(); sCurveCalc = RiaSCurveCalculator::fromTangentsAndLength( target1.targetPointXYZ, - target1.azimuth, - target1.inclination, + target1.azimuthRadians, + target1.inclinationRadians, 0.2 * p1p2Length, target2.targetPointXYZ, - target2.azimuth, - target2.inclination, + target2.azimuthRadians, + target2.inclinationRadians, 0.2 * p1p2Length ); // RiaLogging::warning("Using fall-back calculation of well path geometry between active target // number: " + QString::number(tIdx+1) + " and " + QString::number(tIdx+2)); target1Status.hasOverriddenRadius2 = true; - target1Status.resultRadius2 = sCurveCalc.firstRadius(); - target2Status.hasOverriddenRadius1 = true; - target2Status.resultRadius1 = sCurveCalc.secondRadius(); } + target2Status.resultRadius1 = sCurveCalc.secondRadius(); + target1Status.resultRadius2 = sCurveCalc.firstRadius(); + target2Status.isRadius1Editable = true; + target1Status.isRadius2Editable = true; + m_lineArcEndpoints.push_back( sCurveCalc.firstArcEndpoint() + referencePointXyz ); m_lineArcEndpoints.push_back( sCurveCalc.secondArcStartpoint() + referencePointXyz ); m_lineArcEndpoints.push_back( target2.targetPointXYZ + referencePointXyz ); - - target1Status.isRadius2Editable = true; - target2Status.isRadius1Editable = true; } } } @@ -236,8 +232,8 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& // Create an ordinary J curve RiaJCurveCalculator jCurve( target1.targetPointXYZ, - target1.azimuth, - target1.inclination, + target1.azimuthRadians, + target1.inclinationRadians, target1.radius2, target2.targetPointXYZ ); @@ -248,16 +244,15 @@ RiaLineArcWellPathCalculator::RiaLineArcWellPathCalculator( const cvf::Vec3d& else if ( jCurve.curveStatus() == RiaJCurveCalculator::FAILED_RADIUS_TOO_LARGE ) { target1Status.hasOverriddenRadius2 = true; - target1Status.resultRadius2 = jCurve.radius(); } - m_lineArcEndpoints.push_back( target2.targetPointXYZ + referencePointXyz ); - + target1Status.resultRadius2 = jCurve.radius(); target1Status.isRadius2Editable = true; - target2Status.hasDerivedTangent = true; - target2Status.resultAzimuth = jCurve.endAzimuth(); - target2Status.resultInclination = jCurve.endInclination(); + m_lineArcEndpoints.push_back( target2.targetPointXYZ + referencePointXyz ); + + target2Status.resultAzimuthRadians = jCurve.endAzimuth(); + target2Status.resultInclinationRadians = jCurve.endInclination(); } } diff --git a/ApplicationLibCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.h b/ApplicationLibCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.h index c5a8cdaf77..b9411aa3a0 100644 --- a/ApplicationLibCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.h +++ b/ApplicationLibCode/Application/Tools/WellPathTools/RiaLineArcWellPathCalculator.h @@ -27,10 +27,13 @@ class RiaLineArcWellPathCalculator public: struct WellTarget { + bool isAnyDirectionFixed() const { return isAzimuthConstrained || isInclinationConstrained; } + cvf::Vec3d targetPointXYZ; - bool isTangentConstrained; - double azimuth; - double inclination; + bool isAzimuthConstrained; + bool isInclinationConstrained; + double azimuthRadians; + double inclinationRadians; double radius1; double radius2; @@ -41,9 +44,8 @@ class RiaLineArcWellPathCalculator struct WellTargetStatus { - bool hasDerivedTangent; - double resultAzimuth; - double resultInclination; + double resultAzimuthRadians; + double resultInclinationRadians; bool isRadius1Editable; bool hasOverriddenRadius1; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp index b52498c1fc..ff745c628d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp @@ -624,28 +624,16 @@ RiaLineArcWellPathCalculator RimWellPathGeometryDef::lineArcWellPathCalculator() for ( size_t tIdx = 0; tIdx < activeTargets.size(); ++tIdx ) { - activeTargets[tIdx]->flagRadius1AsIncorrect( targetStatuses[tIdx].isRadius1Editable, false, 0 ); - activeTargets[tIdx]->flagRadius2AsIncorrect( targetStatuses[tIdx].isRadius2Editable, false, 0 ); + activeTargets[tIdx]->setDerivedTangent( targetStatuses[tIdx].resultAzimuthRadians, + targetStatuses[tIdx].resultInclinationRadians ); - if ( targetStatuses[tIdx].hasDerivedTangent ) - { - activeTargets[tIdx]->setDerivedTangent( targetStatuses[tIdx].resultAzimuth, - targetStatuses[tIdx].resultInclination ); - } + activeTargets[tIdx]->setRadius1Data( targetStatuses[tIdx].isRadius1Editable, + targetStatuses[tIdx].hasOverriddenRadius1, + targetStatuses[tIdx].resultRadius1 ); - if ( targetStatuses[tIdx].hasOverriddenRadius1 ) - { - activeTargets[tIdx]->flagRadius1AsIncorrect( targetStatuses[tIdx].isRadius1Editable, - true, - targetStatuses[tIdx].resultRadius1 ); - } - - if ( targetStatuses[tIdx].hasOverriddenRadius2 ) - { - activeTargets[tIdx]->flagRadius2AsIncorrect( targetStatuses[tIdx].isRadius2Editable, - true, - targetStatuses[tIdx].resultRadius2 ); - } + activeTargets[tIdx]->setRadius2Data( targetStatuses[tIdx].isRadius2Editable, + targetStatuses[tIdx].hasOverriddenRadius2, + targetStatuses[tIdx].resultRadius2 ); } return wellPathCalculator; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp index a38ca15cfa..571cf151c9 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.cpp @@ -23,6 +23,7 @@ #include "RigWellPath.h" #include "RimModeledWellPath.h" +#include "RimProject.h" #include "RimWellPath.h" #include "RimWellPathGeometryDef.h" @@ -51,10 +52,6 @@ void caf::AppEnum::setUp() //-------------------------------------------------------------------------------------------------- RimWellPathTarget::RimWellPathTarget() : moved( this ) - , m_targetType( TargetTypeEnum::POINT ) - , m_targetPointXYD( cvf::Vec3d::ZERO ) - , m_azimuth( 0.0 ) - , m_inclination( 0.0 ) , m_isFullUpdateEnabled( true ) { CAF_PDM_InitScriptableObjectWithNameAndComment( "Well Target", @@ -65,8 +62,6 @@ RimWellPathTarget::RimWellPathTarget() "Class containing the Well Target definition" ); CAF_PDM_InitField( &m_isEnabled, "IsEnabled", true, "" ); - CAF_PDM_InitField( &m_isLocked, "IsLocked", false, "" ); - m_isLocked.uiCapability()->setUiHidden( true ); CAF_PDM_InitScriptableFieldNoDefault( &m_targetPointXYD, "TargetPoint", "Relative Coord" ); CAF_PDM_InitFieldNoDefault( &m_targetPointForDisplay, "TargetPointForDisplay", "UTM Coord" ); @@ -79,13 +74,28 @@ RimWellPathTarget::RimWellPathTarget() CAF_PDM_InitScriptableField( &m_dogleg1, "Dogleg1", 3.0, "DL in", "", "[deg/30m]", "" ); CAF_PDM_InitScriptableField( &m_dogleg2, "Dogleg2", 3.0, "DL out", "", "[deg/30m]", "" ); - CAF_PDM_InitFieldNoDefault( &m_targetType, "TargetType", "Type" ); - m_targetType.uiCapability()->setUiHidden( true ); + CAF_PDM_InitScriptableField( &m_useFixedAzimuth, "UseFixedAzimuth", false, "Azi" ); + CAF_PDM_InitScriptableField( &m_azimuthDeg, "Azimuth", 0.0, "Azi(deg)" ); - CAF_PDM_InitField( &m_hasTangentConstraintUiField, "HasTangentConstraint", false, "Dir" ); - m_hasTangentConstraintUiField.xmlCapability()->disableIO(); - CAF_PDM_InitScriptableField( &m_azimuth, "Azimuth", 0.0, "Azi(deg)" ); - CAF_PDM_InitScriptableField( &m_inclination, "Inclination", 0.0, "Inc(deg)" ); + CAF_PDM_InitScriptableField( &m_useFixedInclination, "UseFixedInclination", false, "Inc" ); + CAF_PDM_InitScriptableField( &m_inclinationDeg, "Inclination", 0.0, "Inc(deg)" ); + + CAF_PDM_InitScriptableField( &m_estimatedDogleg1, "EstimatedDogleg1", 0.0, "Est DL in", "", "[deg/30m]", "" ); + m_estimatedDogleg1.uiCapability()->setUiReadOnly( true ); + CAF_PDM_InitScriptableField( &m_estimatedDogleg2, "EstimatedDogleg2", 0.0, "Est DL out", "", "[deg/30m]", "" ); + m_estimatedDogleg2.uiCapability()->setUiReadOnly( true ); + CAF_PDM_InitScriptableField( &m_estimatedAzimuthDeg, "EstimatedAzimuth", 0.0, "Est Azi(deg)" ); + m_estimatedAzimuthDeg.uiCapability()->setUiReadOnly( true ); + CAF_PDM_InitScriptableField( &m_estimatedInclinationDeg, "EstimatedInclination", 0.0, "Est Inc(deg)" ); + m_estimatedInclinationDeg.uiCapability()->setUiReadOnly( true ); + + CAF_PDM_InitFieldNoDefault( &m_targetType_OBSOLETE, "TargetType", "Type" ); + m_targetType_OBSOLETE.uiCapability()->setUiHidden( true ); + m_targetType_OBSOLETE.xmlCapability()->setIOWritable( false ); + + CAF_PDM_InitField( &m_hasTangentConstraintUiField_OBSOLETE, "HasTangentConstraint", false, "Dir" ); + m_hasTangentConstraintUiField_OBSOLETE.xmlCapability()->setIOWritable( false ); + m_hasTangentConstraintUiField_OBSOLETE.uiCapability()->setUiHidden( true ); } //-------------------------------------------------------------------------------------------------- @@ -124,10 +134,12 @@ void RimWellPathTarget::setPointXYZ( const cvf::Vec3d& point ) //-------------------------------------------------------------------------------------------------- void RimWellPathTarget::setAsPointTargetXYD( const cvf::Vec3d& point ) { - m_targetType = TargetTypeEnum::POINT; m_targetPointXYD = point; - m_azimuth = 0.0; - m_inclination = 0.0; + + m_useFixedAzimuth = false; + m_useFixedInclination = false; + m_azimuthDeg = 0.0; + m_inclinationDeg = 0.0; } //-------------------------------------------------------------------------------------------------- @@ -135,10 +147,12 @@ void RimWellPathTarget::setAsPointTargetXYD( const cvf::Vec3d& point ) //-------------------------------------------------------------------------------------------------- void RimWellPathTarget::setAsPointTargetXYZ( const cvf::Vec3d& point ) { - m_targetType = TargetTypeEnum::POINT; m_targetPointXYD = cvf::Vec3d( point.x(), point.y(), -point.z() ); - m_azimuth = 0.0; - m_inclination = 0.0; + + m_useFixedAzimuth = false; + m_useFixedInclination = false; + m_azimuthDeg = 0.0; + m_inclinationDeg = 0.0; } //-------------------------------------------------------------------------------------------------- @@ -153,24 +167,46 @@ void RimWellPathTarget::setAsPointXYZAndTangentTarget( const cvf::Vec3d& point, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPathTarget::setAsPointXYZAndTangentTarget( const cvf::Vec3d& point, double azimuth, double inclination ) +void RimWellPathTarget::setAsPointXYZAndTangentTarget( const cvf::Vec3d& point, double azimuthRadians, double inclinationRadians ) { - m_targetType = TargetTypeEnum::POINT_AND_TANGENT; + m_targetType_OBSOLETE = TargetTypeEnum::POINT_AND_TANGENT; + m_targetPointXYD = cvf::Vec3d( point.x(), point.y(), -point.z() ); - m_azimuth = cvf::Math::toDegrees( azimuth ); - m_inclination = cvf::Math::toDegrees( inclination ); + + m_useFixedAzimuth = true; + m_useFixedInclination = true; + m_azimuthDeg = cvf::Math::toDegrees( azimuthRadians ); + m_inclinationDeg = cvf::Math::toDegrees( inclinationRadians ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPathTarget::setDerivedTangent( double azimuth, double inclination ) +void RimWellPathTarget::setFixedAzimuth( double fixedAzimuthDeg ) { - if ( m_targetType == TargetTypeEnum::POINT ) - { - m_azimuth = cvf::Math::toDegrees( azimuth ); - m_inclination = cvf::Math::toDegrees( inclination ); - } + m_useFixedAzimuth = true; + m_azimuthDeg = fixedAzimuthDeg; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathTarget::setFixedInclination( double fixedInclinationDeg ) +{ + m_useFixedInclination = true; + m_inclinationDeg = fixedInclinationDeg; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathTarget::setDerivedTangent( double azimuthRadians, double inclinationRadians ) +{ + m_estimatedAzimuthDeg = cvf::Math::toDegrees( azimuthRadians ); + m_estimatedInclinationDeg = cvf::Math::toDegrees( inclinationRadians ); + + if ( !m_useFixedAzimuth ) m_azimuthDeg = cvf::Math::toDegrees( azimuthRadians ); + if ( !m_useFixedInclination ) m_inclinationDeg = cvf::Math::toDegrees( inclinationRadians ); } //-------------------------------------------------------------------------------------------------- @@ -190,24 +226,17 @@ RiaLineArcWellPathCalculator::WellTarget RimWellPathTarget::wellTargetData() { RiaLineArcWellPathCalculator::WellTarget targetData; - targetData.targetPointXYZ = targetPointXYZ(); - targetData.isTangentConstrained = ( targetType() == TargetTypeEnum::POINT_AND_TANGENT ); - targetData.azimuth = azimuth(); - targetData.inclination = inclination(); - targetData.radius1 = radius1(); - targetData.radius2 = radius2(); + targetData.targetPointXYZ = targetPointXYZ(); + targetData.isAzimuthConstrained = m_useFixedAzimuth(); + targetData.isInclinationConstrained = m_useFixedInclination(); + targetData.azimuthRadians = azimuthRadians(); + targetData.inclinationRadians = inclinationRadians(); + targetData.radius1 = radius1(); + targetData.radius2 = radius2(); return targetData; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimWellPathTarget::TargetTypeEnum RimWellPathTarget::targetType() const -{ - return m_targetType(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -221,11 +250,11 @@ cvf::Vec3d RimWellPathTarget::targetPointXYZ() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RimWellPathTarget::azimuth() const +double RimWellPathTarget::azimuthRadians() const { - if ( m_targetType() == TargetTypeEnum::POINT_AND_TANGENT ) + if ( m_useFixedAzimuth() ) { - return cvf::Math::toRadians( m_azimuth ); + return cvf::Math::toRadians( m_azimuthDeg ); } return std::numeric_limits::infinity(); @@ -234,11 +263,11 @@ double RimWellPathTarget::azimuth() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -double RimWellPathTarget::inclination() const +double RimWellPathTarget::inclinationRadians() const { - if ( m_targetType() == TargetTypeEnum::POINT_AND_TANGENT ) + if ( m_useFixedInclination() ) { - return cvf::Math::toRadians( m_inclination ); + return cvf::Math::toRadians( m_inclinationDeg ); } return std::numeric_limits::infinity(); @@ -249,8 +278,8 @@ double RimWellPathTarget::inclination() const //-------------------------------------------------------------------------------------------------- cvf::Vec3d RimWellPathTarget::tangent() const { - double aziRad = cvf::Math::toRadians( m_azimuth ); - double incRad = cvf::Math::toRadians( m_inclination ); + double aziRad = cvf::Math::toRadians( m_azimuthDeg ); + double incRad = cvf::Math::toRadians( m_inclinationDeg ); return RiaOffshoreSphericalCoords::unitVectorFromAziInc( aziRad, incRad ); } @@ -294,21 +323,23 @@ double doglegFromRadius( double radius ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPathTarget::flagRadius1AsIncorrect( bool isEditable, bool isIncorrect, double actualRadius ) +void RimWellPathTarget::setRadius1Data( bool isEditable, bool isIncorrect, double actualRadius ) { + double estimatedDogLeg = doglegFromRadius( actualRadius ); + m_estimatedDogleg1 = estimatedDogLeg; + if ( isIncorrect ) { if ( actualRadius < radius1() ) { m_dogleg1.uiCapability()->setUiContentTextColor( Qt::red ); - m_dogleg1.uiCapability()->setUiToolTip( "Actual Dogleg: " + QString::number( doglegFromRadius( actualRadius ) ) + + m_dogleg1.uiCapability()->setUiToolTip( "Actual Dogleg: " + QString::number( estimatedDogLeg ) + "\nThe dogleg constraint is not satisfied!" ); } else { m_dogleg1.uiCapability()->setUiContentTextColor( Qt::darkGreen ); - m_dogleg1.uiCapability()->setUiToolTip( "Actual Dogleg: " + - QString::number( doglegFromRadius( actualRadius ) ) ); + m_dogleg1.uiCapability()->setUiToolTip( "Actual Dogleg: " + QString::number( estimatedDogLeg ) ); } } else @@ -323,21 +354,23 @@ void RimWellPathTarget::flagRadius1AsIncorrect( bool isEditable, bool isIncorrec //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPathTarget::flagRadius2AsIncorrect( bool isEditable, bool isIncorrect, double actualRadius ) +void RimWellPathTarget::setRadius2Data( bool isEditable, bool isIncorrect, double actualRadius ) { + double estimatedDogLeg = doglegFromRadius( actualRadius ); + m_estimatedDogleg2 = estimatedDogLeg; + if ( isIncorrect ) { if ( actualRadius < radius2() ) { m_dogleg2.uiCapability()->setUiContentTextColor( Qt::red ); - m_dogleg2.uiCapability()->setUiToolTip( "Actual Dogleg: " + QString::number( doglegFromRadius( actualRadius ) ) + + m_dogleg2.uiCapability()->setUiToolTip( "Actual Dogleg: " + QString::number( estimatedDogLeg ) + "\nThe dogleg constraint is not satisfied!" ); } else { m_dogleg2.uiCapability()->setUiContentTextColor( Qt::darkGreen ); - m_dogleg2.uiCapability()->setUiToolTip( "Actual Dogleg: " + - QString::number( doglegFromRadius( actualRadius ) ) ); + m_dogleg2.uiCapability()->setUiToolTip( "Actual Dogleg: " + QString::number( estimatedDogLeg ) ); } } else @@ -354,7 +387,7 @@ void RimWellPathTarget::flagRadius2AsIncorrect( bool isEditable, bool isIncorrec //-------------------------------------------------------------------------------------------------- std::vector RimWellPathTarget::fieldsFor3dManipulator() { - return { &m_targetType, &m_targetPointXYD, &m_azimuth, &m_inclination }; + return { &m_targetPointXYD, &m_azimuthDeg, &m_inclinationDeg }; } //-------------------------------------------------------------------------------------------------- @@ -373,6 +406,21 @@ void RimWellPathTarget::enableFullUpdate( bool enable ) m_isFullUpdateEnabled = enable; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathTarget::initAfterRead() +{ + if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2021.10.2" ) ) + { + if ( m_targetType_OBSOLETE() == RimWellPathTarget::TargetTypeEnum::POINT_AND_TANGENT ) + { + m_useFixedAzimuth = true; + m_useFixedInclination = true; + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -473,27 +521,6 @@ RimWellPathGeometryDef* RimWellPathTarget::geometryDefinition() const return geoDef; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QList RimWellPathTarget::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) -{ - QList options; - if ( fieldNeedingOptions == &m_targetType ) - { - options.push_back( - caf::PdmOptionItemInfo( "o->", - RimWellPathTarget::TargetTypeEnum::POINT_AND_TANGENT ) ); //, false, - // QIcon(":/WellTargetPointTangent16x16.png") - //)); - options.push_back( - caf::PdmOptionItemInfo( "o", RimWellPathTarget::TargetTypeEnum::POINT ) ); //, false, - // QIcon(":/WellTargetPoint16x16.png"))); - } - return options; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -501,14 +528,6 @@ void RimWellPathTarget::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel const QVariant& oldValue, const QVariant& newValue ) { - if ( changedField == &m_hasTangentConstraintUiField ) - { - if ( m_hasTangentConstraintUiField ) - m_targetType = TargetTypeEnum::POINT_AND_TANGENT; - else - m_targetType = TargetTypeEnum::POINT; - } - moved.send( m_isFullUpdateEnabled ); } @@ -517,39 +536,20 @@ void RimWellPathTarget::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel //-------------------------------------------------------------------------------------------------- void RimWellPathTarget::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - m_hasTangentConstraintUiField = ( m_targetType == TargetTypeEnum::POINT_AND_TANGENT ); - - if ( m_isEnabled() && !m_isLocked() ) + if ( m_isEnabled() ) { - m_hasTangentConstraintUiField.uiCapability()->setUiReadOnly( false ); - m_targetType.uiCapability()->setUiReadOnly( false ); m_targetPointXYD.uiCapability()->setUiReadOnly( false ); - if ( m_targetType == TargetTypeEnum::POINT ) - { - m_azimuth.uiCapability()->setUiReadOnly( true ); - m_inclination.uiCapability()->setUiReadOnly( true ); - } - else - { - m_azimuth.uiCapability()->setUiReadOnly( false ); - m_inclination.uiCapability()->setUiReadOnly( false ); - } + m_azimuthDeg.uiCapability()->setUiReadOnly( !m_useFixedAzimuth() ); + m_inclinationDeg.uiCapability()->setUiReadOnly( !m_useFixedInclination() ); } else { m_dogleg1.uiCapability()->setUiReadOnly( true ); - m_targetType.uiCapability()->setUiReadOnly( true ); m_targetPointXYD.uiCapability()->setUiReadOnly( true ); - m_azimuth.uiCapability()->setUiReadOnly( true ); - m_inclination.uiCapability()->setUiReadOnly( true ); + m_azimuthDeg.uiCapability()->setUiReadOnly( true ); + m_inclinationDeg.uiCapability()->setUiReadOnly( true ); m_dogleg2.uiCapability()->setUiReadOnly( true ); - m_hasTangentConstraintUiField.uiCapability()->setUiReadOnly( true ); - } - - if ( m_isLocked ) - { - m_isEnabled.uiCapability()->setUiReadOnly( true ); } { diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.h index f383e91e73..288ce09111 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTarget.h @@ -48,8 +48,10 @@ class RimWellPathTarget : public caf::PdmObject void setAsPointTargetXYD( const cvf::Vec3d& point ); void setAsPointTargetXYZ( const cvf::Vec3d& point ); void setAsPointXYZAndTangentTarget( const cvf::Vec3d& point, const cvf::Vec3d& tangent ); - void setAsPointXYZAndTangentTarget( const cvf::Vec3d& point, double azimuth, double inclination ); - void setDerivedTangent( double azimuth, double inclination ); + void setAsPointXYZAndTangentTarget( const cvf::Vec3d& point, double azimuthRadians, double inclinationRadians ); + void setFixedAzimuth( double fixedAzimuthDeg ); + void setFixedInclination( double fixedInclinationDeg ); + void setDerivedTangent( double azimuthRadians, double inclinationRadians ); void updateFrom3DManipulator( const cvf::Vec3d& pointXYD ); RiaLineArcWellPathCalculator::WellTarget wellTargetData(); @@ -60,48 +62,53 @@ class RimWellPathTarget : public caf::PdmObject POINT }; - TargetTypeEnum targetType() const; - cvf::Vec3d targetPointXYZ() const; - double azimuth() const; - double inclination() const; - cvf::Vec3d tangent() const; - double radius1() const; - double radius2() const; - void flagRadius1AsIncorrect( bool isEditable, bool isIncorrect, double actualRadius ); - void flagRadius2AsIncorrect( bool isEditable, bool isIncorrect, double actualRadius ); + cvf::Vec3d targetPointXYZ() const; + double azimuthRadians() const; + double inclinationRadians() const; + cvf::Vec3d tangent() const; + double radius1() const; + double radius2() const; + void setRadius1Data( bool isEditable, bool isIncorrect, double actualRadius ); + void setRadius2Data( bool isEditable, bool isIncorrect, double actualRadius ); std::vector fieldsFor3dManipulator(); void onMoved(); private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - void defineEditorAttribute( const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute ) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; + void initAfterRead() override; cvf::Vec3d targetPointForDisplayXYD() const; void setTargetPointFromDisplayCoord( const cvf::Vec3d& coordInXYZ ); double measuredDepth() const; RimWellPathGeometryDef* geometryDefinition() const; + void enableFullUpdate( bool enable ); private: - void enableFullUpdate( bool enable ); - bool m_isFullUpdateEnabled; - caf::PdmField m_isEnabled; - caf::PdmField m_isLocked; - caf::PdmField> m_targetType; - caf::PdmField m_targetPointXYD; - caf::PdmProxyValueField m_targetPointForDisplay; - caf::PdmProxyValueField m_targetMeasuredDepth; - - caf::PdmField m_azimuth; - caf::PdmField m_inclination; + caf::PdmField m_isEnabled; + caf::PdmField m_targetPointXYD; + caf::PdmProxyValueField m_targetPointForDisplay; + caf::PdmProxyValueField m_targetMeasuredDepth; + + caf::PdmField m_azimuthDeg; + caf::PdmField m_inclinationDeg; caf::PdmField m_dogleg1; caf::PdmField m_dogleg2; - caf::PdmField m_hasTangentConstraintUiField; + caf::PdmField m_useFixedAzimuth; + caf::PdmField m_useFixedInclination; + + caf::PdmField m_estimatedDogleg1; + caf::PdmField m_estimatedDogleg2; + caf::PdmField m_estimatedAzimuthDeg; + caf::PdmField m_estimatedInclinationDeg; + + bool m_isFullUpdateEnabled; + caf::PdmField m_hasTangentConstraintUiField_OBSOLETE; + caf::PdmField> m_targetType_OBSOLETE; }; diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathGeometryDef.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathGeometryDef.cpp index 98db4c9822..e179dbf81e 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathGeometryDef.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathGeometryDef.cpp @@ -40,6 +40,11 @@ RimcRimWellPathGeometryDef_appendNewWellTarget::RimcRimWellPathGeometryDef_appen CAF_PDM_InitObject( "Create and Add New Well Target", "", "", "Create and Add New Well Target" ); CAF_PDM_InitScriptableFieldNoDefault( &m_coordinate, "Coordinate", "", "", "", "Coordinate" ); CAF_PDM_InitScriptableField( &m_isAbsolute, "Absolute", false, "", "", "", "Relative or Absolute Coordinate" ); + + CAF_PDM_InitScriptableField( &m_useFixedAzimuth, "UseFixedAzimuth", false, "" ); + CAF_PDM_InitScriptableField( &m_useFixedInclination, "UseFixedInclination", false, "" ); + CAF_PDM_InitScriptableField( &m_fixedAzimuthValue, "FixedAzimuthValue", 0.0, "", "", "", "[Degrees]" ); + CAF_PDM_InitScriptableField( &m_fixedInclinationValue, "FixedInclinationValue", 0.0, "", "", "", "[Degrees]" ); } //-------------------------------------------------------------------------------------------------- @@ -60,6 +65,17 @@ caf::PdmObjectHandle* RimcRimWellPathGeometryDef_appendNewWellTarget::execute() auto newTarget = new RimWellPathTarget; newTarget->setAsPointTargetXYD( cvf::Vec3d( relativeTargetPoint.x(), relativeTargetPoint.y(), -relativeTargetPoint.z() ) ); + + if ( m_useFixedAzimuth ) + { + newTarget->setFixedAzimuth( m_fixedAzimuthValue ); + } + + if ( m_useFixedInclination ) + { + newTarget->setFixedInclination( m_fixedInclinationValue ); + } + geoDef->insertTarget( nullptr, newTarget ); geoDef->updateConnectedEditors(); diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathGeometryDef.h b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathGeometryDef.h index b22ad820e0..18b7058d64 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathGeometryDef.h +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPathGeometryDef.h @@ -43,4 +43,9 @@ class RimcRimWellPathGeometryDef_appendNewWellTarget : public caf::PdmObjectMeth private: caf::PdmField m_coordinate; caf::PdmField m_isAbsolute; + + caf::PdmField m_useFixedAzimuth; + caf::PdmField m_fixedAzimuthValue; + caf::PdmField m_useFixedInclination; + caf::PdmField m_fixedInclinationValue; }; diff --git a/GrpcInterface/Python/rips/PythonExamples/create_intersection.py b/GrpcInterface/Python/rips/PythonExamples/create_intersection.py index 7a4aa786bf..aa6b74d7f9 100644 --- a/GrpcInterface/Python/rips/PythonExamples/create_intersection.py +++ b/GrpcInterface/Python/rips/PythonExamples/create_intersection.py @@ -41,14 +41,33 @@ coord = [0, 0, 0] geometry.append_well_target(coord) -# Append new well targets relative the the reference point +# Append well target with fixed azimuth coord = [2229.10, -833.74, -74.70] -target = geometry.append_well_target(coord) +target = geometry.append_well_target( + coord, use_fixed_azimuth=True, fixed_azimuth_value=45.1 +) + +# Append well target with fixed inclination +coord = [3403.15, -1938.61, -80.93] +target = geometry.append_well_target( + coord, use_fixed_inclination=True, fixed_inclination_value=115.2 +) coord = [4577.21, -3043.47, -87.15] target = geometry.append_well_target(coord) geometry.update() +# Read out estimated dogleg and azimuth/inclination for well targets +for w in geometry.well_path_targets(): + print( + "DL1:{} DL2:{} Azi: {} Incl: {}".format( + w.estimated_dogleg1, + w.estimated_dogleg2, + w.estimated_azimuth, + w.estimated_inclination, + ) + ) + # Add a curve intersection based on the modeled well path well_path_intersection = intersection_coll.add_new_object(rips.CurveIntersection) well_path_intersection.type = "CS_WELL_PATH" diff --git a/GrpcInterface/Python/rips/tests/create_well_path.py b/GrpcInterface/Python/rips/tests/create_well_path.py deleted file mode 100644 index 41206b7174..0000000000 --- a/GrpcInterface/Python/rips/tests/create_well_path.py +++ /dev/null @@ -1,35 +0,0 @@ -from rips.generated.generated_classes import ( - ModeledWellPath, - StimPlanModel, - WellPathGeometry, - WellPathTarget, -) -import sys -import os - -sys.path.insert(1, os.path.join(sys.path[0], "../../")) -import rips - - -def test_well_path_target(rips_instance, initialize_test): - well_path_coll = rips_instance.project.descendants(rips.WellPathCollection)[0] - - my_well_path = well_path_coll.add_new_object(rips.ModeledWellPath) - my_well_path.name = "test" - my_well_path.update() - - geometry = my_well_path.well_path_geometry() - geometry.add_new_object(rips.WellPathTarget) - geometry.add_new_object(rips.WellPathTarget) - geometry.add_new_object(rips.WellPathTarget) - assert len(geometry.well_path_targets()) == 3 - - assert len(well_path_coll.well_paths()) == 1 - my_well_path_duplicate = well_path_coll.well_paths()[0] - assert my_well_path_duplicate.name == "test" - geometry_duplicate = my_well_path_duplicate.well_path_geometry() - assert len(geometry_duplicate.well_path_targets()) == 3 - - # Not allowed to add object of unrelated type - invalid_object = geometry.add_new_object(rips.WellPath) - assert invalid_object is None diff --git a/GrpcInterface/Python/rips/tests/test_create_well_path.py b/GrpcInterface/Python/rips/tests/test_create_well_path.py new file mode 100644 index 0000000000..2cc866e05e --- /dev/null +++ b/GrpcInterface/Python/rips/tests/test_create_well_path.py @@ -0,0 +1,66 @@ +from rips.generated.generated_classes import ( + ModeledWellPath, + StimPlanModel, + WellPathGeometry, + WellPathTarget, +) +import sys +import os + +sys.path.insert(1, os.path.join(sys.path[0], "../../")) +import rips + + +def test_add_new_object_for_well_paths(rips_instance, initialize_test): + well_path_coll = rips_instance.project.descendants(rips.WellPathCollection)[0] + + my_well_path = well_path_coll.add_new_object(rips.ModeledWellPath) + my_well_path.name = "test" + my_well_path.update() + + geometry = my_well_path.well_path_geometry() + geometry.add_new_object(rips.WellPathTarget) + geometry.add_new_object(rips.WellPathTarget) + geometry.add_new_object(rips.WellPathTarget) + assert len(geometry.well_path_targets()) == 3 + + assert len(well_path_coll.well_paths()) == 1 + my_well_path_duplicate = well_path_coll.well_paths()[0] + assert my_well_path_duplicate.name == "test" + geometry_duplicate = my_well_path_duplicate.well_path_geometry() + assert len(geometry_duplicate.well_path_targets()) == 3 + + # Not allowed to add object of unrelated type + invalid_object = geometry.add_new_object(rips.WellPath) + assert invalid_object is None + + +def test_add_well_path_targets(rips_instance, initialize_test): + well_path_coll = rips_instance.project.descendants(rips.WellPathCollection)[0] + + my_well_path = well_path_coll.add_new_object(rips.ModeledWellPath) + my_well_path.name = "test" + my_well_path.update() + + geometry = my_well_path.well_path_geometry() + + # Append well target with fixed azimuth + coord = [2229.10, -833.74, -74.70] + target = geometry.append_well_target( + coord, use_fixed_azimuth=True, fixed_azimuth_value=110.1 + ) + assert target.use_fixed_inclination == False + assert target.use_fixed_azimuth == True + assert target.azimuth == 110.1 + assert target.inclination == 0.0 + + # Append well target with fixed inclination + coord = [4577.21, -3043.47, -87.15] + target = geometry.append_well_target( + coord, use_fixed_inclination=True, fixed_inclination_value=25.6 + ) + + assert target.use_fixed_inclination == True + assert target.use_fixed_azimuth == False + assert target.azimuth == 0.0 + assert target.inclination == 25.6 From 4ed5250d3b32d015e2e1f51ffcfe27467307f4ee Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 21 Feb 2022 07:15:56 +0100 Subject: [PATCH 133/406] Support horizontally stacked curves (#8553) * #8548 Horizontal track : Improve stacked curves * Add horizontal track bar * Show relevant scroll bar for horizontal and vertical plots * Show max property value at top for horizontal plots --- .../WellLog/RimWellLogCurve.cpp | 31 +++++-- .../WellLog/RimWellLogCurve.h | 3 +- .../WellLog/RimWellLogTrack.cpp | 27 ++++++- .../UserInterface/RiuWellLogPlot.cpp | 80 +++++++++++++------ .../UserInterface/RiuWellLogPlot.h | 9 ++- 5 files changed, 115 insertions(+), 35 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp index 19da3c84d7..d46fabba9c 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp @@ -182,6 +182,12 @@ void RimWellLogCurve::updateCurveAppearance() { RimPlotCurve::updateCurveAppearance(); + RimDepthTrackPlot::DepthOrientation orientation = RimDepthTrackPlot::DepthOrientation::VERTICAL; + + RimDepthTrackPlot* wellLogPlot = nullptr; + firstAncestorOrThisOfType( wellLogPlot ); + if ( wellLogPlot ) orientation = wellLogPlot->depthOrientation(); + if ( m_plotCurve ) { m_plotCurve->setXAxis( RiuPlotAxis::defaultTop() ); @@ -193,9 +199,16 @@ void RimWellLogCurve::updateCurveAppearance() RiuQwtPlotCurve* qwtPlotCurve = dynamic_cast( m_plotCurve ); if ( qwtPlotCurve ) { - qwtPlotCurve->setOrientation( Qt::Horizontal ); - qwtPlotCurve->setBaseline( -std::numeric_limits::infinity() ); - qwtPlotCurve->setCurveAttribute( QwtPlotCurve::Inverted, true ); + if ( orientation == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + { + qwtPlotCurve->setOrientation( Qt::Horizontal ); + qwtPlotCurve->setBaseline( -std::numeric_limits::infinity() ); + } + else + { + qwtPlotCurve->setOrientation( Qt::Vertical ); + qwtPlotCurve->setBaseline( 0.0 ); + } } } } @@ -221,13 +234,21 @@ QString RimWellLogCurve::wellLogCurveIconName() //-------------------------------------------------------------------------------------------------- void RimWellLogCurve::setOverrideCurveData( const std::vector& propertyValues, const std::vector& depthValues, - const RiaCurveDataTools::CurveIntervals& curveIntervals ) + const RiaCurveDataTools::CurveIntervals& curveIntervals, + bool isVerticalPlot ) { auto minmax_it = std::minmax_element( propertyValues.begin(), propertyValues.end() ); this->setOverrideCurveDataPropertyValueRange( *( minmax_it.first ), *( minmax_it.second ) ); if ( m_plotCurve ) { - m_plotCurve->setSamplesValues( propertyValues, depthValues ); + if ( isVerticalPlot ) + { + m_plotCurve->setSamplesValues( propertyValues, depthValues ); + } + else + { + m_plotCurve->setSamplesValues( depthValues, propertyValues ); + } m_plotCurve->setLineSegmentStartStopIndices( curveIntervals ); } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h index e4398f3c80..7451fb5f19 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h @@ -85,7 +85,8 @@ class RimWellLogCurve : public RimStackablePlotCurve void setOverrideCurveData( const std::vector& propertyValues, const std::vector& depthValues, - const RiaCurveDataTools::CurveIntervals& curveIntervals ); + const RiaCurveDataTools::CurveIntervals& curveIntervals, + bool isVerticalPlot ); virtual RiaDefines::PhaseType resultPhase() const; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 893b4bd838..e07017bf76 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -1508,7 +1508,6 @@ RiuPlotWidget* RimWellLogTrack::doCreatePlotViewWidget( QWidget* mainWindowParen if ( m_plotWidget == nullptr ) { m_plotWidget = new RiuWellLogTrack( this, mainWindowParent ); - m_plotWidget->setAxisInverted( getDepthAxis(), true ); updateAxisScaleEngine(); for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx ) @@ -1975,6 +1974,20 @@ void RimWellLogTrack::updateAxisScaleEngine() { if ( !m_plotWidget ) return; + RimDepthTrackPlot* wellLogPlot = nullptr; + this->firstAncestorOrThisOfType( wellLogPlot ); + if ( wellLogPlot ) + { + if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + { + m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), true ); + } + else + { + m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), false ); + } + } + if ( m_isLogarithmicScaleEnabled ) { m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new QwtLogScaleEngine ); @@ -2488,6 +2501,14 @@ void RimWellLogTrack::updateStackedCurveData() if ( allDepthValues.empty() ) continue; + bool isVerticalTrack = true; + RimDepthTrackPlot* wellLogPlot; + this->firstAncestorOrThisOfType( wellLogPlot ); + if ( wellLogPlot ) + { + isVerticalTrack = ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ); + } + size_t stackIndex = 0u; std::vector allStackedValues( allDepthValues.size(), 0.0 ); for ( auto curve : stackedCurvesInGroup ) @@ -2511,10 +2532,10 @@ void RimWellLogTrack::updateStackedCurveData() false, m_isLogarithmicScaleEnabled ); - auto plotDepthValues = tempCurveData.depthValuesByIntervals( depthType, displayUnit ); + auto plotDepthValues = tempCurveData.depths( depthType ); auto polyLineStartStopIndices = tempCurveData.polylineStartStopIndices(); - curve->setOverrideCurveData( allStackedValues, plotDepthValues, polyLineStartStopIndices ); + curve->setOverrideCurveData( allStackedValues, plotDepthValues, polyLineStartStopIndices, isVerticalTrack ); curve->setZOrder( zPos ); if ( !dynamic_cast( curve ) ) diff --git a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp index 7044bd523b..c5aa4667bf 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp @@ -17,22 +17,31 @@ RiuWellLogPlot::RiuWellLogPlot( RimDepthTrackPlot* plotDefinition, QWidget* parent ) : RiuMultiPlotPage( plotDefinition, parent ) { - m_trackScrollBar = new QScrollBar( nullptr ); - m_trackScrollBar->setOrientation( Qt::Vertical ); - m_trackScrollBar->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); + m_verticalTrackScrollBar = new QScrollBar( nullptr ); + m_verticalTrackScrollBar->setOrientation( Qt::Vertical ); + m_verticalTrackScrollBar->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ); - m_trackScrollBarLayout = new QVBoxLayout; - m_trackScrollBarLayout->addWidget( m_trackScrollBar, 0 ); + m_verticalTrackScrollBarLayout = new QVBoxLayout; + m_verticalTrackScrollBarLayout->addWidget( m_verticalTrackScrollBar, 0 ); - connect( m_trackScrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( slotSetMinDepth( int ) ) ); + connect( m_verticalTrackScrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( slotSetMinDepth( int ) ) ); + + m_horizontalTrackScrollBar = new QScrollBar( nullptr ); + m_horizontalTrackScrollBar->setOrientation( Qt::Horizontal ); + m_horizontalTrackScrollBar->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); + + m_horizontalTrackScrollBarLayout = new QHBoxLayout; + m_horizontalTrackScrollBarLayout->addWidget( m_horizontalTrackScrollBar, 0 ); + + connect( m_horizontalTrackScrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( slotSetMinDepth( int ) ) ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimDepthTrackPlot* RiuWellLogPlot::wellLogPlotDefinition() +RimDepthTrackPlot* RiuWellLogPlot::depthTrackPlot() { - RimDepthTrackPlot* wellLogPlot = dynamic_cast( m_plotDefinition.p() ); + auto* wellLogPlot = dynamic_cast( m_plotDefinition.p() ); CAF_ASSERT( wellLogPlot ); return wellLogPlot; } @@ -54,13 +63,21 @@ void RiuWellLogPlot::updateVerticalScrollBar( double minVisible, double maxVisib double visibleRange = maxVisible - minVisible; - m_trackScrollBar->blockSignals( true ); + m_verticalTrackScrollBar->blockSignals( true ); { - m_trackScrollBar->setRange( (int)minAvailable, (int)( ( maxAvailable - visibleRange ) ) ); - m_trackScrollBar->setPageStep( (int)visibleRange ); - m_trackScrollBar->setValue( (int)minVisible ); + m_verticalTrackScrollBar->setRange( (int)minAvailable, (int)( ( maxAvailable - visibleRange ) ) ); + m_verticalTrackScrollBar->setPageStep( (int)visibleRange ); + m_verticalTrackScrollBar->setValue( (int)minVisible ); } - m_trackScrollBar->blockSignals( false ); + m_verticalTrackScrollBar->blockSignals( false ); + + m_horizontalTrackScrollBar->blockSignals( true ); + { + m_horizontalTrackScrollBar->setRange( (int)minAvailable, (int)( ( maxAvailable - visibleRange ) ) ); + m_horizontalTrackScrollBar->setPageStep( (int)visibleRange ); + m_horizontalTrackScrollBar->setValue( (int)minVisible ); + } + m_horizontalTrackScrollBar->blockSignals( false ); } //-------------------------------------------------------------------------------------------------- @@ -68,9 +85,15 @@ void RiuWellLogPlot::updateVerticalScrollBar( double minVisible, double maxVisib //-------------------------------------------------------------------------------------------------- void RiuWellLogPlot::renderTo( QPaintDevice* paintDevice ) { - m_trackScrollBar->setVisible( false ); + m_verticalTrackScrollBar->setVisible( false ); + m_horizontalTrackScrollBar->setVisible( false ); + RiuMultiPlotPage::renderTo( paintDevice ); - m_trackScrollBar->setVisible( true ); + + if ( depthTrackPlot() && depthTrackPlot()->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL ) + m_horizontalTrackScrollBar->setVisible( true ); + else + m_verticalTrackScrollBar->setVisible( true ); } //-------------------------------------------------------------------------------------------------- @@ -88,10 +111,19 @@ void RiuWellLogPlot::reinsertScrollbar() { QList> plotWidgets = this->visiblePlotWidgets(); int colCount = this->m_gridLayout->columnCount(); + int rowCount = this->m_gridLayout->rowCount(); - m_gridLayout->addLayout( m_trackScrollBarLayout, 2, colCount, 1, 1 ); - m_trackScrollBar->setVisible( !plotWidgets.empty() ); - m_gridLayout->setColumnStretch( colCount, 0 ); + if ( depthTrackPlot() && depthTrackPlot()->depthOrientation() == RimDepthTrackPlot::DepthOrientation::HORIZONTAL ) + { + m_gridLayout->addLayout( m_horizontalTrackScrollBarLayout, rowCount, 0, 1, colCount ); + m_horizontalTrackScrollBar->setVisible( !plotWidgets.empty() ); + } + else + { + m_gridLayout->addLayout( m_verticalTrackScrollBarLayout, 2, colCount, 1, 1 ); + m_verticalTrackScrollBar->setVisible( !plotWidgets.empty() ); + m_gridLayout->setColumnStretch( colCount, 0 ); + } } //-------------------------------------------------------------------------------------------------- @@ -99,7 +131,7 @@ void RiuWellLogPlot::reinsertScrollbar() //-------------------------------------------------------------------------------------------------- void RiuWellLogPlot::alignScrollbar( int offset ) { - m_trackScrollBarLayout->setContentsMargins( 0, offset, 0, 0 ); + m_verticalTrackScrollBarLayout->setContentsMargins( 0, offset, 0, 0 ); } //-------------------------------------------------------------------------------------------------- @@ -109,11 +141,11 @@ void RiuWellLogPlot::slotSetMinDepth( int value ) { double minimumDepth; double maximumDepth; - wellLogPlotDefinition()->visibleDepthRange( &minimumDepth, &maximumDepth ); + depthTrackPlot()->visibleDepthRange( &minimumDepth, &maximumDepth ); double delta = value - minimumDepth; - wellLogPlotDefinition()->setDepthAxisRange( minimumDepth + delta, maximumDepth + delta ); - wellLogPlotDefinition()->setAutoScaleDepthEnabled( false ); + depthTrackPlot()->setDepthAxisRange( minimumDepth + delta, maximumDepth + delta ); + depthTrackPlot()->setAutoScaleDepthEnabled( false ); } //-------------------------------------------------------------------------------------------------- @@ -121,7 +153,9 @@ void RiuWellLogPlot::slotSetMinDepth( int value ) //-------------------------------------------------------------------------------------------------- void RiuWellLogPlot::performUpdate() { - m_trackScrollBar->setVisible( false ); + m_horizontalTrackScrollBar->setVisible( false ); + m_verticalTrackScrollBar->setVisible( false ); + reinsertPlotWidgets(); reinsertScrollbar(); int axisShift = alignCanvasTops(); diff --git a/ApplicationLibCode/UserInterface/RiuWellLogPlot.h b/ApplicationLibCode/UserInterface/RiuWellLogPlot.h index a61ea17aba..68c5bfff7e 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogPlot.h +++ b/ApplicationLibCode/UserInterface/RiuWellLogPlot.h @@ -41,13 +41,16 @@ class RiuWellLogPlot : public RiuMultiPlotPage void alignScrollbar( int offset ); private: - RimDepthTrackPlot* wellLogPlotDefinition(); + RimDepthTrackPlot* depthTrackPlot(); private slots: void slotSetMinDepth( int value ); void performUpdate() override; private: - QPointer m_trackScrollBarLayout; - QScrollBar* m_trackScrollBar; + QPointer m_verticalTrackScrollBarLayout; + QScrollBar* m_verticalTrackScrollBar; + + QPointer m_horizontalTrackScrollBarLayout; + QScrollBar* m_horizontalTrackScrollBar; }; From 208ae7692bcf9f4afa30cb032818c16a3b249d75 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Tue, 22 Feb 2022 11:32:35 +0100 Subject: [PATCH 134/406] Merge pull request #8578 from OPM/summaryplot_fromdatavector Summary Plot: create new plot from data vector tree nodes --- .../Application/Tools/RiaSummaryTools.cpp | 19 +++ .../Application/Tools/RiaSummaryTools.h | 4 +- .../CMakeLists_files.cmake | 2 + ...RicNewSummaryPlotFromDataVectorFeature.cpp | 120 ++++++++++++++++++ .../RicNewSummaryPlotFromDataVectorFeature.h | 37 ++++++ .../RicNewSummaryPlotFeature.cpp | 2 +- .../RimContextCommandBuilder.cpp | 5 + 7 files changed, 187 insertions(+), 2 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.h diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp index 8b8e53f739..4566231e47 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp @@ -31,6 +31,7 @@ #include "RimSummaryCalculationCollection.h" #include "RimSummaryCalculationVariable.h" #include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCrossPlot.h" #include "RimSummaryCrossPlotCollection.h" @@ -257,3 +258,21 @@ RimSummaryCase* RiaSummaryTools::summaryCaseById( int caseId ) return nullptr; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCaseCollection* RiaSummaryTools::ensembleById( int ensembleId ) +{ + auto ensembles = RimProject::current()->summaryGroups(); + + for ( auto ensemble : ensembles ) + { + if ( ensemble->ensembleId() == ensembleId ) + { + return ensemble; + } + } + + return nullptr; +} diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.h b/ApplicationLibCode/Application/Tools/RiaSummaryTools.h index ed0d8f2f68..e38d8aa5ea 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.h +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.h @@ -30,6 +30,7 @@ class RimSummaryCrossPlot; class RimSummaryCrossPlotCollection; class RimSummaryCaseMainCollection; class RimSummaryCase; +class RimSummaryCaseCollection; class RifEclipseSummaryAddress; @@ -70,5 +71,6 @@ class RiaSummaryTools std::vector& values, RiaQDateTimeTools::DateTimePeriod period ); - static RimSummaryCase* summaryCaseById( int caseId ); + static RimSummaryCase* summaryCaseById( int caseId ); + static RimSummaryCaseCollection* ensembleById( int ensembleId ); }; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake index c7c7b99f48..f69aa82445 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake @@ -2,12 +2,14 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotBuilder.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromDataVectorFeature.h ) set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewMultiPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotBuilder.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromDataVectorFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp new file mode 100644 index 0000000000..5b888c26a7 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp @@ -0,0 +1,120 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicNewSummaryPlotFromDataVectorFeature.h" + +#include "RiaSummaryTools.h" +#include "RimSummaryAddress.h" +#include "RimSummaryPlot.h" +#include "RimSummaryPlotCollection.h" + +#include "RicSummaryPlotBuilder.h" + +#include "RifEclipseSummaryAddress.h" + +#include "cafSelectionManagerTools.h" +#include "cvfAssert.h" + +#include + +CAF_CMD_SOURCE_INIT( RicNewSummaryPlotFromDataVectorFeature, "RicNewSummaryPlotFromDataVectorFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewSummaryPlotFromDataVectorFeature::isCommandEnabled() +{ + std::vector selectedItems; + caf::SelectionManager::instance()->selectedItems( selectedItems ); + + std::vector selectedAddressItems = caf::selectedObjectsByType(); + + unsigned int nEnsembles = 0; + + for ( auto adr : selectedAddressItems ) + { + if ( adr->isEnsemble() ) nEnsembles++; + } + + bool bOk = ( selectedAddressItems.size() > 0 ); + if ( nEnsembles > 0 ) + { + bOk = bOk && ( nEnsembles == selectedItems.size() ); + } + bOk = bOk && ( selectedAddressItems.size() == selectedItems.size() ); + + return bOk; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSummaryPlotFromDataVectorFeature::onActionTriggered( bool isChecked ) +{ + std::vector selectedAddressItems = caf::selectedObjectsByType(); + std::set caseIds; + std::set ensembleIds; + std::vector selectedCases; + std::set eclipseAddresses; + std::vector selectedEnsembles; + + bool isEnsemble = false; + + for ( auto adr : selectedAddressItems ) + { + eclipseAddresses.insert( adr->address() ); + caseIds.insert( adr->caseId() ); + ensembleIds.insert( adr->ensembleId() ); + isEnsemble = isEnsemble || adr->isEnsemble(); + } + + if ( isEnsemble ) + { + for ( auto id : ensembleIds ) + { + selectedEnsembles.push_back( RiaSummaryTools::ensembleById( id ) ); + } + } + else + { + for ( auto id : caseIds ) + { + selectedCases.push_back( RiaSummaryTools::summaryCaseById( id ) ); + } + } + + auto newPlot = RicSummaryPlotBuilder::createPlot( eclipseAddresses, selectedCases, selectedEnsembles ); + + auto plotCollection = RiaSummaryTools::summaryPlotCollection(); + newPlot->setAsPlotMdiWindow(); + + plotCollection->addPlot( newPlot ); + + newPlot->loadDataAndUpdate(); + + plotCollection->updateConnectedEditors(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSummaryPlotFromDataVectorFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "New Summary Plot" ); + actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.h new file mode 100644 index 0000000000..efadef9496 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RicfCommandObject.h" + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicNewSummaryPlotFromDataVectorFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + // Overrides + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp index b98205a959..701b1fbb05 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2016- Statoil ASA +// Copyright (C) 2022 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 diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 3c68d87ac9..9c2d8bf886 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -118,6 +118,7 @@ #include "RimStimPlanModelTemplate.h" #include "RimStimPlanModelTemplateCollection.h" #include "RimStreamlineInViewCollection.h" +#include "RimSummaryAddress.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" @@ -1184,6 +1185,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewSimWellFractureFeature"; menuBuilder << "RicNewSimWellIntersectionFeature"; } + else if ( dynamic_cast( firstUiItem ) ) + { + menuBuilder << "RicNewSummaryPlotFromDataVectorFeature"; + } #ifdef USE_ODB_API else if ( dynamic_cast( firstUiItem ) ) { From bb7f61ea56016ce287d779d9642a432fd75e5921 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 22 Feb 2022 09:05:33 +0100 Subject: [PATCH 135/406] Janitor : Remove obsolete override comment --- .../AnalysisPlotCommands/RicNewAnalysisPlotFeature.h | 1 - .../AnalysisPlotCommands/RicNewPlotDataFilterFeature.h | 1 - .../RicCreateReachCircleAnnotationFeature.h | 1 - .../AnnotationCommands/RicCreateTextAnnotationFeature.h | 1 - .../RicCreateTextAnnotationIn3dViewFeature.h | 1 - .../RicCreateUserDefinedPolylinesAnnotationFeature.h | 1 - .../AnnotationCommands/RicImportPolylinesAnnotationFeature.h | 1 - .../Commands/ApplicationCommands/RicCloseProjectFeature.h | 1 - .../Commands/ApplicationCommands/RicEditPreferencesFeature.h | 1 - .../Commands/ApplicationCommands/RicExitApplicationFeature.h | 1 - .../Commands/ApplicationCommands/RicHelpFeatures.h | 5 ----- .../Commands/ApplicationCommands/RicLaunchUnitTestsFeature.h | 1 - .../ApplicationCommands/RicOpenLastUsedFileFeature.h | 1 - .../Commands/ApplicationCommands/RicOpenProjectFeature.h | 1 - .../Commands/ApplicationCommands/RicSaveProjectAsFeature.h | 1 - .../Commands/ApplicationCommands/RicSaveProjectFeature.h | 1 - .../Commands/ApplicationCommands/RicShowMainWindowFeature.h | 1 - .../ApplicationCommands/RicShowMemoryCleanupDialogFeature.h | 1 - .../Commands/ApplicationCommands/RicShowPlotDataFeature.h | 1 - .../Commands/ApplicationCommands/RicShowPlotWindowFeature.h | 1 - .../Commands/ApplicationCommands/RicTileWindowsFeature.h | 2 -- .../Commands/CellFilterCommands/RicNewPolygonFilterFeature.h | 1 - .../CellFilterCommands/RicNewRangeFilterSlice3dviewFeature.h | 1 - .../CellFilterCommands/RicNewUserDefinedFilterFeature.h | 1 - .../CompletionCommands/RicDeleteValveTemplateFeature.h | 1 - .../RicImportEnsembleFractureStatisticsFeature.h | 1 - .../CompletionCommands/RicNewPerforationIntervalFeature.h | 1 - .../CompletionCommands/RicNewStimPlanModelPlotFeature.h | 1 - .../Commands/CompletionCommands/RicNewValveFeature.h | 1 - .../RicWellPathImportPerforationIntervalsFeature.h | 1 - .../RicNewCorrelationMatrixPlotFeature.h | 1 - .../CorrelationPlotCommands/RicNewCorrelationPlotFeature.h | 1 - .../RicNewCorrelationReportPlotFeature.h | 1 - .../RicNewParameterResultCrossPlotFeature.h | 1 - .../CrossSectionCommands/RicAppendIntersectionFeature.h | 1 - .../RicAppendSeparateIntersectionResultFeature.h | 1 - .../RicCopyIntersectionsToAllViewsInCaseFeature.h | 1 - .../CrossSectionCommands/RicNewSimWellIntersectionFeature.h | 1 - .../CrossSectionCommands/RicNewWellPathIntersectionFeature.h | 1 - .../EclipseCommands/RicAddEclipseInputPropertyFeature.h | 1 - .../Commands/EclipseCommands/RicComputeStatisticsFeature.h | 1 - .../EclipseCommands/RicCreateGridCaseGroupFromFilesFeature.h | 1 - .../Commands/EclipseCommands/RicEclipseCaseNewGroupFeature.h | 1 - .../EclipseCommands/RicEclipsePropertyFilterInsertFeature.h | 1 - .../EclipseCommands/RicEclipsePropertyFilterNewFeature.h | 1 - .../Commands/EclipseCommands/RicImportEclipseCaseFeature.h | 1 - .../Commands/EclipseCommands/RicImportEclipseCasesFeature.h | 1 - .../EclipseCommands/RicImportInputEclipseCaseFeature.h | 1 - .../Commands/EclipseCommands/RicNewStatisticsCaseFeature.h | 1 - ApplicationLibCode/Commands/ExportCommands/RicExportCarfin.h | 1 - .../Commands/ExportCommands/RicExportFaultsFeature.h | 1 - .../Commands/ExportCommands/RicExportToLasFileFeature.h | 1 - .../ExportCommands/RicSaveEclipseInputPropertyFeature.h | 1 - .../RicSaveEclipseResultAsInputPropertyFeature.h | 1 - .../ExportCommands/RicSnapshotAllPlotsToFileFeature.h | 1 - .../ExportCommands/RicSnapshotAllViewsToFileFeature.h | 1 - .../ExportCommands/RicSnapshotViewToClipboardFeature.h | 1 - .../Commands/ExportCommands/RicSnapshotViewToFileFeature.h | 1 - .../RicAddStoredFlowCharacteristicsPlotFeature.h | 1 - .../FlowCommands/RicAddStoredWellAllocationPlotFeature.h | 1 - .../Commands/FlowCommands/RicPlotProductionRateFeature.h | 1 - .../Commands/FlowCommands/RicShowContributingWellsFeature.h | 1 - .../FlowCommands/RicShowCumulativePhasePlotFeature.h | 1 - .../FlowCommands/RicShowFlowCharacteristicsPlotFeature.h | 1 - .../FlowCommands/RicShowTotalAllocationDataFeature.h | 1 - .../Commands/FlowCommands/RicShowWellAllocationPlotFeature.h | 1 - .../Commands/GeoMechCommands/RicGeoMechCopyCaseFeature.h | 1 - .../GeoMechCommands/RicGeoMechPropertyFilterInsertFeature.h | 1 - .../GeoMechCommands/RicGeoMechPropertyFilterNewFeature.h | 1 - .../Commands/GeoMechCommands/RicImportGeoMechCaseFeature.h | 1 - .../GeoMechCommands/RicNewFaultReactAssessmentFeature.h | 1 - .../RicAppendIntersectionBoxFeature.h | 1 - .../IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.h | 1 - .../RicIntersectionBoxXSliceFeature.h | 1 - .../RicIntersectionBoxYSliceFeature.h | 1 - .../RicIntersectionBoxZSliceFeature.h | 1 - .../Commands/OctaveScriptCommands/RicAddScriptPathFeature.h | 1 - .../OctaveScriptCommands/RicDeleteScriptPathFeature.h | 1 - .../Commands/OctaveScriptCommands/RicEditScriptFeature.h | 1 - .../Commands/OctaveScriptCommands/RicExecuteScriptFeature.h | 1 - .../OctaveScriptCommands/RicExecuteScriptForCasesFeature.h | 1 - .../OctaveScriptCommands/RicNewOctaveScriptFeature.h | 1 - .../OctaveScriptCommands/RicNewPythonScriptFeature.h | 1 - .../Commands/OctaveScriptCommands/RicRefreshScriptsFeature.h | 1 - .../RicCopyReferencesToClipboardFeature.h | 1 - .../RicPasteEclipseCasesFeature.h | 1 - .../RicPasteEclipseViewsFeature.h | 1 - .../RicPasteGeoMechViewsFeature.h | 1 - .../RicPasteIntersectionsFeature.h | 1 - .../Commands/PlotBuilderCommands/RicNewMultiPlotFeature.h | 1 - ApplicationLibCode/Commands/RicCloseCaseFeature.h | 1 - ApplicationLibCode/Commands/RicCloseObservedDataFeature.h | 1 - ApplicationLibCode/Commands/RicCloseSourSimDataFeature.h | 1 - ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.h | 1 - .../Commands/RicConvertGroupToEnsembleFeature.h | 1 - ApplicationLibCode/Commands/RicDeleteItemFeature.h | 1 - .../Commands/RicDeletePressureTableItemFeature.h | 1 - ApplicationLibCode/Commands/RicDeleteSubItemsFeature.h | 1 - .../Commands/RicDeleteWellMeasurementFilePathFeature.h | 1 - .../Commands/RicExportStimPlanModelToFileFeature.h | 1 - .../Commands/RicImportElasticPropertiesFeature.h | 1 - ApplicationLibCode/Commands/RicImportEnsembleFeature.h | 1 - .../Commands/RicImportEnsembleSurfaceFeature.h | 1 - ApplicationLibCode/Commands/RicImportGeneralDataFeature.h | 1 - ApplicationLibCode/Commands/RicImportSummaryCaseFeature.h | 1 - ApplicationLibCode/Commands/RicImportSummaryCasesFeature.h | 1 - ApplicationLibCode/Commands/RicImportSummaryGroupFeature.h | 1 - ApplicationLibCode/Commands/RicNewContourMapViewFeature.h | 1 - .../Commands/RicNewCustomObjectiveFunctionFeature.h | 1 - ApplicationLibCode/Commands/RicNewPressureTableItemFeature.h | 1 - ApplicationLibCode/Commands/RicNewViewFeature.h | 1 - ApplicationLibCode/Commands/RicReloadFormationNamesFeature.h | 1 - ApplicationLibCode/Commands/RicStackSelectedCurvesFeature.h | 1 - ApplicationLibCode/Commands/RicThemeColorEditorFeature.h | 1 - .../Commands/RicTogglePerspectiveViewFeature.h | 1 - .../Commands/RicUnstackSelectedCurvesFeature.h | 1 - .../SsiHubImportCommands/RicWellPathsImportSsihubFeature.h | 1 - .../Commands/StreamlineCommands/RicNewStreamlineFeature.h | 1 - .../RicDuplicateSummaryCrossPlotCurveFeature.h | 1 - .../RicDuplicateSummaryCrossPlotFeature.h | 1 - .../SummaryPlotCommands/RicDuplicateSummaryCurveFeature.h | 1 - .../SummaryPlotCommands/RicDuplicateSummaryPlotFeature.h | 1 - .../SummaryPlotCommands/RicEditSummaryCrossPlotFeature.h | 1 - .../SummaryPlotCommands/RicNewDerivedEnsembleFeature.h | 1 - .../SummaryPlotCommands/RicNewDerivedSummaryFeature.h | 1 - .../SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.h | 1 - .../SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.h | 1 - .../SummaryPlotCommands/RicNewSummaryCrossPlotFeature.h | 1 - .../Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.h | 1 - .../RicNewSummaryEnsembleCurveSetFeature.h | 1 - .../Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h | 1 - .../SummaryPlotCommands/RicPasteAsciiDataCurveFeature.h | 1 - .../RicPasteAsciiDataToSummaryPlotFeature.h | 1 - .../RicPasteSummaryCrossPlotCurveFeature.h | 1 - .../SummaryPlotCommands/RicPasteSummaryCrossPlotFeature.h | 1 - .../SummaryPlotCommands/RicPasteSummaryCurveFeature.h | 1 - .../SummaryPlotCommands/RicPasteSummaryPlotFeature.h | 1 - .../SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.h | 1 - .../SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.h | 1 - .../Commands/SummaryPlotCommands/RicViewZoomAllFeature.h | 1 - .../Commands/SurfaceCommands/RicCopySurfaceFeature.h | 1 - .../Commands/SurfaceCommands/RicExportKLayerToPtlFeature.h | 1 - .../SurfaceCommands/RicExportSurfaceToTsurfFeature.h | 1 - .../Commands/SurfaceCommands/RicImportSurfacesFeature.h | 1 - .../Commands/SurfaceCommands/RicNewGridCaseSurfaceFeature.h | 1 - .../SurfaceCommands/RicNewSurfaceCollectionFeature.h | 1 - .../Commands/SurfaceCommands/RicReloadSurfaceFeature.h | 1 - .../Commands/ToggleCommands/RicToggleItemsFeature.h | 1 - .../Commands/ToggleCommands/RicToggleItemsOffFeature.h | 1 - .../Commands/ToggleCommands/RicToggleItemsOnFeature.h | 1 - .../ToggleCommands/RicToggleItemsOnOthersOffFeature.h | 1 - .../Commands/ViewLink/RicCompareTo3dViewFeature.h | 1 - .../Commands/ViewLink/RicDeleteAllLinkedViewsFeature.h | 1 - ApplicationLibCode/Commands/ViewLink/RicLinkViewFeature.h | 1 - .../Commands/ViewLink/RicLinkVisibleViewsFeature.h | 1 - .../Commands/ViewLink/RicRemoveComparison3dViewFeature.h | 1 - .../Commands/ViewLink/RicSetMasterViewFeature.h | 1 - .../Commands/ViewLink/RicShowAllLinkedViewsFeature.h | 1 - .../Commands/ViewLink/RicShowLinkOptionsFeature.h | 1 - ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.h | 1 - .../WellLogCommands/Ric3dWellLogCurveDeleteFeature.h | 1 - .../Commands/WellLogCommands/RicAddWellLogToPlotFeature.h | 1 - .../Commands/WellLogCommands/RicDeleteSubPlotFeature.h | 1 - .../Commands/WellLogCommands/RicMoveWellLogFilesFeature.h | 1 - .../Commands/WellLogCommands/RicNewPltPlotFeature.h | 1 - .../WellLogCommands/RicNewWellBoreStabilityPlotFeature.h | 1 - .../Commands/WellLogCommands/RicNewWellLogPlotFeature.h | 1 - .../Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.h | 1 - .../Commands/WellLogCommands/RicPasteWellLogCurveFeature.h | 1 - .../Commands/WellLogCommands/RicPasteWellLogPlotFeature.h | 1 - .../Commands/WellLogCommands/RicPasteWellLogTrackFeature.h | 1 - .../Commands/WellLogCommands/RicWellLogFileCloseFeature.h | 1 - .../Commands/WellLogCommands/RicWellLogsImportFileFeature.h | 1 - .../WellPathCommands/RicDeleteWellPathAttributeFeature.h | 1 - .../WellPathCommands/RicDeleteWellPathTargetFeature.h | 1 - .../WellPathCommands/RicImportWellMeasurementsFeature.h | 1 - .../WellPathCommands/RicNewEditableWellPathFeature.h | 1 - .../Commands/WellPathCommands/RicNewPolylineTargetFeature.h | 1 - .../WellPathCommands/RicNewWellPathAttributeFeature.h | 1 - .../WellPathCommands/RicNewWellPathListTargetFeature.h | 1 - .../Commands/WellPathCommands/RicShowWellPlanFeature.h | 1 - 181 files changed, 186 deletions(-) diff --git a/ApplicationLibCode/Commands/AnalysisPlotCommands/RicNewAnalysisPlotFeature.h b/ApplicationLibCode/Commands/AnalysisPlotCommands/RicNewAnalysisPlotFeature.h index 2f3d532905..cce5271826 100644 --- a/ApplicationLibCode/Commands/AnalysisPlotCommands/RicNewAnalysisPlotFeature.h +++ b/ApplicationLibCode/Commands/AnalysisPlotCommands/RicNewAnalysisPlotFeature.h @@ -28,7 +28,6 @@ class RicNewAnalysisPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/AnalysisPlotCommands/RicNewPlotDataFilterFeature.h b/ApplicationLibCode/Commands/AnalysisPlotCommands/RicNewPlotDataFilterFeature.h index c883f00a88..ba17f7d5d4 100644 --- a/ApplicationLibCode/Commands/AnalysisPlotCommands/RicNewPlotDataFilterFeature.h +++ b/ApplicationLibCode/Commands/AnalysisPlotCommands/RicNewPlotDataFilterFeature.h @@ -28,7 +28,6 @@ class RicNewPlotDataFilterFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/AnnotationCommands/RicCreateReachCircleAnnotationFeature.h b/ApplicationLibCode/Commands/AnnotationCommands/RicCreateReachCircleAnnotationFeature.h index 78f6765eee..7b822e3b6e 100644 --- a/ApplicationLibCode/Commands/AnnotationCommands/RicCreateReachCircleAnnotationFeature.h +++ b/ApplicationLibCode/Commands/AnnotationCommands/RicCreateReachCircleAnnotationFeature.h @@ -32,7 +32,6 @@ class RicCreateReachCircleAnnotationFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/AnnotationCommands/RicCreateTextAnnotationFeature.h b/ApplicationLibCode/Commands/AnnotationCommands/RicCreateTextAnnotationFeature.h index cc00423cc1..e9910a5c55 100644 --- a/ApplicationLibCode/Commands/AnnotationCommands/RicCreateTextAnnotationFeature.h +++ b/ApplicationLibCode/Commands/AnnotationCommands/RicCreateTextAnnotationFeature.h @@ -34,7 +34,6 @@ class RicCreateTextAnnotationFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/AnnotationCommands/RicCreateTextAnnotationIn3dViewFeature.h b/ApplicationLibCode/Commands/AnnotationCommands/RicCreateTextAnnotationIn3dViewFeature.h index 114c383ecb..1deff83c68 100644 --- a/ApplicationLibCode/Commands/AnnotationCommands/RicCreateTextAnnotationIn3dViewFeature.h +++ b/ApplicationLibCode/Commands/AnnotationCommands/RicCreateTextAnnotationIn3dViewFeature.h @@ -28,7 +28,6 @@ class RicCreateTextAnnotationIn3dViewFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/AnnotationCommands/RicCreateUserDefinedPolylinesAnnotationFeature.h b/ApplicationLibCode/Commands/AnnotationCommands/RicCreateUserDefinedPolylinesAnnotationFeature.h index 1691d566b8..f1563dc2bb 100644 --- a/ApplicationLibCode/Commands/AnnotationCommands/RicCreateUserDefinedPolylinesAnnotationFeature.h +++ b/ApplicationLibCode/Commands/AnnotationCommands/RicCreateUserDefinedPolylinesAnnotationFeature.h @@ -32,7 +32,6 @@ class RicCreateUserDefinedPolylinesAnnotationFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/AnnotationCommands/RicImportPolylinesAnnotationFeature.h b/ApplicationLibCode/Commands/AnnotationCommands/RicImportPolylinesAnnotationFeature.h index 44ccc39469..945cc864f9 100644 --- a/ApplicationLibCode/Commands/AnnotationCommands/RicImportPolylinesAnnotationFeature.h +++ b/ApplicationLibCode/Commands/AnnotationCommands/RicImportPolylinesAnnotationFeature.h @@ -28,7 +28,6 @@ class RicImportPolylinesAnnotationFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicCloseProjectFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicCloseProjectFeature.h index 4de7b64ad4..8b9cbf937a 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicCloseProjectFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicCloseProjectFeature.h @@ -28,7 +28,6 @@ class RicCloseProjectFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicEditPreferencesFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicEditPreferencesFeature.h index cbb9df9288..5beb6857e2 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicEditPreferencesFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicEditPreferencesFeature.h @@ -31,7 +31,6 @@ class RicEditPreferencesFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.h index f35d305d2c..e436c474e7 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.h @@ -28,7 +28,6 @@ class RicExitApplicationFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.h b/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.h index 3b7cfa5501..c788574438 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.h @@ -28,7 +28,6 @@ class RicHelpAboutFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; @@ -42,7 +41,6 @@ class RicHelpCommandLineFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; @@ -56,7 +54,6 @@ class RicHelpSummaryCommandLineFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; @@ -70,7 +67,6 @@ class RicHelpOpenUsersGuideFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; @@ -84,7 +80,6 @@ class RicSearchHelpFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchUnitTestsFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchUnitTestsFeature.h index 4fd7277cde..33f6de842a 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchUnitTestsFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchUnitTestsFeature.h @@ -29,7 +29,6 @@ class RicLaunchUnitTestsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicOpenLastUsedFileFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicOpenLastUsedFileFeature.h index 4a7ce64c7f..e092a0f4e4 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicOpenLastUsedFileFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicOpenLastUsedFileFeature.h @@ -28,7 +28,6 @@ class RicOpenLastUsedFileFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicOpenProjectFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicOpenProjectFeature.h index 2025485bc7..5832cd9e9e 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicOpenProjectFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicOpenProjectFeature.h @@ -28,7 +28,6 @@ class RicOpenProjectFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.h index 974582a7c9..149c7d9143 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectAsFeature.h @@ -35,7 +35,6 @@ class RicSaveProjectAsFeature : public caf::CmdFeature, public RicfCommandObject caf::PdmScriptResponse execute() override; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectFeature.h index 94ef52564b..30fe1a49b6 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicSaveProjectFeature.h @@ -35,7 +35,6 @@ class RicSaveProjectFeature : public caf::CmdFeature, public RicfCommandObject caf::PdmScriptResponse execute() override; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicShowMainWindowFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicShowMainWindowFeature.h index 3f22ff53e3..3b733b3f9c 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicShowMainWindowFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicShowMainWindowFeature.h @@ -31,7 +31,6 @@ class RicShowMainWindowFeature : public caf::CmdFeature static void showMainWindow(); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicShowMemoryCleanupDialogFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicShowMemoryCleanupDialogFeature.h index 682d272d0a..776e877d26 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicShowMemoryCleanupDialogFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicShowMemoryCleanupDialogFeature.h @@ -28,7 +28,6 @@ class RicShowMemoryCleanupDialogFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h index 7e037387e9..eea9017d87 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h @@ -34,7 +34,6 @@ class RicShowPlotDataFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotWindowFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotWindowFeature.h index ebb1dba462..bea243301a 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotWindowFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotWindowFeature.h @@ -28,7 +28,6 @@ class RicShowPlotWindowFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.h index 7d335e9470..7218340699 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.h @@ -29,7 +29,6 @@ class RicTileWindowsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; @@ -44,7 +43,6 @@ class RicTilePlotWindowsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.h b/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.h index dc4fec083b..588e163fc6 100644 --- a/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.h +++ b/ApplicationLibCode/Commands/CellFilterCommands/RicNewPolygonFilterFeature.h @@ -28,7 +28,6 @@ class RicNewPolygonFilterFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CellFilterCommands/RicNewRangeFilterSlice3dviewFeature.h b/ApplicationLibCode/Commands/CellFilterCommands/RicNewRangeFilterSlice3dviewFeature.h index e2c2f87e14..b1769496ce 100644 --- a/ApplicationLibCode/Commands/CellFilterCommands/RicNewRangeFilterSlice3dviewFeature.h +++ b/ApplicationLibCode/Commands/CellFilterCommands/RicNewRangeFilterSlice3dviewFeature.h @@ -28,7 +28,6 @@ class RicNewRangeFilterSlice3dviewFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CellFilterCommands/RicNewUserDefinedFilterFeature.h b/ApplicationLibCode/Commands/CellFilterCommands/RicNewUserDefinedFilterFeature.h index c0e83b69e9..41e0e84d62 100644 --- a/ApplicationLibCode/Commands/CellFilterCommands/RicNewUserDefinedFilterFeature.h +++ b/ApplicationLibCode/Commands/CellFilterCommands/RicNewUserDefinedFilterFeature.h @@ -28,7 +28,6 @@ class RicNewUserDefinedFilterFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicDeleteValveTemplateFeature.h b/ApplicationLibCode/Commands/CompletionCommands/RicDeleteValveTemplateFeature.h index 1a1d0d92fb..deed2540d9 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicDeleteValveTemplateFeature.h +++ b/ApplicationLibCode/Commands/CompletionCommands/RicDeleteValveTemplateFeature.h @@ -28,7 +28,6 @@ class RicDeleteValveTemplateFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicImportEnsembleFractureStatisticsFeature.h b/ApplicationLibCode/Commands/CompletionCommands/RicImportEnsembleFractureStatisticsFeature.h index 4b6cb2f154..44f68061ac 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicImportEnsembleFractureStatisticsFeature.h +++ b/ApplicationLibCode/Commands/CompletionCommands/RicImportEnsembleFractureStatisticsFeature.h @@ -40,7 +40,6 @@ class RicImportEnsembleFractureStatisticsFeature : public caf::CmdFeature protected: static void importSingleEnsembleFractureStatistics( const QStringList& fileNames ); - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicNewPerforationIntervalFeature.h b/ApplicationLibCode/Commands/CompletionCommands/RicNewPerforationIntervalFeature.h index d48ba2d75c..d74c680b6a 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicNewPerforationIntervalFeature.h +++ b/ApplicationLibCode/Commands/CompletionCommands/RicNewPerforationIntervalFeature.h @@ -31,7 +31,6 @@ class RicNewPerforationIntervalFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.h b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.h index 7ce5e66152..8d70aa19e8 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.h +++ b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.h @@ -43,7 +43,6 @@ class RicNewStimPlanModelPlotFeature : public caf::CmdFeature static RimStimPlanModelPlot* createPlot( RimStimPlanModel* stimPlanModel ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicNewValveFeature.h b/ApplicationLibCode/Commands/CompletionCommands/RicNewValveFeature.h index 91f8abb3a7..38663edfa6 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicNewValveFeature.h +++ b/ApplicationLibCode/Commands/CompletionCommands/RicNewValveFeature.h @@ -28,7 +28,6 @@ class RicNewValveFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.h b/ApplicationLibCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.h index 98672f4625..88ea29f586 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.h +++ b/ApplicationLibCode/Commands/CompletionCommands/RicWellPathImportPerforationIntervalsFeature.h @@ -30,7 +30,6 @@ class RicWellPathImportPerforationIntervalsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationMatrixPlotFeature.h b/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationMatrixPlotFeature.h index da9caa1ff0..ccefe65f41 100644 --- a/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationMatrixPlotFeature.h +++ b/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationMatrixPlotFeature.h @@ -28,7 +28,6 @@ class RicNewCorrelationMatrixPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h b/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h index 72eda7591e..feca8d1215 100644 --- a/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h +++ b/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h @@ -53,7 +53,6 @@ class RicNewCorrelationPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationReportPlotFeature.h b/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationReportPlotFeature.h index e0f720d934..7e907c54c7 100644 --- a/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationReportPlotFeature.h +++ b/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewCorrelationReportPlotFeature.h @@ -28,7 +28,6 @@ class RicNewCorrelationReportPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewParameterResultCrossPlotFeature.h b/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewParameterResultCrossPlotFeature.h index ca502f2bab..e602879035 100644 --- a/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewParameterResultCrossPlotFeature.h +++ b/ApplicationLibCode/Commands/CorrelationPlotCommands/RicNewParameterResultCrossPlotFeature.h @@ -28,7 +28,6 @@ class RicNewParameterResultCrossPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.h b/ApplicationLibCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.h index 3c9f6fc8f6..d4d787b9a9 100644 --- a/ApplicationLibCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.h +++ b/ApplicationLibCode/Commands/CrossSectionCommands/RicAppendIntersectionFeature.h @@ -50,7 +50,6 @@ class RicAppendIntersectionFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CrossSectionCommands/RicAppendSeparateIntersectionResultFeature.h b/ApplicationLibCode/Commands/CrossSectionCommands/RicAppendSeparateIntersectionResultFeature.h index 4023c5fdb9..c45b54aa48 100644 --- a/ApplicationLibCode/Commands/CrossSectionCommands/RicAppendSeparateIntersectionResultFeature.h +++ b/ApplicationLibCode/Commands/CrossSectionCommands/RicAppendSeparateIntersectionResultFeature.h @@ -49,7 +49,6 @@ class RicAppendSeparateIntersectionResultFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CrossSectionCommands/RicCopyIntersectionsToAllViewsInCaseFeature.h b/ApplicationLibCode/Commands/CrossSectionCommands/RicCopyIntersectionsToAllViewsInCaseFeature.h index 54e548f774..dc24e0016a 100644 --- a/ApplicationLibCode/Commands/CrossSectionCommands/RicCopyIntersectionsToAllViewsInCaseFeature.h +++ b/ApplicationLibCode/Commands/CrossSectionCommands/RicCopyIntersectionsToAllViewsInCaseFeature.h @@ -36,7 +36,6 @@ class RicCopyIntersectionsToAllViewsInCaseFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.h b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.h index 4828c5bb59..6c7e135764 100644 --- a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.h +++ b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewSimWellIntersectionFeature.h @@ -52,7 +52,6 @@ class RicNewSimWellIntersectionFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.h b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.h index ef472a201b..06a596b505 100644 --- a/ApplicationLibCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.h +++ b/ApplicationLibCode/Commands/CrossSectionCommands/RicNewWellPathIntersectionFeature.h @@ -55,7 +55,6 @@ class RicNewWellPathIntersectionFeature : public caf::CmdFeature RicNewWellPathIntersectionFeature(); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.h b/ApplicationLibCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.h index 09960eddf6..fd25216bf6 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.h +++ b/ApplicationLibCode/Commands/EclipseCommands/RicAddEclipseInputPropertyFeature.h @@ -31,7 +31,6 @@ class RicAddEclipseInputPropertyFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicComputeStatisticsFeature.h b/ApplicationLibCode/Commands/EclipseCommands/RicComputeStatisticsFeature.h index c46e458c42..e8bfda31b2 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicComputeStatisticsFeature.h +++ b/ApplicationLibCode/Commands/EclipseCommands/RicComputeStatisticsFeature.h @@ -33,7 +33,6 @@ class RicComputeStatisticsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicCreateGridCaseGroupFromFilesFeature.h b/ApplicationLibCode/Commands/EclipseCommands/RicCreateGridCaseGroupFromFilesFeature.h index e09806fcc6..a95e8c5a81 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicCreateGridCaseGroupFromFilesFeature.h +++ b/ApplicationLibCode/Commands/EclipseCommands/RicCreateGridCaseGroupFromFilesFeature.h @@ -37,7 +37,6 @@ class RicCreateGridCaseGroupFromFilesFeature : public caf::CmdFeature } protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicEclipseCaseNewGroupFeature.h b/ApplicationLibCode/Commands/EclipseCommands/RicEclipseCaseNewGroupFeature.h index 35252872e7..56eb99dbdc 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicEclipseCaseNewGroupFeature.h +++ b/ApplicationLibCode/Commands/EclipseCommands/RicEclipseCaseNewGroupFeature.h @@ -29,7 +29,6 @@ class RicEclipseCaseNewGroupFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertFeature.h b/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertFeature.h index 871f50f3d4..50e239928a 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertFeature.h +++ b/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertFeature.h @@ -29,7 +29,6 @@ class RicEclipsePropertyFilterInsertFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterNewFeature.h b/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterNewFeature.h index d4e0a22596..d9d6a43478 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterNewFeature.h +++ b/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterNewFeature.h @@ -29,7 +29,6 @@ class RicEclipsePropertyFilterNewFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicImportEclipseCaseFeature.h b/ApplicationLibCode/Commands/EclipseCommands/RicImportEclipseCaseFeature.h index c102050c41..0297c3d365 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicImportEclipseCaseFeature.h +++ b/ApplicationLibCode/Commands/EclipseCommands/RicImportEclipseCaseFeature.h @@ -33,7 +33,6 @@ class RicImportEclipseCaseFeature : public RicImportGeneralDataFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicImportEclipseCasesFeature.h b/ApplicationLibCode/Commands/EclipseCommands/RicImportEclipseCasesFeature.h index 7d2dd2a262..82a0e499df 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicImportEclipseCasesFeature.h +++ b/ApplicationLibCode/Commands/EclipseCommands/RicImportEclipseCasesFeature.h @@ -38,7 +38,6 @@ class RicImportEclipseCasesFeature : public caf::CmdFeature } protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicImportInputEclipseCaseFeature.h b/ApplicationLibCode/Commands/EclipseCommands/RicImportInputEclipseCaseFeature.h index 3793ef5c32..54601ef289 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicImportInputEclipseCaseFeature.h +++ b/ApplicationLibCode/Commands/EclipseCommands/RicImportInputEclipseCaseFeature.h @@ -35,7 +35,6 @@ class RicImportInputEclipseCaseFeature : public RicImportGeneralDataFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicNewStatisticsCaseFeature.h b/ApplicationLibCode/Commands/EclipseCommands/RicNewStatisticsCaseFeature.h index 600258eeaf..52901d14cc 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicNewStatisticsCaseFeature.h +++ b/ApplicationLibCode/Commands/EclipseCommands/RicNewStatisticsCaseFeature.h @@ -38,7 +38,6 @@ class RicNewStatisticsCaseFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportCarfin.h b/ApplicationLibCode/Commands/ExportCommands/RicExportCarfin.h index 3514b37b80..854fd2bdae 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportCarfin.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportCarfin.h @@ -30,7 +30,6 @@ class RicExportCarfin : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportFaultsFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicExportFaultsFeature.h index 19350bec71..f998d1fdd2 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportFaultsFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportFaultsFeature.h @@ -35,7 +35,6 @@ class RicExportFaultsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.h index c14b304e0f..ce19639d20 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.h @@ -56,7 +56,6 @@ class RicExportToLasFileFeature : public caf::CmdFeature bool convertCurveUnits ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputPropertyFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputPropertyFeature.h index a37fde741d..5b2fed9b9f 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputPropertyFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseInputPropertyFeature.h @@ -31,7 +31,6 @@ class RicSaveEclipseInputPropertyFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyFeature.h index 06336a3567..3fbe1c0c51 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicSaveEclipseResultAsInputPropertyFeature.h @@ -32,7 +32,6 @@ class RicSaveEclipseResultAsInputPropertyFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.h index 158e8f7bc6..4fc2a47035 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.h @@ -39,7 +39,6 @@ class RicSnapshotAllPlotsToFileFeature : public caf::CmdFeature const QString& preferredFileSuffix = ".png" ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.h index 07e2f81dcb..837ce6f702 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.h @@ -35,7 +35,6 @@ class RicSnapshotAllViewsToFileFeature : public caf::CmdFeature int viewId = -1 ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.h index 1c5eb770c9..997ca50e08 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.h @@ -36,7 +36,6 @@ class RicSnapshotViewToClipboardFeature : public caf::CmdFeature static QString text(); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.h index 9466a08040..23db2b0db7 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.h @@ -45,7 +45,6 @@ class RicSnapshotViewToFileFeature : public caf::CmdFeature static QString text(); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.h b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.h index ad8708a15a..0b06865f89 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.h +++ b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.h @@ -28,7 +28,6 @@ class RicAddStoredFlowCharacteristicsPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.h b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.h index dbe16e3e65..9fb82f09ad 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.h +++ b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.h @@ -28,7 +28,6 @@ class RicAddStoredWellAllocationPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.h b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.h index f832394171..ffc7b517ab 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.h +++ b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.h @@ -36,7 +36,6 @@ class RicPlotProductionRateFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeature.h b/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeature.h index 4f245e75aa..58bf8f5cc5 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeature.h +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowContributingWellsFeature.h @@ -28,7 +28,6 @@ class RicShowContributingWellsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowCumulativePhasePlotFeature.h b/ApplicationLibCode/Commands/FlowCommands/RicShowCumulativePhasePlotFeature.h index 1aa438fe9a..4cd97eafea 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowCumulativePhasePlotFeature.h +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowCumulativePhasePlotFeature.h @@ -32,7 +32,6 @@ class RicShowCumulativePhasePlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.h b/ApplicationLibCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.h index 17bb873ce6..496641b964 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.h +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowFlowCharacteristicsPlotFeature.h @@ -28,7 +28,6 @@ class RicShowFlowCharacteristicsPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.h b/ApplicationLibCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.h index 33d48a59aa..6a67ca41a0 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.h +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowTotalAllocationDataFeature.h @@ -32,7 +32,6 @@ class RicShowTotalAllocationDataFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.h b/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.h index a098e5a7b4..ab138f6d35 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.h +++ b/ApplicationLibCode/Commands/FlowCommands/RicShowWellAllocationPlotFeature.h @@ -28,7 +28,6 @@ class RicShowWellAllocationPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechCopyCaseFeature.h b/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechCopyCaseFeature.h index e1f315c51b..1bd070e138 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechCopyCaseFeature.h +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechCopyCaseFeature.h @@ -28,7 +28,6 @@ class RicGeoMechCopyCaseFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterInsertFeature.h b/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterInsertFeature.h index a9f4503817..8e910c7329 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterInsertFeature.h +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterInsertFeature.h @@ -29,7 +29,6 @@ class RicGeoMechPropertyFilterInsertFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterNewFeature.h b/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterNewFeature.h index bd18afa742..34cefe105c 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterNewFeature.h +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterNewFeature.h @@ -29,7 +29,6 @@ class RicGeoMechPropertyFilterNewFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseFeature.h b/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseFeature.h index 98c67fb65f..f40d88af7e 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseFeature.h +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicImportGeoMechCaseFeature.h @@ -28,7 +28,6 @@ class RicImportGeoMechCaseFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicNewFaultReactAssessmentFeature.h b/ApplicationLibCode/Commands/GeoMechCommands/RicNewFaultReactAssessmentFeature.h index 9337e5c3ad..2761f9e364 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicNewFaultReactAssessmentFeature.h +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicNewFaultReactAssessmentFeature.h @@ -32,7 +32,6 @@ class RicNewFaultReactAssessmentFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.h b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.h index 5e0d6d95d0..2387d8ccd6 100644 --- a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.h +++ b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicAppendIntersectionBoxFeature.h @@ -32,7 +32,6 @@ class RicAppendIntersectionBoxFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.h b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.h index 75ac598d38..bf1812911c 100644 --- a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.h +++ b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxAtPosFeature.h @@ -30,7 +30,6 @@ class RicIntersectionBoxAtPosFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.h b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.h index ce357c67a8..57d3214ed3 100644 --- a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.h +++ b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxXSliceFeature.h @@ -30,7 +30,6 @@ class RicIntersectionBoxXSliceFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.h b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.h index 54ca89e96d..265ed78cfb 100644 --- a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.h +++ b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxYSliceFeature.h @@ -30,7 +30,6 @@ class RicIntersectionBoxYSliceFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.h b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.h index c8b7a54a39..5cf28ccb63 100644 --- a/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.h +++ b/ApplicationLibCode/Commands/IntersectionBoxCommands/RicIntersectionBoxZSliceFeature.h @@ -30,7 +30,6 @@ class RicIntersectionBoxZSliceFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicAddScriptPathFeature.h b/ApplicationLibCode/Commands/OctaveScriptCommands/RicAddScriptPathFeature.h index 2089e817d4..a1c499d7cf 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicAddScriptPathFeature.h +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicAddScriptPathFeature.h @@ -31,7 +31,6 @@ class RicAddScriptPathFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.h b/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.h index 9d14a1b36d..4621b82084 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.h +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.h @@ -31,7 +31,6 @@ class RicDeleteScriptPathFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicEditScriptFeature.h b/ApplicationLibCode/Commands/OctaveScriptCommands/RicEditScriptFeature.h index d9ff2cf23f..57684fd899 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicEditScriptFeature.h +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicEditScriptFeature.h @@ -31,7 +31,6 @@ class RicEditScriptFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.h b/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.h index 6db2b1ba09..d38317abc5 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.h +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptFeature.h @@ -35,7 +35,6 @@ class RicExecuteScriptFeature : public caf::CmdFeature static void executeScript( RimCalcScript* calcScript ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.h b/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.h index 039f9b5bb0..b9452f670c 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.h +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.h @@ -30,7 +30,6 @@ class RicExecuteScriptForCasesFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.h b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.h index 5a3c0ba125..5165e78e90 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.h +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.h @@ -31,7 +31,6 @@ class RicNewOctaveScriptFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.h b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.h index 97f135d065..eddf6f7193 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.h +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.h @@ -30,7 +30,6 @@ class RicNewPythonScriptFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicRefreshScriptsFeature.h b/ApplicationLibCode/Commands/OctaveScriptCommands/RicRefreshScriptsFeature.h index 773e6087df..662d9eff2a 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicRefreshScriptsFeature.h +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicRefreshScriptsFeature.h @@ -33,7 +33,6 @@ class RicRefreshScriptsFeature : public caf::CmdFeature static void refreshScriptFolders(); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.h b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.h index d73a60d61e..74820b74c9 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.h +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.h @@ -34,7 +34,6 @@ class RicCopyReferencesToClipboardFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.h b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.h index 7706889496..65b362fd06 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.h +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseCasesFeature.h @@ -39,7 +39,6 @@ class RicPasteEclipseCasesFeature : public caf::CmdFeature static void addCasesToGridCaseGroup( caf::PdmObjectGroup& objectGroup, RimIdenticalGridCaseGroup* gridCaseGroup ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.h b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.h index 8b563f27c4..69b7775214 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.h +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.h @@ -29,7 +29,6 @@ class RicPasteEclipseViewsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.h b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.h index f9a32623c0..4bcc72b7f8 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.h +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.h @@ -29,7 +29,6 @@ class RicPasteGeoMechViewsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteIntersectionsFeature.h b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteIntersectionsFeature.h index 965098004e..22bf9755e2 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteIntersectionsFeature.h +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteIntersectionsFeature.h @@ -31,7 +31,6 @@ class RicPasteIntersectionsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewMultiPlotFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewMultiPlotFeature.h index e70ad56518..432459a18a 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewMultiPlotFeature.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewMultiPlotFeature.h @@ -40,7 +40,6 @@ class RicNewMultiPlotFeature : public caf::CmdFeature, public RicfCommandObject caf::PdmScriptResponse execute() override; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicCloseCaseFeature.h b/ApplicationLibCode/Commands/RicCloseCaseFeature.h index fcfad065bd..df38052c4f 100644 --- a/ApplicationLibCode/Commands/RicCloseCaseFeature.h +++ b/ApplicationLibCode/Commands/RicCloseCaseFeature.h @@ -40,7 +40,6 @@ class RicCloseCaseFeature : public caf::CmdFeature static bool userConfirmedGridCaseGroupChange( const std::vector& casesToBeDeleted ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicCloseObservedDataFeature.h b/ApplicationLibCode/Commands/RicCloseObservedDataFeature.h index 5a9aa54e7b..f9e89c09b7 100644 --- a/ApplicationLibCode/Commands/RicCloseObservedDataFeature.h +++ b/ApplicationLibCode/Commands/RicCloseObservedDataFeature.h @@ -37,7 +37,6 @@ class RicCloseObservedDataFeature : public caf::CmdFeature static void deleteObservedRmuRftData( const std::vector& data ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicCloseSourSimDataFeature.h b/ApplicationLibCode/Commands/RicCloseSourSimDataFeature.h index c10d569330..2090c7cc95 100644 --- a/ApplicationLibCode/Commands/RicCloseSourSimDataFeature.h +++ b/ApplicationLibCode/Commands/RicCloseSourSimDataFeature.h @@ -30,7 +30,6 @@ class RicCloseSourSimDataFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.h b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.h index c3ae8644c3..141158a304 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.h +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.h @@ -36,7 +36,6 @@ class RicCloseSummaryCaseFeature : public caf::CmdFeature static void deleteSummaryCases( std::vector& cases ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.h b/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.h index 6589f36c3b..412f1adaa2 100644 --- a/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.h +++ b/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.h @@ -32,7 +32,6 @@ class RicConvertGroupToEnsembleFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicDeleteItemFeature.h b/ApplicationLibCode/Commands/RicDeleteItemFeature.h index 3456c9bfce..399b113ffe 100644 --- a/ApplicationLibCode/Commands/RicDeleteItemFeature.h +++ b/ApplicationLibCode/Commands/RicDeleteItemFeature.h @@ -29,7 +29,6 @@ class RicDeleteItemFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicDeletePressureTableItemFeature.h b/ApplicationLibCode/Commands/RicDeletePressureTableItemFeature.h index fde622c8c0..4e160bdd7a 100644 --- a/ApplicationLibCode/Commands/RicDeletePressureTableItemFeature.h +++ b/ApplicationLibCode/Commands/RicDeletePressureTableItemFeature.h @@ -28,7 +28,6 @@ class RicDeletePressureTableItemFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.h b/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.h index 0d2d26643d..eda5e8497f 100644 --- a/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.h +++ b/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.h @@ -33,7 +33,6 @@ class RicDeleteSubItemsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicDeleteWellMeasurementFilePathFeature.h b/ApplicationLibCode/Commands/RicDeleteWellMeasurementFilePathFeature.h index 089e104e4b..b526f1c64e 100644 --- a/ApplicationLibCode/Commands/RicDeleteWellMeasurementFilePathFeature.h +++ b/ApplicationLibCode/Commands/RicDeleteWellMeasurementFilePathFeature.h @@ -28,7 +28,6 @@ class RicDeleteWellMeasurementFilePathFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicExportStimPlanModelToFileFeature.h b/ApplicationLibCode/Commands/RicExportStimPlanModelToFileFeature.h index f7b0bc0db9..d71f48c42f 100644 --- a/ApplicationLibCode/Commands/RicExportStimPlanModelToFileFeature.h +++ b/ApplicationLibCode/Commands/RicExportStimPlanModelToFileFeature.h @@ -28,7 +28,6 @@ class RicExportStimPlanModelToFileFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicImportElasticPropertiesFeature.h b/ApplicationLibCode/Commands/RicImportElasticPropertiesFeature.h index 9ccece7b2b..70ecc360e6 100644 --- a/ApplicationLibCode/Commands/RicImportElasticPropertiesFeature.h +++ b/ApplicationLibCode/Commands/RicImportElasticPropertiesFeature.h @@ -28,7 +28,6 @@ class RicImportElasticPropertiesFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicImportEnsembleFeature.h b/ApplicationLibCode/Commands/RicImportEnsembleFeature.h index 5400f3f19e..dc5e76027c 100644 --- a/ApplicationLibCode/Commands/RicImportEnsembleFeature.h +++ b/ApplicationLibCode/Commands/RicImportEnsembleFeature.h @@ -34,7 +34,6 @@ class RicImportEnsembleFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicImportEnsembleSurfaceFeature.h b/ApplicationLibCode/Commands/RicImportEnsembleSurfaceFeature.h index 0e458eb02d..80d6e673e2 100644 --- a/ApplicationLibCode/Commands/RicImportEnsembleSurfaceFeature.h +++ b/ApplicationLibCode/Commands/RicImportEnsembleSurfaceFeature.h @@ -38,7 +38,6 @@ class RicImportEnsembleSurfaceFeature : public caf::CmdFeature RiaEnsembleNameTools::EnsembleGroupingMode groupingMode ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicImportGeneralDataFeature.h b/ApplicationLibCode/Commands/RicImportGeneralDataFeature.h index 91d6c6847a..9e7cae44b9 100644 --- a/ApplicationLibCode/Commands/RicImportGeneralDataFeature.h +++ b/ApplicationLibCode/Commands/RicImportGeneralDataFeature.h @@ -59,7 +59,6 @@ class RicImportGeneralDataFeature : public caf::CmdFeature static QStringList getEclipseFileNamesWithDialog( RiaDefines::ImportFileType fileTypes ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicImportSummaryCaseFeature.h b/ApplicationLibCode/Commands/RicImportSummaryCaseFeature.h index 1447d03034..a4353826d0 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCaseFeature.h +++ b/ApplicationLibCode/Commands/RicImportSummaryCaseFeature.h @@ -32,7 +32,6 @@ class RicImportSummaryCaseFeature : public RicImportGeneralDataFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.h b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.h index c5f170c29f..6128911919 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.h +++ b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.h @@ -54,7 +54,6 @@ class RicImportSummaryCasesFeature : public caf::CmdFeature runRecursiveSummaryCaseFileSearchDialogWithGrouping( const QString& dialogTitle, const QString& pathCacheName ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.h b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.h index 8f10134c74..d40d838ff3 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.h +++ b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.h @@ -32,7 +32,6 @@ class RicImportSummaryGroupFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicNewContourMapViewFeature.h b/ApplicationLibCode/Commands/RicNewContourMapViewFeature.h index 16931ccd75..acf88f0880 100644 --- a/ApplicationLibCode/Commands/RicNewContourMapViewFeature.h +++ b/ApplicationLibCode/Commands/RicNewContourMapViewFeature.h @@ -36,7 +36,6 @@ class RicNewContourMapViewFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicNewCustomObjectiveFunctionFeature.h b/ApplicationLibCode/Commands/RicNewCustomObjectiveFunctionFeature.h index e8e80e1cc0..7e3f3a0d91 100644 --- a/ApplicationLibCode/Commands/RicNewCustomObjectiveFunctionFeature.h +++ b/ApplicationLibCode/Commands/RicNewCustomObjectiveFunctionFeature.h @@ -28,7 +28,6 @@ class RicNewCustomObjectiveFunctionFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicNewPressureTableItemFeature.h b/ApplicationLibCode/Commands/RicNewPressureTableItemFeature.h index 247fa0cdff..a48195f366 100644 --- a/ApplicationLibCode/Commands/RicNewPressureTableItemFeature.h +++ b/ApplicationLibCode/Commands/RicNewPressureTableItemFeature.h @@ -28,7 +28,6 @@ class RicNewPressureTableItemFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicNewViewFeature.h b/ApplicationLibCode/Commands/RicNewViewFeature.h index a15f2b1c87..d0b0a90407 100644 --- a/ApplicationLibCode/Commands/RicNewViewFeature.h +++ b/ApplicationLibCode/Commands/RicNewViewFeature.h @@ -38,7 +38,6 @@ class RicNewViewFeature : public caf::CmdFeature static void addReservoirView( RimEclipseCase* eclipseCase, RimGeoMechCase* geomCase ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicReloadFormationNamesFeature.h b/ApplicationLibCode/Commands/RicReloadFormationNamesFeature.h index 86cf3e61f5..743b2a35f7 100644 --- a/ApplicationLibCode/Commands/RicReloadFormationNamesFeature.h +++ b/ApplicationLibCode/Commands/RicReloadFormationNamesFeature.h @@ -28,7 +28,6 @@ class RicReloadFormationNamesFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicStackSelectedCurvesFeature.h b/ApplicationLibCode/Commands/RicStackSelectedCurvesFeature.h index 566836d1f9..4d3d058e6d 100644 --- a/ApplicationLibCode/Commands/RicStackSelectedCurvesFeature.h +++ b/ApplicationLibCode/Commands/RicStackSelectedCurvesFeature.h @@ -41,7 +41,6 @@ class RicStackSelectedCurvesFeature : public caf::CmdFeature, public RicfCommand subsetOfPlotCurvesFromStacking( const std::vector& plotCurves, bool isStacked ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicThemeColorEditorFeature.h b/ApplicationLibCode/Commands/RicThemeColorEditorFeature.h index 5e2b09478a..c18dbebdc0 100644 --- a/ApplicationLibCode/Commands/RicThemeColorEditorFeature.h +++ b/ApplicationLibCode/Commands/RicThemeColorEditorFeature.h @@ -28,7 +28,6 @@ class RicThemeColorEditorFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicTogglePerspectiveViewFeature.h b/ApplicationLibCode/Commands/RicTogglePerspectiveViewFeature.h index cd00339147..3c003590e6 100644 --- a/ApplicationLibCode/Commands/RicTogglePerspectiveViewFeature.h +++ b/ApplicationLibCode/Commands/RicTogglePerspectiveViewFeature.h @@ -29,7 +29,6 @@ class RicTogglePerspectiveViewFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/RicUnstackSelectedCurvesFeature.h b/ApplicationLibCode/Commands/RicUnstackSelectedCurvesFeature.h index 18bff2fc0c..6810157789 100644 --- a/ApplicationLibCode/Commands/RicUnstackSelectedCurvesFeature.h +++ b/ApplicationLibCode/Commands/RicUnstackSelectedCurvesFeature.h @@ -38,7 +38,6 @@ class RicUnstackSelectedCurvesFeature : public caf::CmdFeature, public RicfComma caf::PdmScriptResponse execute() override; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.h b/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.h index 6cdb86a22c..2dcf2a7d73 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.h +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RicWellPathsImportSsihubFeature.h @@ -29,7 +29,6 @@ class RicWellPathsImportSsihubFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/StreamlineCommands/RicNewStreamlineFeature.h b/ApplicationLibCode/Commands/StreamlineCommands/RicNewStreamlineFeature.h index 504c40c751..a85a088ab5 100644 --- a/ApplicationLibCode/Commands/StreamlineCommands/RicNewStreamlineFeature.h +++ b/ApplicationLibCode/Commands/StreamlineCommands/RicNewStreamlineFeature.h @@ -28,7 +28,6 @@ class RicNewStreamlineFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotCurveFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotCurveFeature.h index 5777608823..9805775091 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotCurveFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotCurveFeature.h @@ -34,7 +34,6 @@ class RicDuplicateSummaryCrossPlotCurveFeature : public RicDuplicateSummaryCurve CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void setupActionLook( QAction* actionToSetup ) override; }; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotFeature.h index d19ba63e7a..f88da1c033 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotFeature.h @@ -32,7 +32,6 @@ class RicDuplicateSummaryCrossPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCurveFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCurveFeature.h index 53761865f9..011ea04454 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCurveFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCurveFeature.h @@ -32,7 +32,6 @@ class RicDuplicateSummaryCurveFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.h index f95cc11b61..2ca3411b64 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.h @@ -32,7 +32,6 @@ class RicDuplicateSummaryPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCrossPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCrossPlotFeature.h index eb1f98e365..69458e4090 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCrossPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCrossPlotFeature.h @@ -37,7 +37,6 @@ class RicEditSummaryCrossPlotFeature : public caf::CmdFeature static RicSummaryPlotEditorDialog* curveCreatorDialog(); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.h index f4fdaefc68..eae29c8dc7 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.h @@ -36,7 +36,6 @@ class RicNewDerivedEnsembleFeature : public caf::CmdFeature static bool showWarningDialogWithQuestion(); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.h index bd2be3a77a..8c6269de77 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedSummaryFeature.h @@ -31,7 +31,6 @@ class RicNewDerivedSummaryFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.h index cc63bd43a4..2984bcde8e 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.h @@ -32,7 +32,6 @@ class RicNewEnsembleCurveFilterFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.h index a291fba533..86c776ec10 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.h @@ -31,7 +31,6 @@ class RicNewGridTimeHistoryCurveFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.h index 9a6c79d100..e8b71e86eb 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotFeature.h @@ -32,7 +32,6 @@ class RicNewSummaryCrossPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; private: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.h index 8c64baf19b..8286a2f564 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.h @@ -36,7 +36,6 @@ class RicNewSummaryCurveFeature : public caf::CmdFeature public: protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h index f9166a06b4..4089320943 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h @@ -37,7 +37,6 @@ class RicNewSummaryEnsembleCurveSetFeature : public caf::CmdFeature static RimSummaryPlot* createPlotForCurveSetsAndUpdate( std::vector ensembles ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h index fbffd769fe..88a5407e10 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h @@ -30,7 +30,6 @@ class RicNewSummaryPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.h index fb2a683b48..11b6575d10 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataCurveFeature.h @@ -33,7 +33,6 @@ class RicPasteAsciiDataCurveFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h index 52403c3bc8..ce8c0971e3 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h @@ -46,7 +46,6 @@ class RicPasteAsciiDataToSummaryPlotFeature : public caf::CmdFeature }; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.h index 185aa58c24..0c11bbb65a 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotCurveFeature.h @@ -36,7 +36,6 @@ class RicPasteSummaryCrossPlotCurveFeature : public RicPasteSummaryCurveFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; // virtual void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotFeature.h index 1f90cb0fd0..6022c6a3c8 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCrossPlotFeature.h @@ -36,7 +36,6 @@ class RicPasteSummaryCrossPlotFeature : public caf::CmdFeature static void copyPlotAndAddToCollection( RimSummaryCrossPlot* sourcePlot ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.h index da39b3121c..07da1abe2c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.h @@ -37,7 +37,6 @@ class RicPasteSummaryCurveFeature : public caf::CmdFeature static RimSummaryCurve* copyCurveAndAddToPlot( RimSummaryCurve* sourceCurve ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.h index a4a4e81c2c..940f97131e 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.h @@ -36,7 +36,6 @@ class RicPasteSummaryPlotFeature : public caf::CmdFeature static void copyPlotAndAddToCollection( RimSummaryPlot* sourcePlot ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.h index c0cb6c74ec..29e4a9428f 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteTimeHistoryCurveFeature.h @@ -33,7 +33,6 @@ class RicPasteTimeHistoryCurveFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.h index 268f4e628b..1fd902964f 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveSwitchAxisFeature.h @@ -35,7 +35,6 @@ class RicSummaryCurveSwitchAxisFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.h index 2c19b4ac1b..5807b55efd 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.h @@ -28,7 +28,6 @@ class RicViewZoomAllFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SurfaceCommands/RicCopySurfaceFeature.h b/ApplicationLibCode/Commands/SurfaceCommands/RicCopySurfaceFeature.h index 8f42e53e3e..9a5be040c2 100644 --- a/ApplicationLibCode/Commands/SurfaceCommands/RicCopySurfaceFeature.h +++ b/ApplicationLibCode/Commands/SurfaceCommands/RicCopySurfaceFeature.h @@ -28,7 +28,6 @@ class RicCopySurfaceFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SurfaceCommands/RicExportKLayerToPtlFeature.h b/ApplicationLibCode/Commands/SurfaceCommands/RicExportKLayerToPtlFeature.h index 119e3c58dc..6d75cec07a 100644 --- a/ApplicationLibCode/Commands/SurfaceCommands/RicExportKLayerToPtlFeature.h +++ b/ApplicationLibCode/Commands/SurfaceCommands/RicExportKLayerToPtlFeature.h @@ -32,7 +32,6 @@ class RicExportKLayerToPtlFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SurfaceCommands/RicExportSurfaceToTsurfFeature.h b/ApplicationLibCode/Commands/SurfaceCommands/RicExportSurfaceToTsurfFeature.h index 4c57e74ec5..9bf4a17fd7 100644 --- a/ApplicationLibCode/Commands/SurfaceCommands/RicExportSurfaceToTsurfFeature.h +++ b/ApplicationLibCode/Commands/SurfaceCommands/RicExportSurfaceToTsurfFeature.h @@ -32,7 +32,6 @@ class RicExportSurfaceToTsurfFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SurfaceCommands/RicImportSurfacesFeature.h b/ApplicationLibCode/Commands/SurfaceCommands/RicImportSurfacesFeature.h index 5dc920b845..b6bb33dd8b 100644 --- a/ApplicationLibCode/Commands/SurfaceCommands/RicImportSurfacesFeature.h +++ b/ApplicationLibCode/Commands/SurfaceCommands/RicImportSurfacesFeature.h @@ -28,7 +28,6 @@ class RicImportSurfacesFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SurfaceCommands/RicNewGridCaseSurfaceFeature.h b/ApplicationLibCode/Commands/SurfaceCommands/RicNewGridCaseSurfaceFeature.h index a3bb029d0c..e5435fa1cd 100644 --- a/ApplicationLibCode/Commands/SurfaceCommands/RicNewGridCaseSurfaceFeature.h +++ b/ApplicationLibCode/Commands/SurfaceCommands/RicNewGridCaseSurfaceFeature.h @@ -28,7 +28,6 @@ class RicNewGridSurfaceFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SurfaceCommands/RicNewSurfaceCollectionFeature.h b/ApplicationLibCode/Commands/SurfaceCommands/RicNewSurfaceCollectionFeature.h index 9754df5520..dc5c031481 100644 --- a/ApplicationLibCode/Commands/SurfaceCommands/RicNewSurfaceCollectionFeature.h +++ b/ApplicationLibCode/Commands/SurfaceCommands/RicNewSurfaceCollectionFeature.h @@ -28,7 +28,6 @@ class RicNewSurfaceCollectionFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/SurfaceCommands/RicReloadSurfaceFeature.h b/ApplicationLibCode/Commands/SurfaceCommands/RicReloadSurfaceFeature.h index e468c374e1..5f83d2725b 100644 --- a/ApplicationLibCode/Commands/SurfaceCommands/RicReloadSurfaceFeature.h +++ b/ApplicationLibCode/Commands/SurfaceCommands/RicReloadSurfaceFeature.h @@ -28,7 +28,6 @@ class RicReloadSurfaceFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeature.h b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeature.h index 95f965cb77..b7afecd793 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeature.h +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeature.h @@ -29,7 +29,6 @@ class RicToggleItemsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOffFeature.h b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOffFeature.h index 16ddc4c153..2e8ae44f76 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOffFeature.h +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOffFeature.h @@ -29,7 +29,6 @@ class RicToggleItemsOffFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnFeature.h b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnFeature.h index a587b2e804..db0e670343 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnFeature.h +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnFeature.h @@ -29,7 +29,6 @@ class RicToggleItemsOnFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.h b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.h index 12686149ac..540f64e6fd 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.h +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.h @@ -37,7 +37,6 @@ class RicToggleItemsOnOthersOffFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ViewLink/RicCompareTo3dViewFeature.h b/ApplicationLibCode/Commands/ViewLink/RicCompareTo3dViewFeature.h index d1e70c9797..359a07e4d7 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicCompareTo3dViewFeature.h +++ b/ApplicationLibCode/Commands/ViewLink/RicCompareTo3dViewFeature.h @@ -28,7 +28,6 @@ class RicCompareTo3dViewFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.h b/ApplicationLibCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.h index 98aca6c909..214a1b46ab 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.h +++ b/ApplicationLibCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.h @@ -31,7 +31,6 @@ class RicDeleteAllLinkedViewsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ViewLink/RicLinkViewFeature.h b/ApplicationLibCode/Commands/ViewLink/RicLinkViewFeature.h index a56def66ad..a9314815a2 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicLinkViewFeature.h +++ b/ApplicationLibCode/Commands/ViewLink/RicLinkViewFeature.h @@ -31,7 +31,6 @@ class RicLinkViewFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.h b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.h index 5f94c6c7f9..32e29d854d 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.h +++ b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.h @@ -36,7 +36,6 @@ class RicLinkVisibleViewsFeature : public caf::CmdFeature static void linkViews( std::vector& views ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; diff --git a/ApplicationLibCode/Commands/ViewLink/RicRemoveComparison3dViewFeature.h b/ApplicationLibCode/Commands/ViewLink/RicRemoveComparison3dViewFeature.h index d5ce10a280..a7949503cb 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicRemoveComparison3dViewFeature.h +++ b/ApplicationLibCode/Commands/ViewLink/RicRemoveComparison3dViewFeature.h @@ -28,7 +28,6 @@ class RicRemoveComparison3dViewFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ViewLink/RicSetMasterViewFeature.h b/ApplicationLibCode/Commands/ViewLink/RicSetMasterViewFeature.h index 46b686441d..ad76867de2 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicSetMasterViewFeature.h +++ b/ApplicationLibCode/Commands/ViewLink/RicSetMasterViewFeature.h @@ -31,7 +31,6 @@ class RicSetMasterViewFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ViewLink/RicShowAllLinkedViewsFeature.h b/ApplicationLibCode/Commands/ViewLink/RicShowAllLinkedViewsFeature.h index 818dde4964..f8bacae4f3 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicShowAllLinkedViewsFeature.h +++ b/ApplicationLibCode/Commands/ViewLink/RicShowAllLinkedViewsFeature.h @@ -31,7 +31,6 @@ class RicShowAllLinkedViewsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ViewLink/RicShowLinkOptionsFeature.h b/ApplicationLibCode/Commands/ViewLink/RicShowLinkOptionsFeature.h index 9c08520249..5cc341827c 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicShowLinkOptionsFeature.h +++ b/ApplicationLibCode/Commands/ViewLink/RicShowLinkOptionsFeature.h @@ -31,7 +31,6 @@ class RicShowLinkOptionsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.h b/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.h index 9a957871c1..7fdaab7a50 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.h +++ b/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.h @@ -31,7 +31,6 @@ class RicUnLinkViewFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/Ric3dWellLogCurveDeleteFeature.h b/ApplicationLibCode/Commands/WellLogCommands/Ric3dWellLogCurveDeleteFeature.h index 1a83bda32c..c9b4f19c15 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/Ric3dWellLogCurveDeleteFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/Ric3dWellLogCurveDeleteFeature.h @@ -29,7 +29,6 @@ class Ric3dWellLogCurveDeleteFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.h index 23868d205a..388272cdc4 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.h @@ -36,7 +36,6 @@ class RicAddWellLogToPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.h index f6b1daacf7..6549a2c9c6 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.h @@ -29,7 +29,6 @@ class RicDeleteSubPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicMoveWellLogFilesFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicMoveWellLogFilesFeature.h index ac61ef4009..af741473e5 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicMoveWellLogFilesFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicMoveWellLogFilesFeature.h @@ -29,7 +29,6 @@ class RicMoveWellLogFilesFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.h index 5ca91dafd5..9220b09d76 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewPltPlotFeature.h @@ -37,7 +37,6 @@ class RicNewPltPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.h index e0242ecd11..58a92ca926 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.h @@ -40,7 +40,6 @@ class RicNewWellBoreStabilityPlotFeature : public caf::CmdFeature const RimWbsParameters* parameters = nullptr ); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.h index a4e07ebcb2..ae20b68218 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeature.h @@ -29,7 +29,6 @@ class RicNewWellLogPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.h index ac93027c1e..8ae342e129 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotTrackFeature.h @@ -31,7 +31,6 @@ class RicNewWellLogPlotTrackFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.h index d6358e8bef..464d0a4589 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.h @@ -33,7 +33,6 @@ class RicPasteWellLogCurveFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.h index 6fb8464941..3e486c56d5 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.h @@ -33,7 +33,6 @@ class RicPasteWellLogPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogTrackFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogTrackFeature.h index 404be8d850..893215c540 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogTrackFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogTrackFeature.h @@ -33,7 +33,6 @@ class RicPasteWellLogTrackFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.h index be951ec239..eea2effd59 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicWellLogFileCloseFeature.h @@ -33,7 +33,6 @@ class RicWellLogFileCloseFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicWellLogsImportFileFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicWellLogsImportFileFeature.h index b1a09252f1..175012465b 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicWellLogsImportFileFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicWellLogsImportFileFeature.h @@ -36,7 +36,6 @@ class RicWellLogsImportFileFeature : public caf::CmdFeature static QStringList wellLogFileNameFilters(); protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.h b/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.h index a9120b3929..60cda7b577 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathAttributeFeature.h @@ -28,7 +28,6 @@ class RicDeleteWellPathAttributeFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.h b/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.h index b31b2462fd..1197da19c9 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathTargetFeature.h @@ -28,7 +28,6 @@ class RicDeleteWellPathTargetFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicImportWellMeasurementsFeature.h b/ApplicationLibCode/Commands/WellPathCommands/RicImportWellMeasurementsFeature.h index a73e0dc463..54ed5a6b40 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicImportWellMeasurementsFeature.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicImportWellMeasurementsFeature.h @@ -28,7 +28,6 @@ class RicImportWellMeasurementsFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.h b/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.h index 984e54e9ac..06470accf1 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewEditableWellPathFeature.h @@ -28,7 +28,6 @@ class RicNewEditableWellPathFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewPolylineTargetFeature.h b/ApplicationLibCode/Commands/WellPathCommands/RicNewPolylineTargetFeature.h index 242e504dae..4466fbc078 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewPolylineTargetFeature.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewPolylineTargetFeature.h @@ -28,7 +28,6 @@ class RicNewPolylineTargetFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.h b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.h index 528d5c3ec5..72a27e7ab7 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathAttributeFeature.h @@ -28,7 +28,6 @@ class RicNewWellPathAttributeFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.h b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.h index 17842d7320..b3eb4e97b0 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicNewWellPathListTargetFeature.h @@ -28,7 +28,6 @@ class RicNewWellPathListTargetFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicShowWellPlanFeature.h b/ApplicationLibCode/Commands/WellPathCommands/RicShowWellPlanFeature.h index dd3e43ff4c..9fb5c62fdb 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicShowWellPlanFeature.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicShowWellPlanFeature.h @@ -28,7 +28,6 @@ class RicShowWellPlanFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; From f154f8c5000466f1db3e19f7d866231eca305a75 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 23 Feb 2022 13:57:02 +0100 Subject: [PATCH 136/406] Import RFT segment data as well log curve (#8449) Add reader for RFT data using opm-common Extend RFT curve with support for RFT segment data Adjustments related to horizontal well log plots 8581 Well Log Plot : Update of curve appearance does not update plot --- .../Application/CMakeLists_files.cmake | 2 + .../Application/RiaRftDefines.cpp | 67 +++ .../Application/RiaRftDefines.h | 33 ++ .../Commands/RicWellLogTools.cpp | 6 +- .../RicPasteWellLogCurveFeature.cpp | 47 +- .../FileInterface/CMakeLists_files.cmake | 4 + .../FileInterface/RifDataSourceForRftPlt.cpp | 6 +- .../FileInterface/RifEclipseRftAddress.cpp | 102 +++- .../FileInterface/RifEclipseRftAddress.h | 39 +- .../FileInterface/RifReaderEclipseRft.cpp | 36 +- .../FileInterface/RifReaderEclipseRft.h | 2 +- .../RifReaderEnsembleStatisticsRft.cpp | 37 +- .../FileInterface/RifReaderFmuRft.cpp | 34 +- .../FileInterface/RifReaderOpmRft.cpp | 488 ++++++++++++++++++ .../FileInterface/RifReaderOpmRft.h | 80 +++ .../FileInterface/RifReaderRftInterface.cpp | 7 + .../FileInterface/RifReaderRftInterface.h | 7 + .../FileInterface/RifRftSegment.cpp | 147 ++++++ .../FileInterface/RifRftSegment.h | 62 +++ .../Flow/RimWellPlotTools.cpp | 2 +- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 6 +- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 28 +- .../GeoMech/RimGeoMechCase.cpp | 8 - .../ProjectDataModel/GeoMech/RimGeoMechCase.h | 2 - ApplicationLibCode/ProjectDataModel/RimCase.h | 2 - .../ProjectDataModel/RimDepthTrackPlot.cpp | 22 + .../ProjectDataModel/RimDepthTrackPlot.h | 3 + .../ProjectDataModel/RimEclipseInputCase.cpp | 21 - .../ProjectDataModel/RimEclipseInputCase.h | 2 - .../ProjectDataModel/RimEclipseResultCase.cpp | 61 +-- .../ProjectDataModel/RimEclipseResultCase.h | 10 +- .../RimEclipseStatisticsCase.h | 1 - .../ProjectDataModel/RimPlotCurve.cpp | 2 +- .../ProjectDataModel/RimProject.cpp | 9 - .../RimDerivedEnsembleCaseCollection.cpp | 2 + .../Summary/RimEnsembleCurveSet.h | 2 +- .../Summary/RimSummaryCaseCollection.cpp | 1 + .../Summary/RimSummaryCaseCollection.h | 4 +- .../WellLog/Rim3dWellLogRftCurve.cpp | 13 +- .../WellLog/Rim3dWellLogRftCurve.h | 2 +- .../WellLog/RimWellLogCurve.cpp | 75 ++- .../WellLog/RimWellLogCurve.h | 10 +- .../WellLog/RimWellLogRftCurve.cpp | 353 +++++++++---- .../WellLog/RimWellLogRftCurve.h | 25 +- .../WellLog/RimWellLogTrack.cpp | 144 ++++-- .../WellLog/RimWellLogTrack.h | 4 +- .../RigWellLogCurveData.cpp | 42 +- .../ReservoirDataModel/RigWellLogCurveData.h | 5 + .../UnitTests/opm-summary-Test.cpp | 249 +++++++++ .../UserInterface/RiuWellLogTrack.cpp | 24 +- .../UserInterface/RiuWellLogTrack.h | 1 - ThirdParty/custom-opm-common/CMakeLists.txt | 1 + 52 files changed, 1943 insertions(+), 399 deletions(-) create mode 100644 ApplicationLibCode/Application/RiaRftDefines.cpp create mode 100644 ApplicationLibCode/Application/RiaRftDefines.h create mode 100644 ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp create mode 100644 ApplicationLibCode/FileInterface/RifReaderOpmRft.h create mode 100644 ApplicationLibCode/FileInterface/RifRftSegment.cpp create mode 100644 ApplicationLibCode/FileInterface/RifRftSegment.h diff --git a/ApplicationLibCode/Application/CMakeLists_files.cmake b/ApplicationLibCode/Application/CMakeLists_files.cmake index 0bd6d1abfc..cb87a9bae2 100644 --- a/ApplicationLibCode/Application/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/CMakeLists_files.cmake @@ -25,6 +25,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaStimPlanModelDefines.h ${CMAKE_CURRENT_LIST_DIR}/RiaResultNames.h ${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.h + ${CMAKE_CURRENT_LIST_DIR}/RiaRftDefines.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -54,6 +55,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaStimPlanModelDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaResultNames.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaRftDefines.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Application/RiaRftDefines.cpp b/ApplicationLibCode/Application/RiaRftDefines.cpp new file mode 100644 index 0000000000..410dde165b --- /dev/null +++ b/ApplicationLibCode/Application/RiaRftDefines.cpp @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiaRftDefines.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::segmentStartDepthResultName() +{ + return "SEGLENST"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::segmentEndDepthResultName() +{ + return "SEGLENEN"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::segmentTvdDepthResultName() +{ + return "SEGDEPTH"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::segmentNumberResultName() +{ + return "SEGMENTNUMBER"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::allBranches() +{ + return "All"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaDefines::segmentBranchNumberResultName() +{ + return "SegmenBranchNumber"; +} diff --git a/ApplicationLibCode/Application/RiaRftDefines.h b/ApplicationLibCode/Application/RiaRftDefines.h new file mode 100644 index 0000000000..2f5aa238bb --- /dev/null +++ b/ApplicationLibCode/Application/RiaRftDefines.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include + +namespace RiaDefines +{ +QString segmentStartDepthResultName(); +QString segmentEndDepthResultName(); +QString segmentTvdDepthResultName(); +QString segmentNumberResultName(); + +QString allBranches(); +QString segmentBranchNumberResultName(); + +}; // namespace RiaDefines diff --git a/ApplicationLibCode/Commands/RicWellLogTools.cpp b/ApplicationLibCode/Commands/RicWellLogTools.cpp index 02ce78e04e..91464ac211 100644 --- a/ApplicationLibCode/Commands/RicWellLogTools.cpp +++ b/ApplicationLibCode/Commands/RicWellLogTools.cpp @@ -108,7 +108,11 @@ bool RicWellLogTools::hasRftDataForWell( const QString& wellName ) { if ( resultCase->rftReader() ) { - return resultCase->rftReader()->wellHasRftData( wellName ); + auto wellNames = resultCase->rftReader()->wellNames(); + for ( const auto& w : wellNames ) + { + if ( w == wellName ) return true; + } } } } diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.cpp index 13885dc809..7cebe4fbcf 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogCurveFeature.cpp @@ -25,6 +25,7 @@ #include "RimWellLogCurve.h" #include "RimWellLogExtractionCurve.h" #include "RimWellLogFileCurve.h" +#include "RimWellLogRftCurve.h" #include "RimWellLogTrack.h" #include "RimWellMeasurementCurve.h" @@ -46,8 +47,7 @@ bool RicPasteWellLogCurveFeature::isCommandEnabled() if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false; if ( RicWellLogPlotCurveFeatureImpl::parentWellRftPlot() ) return false; - caf::PdmObjectHandle* destinationObject = - dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + auto* destinationObject = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); if ( !destinationObject ) return false; RimWellLogTrack* wellLogTrack = nullptr; @@ -62,16 +62,16 @@ bool RicPasteWellLogCurveFeature::isCommandEnabled() std::vector> sourceObjects = RicPasteWellLogCurveFeature::curves(); - for ( size_t i = 0; i < sourceObjects.size(); i++ ) + for ( const auto& sourceObject : sourceObjects ) { RimWellBoreStabilityPlot* originalWbsPlot = nullptr; - sourceObjects[i]->firstAncestorOrThisOfType( originalWbsPlot ); + sourceObject->firstAncestorOrThisOfType( originalWbsPlot ); if ( originalWbsPlot && originalWbsPlot != wbsPlotToPasteInto ) { return false; } } - return RicPasteWellLogCurveFeature::curves().size() > 0; + return !RicPasteWellLogCurveFeature::curves().empty(); } //-------------------------------------------------------------------------------------------------- @@ -81,8 +81,7 @@ void RicPasteWellLogCurveFeature::onActionTriggered( bool isChecked ) { if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return; - caf::PdmObjectHandle* destinationObject = - dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + auto* destinationObject = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); if ( !destinationObject ) return; RimWellLogTrack* wellLogTrack = nullptr; @@ -97,39 +96,23 @@ void RicPasteWellLogCurveFeature::onActionTriggered( bool isChecked ) std::vector> sourceObjects = RicPasteWellLogCurveFeature::curves(); - for ( size_t i = 0; i < sourceObjects.size(); i++ ) + for ( const auto& sourceObject : sourceObjects ) { RimWellBoreStabilityPlot* originalWbsPlot = nullptr; - sourceObjects[i]->firstAncestorOrThisOfType( originalWbsPlot ); + sourceObject->firstAncestorOrThisOfType( originalWbsPlot ); if ( originalWbsPlot && originalWbsPlot != wbsPlotToPasteInto ) { continue; } - RimWellLogFileCurve* fileCurve = dynamic_cast( sourceObjects[i].p() ); - RimWellMeasurementCurve* measurementCurve = dynamic_cast( sourceObjects[i].p() ); - if ( fileCurve || measurementCurve ) + auto* fileCurve = dynamic_cast( sourceObject.p() ); + auto* measurementCurve = dynamic_cast( sourceObject.p() ); + auto* extractionCurve = dynamic_cast( sourceObject.p() ); + auto* rftCurve = dynamic_cast( sourceObject.p() ); + if ( fileCurve || measurementCurve || extractionCurve || rftCurve ) { - RimWellLogFileCurve* newObject = dynamic_cast( - sourceObjects[i]->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); - CVF_ASSERT( newObject ); - - wellLogTrack->addCurve( newObject ); - - // Resolve references after object has been inserted into the project data model - newObject->resolveReferencesRecursively(); - newObject->initAfterReadRecursively(); - - newObject->loadDataAndUpdate( true ); - - wellLogTrack->updateConnectedEditors(); - } - - RimWellLogExtractionCurve* extractionCurve = dynamic_cast( sourceObjects[i].p() ); - if ( extractionCurve ) - { - RimWellLogExtractionCurve* newObject = dynamic_cast( - sourceObjects[i]->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + auto* newObject = dynamic_cast( + sourceObject->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); CVF_ASSERT( newObject ); wellLogTrack->addCurve( newObject ); diff --git a/ApplicationLibCode/FileInterface/CMakeLists_files.cmake b/ApplicationLibCode/FileInterface/CMakeLists_files.cmake index a45e86fc81..5da763a486 100644 --- a/ApplicationLibCode/FileInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/FileInterface/CMakeLists_files.cmake @@ -71,6 +71,8 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RifEclipseKeywordContent.h ${CMAKE_CURRENT_LIST_DIR}/RifMultipleSummaryReaders.h ${CMAKE_CURRENT_LIST_DIR}/RifProjectSummaryDataWriter.h + ${CMAKE_CURRENT_LIST_DIR}/RifReaderOpmRft.h + ${CMAKE_CURRENT_LIST_DIR}/RifRftSegment.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -143,6 +145,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RifEclipseTextFileReader.cpp ${CMAKE_CURRENT_LIST_DIR}/RifMultipleSummaryReaders.cpp ${CMAKE_CURRENT_LIST_DIR}/RifProjectSummaryDataWriter.cpp + ${CMAKE_CURRENT_LIST_DIR}/RifReaderOpmRft.cpp + ${CMAKE_CURRENT_LIST_DIR}/RifRftSegment.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/FileInterface/RifDataSourceForRftPlt.cpp b/ApplicationLibCode/FileInterface/RifDataSourceForRftPlt.cpp index b500e6ddd3..aa2ebdd264 100644 --- a/ApplicationLibCode/FileInterface/RifDataSourceForRftPlt.cpp +++ b/ApplicationLibCode/FileInterface/RifDataSourceForRftPlt.cpp @@ -17,15 +17,19 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RifDataSourceForRftPlt.h" + +#include "RifReaderEclipseRft.h" + #include "RimEclipseCase.h" +#include "RimEclipseResultCase.h" #include "RimObservedFmuRftData.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimWellLogFile.h" -#include "RimEclipseResultCase.h" #include "cafAppEnum.h" #include "cvfAssert.h" + #include #include diff --git a/ApplicationLibCode/FileInterface/RifEclipseRftAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseRftAddress.cpp index 1c2f7041ee..25b210d2da 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseRftAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseRftAddress.cpp @@ -23,9 +23,103 @@ //-------------------------------------------------------------------------------------------------- RifEclipseRftAddress::RifEclipseRftAddress( QString wellName, QDateTime timeStep, RftWellLogChannelType wellLogChannelName ) : m_wellName( wellName ) + , m_timeStep( timeStep ) , m_wellLogChannel( wellLogChannelName ) + , m_segmentBranchNumber( -1 ) { - m_timeStep = timeStep; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifEclipseRftAddress RifEclipseRftAddress::createSegmentResult( const QString& wellName, + const QDateTime& dateTime, + const QString& resultName ) +{ + auto adr = RifEclipseRftAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ); + + adr.setSegmentResultName( resultName ); + + return adr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifEclipseRftAddress::setSegmentResultName( const QString& resultName ) +{ + m_segmentResultName = resultName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RifEclipseRftAddress::segmentResultName() const +{ + return m_segmentResultName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifEclipseRftAddress::setSegmentBranchNumber( int branchNumber ) +{ + m_segmentBranchNumber = branchNumber; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifEclipseRftAddress::segmentBranchNumber() const +{ + return m_segmentBranchNumber; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QString& RifEclipseRftAddress::wellName() const +{ + return m_wellName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QDateTime RifEclipseRftAddress::timeStep() const +{ + return m_timeStep; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const RifEclipseRftAddress::RifEclipseRftAddress::RftWellLogChannelType& RifEclipseRftAddress::wellLogChannel() const +{ + return m_wellLogChannel; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RifEclipseRftAddress::rftPlotChannelTypes() +{ + return { RifEclipseRftAddress::RftWellLogChannelType::PRESSURE, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_ERROR, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_MEAN, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P10, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P90 }; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RifEclipseRftAddress::pltPlotChannelTypes() +{ + return { RifEclipseRftAddress::RftWellLogChannelType::ORAT, + RifEclipseRftAddress::RftWellLogChannelType::WRAT, + RifEclipseRftAddress::RftWellLogChannelType::GRAT }; } //-------------------------------------------------------------------------------------------------- @@ -36,6 +130,8 @@ bool operator==( const RifEclipseRftAddress& first, const RifEclipseRftAddress& if ( first.wellName() != second.wellName() ) return false; if ( first.timeStep() != second.timeStep() ) return false; if ( first.wellLogChannel() != second.wellLogChannel() ) return false; + if ( first.segmentResultName() != second.segmentResultName() ) return false; + if ( first.segmentBranchNumber() != second.segmentBranchNumber() ) return false; return true; } @@ -49,6 +145,10 @@ bool operator<( const RifEclipseRftAddress& first, const RifEclipseRftAddress& s if ( first.timeStep() != second.timeStep() ) return ( first.timeStep() < second.timeStep() ); if ( first.wellLogChannel() != second.wellLogChannel() ) return ( first.wellLogChannel() < second.wellLogChannel() ); + if ( first.segmentResultName() != second.segmentResultName() ) + return first.segmentResultName() < second.segmentResultName(); + if ( first.segmentBranchNumber() != second.segmentBranchNumber() ) + return first.segmentBranchNumber() < second.segmentBranchNumber(); return false; } diff --git a/ApplicationLibCode/FileInterface/RifEclipseRftAddress.h b/ApplicationLibCode/FileInterface/RifEclipseRftAddress.h index ed0e610b5e..bd8cf929a7 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseRftAddress.h +++ b/ApplicationLibCode/FileInterface/RifEclipseRftAddress.h @@ -31,7 +31,7 @@ class RifEclipseRftAddress { public: - enum RftWellLogChannelType + enum class RftWellLogChannelType { NONE, TVD, @@ -47,35 +47,38 @@ class RifEclipseRftAddress PRESSURE_P50, PRESSURE_P90, PRESSURE_MEAN, - PRESSURE_ERROR + PRESSURE_ERROR, + SEGMENT_VALUES }; public: RifEclipseRftAddress( QString wellName, QDateTime timeStep, RftWellLogChannelType wellLogChannel ); - const QString& wellName() const { return m_wellName; } - QDateTime timeStep() const { return m_timeStep; } - const RftWellLogChannelType& wellLogChannel() const { return m_wellLogChannel; } + static RifEclipseRftAddress + createSegmentResult( const QString& wellName, const QDateTime& dateTime, const QString& resultName ); - static std::set rftPlotChannelTypes() - { - return {RifEclipseRftAddress::PRESSURE, - RifEclipseRftAddress::PRESSURE_ERROR, - RifEclipseRftAddress::PRESSURE_MEAN, - RifEclipseRftAddress::PRESSURE_P10, - RifEclipseRftAddress::PRESSURE_P50, - RifEclipseRftAddress::PRESSURE_P90}; - } + QString segmentResultName() const; - static std::set pltPlotChannelTypes() - { - return {RifEclipseRftAddress::ORAT, RifEclipseRftAddress::WRAT, RifEclipseRftAddress::GRAT}; - } + void setSegmentBranchNumber( int branchNumber ); + int segmentBranchNumber() const; + + const QString& wellName() const; + QDateTime timeStep() const; + const RftWellLogChannelType& wellLogChannel() const; + + static std::set rftPlotChannelTypes(); + static std::set pltPlotChannelTypes(); + +private: + void setSegmentResultName( const QString& resultName ); private: QString m_wellName; QDateTime m_timeStep; RftWellLogChannelType m_wellLogChannel; + + QString m_segmentResultName; + int m_segmentBranchNumber; }; bool operator==( const RifEclipseRftAddress& first, const RifEclipseRftAddress& second ); diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp index 152e43c26b..474de5ad53 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp @@ -89,39 +89,39 @@ void RifReaderEclipseRft::open() QDateTime timeStep = RiaQDateTimeTools::createUtcDateTime(); timeStep.setTime_t( timeStepTime_t ); - RifEclipseRftAddress addressPressure( wellName, timeStep, RifEclipseRftAddress::PRESSURE ); + RifEclipseRftAddress addressPressure( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); m_eclipseRftAddresses.insert( addressPressure ); m_rftAddressToLibeclNodeIdx[addressPressure] = i; - RifEclipseRftAddress addressDepth( wellName, timeStep, RifEclipseRftAddress::TVD ); + RifEclipseRftAddress addressDepth( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); m_eclipseRftAddresses.insert( addressDepth ); m_rftAddressToLibeclNodeIdx[addressDepth] = i; if ( ecl_rft_node_is_RFT( node ) ) { - RifEclipseRftAddress addressSwat( wellName, timeStep, RifEclipseRftAddress::SWAT ); + RifEclipseRftAddress addressSwat( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::SWAT ); m_eclipseRftAddresses.insert( addressSwat ); m_rftAddressToLibeclNodeIdx[addressSwat] = i; - RifEclipseRftAddress addressSoil( wellName, timeStep, RifEclipseRftAddress::SOIL ); + RifEclipseRftAddress addressSoil( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::SOIL ); m_eclipseRftAddresses.insert( addressSoil ); m_rftAddressToLibeclNodeIdx[addressSoil] = i; - RifEclipseRftAddress addressSgas( wellName, timeStep, RifEclipseRftAddress::SGAS ); + RifEclipseRftAddress addressSgas( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::SGAS ); m_eclipseRftAddresses.insert( addressSgas ); m_rftAddressToLibeclNodeIdx[addressSgas] = i; } else if ( ecl_rft_node_is_PLT( node ) ) { - RifEclipseRftAddress addressWrat( wellName, timeStep, RifEclipseRftAddress::WRAT ); + RifEclipseRftAddress addressWrat( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::WRAT ); m_eclipseRftAddresses.insert( addressWrat ); m_rftAddressToLibeclNodeIdx[addressWrat] = i; - RifEclipseRftAddress addressOrat( wellName, timeStep, RifEclipseRftAddress::ORAT ); + RifEclipseRftAddress addressOrat( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::ORAT ); m_eclipseRftAddresses.insert( addressOrat ); m_rftAddressToLibeclNodeIdx[addressOrat] = i; - RifEclipseRftAddress addressGrat( wellName, timeStep, RifEclipseRftAddress::GRAT ); + RifEclipseRftAddress addressGrat( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::GRAT ); m_eclipseRftAddresses.insert( addressGrat ); m_rftAddressToLibeclNodeIdx[addressGrat] = i; } @@ -166,7 +166,7 @@ void RifReaderEclipseRft::values( const RifEclipseRftAddress& rftAddress, std::v switch ( wellLogChannelName ) { - case RifEclipseRftAddress::TVD: + case RifEclipseRftAddress::RftWellLogChannelType::TVD: { for ( int i = 0; i < ecl_rft_node_get_size( node ); i++ ) { @@ -174,7 +174,7 @@ void RifReaderEclipseRft::values( const RifEclipseRftAddress& rftAddress, std::v } break; } - case RifEclipseRftAddress::PRESSURE: + case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE: { for ( int i = 0; i < ecl_rft_node_get_size( node ); i++ ) { @@ -182,7 +182,7 @@ void RifReaderEclipseRft::values( const RifEclipseRftAddress& rftAddress, std::v } break; } - case RifEclipseRftAddress::SWAT: + case RifEclipseRftAddress::RftWellLogChannelType::SWAT: { for ( int i = 0; i < ecl_rft_node_get_size( node ); i++ ) { @@ -190,7 +190,7 @@ void RifReaderEclipseRft::values( const RifEclipseRftAddress& rftAddress, std::v } break; } - case RifEclipseRftAddress::SOIL: + case RifEclipseRftAddress::RftWellLogChannelType::SOIL: { for ( int i = 0; i < ecl_rft_node_get_size( node ); i++ ) { @@ -198,7 +198,7 @@ void RifReaderEclipseRft::values( const RifEclipseRftAddress& rftAddress, std::v } break; } - case RifEclipseRftAddress::SGAS: + case RifEclipseRftAddress::RftWellLogChannelType::SGAS: { for ( int i = 0; i < ecl_rft_node_get_size( node ); i++ ) { @@ -206,7 +206,7 @@ void RifReaderEclipseRft::values( const RifEclipseRftAddress& rftAddress, std::v } break; } - case RifEclipseRftAddress::WRAT: + case RifEclipseRftAddress::RftWellLogChannelType::WRAT: { for ( int i = 0; i < ecl_rft_node_get_size( node ); i++ ) { @@ -214,7 +214,7 @@ void RifReaderEclipseRft::values( const RifEclipseRftAddress& rftAddress, std::v } break; } - case RifEclipseRftAddress::ORAT: + case RifEclipseRftAddress::RftWellLogChannelType::ORAT: { for ( int i = 0; i < ecl_rft_node_get_size( node ); i++ ) { @@ -222,7 +222,7 @@ void RifReaderEclipseRft::values( const RifEclipseRftAddress& rftAddress, std::v } break; } - case RifEclipseRftAddress::GRAT: + case RifEclipseRftAddress::RftWellLogChannelType::GRAT: { for ( int i = 0; i < ecl_rft_node_get_size( node ); i++ ) { @@ -351,7 +351,7 @@ std::set RifReaderEclipseRft::avail if ( !pressureFound ) { - if ( name == RifEclipseRftAddress::PRESSURE ) + if ( name == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ) { pressureFound = true; if ( rftFound && pltFound ) break; @@ -381,7 +381,7 @@ std::set RifReaderEclipseRft::avail if ( pressureFound ) { - wellLogChannelNames.insert( RifEclipseRftAddress::PRESSURE ); + wellLogChannelNames.insert( RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); } if ( rftFound ) { diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseRft.h b/ApplicationLibCode/FileInterface/RifReaderEclipseRft.h index 11352f874b..931ebaa0dd 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseRft.h +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseRft.h @@ -45,7 +45,7 @@ class RifReaderEclipseRft : public RifReaderRftInterface, public cvf::Object std::set eclipseRftAddresses() override; void values( const RifEclipseRftAddress& rftAddress, std::vector* values ) override; - void cellIndices( const RifEclipseRftAddress& rftAddress, std::vector* indices ); + void cellIndices( const RifEclipseRftAddress& rftAddress, std::vector* indices ) override; std::set availableTimeSteps( const QString& wellName ) override; std::set diff --git a/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp b/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp index b47c0ef84d..9efaa1b232 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp @@ -53,16 +53,17 @@ std::set RifReaderEnsembleStatisticsRft::eclipseRftAddress std::set statisticsAddresses; for ( const RifEclipseRftAddress& regularAddress : allAddresses ) { - if ( regularAddress.wellLogChannel() == RifEclipseRftAddress::TVD ) + if ( regularAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::TVD ) { statisticsAddresses.insert( regularAddress ); } - else if ( regularAddress.wellLogChannel() == RifEclipseRftAddress::PRESSURE ) + else if ( regularAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ) { - std::set statChannels = { RifEclipseRftAddress::PRESSURE_P10, - RifEclipseRftAddress::PRESSURE_P50, - RifEclipseRftAddress::PRESSURE_P90, - RifEclipseRftAddress::PRESSURE_MEAN }; + std::set statChannels = + { RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P10, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P90, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_MEAN }; for ( auto channel : statChannels ) { statisticsAddresses.insert( @@ -78,12 +79,12 @@ std::set RifReaderEnsembleStatisticsRft::eclipseRftAddress //-------------------------------------------------------------------------------------------------- void RifReaderEnsembleStatisticsRft::values( const RifEclipseRftAddress& rftAddress, std::vector* values ) { - CAF_ASSERT( rftAddress.wellLogChannel() == RifEclipseRftAddress::TVD || - rftAddress.wellLogChannel() == RifEclipseRftAddress::PRESSURE_MEAN || - rftAddress.wellLogChannel() == RifEclipseRftAddress::PRESSURE_P10 || - rftAddress.wellLogChannel() == RifEclipseRftAddress::PRESSURE_P50 || - rftAddress.wellLogChannel() == RifEclipseRftAddress::PRESSURE_P90 || - rftAddress.wellLogChannel() == RifEclipseRftAddress::PRESSURE_ERROR ); + CAF_ASSERT( rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::TVD || + rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_MEAN || + rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P10 || + rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50 || + rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P90 || + rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_ERROR ); auto it = m_cachedValues.find( rftAddress ); if ( it == m_cachedValues.end() ) @@ -191,13 +192,13 @@ void RifReaderEnsembleStatisticsRft::calculateStatistics( const RifEclipseRftAdd { const QString& wellName = rftAddress.wellName(); const QDateTime& timeStep = rftAddress.timeStep(); - RifEclipseRftAddress depthAddress( wellName, timeStep, RifEclipseRftAddress::TVD ); - RifEclipseRftAddress pressAddress( wellName, timeStep, RifEclipseRftAddress::PRESSURE ); + RifEclipseRftAddress depthAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); + RifEclipseRftAddress pressAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); - RifEclipseRftAddress p10Address( wellName, timeStep, RifEclipseRftAddress::PRESSURE_P10 ); - RifEclipseRftAddress p50Address( wellName, timeStep, RifEclipseRftAddress::PRESSURE_P50 ); - RifEclipseRftAddress p90Address( wellName, timeStep, RifEclipseRftAddress::PRESSURE_P90 ); - RifEclipseRftAddress meanAddress( wellName, timeStep, RifEclipseRftAddress::PRESSURE_MEAN ); + RifEclipseRftAddress p10Address( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P10 ); + RifEclipseRftAddress p50Address( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50 ); + RifEclipseRftAddress p90Address( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P90 ); + RifEclipseRftAddress meanAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_MEAN ); RiaCurveMerger curveMerger; diff --git a/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp b/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp index dfc9bc6314..ea4d7d9653 100644 --- a/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp @@ -194,10 +194,14 @@ std::set RifReaderFmuRft::eclipseRftAddresses() { if ( observation.valid() ) { - RifEclipseRftAddress tvdAddress( wellName, dateTime, RifEclipseRftAddress::TVD ); - RifEclipseRftAddress mdAddress( wellName, dateTime, RifEclipseRftAddress::MD ); - RifEclipseRftAddress pressureAddress( wellName, dateTime, RifEclipseRftAddress::PRESSURE ); - RifEclipseRftAddress pressureErrorAddress( wellName, dateTime, RifEclipseRftAddress::PRESSURE_ERROR ); + RifEclipseRftAddress tvdAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::TVD ); + RifEclipseRftAddress mdAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::MD ); + RifEclipseRftAddress pressureAddress( wellName, + dateTime, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); + RifEclipseRftAddress pressureErrorAddress( wellName, + dateTime, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_ERROR ); allAddresses.insert( tvdAddress ); allAddresses.insert( mdAddress ); allAddresses.insert( pressureAddress ); @@ -230,16 +234,16 @@ void RifReaderFmuRft::values( const RifEclipseRftAddress& rftAddress, std::vecto { switch ( rftAddress.wellLogChannel() ) { - case RifEclipseRftAddress::TVD: + case RifEclipseRftAddress::RftWellLogChannelType::TVD: values->push_back( observation.tvdmsl ); break; - case RifEclipseRftAddress::MD: + case RifEclipseRftAddress::RftWellLogChannelType::MD: values->push_back( observation.mdrkb ); break; - case RifEclipseRftAddress::PRESSURE: + case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE: values->push_back( observation.pressure ); break; - case RifEclipseRftAddress::PRESSURE_ERROR: + case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_ERROR: values->push_back( observation.pressureError ); break; default: @@ -309,8 +313,9 @@ std::set RifReaderFmuRft::availableTimeSteps( const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName ) { - if ( wellLogChannelName == RifEclipseRftAddress::TVD || wellLogChannelName == RifEclipseRftAddress::MD || - wellLogChannelName == RifEclipseRftAddress::PRESSURE ) + if ( wellLogChannelName == RifEclipseRftAddress::RftWellLogChannelType::TVD || + wellLogChannelName == RifEclipseRftAddress::RftWellLogChannelType::MD || + wellLogChannelName == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ) { return availableTimeSteps( wellName ); } @@ -342,8 +347,9 @@ std::set RifReaderFmuRft::availableTimeSteps( const QString& wellName, const std::set& relevantChannels ) { - if ( relevantChannels.count( RifEclipseRftAddress::TVD ) || relevantChannels.count( RifEclipseRftAddress::MD ) || - relevantChannels.count( RifEclipseRftAddress::PRESSURE ) ) + if ( relevantChannels.count( RifEclipseRftAddress::RftWellLogChannelType::TVD ) || + relevantChannels.count( RifEclipseRftAddress::RftWellLogChannelType::MD ) || + relevantChannels.count( RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ) ) { return availableTimeSteps( wellName ); } @@ -362,7 +368,9 @@ std::set RifReaderFmuRft::available if ( !m_allWellObservations.empty() ) { - return { RifEclipseRftAddress::TVD, RifEclipseRftAddress::MD, RifEclipseRftAddress::PRESSURE }; + return { RifEclipseRftAddress::RftWellLogChannelType::TVD, + RifEclipseRftAddress::RftWellLogChannelType::MD, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE }; } return {}; } diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp new file mode 100644 index 0000000000..b73840b077 --- /dev/null +++ b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp @@ -0,0 +1,488 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RifReaderOpmRft.h" + +#include "RiaLogging.h" +#include "RiaQDateTimeTools.h" +#include "RiaRftDefines.h" +#include "RiaStdStringTools.h" + +#include "opm/io/eclipse/ERft.hpp" + +#include "cafAssert.h" +#include "cafVecIjk.h" + +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifReaderOpmRft::RifReaderOpmRft( const QString& fileName ) +{ + try + { + m_opm_rft = std::make_unique( fileName.toStdString() ); + + buildMetaData(); + } + catch ( ... ) + { + RiaLogging::error( QString( "Failed to open RFT file %1" ).arg( fileName ) ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RifReaderOpmRft::eclipseRftAddresses() +{ + return m_addresses; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderOpmRft::values( const RifEclipseRftAddress& rftAddress, std::vector* values ) +{ + auto wellName = rftAddress.wellName().toStdString(); + auto resultName = rftAddress.segmentResultName().toStdString(); + + auto qDate = rftAddress.timeStep().date(); + int y = qDate.year(); + int m = qDate.month(); + int d = qDate.day(); + + if ( rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ) + { + auto key = std::make_pair( wellName, RftDate{ y, m, d } ); + auto segment = m_rftWellDateSegments[key]; + + if ( rftAddress.segmentResultName() == RiaDefines::segmentNumberResultName() ) + { + auto data = segment.topology(); + + auto indices = segment.indicesForBranchNumber( rftAddress.segmentBranchNumber() ); + for ( const auto& i : indices ) + { + CAF_ASSERT( i < data.size() ); + values->push_back( data[i].segNo() ); + } + } + else if ( rftAddress.segmentResultName() == RiaDefines::segmentBranchNumberResultName() ) + { + auto branchNumbers = segment.branchIds(); + for ( const auto& branchNumber : branchNumbers ) + { + values->push_back( branchNumber ); + } + } + } + + if ( resultName.empty() ) + { + resultName = RifReaderOpmRft::resultNameFromChannelType( rftAddress.wellLogChannel() ); + } + + try + { + auto data = m_opm_rft->getRft( resultName, wellName, y, m, d ); + if ( !data.empty() ) + { + if ( rftAddress.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ) + { + auto key = std::make_pair( wellName, RftDate{ y, m, d } ); + auto segment = m_rftWellDateSegments[key]; + + auto indices = segment.indicesForBranchNumber( rftAddress.segmentBranchNumber() ); + for ( const auto& i : indices ) + { + CAF_ASSERT( i < data.size() ); + values->push_back( data[i] ); + } + } + else + { + values->insert( values->end(), data.begin(), data.end() ); + } + } + } + catch ( ... ) + { + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RifReaderOpmRft::availableTimeSteps( const QString& wellName ) +{ + std::set timeSteps; + + for ( const auto& address : m_addresses ) + { + if ( address.wellName() == wellName ) + { + timeSteps.insert( address.timeStep() ); + } + } + return timeSteps; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set + RifReaderOpmRft::availableTimeSteps( const QString& wellName, + const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName ) +{ + std::set timeSteps; + + for ( const auto& address : m_addresses ) + { + if ( address.wellName() == wellName && address.wellLogChannel() == wellLogChannelName ) + { + timeSteps.insert( address.timeStep() ); + } + } + return timeSteps; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set + RifReaderOpmRft::availableTimeSteps( const QString& wellName, + const std::set& relevantChannels ) +{ + std::set timeSteps; + + for ( const auto& address : m_addresses ) + { + if ( address.wellName() == wellName && relevantChannels.count( address.wellLogChannel() ) ) + { + timeSteps.insert( address.timeStep() ); + } + } + return timeSteps; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RifReaderOpmRft::availableWellLogChannels( const QString& wellName ) +{ + std::set types; + + for ( const auto& a : m_addresses ) + { + if ( ( a.wellName() == wellName ) && ( a.wellLogChannel() != RifEclipseRftAddress::RftWellLogChannelType::NONE ) ) + { + types.insert( a.wellLogChannel() ); + } + } + + return types; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set RifReaderOpmRft::wellNames() +{ + return m_wellNames; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderOpmRft::cellIndices( const RifEclipseRftAddress& rftAddress, std::vector* indices ) +{ + auto wellName = rftAddress.wellName().toStdString(); + + auto date = rftAddress.timeStep().date(); + int y = date.year(); + int m = date.month(); + int d = date.day(); + + try + { + auto resultNameI = "CONIPOS"; + auto dataI = m_opm_rft->getRft( resultNameI, wellName, y, m, d ); + + auto resultNameJ = "CONJPOS"; + auto dataJ = m_opm_rft->getRft( resultNameJ, wellName, y, m, d ); + + auto resultNameK = "CONKPOS"; + auto dataK = m_opm_rft->getRft( resultNameK, wellName, y, m, d ); + + if ( !dataI.empty() && ( dataI.size() == dataJ.size() ) && ( dataI.size() == dataK.size() ) ) + { + for ( size_t n = 0; n < dataI.size(); n++ ) + { + // NB: Transform to zero-based cell indices + indices->push_back( caf::VecIjk( dataI[n] - 1, dataJ[n] - 1, dataK[n] - 1 ) ); + } + } + } + catch ( ... ) + { + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderOpmRft::buildMetaData() +{ + // TODO: Assert better than return? + if ( !isOpen() ) return; + + importWellNames(); + + auto reports = m_opm_rft->listOfRftReports(); + for ( const auto& report : reports ) + { + auto [wellName, reportDate, reportTime] = report; + auto rftVectors = m_opm_rft->listOfRftArrays( wellName, reportDate ); + + for ( const auto& rftVec : rftVectors ) + { + auto [resultDataName, arrType, itemCount] = rftVec; + + int y = std::get<0>( reportDate ); + int m = std::get<1>( reportDate ); + int d = std::get<2>( reportDate ); + + auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) ); + + auto channelTypes = identifyChannelType( resultDataName ); + if ( channelTypes != RifEclipseRftAddress::RftWellLogChannelType::NONE ) + { + auto adr = RifEclipseRftAddress( QString::fromStdString( wellName ), dt, channelTypes ); + m_addresses.insert( adr ); + } + } + } + + buildSegmentData(); + + // Create segment result addresses + for ( const auto& segmentWellData : m_rftWellDateSegments ) + { + auto [wellName, reportDate] = segmentWellData.first; + auto segmentData = segmentWellData.second; + + auto resultNameAndSizes = segmentData.resultNameAndSize(); + + int y = std::get<0>( reportDate ); + int m = std::get<1>( reportDate ); + int d = std::get<2>( reportDate ); + + auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) ); + + auto segmentCount = segmentData.topology().size(); + + for ( const auto& resultNameAndSize : resultNameAndSizes ) + { + auto resultValueCount = std::get<2>( resultNameAndSize ); + + if ( static_cast( resultValueCount ) != segmentCount ) continue; + + auto resultName = std::get<0>( resultNameAndSize ); + auto adr = RifEclipseRftAddress::createSegmentResult( QString::fromStdString( wellName ), + dt, + QString::fromStdString( resultName ) ); + + m_addresses.insert( adr ); + } + + auto adr = RifEclipseRftAddress::createSegmentResult( QString::fromStdString( wellName ), + dt, + RiaDefines::segmentNumberResultName() ); + + m_addresses.insert( adr ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderOpmRft::buildSegmentData() +{ + m_rftWellDateSegments.clear(); + + auto wellNames = m_opm_rft->listOfWells(); + auto dates = m_opm_rft->listOfdates(); + + for ( const auto& wellName : wellNames ) + { + for ( const auto& date : dates ) + { + std::vector segmentsForWellDate; + + std::vector segnxt = importWellData( wellName, "SEGNXT", date ); + std::vector segbrno = importWellData( wellName, "SEGBRNO", date ); + std::vector brnstValues = importWellData( wellName, "BRNST", date ); + std::vector brnenValues = importWellData( wellName, "BRNEN", date ); + + if ( segnxt.empty() ) continue; + if ( segnxt.size() != segbrno.size() ) continue; + if ( brnenValues.empty() || brnstValues.empty() ) continue; + + std::vector segNo; + for ( size_t i = 0; i < segnxt.size(); i++ ) + { + int branchIndex = segbrno[i] - 1; + int nextBranchIndex = -1; + if ( i + 1 < segbrno.size() ) nextBranchIndex = segbrno[i + 1] - 1; + + bool isLastSegmentOnBranch = branchIndex != nextBranchIndex; + + int brnst = brnstValues[branchIndex]; + int brnen = brnenValues[branchIndex]; + + int segmentId = -1; + if ( !isLastSegmentOnBranch ) + { + if ( i + 1 < segnxt.size() ) segmentId = segnxt[i + 1]; + } + else + { + segmentId = brnen; + } + + segNo.push_back( segmentId ); + + segmentsForWellDate.emplace_back( RifRftSegmentData( segnxt[i], segbrno[i], brnst, brnen, segmentId ) ); + } + + if ( segmentsForWellDate.empty() ) continue; + + RifRftSegment segment; + segment.setSegmentData( segmentsForWellDate ); + + auto arraysAtWellDate = m_opm_rft->listOfRftArrays( wellName, date ); + for ( const auto& rftResultMetaData : arraysAtWellDate ) + { + auto [name, arrayType, size] = rftResultMetaData; + if ( name.find( "SEG" ) == 0 ) + { + segment.addResultNameAndSize( rftResultMetaData ); + } + } + + auto wellDateKey = std::make_pair( wellName, date ); + + m_rftWellDateSegments[wellDateKey] = segment; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderOpmRft::segmentDataDebugLog() const +{ + for ( const auto& a : m_rftWellDateSegments ) + { + auto [wellName, date] = a.first; + auto segmentData = a.second; + + std::cout << "\nWell: " << wellName << "Date : " << std::get<0>( date ) << " " << std::get<1>( date ) << " " + << std::get<2>( date ) << " \n"; + + for ( const auto& r : segmentData.topology() ) + { + std::cout << "SEGNXT " << std::setw( 2 ) << r.segNext() << ", "; + std::cout << "SEGBRNO " << std::setw( 2 ) << r.segBrno() << ", "; + std::cout << "BNRST " << std::setw( 2 ) << r.segBrnst() << ", "; + std::cout << "BRNEN " << std::setw( 2 ) << r.segBrnen() << ", "; + std::cout << "SEGNO " << std::setw( 2 ) << r.segNo() << "\n"; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RifReaderOpmRft::isOpen() const +{ + return m_opm_rft != nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderOpmRft::importWellNames() +{ + auto names = m_opm_rft->listOfWells(); + for ( const auto& w : names ) + { + m_wellNames.insert( QString::fromStdString( w ) ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector + RifReaderOpmRft::importWellData( const std::string& wellName, const std::string& propertyName, const RftDate& date ) const +{ + if ( m_opm_rft->hasArray( propertyName, wellName, date ) ) + { + return m_opm_rft->getRft( propertyName, wellName, date ); + } + + return {}; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifEclipseRftAddress::RftWellLogChannelType RifReaderOpmRft::identifyChannelType( const std::string& resultName ) +{ + if ( resultName == "DEPTH" ) return RifEclipseRftAddress::RftWellLogChannelType::TVD; + if ( resultName == "PRESSURE" ) return RifEclipseRftAddress::RftWellLogChannelType::PRESSURE; + if ( resultName == "SWAT" ) return RifEclipseRftAddress::RftWellLogChannelType::SWAT; + if ( resultName == "SOIL" ) return RifEclipseRftAddress::RftWellLogChannelType::SOIL; + if ( resultName == "SGAS" ) return RifEclipseRftAddress::RftWellLogChannelType::SGAS; + if ( resultName == "WRAT" ) return RifEclipseRftAddress::RftWellLogChannelType::WRAT; + if ( resultName == "ORAT" ) return RifEclipseRftAddress::RftWellLogChannelType::ORAT; + if ( resultName == "GRAT" ) return RifEclipseRftAddress::RftWellLogChannelType::GRAT; + + return RifEclipseRftAddress::RftWellLogChannelType::NONE; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::string RifReaderOpmRft::resultNameFromChannelType( RifEclipseRftAddress::RftWellLogChannelType channelType ) +{ + if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::TVD ) return "DEPTH"; + if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ) return "PRESSURE"; + if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::SWAT ) return "SWAT"; + if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::SOIL ) return "SOIL"; + if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::SGAS ) return "SGAS"; + if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::WRAT ) return "WRAT"; + if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::ORAT ) return "ORAT"; + if ( channelType == RifEclipseRftAddress::RftWellLogChannelType::GRAT ) return "GRAT"; + + return {}; +} diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmRft.h b/ApplicationLibCode/FileInterface/RifReaderOpmRft.h new file mode 100644 index 0000000000..c0982c5037 --- /dev/null +++ b/ApplicationLibCode/FileInterface/RifReaderOpmRft.h @@ -0,0 +1,80 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RifReaderEclipseRft.h" +#include "RifRftSegment.h" + +#include "cvfObject.h" + +#include + +namespace Opm +{ +namespace EclIO +{ + class ERft; +} // namespace EclIO +} // namespace Opm + +class RifReaderOpmRft : public RifReaderRftInterface, public cvf::Object +{ +public: + RifReaderOpmRft( const QString& fileName ); + + std::set eclipseRftAddresses() override; + void values( const RifEclipseRftAddress& rftAddress, std::vector* values ) override; + + std::set availableTimeSteps( const QString& wellName ) override; + std::set availableTimeSteps( const QString& wellName, + const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName ) override; + std::set + availableTimeSteps( const QString& wellName, + const std::set& relevantChannels ) override; + std::set availableWellLogChannels( const QString& wellName ) override; + std::set wellNames() override; + + void cellIndices( const RifEclipseRftAddress& rftAddress, std::vector* indices ) override; + +private: + // Segment data + // RftDate must be synced with definition in Opm::EclIO::ERft::RftDate + using RftDate = std::tuple; + using RftSegmentKey = std::pair; + + void buildMetaData(); + void buildSegmentData(); + void segmentDataDebugLog() const; + bool isOpen() const; + void importWellNames(); + + std::vector importWellData( const std::string& wellName, const std::string& propertyName, const RftDate& date ) const; + + static RifEclipseRftAddress::RftWellLogChannelType identifyChannelType( const std::string& resultName ); + static std::string resultNameFromChannelType( RifEclipseRftAddress::RftWellLogChannelType channelType ); + +private: + std::unique_ptr m_opm_rft; + + // RFT and PLT addresses + std::set m_addresses; + std::set m_wellNames; + + std::map m_rftWellDateSegments; +}; diff --git a/ApplicationLibCode/FileInterface/RifReaderRftInterface.cpp b/ApplicationLibCode/FileInterface/RifReaderRftInterface.cpp index bfb6838d25..b84861c2b8 100644 --- a/ApplicationLibCode/FileInterface/RifReaderRftInterface.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderRftInterface.cpp @@ -34,3 +34,10 @@ std::set RifReaderRftInterface::eclipseRftAddresses( const } return matchingAddresses; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderRftInterface::cellIndices( const RifEclipseRftAddress& rftAddress, std::vector* indices ) +{ +} diff --git a/ApplicationLibCode/FileInterface/RifReaderRftInterface.h b/ApplicationLibCode/FileInterface/RifReaderRftInterface.h index 3fe405fb1e..790109ebae 100644 --- a/ApplicationLibCode/FileInterface/RifReaderRftInterface.h +++ b/ApplicationLibCode/FileInterface/RifReaderRftInterface.h @@ -26,6 +26,11 @@ #include #include +namespace caf +{ +class VecIjk; +}; + class RifReaderRftInterface { public: @@ -42,4 +47,6 @@ class RifReaderRftInterface const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName ) = 0; virtual std::set availableWellLogChannels( const QString& wellName ) = 0; virtual std::set wellNames() = 0; + + virtual void cellIndices( const RifEclipseRftAddress& rftAddress, std::vector* indices ); }; diff --git a/ApplicationLibCode/FileInterface/RifRftSegment.cpp b/ApplicationLibCode/FileInterface/RifRftSegment.cpp new file mode 100644 index 0000000000..5b74115de4 --- /dev/null +++ b/ApplicationLibCode/FileInterface/RifRftSegment.cpp @@ -0,0 +1,147 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RifRftSegment.h" + +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// segnxt : Int ID for the next segment +/// brno : Branch ID number +/// brnst : Branch ID number for start of segment +/// brnen : Branch ID number for end of segment +/// segNo : Segment ID number +/// +//-------------------------------------------------------------------------------------------------- +RifRftSegmentData::RifRftSegmentData( int segnxt, int brno, int brnst, int brnen, int segNo ) + : m_segNext( segnxt ) + , m_segbrno( brno ) + , m_brnst( brnst ) + , m_brnen( brnen ) + , m_segmentNo( segNo ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifRftSegmentData::segNext() const +{ + return m_segNext; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifRftSegmentData::segBrno() const +{ + return m_segbrno; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifRftSegmentData::segBrnst() const +{ + return m_brnst; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifRftSegmentData::segBrnen() const +{ + return m_brnen; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RifRftSegmentData::segNo() const +{ + return m_segmentNo; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifRftSegment::setSegmentData( std::vector segmentData ) +{ + m_topology = segmentData; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifRftSegment::topology() const +{ + return m_topology; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifRftSegment::addResultNameAndSize( const Opm::EclIO::EclFile::EclEntry& resultNameAndSize ) +{ + m_resultNameAndSize.push_back( resultNameAndSize ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifRftSegment::resultNameAndSize() const +{ + return m_resultNameAndSize; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifRftSegment::branchIds() const +{ + std::unordered_set s; + for ( const auto& segData : m_topology ) + { + s.insert( segData.segBrno() ); + } + + std::vector v; + v.assign( s.begin(), s.end() ); + std::sort( v.begin(), v.end() ); + + return v; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifRftSegment::indicesForBranchNumber( int branchNumber ) const +{ + std::vector v; + for ( size_t i = 0; i < m_topology.size(); i++ ) + { + auto segment = m_topology[i]; + if ( branchNumber <= 0 || segment.segBrno() == branchNumber ) + { + v.push_back( i ); + } + } + + return v; +} diff --git a/ApplicationLibCode/FileInterface/RifRftSegment.h b/ApplicationLibCode/FileInterface/RifRftSegment.h new file mode 100644 index 0000000000..428b858df9 --- /dev/null +++ b/ApplicationLibCode/FileInterface/RifRftSegment.h @@ -0,0 +1,62 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include + +#include "opm/io/eclipse/EclFile.hpp" + +class RifRftSegmentData +{ +public: + RifRftSegmentData( int segnxt, int brno, int brnst, int brnen, int segNo ); + + int segNext() const; + int segBrno() const; + int segBrnst() const; + int segBrnen() const; + int segNo() const; + +private: + int m_segNext; + int m_segbrno; + int m_brnst; + int m_brnen; + int m_segmentNo; +}; + +class RifRftSegment +{ +public: + void setSegmentData( std::vector segmentData ); + std::vector topology() const; + + void addResultNameAndSize( const Opm::EclIO::EclFile::EclEntry& resultNameAndSize ); + std::vector resultNameAndSize() const; + + std::vector branchIds() const; + + std::vector indicesForBranchNumber( int branchNumber ) const; + +private: + std::vector m_topology; + std::vector m_resultNameAndSize; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp index c52f4c1155..ebbdba1bad 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp @@ -951,7 +951,7 @@ std::map> RimWellPlotTools::calculat const std::vector& selSources, const std::set& interestingRFTResults ) { - bool addFirstTimestep = ( interestingRFTResults.count( RifEclipseRftAddress::PRESSURE ) == 1 ); + bool addFirstTimestep = ( interestingRFTResults.count( RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ) == 1 ); const QString simWellName = RimWellPlotTools::simWellName( wellPathNameOrSimWellName ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 4fb250e1d8..bedeef7dc9 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -302,13 +302,13 @@ class RigRftResultPointCalculator : public RigResultPointCalculator { RifEclipseRftAddress gasRateAddress( RimWellPlotTools::simWellName( wellPathName ), m_timeStep, - RifEclipseRftAddress::GRAT ); + RifEclipseRftAddress::RftWellLogChannelType::GRAT ); RifEclipseRftAddress oilRateAddress( RimWellPlotTools::simWellName( wellPathName ), m_timeStep, - RifEclipseRftAddress::ORAT ); + RifEclipseRftAddress::RftWellLogChannelType::ORAT ); RifEclipseRftAddress watRateAddress( RimWellPlotTools::simWellName( wellPathName ), m_timeStep, - RifEclipseRftAddress::WRAT ); + RifEclipseRftAddress::RftWellLogChannelType::WRAT ); std::vector rftIndices; eclCase->rftReader()->cellIndices( gasRateAddress, &rftIndices ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index 5ca8ea8455..613f7bba63 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -500,7 +500,9 @@ void RimWellRftPlot::updateCurvesInPlot( const std::setsetEclipseResultCase( dynamic_cast( rftCase ) ); - RifEclipseRftAddress address( simWellName, curveDefToAdd.timeStep(), RifEclipseRftAddress::PRESSURE ); + RifEclipseRftAddress address( simWellName, + curveDefToAdd.timeStep(), + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); curve->setRftAddress( address ); curve->setZOrder( 1 ); curve->setSimWellBranchData( m_branchDetection, m_branchIndex ); @@ -516,7 +518,7 @@ void RimWellRftPlot::updateCurvesInPlot( const std::setsetObservedFmuRftData( observedFmuRftData ); RifEclipseRftAddress address( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep(), - RifEclipseRftAddress::PRESSURE ); + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); curve->setRftAddress( address ); curve->setZOrder( RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_OBSERVED ) ); @@ -533,7 +535,7 @@ void RimWellRftPlot::updateCurvesInPlot( const std::setfindObservedFmuData( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() ) ); RifEclipseRftAddress address( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep(), - RifEclipseRftAddress::PRESSURE ); + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); curve->setRftAddress( address ); curve->setZOrder( 1 ); applyCurveAppearance( curve ); @@ -551,7 +553,7 @@ void RimWellRftPlot::updateCurvesInPlot( const std::setaddCurve( curve ); @@ -1164,13 +1166,13 @@ RiuPlotCurveSymbol::PointSymbolEnum RimWellRftPlot::statisticsCurveSymbolFromAdd { switch ( address.wellLogChannel() ) { - case RifEclipseRftAddress::PRESSURE_P10: + case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P10: return RiuPlotCurveSymbol::SYMBOL_TRIANGLE; - case RifEclipseRftAddress::PRESSURE_P50: + case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50: return RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE; - case RifEclipseRftAddress::PRESSURE_P90: + case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P90: return RiuPlotCurveSymbol::SYMBOL_LEFT_TRIANGLE; - case RifEclipseRftAddress::PRESSURE_MEAN: + case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_MEAN: return RiuPlotCurveSymbol::SYMBOL_RIGHT_TRIANGLE; } return RiuPlotCurveSymbol::SYMBOL_RIGHT_TRIANGLE; @@ -1183,13 +1185,13 @@ RiuPlotCurveSymbol::LabelPosition RimWellRftPlot::statisticsLabelPosFromAddress( { switch ( address.wellLogChannel() ) { - case RifEclipseRftAddress::PRESSURE_P10: + case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P10: return RiuPlotCurveSymbol::LabelLeftOfSymbol; - case RifEclipseRftAddress::PRESSURE_P50: + case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50: return RiuPlotCurveSymbol::LabelAboveSymbol; - case RifEclipseRftAddress::PRESSURE_P90: + case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P90: return RiuPlotCurveSymbol::LabelRightOfSymbol; - case RifEclipseRftAddress::PRESSURE_MEAN: + case RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_MEAN: return RiuPlotCurveSymbol::LabelBelowSymbol; } return RiuPlotCurveSymbol::LabelAboveSymbol; diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp index 80fc5d7f94..6d6b96186c 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp @@ -393,14 +393,6 @@ RimGeoMechCase::CaseOpenStatus RimGeoMechCase::openGeoMechCase( std::string* err return CASE_OPEN_OK; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimGeoMechCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) -{ - // No longer in use. Filepaths are now of type caf::FilePath, and updated in RimProject on load. -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.h b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.h index 588e790bd5..8a5cb73cc6 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.h +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.h @@ -84,8 +84,6 @@ class RimGeoMechCase : public RimCase RimGeoMechView* createAndAddReservoirView(); RimGeoMechView* createCopyAndAddView( const RimGeoMechView* sourceView ); - void updateFilePathsFromProjectPath( const QString& projectPath, const QString& oldProjectPath ) override; - std::vector timeStepDates() const override; QStringList timeStepStrings() const override; QString timeStepName( int frameIdx ) const override; diff --git a/ApplicationLibCode/ProjectDataModel/RimCase.h b/ApplicationLibCode/ProjectDataModel/RimCase.h index b0ee0d9074..58dc1df104 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCase.h +++ b/ApplicationLibCode/ProjectDataModel/RimCase.h @@ -67,8 +67,6 @@ class RimCase : public caf::PdmObject std::vector views() const; std::vector gridViews() const; - virtual void updateFilePathsFromProjectPath( const QString& projectPath, const QString& oldProjectPath ) = 0; - virtual std::vector timeStepDates() const = 0; virtual QStringList timeStepStrings() const = 0; virtual QString timeStepName( int frameIdx ) const = 0; diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index f9fed18592..2aa90e6691 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -1176,6 +1176,28 @@ RimDepthTrackPlot::DepthOrientation RimDepthTrackPlot::depthOrientation() const return m_depthOrientation(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RimDepthTrackPlot::depthAxis() const +{ + if ( m_depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + return RiuPlotAxis::defaultLeft(); + else + return RiuPlotAxis::defaultBottom(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RimDepthTrackPlot::valueAxis() const +{ + if ( m_depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + return RiuPlotAxis::defaultTop(); + else + return RiuPlotAxis::defaultLeft(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h index bfb3677d58..a65d01bb90 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h @@ -42,6 +42,7 @@ class RimWellLogCurveCommonDataSource; class RiuWellLogPlot; class RimPlot; class RimEnsembleCurveSet; +class RiuPlotAxis; class QKeyEvent; @@ -103,6 +104,8 @@ class RimDepthTrackPlot : public RimTypedPlotCollection, public RimPlot AxisGridVisibility depthAxisGridLinesEnabled() const; RimDepthTrackPlot::DepthOrientation depthOrientation() const; + RiuPlotAxis depthAxis() const; + RiuPlotAxis valueAxis() const; void setAutoScaleXEnabled( bool enabled ); void setAutoScaleDepthEnabled( bool enabled ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp index c0103ef88b..07ede4cb78 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.cpp @@ -322,27 +322,6 @@ QString RimEclipseInputCase::locationOnDisc() const return fi.absolutePath(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimEclipseInputCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) -{ - // bool foundFile = false; - // std::vector searchedPaths; - - // m_gridFileName = RimTools::relocateFile( m_gridFileName().path(), newProjectPath, oldProjectPath, &foundFile, - // &searchedPaths ); - - // for ( RimEclipseInputProperty* inputProperty : m_inputPropertyCollection()->inputProperties() ) - //{ - // inputProperty->fileName = RimTools::relocateFile( inputProperty->fileName, - // newProjectPath, - // oldProjectPath, - // &foundFile, - // &searchedPaths ); - //} -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.h b/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.h index 4d45c92067..20f97edb05 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseInputCase.h @@ -55,8 +55,6 @@ class RimEclipseInputCase : public RimEclipseCase // Overrides from RimCase QString locationOnDisc() const override; - void updateFilePathsFromProjectPath( const QString& projectPath, const QString& oldProjectPath ) override; - void updateAdditionalFileFolder( const QString& newFolder ); protected: diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp index c17eeb53bc..704a1517c9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -33,6 +33,7 @@ #include "RifReaderEclipseOutput.h" #include "RifReaderEclipseRft.h" #include "RifReaderMockModel.h" +#include "RifReaderOpmRft.h" #include "RifReaderSettings.h" #include "RigCaseCellResultsData.h" @@ -68,7 +69,9 @@ CAF_PDM_SOURCE_INIT( RimEclipseResultCase, "EclipseCase" ); /// //-------------------------------------------------------------------------------------------------- RimEclipseResultCase::RimEclipseResultCase() - : RimEclipseCase() + : m_gridAndWellDataIsReadFromFile( false ) + , m_activeCellInfoIsReadFromFile( false ) + , m_useOpmRftReader( true ) { CAF_PDM_InitScriptableObject( "Eclipse Case", ":/Case48x48.png", "", "The Regular Eclipse Results Case" ); @@ -90,9 +93,6 @@ RimEclipseResultCase::RimEclipseResultCase() #ifndef USE_HDF5 m_sourSimFileName.uiCapability()->setUiHidden( true ); #endif - - m_activeCellInfoIsReadFromFile = false; - m_gridAndWellDataIsReadFromFile = false; } //-------------------------------------------------------------------------------------------------- @@ -212,17 +212,25 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter if ( rftFileInfo.exists() ) { RiaLogging::info( QString( "RFT file found" ) ); - m_readerEclipseRft = new RifReaderEclipseRft( rftFileInfo.filePath() ); + + if ( m_useOpmRftReader ) + { + m_readerOpmRft = new RifReaderOpmRft( rftFileInfo.filePath() ); + } + else + { + m_readerEclipseRft = new RifReaderEclipseRft( rftFileInfo.filePath() ); + } } - if ( m_flowDiagSolutions.size() == 0 ) + if ( m_flowDiagSolutions.empty() ) { m_flowDiagSolutions.push_back( new RimFlowDiagSolution() ); } if ( !m_sourSimFileName().path().isEmpty() ) { - RifReaderEclipseOutput* outReader = dynamic_cast( readerInterface.p() ); + auto* outReader = dynamic_cast( readerInterface.p() ); outReader->setHdf5FileName( m_sourSimFileName().path() ); } @@ -336,7 +344,7 @@ void RimEclipseResultCase::loadAndUpdateSourSimData() // Deselect SourSimRL cell results for ( Rim3dView* view : views() ) { - RimEclipseView* eclipseView = dynamic_cast( view ); + auto* eclipseView = dynamic_cast( view ); if ( eclipseView != nullptr ) { if ( eclipseView->cellResult()->resultType() == RiaDefines::ResultCatType::SOURSIMRL ) @@ -487,41 +495,12 @@ void RimEclipseResultCase::readGridDimensions( std::vector>& gr RifEclipseOutputFileTools::readGridDimensions( gridFileName(), gridDimensions ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimEclipseResultCase::updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) -{ - // bool foundFile = false; - // std::vector searchedPaths; - - // Update filename and folder paths when opening project from a different file location - // caseFileName = RimTools::relocateFile( caseFileName(), newProjectPath, oldProjectPath, &foundFile, - // &searchedPaths ); - - // std::vector relocatedFaultFiles; - // const std::vector& orgFilesContainingFaults = filesContainingFaults(); - // for ( auto faultFileName : orgFilesContainingFaults ) - // { - // QString relocatedFaultFile = - // RimTools::relocateFile( faultFileName, newProjectPath, oldProjectPath, &foundFile, &searchedPaths ); - // relocatedFaultFiles.push_back( relocatedFaultFile ); - // } - // - // setFilesContainingFaults( relocatedFaultFiles ); - -#if 0 // Output the search path for debugging - for (size_t i = 0; i < searchedPaths.size(); ++i) - qDebug() << searchedPaths[i]; -#endif -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimFlowDiagSolution* RimEclipseResultCase::defaultFlowDiagSolution() { - if ( m_flowDiagSolutions.size() > 0 ) + if ( !m_flowDiagSolutions.empty() ) { return m_flowDiagSolutions[0]; } @@ -554,8 +533,10 @@ RigFlowDiagSolverInterface* RimEclipseResultCase::flowDiagSolverInterface() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifReaderEclipseRft* RimEclipseResultCase::rftReader() +RifReaderRftInterface* RimEclipseResultCase::rftReader() { + if ( m_useOpmRftReader ) return m_readerOpmRft.p(); + return m_readerEclipseRft.p(); } @@ -638,7 +619,7 @@ void RimEclipseResultCase::defineEditorAttribute( const caf::PdmFieldHandle* fie { if ( field == &m_sourSimFileName ) { - caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast( attribute ); + auto* myAttr = dynamic_cast( attribute ); if ( myAttr ) { myAttr->m_fileSelectionFilter = "SourSim (*.sourres)"; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.h b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.h index cc3bdfc319..cdaad13290 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.h @@ -25,9 +25,11 @@ #include "RimEclipseCase.h" #include "cafFilePath.h" -#include +#include "cafPdmProxyValueField.h" +class RifReaderRftInterface; class RifReaderEclipseRft; +class RifReaderOpmRft; class RifReaderInterface; class RigFlowDiagSolverInterface; class RigMainGrid; @@ -63,15 +65,13 @@ class RimEclipseResultCase : public RimEclipseCase caf::AppEnum unitSystem(); - // Overrides from RimCase QString locationOnDisc() const override; - void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ) override; RimFlowDiagSolution* defaultFlowDiagSolution(); std::vector flowDiagSolutions(); RigFlowDiagSolverInterface* flowDiagSolverInterface(); - RifReaderEclipseRft* rftReader(); + RifReaderRftInterface* rftReader(); protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; @@ -90,6 +90,7 @@ class RimEclipseResultCase : public RimEclipseCase cvf::ref m_flowDagSolverInterface; cvf::ref m_readerEclipseRft; + cvf::ref m_readerOpmRft; // Fields: caf::PdmProxyValueField> m_unitSystem; @@ -98,4 +99,5 @@ class RimEclipseResultCase : public RimEclipseCase bool m_gridAndWellDataIsReadFromFile; bool m_activeCellInfoIsReadFromFile; + bool m_useOpmRftReader; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h index adc5015186..6731fbbe73 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h @@ -71,7 +71,6 @@ class RimEclipseStatisticsCase : public RimEclipseCase }; caf::PdmField m_calculateEditCommand; - void updateFilePathsFromProjectPath( const QString& projectPath, const QString& oldProjectPath ) override {} void populateResultSelectionAfterLoadingGrid(); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index c144df4a13..1beb44c0a3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -118,7 +118,7 @@ RimPlotCurve::RimPlotCurve() m_curveAppearance.uiCapability()->setUiTreeHidden( true ); m_curveAppearance.uiCapability()->setUiTreeChildrenHidden( true ); m_curveAppearance->appearanceChanged.connect( this, &RimPlotCurve::onCurveAppearanceChanged ); - m_curveAppearance->appearanceChanged.connect( this, &RimPlotCurve::onFillColorChanged ); + m_curveAppearance->fillColorChanged.connect( this, &RimPlotCurve::onFillColorChanged ); m_plotCurve = nullptr; m_parentPlot = nullptr; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index c38ab0dc05..c5983cbce4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -456,15 +456,6 @@ void RimProject::setProjectFileNameAndUpdateDependencies( const QString& project filePath->setPath( newFilePath ); } - // Loop over all cases and update file path - - std::vector cases; - allCases( cases ); - for ( size_t i = 0; i < cases.size(); i++ ) - { - cases[i]->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath ); - } - // Update path to well path file cache for ( RimOilField* oilField : oilFields ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp index a9addfcda2..b126b847f3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp @@ -31,6 +31,8 @@ #include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiTreeSelectionEditor.h" +#include + #include namespace caf diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index 9f69a2c564..a430a3833a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -46,6 +46,7 @@ #include "cafPdmPtrArrayField.h" #include "cafPdmPtrField.h" +#include #include class RimSummaryCase; @@ -71,7 +72,6 @@ class QwtPlot; class QwtPlotCurve; class QKeyEvent; class QFrame; -class QDate; //================================================================================================== /// diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index 3c361f6f38..6ec9752c3f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -41,6 +41,7 @@ #include "cafPdmFieldScriptingCapability.h" #include "cafPdmUiTreeOrdering.h" +#include #include #include diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h index 394050c9e3..461e997560 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h @@ -19,9 +19,7 @@ #pragma once #include "RiaDefines.h" -#include "RifEclipseRftAddress.h" #include "RifEclipseSummaryAddress.h" -#include "RifReaderEnsembleStatisticsRft.h" #include "RigEnsembleParameter.h" @@ -33,6 +31,8 @@ #include "cafPdmObject.h" #include "cafPdmProxyValueField.h" +#include "cvfObject.h" + #include #include diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp index 7461dd2745..d01839d60b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp @@ -27,6 +27,7 @@ #include "RimEclipseResultCase.h" #include "RimTools.h" #include "RimWellLogCurve.h" +#include "RimWellLogRftCurve.h" #include "RimWellLogRftCurveNameConfig.h" #include "RimWellPath.h" @@ -117,8 +118,8 @@ QString Rim3dWellLogRftCurve::createAutoName() const { name.push_back( m_eclipseResultCase->caseUserDescription() ); } - if ( m_wellLogChannelName().text() != - caf::AppEnum::text( RifEclipseRftAddress::NONE ) ) + if ( m_wellLogChannelName().text() != caf::AppEnum::text( + RifEclipseRftAddress::RftWellLogChannelType::NONE ) ) { RifEclipseRftAddress::RftWellLogChannelType channelNameEnum = m_wellLogChannelName(); name.push_back( caf::AppEnum::uiText( channelNameEnum ) ); @@ -172,7 +173,7 @@ QList { if ( m_eclipseResultCase ) { - RifReaderEclipseRft* reader = m_eclipseResultCase()->rftReader(); + RifReaderRftInterface* reader = m_eclipseResultCase()->rftReader(); if ( reader ) { for ( const RifEclipseRftAddress::RftWellLogChannelType& channelName : @@ -187,8 +188,8 @@ QList if ( options.empty() ) { options.push_back( caf::PdmOptionItemInfo( caf::AppEnum::uiText( - RifEclipseRftAddress::NONE ), - RifEclipseRftAddress::NONE ) ); + RifEclipseRftAddress::RftWellLogChannelType::NONE ), + RifEclipseRftAddress::RftWellLogChannelType::NONE ) ); } } } @@ -196,7 +197,7 @@ QList { if ( m_eclipseResultCase ) { - RifReaderEclipseRft* reader = m_eclipseResultCase()->rftReader(); + RifReaderRftInterface* reader = m_eclipseResultCase()->rftReader(); if ( reader ) { QString dateFormat = "dd MMM yyyy"; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.h index 5dee8b1c78..6272a7db55 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.h @@ -25,10 +25,10 @@ #include "cafPdmPtrField.h" #include "RifEclipseRftAddress.h" -#include "RimWellLogRftCurve.h" class RimEclipseResultCase; class RimWellLogRftCurveNameConfig; +class RimWellLogRftCurve; class QString; //================================================================================================== diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp index d46fabba9c..dc1dc71753 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp @@ -148,6 +148,24 @@ void RimWellLogCurve::setPropertyValuesAndDepths( const std::vector& pro calculateCurveDataPropertyValueRange(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogCurve::setPropertyAndDepthValuesToPlotCurve( const std::vector& propertyValues, + const std::vector& depthValues ) +{ + if ( !m_plotCurve ) return; + + if ( isVerticalCurve() ) + { + m_plotCurve->setSamplesValues( propertyValues, depthValues ); + } + else + { + m_plotCurve->setSamplesValues( depthValues, propertyValues ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -234,21 +252,15 @@ QString RimWellLogCurve::wellLogCurveIconName() //-------------------------------------------------------------------------------------------------- void RimWellLogCurve::setOverrideCurveData( const std::vector& propertyValues, const std::vector& depthValues, - const RiaCurveDataTools::CurveIntervals& curveIntervals, - bool isVerticalPlot ) + const RiaCurveDataTools::CurveIntervals& curveIntervals ) { auto minmax_it = std::minmax_element( propertyValues.begin(), propertyValues.end() ); this->setOverrideCurveDataPropertyValueRange( *( minmax_it.first ), *( minmax_it.second ) ); + if ( m_plotCurve ) { - if ( isVerticalPlot ) - { - m_plotCurve->setSamplesValues( propertyValues, depthValues ); - } - else - { - m_plotCurve->setSamplesValues( depthValues, propertyValues ); - } + setPropertyAndDepthValuesToPlotCurve( propertyValues, depthValues ); + m_plotCurve->setLineSegmentStartStopIndices( curveIntervals ); } } @@ -357,9 +369,12 @@ void RimWellLogCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { RimStackablePlotCurve::fieldChangedByUi( changedField, oldValue, newValue ); - if ( changedField == &m_showCurve && m_showCurve() ) + if ( changedField == &m_showCurve ) { - updateZoomInParentPlot(); + if ( m_isStacked() || m_showCurve() ) + { + updateZoomInParentPlot(); + } } if ( changedField == &m_isStacked ) @@ -367,3 +382,39 @@ void RimWellLogCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, loadDataAndUpdate( true ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimWellLogCurve::isVerticalCurve() const +{ + RimDepthTrackPlot::DepthOrientation orientation = RimDepthTrackPlot::DepthOrientation::VERTICAL; + + RimDepthTrackPlot* depthTrackPlot = nullptr; + firstAncestorOrThisOfType( depthTrackPlot ); + if ( depthTrackPlot ) orientation = depthTrackPlot->depthOrientation(); + + return orientation == RimDepthTrackPlot::DepthOrientation::VERTICAL; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RimWellLogCurve::depthAxis() const +{ + RimDepthTrackPlot* depthTrackPlot; + this->firstAncestorOrThisOfTypeAsserted( depthTrackPlot ); + + return depthTrackPlot->depthAxis(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RimWellLogCurve::valueAxis() const +{ + RimDepthTrackPlot* depthTrackPlot; + this->firstAncestorOrThisOfTypeAsserted( depthTrackPlot ); + + return depthTrackPlot->valueAxis(); +} diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h index 7451fb5f19..bbfaa414fa 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h @@ -71,6 +71,9 @@ class RimWellLogCurve : public RimStackablePlotCurve bool useLogarithmicScale, const QString& propertyUnit = RiaWellLogUnitTools::noUnitString() ); + void setPropertyAndDepthValuesToPlotCurve( const std::vector& propertyValues, + const std::vector& depthValues ); + const RigWellLogCurveData* curveData() const; void updateCurveAppearance() override; @@ -85,8 +88,7 @@ class RimWellLogCurve : public RimStackablePlotCurve void setOverrideCurveData( const std::vector& propertyValues, const std::vector& depthValues, - const RiaCurveDataTools::CurveIntervals& curveIntervals, - bool isVerticalPlot ); + const RiaCurveDataTools::CurveIntervals& curveIntervals ); virtual RiaDefines::PhaseType resultPhase() const; @@ -97,6 +99,10 @@ class RimWellLogCurve : public RimStackablePlotCurve void calculateCurveDataPropertyValueRange(); void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + bool isVerticalCurve() const; + RiuPlotAxis depthAxis() const; + RiuPlotAxis valueAxis() const; + private: cvf::ref m_curveData; std::pair m_curveDataPropertyValueRange; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index b295dbf6c4..78460e82dd 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -22,6 +22,7 @@ #include "RiaEclipseUnitTools.h" #include "RiaQDateTimeTools.h" #include "RiaResultNames.h" +#include "RiaRftDefines.h" #include "RiaSimWellBranchTools.h" #include "RifEclipseRftAddress.h" @@ -69,27 +70,73 @@ namespace caf template <> void caf::AppEnum::setUp() { - addItem( RifEclipseRftAddress::NONE, "NONE", "None" ); - addItem( RifEclipseRftAddress::TVD, "DEPTH", "Depth" ); - addItem( RifEclipseRftAddress::PRESSURE, "PRESSURE", "Pressure" ); - addItem( RifEclipseRftAddress::SWAT, RiaResultNames::swat(), "Water Saturation" ); - addItem( RifEclipseRftAddress::SOIL, RiaResultNames::soil(), "Oil Saturation" ); - addItem( RifEclipseRftAddress::SGAS, RiaResultNames::sgas(), "Gas Saturation" ); - addItem( RifEclipseRftAddress::WRAT, "WRAT", "Water Flow" ); - addItem( RifEclipseRftAddress::ORAT, "ORAT", "Oil Flow" ); - addItem( RifEclipseRftAddress::GRAT, "GRAT", "Gas flow" ); - addItem( RifEclipseRftAddress::MD, "MD", "Measured Depth" ); - addItem( RifEclipseRftAddress::PRESSURE_P10, "PRESSURE_P10", "P10: Pressure" ); - addItem( RifEclipseRftAddress::PRESSURE_P50, "PRESSURE_P50", "P50: Pressure" ); - addItem( RifEclipseRftAddress::PRESSURE_P90, "PRESSURE_P90", "P90: Pressure" ); - addItem( RifEclipseRftAddress::PRESSURE_MEAN, "PRESSURE_MEAN", "Mean: Pressure" ); - addItem( RifEclipseRftAddress::PRESSURE_ERROR, "PRESSURE_ERROR", "Error: Pressure" ); - setDefault( RifEclipseRftAddress::NONE ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::NONE, "NONE", "None" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::TVD, "DEPTH", "Depth" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::PRESSURE, "PRESSURE", "Pressure" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::SWAT, RiaResultNames::swat(), "Water Saturation" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::SOIL, RiaResultNames::soil(), "Oil Saturation" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::SGAS, RiaResultNames::sgas(), "Gas Saturation" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::WRAT, "WRAT", "Water Flow" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::ORAT, "ORAT", "Oil Flow" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::GRAT, "GRAT", "Gas flow" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::MD, "MD", "Measured Depth" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P10, "PRESSURE_P10", "P10: Pressure" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50, "PRESSURE_P50", "P50: Pressure" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P90, "PRESSURE_P90", "P90: Pressure" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_MEAN, "PRESSURE_MEAN", "Mean: Pressure" ); + addItem( RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_ERROR, "PRESSURE_ERROR", "Error: Pressure" ); + setDefault( RifEclipseRftAddress::RftWellLogChannelType::NONE ); +} +} // namespace caf + +namespace caf +{ +template <> +void caf::AppEnum::setUp() +{ + addItem( RimWellLogRftCurve::RftDataType::RFT_DATA, "RFT_DATA", "RFT" ); + addItem( RimWellLogRftCurve::RftDataType::RFT_SEGMENT_DATA, "RFT_SEGMENT_DATA", "RFT Segment" ); + setDefault( RimWellLogRftCurve::RftDataType::RFT_DATA ); } } // namespace caf CAF_PDM_SOURCE_INIT( RimWellLogRftCurve, "WellLogRftCurve" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::PhaseType RimWellLogRftCurve::phaseType() const +{ + if ( m_rftDataType() == RimWellLogRftCurve::RftDataType::RFT_DATA ) + { + if ( m_wellLogChannelName() == RifEclipseRftAddress::RftWellLogChannelType::SWAT || + m_wellLogChannelName() == RifEclipseRftAddress::RftWellLogChannelType::WRAT ) + { + return RiaDefines::PhaseType::WATER_PHASE; + } + + if ( m_wellLogChannelName() == RifEclipseRftAddress::RftWellLogChannelType::SGAS || + m_wellLogChannelName() == RifEclipseRftAddress::RftWellLogChannelType::GRAT ) + { + return RiaDefines::PhaseType::GAS_PHASE; + } + + if ( m_wellLogChannelName() == RifEclipseRftAddress::RftWellLogChannelType::SOIL || + m_wellLogChannelName() == RifEclipseRftAddress::RftWellLogChannelType::ORAT ) + { + return RiaDefines::PhaseType::OIL_PHASE; + } + } + else if ( m_rftDataType() == RimWellLogRftCurve::RftDataType::RFT_SEGMENT_DATA ) + { + if ( m_segmentResultName().startsWith( "SEGO" ) ) return RiaDefines::PhaseType::OIL_PHASE; + if ( m_segmentResultName().startsWith( "SEGW" ) ) return RiaDefines::PhaseType::WATER_PHASE; + if ( m_segmentResultName().startsWith( "SEGG" ) ) return RiaDefines::PhaseType::GAS_PHASE; + } + + return RiaDefines::PhaseType::PHASE_NOT_APPLICABLE; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -122,6 +169,10 @@ RimWellLogRftCurve::RimWellLogRftCurve() "" ); CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "WellLogChannelName", "Well Property" ); + CAF_PDM_InitFieldNoDefault( &m_rftDataType, "RftDataType", "Data Type" ); + + CAF_PDM_InitField( &m_segmentResultName, "SegmentResultName", RiaResultNames::undefinedResultName(), "Segment Result Name" ); + CAF_PDM_InitField( &m_segmentBranchId, "SegmentBranchId", RiaResultNames::undefinedResultName(), "Segment Branch" ); } //-------------------------------------------------------------------------------------------------- @@ -234,7 +285,7 @@ void RimWellLogRftCurve::setRftAddress( RifEclipseRftAddress address ) //-------------------------------------------------------------------------------------------------- RifEclipseRftAddress RimWellLogRftCurve::rftAddress() const { - return RifEclipseRftAddress( m_wellName, m_timeStep, m_wellLogChannelName() ); + return { m_wellName, m_timeStep, m_wellLogChannelName() }; } //-------------------------------------------------------------------------------------------------- @@ -259,12 +310,12 @@ void RimWellLogRftCurve::setDefaultAddress( QString wellName ) if ( !wellNameHasRftData ) { - m_wellLogChannelName = RifEclipseRftAddress::NONE; + m_wellLogChannelName = RifEclipseRftAddress::RftWellLogChannelType::NONE; m_timeStep = QDateTime(); return; } - m_wellLogChannelName = RifEclipseRftAddress::PRESSURE; + m_wellLogChannelName = RifEclipseRftAddress::RftWellLogChannelType::PRESSURE; std::set timeSteps = reader->availableTimeSteps( m_wellName, m_wellLogChannelName() ); if ( !timeSteps.empty() ) @@ -282,7 +333,7 @@ void RimWellLogRftCurve::setDefaultAddress( QString wellName ) //-------------------------------------------------------------------------------------------------- void RimWellLogRftCurve::updateWellChannelNameAndTimeStep() { - if ( !m_timeStep().isValid() || m_wellLogChannelName() == RifEclipseRftAddress::NONE ) + if ( !m_timeStep().isValid() || m_wellLogChannelName() == RifEclipseRftAddress::RftWellLogChannelType::NONE ) { setDefaultAddress( m_wellName ); return; @@ -295,11 +346,11 @@ void RimWellLogRftCurve::updateWellChannelNameAndTimeStep() if ( channelNames.empty() ) { - m_wellLogChannelName = RifEclipseRftAddress::NONE; + m_wellLogChannelName = RifEclipseRftAddress::RftWellLogChannelType::NONE; } else if ( !channelNames.count( m_wellLogChannelName() ) ) { - m_wellLogChannelName = RifEclipseRftAddress::PRESSURE; + m_wellLogChannelName = RifEclipseRftAddress::RftWellLogChannelType::PRESSURE; } std::set timeSteps = reader->availableTimeSteps( m_wellName, m_wellLogChannelName() ); @@ -353,14 +404,26 @@ QString RimWellLogRftCurve::createCurveAutoName() { name.push_back( m_observedFmuRftData->name() ); } - if ( wellLogChannelUiName() != - caf::AppEnum::text( RifEclipseRftAddress::NONE ) ) + + if ( m_rftDataType() == RftDataType::RFT_DATA ) { - RifEclipseRftAddress::RftWellLogChannelType channelNameEnum = - caf::AppEnum::fromText( wellLogChannelUiName() ); - QString channelName = caf::AppEnum::uiText( channelNameEnum ); - name.push_back( channelName ); + if ( wellLogChannelUiName() != caf::AppEnum::text( + RifEclipseRftAddress::RftWellLogChannelType::NONE ) ) + { + RifEclipseRftAddress::RftWellLogChannelType channelNameEnum = + caf::AppEnum::fromText( wellLogChannelUiName() ); + QString channelName = caf::AppEnum::uiText( channelNameEnum ); + name.push_back( channelName ); + } } + else if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA ) + { + name.push_back( m_segmentResultName ); + + QString branchText = "Branch " + m_segmentBranchId(); + name.push_back( branchText ); + } + if ( !m_timeStep().isNull() ) { name.push_back( m_timeStep().toString( RiaQDateTimeTools::dateFormatString() ) ); @@ -376,7 +439,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) { this->RimPlotCurve::updateCurvePresentation( updateParentPlot ); - DerivedMDSource derivedMDSource = NO_SOURCE; + DerivedMDSource derivedMDSource = DerivedMDSource::NO_SOURCE; if ( isCurveVisible() ) { @@ -384,9 +447,9 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) firstAncestorOrThisOfType( wellLogPlot ); CVF_ASSERT( wellLogPlot ); - RimWellRftPlot* rftPlot = dynamic_cast( wellLogPlot ); - bool showErrorBarsInObservedData = rftPlot ? rftPlot->showErrorBarsForObservedData() : false; - m_showErrorBars = showErrorBarsInObservedData; + auto* rftPlot = dynamic_cast( wellLogPlot ); + bool showErrorBarsInObservedData = rftPlot ? rftPlot->showErrorBarsForObservedData() : false; + m_showErrorBars = showErrorBarsInObservedData; std::vector measuredDepthVector = measuredDepthValues(); std::vector tvDepthVector = tvDepthValues(); @@ -428,17 +491,17 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) { if ( deriveMeasuredDepthValuesFromWellPath( tvDepthVector, measuredDepthVector ) ) { - derivedMDSource = WELL_PATH; + derivedMDSource = DerivedMDSource::WELL_PATH; } else if ( deriveMeasuredDepthFromObservedData( tvDepthVector, measuredDepthVector ) ) { - derivedMDSource = OBSERVED_DATA; + derivedMDSource = DerivedMDSource::OBSERVED_DATA; } } if ( tvDepthVector.size() != measuredDepthVector.size() ) { - derivedMDSource = NO_SOURCE; + derivedMDSource = DerivedMDSource::NO_SOURCE; measuredDepthVector = tvDepthVector; } @@ -470,22 +533,21 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) { m_plotCurve->setPerPointLabels( perPointLabels ); - auto xValues = this->curveData()->propertyValuesByIntervals(); - auto yValues = - this->curveData()->depthValuesByIntervals( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit ); + auto propertyValues = this->curveData()->propertyValues(); + auto depthValues = this->curveData()->depths( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit ); bool useLogarithmicScale = false; if ( !errors.empty() ) { - this->setSamplesFromXYErrorValues( xValues, - yValues, + this->setSamplesFromXYErrorValues( propertyValues, + depthValues, errors, useLogarithmicScale, RiaCurveDataTools::ErrorAxis::ERROR_ALONG_X_AXIS ); } else { - m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, useLogarithmicScale ); + setPropertyAndDepthValuesToPlotCurve( propertyValues, depthValues ); } RimWellLogTrack* wellLogTrack; @@ -495,21 +557,25 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) RiuQwtPlotWidget* viewer = wellLogTrack->viewer(); if ( viewer ) { - if ( derivedMDSource != NO_SOURCE ) + QString text; + + if ( derivedMDSource != DerivedMDSource::NO_SOURCE ) { - if ( derivedMDSource == WELL_PATH ) + if ( derivedMDSource == DerivedMDSource::WELL_PATH ) { - viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "WELL/" + wellLogPlot->depthAxisTitle() ); + text = "WELL/" + wellLogPlot->depthAxisTitle(); } else { - viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), "OBS/" + wellLogPlot->depthAxisTitle() ); + text = "OBS/" + wellLogPlot->depthAxisTitle(); } } else // Standard depth title set from plot { - viewer->setAxisTitleText( RiuPlotAxis::defaultLeft(), wellLogPlot->depthAxisTitle() ); + text = wellLogPlot->depthAxisTitle(); } + + viewer->setAxisTitleText( wellLogPlot->depthAxis(), text ); } } else @@ -559,14 +625,23 @@ void RimWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" ); curveDataGroup->add( &m_eclipseResultCase ); curveDataGroup->add( &m_wellName ); + curveDataGroup->add( &m_timeStep ); + curveDataGroup->add( &m_rftDataType ); - RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromWellName( curveDataGroup, - m_wellName, - m_branchDetection, - m_branchIndex ); + if ( m_rftDataType() == RimWellLogRftCurve::RftDataType::RFT_DATA ) + { + curveDataGroup->add( &m_wellLogChannelName ); - curveDataGroup->add( &m_wellLogChannelName ); - curveDataGroup->add( &m_timeStep ); + RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromWellName( curveDataGroup, + m_wellName, + m_branchDetection, + m_branchIndex ); + } + else + { + curveDataGroup->add( &m_segmentResultName ); + curveDataGroup->add( &m_segmentBranchId ); + } caf::PdmUiGroup* stackingGroup = uiOrdering.addNewGroup( "Stacking" ); RimStackablePlotCurve::stackingUiOrdering( *stackingGroup ); @@ -591,7 +666,7 @@ QList RimWellLogRftCurve::calculateValueOptions( const c options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); - if ( options.size() > 0 ) return options; + if ( !options.empty() ) return options; if ( fieldNeedingOptions == &m_eclipseResultCase ) { @@ -628,8 +703,8 @@ QList RimWellLogRftCurve::calculateValueOptions( const c if ( options.empty() ) { options.push_back( caf::PdmOptionItemInfo( caf::AppEnum::uiText( - RifEclipseRftAddress::NONE ), - RifEclipseRftAddress::NONE ) ); + RifEclipseRftAddress::RftWellLogChannelType::NONE ), + RifEclipseRftAddress::RftWellLogChannelType::NONE ) ); } } else if ( fieldNeedingOptions == &m_timeStep ) @@ -656,6 +731,49 @@ QList RimWellLogRftCurve::calculateValueOptions( const c options = RiaSimWellBranchTools::valueOptionsForBranchIndexField( simulationWellBranches ); } + else if ( fieldNeedingOptions == &m_segmentResultName ) + { + options.push_front( + caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), RiaResultNames::undefinedResultName() ) ); + + RifReaderRftInterface* reader = rftReader(); + if ( reader ) + { + options.push_back( caf::PdmOptionItemInfo( RiaDefines::segmentNumberResultName(), + RiaDefines::segmentNumberResultName() ) ); + + for ( const auto& resultAdr : reader->eclipseRftAddresses( m_wellName(), m_timeStep() ) ) + { + if ( resultAdr.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ) + { + options.push_back( + caf::PdmOptionItemInfo( resultAdr.segmentResultName(), resultAdr.segmentResultName() ) ); + } + } + } + } + else if ( fieldNeedingOptions == &m_segmentBranchId ) + { + options.push_front( caf::PdmOptionItemInfo( RiaDefines::allBranches(), RiaDefines::allBranches() ) ); + + RifReaderRftInterface* reader = rftReader(); + if ( reader ) + { + std::vector values; + + auto adr = RifEclipseRftAddress::createSegmentResult( m_wellName(), + m_timeStep, + RiaDefines::segmentBranchNumberResultName() ); + + reader->values( adr, &values ); + for ( const auto& v : values ) + { + int intValue = v; + auto txt = QString::number( intValue ); + options.push_back( caf::PdmOptionItemInfo( txt, txt ) ); + } + } + } return options; } @@ -669,21 +787,23 @@ void RimWellLogRftCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFie { m_idxInWellPathToIdxInRftFile.clear(); + bool loadData = false; + RimWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue ); if ( changedField == &m_eclipseResultCase ) { m_timeStep = QDateTime(); m_wellName = ""; - m_wellLogChannelName = RifEclipseRftAddress::NONE; + m_wellLogChannelName = RifEclipseRftAddress::RftWellLogChannelType::NONE; - this->loadDataAndUpdate( true ); + loadData = true; } else if ( changedField == &m_wellName ) { m_branchIndex = 0; updateWellChannelNameAndTimeStep(); - this->loadDataAndUpdate( true ); + loadData = true; } else if ( changedField == &m_branchDetection || changedField == &m_branchIndex ) { @@ -692,20 +812,23 @@ void RimWellLogRftCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedFie m_branchIndex = RiaSimWellBranchTools::clampBranchIndex( simWellName, m_branchIndex, m_branchDetection ); updateWellChannelNameAndTimeStep(); - this->loadDataAndUpdate( true ); + loadData = true; } else if ( changedField == &m_wellLogChannelName ) { - if ( m_wellLogChannelName == RifEclipseRftAddress::NONE ) + if ( m_wellLogChannelName == RifEclipseRftAddress::RftWellLogChannelType::NONE ) { m_timeStep = QDateTime(); } - this->loadDataAndUpdate( true ); + loadData = true; } - else if ( changedField == &m_timeStep ) + else if ( changedField == &m_timeStep || changedField == &m_segmentResultName || + changedField == &m_segmentBranchId || changedField == &m_rftDataType ) { - this->loadDataAndUpdate( true ); + loadData = true; } + + if ( loadData ) this->loadDataAndUpdate( true ); } //-------------------------------------------------------------------------------------------------- @@ -715,7 +838,7 @@ std::vector RimWellLogRftCurve::perPointLabels() const { if ( m_observedFmuRftData() ) { - RifEclipseRftAddress address( m_wellName(), m_timeStep, RifEclipseRftAddress::PRESSURE ); + RifEclipseRftAddress address( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); return m_observedFmuRftData()->labels( address ); } return {}; @@ -730,18 +853,22 @@ RifReaderRftInterface* RimWellLogRftCurve::rftReader() const { return m_eclipseResultCase()->rftReader(); } - else if ( m_summaryCase() ) // Summary RFT curves have both summary and ensemble set. Prioritize summary for reader. + + if ( m_summaryCase() ) // Summary RFT curves have both summary and ensemble set. Prioritize summary for reader. { return m_summaryCase()->rftReader(); } - else if ( m_ensemble() ) + + if ( m_ensemble() ) { return m_ensemble()->rftStatisticsReader(); } - else if ( m_observedFmuRftData() ) + + if ( m_observedFmuRftData() ) { return m_observedFmuRftData()->rftReader(); } + return nullptr; } @@ -770,7 +897,7 @@ RigEclipseWellLogExtractor* RimWellLogRftCurve::extractor() QString simWellName = RimWellPlotTools::simWellName( m_wellName ); std::vector wellPaths = RiaSimWellBranchTools::simulationWellBranches( simWellName, m_branchDetection ); - if ( wellPaths.size() == 0 ) return nullptr; + if ( wellPaths.empty() ) return nullptr; m_branchIndex = RiaSimWellBranchTools::clampBranchIndex( simWellName, m_branchIndex, m_branchDetection ); @@ -809,12 +936,11 @@ bool RimWellLogRftCurve::createWellPathIdxToRftFileIdxMapping() globCellIndicesToIndexInWell[intersections[idx].globCellIndex] = idx; } - RifEclipseRftAddress depthAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::TVD ); + RifEclipseRftAddress depthAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); std::vector rftIndices; - RifReaderEclipseRft* eclipseRftReader = dynamic_cast( rftReader() ); - if ( !eclipseRftReader ) return false; + if ( !rftReader() ) return false; - eclipseRftReader->cellIndices( depthAddress, &rftIndices ); + rftReader()->cellIndices( depthAddress, &rftIndices ); const RigMainGrid* mainGrid = eclExtractor->caseData()->mainGrid(); @@ -861,9 +987,9 @@ std::vector RimWellLogRftCurve::sortedIndicesInRftFile() } std::vector indices; - for ( auto it = m_idxInWellPathToIdxInRftFile.begin(); it != m_idxInWellPathToIdxInRftFile.end(); it++ ) + for ( auto& it : m_idxInWellPathToIdxInRftFile ) { - indices.push_back( it->second ); + indices.push_back( it.second ); } return indices; @@ -879,6 +1005,16 @@ std::vector RimWellLogRftCurve::xValues() if ( !reader ) return values; + if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA ) + { + auto depthAddress = RifEclipseRftAddress::createSegmentResult( m_wellName(), m_timeStep, m_segmentResultName() ); + depthAddress.setSegmentBranchNumber( segmentBranchNumber() ); + + reader->values( depthAddress, &values ); + + return values; + } + RifEclipseRftAddress address( m_wellName(), m_timeStep, m_wellLogChannelName() ); reader->values( address, &values ); @@ -899,10 +1035,8 @@ std::vector RimWellLogRftCurve::xValues() return valuesSorted; } - else - { - return values; - } + + return values; } //-------------------------------------------------------------------------------------------------- @@ -913,11 +1047,14 @@ std::vector RimWellLogRftCurve::errorValues() RifReaderRftInterface* reader = rftReader(); std::vector errorValues; - if ( reader ) + if ( reader && m_rftDataType() == RftDataType::RFT_DATA ) { - RifEclipseRftAddress errorAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::PRESSURE_ERROR ); + RifEclipseRftAddress errorAddress( m_wellName(), + m_timeStep, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_ERROR ); reader->values( errorAddress, &errorValues ); } + return errorValues; } @@ -931,7 +1068,17 @@ std::vector RimWellLogRftCurve::tvDepthValues() if ( !reader ) return values; - RifEclipseRftAddress depthAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::TVD ); + if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA ) + { + auto depthAddress = + RifEclipseRftAddress::createSegmentResult( m_wellName(), m_timeStep, RiaDefines::segmentTvdDepthResultName() ); + depthAddress.setSegmentBranchNumber( segmentBranchNumber() ); + + reader->values( depthAddress, &values ); + return values; + } + + RifEclipseRftAddress depthAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); reader->values( depthAddress, &values ); bool wellPathExists = createWellPathIdxToRftFileIdxMapping(); @@ -950,10 +1097,8 @@ std::vector RimWellLogRftCurve::tvDepthValues() return valuesSorted; } - else - { - return values; - } + + return values; } //-------------------------------------------------------------------------------------------------- @@ -961,6 +1106,23 @@ std::vector RimWellLogRftCurve::tvDepthValues() //-------------------------------------------------------------------------------------------------- std::vector RimWellLogRftCurve::measuredDepthValues() { + if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA ) + { + std::vector values; + + RifReaderRftInterface* reader = rftReader(); + if ( reader ) + { + auto depthAddress = RifEclipseRftAddress::createSegmentResult( m_wellName(), + m_timeStep, + RiaDefines::segmentStartDepthResultName() ); + depthAddress.setSegmentBranchNumber( segmentBranchNumber() ); + + reader->values( depthAddress, &values ); + } + return values; + } + if ( m_observedFmuRftData && !m_ensemble && !m_summaryCase ) { RifReaderRftInterface* reader = rftReader(); @@ -968,7 +1130,7 @@ std::vector RimWellLogRftCurve::measuredDepthValues() if ( !reader ) return values; - RifEclipseRftAddress depthAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::MD ); + RifEclipseRftAddress depthAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::MD ); reader->values( depthAddress, &values ); return values; } @@ -1044,8 +1206,8 @@ bool RimWellLogRftCurve::deriveMeasuredDepthFromObservedData( const std::vector< std::vector tvdValuesOfObservedData; std::vector mdValuesOfObservedData; - RifEclipseRftAddress tvdAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::TVD ); - RifEclipseRftAddress mdAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::MD ); + RifEclipseRftAddress tvdAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); + RifEclipseRftAddress mdAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::MD ); reader->values( tvdAddress, &tvdValuesOfObservedData ); reader->values( mdAddress, &mdValuesOfObservedData ); @@ -1062,3 +1224,18 @@ bool RimWellLogRftCurve::deriveMeasuredDepthFromObservedData( const std::vector< } return false; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimWellLogRftCurve::segmentBranchNumber() const +{ + if ( m_segmentBranchId() != RiaDefines::allBranches() ) + { + QString text = m_segmentBranchId(); + auto intValue = text.toInt(); + return intValue; + } + + return -1; +} diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h index fc37b7b697..0bcfbb8f25 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h @@ -28,6 +28,7 @@ #include "cvfObject.h" +#include #include class RifReaderRftInterface; @@ -47,10 +48,18 @@ class RimWellLogRftCurve : public RimWellLogCurve CAF_PDM_HEADER_INIT; public: - enum DerivedMDSource + enum class RftDataType + { + RFT_DATA, + RFT_SEGMENT_DATA + }; + +private: + enum class DerivedMDSource { NO_SOURCE, WELL_PATH, + SEGMENT, OBSERVED_DATA }; @@ -78,14 +87,14 @@ class RimWellLogRftCurve : public RimWellLogCurve RifEclipseRftAddress rftAddress() const; void setDefaultAddress( QString wellName ); - void updateWellChannelNameAndTimeStep(); void setSimWellBranchData( bool branchDetection, int branchIndex ); protected: // Overrides from RimWellLogPlotCurve - QString createCurveAutoName() override; - void onLoadDataAndUpdate( bool updateParentPlot ) override; + QString createCurveAutoName() override; + void onLoadDataAndUpdate( bool updateParentPlot ) override; + RiaDefines::PhaseType phaseType() const override; // Pdm overrrides void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; @@ -103,6 +112,7 @@ class RimWellLogRftCurve : public RimWellLogCurve bool createWellPathIdxToRftFileIdxMapping(); size_t rftFileIndex( size_t wellPathIndex ); std::vector sortedIndicesInRftFile(); + void updateWellChannelNameAndTimeStep(); std::vector xValues(); std::vector errorValues(); @@ -114,6 +124,8 @@ class RimWellLogRftCurve : public RimWellLogCurve bool deriveMeasuredDepthFromObservedData( const std::vector& tvDepthValues, std::vector& derivedMDValues ); + int segmentBranchNumber() const; + private: caf::PdmPtrField m_eclipseResultCase; caf::PdmPtrField m_summaryCase; @@ -124,6 +136,11 @@ class RimWellLogRftCurve : public RimWellLogCurve caf::PdmField m_branchIndex; caf::PdmField m_branchDetection; + caf::PdmField> m_rftDataType; + + caf::PdmField m_segmentResultName; + caf::PdmField m_segmentBranchId; + std::map m_idxInWellPathToIdxInRftFile; caf::PdmField> m_wellLogChannelName; }; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index e07017bf76..f31b700f00 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -505,7 +505,18 @@ void RimWellLogTrack::updateDepthZoom() { if ( !m_plotWidget ) return; - m_plotWidget->setAxisRange( getDepthAxis(), m_visibleDepthRangeMin(), m_visibleDepthRangeMax() ); + RimDepthTrackPlot* wellLogPlot; + this->firstAncestorOrThisOfTypeAsserted( wellLogPlot ); + + if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + { + m_plotWidget->setAxisRange( depthAxis(), m_visibleDepthRangeMin(), m_visibleDepthRangeMax() ); + } + else + { + m_plotWidget->setAxisRange( RiuPlotAxis::defaultTop(), m_visibleDepthRangeMin(), m_visibleDepthRangeMax() ); + m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), m_visibleDepthRangeMin(), m_visibleDepthRangeMax() ); + } } //-------------------------------------------------------------------------------------------------- @@ -542,8 +553,8 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { if ( m_plotWidget ) { - m_majorTickInterval = m_plotWidget->majorTickInterval( getValueAxis() ); - m_minorTickInterval = m_plotWidget->minorTickInterval( getValueAxis() ); + m_majorTickInterval = m_plotWidget->majorTickInterval( valueAxis() ); + m_minorTickInterval = m_plotWidget->minorTickInterval( valueAxis() ); } m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); @@ -764,13 +775,13 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() bool emptyRange = isEmptyVisibleXRange(); if ( emptyRange ) { - m_plotWidget->enableGridLines( getValueAxis(), false, false ); - m_plotWidget->setAxisRange( getValueAxis(), 0.0, 1.0 ); - m_plotWidget->setAxisLabelsAndTicksEnabled( getValueAxis(), false, false ); + m_plotWidget->enableGridLines( valueAxis(), false, false ); + m_plotWidget->setAxisRange( valueAxis(), 0.0, 1.0 ); + m_plotWidget->setAxisLabelsAndTicksEnabled( valueAxis(), false, false ); } else { - m_plotWidget->setAxisLabelsAndTicksEnabled( getValueAxis(), true, true ); + m_plotWidget->setAxisLabelsAndTicksEnabled( valueAxis(), true, true ); if ( m_minAndMaxTicksOnly ) { auto roundToDigits = []( double value, int numberOfDigits, bool useFloor ) { @@ -805,11 +816,20 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() div.setTicks( QwtScaleDiv::TickType::MajorTick, majorTicks ); - m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtPlot::xTop, div ); + RimDepthTrackPlot* wellLogPlot; + this->firstAncestorOrThisOfTypeAsserted( wellLogPlot ); + if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + { + m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtPlot::xTop, div ); + } + else + { + m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtPlot::yLeft, div ); + } } else if ( m_explicitTickIntervals ) { - m_plotWidget->setMajorAndMinorTickIntervals( getValueAxis(), + m_plotWidget->setMajorAndMinorTickIntervals( valueAxis(), m_majorTickInterval(), m_minorTickInterval(), m_visiblePropertyValueRangeMin(), @@ -819,11 +839,11 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() { int majorTickIntervals = 5; int minorTickIntervals = 10; - m_plotWidget->setAutoTickIntervalCounts( getValueAxis(), majorTickIntervals, minorTickIntervals ); - m_plotWidget->setAxisRange( getValueAxis(), m_visiblePropertyValueRangeMin, m_visiblePropertyValueRangeMax ); + m_plotWidget->setAutoTickIntervalCounts( valueAxis(), majorTickIntervals, minorTickIntervals ); + m_plotWidget->setAxisRange( valueAxis(), m_visiblePropertyValueRangeMin, m_visiblePropertyValueRangeMax ); } - m_plotWidget->enableGridLines( getValueAxis(), + m_plotWidget->enableGridLines( valueAxis(), m_propertyValueAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MAJOR, m_propertyValueAxisGridVisibility() & RimWellLogPlot::AXIS_GRID_MINOR ); } @@ -832,7 +852,7 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() this->firstAncestorOrThisOfType( wellLogPlot ); if ( wellLogPlot ) { - m_plotWidget->enableGridLines( getDepthAxis(), + m_plotWidget->enableGridLines( depthAxis(), wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MAJOR, wellLogPlot->depthAxisGridLinesEnabled() & RimWellLogPlot::AXIS_GRID_MINOR ); } @@ -1008,8 +1028,8 @@ QString RimWellLogTrack::asciiDataForPlotExport() const //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::updateZoomFromParentPlot() { - auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( getValueAxis() ); - auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( getDepthAxis() ); + auto [xIntervalMin, xIntervalMax] = m_plotWidget->axisRange( valueAxis() ); + auto [depthIntervalMin, depthIntervalMax] = m_plotWidget->axisRange( depthAxis() ); m_visiblePropertyValueRangeMin = xIntervalMin; m_visiblePropertyValueRangeMax = xIntervalMax; @@ -1228,8 +1248,19 @@ void RimWellLogTrack::onLoadDataAndUpdate() if ( wellLogPlot && m_plotWidget ) { - m_plotWidget->setAxisTitleText( getValueAxis(), m_propertyValueAxisTitle ); - m_plotWidget->setAxisTitleText( getDepthAxis(), wellLogPlot->depthAxisTitle() ); + m_plotWidget->setAxisTitleText( valueAxis(), m_propertyValueAxisTitle ); + m_plotWidget->setAxisTitleText( depthAxis(), wellLogPlot->depthAxisTitle() ); + + if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + { + m_plotWidget->setAxisEnabled( QwtPlot::xTop, true ); + m_plotWidget->setAxisEnabled( QwtPlot::xBottom, false ); + } + else + { + m_plotWidget->setAxisEnabled( QwtPlot::xTop, false ); + m_plotWidget->setAxisEnabled( QwtPlot::xBottom, true ); + } } for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx ) @@ -1981,26 +2012,41 @@ void RimWellLogTrack::updateAxisScaleEngine() if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) { m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), true ); + + if ( m_isLogarithmicScaleEnabled ) + { + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new QwtLogScaleEngine ); + + // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine ); + } + else + { + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new RiuQwtLinearScaleEngine ); + + // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine ); + } } else { m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), false ); - } - } - if ( m_isLogarithmicScaleEnabled ) - { - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new QwtLogScaleEngine ); + if ( m_isLogarithmicScaleEnabled ) + { + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new QwtLogScaleEngine ); - // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine ); - } - else - { - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new RiuQwtLinearScaleEngine ); + // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yRight, new QwtLogScaleEngine ); + } + else + { + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new RiuQwtLinearScaleEngine ); - // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine ); + // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yRight, new RiuQwtLinearScaleEngine ); + } + } } } @@ -2055,8 +2101,18 @@ void RimWellLogTrack::handleWheelEvent( QWheelEvent* event ) { if ( event->modifiers() & Qt::ControlModifier ) { - QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtPlot::yLeft ); - double zoomCenter = scaleMap.invTransform( event->pos().y() ); + double zoomCenter = 0.0; + + if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + { + QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtPlot::yLeft ); + zoomCenter = scaleMap.invTransform( event->pos().y() ); + } + else + { + QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtPlot::xTop ); + zoomCenter = scaleMap.invTransform( event->pos().x() ); + } if ( event->delta() > 0 ) { @@ -2501,14 +2557,6 @@ void RimWellLogTrack::updateStackedCurveData() if ( allDepthValues.empty() ) continue; - bool isVerticalTrack = true; - RimDepthTrackPlot* wellLogPlot; - this->firstAncestorOrThisOfType( wellLogPlot ); - if ( wellLogPlot ) - { - isVerticalTrack = ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ); - } - size_t stackIndex = 0u; std::vector allStackedValues( allDepthValues.size(), 0.0 ); for ( auto curve : stackedCurvesInGroup ) @@ -2535,7 +2583,7 @@ void RimWellLogTrack::updateStackedCurveData() auto plotDepthValues = tempCurveData.depths( depthType ); auto polyLineStartStopIndices = tempCurveData.polylineStartStopIndices(); - curve->setOverrideCurveData( allStackedValues, plotDepthValues, polyLineStartStopIndices, isVerticalTrack ); + curve->setOverrideCurveData( allStackedValues, plotDepthValues, polyLineStartStopIndices ); curve->setZOrder( zPos ); if ( !dynamic_cast( curve ) ) @@ -3253,27 +3301,21 @@ void RimWellLogTrack::setEnsembleWellLogCurveSet( RimEnsembleWellLogCurveSet* cu //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuPlotAxis RimWellLogTrack::getDepthAxis() const +RiuPlotAxis RimWellLogTrack::depthAxis() const { RimDepthTrackPlot* wellLogPlot; this->firstAncestorOrThisOfTypeAsserted( wellLogPlot ); - if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) - return RiuPlotAxis::defaultLeft(); - else - return RiuPlotAxis::defaultTop(); + return wellLogPlot->depthAxis(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuPlotAxis RimWellLogTrack::getValueAxis() const +RiuPlotAxis RimWellLogTrack::valueAxis() const { RimDepthTrackPlot* wellLogPlot; this->firstAncestorOrThisOfTypeAsserted( wellLogPlot ); - if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) - return RiuPlotAxis::defaultTop(); - else - return RiuPlotAxis::defaultLeft(); + return wellLogPlot->valueAxis(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index a15aaf3ff8..d22fca5172 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -250,8 +250,8 @@ class RimWellLogTrack : public RimPlot void updatePropertyValueZoom(); void updateDepthZoom(); - RiuPlotAxis getDepthAxis() const; - RiuPlotAxis getValueAxis() const; + RiuPlotAxis depthAxis() const; + RiuPlotAxis valueAxis() const; int axisFontSize() const; diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.cpp index aa30bbc07b..cda550113a 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.cpp @@ -186,6 +186,15 @@ std::vector RigWellLogCurveData::depths( RiaDefines::DepthTypeEnum depth return std::vector(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigWellLogCurveData::depths( RiaDefines::DepthTypeEnum depthType, + RiaDefines::DepthUnitType destinationDepthUnit ) const +{ + return depthsForDepthUnit( depths( depthType ), m_depthUnit, destinationDepthUnit ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -232,22 +241,11 @@ std::vector RigWellLogCurveData::propertyValuesByIntervals() const std::vector RigWellLogCurveData::depthValuesByIntervals( RiaDefines::DepthTypeEnum depthType, RiaDefines::DepthUnitType destinationDepthUnit ) const { - std::vector filteredValues; + const std::vector depthValues = + RigWellLogCurveData::depthsForDepthUnit( depths( depthType ), m_depthUnit, destinationDepthUnit ); - const std::vector depthValues = depths( depthType ); - if ( !depthValues.empty() ) - { - if ( destinationDepthUnit == m_depthUnit ) - { - RiaCurveDataTools::getValuesByIntervals( depthValues, m_intervalsOfContinousValidValues, &filteredValues ); - } - else - { - std::vector convertedValues = - RiaWellLogUnitTools::convertDepths( depthValues, m_depthUnit, destinationDepthUnit ); - RiaCurveDataTools::getValuesByIntervals( convertedValues, m_intervalsOfContinousValidValues, &filteredValues ); - } - } + std::vector filteredValues; + RiaCurveDataTools::getValuesByIntervals( depthValues, m_intervalsOfContinousValidValues, &filteredValues ); return filteredValues; } @@ -502,6 +500,20 @@ void RigWellLogCurveData::calculateIntervalsOfContinousValidValues() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RigWellLogCurveData::depthsForDepthUnit( const std::vector& depths, + RiaDefines::DepthUnitType sourceDepthUnit, + RiaDefines::DepthUnitType destinationDepthUnit ) +{ + if ( destinationDepthUnit == sourceDepthUnit ) return depths; + + std::vector convertedValues = + RiaWellLogUnitTools::convertDepths( depths, sourceDepthUnit, destinationDepthUnit ); + return convertedValues; +} + //-------------------------------------------------------------------------------------------------- /// Splits the start stop interval between cells that are not close enough. //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.h b/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.h index 807b7c9d96..e44097f7e3 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.h +++ b/ApplicationLibCode/ReservoirDataModel/RigWellLogCurveData.h @@ -65,6 +65,7 @@ class RigWellLogCurveData : public cvf::Object QString propertyValueUnit() const; std::vector depths( RiaDefines::DepthTypeEnum depthType ) const; + std::vector depths( RiaDefines::DepthTypeEnum depthType, RiaDefines::DepthUnitType destinationDepthUnit ) const; std::set availableDepthTypes() const; @@ -93,6 +94,10 @@ class RigWellLogCurveData : public cvf::Object private: void calculateIntervalsOfContinousValidValues(); + static std::vector depthsForDepthUnit( const std::vector& depths, + RiaDefines::DepthUnitType sourceDepthUnit, + RiaDefines::DepthUnitType destinationDepthUnit ); + static void splitIntervalAtEmptySpace( const std::vector& depthValues, size_t startIdx, size_t stopIdx, diff --git a/ApplicationLibCode/UnitTests/opm-summary-Test.cpp b/ApplicationLibCode/UnitTests/opm-summary-Test.cpp index c65b554a67..8e38300d4d 100644 --- a/ApplicationLibCode/UnitTests/opm-summary-Test.cpp +++ b/ApplicationLibCode/UnitTests/opm-summary-Test.cpp @@ -1,11 +1,17 @@ #include "gtest/gtest.h" +#include "RiaRftDefines.h" #include "RiaTestDataDirectory.h" + #include "RifOpmCommonSummary.h" +#include "RifReaderOpmRft.h" +#include "opm/io/eclipse/ERft.hpp" #include "opm/io/eclipse/ESmry.hpp" #include "opm/io/eclipse/ExtESmry.hpp" +#include + static const QString H5_TEST_DATA_DIRECTORY = QString( "%1/h5-file/" ).arg( TEST_DATA_DIR ); //-------------------------------------------------------------------------------------------------- @@ -43,3 +49,246 @@ TEST( OpmSummaryTests, ReadOpmSummaryDataListContent ) EXPECT_TRUE( eclAdr.isValid() ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( OpmSummaryTests, DISABLED_OpmImportRftData ) +{ + std::vector esmryKeywords; + { + // QString filePath = "e:/gitroot/opm-tests/model1/opm-simulation-reference/flow/MSW_MODEL_1.RFT"; + // QString filePath = "e:/gitroot/opm-tests/norne/ECL.2014.2/NORNE_ATW2013.RFT"; + // QString filePath = "d:/Models/Statoil/MSW-RFTfile/NORNE_ATW2013_RFTPLT_MSW.RFT"; + QString filePath = "e:/models/from_equinor_sftp/MSW-RFTfile/NORNE_ATW2013_RFTPLT_MSW.RFT"; + + Opm::EclIO::ERft eRft( filePath.toStdString() ); + + auto wells = eRft.listOfWells(); + auto dates = eRft.listOfdates(); + auto reports = eRft.listOfRftReports(); + + std::cout << "\nWells:\n"; + for ( const auto& w : wells ) + { + std::cout << w << "\n"; + } + + std::cout << "\nDates:\n"; + for ( const auto& date : dates ) + { + auto [year, month, day] = date; + + std::cout << year << ", " << month << ", " << day << "\n"; + } + + std::cout << "\nReports:\n"; + for ( const auto& report : reports ) + { + auto [text, date, floatValue] = report; + + std::cout << text << ", " << floatValue << "\n"; + } + + std::cout << "\nRFT Arrays:\n"; + for ( int i = 0; i < eRft.numberOfReports(); i++ ) + { + std::cout << "\n"; + + auto rftVectors = eRft.listOfRftArrays( i ); + + for ( const auto& rftVec : rftVectors ) + { + auto [name, arrType, itemCount] = rftVec; + + std::cout << name << ", " << itemCount << "\n"; + } + } + } +} + +// std::vector getValues(Opm::EclIO::ERft& fileReader, std::) + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( OpmSummaryTests, DISABLED_OpmComputeSegmentTopology ) +{ + std::vector esmryKeywords; + { + // QString filePath = "e:/gitroot/opm-tests/model1/opm-simulation-reference/flow/MSW_MODEL_1.RFT"; + // QString filePath = "e:/gitroot/opm-tests/norne/ECL.2014.2/NORNE_ATW2013.RFT"; + // QString filePath = "d:/Models/Statoil/MSW-RFTfile/NORNE_ATW2013_RFTPLT_MSW.RFT"; + // QString filePath = "e:/models/from_equinor_sftp/MSW-RFTfile/NORNE_ATW2013_RFTPLT_MSW.RFT"; + QString filePath = "e:/models/from_equinor_sftp/MSWRFT_toCS/MSWLOOPED_UN_RFT.RFT"; + + Opm::EclIO::ERft eRft( filePath.toStdString() ); + + auto wells = eRft.listOfWells(); + auto dates = eRft.listOfdates(); + + class RftSegmentData + { + public: + RftSegmentData( int segnxt, int brno, int brnst, int brnen, int segNo ) + : m_segNext( segnxt ) + , m_segbrno( brno ) + , m_brnst( brnst ) + , m_brnen( brnen ) + , m_segmentNo( segNo ) + { + } + + int segNext() const { return m_segNext; } + int segBrno() const { return m_segbrno; } + int segBrnst() const { return m_brnst; } + int segBrnen() const { return m_brnen; } + int segNo() const { return m_segmentNo; } + + private: + int m_segNext; + int m_segbrno; + int m_brnst; + int m_brnen; + int m_segmentNo; + }; + + using RftSegmentKey = std::pair; + std::map> rftWellDateSegments; + + for ( const auto& well : wells ) + { + for ( const auto& date : dates ) + { + std::vector segmentsForWellDate; + + std::vector segnxt; + std::vector segbrno; + std::vector brnstValues; + std::vector brnenValues; + std::vector segNo; + + { + std::string resultName = "SEGNXT"; + if ( eRft.hasArray( resultName, well, date ) ) + { + segnxt = eRft.getRft( resultName, well, date ); + } + } + { + std::string resultName = "SEGBRNO"; + if ( eRft.hasArray( resultName, well, date ) ) + { + segbrno = eRft.getRft( resultName, well, date ); + } + } + { + std::string resultName = "BRNST"; + if ( eRft.hasArray( resultName, well, date ) ) + { + brnstValues = eRft.getRft( resultName, well, date ); + } + } + { + std::string resultName = "BRNEN"; + if ( eRft.hasArray( resultName, well, date ) ) + { + brnenValues = eRft.getRft( resultName, well, date ); + } + } + + if ( segnxt.empty() ) continue; + if ( segnxt.size() != segbrno.size() ) continue; + if ( brnenValues.empty() || brnstValues.empty() ) continue; + + for ( size_t i = 0; i < segnxt.size(); i++ ) + { + int branchIndex = segbrno[i] - 1; + int nextBranchIndex = -1; + if ( i + 1 < segbrno.size() ) nextBranchIndex = segbrno[i + 1] - 1; + + bool isLastSegmentOnBranch = branchIndex != nextBranchIndex; + + int brnst = brnstValues[branchIndex]; + int brnen = brnenValues[branchIndex]; + + int segmentId = -1; + if ( !isLastSegmentOnBranch ) + { + if ( i + 1 < segnxt.size() ) segmentId = segnxt[i + 1]; + } + else + { + segmentId = brnen; + } + + segNo.push_back( segmentId ); + + segmentsForWellDate.emplace_back( RftSegmentData( segnxt[i], segbrno[i], brnst, brnen, segmentId ) ); + } + + auto wellDateKey = std::make_pair( well, date ); + + rftWellDateSegments[wellDateKey] = segmentsForWellDate; + } + } + + for ( const auto& a : rftWellDateSegments ) + { + auto [wellName, date] = a.first; + auto segmentData = a.second; + + std::cout << "\nWell: " << wellName << "Date : " << std::get<0>( date ) << " " << std::get<1>( date ) << " " + << std::get<2>( date ) << " \n"; + + for ( const auto& r : segmentData ) + { + std::cout << "SEGNXT " << std::setw( 2 ) << r.segNext() << ", "; + std::cout << "SEGBRNO " << std::setw( 2 ) << r.segBrno() << ", "; + std::cout << "BNRST " << std::setw( 2 ) << r.segBrnst() << ", "; + std::cout << "BRNEN " << std::setw( 2 ) << r.segBrnen() << ", "; + std::cout << "SEGNO " << std::setw( 2 ) << r.segNo() << "\n"; + } + } + } +} + +TEST( OpmSummaryTests, OpmComputeSegmentTopology ) +{ + std::vector esmryKeywords; + { + // QString filePath = "e:/gitroot/opm-tests/model1/opm-simulation-reference/flow/MSW_MODEL_1.RFT"; + // QString filePath = "e:/gitroot/opm-tests/norne/ECL.2014.2/NORNE_ATW2013.RFT"; + // QString filePath = "d:/Models/Statoil/MSW-RFTfile/NORNE_ATW2013_RFTPLT_MSW.RFT"; + // QString filePath = "e:/models/from_equinor_sftp/MSW-RFTfile/NORNE_ATW2013_RFTPLT_MSW.RFT"; + QString filePath = "e:/models/from_equinor_sftp/MSWRFT_toCS/MSWLOOPED_UN_RFT.RFT"; + + RifReaderOpmRft reader( filePath ); + + auto adresses = reader.eclipseRftAddresses(); + + std::vector segStartDepth; + std::vector segEndDepth; + std::vector segNumber; + + std::set segmentAdresses; + for ( const auto& adr : adresses ) + { + if ( adr.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ) + { + segmentAdresses.insert( adr ); + } + } + + for ( const auto& adr : segmentAdresses ) + { + qDebug() << adr.timeStep().toString( "YYYY MM dd" ) << " " << adr.segmentResultName(); + + if ( adr.segmentResultName() == RiaDefines::segmentNumberResultName() ) + { + std::vector values; + reader.values( adr, &values ); + } + } + } +} diff --git a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp index 1cf1a08779..3a3766b95f 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp @@ -41,8 +41,9 @@ class RiuWellLogCurvePointTracker : public RiuQwtCurvePointTracker { public: - RiuWellLogCurvePointTracker( QwtPlot* plot, IPlotCurveInfoTextProvider* curveInfoTextProvider ) + RiuWellLogCurvePointTracker( QwtPlot* plot, IPlotCurveInfoTextProvider* curveInfoTextProvider, RimWellLogTrack* track ) : RiuQwtCurvePointTracker( plot, false, curveInfoTextProvider ) + , m_wellLogTrack( track ) { } @@ -66,7 +67,19 @@ class RiuWellLogCurvePointTracker : public RiuQwtCurvePointTracker closestCurvePoint( pos, &curveInfoText, &xAxisValueString, &depthAxisValueString, &relatedXAxis, &relatedYAxis ); if ( !closestPoint.isNull() ) { - QString str = QString( "%1\nDepth: %2" ).arg( xAxisValueString ).arg( depthAxisValueString ); + QString str; + + RimWellLogPlot* wlp = nullptr; + m_wellLogTrack->firstAncestorOfType( wlp ); + + if ( wlp && wlp->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + { + str = QString( "%1\nDepth: %2" ).arg( xAxisValueString ).arg( depthAxisValueString ); + } + else + { + str = QString( "%1\nDepth: %2" ).arg( depthAxisValueString ).arg( xAxisValueString ); + } if ( !curveInfoText.isEmpty() ) { @@ -84,6 +97,9 @@ class RiuWellLogCurvePointTracker : public RiuQwtCurvePointTracker return txt; } + +private: + caf::PdmPointer m_wellLogTrack; }; //-------------------------------------------------------------------------------------------------- @@ -122,9 +138,9 @@ RiuWellLogTrack::RiuWellLogTrack( RimWellLogTrack* track, QWidget* parent /*= nu setAxisEnabled( QwtPlot::yLeft, true ); setAxisEnabled( QwtPlot::yRight, false ); setAxisEnabled( QwtPlot::xTop, true ); - setAxisEnabled( QwtPlot::xBottom, false ); + setAxisEnabled( QwtPlot::xBottom, true ); - new RiuWellLogCurvePointTracker( this->qwtPlot(), &wellLogCurveInfoTextProvider ); + new RiuWellLogCurvePointTracker( this->qwtPlot(), &wellLogCurveInfoTextProvider, track ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuWellLogTrack.h b/ApplicationLibCode/UserInterface/RiuWellLogTrack.h index 9979e1c1f7..117a2c5ba8 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogTrack.h +++ b/ApplicationLibCode/UserInterface/RiuWellLogTrack.h @@ -38,6 +38,5 @@ class RiuWellLogTrack : public RiuQwtPlotWidget RiuWellLogTrack( RimWellLogTrack* track, QWidget* parent = nullptr ); ~RiuWellLogTrack() override; -private: void setAxisEnabled( QwtPlot::Axis axis, bool enabled ); }; diff --git a/ThirdParty/custom-opm-common/CMakeLists.txt b/ThirdParty/custom-opm-common/CMakeLists.txt index 3428bb6a50..5956aa84d0 100644 --- a/ThirdParty/custom-opm-common/CMakeLists.txt +++ b/ThirdParty/custom-opm-common/CMakeLists.txt @@ -88,6 +88,7 @@ add_library(${PROJECT_NAME} opm-common/src/opm/io/eclipse/ESmry.cpp opm-common/src/opm/io/eclipse/ExtESmry.cpp opm-common/src/opm/io/eclipse/EInit.cpp + opm-common/src/opm/io/eclipse/ERft.cpp # Required for use of static function RstConnection::inverse_peaceman opm-common/src/opm/io/eclipse/rst/connection.cpp From 3180b419d0799a7bead3a0c2d425454f9cc824cb Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 18 Feb 2022 12:28:52 +0100 Subject: [PATCH 137/406] #8522 Summary Plot: Add menu item to add plot axis. --- .../CMakeLists_files.cmake | 2 + .../RicNewPlotAxisPropertiesFeature.cpp | 67 +++++++++++++++++++ .../RicNewPlotAxisPropertiesFeature.h | 35 ++++++++++ .../RimContextCommandBuilder.cpp | 1 + .../Summary/RimSummaryPlot.cpp | 22 ++++++ .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 ++ .../UserInterface/RiuQtChartsPlotWidget.cpp | 4 +- 7 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp create mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.h diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index e3e05f508d..6ee0d2b92c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -43,6 +43,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicNewPlotAxisPropertiesFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.h ) @@ -91,6 +92,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicNewPlotAxisPropertiesFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.cpp ) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp new file mode 100644 index 0000000000..09e42f57ac --- /dev/null +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicNewPlotAxisPropertiesFeature.h" + +#include "RiaPlotDefines.h" + +#include "RimPlotAxisProperties.h" +#include "RimSummaryPlot.h" + +#include "RiuPlotMainWindowTools.h" + +#include "cafSelectionManagerTools.h" + +#include + +CAF_CMD_SOURCE_INIT( RicNewPlotAxisPropertiesFeature, "RicNewPlotAxisPropertiesFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewPlotAxisPropertiesFeature::isCommandEnabled() +{ + std::vector summaryPlots = caf::selectedObjectsByTypeStrict(); + return summaryPlots.size() == 1; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewPlotAxisPropertiesFeature::onActionTriggered( bool isChecked ) +{ + std::vector summaryPlots = caf::selectedObjectsByTypeStrict(); + if ( summaryPlots.size() != 1 ) return; + + RimSummaryPlot* summaryPlot = summaryPlots[0]; + + RimPlotAxisProperties* newPlotAxisProperties = + summaryPlot->addNewAxisProperties( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "New Axis" ); + + summaryPlot->updateConnectedEditors(); + RiuPlotMainWindowTools::selectAsCurrentItem( newPlotAxisProperties ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewPlotAxisPropertiesFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "New Plot Axis" ); + actionToSetup->setIcon( QIcon( ":/LeftAxis16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.h new file mode 100644 index 0000000000..96044452ff --- /dev/null +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicNewPlotAxisPropertiesFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + // Overrides + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 9c2d8bf886..f01e992960 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -677,6 +677,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewSummaryEnsembleCurveSetFeature"; menuBuilder << "RicDuplicateSummaryCrossPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotCurveFeature"; + menuBuilder << "RicNewPlotAxisPropertiesFeature"; menuBuilder << "Separator"; menuBuilder << "RicSavePlotTemplateFeature"; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 244d86dac1..4da4925c01 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1715,6 +1715,28 @@ void RimSummaryPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter, loadDataAndUpdate(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiaDefines::PlotAxis plotAxis, const QString& name ) +{ + RiuPlotAxis newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); + return addNewAxisProperties( newPlotAxis, name ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name ) +{ + RimPlotAxisProperties* axisProperties = new RimPlotAxisProperties; + axisProperties->setNameAndAxis( name, plotAxis.axis(), plotAxis.index() ); + m_axisProperties.push_back( axisProperties ); + connectAxisSignals( axisProperties ); + + return axisProperties; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 582a31d58c..c533af7aba 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -189,6 +189,8 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping RimPlotAxisPropertiesInterface* axisPropertiesForPlotAxis( RiuPlotAxis plotAxis ) const; + RimPlotAxisProperties* addNewAxisProperties( RiaDefines::PlotAxis, const QString& name ); + public: // RimViewWindow overrides void deleteViewWidget() override; @@ -211,6 +213,8 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis ); + RimPlotAxisProperties* addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name ); + protected: // Overridden PDM methods caf::PdmFieldHandle* userDescriptionField() override; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 8a5c0b617c..d14846410d 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -905,7 +905,9 @@ void RiuQtChartsPlotWidget::addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool { QValueAxis* axis = new QValueAxis(); qtChart()->addAxis( axis, mapPlotAxisToQtAlignment( plotAxis.axis() ) ); - m_axes[plotAxis] = axis; + m_axes[plotAxis] = axis; + m_axesEnabled[plotAxis] = isEnabled; + m_axesAutoScale[plotAxis] = isAutoScale; } //-------------------------------------------------------------------------------------------------- From 2e6795bd1d3c5092dd297b5155b3d1cded2debce Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 18 Feb 2022 14:17:18 +0100 Subject: [PATCH 138/406] Summary Plot: Refactor to use new RimSummaryPlot::addNewAxisProperties(). --- .../Summary/RimSummaryPlot.cpp | 23 ++++--------------- 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 4da4925c01..1f88ed6d34 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -121,21 +121,12 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) CAF_PDM_InitFieldNoDefault( &m_axisProperties, "AxisProperties", "Axes", ":/Axes16x16.png" ); - RimPlotAxisProperties* leftYAxisProperties = new RimPlotAxisProperties; - leftYAxisProperties->setNameAndAxis( "Left", RiaDefines::PlotAxis::PLOT_AXIS_LEFT, 0 ); - m_axisProperties.push_back( leftYAxisProperties ); - connectAxisSignals( leftYAxisProperties ); - - RimPlotAxisProperties* rightYAxisProperties = new RimPlotAxisProperties; - rightYAxisProperties->setNameAndAxis( "Right", RiaDefines::PlotAxis::PLOT_AXIS_RIGHT, 0 ); - m_axisProperties.push_back( rightYAxisProperties ); - connectAxisSignals( rightYAxisProperties ); + addNewAxisProperties( RiuPlotAxis::defaultLeft(), "Left" ); + addNewAxisProperties( RiuPlotAxis::defaultRight(), "Right" ); if ( m_isCrossPlot ) { - RimPlotAxisProperties* bottomAxisProperties = new RimPlotAxisProperties; - bottomAxisProperties->setNameAndAxis( "Bottom", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, 0 ); - m_axisProperties.push_back( bottomAxisProperties ); + addNewAxisProperties( RiuPlotAxis::defaultBottom(), "Bottom" ); } else { @@ -2451,16 +2442,12 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* curve ) RiuPlotAxis newPlotAxis = RiuPlotAxis::defaultLeft(); if ( plotWidget() && plotWidget()->isMultiAxisSupported() ) { - newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); - QString axisObjectName = "New Axis"; if ( !curve->summaryAddressY().uiText().empty() ) axisObjectName = QString::fromStdString( curve->summaryAddressY().uiText() ); - auto* newAxisProperties = new RimPlotAxisProperties; - newAxisProperties->setNameAndAxis( axisObjectName, newPlotAxis.axis(), newPlotAxis.index() ); - m_axisProperties.push_back( newAxisProperties ); - connectAxisSignals( newAxisProperties ); + newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); + addNewAxisProperties( newPlotAxis, axisObjectName ); } curve->setLeftOrRightAxisY( newPlotAxis ); From bd22336ba86d202c4eec45f10640c93347f140bd Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 18 Feb 2022 14:59:35 +0100 Subject: [PATCH 139/406] #8522 Summary Plot: ensure plot axis are restore when creating plots. --- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 5 +++++ ApplicationLibCode/UserInterface/RiuPlotWidget.h | 2 ++ .../UserInterface/RiuQtChartsPlotWidget.cpp | 12 ++++++++++-- .../UserInterface/RiuQtChartsPlotWidget.h | 2 ++ .../UserInterface/RiuQwtPlotWidget.cpp | 7 +++++++ ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h | 2 ++ 6 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 1f88ed6d34..cb88bfc61a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2006,6 +2006,11 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent m_summaryPlot = std::make_unique( this, mainWindowParent ); #endif + for ( auto axisProperties : m_axisProperties ) + { + plotWidget()->ensureAxis( axisProperties->plotAxisType() ); + } + for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves ) { curve->setParentPlotNoReplot( plotWidget() ); diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.h b/ApplicationLibCode/UserInterface/RiuPlotWidget.h index dc5fa7b13e..3bb660b743 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.h @@ -153,6 +153,8 @@ class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow virtual int axisExtent( RiuPlotAxis axis ) const = 0; + virtual void ensureAxis( RiuPlotAxis axis ) = 0; + QPoint dragStartPosition() const; void scheduleReplot(); diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index d14846410d..12289e1540 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -860,13 +860,21 @@ void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSerie //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) +void RiuQtChartsPlotWidget::ensureAxis( RiuPlotAxis axis ) { - // Make sure the axis we are about to set exists. if ( m_axes.find( axis ) == m_axes.end() ) { addAxis( axis, true, true ); } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) +{ + // Make sure the axis we are about to set exists. + ensureAxis( axis ); if ( qtChart()->series().contains( series ) && !series->attachedAxes().contains( plotAxis( axis ) ) ) { diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index 9b06fc8d45..00025f5fca 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -134,6 +134,8 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget int axisExtent( RiuPlotAxis axis ) const override; + void ensureAxis( RiuPlotAxis axis ) override; + QPoint dragStartPosition() const; void scheduleReplot(); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 0ae8b6a5f2..457502194a 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -1048,6 +1048,13 @@ QwtPlot* RiuQwtPlotWidget::qwtPlot() const return m_plot; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::ensureAxis( RiuPlotAxis axis ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index f0e13b7d5e..cf77fba0d8 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -131,6 +131,8 @@ class RiuQwtPlotWidget : public RiuPlotWidget int axisExtent( RiuPlotAxis axis ) const override; + void ensureAxis( RiuPlotAxis axis ) override; + QPoint dragStartPosition() const; void scheduleReplot(); From 1a1acfa0069bac381e0df9d1ac6b60050f95763a Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 18 Feb 2022 18:22:40 +0100 Subject: [PATCH 140/406] #8522 Summary Plot: handle plot axis deletion. --- .../RimPlotAxisProperties.cpp | 2 ++ .../Summary/RimEnsembleCurveSet.cpp | 10 +++++++ .../Summary/RimEnsembleCurveSet.h | 6 ++-- .../Summary/RimSummaryPlot.cpp | 30 +++++++++++++++++++ .../ProjectDataModel/Summary/RimSummaryPlot.h | 7 +++-- 5 files changed, 51 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 6d1d9ceabb..2bad67414f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -95,6 +95,8 @@ RimPlotAxisProperties::RimPlotAxisProperties() m_annotations.uiCapability()->setUiTreeHidden( true ); updateOptionSensitivity(); + + setDeletable( true ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 9be8b37b13..1b30e5d247 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -2091,6 +2091,16 @@ RiuPlotAxis RimEnsembleCurveSet::axisY() const return RiuPlotAxis::defaultLeft(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEnsembleCurveSet::setAxisY( RiuPlotAxis plotAxis ) +{ + RimSummaryPlot* plot = nullptr; + firstAncestorOrThisOfTypeAsserted( plot ); + m_plotAxisProperties = plot->axisPropertiesForPlotAxis( plotAxis ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index a430a3833a..ea55d6f90c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -167,6 +167,9 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt std::vector generateColorsForCases( const std::vector& summaryCases ) const; + RiuPlotAxis axisY() const; + void setAxisY( RiuPlotAxis plotAxis ); + protected: void initAfterRead() override; @@ -192,8 +195,7 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - void updatePlotAxis(); - RiuPlotAxis axisY() const; + void updatePlotAxis(); QString createAutoName() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index cb88bfc61a..71ce1e4d3a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2457,3 +2457,33 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* curve ) curve->setLeftOrRightAxisY( newPlotAxis ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, + std::vector& referringObjects ) +{ + if ( childArray == &m_axisProperties ) + { + for ( caf::PdmObjectHandle* reffingObj : referringObjects ) + { + RimSummaryCurve* curve = dynamic_cast( reffingObj ); + RimEnsembleCurveSet* curveSet = dynamic_cast( reffingObj ); + if ( curve ) + { + curve->setLeftOrRightAxisY( RiuPlotAxis::defaultLeft() ); + } + else if ( curveSet ) + { + curveSet->setAxisY( RiuPlotAxis::defaultLeft() ); + } + } + + if ( plotWidget() ) + { + updateAxes(); + plotWidget()->scheduleReplot(); + } + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index c533af7aba..3a27d3f50e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -220,8 +220,11 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping caf::PdmFieldHandle* userDescriptionField() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override; - void updateStackedCurveData(); - void updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ); + void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, + std::vector& referringObjects ) override; + + void updateStackedCurveData(); + void updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ); void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; From 10cb2d7d0b187cf440f5351c29e0ef6d144d0f9e Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 21 Feb 2022 11:32:26 +0100 Subject: [PATCH 141/406] #8522 Summary Plot: Prune unused axes after move or delete --- .../RimPlotAxisProperties.cpp | 9 +++++++- .../ProjectDataModel/RimPlotAxisProperties.h | 3 +++ .../Summary/RimEnsembleCurveSet.cpp | 6 ++++++ .../Summary/RimSummaryPlot.cpp | 11 ++++++++-- .../UserInterface/RiuPlotWidget.h | 7 ++++--- .../UserInterface/RiuQtChartsPlotWidget.cpp | 21 +++++++++++++++++-- .../UserInterface/RiuQtChartsPlotWidget.h | 3 ++- .../UserInterface/RiuQwtPlotWidget.cpp | 10 ++++++++- .../UserInterface/RiuQwtPlotWidget.h | 3 ++- 9 files changed, 62 insertions(+), 11 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 2bad67414f..4f68e30262 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -95,8 +95,15 @@ RimPlotAxisProperties::RimPlotAxisProperties() m_annotations.uiCapability()->setUiTreeHidden( true ); updateOptionSensitivity(); +} - setDeletable( true ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotAxisProperties::isDeletable() const +{ + // The default axes (which have index 0) are not deletable + return m_plotAxisIndex != 0; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index 6fb452b2f0..a4eebc3389 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -77,6 +77,9 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface bool isAxisInverted() const override; void setAxisInverted( bool inverted ); + bool isDeletable() const override; + + std::vector annotations() const override; void appendAnnotation( RimPlotAxisAnnotation* annotation ) override; void removeAllAnnotations() override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 1b30e5d247..2961e58ad9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -753,6 +753,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi updatePlotAxis(); plot->updateAxes(); + plot->updateAll(); updateTextInPlot = true; } @@ -2099,6 +2100,11 @@ void RimEnsembleCurveSet::setAxisY( RiuPlotAxis plotAxis ) RimSummaryPlot* plot = nullptr; firstAncestorOrThisOfTypeAsserted( plot ); m_plotAxisProperties = plot->axisPropertiesForPlotAxis( plotAxis ); + + for ( RimSummaryCurve* curve : curves() ) + { + curve->setLeftOrRightAxisY( axisY() ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 71ce1e4d3a..984d72d694 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -845,7 +845,7 @@ void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis ) } double min, max; - RimPlotAxisLogRangeCalculator calc( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, plotCurves ); + RimPlotAxisLogRangeCalculator calc( plotAxis.axis(), plotCurves ); calc.computeAxisRange( &min, &max ); if ( yAxisProps->isAxisInverted() ) @@ -2008,7 +2008,7 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent for ( auto axisProperties : m_axisProperties ) { - plotWidget()->ensureAxis( axisProperties->plotAxisType() ); + plotWidget()->ensureAxisIsCreated( axisProperties->plotAxisType() ); } for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves ) @@ -2482,6 +2482,13 @@ void RimSummaryPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childAr if ( plotWidget() ) { + std::set usedPlotAxis; + for ( auto axisProperties : m_axisProperties ) + { + usedPlotAxis.insert( axisProperties->plotAxisType() ); + } + + plotWidget()->pruneAxes( usedPlotAxis ); updateAxes(); plotWidget()->scheduleReplot(); } diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.h b/ApplicationLibCode/UserInterface/RiuPlotWidget.h index 3bb660b743..42ab278c76 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.h @@ -107,8 +107,9 @@ class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow virtual void setAxisTitleText( RiuPlotAxis axis, const QString& title ) = 0; virtual void setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) = 0; - virtual bool isMultiAxisSupported() const = 0; - virtual RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) = 0; + virtual bool isMultiAxisSupported() const = 0; + virtual RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) = 0; + virtual void pruneAxes( const std::set& usedAxes ) = 0; virtual void setPlotTitle( const QString& plotTitle ) = 0; const QString& plotTitle() const; @@ -153,7 +154,7 @@ class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow virtual int axisExtent( RiuPlotAxis axis ) const = 0; - virtual void ensureAxis( RiuPlotAxis axis ) = 0; + virtual void ensureAxisIsCreated( RiuPlotAxis axis ) = 0; QPoint dragStartPosition() const; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 12289e1540..2e5da20acc 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -860,7 +860,7 @@ void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSerie //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::ensureAxis( RiuPlotAxis axis ) +void RiuQtChartsPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis ) { if ( m_axes.find( axis ) == m_axes.end() ) { @@ -874,7 +874,7 @@ void RiuQtChartsPlotWidget::ensureAxis( RiuPlotAxis axis ) void RiuQtChartsPlotWidget::setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) { // Make sure the axis we are about to set exists. - ensureAxis( axis ); + ensureAxisIsCreated( axis ); if ( qtChart()->series().contains( series ) && !series->attachedAxes().contains( plotAxis( axis ) ) ) { @@ -1111,3 +1111,20 @@ Qt::Alignment RiuQtChartsPlotWidget::mapPlotAxisToQtAlignment( RiaDefines::PlotA if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) return Qt::AlignLeft; return Qt::AlignRight; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::pruneAxes( const std::set& usedAxes ) +{ + for ( auto [plotAxis, qtAxis] : m_axes ) + { + if ( usedAxes.count( plotAxis ) == 0 ) + { + // This axis is now unused, and can be disabled + qtAxis->setVisible( false ); + m_axesEnabled[plotAxis] = false; + m_axesAutoScale[plotAxis] = false; + } + } +} \ No newline at end of file diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index 00025f5fca..70234d6e3b 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -92,6 +92,7 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget void setAxisFormat( RiuPlotAxis axis, const QString& format ); + void pruneAxes( const std::set& usedAxis ) override; RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) override; bool isMultiAxisSupported() const override; @@ -134,7 +135,7 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget int axisExtent( RiuPlotAxis axis ) const override; - void ensureAxis( RiuPlotAxis axis ) override; + void ensureAxisIsCreated( RiuPlotAxis axis ) override; QPoint dragStartPosition() const; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 457502194a..c82520bd19 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -1051,7 +1051,7 @@ QwtPlot* RiuQwtPlotWidget::qwtPlot() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::ensureAxis( RiuPlotAxis axis ) +void RiuQwtPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis ) { } @@ -1190,3 +1190,11 @@ bool RiuQwtPlotWidget::isMultiAxisSupported() const { return false; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::pruneAxes( const std::set& usedAxes ) +{ + // Currently not supported. +} diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index cf77fba0d8..23d648874c 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -91,6 +91,7 @@ class RiuQwtPlotWidget : public RiuPlotWidget void setAxisTitleText( RiuPlotAxis axis, const QString& title ) override; void setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) override; + void pruneAxes( const std::set& usedAxes ) override; RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) override; bool isMultiAxisSupported() const override; @@ -131,7 +132,7 @@ class RiuQwtPlotWidget : public RiuPlotWidget int axisExtent( RiuPlotAxis axis ) const override; - void ensureAxis( RiuPlotAxis axis ) override; + void ensureAxisIsCreated( RiuPlotAxis axis ) override; QPoint dragStartPosition() const; From f955d9e645f9067018507d18957b30aab1f89eb5 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 21 Feb 2022 13:01:49 +0100 Subject: [PATCH 142/406] #8575 Summary Plot: Restore zoom of time axis on project load. --- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 984d72d694..dbb641db7a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2057,7 +2057,7 @@ void RimSummaryPlot::initAfterRead() if ( RimProject::current()->isProjectFileVersionEqualOrOlderThan( "2021.10.2" ) ) { auto copyAxis = [this]( RiuPlotAxis axis, auto sourceObject ) { - auto axisProperties = dynamic_cast( axisPropertiesForPlotAxis( axis ) ); + auto axisProperties = axisPropertiesForPlotAxis( axis ); if ( axisProperties ) { QString data = sourceObject->writeObjectToXmlString(); @@ -2065,8 +2065,12 @@ void RimSummaryPlot::initAfterRead() // This operation will overwrite the plot axis side, default is left axisProperties->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() ); - // Reset the plot axis for the axis property - axisProperties->setNameAndAxis( axisProperties->name(), axis.axis(), 0 ); + auto plotAxisProperties = dynamic_cast( axisProperties ); + if ( plotAxisProperties ) + { + // Reset the plot axis for the axis property + plotAxisProperties->setNameAndAxis( axisProperties->name(), axis.axis(), 0 ); + } } }; From 65e80ca03f9e66dc7541a64c2f0f057434eb967d Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 23 Feb 2022 10:21:45 +0100 Subject: [PATCH 143/406] QtCharts: Improve name: RitQtChartsPlot::setAxis -> attachSeriesToAxis --- .../UserInterface/RiuQtChartsPlotWidget.cpp | 8 ++++---- ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 2e5da20acc..c0622b28d6 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -846,7 +846,7 @@ void RiuQtChartsPlotWidget::detachItems( RiuPlotWidget::PlotItemType plotItemTyp //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) { - setAxis( axis, series ); + attachSeriesToAxis( axis, series ); } //-------------------------------------------------------------------------------------------------- @@ -854,7 +854,7 @@ void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSerie //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) { - setAxis( axis, series ); + attachSeriesToAxis( axis, series ); } //-------------------------------------------------------------------------------------------------- @@ -871,7 +871,7 @@ void RiuQtChartsPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) +void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) { // Make sure the axis we are about to set exists. ensureAxisIsCreated( axis ); @@ -1127,4 +1127,4 @@ void RiuQtChartsPlotWidget::pruneAxes( const std::set& usedAxes ) m_axesAutoScale[plotAxis] = false; } } -} \ No newline at end of file +} diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index 70234d6e3b..ed124346fd 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -175,7 +175,7 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget std::pair findClosestCurve( const QPoint& pos, double& distanceToClick ) const override; protected: - void setAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ); + void attachSeriesToAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ); void resizeEvent( QResizeEvent* event ) override; void keyPressEvent( QKeyEvent* event ) override; From 7f41349b5c8a6f25ddd00b02e09242ff8b03d758 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 24 Feb 2022 08:20:43 +0100 Subject: [PATCH 144/406] #8582 Eclipse Case : Make it possible to access RFT data without grid data --- .../ProjectDataModel/RimEclipseResultCase.cpp | 49 ++++++++++++------- .../ProjectDataModel/RimEclipseResultCase.h | 2 + 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp index 704a1517c9..5d64d76437 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -72,6 +72,7 @@ RimEclipseResultCase::RimEclipseResultCase() : m_gridAndWellDataIsReadFromFile( false ) , m_activeCellInfoIsReadFromFile( false ) , m_useOpmRftReader( true ) + , m_rftDataIsReadFromFile( false ) { CAF_PDM_InitScriptableObject( "Eclipse Case", ":/Case48x48.png", "", "The Regular Eclipse Results Case" ); @@ -205,23 +206,7 @@ bool RimEclipseResultCase::importGridAndResultMetaData( bool showTimeStepFilter m_gridAndWellDataIsReadFromFile = true; m_activeCellInfoIsReadFromFile = true; - QFileInfo eclipseCaseFileInfo( gridFileName() ); - QString rftFileName = eclipseCaseFileInfo.path() + "/" + eclipseCaseFileInfo.completeBaseName() + ".RFT"; - QFileInfo rftFileInfo( rftFileName ); - - if ( rftFileInfo.exists() ) - { - RiaLogging::info( QString( "RFT file found" ) ); - - if ( m_useOpmRftReader ) - { - m_readerOpmRft = new RifReaderOpmRft( rftFileInfo.filePath() ); - } - else - { - m_readerEclipseRft = new RifReaderEclipseRft( rftFileInfo.filePath() ); - } - } + ensureRftDataIsImported(); if ( m_flowDiagSolutions.empty() ) { @@ -358,6 +343,34 @@ void RimEclipseResultCase::loadAndUpdateSourSimData() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultCase::ensureRftDataIsImported() +{ + if ( m_rftDataIsReadFromFile ) return; + + QFileInfo eclipseCaseFileInfo( gridFileName() ); + QString rftFileName = eclipseCaseFileInfo.path() + "/" + eclipseCaseFileInfo.completeBaseName() + ".RFT"; + QFileInfo rftFileInfo( rftFileName ); + + if ( rftFileInfo.exists() ) + { + RiaLogging::info( QString( "RFT file found" ) ); + + if ( m_useOpmRftReader ) + { + m_readerOpmRft = new RifReaderOpmRft( rftFileInfo.filePath() ); + } + else + { + m_readerEclipseRft = new RifReaderEclipseRft( rftFileInfo.filePath() ); + } + } + + m_rftDataIsReadFromFile = true; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -535,6 +548,8 @@ RigFlowDiagSolverInterface* RimEclipseResultCase::flowDiagSolverInterface() //-------------------------------------------------------------------------------------------------- RifReaderRftInterface* RimEclipseResultCase::rftReader() { + ensureRftDataIsImported(); + if ( m_useOpmRftReader ) return m_readerOpmRft.p(); return m_readerEclipseRft.p(); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.h b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.h index cdaad13290..0c1b77bc89 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.h @@ -81,6 +81,7 @@ class RimEclipseResultCase : public RimEclipseCase private: void loadAndUpdateSourSimData(); + void ensureRftDataIsImported(); private: cvf::ref createMockModel( QString modelName ); @@ -100,4 +101,5 @@ class RimEclipseResultCase : public RimEclipseCase bool m_gridAndWellDataIsReadFromFile; bool m_activeCellInfoIsReadFromFile; bool m_useOpmRftReader; + bool m_rftDataIsReadFromFile; }; From 10a01972f3ddb95830cc9715097bbc81757ff203 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 24 Feb 2022 10:03:30 +0100 Subject: [PATCH 145/406] #8583 RFT Plots : Add support for data source management to well log plots --- .../Commands/RicWellLogTools.cpp | 11 ++ .../RicChangeDataSourceFeature.cpp | 4 +- .../ProjectDataModel/RimDepthTrackPlot.cpp | 2 +- .../WellLog/CMakeLists_files.cmake | 2 + .../WellLog/Rim3dWellLogRftCurve.cpp | 30 +--- .../ProjectDataModel/WellLog/RimRftTools.cpp | 168 ++++++++++++++++++ .../ProjectDataModel/WellLog/RimRftTools.h | 46 +++++ .../RimWellLogCurveCommonDataSource.cpp | 123 ++++++++++--- .../WellLog/RimWellLogCurveCommonDataSource.h | 18 +- .../WellLog/RimWellLogRftCurve.cpp | 124 +++++-------- .../WellLog/RimWellLogRftCurve.h | 7 + 11 files changed, 396 insertions(+), 139 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.h diff --git a/ApplicationLibCode/Commands/RicWellLogTools.cpp b/ApplicationLibCode/Commands/RicWellLogTools.cpp index 91464ac211..997f6dece3 100644 --- a/ApplicationLibCode/Commands/RicWellLogTools.cpp +++ b/ApplicationLibCode/Commands/RicWellLogTools.cpp @@ -368,6 +368,17 @@ RimWellLogRftCurve* plotTrack->setFormationCase( resultCase ); plotTrack->setFormationSimWellName( simWell->name() ); } + else if ( resultCase ) + { + curve->setEclipseResultCase( resultCase ); + + auto wellNames = resultCase->rftReader()->wellNames(); + if ( !wellNames.empty() ) + { + auto wellName = *( wellNames.begin() ); + curve->setDefaultAddress( wellName ); + } + } cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() ); curve->setColor( curveColor ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicChangeDataSourceFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicChangeDataSourceFeature.cpp index 789a246023..439c57409d 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicChangeDataSourceFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicChangeDataSourceFeature.cpp @@ -66,14 +66,14 @@ void RicChangeDataSourceFeature::onActionTriggered( bool isChecked ) if ( selectedTracksAndCurves( &curves, &tracks ) ) { RimWellLogCurveCommonDataSource featureUi; - featureUi.updateDefaultOptions( curves, tracks ); + featureUi.analyseCurvesAndTracks( curves, tracks ); caf::PdmUiPropertyViewDialog propertyDialog( nullptr, &featureUi, "Change Data Source for Multiple Curves", "" ); propertyDialog.resize( QSize( 500, 200 ) ); if ( propertyDialog.exec() == QDialog::Accepted ) { - featureUi.updateCurvesAndTracks( curves, tracks ); + featureUi.applyDataSourceChanges( curves, tracks ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index 2aa90e6691..309c682fc2 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -670,7 +670,7 @@ RimWellLogCurveCommonDataSource* RimDepthTrackPlot::commonDataSource() const //-------------------------------------------------------------------------------------------------- void RimDepthTrackPlot::updateCommonDataSource() { - m_commonDataSource->updateDefaultOptions(); + m_commonDataSource->analyseCurvesAndTracks(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/WellLog/CMakeLists_files.cmake index 861abfda47..334773ffc9 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/WellLog/CMakeLists_files.cmake @@ -23,6 +23,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimWellLogFileCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimWellLogRftCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimWellLogWbsCurve.h + ${CMAKE_CURRENT_LIST_DIR}/RimRftTools.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -50,6 +51,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogCurveSet.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogStatistics.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleWellLogStatisticsCurve.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimRftTools.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp index d01839d60b..9fa5771eaf 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp @@ -25,6 +25,7 @@ #include "RigWellLogCurveData.h" #include "RimEclipseResultCase.h" +#include "RimRftTools.h" #include "RimTools.h" #include "RimWellLogCurve.h" #include "RimWellLogRftCurve.h" @@ -174,23 +175,7 @@ QList if ( m_eclipseResultCase ) { RifReaderRftInterface* reader = m_eclipseResultCase()->rftReader(); - if ( reader ) - { - for ( const RifEclipseRftAddress::RftWellLogChannelType& channelName : - reader->availableWellLogChannels( wellName() ) ) - { - options.push_back( - caf::PdmOptionItemInfo( caf::AppEnum::uiText( - channelName ), - channelName ) ); - } - } - if ( options.empty() ) - { - options.push_back( caf::PdmOptionItemInfo( caf::AppEnum::uiText( - RifEclipseRftAddress::RftWellLogChannelType::NONE ), - RifEclipseRftAddress::RftWellLogChannelType::NONE ) ); - } + options = RimRftTools::wellLogChannelsOptions( reader, wellName() ); } } else if ( fieldNeedingOptions == &m_timeStep ) @@ -200,17 +185,8 @@ QList RifReaderRftInterface* reader = m_eclipseResultCase()->rftReader(); if ( reader ) { - QString dateFormat = "dd MMM yyyy"; - std::set timeStamps = reader->availableTimeSteps( wellName(), m_wellLogChannelName() ); - for ( const QDateTime& dt : timeStamps ) - { - QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, dateFormat ); - - options.push_back( caf::PdmOptionItemInfo( dateString, dt ) ); - } + options = RimRftTools::timeStepOptions( reader, wellName(), m_wellLogChannelName() ); } - - options.push_back( caf::PdmOptionItemInfo( "None", QDateTime() ) ); } } return options; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp new file mode 100644 index 0000000000..a2da5205fb --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp @@ -0,0 +1,168 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimRftTools.h" + +#include "RiaQDateTimeTools.h" +#include "RiaResultNames.h" +#include "RiaRftDefines.h" + +#include "RifReaderRftInterface.h" + +#include "cafPdmUiItem.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimRftTools::wellLogChannelsOptions( RifReaderRftInterface* readerRft, const QString& wellName ) +{ + QList options; + + if ( readerRft ) + { + for ( const RifEclipseRftAddress::RftWellLogChannelType& channelName : + readerRft->availableWellLogChannels( wellName ) ) + { + options.push_back( + caf::PdmOptionItemInfo( caf::AppEnum::uiText( channelName ), + channelName ) ); + } + } + + if ( options.empty() ) + { + options.push_back( caf::PdmOptionItemInfo( caf::AppEnum::uiText( + RifEclipseRftAddress::RftWellLogChannelType::NONE ), + RifEclipseRftAddress::RftWellLogChannelType::NONE ) ); + } + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimRftTools::wellNameOptions( RifReaderRftInterface* readerRft ) +{ + QList options; + + options.push_back( caf::PdmOptionItemInfo( "None", "" ) ); + if ( readerRft ) + { + std::set wellNames = readerRft->wellNames(); + for ( const QString& name : wellNames ) + { + options.push_back( caf::PdmOptionItemInfo( name, name, false, caf::IconProvider( ":/Well.svg" ) ) ); + } + } + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimRftTools::timeStepOptions( RifReaderRftInterface* readerRft, + const QString& wellName, + RifEclipseRftAddress::RftWellLogChannelType channelType ) +{ + QList options; + + if ( readerRft ) + { + QString dateFormat = "dd MMM yyyy"; + std::set timeStamps = readerRft->availableTimeSteps( wellName, channelType ); + for ( const QDateTime& dt : timeStamps ) + { + QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, dateFormat ); + + options.push_back( caf::PdmOptionItemInfo( dateString, dt ) ); + } + } + + options.push_back( caf::PdmOptionItemInfo( "None", QDateTime() ) ); + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimRftTools::segmentTimeStepOptions( RifReaderRftInterface* readerRft, const QString& wellName ) +{ + return timeStepOptions( readerRft, wellName, RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimRftTools::segmentResultNameOptions( RifReaderRftInterface* readerRft, + const QString& wellName, + const QDateTime& timeStep ) +{ + QList options; + + options.push_front( + caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), RiaResultNames::undefinedResultName() ) ); + + if ( readerRft ) + { + options.push_back( + caf::PdmOptionItemInfo( RiaDefines::segmentNumberResultName(), RiaDefines::segmentNumberResultName() ) ); + + for ( const auto& resultAdr : readerRft->eclipseRftAddresses( wellName, timeStep ) ) + { + if ( resultAdr.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ) + { + options.push_back( caf::PdmOptionItemInfo( resultAdr.segmentResultName(), resultAdr.segmentResultName() ) ); + } + } + } + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimRftTools::segmentBranchIdOptions( RifReaderRftInterface* readerRft, + const QString& wellName, + const QDateTime& timeStep ) +{ + QList options; + + options.push_front( caf::PdmOptionItemInfo( RiaDefines::allBranches(), RiaDefines::allBranches() ) ); + + if ( readerRft ) + { + std::vector values; + + auto adr = + RifEclipseRftAddress::createSegmentResult( wellName, timeStep, RiaDefines::segmentBranchNumberResultName() ); + + readerRft->values( adr, &values ); + for ( const auto& v : values ) + { + int intValue = v; + auto txt = QString::number( intValue ); + options.push_back( caf::PdmOptionItemInfo( txt, txt ) ); + } + } + + return options; +} diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.h new file mode 100644 index 0000000000..fdc1e48f08 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RifEclipseRftAddress.h" + +#include + +namespace caf +{ +class PdmOptionItemInfo; +} +class RifReaderRftInterface; + +class RimRftTools +{ +public: + static QList wellLogChannelsOptions( RifReaderRftInterface* readerRft, const QString& wellName ); + static QList wellNameOptions( RifReaderRftInterface* readerRft ); + static QList timeStepOptions( RifReaderRftInterface* readerRft, + const QString& wellName, + RifEclipseRftAddress::RftWellLogChannelType channelType ); + + static QList segmentTimeStepOptions( RifReaderRftInterface* readerRft, const QString& wellName ); + + static QList + segmentResultNameOptions( RifReaderRftInterface* readerRft, const QString& wellName, const QDateTime& timeStep ); + static QList + segmentBranchIdOptions( RifReaderRftInterface* readerRft, const QString& wellName, const QDateTime& timeStep ); +}; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp index 710bb28041..2510035299 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp @@ -25,12 +25,14 @@ #include "RimGeoMechCase.h" #include "RimOilField.h" #include "RimProject.h" +#include "RimRftTools.h" #include "RimTools.h" #include "RimWellFlowRateCurve.h" #include "RimWellLogExtractionCurve.h" #include "RimWellLogFileCurve.h" #include "RimWellLogPlot.h" #include "RimWellLogPlotCollection.h" +#include "RimWellLogRftCurve.h" #include "RimWellLogTrack.h" #include "RimWellLogWbsCurve.h" #include "RimWellMeasurementCurve.h" @@ -96,6 +98,10 @@ RimWellLogCurveCommonDataSource::RimWellLogCurveCommonDataSource() CAF_PDM_InitField( &m_wbsSmoothingThreshold, "WBSSmoothingThreshold", -1.0, "Smoothing Threshold" ); + CAF_PDM_InitFieldNoDefault( &m_rftTimeStep, "RftTimeStep", "RFT Time Step" ); + CAF_PDM_InitFieldNoDefault( &m_rftWellName, "RftWellName", "RFT Well Name" ); + CAF_PDM_InitFieldNoDefault( &m_rftSegmentBranchId, "SegmentBranchId", "RFT Segment Branch" ); + m_case = nullptr; m_wellPath = nullptr; } @@ -276,13 +282,17 @@ void RimWellLogCurveCommonDataSource::resetDefaultOptions() m_uniqueBranchDetection.clear(); m_uniqueWbsSmoothing.clear(); m_uniqueWbsSmoothingThreshold.clear(); + + m_uniqueRftTimeSteps.clear(); + m_uniqueRftWellNames.clear(); + m_uniqueRftBranchIds.clear(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector& curves, - const std::vector& tracks ) +void RimWellLogCurveCommonDataSource::analyseCurvesAndTracks( const std::vector& curves, + const std::vector& tracks ) { // Reset all options in the UI resetDefaultOptions(); @@ -294,12 +304,14 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vector( curve ); - RimWellLogFileCurve* fileCurve = dynamic_cast( curve ); - RimWellFlowRateCurve* flowRateCurve = dynamic_cast( curve ); + auto* extractionCurve = dynamic_cast( curve ); + auto* fileCurve = dynamic_cast( curve ); + auto* flowRateCurve = dynamic_cast( curve ); + auto* rftCurve = dynamic_cast( curve ); + if ( extractionCurve ) { - RimWellLogWbsCurve* wbsCurve = dynamic_cast( extractionCurve ); + auto* wbsCurve = dynamic_cast( extractionCurve ); if ( wbsCurve ) { m_uniqueWbsSmoothing.insert( wbsCurve->smoothCurve() ); @@ -341,6 +353,16 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vectorrimCase() ); m_uniqueTimeSteps.insert( flowRateCurve->timeStep() ); } + else if ( rftCurve ) + { + m_uniqueWellNames.insert( rftCurve->wellName() ); + m_uniqueCases.insert( rftCurve->eclipseResultCase() ); + + auto adr = rftCurve->rftAddress(); + m_uniqueRftWellNames.insert( adr.wellName() ); + m_uniqueRftTimeSteps.insert( adr.timeStep() ); + m_uniqueRftBranchIds.insert( QString::number( adr.segmentBranchNumber() ) ); + } } for ( RimWellLogTrack* track : tracks ) { @@ -411,12 +433,22 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions( const std::vectorfirstAncestorOrThisOfType( parentPlot ); @@ -428,15 +460,15 @@ void RimWellLogCurveCommonDataSource::updateDefaultOptions() std::vector tracks; parentPlot->descendantsIncludingThisOfType( tracks ); - this->updateDefaultOptions( curves, tracks ); + this->analyseCurvesAndTracks( curves, tracks ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( const std::vector& curves, - const std::vector& tracks ) +void RimWellLogCurveCommonDataSource::applyDataSourceChanges( const std::vector& curves, + const std::vector& tracks ) { std::set plots; for ( RimWellLogCurve* curve : curves ) @@ -445,9 +477,10 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( const std::vector( curve ); - RimWellLogExtractionCurve* extractionCurve = dynamic_cast( curve ); - RimWellMeasurementCurve* measurementCurve = dynamic_cast( curve ); + auto* fileCurve = dynamic_cast( curve ); + auto* extractionCurve = dynamic_cast( curve ); + auto* measurementCurve = dynamic_cast( curve ); + auto* rftCurve = dynamic_cast( curve ); if ( fileCurve ) { if ( wellPathToApply() != nullptr ) @@ -512,7 +545,7 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( const std::vector( extractionCurve ); + auto* wbsCurve = dynamic_cast( extractionCurve ); if ( wbsCurve ) { if ( !wbsSmoothingToApply().isPartiallyTrue() ) @@ -542,6 +575,16 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( const std::vectorsetWellPath( wellPathToApply() ); } } + else if ( rftCurve ) + { + rftCurve->setTimeStep( m_rftTimeStep() ); + rftCurve->setWellName( m_rftWellName() ); + rftCurve->setSegmentBranchId( m_rftSegmentBranchId() ); + + RimWellLogPlot* parentPlot = nullptr; + rftCurve->firstAncestorOrThisOfTypeAsserted( parentPlot ); + plots.insert( parentPlot ); + } } for ( RimWellLogTrack* track : tracks ) @@ -607,7 +650,7 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks( const std::vectorfirstAncestorOrThisOfType( parentPlot ); @@ -619,7 +662,7 @@ void RimWellLogCurveCommonDataSource::updateCurvesAndTracks() std::vector tracks; parentPlot->descendantsIncludingThisOfType( tracks ); - this->updateCurvesAndTracks( curves, tracks ); + this->applyDataSourceChanges( curves, tracks ); } } @@ -690,7 +733,7 @@ void RimWellLogCurveCommonDataSource::applyNextTimeStep() //-------------------------------------------------------------------------------------------------- std::vector RimWellLogCurveCommonDataSource::fieldsToShowInToolbar() { - updateDefaultOptions(); + analyseCurvesAndTracks(); std::vector fieldsToDisplay; fieldsToDisplay.push_back( &m_case ); @@ -741,7 +784,7 @@ void RimWellLogCurveCommonDataSource::fieldChangedByUi( const caf::PdmFieldHandl } } - this->updateCurvesAndTracks(); + this->applyDataSourceChanges(); } //-------------------------------------------------------------------------------------------------- @@ -753,7 +796,7 @@ QList { QList options; - this->updateDefaultOptions(); + this->analyseCurvesAndTracks(); if ( fieldNeedingOptions == &m_case ) { @@ -840,7 +883,7 @@ QList } else if ( fieldNeedingOptions == &m_simWellName ) { - RimEclipseCase* eclipseCase = dynamic_cast( m_case() ); + auto* eclipseCase = dynamic_cast( m_case() ); if ( eclipseCase ) { std::set sortedWellNames = eclipseCase->sortedSimWellNames(); @@ -887,6 +930,30 @@ QList } } } + else if ( fieldNeedingOptions == &m_rftTimeStep ) + { + auto eclipseCase = dynamic_cast( m_case() ); + if ( eclipseCase && eclipseCase->rftReader() ) + { + options = RimRftTools::segmentTimeStepOptions( eclipseCase->rftReader(), *( m_uniqueRftWellNames.begin() ) ); + } + } + else if ( fieldNeedingOptions == &m_rftWellName ) + { + auto eclipseCase = dynamic_cast( m_case() ); + if ( eclipseCase && eclipseCase->rftReader() ) + { + options = RimRftTools::wellNameOptions( eclipseCase->rftReader() ); + } + } + else if ( fieldNeedingOptions == &m_rftSegmentBranchId ) + { + auto eclipseCase = dynamic_cast( m_case() ); + if ( eclipseCase && eclipseCase->rftReader() ) + { + options = RimRftTools::segmentBranchIdOptions( eclipseCase->rftReader(), m_rftWellName(), m_rftTimeStep() ); + } + } return options; } @@ -896,12 +963,12 @@ QList //-------------------------------------------------------------------------------------------------- void RimWellLogCurveCommonDataSource::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - updateDefaultOptions(); + analyseCurvesAndTracks(); caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Data Source" ); group->add( &m_case ); - RimEclipseCase* eclipseCase = dynamic_cast( m_case() ); + auto* eclipseCase = dynamic_cast( m_case() ); if ( eclipseCase ) { group->add( &m_trajectoryType ); @@ -939,6 +1006,10 @@ void RimWellLogCurveCommonDataSource::defineUiOrdering( QString uiConfigName, ca group->add( &m_wbsSmoothingThreshold ); } + group->add( &m_rftWellName ); + group->add( &m_rftTimeStep ); + group->add( &m_rftSegmentBranchId ); + uiOrdering.skipRemainingFields( true ); } @@ -949,10 +1020,11 @@ void RimWellLogCurveCommonDataSource::defineEditorAttribute( const caf::PdmField QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) { - caf::PdmUiComboBoxEditorAttribute* myAttr = dynamic_cast( attribute ); + auto* myAttr = dynamic_cast( attribute ); if ( myAttr ) { - if ( field == &m_case || field == &m_simWellName || field == &m_wellPath || field == &m_timeStep ) + if ( field == &m_case || field == &m_simWellName || field == &m_wellPath || field == &m_timeStep || + field == &m_rftTimeStep || field == &m_rftSegmentBranchId ) { myAttr->showPreviousAndNextButtons = true; myAttr->nextIcon = QIcon( ":/ComboBoxDown.svg" ); @@ -982,8 +1054,7 @@ void RimWellLogCurveCommonDataSource::defineEditorAttribute( const caf::PdmField myAttr->prevButtonText = "Previous " + modifierText + "PgUp)"; } } - caf::PdmUiLineEditorAttributeUiDisplayString* uiDisplayStringAttr = - dynamic_cast( attribute ); + auto* uiDisplayStringAttr = dynamic_cast( attribute ); if ( uiDisplayStringAttr && wbsSmoothingThreshold() == -1.0 ) { QString displayString = "Mixed"; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h index 5af6ba4f29..67d9b74ea5 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h @@ -26,6 +26,8 @@ #include "cafPdmUiOrdering.h" #include "cafTristate.h" +#include + class RimCase; class RimWellLogCurve; class RimWellLogPlot; @@ -75,10 +77,10 @@ class RimWellLogCurveCommonDataSource : public caf::PdmObject void setTimeStepToApply( int val ); void resetDefaultOptions(); - void updateDefaultOptions( const std::vector& curves, const std::vector& tracks ); - void updateDefaultOptions(); - void updateCurvesAndTracks( const std::vector& curves, const std::vector& tracks ); - void updateCurvesAndTracks(); + void analyseCurvesAndTracks( const std::vector& curves, const std::vector& tracks ); + void analyseCurvesAndTracks(); + void applyDataSourceChanges( const std::vector& curves, const std::vector& tracks ); + void applyDataSourceChanges(); void applyPrevCase(); void applyNextCase(); @@ -114,6 +116,10 @@ class RimWellLogCurveCommonDataSource : public caf::PdmObject caf::PdmField m_wbsSmoothing; caf::PdmField m_wbsSmoothingThreshold; + caf::PdmField m_rftTimeStep; + caf::PdmField m_rftWellName; + caf::PdmField m_rftSegmentBranchId; + std::set m_uniqueCases; std::set m_uniqueTrajectoryTypes; std::set m_uniqueWellPaths; @@ -123,4 +129,8 @@ class RimWellLogCurveCommonDataSource : public caf::PdmObject std::set m_uniqueBranchIndices; std::set m_uniqueWbsSmoothing; std::set m_uniqueWbsSmoothingThreshold; + + std::set m_uniqueRftTimeSteps; + std::set m_uniqueRftWellNames; + std::set m_uniqueRftBranchIds; }; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index 78460e82dd..7490134a10 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -41,6 +41,7 @@ #include "RimMainPlotCollection.h" #include "RimObservedFmuRftData.h" #include "RimProject.h" +#include "RimRftTools.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimTools.h" @@ -182,6 +183,14 @@ RimWellLogRftCurve::~RimWellLogRftCurve() { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogRftCurve::setWellName( const QString& wellName ) +{ + m_wellName = wellName; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -206,6 +215,30 @@ QString RimWellLogRftCurve::wellLogChannelUnits() const return RiaWellLogUnitTools::noUnitString(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogRftCurve::setTimeStep( const QDateTime& dateTime ) +{ + m_timeStep = dateTime; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QDateTime RimWellLogRftCurve::timeStep() const +{ + return m_timeStep(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogRftCurve::setSegmentBranchId( const QString& branchId ) +{ + m_segmentBranchId = branchId; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -466,7 +499,12 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) RiaDefines::EclipseUnitSystem unitSystem = RiaDefines::EclipseUnitSystem::UNITS_METRIC; if ( m_eclipseResultCase ) { - unitSystem = m_eclipseResultCase->eclipseCaseData()->unitsType(); + // TODO: If no grid data, but only RFT data is loaded, we do not have any way to + // detect unit + if ( m_eclipseResultCase->eclipseCaseData() ) + { + unitSystem = m_eclipseResultCase->eclipseCaseData()->unitsType(); + } } else if ( m_summaryCase ) { @@ -668,6 +706,7 @@ QList RimWellLogRftCurve::calculateValueOptions( const c if ( !options.empty() ) return options; + RifReaderRftInterface* reader = rftReader(); if ( fieldNeedingOptions == &m_eclipseResultCase ) { RimTools::caseOptionItems( &options ); @@ -676,53 +715,15 @@ QList RimWellLogRftCurve::calculateValueOptions( const c } else if ( fieldNeedingOptions == &m_wellName ) { - options.push_back( caf::PdmOptionItemInfo( "None", "" ) ); - RifReaderRftInterface* reader = rftReader(); - if ( reader ) - { - std::set wellNames = reader->wellNames(); - for ( const QString& name : wellNames ) - { - options.push_back( caf::PdmOptionItemInfo( name, name, false, caf::IconProvider( ":/Well.svg" ) ) ); - } - } + options = RimRftTools::wellNameOptions( reader ); } else if ( fieldNeedingOptions == &m_wellLogChannelName ) { - RifReaderRftInterface* reader = rftReader(); - if ( reader ) - { - for ( const RifEclipseRftAddress::RftWellLogChannelType& channelName : - reader->availableWellLogChannels( m_wellName ) ) - { - options.push_back( - caf::PdmOptionItemInfo( caf::AppEnum::uiText( channelName ), - channelName ) ); - } - } - if ( options.empty() ) - { - options.push_back( caf::PdmOptionItemInfo( caf::AppEnum::uiText( - RifEclipseRftAddress::RftWellLogChannelType::NONE ), - RifEclipseRftAddress::RftWellLogChannelType::NONE ) ); - } + options = RimRftTools::wellLogChannelsOptions( reader, m_wellName() ); } else if ( fieldNeedingOptions == &m_timeStep ) { - RifReaderRftInterface* reader = rftReader(); - if ( reader ) - { - QString dateFormat = "dd MMM yyyy"; - std::set timeStamps = reader->availableTimeSteps( m_wellName, m_wellLogChannelName() ); - for ( const QDateTime& dt : timeStamps ) - { - QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, dateFormat ); - - options.push_back( caf::PdmOptionItemInfo( dateString, dt ) ); - } - } - - options.push_back( caf::PdmOptionItemInfo( "None", QDateTime() ) ); + options = RimRftTools::timeStepOptions( reader, m_wellName, m_wellLogChannelName() ); } else if ( fieldNeedingOptions == &m_branchIndex ) { @@ -733,46 +734,11 @@ QList RimWellLogRftCurve::calculateValueOptions( const c } else if ( fieldNeedingOptions == &m_segmentResultName ) { - options.push_front( - caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), RiaResultNames::undefinedResultName() ) ); - - RifReaderRftInterface* reader = rftReader(); - if ( reader ) - { - options.push_back( caf::PdmOptionItemInfo( RiaDefines::segmentNumberResultName(), - RiaDefines::segmentNumberResultName() ) ); - - for ( const auto& resultAdr : reader->eclipseRftAddresses( m_wellName(), m_timeStep() ) ) - { - if ( resultAdr.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ) - { - options.push_back( - caf::PdmOptionItemInfo( resultAdr.segmentResultName(), resultAdr.segmentResultName() ) ); - } - } - } + options = RimRftTools::segmentResultNameOptions( reader, m_wellName(), m_timeStep() ); } else if ( fieldNeedingOptions == &m_segmentBranchId ) { - options.push_front( caf::PdmOptionItemInfo( RiaDefines::allBranches(), RiaDefines::allBranches() ) ); - - RifReaderRftInterface* reader = rftReader(); - if ( reader ) - { - std::vector values; - - auto adr = RifEclipseRftAddress::createSegmentResult( m_wellName(), - m_timeStep, - RiaDefines::segmentBranchNumberResultName() ); - - reader->values( adr, &values ); - for ( const auto& v : values ) - { - int intValue = v; - auto txt = QString::number( intValue ); - options.push_back( caf::PdmOptionItemInfo( txt, txt ) ); - } - } + options = RimRftTools::segmentBranchIdOptions( reader, m_wellName(), m_timeStep() ); } return options; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h index 0bcfbb8f25..9cd38fb196 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h @@ -67,10 +67,17 @@ class RimWellLogRftCurve : public RimWellLogCurve RimWellLogRftCurve(); ~RimWellLogRftCurve() override; + void setWellName( const QString& wellName ); QString wellName() const override; + QString wellLogChannelUiName() const override; QString wellLogChannelUnits() const override; + void setTimeStep( const QDateTime& dateTime ); + QDateTime timeStep() const; + + void setSegmentBranchId( const QString& branchId ); + void setEclipseResultCase( RimEclipseResultCase* eclipseResultCase ); RimEclipseResultCase* eclipseResultCase() const; From d5b108d2efcf44ab5f4f844e81366c4149407ac4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 25 Feb 2022 10:49:39 +0100 Subject: [PATCH 146/406] QtChart : Avoid zoom on right mouse button release --- ApplicationLibCode/UserInterface/RiuQtChartView.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartView.cpp b/ApplicationLibCode/UserInterface/RiuQtChartView.cpp index edfd66821d..fe81705a6b 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartView.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartView.cpp @@ -76,6 +76,12 @@ void RiuQtChartView::mouseReleaseEvent( QMouseEvent* event ) } else { + if ( event->button() == Qt::RightButton ) + { + // Skip QtCharts::QChartView::mouseReleaseEvent() to avoid zoom on right mouse button + return QGraphicsView::mouseReleaseEvent( event ); + } + QtCharts::QChartView::mouseReleaseEvent( event ); } } From 47a44a79dfe8e009cfd90cb60c94044192caccac Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 24 Feb 2022 15:13:28 +0100 Subject: [PATCH 147/406] Axis assignment : Use axis with same unit by default --- .../Summary/RimSummaryPlot.cpp | 59 +++++++++++++++++-- 1 file changed, 53 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index dbb641db7a..968d65f770 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2413,18 +2413,65 @@ std::vector RimSummaryPlot::plotAxes() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* curve ) +void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* destinationCurve ) { enum class AxisAssignmentStrategy { ALL_TO_LEFT, ALL_TO_RIGHT, - ALTERNATING + ALTERNATING, + USE_MATCHING_UNIT }; RiaDefines::PlotAxis plotAxis = RiaDefines::PlotAxis::PLOT_AXIS_LEFT; - auto strategy = AxisAssignmentStrategy::ALTERNATING; + auto strategy = AxisAssignmentStrategy::USE_MATCHING_UNIT; + if ( strategy == AxisAssignmentStrategy::USE_MATCHING_UNIT ) + { + auto destinationUnit = destinationCurve->unitNameY(); + + bool isLeftUsed = false; + bool isRightUsed = false; + + for ( auto c : summaryCurves() ) + { + if ( c == destinationCurve ) continue; + + if ( c->axisY() == RiuPlotAxis::defaultLeft() ) isLeftUsed = true; + if ( c->axisY() == RiuPlotAxis::defaultRight() ) isRightUsed = true; + + auto currentUnit = c->unitNameY(); + + if ( currentUnit == destinationUnit ) + { + for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisProperties ) + { + if ( axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || + axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) + { + destinationCurve->setLeftOrRightAxisY( c->axisY() ); + + return; + } + } + } + } + + if ( !isLeftUsed ) + { + destinationCurve->setLeftOrRightAxisY( RiuPlotAxis::defaultLeft() ); + return; + } + + if ( !isRightUsed ) + { + destinationCurve->setLeftOrRightAxisY( RiuPlotAxis::defaultRight() ); + return; + } + + strategy = AxisAssignmentStrategy::ALTERNATING; + } + if ( strategy == AxisAssignmentStrategy::ALTERNATING ) { size_t axisCountLeft = 0; @@ -2452,14 +2499,14 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* curve ) if ( plotWidget() && plotWidget()->isMultiAxisSupported() ) { QString axisObjectName = "New Axis"; - if ( !curve->summaryAddressY().uiText().empty() ) - axisObjectName = QString::fromStdString( curve->summaryAddressY().uiText() ); + if ( !destinationCurve->summaryAddressY().uiText().empty() ) + axisObjectName = QString::fromStdString( destinationCurve->summaryAddressY().uiText() ); newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); addNewAxisProperties( newPlotAxis, axisObjectName ); } - curve->setLeftOrRightAxisY( newPlotAxis ); + destinationCurve->setLeftOrRightAxisY( newPlotAxis ); } //-------------------------------------------------------------------------------------------------- From 4693dc44ef48f34f69b26c66ec35434288cc783f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 25 Feb 2022 14:47:15 +0100 Subject: [PATCH 148/406] Memory Management : Fixes related to plot objects and curves --- .../ProjectDataModel/RimPlotCurve.cpp | 17 ++++- .../ProjectDataModel/RimPlotCurve.h | 1 + .../Summary/RimSummaryPlot.cpp | 64 ++++++++++++++----- .../ProjectDataModel/Summary/RimSummaryPlot.h | 10 +-- .../UserInterface/RiuQtChartsPlotCurve.cpp | 33 ++++++++-- .../UserInterface/RiuQtChartsPlotCurve.h | 2 +- .../UserInterface/RiuQtChartsPlotWidget.cpp | 14 ++-- .../UserInterface/RiuQwtPlotCurve.cpp | 10 ++- .../UserInterface/RiuSummaryPlot.cpp | 13 ++-- .../UserInterface/RiuSummaryPlot.h | 10 +-- .../UserInterface/RiuSummaryQtChartsPlot.cpp | 6 +- .../UserInterface/RiuSummaryQtChartsPlot.h | 2 +- .../UserInterface/RiuSummaryQwtPlot.cpp | 4 +- .../UserInterface/RiuSummaryQwtPlot.h | 2 +- 14 files changed, 128 insertions(+), 60 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index 1beb44c0a3..4691ffa21a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -131,7 +131,6 @@ RimPlotCurve::~RimPlotCurve() { if ( m_plotCurve ) { - detach(); delete m_plotCurve; m_plotCurve = nullptr; } @@ -1017,12 +1016,15 @@ void RimPlotCurve::detach( bool deletePlotCurve ) { if ( m_plotCurve ) { - m_plotCurve->detach(); if ( deletePlotCurve ) { delete m_plotCurve; m_plotCurve = nullptr; } + else + { + m_plotCurve->detach(); + } } replotParentPlot(); @@ -1033,7 +1035,7 @@ void RimPlotCurve::detach( bool deletePlotCurve ) //-------------------------------------------------------------------------------------------------- void RimPlotCurve::reattach() { - if ( m_parentPlot ) attach( m_parentPlot ); + if ( m_parentPlot && canCurveBeAttached() ) attach( m_parentPlot ); } //-------------------------------------------------------------------------------------------------- @@ -1044,6 +1046,15 @@ bool RimPlotCurve::isSameCurve( const RiuPlotCurve* plotCurve ) const return m_plotCurve == plotCurve; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotCurve::deletePlotCurve() +{ + delete m_plotCurve; + m_plotCurve = nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h index bb367a6ebe..1cb8713bd0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h @@ -126,6 +126,7 @@ class RimPlotCurve : public caf::PdmObject void detach( bool deletePlotCurve = false ); void reattach(); bool isSameCurve( const RiuPlotCurve* plotCurve ) const; + void deletePlotCurve(); protected: virtual QString createCurveAutoName() = 0; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 968d65f770..a4cdc39986 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -179,7 +179,7 @@ RimSummaryPlot::~RimSummaryPlot() { removeMdiWindowFromMdiArea(); - cleanupBeforeClose(); + deletePlotCurvesAndPlotWidget(); delete m_summaryCurveCollection; delete m_ensembleCurveSetCollection; @@ -1378,7 +1378,7 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, // Destroy viewer removeMdiWindowFromMdiArea(); - cleanupBeforeClose(); + deletePlotCurvesAndPlotWidget(); } #endif @@ -1401,14 +1401,9 @@ void RimSummaryPlot::childFieldChangedByUi( const caf::PdmFieldHandle* changedCh //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updateStackedCurveData() { - for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisProperties ) - { - if ( axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || - axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) - updateStackedCurveDataForAxis( axisProperties->plotAxisType() ); - } + auto anyStackedCurvesPresent = updateStackedCurveDataForRelevantAxes(); - if ( plotWidget() ) + if ( plotWidget() && anyStackedCurvesPresent ) { reattachAllCurves(); plotWidget()->scheduleReplot(); @@ -1418,13 +1413,30 @@ void RimSummaryPlot::updateStackedCurveData() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ) +bool RimSummaryPlot::updateStackedCurveDataForRelevantAxes() { - std::map curvePhaseCount; + bool anyStackedCurvesPresent = false; + for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisProperties ) + { + if ( axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || + axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) + { + anyStackedCurvesPresent |= updateStackedCurveDataForAxis( axisProperties->plotAxisType() ); + } + } + + return anyStackedCurvesPresent; +} +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryPlot::updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ) +{ auto stackedCurves = visibleStackedSummaryCurvesForAxis( plotAxis ); + if ( stackedCurves.empty() ) return false; - // Reset all curves + std::map curvePhaseCount; for ( RimSummaryCurve* curve : stackedCurves ) { // Apply a area filled style if it isn't already set @@ -1473,6 +1485,8 @@ void RimSummaryPlot::updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ) zPos -= 1.0; } } + + return true; } //-------------------------------------------------------------------------------------------------- @@ -1595,7 +1609,7 @@ void RimSummaryPlot::updateZoomFromParentPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::cleanupBeforeClose() +void RimSummaryPlot::deletePlotCurvesAndPlotWidget() { if ( isDeletable() ) { @@ -1606,6 +1620,8 @@ void RimSummaryPlot::cleanupBeforeClose() plotWidget()->setParent( nullptr ); } + deleteAllPlotCurves(); + if ( m_summaryPlot ) { m_summaryPlot.reset(); @@ -1905,7 +1921,11 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector 0 ) applyDefaultCurveAppearances(); + if ( newCurves > 0 ) + { + applyDefaultCurveAppearances(); + loadDataAndUpdate(); + } updateConnectedEditors(); } @@ -1919,7 +1939,6 @@ void RimSummaryPlot::addNewCurveY( const RifEclipseSummaryAddress& address, RimS newCurve->setSummaryCaseY( summaryCase ); newCurve->setSummaryAddressYAndApplyInterpolation( address ); addCurveNoUpdate( newCurve ); - newCurve->loadDataAndUpdate( true ); } //-------------------------------------------------------------------------------------------------- @@ -1996,7 +2015,7 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent if ( useQtCharts ) { - m_summaryPlot = std::make_unique( this, mainWindowParent ); + m_summaryPlot = std::make_unique( this ); } else { @@ -2044,7 +2063,7 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::deleteViewWidget() { - cleanupBeforeClose(); + deletePlotCurvesAndPlotWidget(); } //-------------------------------------------------------------------------------------------------- @@ -2190,6 +2209,17 @@ void RimSummaryPlot::detachAllPlotItems() m_plotInfoLabel->detach(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::deleteAllPlotCurves() +{ + for ( auto* c : summaryCurves() ) + { + c->deletePlotCurve(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 3a27d3f50e..f02d514d52 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -206,6 +206,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void doUpdateLayout() override; void detachAllPlotItems(); + void deleteAllPlotCurves(); void handleKeyPressEvent( QKeyEvent* keyEvent ) override; @@ -223,9 +224,6 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector& referringObjects ) override; - void updateStackedCurveData(); - void updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ); - void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void onLoadDataAndUpdate() override; @@ -249,7 +247,7 @@ private slots: void updateTimeAxis( RimSummaryTimeAxisProperties* timeAxisProperties ); - void cleanupBeforeClose(); + void deletePlotCurvesAndPlotWidget(); void connectCurveSignals( RimSummaryCurve* curve ); void disconnectCurveSignals( RimSummaryCurve* curve ); @@ -272,6 +270,10 @@ private slots: void addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase ); + void updateStackedCurveData(); + bool updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ); + bool updateStackedCurveDataForRelevantAxes(); + private: #ifdef USE_QTCHARTS caf::PdmField m_useQtChartsPlot; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index 7fa055b28b..551b3c72b4 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -54,7 +54,26 @@ RiuQtChartsPlotCurve::RiuQtChartsPlotCurve( RimPlotCurve* ownerRimCurve, const Q //-------------------------------------------------------------------------------------------------- RiuQtChartsPlotCurve::~RiuQtChartsPlotCurve() { - detach(); + if ( m_plotWidget && m_plotWidget->qtChart() ) + { + auto* line = lineSeries(); + if ( line ) + { + m_plotWidget->qtChart()->removeSeries( line ); + + // removeSeries() releases chart ownership of the data, delete data to avoid memory leak + delete line; + } + + auto* scatter = scatterSeries(); + if ( scatter ) + { + m_plotWidget->qtChart()->removeSeries( scatter ); + + // removeSeries() releases chart ownership of the data, delete data to avoid memory leak + delete scatter; + } + } // Delete if it is still owned by by plot curve delete m_lineSeries; @@ -164,8 +183,6 @@ void RiuQtChartsPlotCurve::detach() } if ( m_plotWidget ) setVisibleInLegend( false ); - - m_plotWidget = nullptr; } //-------------------------------------------------------------------------------------------------- @@ -188,13 +205,15 @@ void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, QtCharts::QLineSeries* line = lineSeries(); QtCharts::QScatterSeries* scatter = scatterSeries(); - line->clear(); - scatter->clear(); + QVector values( static_cast( xValues.size() ) ); + for ( int i = 0; i < static_cast( xValues.size() ); i++ ) { - line->append( xValues[i], yValues[i] ); - scatter->append( xValues[i], yValues[i] ); + values[i] = QPointF( xValues[i], yValues[i] ); } + + line->replace( values ); + scatter->replace( values ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h index 4c2c476c20..1752f1cbd3 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h @@ -90,7 +90,7 @@ class RiuQtChartsPlotCurve : public RiuPlotCurve QtCharts::QLineSeries* m_lineSeries; QtCharts::QScatterSeries* m_scatterSeries; std::shared_ptr m_symbol; - RiuQtChartsPlotWidget* m_plotWidget; + QPointer m_plotWidget; RiuPlotAxis m_axisX; RiuPlotAxis m_axisY; }; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index c0622b28d6..bf95673a3e 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -717,8 +717,8 @@ RiuQtChartsPlotWidget::AxisScaleType RiuQtChartsPlotWidget::axisScaleType( RiuPl //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotWidget::setAxisScaleType( RiuPlotAxis axis, RiuQtChartsPlotWidget::AxisScaleType axisScaleType ) { - QAbstractAxis* removeaxis = plotAxis( axis ); - QAbstractAxis* insertaxis = nullptr; + QAbstractAxis* axisToBeDeleted = plotAxis( axis ); + QAbstractAxis* insertaxis = nullptr; if ( axisScaleType == AxisScaleType::LOGARITHMIC ) { @@ -734,15 +734,19 @@ void RiuQtChartsPlotWidget::setAxisScaleType( RiuPlotAxis axis, RiuQtChartsPlotW } QChart* chart = qtChart(); - if ( chart->axes().contains( removeaxis ) ) chart->removeAxis( removeaxis ); + if ( chart->axes().contains( axisToBeDeleted ) ) chart->removeAxis( axisToBeDeleted ); chart->addAxis( insertaxis, mapPlotAxisToQtAlignment( axis.axis() ) ); m_axes[axis] = insertaxis; for ( auto serie : chart->series() ) { - if ( serie->attachedAxes().contains( removeaxis ) ) serie->detachAxis( removeaxis ); + if ( serie->attachedAxes().contains( axisToBeDeleted ) ) serie->detachAxis( axisToBeDeleted ); serie->attachAxis( insertaxis ); } + + // We have the ownership of the axis object, delete to avoid memory leak + delete axisToBeDeleted; + axisToBeDeleted = nullptr; } //-------------------------------------------------------------------------------------------------- @@ -789,8 +793,6 @@ void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, qtChart()->addSeries( series ); setXAxis( xAxis, series ); setXAxis( yAxis, series ); - rescaleAxis( xAxis ); - rescaleAxis( yAxis ); } }; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index 5a352fdb0e..110fd7e76a 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -63,12 +63,10 @@ RiuQwtPlotCurve::RiuQwtPlotCurve( RimPlotCurve* ownerRimCurve, const QString& ti //-------------------------------------------------------------------------------------------------- RiuQwtPlotCurve::~RiuQwtPlotCurve() { - if ( m_qwtCurveErrorBars ) - { - m_qwtCurveErrorBars->detach(); - delete m_qwtCurveErrorBars; - m_qwtCurveErrorBars = nullptr; - } + detach(); + + delete m_qwtCurveErrorBars; + m_qwtCurveErrorBars = nullptr; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp index 5ec31a3c1a..8c644d53cd 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp @@ -37,8 +37,7 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuSummaryPlot::RiuSummaryPlot( RimSummaryPlot* plot, QWidget* parent ) - : QWidget( parent ) +RiuSummaryPlot::RiuSummaryPlot( RimSummaryPlot* plot ) { } @@ -54,6 +53,8 @@ RiuSummaryPlot::~RiuSummaryPlot() //-------------------------------------------------------------------------------------------------- void RiuSummaryPlot::showContextMenu( QPoint pos ) { + if ( !plotWidget() ) return; + QMenu menu; caf::CmdFeatureMenuBuilder menuBuilder; @@ -66,7 +67,7 @@ void RiuSummaryPlot::showContextMenu( QPoint pos ) if ( plotCurve && closestCurvePoint >= 0 ) { - RimSummaryCurve* summaryCurve = dynamic_cast( plotCurve->ownerRimCurve() ); + auto* summaryCurve = dynamic_cast( plotCurve->ownerRimCurve() ); if ( summaryCurve && closestCurvePoint < (int)summaryCurve->timeStepsY().size() ) { std::time_t timeStep = summaryCurve->timeStepsY()[closestCurvePoint]; @@ -105,7 +106,7 @@ void RiuSummaryPlot::showContextMenu( QPoint pos ) if ( !curveClicked ) { - RimSummaryPlot* summaryPlot = static_cast( plotWidget()->plotDefinition() ); + auto* summaryPlot = static_cast( plotWidget()->plotDefinition() ); std::vector allCurveSetsInPlot; summaryPlot->descendantsOfType( allCurveSetsInPlot ); for ( auto curveSet : allCurveSetsInPlot ) @@ -185,9 +186,9 @@ void RiuSummaryPlot::showContextMenu( QPoint pos ) menuBuilder.appendToMenu( &menu ); - if ( menu.actions().size() > 0 ) + if ( !menu.actions().empty() ) { - menu.exec( mapToGlobal( pos ) ); + menu.exec( plotWidget()->mapToGlobal( pos ) ); // Parts of progress dialog GUI can be present after menu has closed related to // RicImportGridModelFromSummaryCurveFeature. Make sure the plot is updated, and call processEvents() to make diff --git a/ApplicationLibCode/UserInterface/RiuSummaryPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryPlot.h index 50bd88b3ba..4161b12fac 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryPlot.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryPlot.h @@ -19,9 +19,9 @@ #pragma once #include "RiaQDateTimeTools.h" -#include "RiuInterfaceToViewWindow.h" -#include +#include +#include class RimSummaryPlot; class RimPlotAxisPropertiesInterface; @@ -32,12 +32,12 @@ class RiuPlotWidget; // // //================================================================================================== -class RiuSummaryPlot : public QWidget +class RiuSummaryPlot : public QObject { Q_OBJECT public: - RiuSummaryPlot( RimSummaryPlot* plot, QWidget* parent ); - ~RiuSummaryPlot() override; + RiuSummaryPlot( RimSummaryPlot* plot ); + ~RiuSummaryPlot(); virtual void useDateBasedTimeAxis( const QString& dateFormat, diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp index 1ba4ccb8e4..688c4ce013 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp @@ -29,8 +29,8 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuSummaryQtChartsPlot::RiuSummaryQtChartsPlot( RimSummaryPlot* plot, QWidget* parent /*= nullptr*/ ) - : RiuSummaryPlot( plot, parent ) +RiuSummaryQtChartsPlot::RiuSummaryQtChartsPlot( RimSummaryPlot* plot ) + : RiuSummaryPlot( plot ) { m_plotWidget = new RiuQtChartsPlotWidget( plot ); m_plotWidget->setContextMenuPolicy( Qt::CustomContextMenu ); @@ -49,6 +49,8 @@ RiuSummaryQtChartsPlot::RiuSummaryQtChartsPlot( RimSummaryPlot* plot, QWidget* p //-------------------------------------------------------------------------------------------------- RiuSummaryQtChartsPlot::~RiuSummaryQtChartsPlot() { + delete m_plotWidget; + m_plotWidget = nullptr; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h index 4d8b4c84bb..80dd2ea8fe 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h @@ -38,7 +38,7 @@ class RiuSummaryQtChartsPlot : public RiuSummaryPlot Q_OBJECT; public: - RiuSummaryQtChartsPlot( RimSummaryPlot* plot, QWidget* parent = nullptr ); + RiuSummaryQtChartsPlot( RimSummaryPlot* plot ); ~RiuSummaryQtChartsPlot() override; void useDateBasedTimeAxis( const QString& dateFormat, diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp index 2c82457439..d7d8c9e94b 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -94,7 +94,7 @@ static EnsembleCurveInfoTextProvider ensembleCurveInfoTextProvider; /// //-------------------------------------------------------------------------------------------------- RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*= nullptr*/ ) - : RiuSummaryPlot( plot, parent ) + : RiuSummaryPlot( plot ) { m_plotWidget = new RiuQwtPlotWidget( plot, parent ); m_plotWidget->setContextMenuPolicy( Qt::CustomContextMenu ); @@ -138,6 +138,8 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*= //-------------------------------------------------------------------------------------------------- RiuSummaryQwtPlot::~RiuSummaryQwtPlot() { + delete m_plotWidget; + m_plotWidget = nullptr; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h index 1e1a909005..82aca42a1a 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h @@ -45,7 +45,7 @@ class RiuSummaryQwtPlot : public RiuSummaryPlot public: RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent = nullptr ); - ~RiuSummaryQwtPlot() override; + ~RiuSummaryQwtPlot(); void useDateBasedTimeAxis( const QString& dateFormat, const QString& timeFormat, From 5706c433d0e82745aa1e3f9b0d2e4a82abca92f4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 25 Feb 2022 13:46:02 +0100 Subject: [PATCH 149/406] #8580 cafSignal : Assert if signal is connected twice to the same object --- .../cafPdmCore_UnitTests/cafSignalTest.cpp | 18 ++++++++++++++++++ .../cafProjectDataModel/cafPdmCore/cafSignal.h | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafSignalTest.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafSignalTest.cpp index 84577be9cc..215db8a6de 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafSignalTest.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafSignalTest.cpp @@ -72,6 +72,12 @@ class TestObserver : public caf::SignalObserver emitter->structSignal.connect( this, &TestObserver::setSimpleStruct ); } + void connectSignalsTwice( TestEmitter* emitter ) + { + emitter->basicSignal.connect( this, &TestObserver::setBasicSignalReceived ); + emitter->basicSignal.connect( this, &TestObserver::setBasicSignalReceived ); + } + void setBasicSignalReceived( const caf::SignalEmitter* emitter ) { m_receivedBasicSignal = true; } void setBoolValue( const caf::SignalEmitter*, bool test ) { m_boolValue = test; } void setStringValue( const caf::SignalEmitter*, std::string test ) { m_stringValue = test; } @@ -149,3 +155,15 @@ TEST( SignalTest, ObserverDeletion ) ASSERT_EQ( (size_t)0, emitter.basicSignal.observerCount() ); emitter.triggerBasicSignal(); } + +TEST( SignalTest, ConnectSignalTwiceAssert ) +{ + ASSERT_DEATH( + { + TestEmitter emitter; + TestObserver observer; + + observer.connectSignalsTwice( &emitter ); + }, + "" ); +} diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafSignal.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafSignal.h index 2fd7e3b484..8775fa9f32 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafSignal.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafSignal.h @@ -135,6 +135,10 @@ class Signal : public AbstractSignal { static_assert( std::is_convertible::value, "Only classes that inherit SignalObserver can connect as an observer of a Signal." ); + + // Connecting a signal twice is not supported + CAF_ASSERT( m_observerCallbacks.find( observer ) == m_observerCallbacks.end() ); + m_observerCallbacks[observer] = std::make_pair( callback, true ); observer->addObservedSignal( this ); } From 5c0082f20b09e1d856285ffbc46f3a57b618b06b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 25 Feb 2022 15:22:36 +0100 Subject: [PATCH 150/406] Avoid setting signal multiple times --- .../ProjectDataModel/RimEclipseCellColors.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp index 5c8fd69434..fed5b0b2be 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -153,17 +153,14 @@ void RimEclipseCellColors::changeLegendConfig( QString resultVarNameOfNewLegend this->m_useDiscreteLogLevels, this->hasCategoryResult() ); + newLegend->changed.connect( this, &RimEclipseCellColors::onLegendConfigChanged ); + m_legendConfigData.push_back( newLegend ); this->m_legendConfigPtrField = newLegend; } } } - - for ( auto legendConfig : m_legendConfigData ) - { - legendConfig->changed.connect( this, &RimEclipseCellColors::onLegendConfigChanged ); - } } //-------------------------------------------------------------------------------------------------- @@ -209,7 +206,9 @@ void RimEclipseCellColors::initAfterRead() // set to nullptr before pushing into container obsoleteField_legendConfig = nullptr; + obsoleteLegend->changed.connect( this, &RimEclipseCellColors::onLegendConfigChanged ); m_legendConfigData.push_back( obsoleteLegend ); + m_legendConfigPtrField = obsoleteLegend; } From e1990afbae877172b50de0770f7db014f3dadfed Mon Sep 17 00:00:00 2001 From: magnesj Date: Sun, 27 Feb 2022 01:44:24 +0000 Subject: [PATCH 151/406] Fixes by clang-tidy --- ApplicationLibCode/UserInterface/RiuSummaryPlot.h | 2 +- ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuSummaryPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryPlot.h index 4161b12fac..791c07aa96 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryPlot.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryPlot.h @@ -37,7 +37,7 @@ class RiuSummaryPlot : public QObject Q_OBJECT public: RiuSummaryPlot( RimSummaryPlot* plot ); - ~RiuSummaryPlot(); + ~RiuSummaryPlot() override; virtual void useDateBasedTimeAxis( const QString& dateFormat, diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h index 82aca42a1a..1e1a909005 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h @@ -45,7 +45,7 @@ class RiuSummaryQwtPlot : public RiuSummaryPlot public: RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent = nullptr ); - ~RiuSummaryQwtPlot(); + ~RiuSummaryQwtPlot() override; void useDateBasedTimeAxis( const QString& dateFormat, const QString& timeFormat, From cc5250897008abc5811ec6d6e546bb29eb151f7a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 28 Feb 2022 07:58:17 +0100 Subject: [PATCH 152/406] #8494 Icons : Add icons for toolbars and docking widgets --- ApplicationExeCode/Resources/ResInsight.qrc | 18 +++++++++++++++++- ApplicationExeCode/Resources/data-sources.svg | 3 +++ ApplicationExeCode/Resources/edit.svg | 3 +++ ApplicationExeCode/Resources/graph.svg | 3 +++ ApplicationExeCode/Resources/messages.svg | 3 +++ ApplicationExeCode/Resources/multiplot.svg | 12 ++++++++++++ ApplicationExeCode/Resources/plot-manager.svg | 3 +++ ApplicationExeCode/Resources/plots.svg | 3 +++ .../Resources/property-editor.svg | 6 ++++++ ApplicationExeCode/Resources/scripts.svg | 3 +++ ApplicationExeCode/Resources/standard.svg | 3 +++ ApplicationExeCode/Resources/summary-plot.svg | 19 +++++++++++++++++++ ApplicationExeCode/Resources/undo-stack.svg | 3 +++ .../Resources/view-snapshots.svg | 3 +++ ApplicationExeCode/Resources/view.svg | 3 +++ .../Resources/well-log-plot.svg | 12 ++++++++++++ .../Resources/window-management.svg | 3 +++ 17 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 ApplicationExeCode/Resources/data-sources.svg create mode 100644 ApplicationExeCode/Resources/edit.svg create mode 100644 ApplicationExeCode/Resources/graph.svg create mode 100644 ApplicationExeCode/Resources/messages.svg create mode 100644 ApplicationExeCode/Resources/multiplot.svg create mode 100644 ApplicationExeCode/Resources/plot-manager.svg create mode 100644 ApplicationExeCode/Resources/plots.svg create mode 100644 ApplicationExeCode/Resources/property-editor.svg create mode 100644 ApplicationExeCode/Resources/scripts.svg create mode 100644 ApplicationExeCode/Resources/standard.svg create mode 100644 ApplicationExeCode/Resources/summary-plot.svg create mode 100644 ApplicationExeCode/Resources/undo-stack.svg create mode 100644 ApplicationExeCode/Resources/view-snapshots.svg create mode 100644 ApplicationExeCode/Resources/view.svg create mode 100644 ApplicationExeCode/Resources/well-log-plot.svg create mode 100644 ApplicationExeCode/Resources/window-management.svg diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index ebd7275464..2469e9448d 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -240,7 +240,23 @@ ComboBoxDown.svg ComboBoxUp.svg WellIntAnalysis.png - DataVector.png + DataVector.png + data-sources.svg + edit.svg + graph.svg + messages.svg + multiplot.svg + plot-manager.svg + plots.svg + property-editor.svg + scripts.svg + standard.svg + summary-plot.svg + undo-stack.svg + view.svg + view-snapshots.svg + well-log-plot.svg + window-management.svg fs_CellFace.glsl diff --git a/ApplicationExeCode/Resources/data-sources.svg b/ApplicationExeCode/Resources/data-sources.svg new file mode 100644 index 0000000000..19a6b13dbc --- /dev/null +++ b/ApplicationExeCode/Resources/data-sources.svg @@ -0,0 +1,3 @@ + + + diff --git a/ApplicationExeCode/Resources/edit.svg b/ApplicationExeCode/Resources/edit.svg new file mode 100644 index 0000000000..08f6b38e54 --- /dev/null +++ b/ApplicationExeCode/Resources/edit.svg @@ -0,0 +1,3 @@ + + + diff --git a/ApplicationExeCode/Resources/graph.svg b/ApplicationExeCode/Resources/graph.svg new file mode 100644 index 0000000000..40a5c774f6 --- /dev/null +++ b/ApplicationExeCode/Resources/graph.svg @@ -0,0 +1,3 @@ + + + diff --git a/ApplicationExeCode/Resources/messages.svg b/ApplicationExeCode/Resources/messages.svg new file mode 100644 index 0000000000..1d3be011f8 --- /dev/null +++ b/ApplicationExeCode/Resources/messages.svg @@ -0,0 +1,3 @@ + + + diff --git a/ApplicationExeCode/Resources/multiplot.svg b/ApplicationExeCode/Resources/multiplot.svg new file mode 100644 index 0000000000..b4fb3c0af0 --- /dev/null +++ b/ApplicationExeCode/Resources/multiplot.svg @@ -0,0 +1,12 @@ + + + + + + + + + diff --git a/ApplicationExeCode/Resources/plot-manager.svg b/ApplicationExeCode/Resources/plot-manager.svg new file mode 100644 index 0000000000..1f5e31274e --- /dev/null +++ b/ApplicationExeCode/Resources/plot-manager.svg @@ -0,0 +1,3 @@ + + + diff --git a/ApplicationExeCode/Resources/plots.svg b/ApplicationExeCode/Resources/plots.svg new file mode 100644 index 0000000000..40a5c774f6 --- /dev/null +++ b/ApplicationExeCode/Resources/plots.svg @@ -0,0 +1,3 @@ + + + diff --git a/ApplicationExeCode/Resources/property-editor.svg b/ApplicationExeCode/Resources/property-editor.svg new file mode 100644 index 0000000000..a9b9ee76b0 --- /dev/null +++ b/ApplicationExeCode/Resources/property-editor.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/ApplicationExeCode/Resources/scripts.svg b/ApplicationExeCode/Resources/scripts.svg new file mode 100644 index 0000000000..5f29574b2d --- /dev/null +++ b/ApplicationExeCode/Resources/scripts.svg @@ -0,0 +1,3 @@ + + + diff --git a/ApplicationExeCode/Resources/standard.svg b/ApplicationExeCode/Resources/standard.svg new file mode 100644 index 0000000000..bc321cdffa --- /dev/null +++ b/ApplicationExeCode/Resources/standard.svg @@ -0,0 +1,3 @@ + + + diff --git a/ApplicationExeCode/Resources/summary-plot.svg b/ApplicationExeCode/Resources/summary-plot.svg new file mode 100644 index 0000000000..5b1a8abbb8 --- /dev/null +++ b/ApplicationExeCode/Resources/summary-plot.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + diff --git a/ApplicationExeCode/Resources/undo-stack.svg b/ApplicationExeCode/Resources/undo-stack.svg new file mode 100644 index 0000000000..eabdd7e0c5 --- /dev/null +++ b/ApplicationExeCode/Resources/undo-stack.svg @@ -0,0 +1,3 @@ + + + diff --git a/ApplicationExeCode/Resources/view-snapshots.svg b/ApplicationExeCode/Resources/view-snapshots.svg new file mode 100644 index 0000000000..c5343b4117 --- /dev/null +++ b/ApplicationExeCode/Resources/view-snapshots.svg @@ -0,0 +1,3 @@ + + + diff --git a/ApplicationExeCode/Resources/view.svg b/ApplicationExeCode/Resources/view.svg new file mode 100644 index 0000000000..390221b8da --- /dev/null +++ b/ApplicationExeCode/Resources/view.svg @@ -0,0 +1,3 @@ + + + diff --git a/ApplicationExeCode/Resources/well-log-plot.svg b/ApplicationExeCode/Resources/well-log-plot.svg new file mode 100644 index 0000000000..9df12a42ec --- /dev/null +++ b/ApplicationExeCode/Resources/well-log-plot.svg @@ -0,0 +1,12 @@ + + + + + + + diff --git a/ApplicationExeCode/Resources/window-management.svg b/ApplicationExeCode/Resources/window-management.svg new file mode 100644 index 0000000000..829ba31e38 --- /dev/null +++ b/ApplicationExeCode/Resources/window-management.svg @@ -0,0 +1,3 @@ + + + From 9826d94e9af50682715207f3bbb0175195e11d98 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 28 Feb 2022 10:32:15 +0100 Subject: [PATCH 153/406] Make sure a signal is connected only once --- .../RicNewPlotAxisPropertiesFeature.cpp | 3 ++- .../Summary/RimSummaryPlot.cpp | 25 ++++++++++++------- .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 +-- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp index 09e42f57ac..6dcdcc8c9d 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp @@ -50,8 +50,9 @@ void RicNewPlotAxisPropertiesFeature::onActionTriggered( bool isChecked ) RimSummaryPlot* summaryPlot = summaryPlots[0]; + bool connectSignals = true; RimPlotAxisProperties* newPlotAxisProperties = - summaryPlot->addNewAxisProperties( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "New Axis" ); + summaryPlot->addNewAxisProperties( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "New Axis", connectSignals ); summaryPlot->updateConnectedEditors(); RiuPlotMainWindowTools::selectAsCurrentItem( newPlotAxisProperties ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index a4cdc39986..32e8a76dd1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -121,12 +121,13 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) CAF_PDM_InitFieldNoDefault( &m_axisProperties, "AxisProperties", "Axes", ":/Axes16x16.png" ); - addNewAxisProperties( RiuPlotAxis::defaultLeft(), "Left" ); - addNewAxisProperties( RiuPlotAxis::defaultRight(), "Right" ); + bool connectSignals = false; + addNewAxisProperties( RiuPlotAxis::defaultLeft(), "Left", connectSignals ); + addNewAxisProperties( RiuPlotAxis::defaultRight(), "Right", connectSignals ); if ( m_isCrossPlot ) { - addNewAxisProperties( RiuPlotAxis::defaultBottom(), "Bottom" ); + addNewAxisProperties( RiuPlotAxis::defaultBottom(), "Bottom", connectSignals ); } else { @@ -1725,21 +1726,26 @@ void RimSummaryPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiaDefines::PlotAxis plotAxis, const QString& name ) +RimPlotAxisProperties* + RimSummaryPlot::addNewAxisProperties( RiaDefines::PlotAxis plotAxis, const QString& name, bool connectSignals ) { RiuPlotAxis newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); - return addNewAxisProperties( newPlotAxis, name ); + return addNewAxisProperties( newPlotAxis, name, connectSignals ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name ) +RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name, bool connectSignals ) { RimPlotAxisProperties* axisProperties = new RimPlotAxisProperties; axisProperties->setNameAndAxis( name, plotAxis.axis(), plotAxis.index() ); m_axisProperties.push_back( axisProperties ); - connectAxisSignals( axisProperties ); + + if ( connectSignals ) + { + connectAxisSignals( axisProperties ); + } return axisProperties; } @@ -2532,8 +2538,9 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* destinationCurve ) if ( !destinationCurve->summaryAddressY().uiText().empty() ) axisObjectName = QString::fromStdString( destinationCurve->summaryAddressY().uiText() ); - newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); - addNewAxisProperties( newPlotAxis, axisObjectName ); + newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); + bool connectSignals = true; + addNewAxisProperties( newPlotAxis, axisObjectName, connectSignals ); } destinationCurve->setLeftOrRightAxisY( newPlotAxis ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index f02d514d52..03ecad72e7 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -189,7 +189,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping RimPlotAxisPropertiesInterface* axisPropertiesForPlotAxis( RiuPlotAxis plotAxis ) const; - RimPlotAxisProperties* addNewAxisProperties( RiaDefines::PlotAxis, const QString& name ); + RimPlotAxisProperties* addNewAxisProperties( RiaDefines::PlotAxis, const QString& name, bool connectSignals ); public: // RimViewWindow overrides @@ -214,7 +214,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis ); - RimPlotAxisProperties* addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name ); + RimPlotAxisProperties* addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name, bool connectSignals ); protected: // Overridden PDM methods From 0cd965dd5ba8e4504401aa13340342c7bbb16003 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Tue, 1 Mar 2022 17:27:46 +0100 Subject: [PATCH 154/406] Summary plot crash fixes (#8595) Disable assert for duplicated signal connections for now, just ignore everyone but the first one Temp. workaround for crash when duplicating plot axis properties. Update test --- .../Summary/RimEnsembleCurveSet.cpp | 7 ++++-- .../cafPdmCore_UnitTests/cafSignalTest.cpp | 22 +++++++++---------- .../cafPdmCore/cafSignal.h | 3 ++- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 2961e58ad9..666a065317 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -2115,7 +2115,10 @@ void RimEnsembleCurveSet::initAfterRead() if ( m_plotAxisProperties.value() == nullptr ) { RimSummaryPlot* plot = nullptr; - firstAncestorOrThisOfTypeAsserted( plot ); - m_plotAxisProperties = plot->axisPropertiesForPlotAxis( RiuPlotAxis( m_plotAxis_OBSOLETE() ) ); + firstAncestorOrThisOfType( plot ); + if ( plot ) + { + m_plotAxisProperties = plot->axisPropertiesForPlotAxis( RiuPlotAxis( m_plotAxis_OBSOLETE() ) ); + } } } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafSignalTest.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafSignalTest.cpp index 215db8a6de..563877af61 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafSignalTest.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafSignalTest.cpp @@ -156,14 +156,14 @@ TEST( SignalTest, ObserverDeletion ) emitter.triggerBasicSignal(); } -TEST( SignalTest, ConnectSignalTwiceAssert ) -{ - ASSERT_DEATH( - { - TestEmitter emitter; - TestObserver observer; - - observer.connectSignalsTwice( &emitter ); - }, - "" ); -} +// TEST( SignalTest, ConnectSignalTwiceAssert ) +//{ +// ASSERT_DEATH( +// { +// TestEmitter emitter; +// TestObserver observer; +// +// observer.connectSignalsTwice( &emitter ); +// }, +// "" ); +//} diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafSignal.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafSignal.h index 8775fa9f32..4d718d1305 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafSignal.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafSignal.h @@ -137,7 +137,8 @@ class Signal : public AbstractSignal "Only classes that inherit SignalObserver can connect as an observer of a Signal." ); // Connecting a signal twice is not supported - CAF_ASSERT( m_observerCallbacks.find( observer ) == m_observerCallbacks.end() ); + // CAF_ASSERT( m_observerCallbacks.find( observer ) == m_observerCallbacks.end() ); + if ( m_observerCallbacks.find( observer ) != m_observerCallbacks.end() ) return; m_observerCallbacks[observer] = std::make_pair( callback, true ); observer->addObservedSignal( this ); From 423dde93fc77ecb59834bb4a379ff8fb1d1fca8b Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 25 Feb 2022 14:45:01 +0100 Subject: [PATCH 155/406] #8523 Summary Plot: Improve axis name. Use same name as axis in plot now. --- .../ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index 343cfc9e7e..064896664f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -128,6 +128,8 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot { titleAlignment = Qt::AlignRight; } + + m_axisProperties->setNameAndAxis( axisTitle, axis.axis(), axis.index() ); plotWidget->setAxisTitleText( axis, axisTitle ); plotWidget->setAxisFontsAndAlignment( axis, m_axisProperties->titleFontSize(), From 7a2a29764851f58b40cc144f91c22a627bcbe526 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 2 Mar 2022 15:27:55 +0100 Subject: [PATCH 156/406] #8592: Temporary workaround for crash seen on RHEL7 --- .../cafInternalPdmUiFieldCapability.inl | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl index a732ce7f95..7226659747 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl @@ -14,7 +14,7 @@ namespace caf //-------------------------------------------------------------------------------------------------- template -void caf::PdmFieldUiCap::setValueFromUiEditor( const QVariant& uiValue ) +void PdmFieldUiCap::setValueFromUiEditor( const QVariant& uiValue ) { QVariant oldUiBasedQVariant = toUiBasedQVariant(); @@ -123,7 +123,7 @@ void caf::PdmFieldUiCap::setValueFromUiEditor( const QVariant& uiValu //-------------------------------------------------------------------------------------------------- template -QVariant caf::PdmFieldUiCap::uiValue() const +QVariant PdmFieldUiCap::uiValue() const { if ( m_optionEntryCache.size() ) { @@ -137,11 +137,13 @@ QVariant caf::PdmFieldUiCap::uiValue() const if ( isAutoAddingOptionFromValue() && indexesToFoundOptions.size() != static_cast( uiBasedQVariant.toList().size() ) ) { - CAF_ASSERT( false ); // Did not find all the field values among the options available, even though we - // should. Reasons might be: - // The "core" data type in the field is probably not supported by - // QVariant::toString() You forgot to call valueOptions() before the call to - // uiValue(). + return QVariant(); + + // CAF_ASSERT( false ); // Did not find all the field values among the options available, even though we + // should. Reasons might be: + // The "core" data type in the field is probably not supported by + // QVariant::toString() You forgot to call valueOptions() before the call to + // uiValue(). } else { @@ -181,7 +183,7 @@ QVariant caf::PdmFieldUiCap::uiValue() const //-------------------------------------------------------------------------------------------------- template -QList caf::PdmFieldUiCap::valueOptions( bool* useOptionsOnly ) const +QList PdmFieldUiCap::valueOptions( bool* useOptionsOnly ) const { m_optionEntryCache.clear(); @@ -261,7 +263,7 @@ QList caf::PdmFieldUiCap::valueOptions( bool* useO /// //-------------------------------------------------------------------------------------------------- template -QVariant caf::PdmFieldUiCap::toUiBasedQVariant() const +QVariant PdmFieldUiCap::toUiBasedQVariant() const { return PdmUiFieldSpecialization::convert( m_field->value() ); } @@ -270,8 +272,8 @@ QVariant caf::PdmFieldUiCap::toUiBasedQVariant() const /// //-------------------------------------------------------------------------------------------------- template -bool caf::PdmFieldUiCap::isQVariantDataEqual( const QVariant& oldUiBasedQVariant, - const QVariant& newUiBasedQVariant ) const +bool PdmFieldUiCap::isQVariantDataEqual( const QVariant& oldUiBasedQVariant, + const QVariant& newUiBasedQVariant ) const { return PdmValueFieldSpecialization::isEqual( oldUiBasedQVariant, newUiBasedQVariant ); } From 0e57cfe201aeb7a70daec3775865b409759fec23 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 3 Mar 2022 10:15:32 +0100 Subject: [PATCH 157/406] Memory Management : Adjustment and fixes Add release of several static singleton objects Fix several minor memory leaks --- ApplicationExeCode/CMakeLists.txt | 4 +- ApplicationExeCode/RiaMain.cpp | 12 ++++ ApplicationExeCode/RiaMainTools.cpp | 61 +++++++++++++++++ ApplicationExeCode/RiaMainTools.h | 25 +++++++ .../Application/RiaGuiApplication.cpp | 47 +++---------- .../Application/RiaGuiApplication.h | 6 +- .../Tools/RiaRegressionTestRunner.cpp | 23 ++++++- .../Tools/RiaRegressionTestRunner.h | 5 ++ .../RicEditSummaryCurveCalculationFeature.cpp | 2 +- .../RicEditSummaryPlotFeature.cpp | 8 +-- .../RicEditSummaryPlotFeature.h | 2 +- .../RicNewSummaryPlotFeature.cpp | 2 +- .../RicShowSummaryCurveCalculatorFeature.cpp | 11 ++- .../RicShowSummaryCurveCalculatorFeature.h | 2 +- .../RicSummaryPlotEditorDialog.cpp | 1 + .../UserInterface/RiuMainWindow.cpp | 2 +- .../UserInterface/RiuMainWindowBase.cpp | 13 ++++ .../UserInterface/RiuMainWindowBase.h | 3 +- .../UserInterface/RiuMdiArea.cpp | 16 +++++ ApplicationLibCode/UserInterface/RiuMdiArea.h | 3 + .../UserInterface/RiuPlotMainWindow.cpp | 32 ++++----- .../UserInterface/RiuPlotMainWindow.h | 20 +++--- .../RiuSummaryVectorSelectionUi.cpp | 12 +++- .../cafCommand/cafCmdFeatureManager.cpp | 40 ++++++++++- Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h | 7 ++ Fwk/AppFwk/cafProjectDataModel/cafFactory.h | 9 +++ .../cafPdmXml/cafPdmDefaultObjectFactory.cpp | 67 +++++++++++++++---- .../cafPdmXml/cafPdmDefaultObjectFactory.h | 62 +++++++++-------- .../cafTests/cafTestApplication/Main.cpp | 34 ++++++++-- .../cafTestApplication/MainWindow.cpp | 2 + .../cafPdmUiTreeViewEditor.cpp | 6 ++ .../cafUserInterface/cafPdmUiTreeViewEditor.h | 8 +-- .../cafPdmUiTreeViewQModel.cpp | 12 ++++ .../cafUserInterface/cafPdmUiTreeViewQModel.h | 1 + GrpcInterface/RiaGrpcCallbacks.h | 9 +++ GrpcInterface/RiaGrpcServer.cpp | 13 ++++ 36 files changed, 441 insertions(+), 141 deletions(-) create mode 100644 ApplicationExeCode/RiaMainTools.cpp create mode 100644 ApplicationExeCode/RiaMainTools.h diff --git a/ApplicationExeCode/CMakeLists.txt b/ApplicationExeCode/CMakeLists.txt index 97864137b5..17db20b730 100644 --- a/ApplicationExeCode/CMakeLists.txt +++ b/ApplicationExeCode/CMakeLists.txt @@ -68,9 +68,9 @@ endif() # Defining all the source (and header) files # ############################################################################## -set(CODE_HEADER_FILES) +set(CODE_HEADER_FILES RiaMainTools.h) -set(CODE_SOURCE_FILES RiaMain.cpp) +set(CODE_SOURCE_FILES RiaMain.cpp RiaMainTools.cpp) if(RESINSIGHT_ENABLE_GRPC) list(APPEND CODE_HEAD_FILES RiaGrpcConsoleApplication.h diff --git a/ApplicationExeCode/RiaMain.cpp b/ApplicationExeCode/RiaMain.cpp index 7e158905aa..67fb3b5232 100644 --- a/ApplicationExeCode/RiaMain.cpp +++ b/ApplicationExeCode/RiaMain.cpp @@ -18,6 +18,7 @@ #include "RiaArgumentParser.h" #include "RiaLogging.h" +#include "RiaMainTools.h" #ifdef ENABLE_GRPC #include "RiaGrpcConsoleApplication.h" @@ -26,6 +27,7 @@ #include "RiaConsoleApplication.h" #include "RiaGuiApplication.h" #endif + #include "cvfProgramOptions.h" #include "cvfqtUtils.h" @@ -66,8 +68,12 @@ int main( int argc, char* argv[] ) return 1; } #endif + // Global initialization RiaLogging::loggerInstance()->setLevel( int( RILogLevel::RI_LL_DEBUG ) ); + // Create feature manager before the application object is created + RiaMainTools::initializeSingletons(); + std::unique_ptr app( createApplication( argc, argv ) ); cvf::ProgramOptions progOpt; @@ -112,6 +118,9 @@ int main( int argc, char* argv[] ) // Make sure project is closed to avoid assert and crash in destruction of widgets app->closeProject(); + app.reset(); + RiaMainTools::releaseSingletonAndFactoryObjects(); + return 0; } else if ( status == RiaApplication::ApplicationStatus::EXIT_WITH_ERROR ) @@ -147,6 +156,9 @@ int main( int argc, char* argv[] ) throw; } + app.reset(); + RiaMainTools::releaseSingletonAndFactoryObjects(); + return exitCode; } diff --git a/ApplicationExeCode/RiaMainTools.cpp b/ApplicationExeCode/RiaMainTools.cpp new file mode 100644 index 0000000000..4a2fdcded3 --- /dev/null +++ b/ApplicationExeCode/RiaMainTools.cpp @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiaMainTools.h" +#include "RiaRegressionTestRunner.h" +#include "RiaSocketCommand.h" + +#include "cafCmdFeature.h" +#include "cafCmdFeatureManager.h" +#include "cafPdmDefaultObjectFactory.h" +#include "cafPdmUiFieldEditorHandle.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaMainTools::initializeSingletons() +{ + caf::CmdFeatureManager::createSingleton(); + RiaRegressionTestRunner::createSingleton(); + caf::PdmDefaultObjectFactory::createSingleton(); +} + +//-------------------------------------------------------------------------------------------------- +/// This method is used to release memory allocated by static functions. This enables use of memory allocation tools +/// after the application has closed down. +//-------------------------------------------------------------------------------------------------- +void RiaMainTools::releaseSingletonAndFactoryObjects() +{ + caf::CmdFeatureManager::deleteSingleton(); + RiaRegressionTestRunner::deleteSingleton(); + caf::PdmDefaultObjectFactory::deleteSingleton(); + + { + auto factory = caf::Factory::instance(); + factory->deleteCreatorObjects(); + } + + { + auto factory = caf::Factory::instance(); + factory->deleteCreatorObjects(); + } + { + auto factory = caf::Factory::instance(); + factory->deleteCreatorObjects(); + } +} diff --git a/ApplicationExeCode/RiaMainTools.h b/ApplicationExeCode/RiaMainTools.h new file mode 100644 index 0000000000..025e9bc256 --- /dev/null +++ b/ApplicationExeCode/RiaMainTools.h @@ -0,0 +1,25 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +class RiaMainTools +{ +public: + static void initializeSingletons(); + static void releaseSingletonAndFactoryObjects(); +}; diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index f30535d1c4..4177675a39 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -189,8 +189,6 @@ RiaGuiApplication::RiaGuiApplication( int& argc, char** argv ) //-------------------------------------------------------------------------------------------------- RiaGuiApplication::~RiaGuiApplication() { - deleteMainPlotWindow(); - deleteMainWindow(); } //-------------------------------------------------------------------------------------------------- @@ -925,7 +923,7 @@ RiuMainWindow* RiaGuiApplication::getOrCreateAndShowMainWindow() m_mainWindow->loadWinGeoAndDockToolBarLayout(); } - return m_mainWindow; + return m_mainWindow.get(); } //-------------------------------------------------------------------------------------------------- @@ -933,7 +931,7 @@ RiuMainWindow* RiaGuiApplication::getOrCreateAndShowMainWindow() //-------------------------------------------------------------------------------------------------- RiuMainWindow* RiaGuiApplication::mainWindow() { - return m_mainWindow; + return m_mainWindow.get(); } //-------------------------------------------------------------------------------------------------- @@ -947,7 +945,7 @@ RiuPlotMainWindow* RiaGuiApplication::getOrCreateMainPlotWindow() m_mainPlotWindow->initializeGuiNewProjectLoaded(); loadAndUpdatePlotData(); } - return m_mainPlotWindow; + return m_mainPlotWindow.get(); } //-------------------------------------------------------------------------------------------------- @@ -962,7 +960,7 @@ void RiaGuiApplication::createMainWindow() caf::CmdExecCommandManager::instance()->enableUndoCommandSystem( true ); } - m_mainWindow = new RiuMainWindow; + m_mainWindow = std::make_unique(); QString platform = cvf::System::is64Bit() ? "(64bit)" : "(32bit)"; m_mainWindow->setWindowTitle( "ResInsight " + platform ); m_mainWindow->setDefaultWindowSize(); @@ -972,18 +970,6 @@ void RiaGuiApplication::createMainWindow() m_mainWindow->showWindow(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaGuiApplication::deleteMainWindow() -{ - if ( m_mainWindow ) - { - delete m_mainWindow; - m_mainWindow = nullptr; - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -996,26 +982,13 @@ void RiaGuiApplication::createMainPlotWindow() caf::CmdExecCommandManager::instance()->enableUndoCommandSystem( true ); } - m_mainPlotWindow = new RiuPlotMainWindow; + m_mainPlotWindow = std::make_unique(); m_mainPlotWindow->setWindowTitle( "Plots - ResInsight" ); m_mainPlotWindow->setDefaultWindowSize(); m_mainPlotWindow->loadWinGeoAndDockToolBarLayout(); m_mainPlotWindow->hideAllDockWidgets(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaGuiApplication::deleteMainPlotWindow() -{ - if ( m_mainPlotWindow ) - { - m_mainPlotWindow->setParent( nullptr ); - delete m_mainPlotWindow; - m_mainPlotWindow = nullptr; - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1052,7 +1025,7 @@ RiuPlotMainWindow* RiaGuiApplication::getOrCreateAndShowMainPlotWindow() m_mainPlotWindow->restoreDockWidgetVisibilities(); } - return m_mainPlotWindow; + return m_mainPlotWindow.get(); } //-------------------------------------------------------------------------------------------------- @@ -1060,7 +1033,7 @@ RiuPlotMainWindow* RiaGuiApplication::getOrCreateAndShowMainPlotWindow() //-------------------------------------------------------------------------------------------------- RiuPlotMainWindow* RiaGuiApplication::mainPlotWindow() { - return m_mainPlotWindow; + return m_mainPlotWindow.get(); } //-------------------------------------------------------------------------------------------------- @@ -1069,9 +1042,9 @@ RiuPlotMainWindow* RiaGuiApplication::mainPlotWindow() RiuMainWindowBase* RiaGuiApplication::mainWindowByID( int mainWindowID ) { if ( mainWindowID == 0 ) - return m_mainWindow; + return m_mainWindow.get(); else if ( mainWindowID == 1 ) - return m_mainPlotWindow; + return m_mainPlotWindow.get(); else return nullptr; } @@ -1478,7 +1451,7 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* } QMessageBox::StandardButton reply; - reply = QMessageBox::question( m_mainWindow, + reply = QMessageBox::question( m_mainWindow.get(), QString( "Apply %1 to Existing Views or Plots?" ).arg( listString ), QString( "You have changed default %1 and have existing views or plots with " "different settings.\n" ) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.h b/ApplicationLibCode/Application/RiaGuiApplication.h index e4fd72590f..257a21ea04 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.h +++ b/ApplicationLibCode/Application/RiaGuiApplication.h @@ -155,9 +155,7 @@ class RiaGuiApplication : public QApplication, public RiaApplication void setWindowCaptionFromAppState(); void createMainWindow(); - void deleteMainWindow(); void createMainPlotWindow(); - void deleteMainPlotWindow(); void storeTreeViewState(); @@ -168,8 +166,8 @@ private slots: void onLastWindowClosed(); private: - QPointer m_mainWindow; - QPointer m_mainPlotWindow; + std::unique_ptr m_mainWindow; + std::unique_ptr m_mainPlotWindow; std::unique_ptr m_recentFileActionProvider; diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp index c06375c720..04bface28e 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp @@ -69,6 +69,8 @@ const QString reportFileName = "ResInsightRegressionTestReport.html"; const QString commandFileFilter = "commandfile-*"; }; // namespace RegTestNames +RiaRegressionTestRunner* RiaRegressionTestRunner::sm_singleton = nullptr; + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -95,8 +97,25 @@ RiaRegressionTestRunner::RiaRegressionTestRunner() //-------------------------------------------------------------------------------------------------- RiaRegressionTestRunner* RiaRegressionTestRunner::instance() { - static RiaRegressionTestRunner* singleton = new RiaRegressionTestRunner; - return singleton; + CAF_ASSERT( sm_singleton ); + return sm_singleton; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaRegressionTestRunner::createSingleton() +{ + if ( !sm_singleton ) sm_singleton = new RiaRegressionTestRunner; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaRegressionTestRunner::deleteSingleton() +{ + if ( sm_singleton ) delete sm_singleton; + sm_singleton = nullptr; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h index afd4e5af76..cf10faa09b 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h @@ -34,6 +34,9 @@ class RiaRegressionTestRunner public: static RiaRegressionTestRunner* instance(); + static void createSingleton(); + static void deleteSingleton(); + void executeRegressionTests( const QString& regressionTestPath, const QStringList& testFilter ); void executeRegressionTests(); @@ -73,4 +76,6 @@ class RiaRegressionTestRunner bool m_appendAllTestsAfterLastItemInFilter; bool m_runningRegressionTests; RiaRegressionTest m_regressionTestSettings; + + static RiaRegressionTestRunner* sm_singleton; }; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp index 73c2d14213..5ab5df3210 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp @@ -70,7 +70,7 @@ void RicEditSummaryCurveCalculationFeature::onActionTriggered( bool isChecked ) } } - RicSummaryCurveCalculatorDialog* dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog(); + RicSummaryCurveCalculatorDialog* dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog( true ); dialog->setCalculationAndUpdateUi( calculation ); dialog->show(); dialog->raise(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.cpp index 32f7b44038..1daab4da12 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.cpp @@ -50,7 +50,7 @@ RicEditSummaryPlotFeature::RicEditSummaryPlotFeature() //-------------------------------------------------------------------------------------------------- void RicEditSummaryPlotFeature::closeDialogAndResetTargetPlot() { - auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog(); + auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog( false ); if ( dialog ) { @@ -65,13 +65,13 @@ void RicEditSummaryPlotFeature::closeDialogAndResetTargetPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RicSummaryPlotEditorDialog* RicEditSummaryPlotFeature::curveCreatorDialog() +RicSummaryPlotEditorDialog* RicEditSummaryPlotFeature::curveCreatorDialog( bool createIfNotPresent ) { RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); if ( mainPlotWindow ) { - return mainPlotWindow->summaryCurveCreatorDialog(); + return mainPlotWindow->summaryCurveCreatorDialog( createIfNotPresent ); } return nullptr; @@ -82,7 +82,7 @@ RicSummaryPlotEditorDialog* RicEditSummaryPlotFeature::curveCreatorDialog() //-------------------------------------------------------------------------------------------------- void RicEditSummaryPlotFeature::editSummaryPlot( RimSummaryPlot* plot ) { - auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog(); + auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog( true ); if ( !dialog->isVisible() ) { diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.h index a51d6e3982..29dca7d6c0 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryPlotFeature.h @@ -34,7 +34,7 @@ class RicEditSummaryPlotFeature : public caf::CmdFeature public: void closeDialogAndResetTargetPlot(); - static RicSummaryPlotEditorDialog* curveCreatorDialog(); + static RicSummaryPlotEditorDialog* curveCreatorDialog( bool createIfNotPresent ); static void editSummaryPlot( RimSummaryPlot* plot ); protected: diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp index 701b1fbb05..88128ba82b 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp @@ -123,7 +123,7 @@ void RicNewSummaryPlotFeature::onActionTriggered( bool isChecked ) } } - auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog(); + auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog( true ); if ( !dialog->isVisible() ) { diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp index 8441df7ca2..9ddde2e304 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp @@ -34,13 +34,13 @@ CAF_CMD_SOURCE_INIT( RicShowSummaryCurveCalculatorFeature, "RicShowSummaryCurveC //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RicSummaryCurveCalculatorDialog* RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog() +RicSummaryCurveCalculatorDialog* RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog( bool createIfNotPresent ) { RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); if ( mainPlotWindow ) { - return mainPlotWindow->summaryCurveCalculatorDialog(); + return mainPlotWindow->summaryCurveCalculatorDialog( createIfNotPresent ); } return nullptr; @@ -51,9 +51,8 @@ RicSummaryCurveCalculatorDialog* RicShowSummaryCurveCalculatorFeature::curveCalc //-------------------------------------------------------------------------------------------------- void RicShowSummaryCurveCalculatorFeature::hideCurveCalculatorDialog() { - auto dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog(); - - dialog->hide(); + auto dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog( false ); + if ( dialog ) dialog->hide(); } //-------------------------------------------------------------------------------------------------- @@ -74,7 +73,7 @@ bool RicShowSummaryCurveCalculatorFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicShowSummaryCurveCalculatorFeature::onActionTriggered( bool isChecked ) { - RicSummaryCurveCalculatorDialog* dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog(); + RicSummaryCurveCalculatorDialog* dialog = RicShowSummaryCurveCalculatorFeature::curveCalculatorDialog( true ); RimProject* proj = RimProject::current(); RimSummaryCalculationCollection* calcColl = proj->calculationCollection(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.h index a274865185..9d9d30e4a4 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.h @@ -30,7 +30,7 @@ class RicShowSummaryCurveCalculatorFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; public: - static RicSummaryCurveCalculatorDialog* curveCalculatorDialog(); + static RicSummaryCurveCalculatorDialog* curveCalculatorDialog( bool createIfNotPresent ); static void hideCurveCalculatorDialog(); protected: diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorDialog.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorDialog.cpp index 00ba11274a..f25da5c11e 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorDialog.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorDialog.cpp @@ -55,6 +55,7 @@ RicSummaryPlotEditorDialog::RicSummaryPlotEditorDialog( QWidget* parent ) RicSummaryPlotEditorDialog::~RicSummaryPlotEditorDialog() { m_curveCreatorSplitterUi->setPdmObject( nullptr ); + delete m_curveCreatorSplitterUi; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 7b2eda76be..d4a68a8fd2 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -119,7 +119,7 @@ RiuMainWindow::RiuMainWindow() , m_windowMenu( nullptr ) , m_holoLensToolBar( nullptr ) { - m_mdiArea = new RiuMdiArea; + m_mdiArea = new RiuMdiArea( this ); connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) ); setCentralWidget( m_mdiArea ); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 947e4ca483..2bbe047119 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -73,6 +73,19 @@ RiuMainWindowBase::RiuMainWindowBase() connect( m_redoAction, SIGNAL( triggered() ), SLOT( slotRedo() ) ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuMainWindowBase::~RiuMainWindowBase() +{ + for ( auto v : m_projectTreeViews ) + { + delete v; + } + + m_projectTreeViews.clear(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index f7a6739615..dc2d6608f1 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -47,7 +47,8 @@ class RiuMainWindowBase : public QMainWindow Q_OBJECT public: - RiuMainWindowBase(); + RiuMainWindowBase(); + ~RiuMainWindowBase(); virtual QString mainWindowName() = 0; diff --git a/ApplicationLibCode/UserInterface/RiuMdiArea.cpp b/ApplicationLibCode/UserInterface/RiuMdiArea.cpp index 9790558dbe..b2895b5eb0 100644 --- a/ApplicationLibCode/UserInterface/RiuMdiArea.cpp +++ b/ApplicationLibCode/UserInterface/RiuMdiArea.cpp @@ -20,6 +20,22 @@ #include "RiuMainWindow.h" #include "RiuMdiSubWindow.h" #include "RiuPlotMainWindow.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuMdiArea::RiuMdiArea( QWidget* parent /*= nullptr*/ ) + : QMdiArea( parent ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuMdiArea::~RiuMdiArea() +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMdiArea.h b/ApplicationLibCode/UserInterface/RiuMdiArea.h index 9a187c3169..4d93fcd866 100644 --- a/ApplicationLibCode/UserInterface/RiuMdiArea.h +++ b/ApplicationLibCode/UserInterface/RiuMdiArea.h @@ -29,6 +29,9 @@ class RiuMdiArea : public QMdiArea Q_OBJECT public: + RiuMdiArea( QWidget* parent = nullptr ); + ~RiuMdiArea(); + std::list subWindowListSortedByPosition(); protected: diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 72f8581c79..ce34060102 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -77,7 +77,7 @@ RiuPlotMainWindow::RiuPlotMainWindow() : m_activePlotViewWindow( nullptr ) , m_windowMenu( nullptr ) { - m_mdiArea = new RiuMdiArea; + m_mdiArea = new RiuMdiArea( this ); connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) ); setCentralWidget( m_mdiArea ); @@ -417,13 +417,13 @@ void RiuPlotMainWindow::createToolBars() } } - m_wellLogPlotToolBarEditor = new caf::PdmUiToolBarEditor( "Well Log Plot", this ); + m_wellLogPlotToolBarEditor = std::make_unique( "Well Log Plot", this ); m_wellLogPlotToolBarEditor->hide(); - m_summaryPlotToolBarEditor = new caf::PdmUiToolBarEditor( "Summary Plot", this ); + m_summaryPlotToolBarEditor = std::make_unique( "Summary Plot", this ); m_summaryPlotToolBarEditor->hide(); - m_multiPlotToolBarEditor = new caf::PdmUiToolBarEditor( "Multi Plot", this ); + m_multiPlotToolBarEditor = std::make_unique( "Multi Plot", this ); m_multiPlotToolBarEditor->hide(); if ( RiaPreferences::current()->useUndoRedo() ) @@ -516,8 +516,8 @@ void RiuPlotMainWindow::createDockPanels() dockWidget->setObjectName( RiuDockWidgetTools::plotMainWindowPropertyEditorName() ); dockWidget->setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); - m_pdmUiPropertyView = new caf::PdmUiPropertyView( dockWidget ); - dockWidget->setWidget( m_pdmUiPropertyView ); + m_pdmUiPropertyView = std::make_unique( dockWidget ); + dockWidget->setWidget( m_pdmUiPropertyView.get() ); addDockWidget( Qt::LeftDockWidgetArea, dockWidget ); } @@ -535,14 +535,14 @@ void RiuPlotMainWindow::createDockPanels() QDockWidget* dockWidget = new QDockWidget( "Plot Manager", this ); dockWidget->setObjectName( RiuDockWidgetTools::summaryPlotManagerName() ); - m_summaryPlotManagerView = new caf::PdmUiPropertyView( dockWidget ); + m_summaryPlotManagerView = std::make_unique( dockWidget ); auto plotManager = std::make_unique(); m_summaryPlotManagerView->showProperties( plotManager.get() ); m_summaryPlotManagerView->installEventFilter( plotManager.get() ); m_summaryPlotManager = std::move( plotManager ); - dockWidget->setWidget( m_summaryPlotManagerView ); + dockWidget->setWidget( m_summaryPlotManagerView.get() ); addDockWidget( Qt::BottomDockWidgetArea, dockWidget ); dockWidget->hide(); } @@ -750,27 +750,27 @@ void RiuPlotMainWindow::setFocusToLineEditInSummaryToolBar() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RicSummaryPlotEditorDialog* RiuPlotMainWindow::summaryCurveCreatorDialog() +RicSummaryPlotEditorDialog* RiuPlotMainWindow::summaryCurveCreatorDialog( bool createIfNotPresent ) { - if ( m_summaryCurveCreatorDialog.isNull() ) + if ( !m_summaryCurveCreatorDialog && createIfNotPresent ) { - m_summaryCurveCreatorDialog = new RicSummaryPlotEditorDialog( this ); + m_summaryCurveCreatorDialog = std::make_unique( this ); } - return m_summaryCurveCreatorDialog; + return m_summaryCurveCreatorDialog.get(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RicSummaryCurveCalculatorDialog* RiuPlotMainWindow::summaryCurveCalculatorDialog() +RicSummaryCurveCalculatorDialog* RiuPlotMainWindow::summaryCurveCalculatorDialog( bool createIfNotPresent ) { - if ( m_summaryCurveCalculatorDialog.isNull() ) + if ( !m_summaryCurveCalculatorDialog && createIfNotPresent ) { - m_summaryCurveCalculatorDialog = new RicSummaryCurveCalculatorDialog( this ); + m_summaryCurveCalculatorDialog = std::make_unique( this ); } - return m_summaryCurveCalculatorDialog; + return m_summaryCurveCalculatorDialog.get(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 83696c784e..2814b8e6c9 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -88,8 +88,8 @@ class RiuPlotMainWindow : public RiuMainWindowBase void updateSummaryPlotToolBar( bool forceUpdateUi = false ); void setFocusToLineEditInSummaryToolBar(); - RicSummaryPlotEditorDialog* summaryCurveCreatorDialog(); - RicSummaryCurveCalculatorDialog* summaryCurveCalculatorDialog(); + RicSummaryPlotEditorDialog* summaryCurveCreatorDialog( bool createIfNotPresent ); + RicSummaryCurveCalculatorDialog* summaryCurveCalculatorDialog( bool createIfNotPresent ); RiuMessagePanel* messagePanel(); @@ -132,16 +132,16 @@ private slots: QMenu* m_windowMenu; - caf::PdmUiToolBarEditor* m_wellLogPlotToolBarEditor; - caf::PdmUiToolBarEditor* m_multiPlotToolBarEditor; - caf::PdmUiToolBarEditor* m_summaryPlotToolBarEditor; + std::unique_ptr m_wellLogPlotToolBarEditor; + std::unique_ptr m_multiPlotToolBarEditor; + std::unique_ptr m_summaryPlotToolBarEditor; - caf::PdmUiPropertyView* m_pdmUiPropertyView; - caf::PdmUiPropertyView* m_summaryPlotManagerView; + std::unique_ptr m_pdmUiPropertyView; + std::unique_ptr m_summaryPlotManagerView; - QPointer m_summaryCurveCreatorDialog; - QPointer m_summaryCurveCalculatorDialog; - std::unique_ptr m_summaryPlotManager; + std::unique_ptr m_summaryCurveCreatorDialog; + std::unique_ptr m_summaryCurveCalculatorDialog; + std::unique_ptr m_summaryPlotManager; std::vector m_temporaryWidgets; }; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp index 2de072ec59..b95aa232c7 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp @@ -71,7 +71,7 @@ class SummaryIdentifierAndField { } - virtual ~SummaryIdentifierAndField() { delete m_pdmField; } + virtual ~SummaryIdentifierAndField(); RifEclipseSummaryAddress::SummaryIdentifierType summaryIdentifier() const { return m_summaryIdentifier; } caf::PdmField>* pdmField() { return m_pdmField; } @@ -81,6 +81,14 @@ class SummaryIdentifierAndField caf::PdmField>* m_pdmField; }; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +SummaryIdentifierAndField::~SummaryIdentifierAndField() +{ + delete m_pdmField; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -303,7 +311,7 @@ RiuSummaryVectorSelectionUi::~RiuSummaryVectorSelectionUi() { for ( const auto& identifierAndField : identifierAndFieldList.second ) { - delete identifierAndField->pdmField(); + delete identifierAndField; } } } diff --git a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp index 4df8ce8dba..88bd4470f0 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp +++ b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.cpp @@ -46,6 +46,9 @@ namespace caf { typedef Factory CommandFeatureFactory; + +CmdFeatureManager* CmdFeatureManager::sm_singleton = nullptr; + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -67,6 +70,18 @@ CmdFeatureManager::CmdFeatureManager() //-------------------------------------------------------------------------------------------------- CmdFeatureManager::~CmdFeatureManager() { + releaseAllCommandFeatures(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void CmdFeatureManager::createSingleton() +{ + if ( !sm_singleton ) + { + sm_singleton = new CmdFeatureManager; + } } //-------------------------------------------------------------------------------------------------- @@ -74,8 +89,8 @@ CmdFeatureManager::~CmdFeatureManager() //-------------------------------------------------------------------------------------------------- CmdFeatureManager* CmdFeatureManager::instance() { - static CmdFeatureManager* singleton = new CmdFeatureManager; - return singleton; + CAF_ASSERT( sm_singleton ); + return sm_singleton; } //-------------------------------------------------------------------------------------------------- @@ -345,4 +360,25 @@ QWidget* CmdFeatureManager::currentContextMenuTargetWidget() return m_currentContextMenuTargetWidget; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void CmdFeatureManager::releaseAllCommandFeatures() +{ + for ( auto c : m_commandFeatures ) + { + if ( c ) delete c; + c = nullptr; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void CmdFeatureManager::deleteSingleton() +{ + if ( sm_singleton ) delete sm_singleton; + sm_singleton = nullptr; +} + } // end namespace caf diff --git a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h index 5128320d8d..518dbab7ca 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h +++ b/Fwk/AppFwk/cafCommand/cafCmdFeatureManager.h @@ -63,6 +63,9 @@ class CmdFeatureManager : public QObject static CmdFeatureManager* instance(); ~CmdFeatureManager() override; + static void createSingleton(); + static void deleteSingleton(); + QAction* action( const QString& commandId ); QAction* action( const QString& commandId, const QString& customActionText ); QAction* actionWithUserData( const QString& commandId, const QString& customActionText, const QVariant& userData ); @@ -86,7 +89,11 @@ class CmdFeatureManager : public QObject CmdFeature* commandFeature( const std::string& commandId ) const; + void releaseAllCommandFeatures(); + private: + static CmdFeatureManager* sm_singleton; + std::vector m_commandFeatures; std::map m_commandIdToFeatureIdxMap; std::map m_actionToFeatureIdxMap; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafFactory.h b/Fwk/AppFwk/cafProjectDataModel/cafFactory.h index a4793bcd1a..52cd2cd488 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafFactory.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafFactory.h @@ -152,6 +152,15 @@ class Factory return keys; } + void deleteCreatorObjects() + { + for ( auto f : m_factoryMap ) + { + if ( f.second ) delete f.second; + } + m_factoryMap.clear(); + } + private: Factory() {} ~Factory() diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmDefaultObjectFactory.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmDefaultObjectFactory.cpp index 93ece27245..2ee67310e6 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmDefaultObjectFactory.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmDefaultObjectFactory.cpp @@ -1,11 +1,63 @@ #include "cafPdmDefaultObjectFactory.h" +#include + namespace caf { //-------------------------------------------------------------------------------------------------- /// PdmObjectFactory implementations //-------------------------------------------------------------------------------------------------- +PdmDefaultObjectFactory* PdmDefaultObjectFactory::sm_singleton = nullptr; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +PdmDefaultObjectFactory::~PdmDefaultObjectFactory() +{ + // Each keyword alias is connected to the one creator object, so it is not possible to traverse the map directly and + // delete the creator objects. Create a set of unique creator objects. + std::set uniqueObjects; + + for ( const auto& f : m_factoryMap ) + { + uniqueObjects.insert( f.second ); + } + + for ( auto obj : uniqueObjects ) + { + if ( obj ) delete obj; + } + + m_factoryMap.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +PdmDefaultObjectFactory* PdmDefaultObjectFactory::instance() +{ + createSingleton(); + return sm_singleton; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmDefaultObjectFactory::createSingleton() +{ + if ( !sm_singleton ) sm_singleton = new PdmDefaultObjectFactory; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmDefaultObjectFactory::deleteSingleton() +{ + if ( sm_singleton ) delete sm_singleton; + sm_singleton = nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -17,10 +69,8 @@ PdmObjectHandle* PdmDefaultObjectFactory::create( const QString& classNameKeywor { return entryIt->second->create(); } - else - { - return nullptr; - } + + return nullptr; } //-------------------------------------------------------------------------------------------------- @@ -38,13 +88,4 @@ std::vector PdmDefaultObjectFactory::classKeywords() const return names; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -PdmDefaultObjectFactory* PdmDefaultObjectFactory::instance() -{ - static PdmDefaultObjectFactory* fact = new PdmDefaultObjectFactory; - return fact; -} - } // End of namespace caf diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmDefaultObjectFactory.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmDefaultObjectFactory.h index eb5f29927b..4321f25e6c 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmDefaultObjectFactory.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmDefaultObjectFactory.h @@ -58,46 +58,28 @@ class PdmDefaultObjectFactory : public PdmObjectFactory public: static PdmDefaultObjectFactory* instance(); + static void createSingleton(); + static void deleteSingleton(); + PdmObjectHandle* create( const QString& classNameKeyword ) override; template - bool registerCreator() - { - std::vector classNameKeywords = PdmObjectBaseDerivative::classKeywordAliases(); - - for ( QString classNameKeyword : classNameKeywords ) - { - auto entryIt = m_factoryMap.find( classNameKeyword ); - if ( entryIt != m_factoryMap.end() ) - { - CAF_ASSERT( classNameKeyword != entryIt->first ); // classNameKeyword has already been used - CAF_ASSERT( false ); // To be sure .. - return false; // never hit; - } - } - auto object = new PdmObjectCreator(); - for ( QString classNameKeyword : classNameKeywords ) - { - m_factoryMap[classNameKeyword] = object; - } - return true; - } + bool registerCreator(); std::vector classKeywords() const override; private: - PdmDefaultObjectFactory() {} - ~PdmDefaultObjectFactory() override - { /* Could clean up, but ... */ - } + ~PdmDefaultObjectFactory() override; + + static PdmDefaultObjectFactory* sm_singleton; // Internal helper classes class PdmObjectCreatorBase { public: - PdmObjectCreatorBase() {} - virtual ~PdmObjectCreatorBase() {} + PdmObjectCreatorBase() = default; + virtual ~PdmObjectCreatorBase() = default; virtual PdmObjectHandle* create() = 0; }; @@ -112,4 +94,30 @@ class PdmDefaultObjectFactory : public PdmObjectFactory std::map m_factoryMap; }; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +template +bool caf::PdmDefaultObjectFactory::registerCreator() +{ + std::vector classNameKeywords = PdmObjectBaseDerivative::classKeywordAliases(); + + for ( const QString& classNameKeyword : classNameKeywords ) + { + auto entryIt = m_factoryMap.find( classNameKeyword ); + if ( entryIt != m_factoryMap.end() ) + { + CAF_ASSERT( classNameKeyword != entryIt->first ); // classNameKeyword has already been used + CAF_ASSERT( false ); // To be sure .. + return false; // never hit; + } + } + auto object = new PdmObjectCreator(); + for ( const QString& classNameKeyword : classNameKeywords ) + { + m_factoryMap[classNameKeyword] = object; + } + return true; +} + } // End of namespace caf diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/Main.cpp b/Fwk/AppFwk/cafTests/cafTestApplication/Main.cpp index 2fcebf530f..ce6ab18095 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/Main.cpp +++ b/Fwk/AppFwk/cafTests/cafTestApplication/Main.cpp @@ -1,16 +1,38 @@ #include "MainWindow.h" +#include "cafCmdFeatureManager.h" +#include "cafPdmDefaultObjectFactory.h" + +#include "cafFactory.h" +#include "cafPdmUiFieldEditorHandle.h" #include int main(int argc, char* argv[]) { - QApplication app(argc, argv); + auto appExitCode = 0; + { + QApplication app(argc, argv); + + MainWindow window; + window.setWindowTitle("Ceetron Application Framework Test Application"); + window.resize(1000, 810); + window.show(); + + appExitCode = app.exec(); + } + + caf::CmdFeatureManager::deleteSingleton(); + caf::PdmDefaultObjectFactory::deleteSingleton(); - MainWindow window; - window.setWindowTitle("Ceetron Application Framework Test Application"); - window.resize(1000, 810); - window.show(); + { + auto factory = caf::Factory::instance(); + factory->deleteCreatorObjects(); + } + { + auto factory = caf::Factory::instance(); + factory->deleteCreatorObjects(); + } - return app.exec(); + return appExitCode; } diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp index 640e9facd0..2b19200632 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp +++ b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp @@ -1299,6 +1299,8 @@ MainWindow::~MainWindow() m_pdmUiPropertyView->showProperties(nullptr); m_pdmUiTableView->setChildArrayField(nullptr); + releaseTestData(); + delete m_pdmUiTreeView; delete m_pdmUiTreeView2; delete m_pdmUiPropertyView; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp index d2c6f92012..f4be4b1e61 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp @@ -160,6 +160,12 @@ PdmUiTreeViewEditor::~PdmUiTreeViewEditor() { m_treeView->removeEventFilter( this ); m_treeViewModel->setPdmItemRoot( nullptr ); + + if ( m_mainWidget ) delete m_mainWidget; + if ( m_delegate ) delete m_delegate; + if ( m_treeViewModel ) delete m_treeViewModel; + if ( m_filterModel ) delete m_filterModel; + if ( m_treeView ) delete m_treeView; } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h index 7409ef6b18..37b461244e 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h @@ -160,10 +160,10 @@ private slots: QPointer m_mainWidget; QVBoxLayout* m_layout; - PdmUiTreeViewWidget* m_treeView; - PdmUiTreeViewQModel* m_treeViewModel; - PdmUiTreeViewItemDelegate* m_delegate; - QSortFilterProxyModel* m_filterModel; + QPointer m_treeView; + QPointer m_treeViewModel; + QPointer m_delegate; + QPointer m_filterModel; bool m_useDefaultContextMenu; bool m_updateSelectionManager; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp index a3247bbfc7..d5686dc473 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp @@ -61,6 +61,18 @@ PdmUiTreeViewQModel::PdmUiTreeViewQModel( PdmUiTreeViewEditor* treeViewEditor ) m_treeViewEditor = treeViewEditor; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +PdmUiTreeViewQModel::~PdmUiTreeViewQModel() +{ + if ( m_dragDropInterface ) + { + delete m_dragDropInterface; + m_dragDropInterface = nullptr; + } +} + //-------------------------------------------------------------------------------------------------- /// Will populate the tree with the contents of the Pdm data structure rooted at rootItem. /// Will not show the rootItem itself, only the children and downwards diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.h index 408f13462c..45959eedef 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.h @@ -60,6 +60,7 @@ class PdmUiTreeViewQModel : public QAbstractItemModel public: explicit PdmUiTreeViewQModel( PdmUiTreeViewEditor* treeViewEditor ); + virtual ~PdmUiTreeViewQModel(); void setPdmItemRoot( PdmUiItem* rootItem ); void updateSubTree( PdmUiItem* subTreeRoot ); diff --git a/GrpcInterface/RiaGrpcCallbacks.h b/GrpcInterface/RiaGrpcCallbacks.h index f7c2bb6cd2..fdef188e9d 100644 --- a/GrpcInterface/RiaGrpcCallbacks.h +++ b/GrpcInterface/RiaGrpcCallbacks.h @@ -85,6 +85,7 @@ class RiaGrpcServiceCallback : public RiaGrpcCallbackInterface { public: RiaGrpcServiceCallback( ServiceT* service ); + ~RiaGrpcServiceCallback(); QString name() const override; const RequestT& request() const; @@ -99,6 +100,14 @@ class RiaGrpcServiceCallback : public RiaGrpcCallbackInterface ReplyT m_reply; }; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +template +RiaGrpcServiceCallback::~RiaGrpcServiceCallback() +{ +} + //================================================================================================== // // Templated gRPC-callback for non-streaming services diff --git a/GrpcInterface/RiaGrpcServer.cpp b/GrpcInterface/RiaGrpcServer.cpp index f89ba9af87..7dc9eff813 100644 --- a/GrpcInterface/RiaGrpcServer.cpp +++ b/GrpcInterface/RiaGrpcServer.cpp @@ -74,6 +74,7 @@ class RiaGrpcServerImpl std::unique_ptr m_server; std::list> m_services; std::list m_unprocessedRequests; + std::list m_allocatedCallbakcs; std::mutex m_requestMutex; std::thread m_thread; }; @@ -217,6 +218,12 @@ void RiaGrpcServerImpl::quit() m_server.reset(); m_completionQueue.reset(); + for ( auto c : m_allocatedCallbakcs ) + { + delete c; + } + m_allocatedCallbakcs.clear(); + // Finally clear services m_services.clear(); } @@ -253,6 +260,8 @@ void RiaGrpcServerImpl::process( RiaGrpcCallbackInterface* method ) if ( method->callState() == RiaGrpcCallbackInterface::CREATE_HANDLER ) { method->createRequestHandler( m_completionQueue.get() ); + + m_allocatedCallbakcs.push_back( method ); } else if ( method->callState() == RiaGrpcCallbackInterface::INIT_REQUEST_STARTED ) { @@ -269,7 +278,11 @@ void RiaGrpcServerImpl::process( RiaGrpcCallbackInterface* method ) else { method->onFinishRequest(); + process( method->createNewFromThis() ); + + m_allocatedCallbakcs.remove( method ); + delete method; } } From 32614152a6f28eef7f83fb9733e7ccd57b4459ca Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 3 Mar 2022 10:15:58 +0100 Subject: [PATCH 158/406] Memory Management : Fix memory leak in bounding box tree --- Fwk/VizFwk/LibGeometry/cvfBoundingBoxTree.cpp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Fwk/VizFwk/LibGeometry/cvfBoundingBoxTree.cpp b/Fwk/VizFwk/LibGeometry/cvfBoundingBoxTree.cpp index 89086e5467..7fbc9d3e8b 100644 --- a/Fwk/VizFwk/LibGeometry/cvfBoundingBoxTree.cpp +++ b/Fwk/VizFwk/LibGeometry/cvfBoundingBoxTree.cpp @@ -187,6 +187,9 @@ namespace cvf { AABBTreeNodeInternal* createNode(); AABBTreeNodeLeaf* createOrAssignLeaf(size_t leafIndex, size_t bbId); + private: + static void deleteInternalNodesBottomUp(AABBTreeNode* node); + protected: struct InternalNodeAndRange { @@ -598,6 +601,7 @@ bool AABBTree::buildTree(AABBTreeNodeInternal* pNode, size_t iFromIdx, size_t iT return true; } + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -606,6 +610,8 @@ void AABBTree::freeThis() // Delete all the internal nodes if (m_pRoot) { + AABBTree::deleteInternalNodesBottomUp(m_pRoot); + m_pRoot = NULL; } @@ -781,6 +787,24 @@ cvf::AABBTreeNodeLeaf* AABBTree::createOrAssignLeaf(size_t leafIndex, size_t bbI return leaf; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void AABBTree::deleteInternalNodesBottomUp(AABBTreeNode* node) +{ + // All leaf nodes (AABBTreeNodeLeaf) are allocated in m_leafPool and does not require a delete + if (node->type() == AB_LEAF) return; + + auto internalNode = dynamic_cast(node); + CVF_ASSERT(internalNode); + + AABBTree::deleteInternalNodesBottomUp(internalNode->left()); + AABBTree::deleteInternalNodesBottomUp(internalNode->right()); + + delete internalNode; +} + //-------------------------------------------------------------------------------------------------- /// Creates leafs for the supplied valid bounding boxes, keeping the original index //-------------------------------------------------------------------------------------------------- From 84694cdbc3ff0ca1b76e33a890905cb0dc2b7284 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 3 Mar 2022 10:16:21 +0100 Subject: [PATCH 159/406] Memory Management : Fix memory leak in FaultRASettings --- .../ProjectDataModel/Faults/RimFaultRASettings.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.h b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.h index 94d7b96225..d05ecffb03 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.h +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.h @@ -18,6 +18,7 @@ #pragma once #include "cafPdmChildArrayField.h" +#include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmPtrField.h" @@ -113,6 +114,6 @@ class RimFaultRASettings : public caf::PdmObject caf::PdmChildArrayField m_basicParameters; caf::PdmChildArrayField m_advancedParameters; - caf::PdmPtrField m_basicParametersRI; - caf::PdmPtrField m_advancedParametersRI; + caf::PdmChildField m_basicParametersRI; + caf::PdmChildField m_advancedParametersRI; }; From a32dda2e657d49c36905f1a8c171c481fb0e059c Mon Sep 17 00:00:00 2001 From: magnesj Date: Fri, 4 Mar 2022 02:12:45 +0000 Subject: [PATCH 160/406] Fixes by clang-tidy --- ApplicationLibCode/UserInterface/RiuMainWindowBase.h | 2 +- ApplicationLibCode/UserInterface/RiuMdiArea.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index dc2d6608f1..8f10db2864 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -48,7 +48,7 @@ class RiuMainWindowBase : public QMainWindow public: RiuMainWindowBase(); - ~RiuMainWindowBase(); + ~RiuMainWindowBase() override; virtual QString mainWindowName() = 0; diff --git a/ApplicationLibCode/UserInterface/RiuMdiArea.h b/ApplicationLibCode/UserInterface/RiuMdiArea.h index 4d93fcd866..ff78ff4bc9 100644 --- a/ApplicationLibCode/UserInterface/RiuMdiArea.h +++ b/ApplicationLibCode/UserInterface/RiuMdiArea.h @@ -30,7 +30,7 @@ class RiuMdiArea : public QMdiArea public: RiuMdiArea( QWidget* parent = nullptr ); - ~RiuMdiArea(); + ~RiuMdiArea() override; std::list subWindowListSortedByPosition(); From abff06d2d5d282284ebb2515c4921e2f1c5cb54a Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Fri, 4 Mar 2022 10:52:17 +0100 Subject: [PATCH 161/406] Summary multiplot improvements (#8598) * Create multi summary plot from summary plot(s) * Rearrange multi summary plot properties * Enable source stepping toolbar for multi summary plot * Automatically activate new summary plot when creating from data sources -> data vector tree * Enable global key controls for switching data in summary and multi summary plots * Update tooltip texts for summary plot toolbar --- .../Application/RiaGuiApplication.cpp | 16 +- .../Application/RiaGuiApplication.h | 4 +- .../CMakeLists_files.cmake | 2 + .../RicNewSummaryMultiPlotFeature.cpp | 73 +++-- .../RicNewSummaryMultiPlotFeature.h | 9 +- ...wSummaryMultiPlotFromDataVectorFeature.cpp | 115 +++++++ ...NewSummaryMultiPlotFromDataVectorFeature.h | 37 +++ ...RicNewSummaryPlotFromDataVectorFeature.cpp | 4 + .../RicSummaryPlotBuilder.cpp | 66 ++++ .../RicSummaryPlotBuilder.h | 12 +- .../RimAbstractPlotCollection.h | 2 +- .../RimContextCommandBuilder.cpp | 3 +- .../RimMainPlotCollection.cpp | 14 + .../ProjectDataModel/RimMainPlotCollection.h | 3 + .../ProjectDataModel/RimMultiPlot.cpp | 15 +- .../ProjectDataModel/RimMultiPlot.h | 4 +- .../RimMultiPlotCollection.cpp | 31 +- .../ProjectDataModel/RimMultiPlotCollection.h | 9 +- .../ProjectDataModel/RimPlotWindow.cpp | 8 + .../ProjectDataModel/RimPlotWindow.h | 3 + .../ProjectDataModel/RimProject.cpp | 6 + .../ProjectDataModel/RimVfpPlotCollection.h | 2 +- .../Summary/CMakeLists_files.cmake | 4 + .../Summary/RimSummaryMultiPlot.cpp | 299 ++++-------------- .../Summary/RimSummaryMultiPlot.h | 49 +-- .../Summary/RimSummaryMultiPlotCollection.cpp | 85 +++++ .../Summary/RimSummaryMultiPlotCollection.h | 49 +++ .../Summary/RimSummaryPlot.cpp | 56 +--- .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 +- .../Summary/RimSummaryPlotControls.cpp | 123 +++++++ .../Summary/RimSummaryPlotControls.h | 40 +++ .../Summary/RimSummaryPlotManager.cpp | 4 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 19 +- .../UserInterface/RiuMainWindowBase.cpp | 11 +- .../UserInterface/RiuPlotMainWindow.cpp | 30 +- 35 files changed, 791 insertions(+), 420 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.h create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.h diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 4177675a39..bfab7335f7 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -125,6 +125,7 @@ #include #include #include +#include #include #include #include @@ -1681,13 +1682,24 @@ bool RiaGuiApplication::notify( QObject* receiver, QEvent* event ) "unstable and will probably crash soon." ); } - bool done = true; + bool done = false; try { - done = QApplication::notify( receiver, event ); + if ( event->type() == QEvent::KeyPress ) + { + QKeyEvent* keyEvent = static_cast( event ); + + RimPlotWindow* plot = dynamic_cast( activePlotWindow() ); + if ( plot ) done = plot->handleGlobalKeyEvent( keyEvent ); + } + if ( !done ) + { + done = QApplication::notify( receiver, event ); + } } catch ( const std::bad_alloc& ) { + done = true; if ( memoryExhaustedBox ) memoryExhaustedBox->exec(); std::cout << "ResInsight: Memory is Exhausted!\n ResInsight could not allocate the memory needed, and is now " "unstable " diff --git a/ApplicationLibCode/Application/RiaGuiApplication.h b/ApplicationLibCode/Application/RiaGuiApplication.h index 257a21ea04..f01573a85a 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.h +++ b/ApplicationLibCode/Application/RiaGuiApplication.h @@ -134,6 +134,8 @@ class RiaGuiApplication : public QApplication, public RiaApplication void showFormattedTextInMessageBoxOrConsole( const QString& errMsg ) override; protected: + bool notify( QObject* receiver, QEvent* event ) override; + // Protected RiaApplication overrides void invokeProcessEvents( QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents ) override; void onFileSuccessfullyLoaded( const QString& fileName, RiaDefines::ImportFileType fileType ) override; @@ -159,8 +161,6 @@ class RiaGuiApplication : public QApplication, public RiaApplication void storeTreeViewState(); - bool notify( QObject*, QEvent* ) override; - private slots: void slotWorkerProcessFinished( int exitCode, QProcess::ExitStatus exitStatus ); void onLastWindowClosed(); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake index f69aa82445..6e5569c6ca 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake @@ -3,6 +3,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotBuilder.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromDataVectorFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -10,6 +11,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotBuilder.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromDataVectorFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp index bdb3bc0f4b..decf510dd2 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2021 Equinor ASA +// Copyright (C) 2022 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 @@ -19,8 +19,10 @@ #include "RicNewSummaryMultiPlotFeature.h" #include "RimMultiPlotCollection.h" -#include "RimPlot.h" #include "RimSummaryMultiPlot.h" +#include "RimSummaryPlot.h" + +#include "RicSummaryPlotBuilder.h" #include "cafSelectionManager.h" #include "cvfAssert.h" @@ -34,49 +36,82 @@ RICF_SOURCE_INIT( RicNewSummaryMultiPlotFeature, "RicNewSummaryMultiPlotFeature" //-------------------------------------------------------------------------------------------------- RicNewSummaryMultiPlotFeature::RicNewSummaryMultiPlotFeature() { + CAF_PDM_InitFieldNoDefault( &m_plots, "plots", "Plots" ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmScriptResponse RicNewSummaryMultiPlotFeature::execute() +bool RicNewSummaryMultiPlotFeature::isCommandEnabled() { - std::vector plots; - RimSummaryMultiPlot::createAndAppendMultiPlot( plots ); + auto plots = selectedPlots(); - return caf::PdmScriptResponse(); + std::vector selectedUiItems; + caf::SelectionManager::instance()->selectedItems( selectedUiItems ); + + return !plots.empty() && plots.size() == selectedUiItems.size(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RicNewSummaryMultiPlotFeature::isCommandEnabled() +void RicNewSummaryMultiPlotFeature::onActionTriggered( bool isChecked ) { - RimMultiPlotCollection* objToFind = nullptr; - - auto pdmUiItem = caf::SelectionManager::instance()->selectedItem(); - auto objHandle = dynamic_cast( pdmUiItem ); - if ( objHandle ) + m_plots.v().clear(); + auto plots = selectedPlots(); + for ( RimPlot* plot : plots ) { - objHandle->firstAncestorOrThisOfType( objToFind ); + m_plots.v().push_back( reinterpret_cast( plot ) ); } + execute(); +} - return ( objToFind != nullptr ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSummaryMultiPlotFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Create Summary Multi Plot from Selected Plots" ); + actionToSetup->setIcon( QIcon( ":/MultiPlot16x16.png" ) ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicNewSummaryMultiPlotFeature::onActionTriggered( bool isChecked ) +std::vector RicNewSummaryMultiPlotFeature::selectedPlots() { - execute(); + std::vector uiItems; + caf::SelectionManager::instance()->selectedItems( uiItems ); + + std::vector plots; + for ( caf::PdmUiItem* uiItem : uiItems ) + { + RimSummaryPlot* summaryPlot = dynamic_cast( uiItem ); + if ( summaryPlot ) + { + plots.push_back( summaryPlot ); + } + } + return plots; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicNewSummaryMultiPlotFeature::setupActionLook( QAction* actionToSetup ) +caf::PdmScriptResponse RicNewSummaryMultiPlotFeature::execute() { - actionToSetup->setText( "Create Summary Multi Plot" ); - actionToSetup->setIcon( QIcon( ":/MultiPlot16x16.png" ) ); + if ( !m_plots().empty() ) + { + std::vector plots; + for ( auto ptr : m_plots() ) + { + plots.push_back( reinterpret_cast( ptr ) ); + } + + auto copyOfPlots = RicSummaryPlotBuilder::duplicateSummaryPlots( plots ); + + RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( copyOfPlots ); + } + + return caf::PdmScriptResponse(); } diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h index 0836072f2c..67c9370ce1 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2021 Equinor ASA +// Copyright (C) 2022 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 @@ -25,7 +25,7 @@ #include -class RimPlot; +class RimSummaryPlot; //================================================================================================== /// @@ -43,4 +43,9 @@ class RicNewSummaryMultiPlotFeature : public caf::CmdFeature, public RicfCommand bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; + +private: + static std::vector selectedPlots(); + + caf::PdmField> m_plots; }; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp new file mode 100644 index 0000000000..0ef4b3f488 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp @@ -0,0 +1,115 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicNewSummaryMultiPlotFromDataVectorFeature.h" + +#include "RiaSummaryTools.h" +#include "RimSummaryAddress.h" +#include "RimSummaryPlot.h" +#include "RimSummaryPlotCollection.h" + +#include "RicSummaryPlotBuilder.h" + +#include "RifEclipseSummaryAddress.h" + +#include "cafSelectionManagerTools.h" +#include "cvfAssert.h" + +#include + +CAF_CMD_SOURCE_INIT( RicNewSummaryMultiPlotFromDataVectorFeature, "RicNewSummaryMultiPlotFromDataVectorFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewSummaryMultiPlotFromDataVectorFeature::isCommandEnabled() +{ + std::vector selectedItems; + caf::SelectionManager::instance()->selectedItems( selectedItems ); + + std::vector selectedAddressItems = caf::selectedObjectsByType(); + + unsigned int nEnsembles = 0; + + for ( auto adr : selectedAddressItems ) + { + if ( adr->isEnsemble() ) nEnsembles++; + } + + bool bOk = ( selectedAddressItems.size() > 0 ); + if ( nEnsembles > 0 ) + { + bOk = bOk && ( nEnsembles == selectedItems.size() ); + } + bOk = bOk && ( selectedAddressItems.size() == selectedItems.size() ); + + return bOk; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSummaryMultiPlotFromDataVectorFeature::onActionTriggered( bool isChecked ) +{ + std::vector selectedAddressItems = caf::selectedObjectsByType(); + std::set caseIds; + std::set ensembleIds; + std::vector selectedCases; + std::set eclipseAddresses; + std::vector selectedEnsembles; + + bool isEnsemble = false; + + for ( auto adr : selectedAddressItems ) + { + eclipseAddresses.insert( adr->address() ); + caseIds.insert( adr->caseId() ); + ensembleIds.insert( adr->ensembleId() ); + isEnsemble = isEnsemble || adr->isEnsemble(); + } + + if ( isEnsemble ) + { + for ( auto id : ensembleIds ) + { + selectedEnsembles.push_back( RiaSummaryTools::ensembleById( id ) ); + } + } + else + { + for ( auto id : caseIds ) + { + selectedCases.push_back( RiaSummaryTools::summaryCaseById( id ) ); + } + } + + auto newPlot = RicSummaryPlotBuilder::createPlot( eclipseAddresses, selectedCases, selectedEnsembles ); + + std::vector plots{ newPlot }; + + RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( plots ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSummaryMultiPlotFromDataVectorFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "New Multi Summary Plot" ); + actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.h new file mode 100644 index 0000000000..860eba06c2 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RicfCommandObject.h" + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicNewSummaryMultiPlotFromDataVectorFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + // Overrides + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp index 5b888c26a7..fef0068066 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp @@ -27,6 +27,8 @@ #include "RifEclipseSummaryAddress.h" +#include "RiuPlotMainWindowTools.h" + #include "cafSelectionManagerTools.h" #include "cvfAssert.h" @@ -108,6 +110,8 @@ void RicNewSummaryPlotFromDataVectorFeature::onActionTriggered( bool isChecked ) newPlot->loadDataAndUpdate(); plotCollection->updateConnectedEditors(); + + RiuPlotMainWindowTools::selectAsCurrentItem( newPlot, true ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 0bf2790758..5fe5ed645a 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -36,6 +36,8 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindowTools.h" @@ -292,6 +294,27 @@ std::vector RicSummaryPlotBuilder::duplicatePlots( const std::vector RicSummaryPlotBuilder::duplicateSummaryPlots( const std::vector& sourcePlots ) +{ + std::vector plots; + + for ( auto plot : sourcePlots ) + { + auto copy = + dynamic_cast( plot->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + + if ( copy ) + { + plots.push_back( copy ); + } + } + + return plots; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -335,6 +358,49 @@ void RicSummaryPlotBuilder::appendPlotsToMultiPlot( RimMultiPlot* multiPlot, con } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( const std::vector& plots ) +{ + RimProject* project = RimProject::current(); + auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); + + auto* plotWindow = new RimSummaryMultiPlot(); + plotWindow->setMultiPlotTitle( QString( "Multi Summary Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) ); + plotWindow->setAsPlotMdiWindow(); + plotCollection->addMultiSummaryPlot( plotWindow ); + + appendPlotsToSummaryMultiPlot( plotWindow, plots ); + + plotCollection->updateAllRequiredEditors(); + plotWindow->loadDataAndUpdate(); + + RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); + plotWindow->updateAllRequiredEditors(); + + return plotWindow; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotBuilder::appendPlotsToSummaryMultiPlot( RimSummaryMultiPlot* multiPlot, + const std::vector& plots ) +{ + for ( auto plot : plots ) + { + plot->revokeMdiWindowStatus(); + + multiPlot->addPlot( plot ); + + plot->resolveReferencesRecursively(); + plot->setShowWindow( true ); + + plot->loadDataAndUpdate(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h index 49b3267f99..5af00cd7f7 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h @@ -26,6 +26,7 @@ class RimSummaryCaseCollection; class RimSummaryPlot; class RimEnsembleCurveSet; class RimSummaryCurve; +class RimSummaryMultiPlot; namespace caf { @@ -67,9 +68,14 @@ class RicSummaryPlotBuilder static RimEnsembleCurveSet* createCurveSet( RimSummaryCaseCollection* ensemble, const RifEclipseSummaryAddress& addr ); static RimSummaryCurve* createCurve( RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& addr ); - static std::vector duplicatePlots( const std::vector& plots ); - static RimMultiPlot* createAndAppendMultiPlot( const std::vector& plots ); - static void appendPlotsToMultiPlot( RimMultiPlot* multiPlot, const std::vector& plots ); + static std::vector duplicatePlots( const std::vector& plots ); + static std::vector duplicateSummaryPlots( const std::vector& plots ); + + static RimMultiPlot* createAndAppendMultiPlot( const std::vector& plots ); + static void appendPlotsToMultiPlot( RimMultiPlot* multiPlot, const std::vector& plots ); + + static RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vector& plots ); + static void appendPlotsToSummaryMultiPlot( RimSummaryMultiPlot* multiPlot, const std::vector& plots ); static RimSummaryPlot* createPlot( const std::set& addresses, const std::vector& summaryCases, diff --git a/ApplicationLibCode/ProjectDataModel/RimAbstractPlotCollection.h b/ApplicationLibCode/ProjectDataModel/RimAbstractPlotCollection.h index 4e5cca6fa7..1f7d15e226 100644 --- a/ApplicationLibCode/ProjectDataModel/RimAbstractPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimAbstractPlotCollection.h @@ -68,7 +68,7 @@ class RimTypedPlotCollection : public RimAbstractPlotCollection } } - void addPlot( RimPlotType* plot ) { insertPlot( plot, plotCount() ); } + virtual void addPlot( RimPlotType* plot ) { insertPlot( plot, plotCount() ); } virtual void insertPlot( RimPlotType* plot, size_t index ) = 0; virtual void removePlot( RimPlotType* plot ) = 0; void removeRimPlot( RimPlot* rimPlot ) override diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index f01e992960..041d4149c6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1065,6 +1065,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewDerivedEnsembleFeature"; menuBuilder << "RicNewSummaryPlotFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; + menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder << "RicSummaryCurveSwitchAxisFeature"; menuBuilder << "RicNewDerivedSummaryFeature"; @@ -1104,7 +1105,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicCloseObservedDataFeature"; menuBuilder << "RicNewMultiPlotFeature"; - menuBuilder << "RicNewSummaryMultiPlotFeature"; // Work in progress -- End @@ -1189,6 +1189,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewSummaryPlotFromDataVectorFeature"; + menuBuilder << "RicNewSummaryMultiPlotFromDataVectorFeature"; } #ifdef USE_ODB_API else if ( dynamic_cast( firstUiItem ) ) diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp index 503979b3c9..a683c5d91a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp @@ -38,6 +38,7 @@ #include "RimStimPlanModelPlotCollection.h" #include "RimSummaryAddress.h" #include "RimSummaryCrossPlotCollection.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlotCollection.h" #include "RimVfpPlotCollection.h" #include "RimViewWindow.h" @@ -82,6 +83,9 @@ RimMainPlotCollection::RimMainPlotCollection() CAF_PDM_InitFieldNoDefault( &m_summaryPlotCollection, "SummaryPlotCollection", "Summary Plots" ); m_summaryPlotCollection.uiCapability()->setUiTreeHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_summaryMultiPlotCollection, "SummaryMultiPlotCollection", "Multi Summary Plots" ); + m_summaryMultiPlotCollection.uiCapability()->setUiTreeHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_analysisPlotCollection, "AnalysisPlotCollection", "Analysis Plots" ); m_analysisPlotCollection.uiCapability()->setUiTreeHidden( true ); @@ -122,6 +126,7 @@ RimMainPlotCollection::RimMainPlotCollection() m_rftPlotCollection = new RimRftPlotCollection(); m_pltPlotCollection = new RimPltPlotCollection(); m_summaryPlotCollection = new RimSummaryPlotCollection(); + m_summaryMultiPlotCollection = new RimSummaryMultiPlotCollection(); m_summaryCrossPlotCollection = new RimSummaryCrossPlotCollection(); m_flowPlotCollection = new RimFlowPlotCollection(); m_gridCrossPlotCollection = new RimGridCrossPlotCollection; @@ -193,6 +198,14 @@ RimSummaryPlotCollection* RimMainPlotCollection::summaryPlotCollection() const return m_summaryPlotCollection(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlotCollection* RimMainPlotCollection::summaryMultiPlotCollection() const +{ + return m_summaryMultiPlotCollection(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -403,6 +416,7 @@ std::vector RimMainPlotCollection::allPlotCollections() cons std::vector plotCollections; plotCollections.push_back( wellLogPlotCollection() ); plotCollections.push_back( summaryPlotCollection() ); + plotCollections.push_back( summaryMultiPlotCollection() ); plotCollections.push_back( summaryCrossPlotCollection() ); plotCollections.push_back( gridCrossPlotCollection() ); plotCollections.push_back( analysisPlotCollection() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h index 8dcf15bcda..bd6d7eb35c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h @@ -33,6 +33,7 @@ class RimRftPlotCollection; class RimPltPlotCollection; class RimGridCrossPlotCollection; class RimMultiPlotCollection; +class RimSummaryMultiPlotCollection; class RimSummaryPlotCollection; class RimSummaryCrossPlotCollection; class RimSummaryPlot; @@ -65,6 +66,7 @@ class RimMainPlotCollection : public caf::PdmObject RimRftPlotCollection* rftPlotCollection() const; RimPltPlotCollection* pltPlotCollection() const; RimSummaryPlotCollection* summaryPlotCollection() const; + RimSummaryMultiPlotCollection* summaryMultiPlotCollection() const; RimSummaryCrossPlotCollection* summaryCrossPlotCollection() const; RimAnalysisPlotCollection* analysisPlotCollection() const; RimCorrelationPlotCollection* correlationPlotCollection() const; @@ -105,6 +107,7 @@ class RimMainPlotCollection : public caf::PdmObject caf::PdmChildField m_rftPlotCollection; caf::PdmChildField m_pltPlotCollection; caf::PdmChildField m_summaryPlotCollection; + caf::PdmChildField m_summaryMultiPlotCollection; caf::PdmChildField m_summaryCrossPlotCollection; caf::PdmChildField m_analysisPlotCollection; caf::PdmChildField m_correlationPlotCollection; diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index fe263fd2e9..fba50a9191 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -757,22 +757,9 @@ void RimMultiPlot::uiOrderingForMultiPlotLayout( QString uiConfigName, caf::PdmU uiOrdering.add( &m_showPlotWindowTitle ); uiOrdering.add( &m_plotWindowTitle ); uiOrdering.add( &m_showIndividualPlotTitles ); - RimPlotWindow::uiOrderingForPlotLayout( uiConfigName, uiOrdering ); uiOrdering.add( &m_subTitleFontSize ); - uiOrdering.add( &m_columnCount ); - uiOrdering.add( &m_rowsPerPage ); - uiOrdering.add( &m_majorTickmarkCount ); -} -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimMultiPlot::uiOrderingForSummaryMultiPlot( caf::PdmUiOrdering& uiOrdering ) const -{ - uiOrdering.add( &m_showPlotWindowTitle ); - uiOrdering.add( &m_plotWindowTitle ); - uiOrdering.add( &m_showIndividualPlotTitles ); - uiOrdering.add( &m_subTitleFontSize ); + RimPlotWindow::uiOrderingForPlotLayout( uiConfigName, uiOrdering ); uiOrdering.add( &m_columnCount ); uiOrdering.add( &m_rowsPerPage ); uiOrdering.add( &m_majorTickmarkCount ); diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index be4ca57e30..2e9f255e39 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -79,7 +79,6 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection& plots ); void deleteAllPlots() override; - void uiOrderingForSummaryMultiPlot( caf::PdmUiOrdering& uiOrdering ) const; size_t plotCount() const override; size_t plotIndex( const RimPlot* plot ) const; @@ -140,11 +139,12 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollectionsetUiTreeHidden( true ); caf::PdmFieldReorderCapability::addToField( &m_multiPlots ); - - CAF_PDM_InitFieldNoDefault( &m_multiSummaryPlots, "MultiSummaryPlots", "Multi Summary Plots" ); - m_multiSummaryPlots.uiCapability()->setUiTreeHidden( true ); - caf::PdmFieldReorderCapability::addToField( &m_multiSummaryPlots ); } //-------------------------------------------------------------------------------------------------- @@ -54,7 +49,6 @@ RimMultiPlotCollection::~RimMultiPlotCollection() void RimMultiPlotCollection::deleteAllPlots() { m_multiPlots.deleteAllChildObjects(); - m_multiSummaryPlots.deleteAllChildObjects(); } //-------------------------------------------------------------------------------------------------- @@ -65,18 +59,6 @@ std::vector RimMultiPlotCollection::multiPlots() const return m_multiPlots.childObjects(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimMultiPlot* RimMultiPlotCollection::createMultiPlot() -{ - RimMultiPlot* plot = new RimMultiPlot(); - plot->setAsPlotMdiWindow(); - - addMultiPlot( plot ); - return plot; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -85,14 +67,6 @@ void RimMultiPlotCollection::addMultiPlot( RimMultiPlot* plot ) m_multiPlots().push_back( plot ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimMultiPlotCollection::addMultiSummaryPlot( RimSummaryMultiPlot* plot ) -{ - m_multiSummaryPlots().push_back( plot ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -100,9 +74,6 @@ void RimMultiPlotCollection::loadDataAndUpdateAllPlots() { for ( const auto& p : m_multiPlots.childObjects() ) p->loadDataAndUpdate(); - - for ( const auto& p : m_multiSummaryPlots.childObjects() ) - p->loadDataAndUpdate(); } //-------------------------------------------------------------------------------------------------- @@ -110,5 +81,5 @@ void RimMultiPlotCollection::loadDataAndUpdateAllPlots() //-------------------------------------------------------------------------------------------------- size_t RimMultiPlotCollection::plotCount() const { - return m_multiPlots.size() + m_multiSummaryPlots.size(); + return m_multiPlots.size(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.h index e159c53ea1..74226c5681 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.h @@ -23,7 +23,6 @@ #include "cafPdmObject.h" class RimMultiPlot; -class RimSummaryMultiPlot; //================================================================================================== /// @@ -42,11 +41,9 @@ class RimMultiPlotCollection : public caf::PdmObject, public RimPlotCollection size_t plotCount() const override; std::vector multiPlots() const; - RimMultiPlot* createMultiPlot(); - void addMultiPlot( RimMultiPlot* plot ); - void addMultiSummaryPlot( RimSummaryMultiPlot* plot ); + + void addMultiPlot( RimMultiPlot* plot ); private: - caf::PdmChildArrayField m_multiPlots; - caf::PdmChildArrayField m_multiSummaryPlots; + caf::PdmChildArrayField m_multiPlots; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp index 5b2fdac363..1bf09c5fd1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp @@ -336,3 +336,11 @@ void RimPlotWindow::assignIdIfNecessary() RimProject::current()->assignPlotIdToPlotWindow( this ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotWindow::handleGlobalKeyEvent( QKeyEvent* keyEvent ) +{ + return false; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h index db99ed9968..d822179f45 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h @@ -75,6 +75,8 @@ class RimPlotWindow : public RimViewWindow void renderWindowContent( QPaintDevice* painter ); QPageLayout pageLayout() const; + virtual bool handleGlobalKeyEvent( QKeyEvent* keyEvent ); + protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; @@ -82,6 +84,7 @@ class RimPlotWindow : public RimViewWindow bool* useOptionsOnly ) override; void uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ); + void updateWindowVisibility(); private: diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index c5983cbce4..da016e3a61 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -76,6 +76,7 @@ #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCrossPlotCollection.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlotCollection.h" #include "RimSurfaceCollection.h" #include "RimTools.h" @@ -1377,6 +1378,11 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q uiTreeOrdering.add( mainPlotCollection->summaryPlotCollection() ); } + if ( mainPlotCollection->summaryMultiPlotCollection() ) + { + uiTreeOrdering.add( mainPlotCollection->summaryMultiPlotCollection() ); + } + if ( mainPlotCollection->analysisPlotCollection() ) { uiTreeOrdering.add( mainPlotCollection->analysisPlotCollection() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.h b/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.h index 61334f224f..9ea6ebfb4f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.h @@ -35,7 +35,7 @@ class RimVfpPlotCollection : public caf::PdmObject, public RimTypedPlotCollectio RimVfpPlotCollection(); ~RimVfpPlotCollection() override; - void addPlot( RimVfpPlot* newPlot ); + void addPlot( RimVfpPlot* newPlot ) override; std::vector plots() const override; void deleteAllChildObjects(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake index d87ee1e678..e96af9970f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -43,6 +43,8 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryNameHelper.h ${CMAKE_CURRENT_LIST_DIR}/RimMultipleSummaryPlotNameHelper.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressCollection.h + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.h + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -90,6 +92,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryNameHelper.cpp ${CMAKE_CURRENT_LIST_DIR}/RimMultipleSummaryPlotNameHelper.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressCollection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index cdae6042e4..1480bf501c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -29,6 +29,7 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" +#include "RimSummaryPlotControls.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" @@ -51,20 +52,8 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() CAF_PDM_InitObject( "Multi Summary Plot" ); this->setDeletable( true ); - CAF_PDM_InitFieldNoDefault( &m_filterText, "FilterText", "Filter Text" ); - m_filterText.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - - CAF_PDM_InitField( &m_individualPlotPerVector, "IndividualPlotPerVector", false, "One plot per Vector" ); - CAF_PDM_InitField( &m_individualPlotPerObject, "IndividualPlotPerObject", false, "One plot per Object" ); - CAF_PDM_InitField( &m_individualPlotPerDataSource, "IndividualPlotPerDataSource", false, "One plot per Data Source" ); - CAF_PDM_InitField( &m_autoPlotTitles, "AutoPlotTitles", false, "Auto Plot Titles" ); - CAF_PDM_InitField( &m_autoPlotTitlesOnSubPlots, "AutoPlotTitlesSubPlots", false, "Auto Plot Titles Sub Plots" ); - - CAF_PDM_InitField( &m_showMultiPlotInProjectTree, "ShowMultiPlotInProjectTree", true, "Show Multi Plot In Project Tree" ); - - CAF_PDM_InitFieldNoDefault( &m_multiPlot, "MultiPlot", "Multi Plot" ); - m_multiPlot.uiCapability()->setUiTreeHidden( true ); - m_multiPlot = new RimMultiPlot; + CAF_PDM_InitField( &m_autoPlotTitles, "AutoPlotTitles", true, "Auto Plot Titles" ); + CAF_PDM_InitField( &m_autoPlotTitlesOnSubPlots, "AutoPlotTitlesSubPlots", true, "Auto Plot Titles Sub Plots" ); CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); m_sourceStepping = new RimSummaryPlotSourceStepping; @@ -82,67 +71,26 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlot::~RimSummaryMultiPlot() { - removeMdiWindowFromMdiArea(); - m_multiPlot->cleanupBeforeClose(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* RimSummaryMultiPlot::viewWidget() -{ - return m_multiPlot->viewWidget(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QImage RimSummaryMultiPlot::snapshotWindowContent() -{ - return m_multiPlot->snapshotWindowContent(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::zoomAll() -{ - m_multiPlot->zoomAll(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimSummaryMultiPlot::description() const +void RimSummaryMultiPlot::addPlot( RimPlot* plot ) { - return "RimSummaryMultiPlot Placeholder Text"; + RimSummaryPlot* sumPlot = dynamic_cast( plot ); + CVF_ASSERT( sumPlot != nullptr ); + if ( sumPlot ) RimMultiPlot::addPlot( plot ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::addPlot( RimSummaryPlot* plot ) +void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) { - m_multiPlot->addPlot( plot ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryMultiPlot* RimSummaryMultiPlot::createAndAppendMultiPlot( const std::vector& plots ) -{ - RimProject* project = RimProject::current(); - auto* plotCollection = project->mainPlotCollection()->multiPlotCollection(); - - auto* plotWindow = new RimSummaryMultiPlot; - plotWindow->setAsPlotMdiWindow(); - plotCollection->addMultiSummaryPlot( plotWindow ); - - insertGraphsIntoPlot( plotWindow, plots ); - - plotCollection->updateAllRequiredEditors(); - - return plotWindow; + RimSummaryPlot* sumPlot = dynamic_cast( plot ); + CVF_ASSERT( sumPlot != nullptr ); + if ( sumPlot ) RimMultiPlot::insertPlot( plot, index ); } //-------------------------------------------------------------------------------------------------- @@ -235,83 +183,32 @@ void RimSummaryMultiPlot::populateNameHelper( RimSummaryPlotNameHelper* nameHelp nameHelper->setEnsembleCases( ensembleCases ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* RimSummaryMultiPlot::createViewWidget( QWidget* mainWindowParent /*= nullptr*/ ) -{ - return m_multiPlot->createViewWidget( mainWindowParent ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::deleteViewWidget() -{ - m_multiPlot->deleteViewWidget(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::onLoadDataAndUpdate() -{ - updateMdiWindowVisibility(); - - if ( m_autoPlotTitles ) - { - updatePlotTitles(); - } - - m_multiPlot->onLoadDataAndUpdate(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::doRenderWindowContent( QPaintDevice* paintDevice ) -{ - m_multiPlot->doRenderWindowContent( paintDevice ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QList RimSummaryMultiPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) -{ - QList options; - return options; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - uiOrdering.add( &m_autoPlotTitles ); - uiOrdering.add( &m_autoPlotTitlesOnSubPlots ); - - { - auto group = uiOrdering.addNewGroup( "Data Source" ); - m_sourceStepping()->uiOrdering( uiConfigName, *group ); - } - - auto group = uiOrdering.addNewGroup( "Multi Plot Options" ); - m_multiPlot->uiOrderingForSummaryMultiPlot( *group ); - - { - auto group = uiOrdering.addNewGroup( "Graph Building" ); - group->setCollapsedByDefault( true ); - - group->add( &m_filterText ); - group->add( &m_individualPlotPerVector ); - group->add( &m_individualPlotPerDataSource ); - group->add( &m_individualPlotPerObject ); - } - uiOrdering.add( &m_showMultiPlotInProjectTree ); - - uiOrdering.skipRemainingFields(); + caf::PdmUiGroup* titlesGroup = uiOrdering.addNewGroup( "Titles" ); + titlesGroup->add( &m_autoPlotTitles ); + titlesGroup->add( &m_autoPlotTitlesOnSubPlots ); + + titlesGroup->add( &m_showPlotWindowTitle ); + titlesGroup->add( &m_plotWindowTitle ); + titlesGroup->add( &m_showIndividualPlotTitles ); + titlesGroup->add( &m_titleFontSize ); + titlesGroup->add( &m_subTitleFontSize ); + + caf::PdmUiGroup* legendsGroup = uiOrdering.addNewGroup( "Legends" ); + legendsGroup->add( &m_showPlotLegends ); + legendsGroup->add( &m_plotLegendsHorizontal ); + legendsGroup->add( &m_legendFontSize ); + + caf::PdmUiGroup* layoutGroup = uiOrdering.addNewGroup( "Layout" ); + layoutGroup->add( &m_columnCount ); + layoutGroup->add( &m_rowsPerPage ); + layoutGroup->add( &m_majorTickmarkCount ); + + uiOrdering.skipRemainingFields( true ); } //-------------------------------------------------------------------------------------------------- @@ -321,110 +218,29 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi const QVariant& oldValue, const QVariant& newValue ) { - RimPlotWindow::fieldChangedByUi( changedField, oldValue, newValue ); - - if ( changedField == &m_showWindow && m_showWindow() ) - { - // Plots contained in a RimMultiPlot will automatically be set invisible - // Restore plot visibility - - for ( auto p : m_multiPlot->plots() ) - { - p->setShowWindow( true ); - } - } - else if ( changedField == &m_filterText || changedField == &m_individualPlotPerDataSource || - changedField == &m_individualPlotPerVector || changedField == &m_individualPlotPerObject ) - { - updatePlots(); - } - else if ( changedField == &m_autoPlotTitles || changedField == &m_autoPlotTitlesOnSubPlots ) + if ( changedField == &m_autoPlotTitles || changedField == &m_autoPlotTitlesOnSubPlots ) { onLoadDataAndUpdate(); updateLayout(); } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::defineEditorAttribute( const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute ) -{ - if ( field == &m_filterText ) + else { - auto attr = dynamic_cast( attribute ); - if ( attr ) - { - attr->enableEditableContent = true; - attr->enableAutoComplete = false; - attr->adjustWidthToContents = true; - attr->notifyWhenTextIsEdited = true; - } + RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) +void RimSummaryMultiPlot::updatePlotWindowTitle() { - uiTreeOrdering.skipRemainingChildren( !m_showMultiPlotInProjectTree ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::updatePlots() -{ - auto [addressFilters, dataSourceFilters] = - RiaSummaryStringTools::splitIntoAddressAndDataSourceFilters( m_filterText() ); - - auto [matchingSummaryCases, matchingEnsembles] = RiaSummaryStringTools::dataSourcesMatchingFilters( dataSourceFilters ); - - std::set allAddresses; - if ( !matchingSummaryCases.empty() ) - { - allAddresses = RicSummaryPlotBuilder::addressesForSource( matchingSummaryCases.front() ); - } - else if ( !matchingEnsembles.empty() ) - { - allAddresses = RicSummaryPlotBuilder::addressesForSource( matchingEnsembles.front() ); - } - - bool includeDiffCurves = false; - auto filteredAddresses = - RiaSummaryStringTools::computeFilteredAddresses( addressFilters, allAddresses, includeDiffCurves ); - + if ( m_autoPlotTitles ) { - m_multiPlot->deleteAllPlots(); - - RicSummaryPlotBuilder plotBuilder; - plotBuilder.setAddresses( filteredAddresses ); - plotBuilder.setDataSources( matchingSummaryCases, matchingEnsembles ); - plotBuilder.setIndividualPlotPerDataSource( m_individualPlotPerDataSource ); - - RicSummaryPlotBuilder::RicGraphCurveGrouping groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::NONE; - if ( m_individualPlotPerVector ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::SINGLE_CURVES; - if ( m_individualPlotPerObject ) groping = RicSummaryPlotBuilder::RicGraphCurveGrouping::CURVES_FOR_OBJECT; - plotBuilder.setGrouping( groping ); + populateNameHelper( m_nameHelper.get() ); - auto plots = plotBuilder.createPlots(); - - insertGraphsIntoPlot( this, plots ); + auto title = m_nameHelper->plotTitle(); + setMultiPlotTitle( title ); } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::updatePlotTitles() -{ - populateNameHelper( m_nameHelper.get() ); - - auto title = m_nameHelper->plotTitle(); - m_multiPlot->setMultiPlotTitle( title ); if ( m_autoPlotTitlesOnSubPlots ) { @@ -473,7 +289,7 @@ std::vector RimSummaryMultiPlot::summaryPlots() const { std::vector typedPlots; - for ( auto plot : m_multiPlot->plots() ) + for ( auto plot : plots() ) { auto summaryPlot = dynamic_cast( plot ); if ( summaryPlot ) typedPlots.push_back( summaryPlot ); @@ -519,10 +335,10 @@ void RimSummaryMultiPlot::insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const plot->setAutoTitlePlot( true ); plot->setAutoTitleGraphs( showTitleSubGraph ); - plot->m_multiPlot->setColumnCount( columnCount ); - plot->m_multiPlot->setRowCount( rowCount ); - plot->m_multiPlot->setShowPlotTitles( showTitleSubGraph ); - plot->m_multiPlot->setTickmarkCount( tickmarkCount ); + plot->setColumnCount( columnCount ); + plot->setRowCount( rowCount ); + plot->setShowPlotTitles( showTitleSubGraph ); + plot->setTickmarkCount( tickmarkCount ); for ( auto graph : graphs ) { @@ -537,3 +353,28 @@ void RimSummaryMultiPlot::insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const plot->loadDataAndUpdate(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() +{ + std::vector toolBarFields; + + auto& sourceObject = m_sourceStepping(); + if ( sourceObject ) + { + auto fields = sourceObject->fieldsToShowInToolbar(); + toolBarFields.insert( std::end( toolBarFields ), std::begin( fields ), std::end( fields ) ); + } + + return toolBarFields; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryMultiPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent ) +{ + return RimSummaryPlotControls::handleKeyEvents( m_sourceStepping(), keyEvent ); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 28e10ebc8b..3c7a90c35c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -18,14 +18,15 @@ #pragma once -#include "RimPlotWindow.h" +#include "RimMultiPlot.h" #include "RimSummaryDataSourceStepping.h" #include "cafPdmChildField.h" #include "cafPdmObject.h" #include "cafPdmPtrArrayField.h" -class RimMultiPlot; +#include + class RimSummaryPlot; class RimSummaryPlotSourceStepping; class RimSummaryPlotNameHelper; @@ -35,7 +36,7 @@ class RimSummaryNameHelper; /// /// //================================================================================================== -class RimSummaryMultiPlot : public RimPlotWindow, public RimSummaryDataSourceStepping +class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStepping { CAF_PDM_HEADER_INIT; @@ -43,60 +44,38 @@ class RimSummaryMultiPlot : public RimPlotWindow, public RimSummaryDataSourceSte RimSummaryMultiPlot(); ~RimSummaryMultiPlot() override; - QWidget* viewWidget() override; - QImage snapshotWindowContent() override; - void zoomAll() override; - QString description() const override; - - void addPlot( RimSummaryPlot* plot ); - - void updatePlotTitles(); const RimSummaryNameHelper* nameHelper() const; void setAutoTitlePlot( bool enable ); void setAutoTitleGraphs( bool enable ); - static RimSummaryMultiPlot* createAndAppendMultiPlot( const std::vector& plots ); - std::vector availableAxes() const override; std::vector curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const override; std::vector curveSets() const override; std::vector allCurves( RimSummaryDataSourceStepping::Axis axis ) const override; -private: - QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) override; - void deleteViewWidget() override; - void onLoadDataAndUpdate() override; + void addPlot( RimPlot* plot ) override; + void insertPlot( RimPlot* plot, size_t index ) override; - void doRenderWindowContent( QPaintDevice* paintDevice ) override; + std::vector fieldsToShowInToolbar(); - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; +protected: + bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; +private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - void defineEditorAttribute( const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute ) override; - void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override; - - void updatePlots(); void populateNameHelper( RimSummaryPlotNameHelper* nameHelper ); std::vector summaryPlots() const; static void insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const std::vector& graphs ); + void updatePlotWindowTitle() override; + private: - caf::PdmField m_filterText; - caf::PdmField m_individualPlotPerVector; - caf::PdmField m_individualPlotPerDataSource; - caf::PdmField m_individualPlotPerObject; - caf::PdmField m_autoPlotTitles; - caf::PdmField m_autoPlotTitlesOnSubPlots; - - caf::PdmField m_showMultiPlotInProjectTree; - caf::PdmChildField m_multiPlot; + caf::PdmField m_autoPlotTitles; + caf::PdmField m_autoPlotTitlesOnSubPlots; caf::PdmChildField m_sourceStepping; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp new file mode 100644 index 0000000000..ce87a179a1 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -0,0 +1,85 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#include "RimSummaryMultiPlotCollection.h" + +#include "RimProject.h" +#include "RimSummaryMultiPlot.h" + +#include "cafPdmFieldReorderCapability.h" + +CAF_PDM_SOURCE_INIT( RimSummaryMultiPlotCollection, "RimSummaryMultiPlotCollection" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlotCollection::RimSummaryMultiPlotCollection() +{ + CAF_PDM_InitObject( "Summary Multi Plots", ":/MultiPlot16x16.png" ); + + CAF_PDM_InitFieldNoDefault( &m_summaryMultiPlots, "MultiSummaryPlots", "Multi Summary Plots" ); + m_summaryMultiPlots.uiCapability()->setUiTreeHidden( true ); + caf::PdmFieldReorderCapability::addToField( &m_summaryMultiPlots ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlotCollection::~RimSummaryMultiPlotCollection() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlotCollection::deleteAllPlots() +{ + m_summaryMultiPlots.deleteAllChildObjects(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryMultiPlotCollection::multiPlots() const +{ + return m_summaryMultiPlots.childObjects(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlotCollection::addMultiSummaryPlot( RimSummaryMultiPlot* plot ) +{ + m_summaryMultiPlots().push_back( plot ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlotCollection::loadDataAndUpdateAllPlots() +{ + for ( const auto& p : m_summaryMultiPlots.childObjects() ) + p->loadDataAndUpdate(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RimSummaryMultiPlotCollection::plotCount() const +{ + return m_summaryMultiPlots.size(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h new file mode 100644 index 0000000000..0b8cd4572e --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include "RimAbstractPlotCollection.h" + +#include "cafPdmChildArrayField.h" +#include "cafPdmObject.h" + +class RimSummaryMultiPlot; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimSummaryMultiPlotCollection : public caf::PdmObject, public RimPlotCollection +{ + CAF_PDM_HEADER_INIT; + +public: + RimSummaryMultiPlotCollection(); + ~RimSummaryMultiPlotCollection() override; + + void deleteAllPlots() override; + void loadDataAndUpdateAllPlots() override; + size_t plotCount() const override; + + std::vector multiPlots() const; + + void addMultiSummaryPlot( RimSummaryMultiPlot* plot ); + +private: + caf::PdmChildArrayField m_summaryMultiPlots; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 32e8a76dd1..97d30a9813 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -51,6 +51,7 @@ #include "RimSummaryCurvesData.h" #include "RimSummaryPlotAxisFormatter.h" #include "RimSummaryPlotCollection.h" +#include "RimSummaryPlotControls.h" #include "RimSummaryPlotFilterTextCurveSetEditor.h" #include "RimSummaryPlotNameHelper.h" #include "RimSummaryTimeAxisProperties.h" @@ -2279,60 +2280,9 @@ void RimSummaryPlot::reattachAllCurves() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::handleKeyPressEvent( QKeyEvent* keyEvent ) +bool RimSummaryPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent ) { - if ( !keyEvent ) return; - - if ( RiuTreeViewEventFilter::activateFeatureFromKeyEvent( keyEvent ) ) - { - return; - } - - RimSummaryPlotSourceStepping* sourceStepping = sourceSteppingObjectForKeyEventHandling(); - if ( !sourceStepping ) return; - - if ( keyEvent->key() == Qt::Key_PageUp ) - { - if ( keyEvent->modifiers() & Qt::ShiftModifier ) - { - sourceStepping->applyPrevCase(); - - keyEvent->accept(); - } - else if ( keyEvent->modifiers() & Qt::ControlModifier ) - { - sourceStepping->applyPrevOtherIdentifier(); - - keyEvent->accept(); - } - else - { - sourceStepping->applyPrevQuantity(); - - keyEvent->accept(); - } - } - else if ( keyEvent->key() == Qt::Key_PageDown ) - { - if ( keyEvent->modifiers() & Qt::ShiftModifier ) - { - sourceStepping->applyNextCase(); - - keyEvent->accept(); - } - else if ( keyEvent->modifiers() & Qt::ControlModifier ) - { - sourceStepping->applyNextOtherIdentifier(); - - keyEvent->accept(); - } - else - { - sourceStepping->applyNextQuantity(); - - keyEvent->accept(); - } - } + return RimSummaryPlotControls::handleKeyEvents( sourceSteppingObjectForKeyEventHandling(), keyEvent ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 03ecad72e7..f92b7e58b8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -208,8 +208,6 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void detachAllPlotItems(); void deleteAllPlotCurves(); - void handleKeyPressEvent( QKeyEvent* keyEvent ) override; - void onCurveCollectionChanged( const SignalEmitter* emitter ); void connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis ); @@ -231,6 +229,8 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping QImage snapshotWindowContent() override; + bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; + private slots: void onPlotZoomed(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.cpp new file mode 100644 index 0000000000..68f736a772 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.cpp @@ -0,0 +1,123 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimSummaryPlotControls.h" + +#include "RimSummaryPlotSourceStepping.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryPlotControls::handleKeyEvents( RimSummaryPlotSourceStepping* srcStepping, QKeyEvent* keyEvent ) +{ + if ( !keyEvent ) return false; + if ( !srcStepping ) return false; + + if ( !( keyEvent->modifiers() & Qt::ControlModifier ) ) return false; + + bool bHandled = false; + + if ( keyEvent->key() == Qt::Key_Left ) + { + srcStepping->applyPrevOtherIdentifier(); + keyEvent->accept(); + bHandled = true; + } + else if ( keyEvent->key() == Qt::Key_Right ) + { + srcStepping->applyNextOtherIdentifier(); + keyEvent->accept(); + bHandled = true; + } + else if ( keyEvent->key() == Qt::Key_PageDown ) + { + srcStepping->applyNextCase(); + keyEvent->accept(); + bHandled = true; + } + else if ( keyEvent->key() == Qt::Key_PageUp ) + { + srcStepping->applyPrevCase(); + keyEvent->accept(); + bHandled = true; + } + else if ( keyEvent->key() == Qt::Key_Up ) + { + srcStepping->applyPrevQuantity(); + keyEvent->accept(); + bHandled = true; + } + else if ( keyEvent->key() == Qt::Key_Down ) + { + srcStepping->applyNextQuantity(); + keyEvent->accept(); + bHandled = true; + } + + return bHandled; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryPlotControls::quantityNextKeyText() +{ + return QString( "Ctrl-Down" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryPlotControls::quantityPrevKeyText() +{ + return QString( "Ctrl-Up" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryPlotControls::caseNextKeyText() +{ + return QString( "Ctrl-PgDown" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryPlotControls::casePrevKeyText() +{ + return QString( "Ctrl-PgUp" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryPlotControls::otherNextKeyText() +{ + return QString( "Ctrl-Right" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryPlotControls::otherPrevKeyText() +{ + return QString( "Ctrl-Left" ); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.h new file mode 100644 index 0000000000..55f5c18962 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.h @@ -0,0 +1,40 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +class RimSummaryPlotSourceStepping; +class QKeyEvent; + +#include + +class RimSummaryPlotControls +{ +public: + static bool handleKeyEvents( RimSummaryPlotSourceStepping* srcStepping, QKeyEvent* keyEvent ); + + static QString quantityNextKeyText(); + static QString quantityPrevKeyText(); + static QString caseNextKeyText(); + static QString casePrevKeyText(); + static QString otherNextKeyText(); + static QString otherPrevKeyText(); + +private: + RimSummaryPlotControls() = default; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index 860f9d41af..c5d72bdf7f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -399,9 +399,7 @@ void RimSummaryPlotManager::createNewPlot() { { auto summaryPlots = plotBuilder.createPlots(); - auto plot = RimSummaryMultiPlot::createAndAppendMultiPlot( summaryPlots ); - - RiuPlotMainWindowTools::selectAsCurrentItem( plot ); + RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( summaryPlots ); } bool createStandardMultiPlot = false; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index bef8b73527..7e9e3fcb20 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -35,6 +35,7 @@ #include "RimSummaryDataSourceStepping.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" +#include "RimSummaryPlotControls.h" #include "RiuPlotMainWindow.h" @@ -976,25 +977,29 @@ void RimSummaryPlotSourceStepping::defineEditorAttribute( const caf::PdmFieldHan myAttr->nextIcon = QIcon( ":/ComboBoxDown.svg" ); myAttr->previousIcon = QIcon( ":/ComboBoxUp.svg" ); - QString modifierText; + QString nextText; + QString prevText; if ( field == &m_summaryCase ) { - modifierText = ( "(Shift+" ); + nextText = RimSummaryPlotControls::caseNextKeyText(); + prevText = RimSummaryPlotControls::casePrevKeyText(); } else if ( field == &m_wellName || field == &m_wellGroupName || field == &m_region ) { - modifierText = ( "(Ctrl+" ); + nextText = RimSummaryPlotControls::otherNextKeyText(); + prevText = RimSummaryPlotControls::otherPrevKeyText(); } else if ( field == &m_quantity ) { - modifierText = ( "(" ); + nextText = RimSummaryPlotControls::quantityNextKeyText(); + prevText = RimSummaryPlotControls::quantityPrevKeyText(); } - if ( !modifierText.isEmpty() ) + if ( !nextText.isEmpty() ) { - myAttr->nextButtonText = "Next " + modifierText + "PgDown)"; - myAttr->prevButtonText = "Previous " + modifierText + "PgUp)"; + myAttr->nextButtonText = "Next (" + nextText + ")"; + myAttr->prevButtonText = "Previous (" + prevText + ")"; } } diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 2bbe047119..1d6fda70d3 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -255,7 +255,16 @@ void RiuMainWindowBase::selectAsCurrentItem( const caf::PdmObject* object, bool m_allowActiveViewChangeFromSelection = allowActiveViewChange; auto tv = getTreeViewWithItem( object ); - if ( tv ) tv->selectAsCurrentItem( object ); + if ( tv ) + { + tv->selectAsCurrentItem( object ); + QDockWidget* dw = dynamic_cast( tv->parentWidget() ); + if ( dw ) + { + dw->show(); + dw->raise(); + } + } m_allowActiveViewChangeFromSelection = true; } diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index ce34060102..f5a9f66cd1 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -31,6 +31,7 @@ #include "RimProject.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCurveCollection.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" #include "RimSummaryPlotFilterTextCurveSetEditor.h" @@ -702,17 +703,22 @@ void RiuPlotMainWindow::updateMultiPlotToolBar() //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::updateSummaryPlotToolBar( bool forceUpdateUi ) { - RimSummaryPlot* summaryPlot = dynamic_cast( m_activePlotViewWindow.p() ); - RimMultiPlot* multiPlot = dynamic_cast( m_activePlotViewWindow.p() ); - if ( multiPlot ) + RimSummaryPlot* summaryPlot = dynamic_cast( m_activePlotViewWindow.p() ); + RimSummaryMultiPlot* summaryMultiPlot = dynamic_cast( m_activePlotViewWindow.p() ); + + std::vector toolBarFields; + + if ( summaryMultiPlot ) { - summaryPlot = caf::SelectionManager::instance()->selectedItemOfType(); + toolBarFields = summaryMultiPlot->fieldsToShowInToolbar(); } - - if ( summaryPlot ) + else if ( summaryPlot ) { - std::vector toolBarFields = summaryPlot->fieldsToShowInToolbar(); + toolBarFields = summaryPlot->fieldsToShowInToolbar(); + } + if ( toolBarFields.size() > 0 ) + { QString keyword; if ( !m_summaryPlotToolBarEditor->isEditorDataValid( toolBarFields ) ) @@ -997,6 +1003,16 @@ void RiuPlotMainWindow::selectedObjectsChanged() { updateSummaryPlotToolBar(); } + else + { + RimSummaryMultiPlot* multiSummaryPlot = nullptr; + firstSelectedObject->firstAncestorOrThisOfType( multiSummaryPlot ); + if ( multiSummaryPlot ) + { + updateSummaryPlotToolBar(); + updateMultiPlotToolBar(); + } + } } // The only way to get to this code is by selection change initiated from the project tree view From 1563ae7b58b4d799f27d06b609857d19a84264e9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Mar 2022 12:24:15 +0100 Subject: [PATCH 162/406] Merge pull request #8614 from OPM/minor-adjustments --- .../RicNewPlotAxisPropertiesFeature.cpp | 3 +- .../RimPlotAxisProperties.cpp | 13 +++++++-- .../ProjectDataModel/RimPlotAxisProperties.h | 4 ++- .../Summary/RimSummaryPlot.cpp | 28 ++++++++----------- .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 +-- .../cafPdmUiFormLayoutObjectEditor.cpp | 9 ++++++ .../cafPdmUiFormLayoutObjectEditor.h | 2 ++ .../cafPdmUiTreeViewEditor.cpp | 22 +++++++++++---- .../cafUserInterface/cafPdmUiTreeViewEditor.h | 4 +-- 9 files changed, 59 insertions(+), 30 deletions(-) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp index 6dcdcc8c9d..09e42f57ac 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp @@ -50,9 +50,8 @@ void RicNewPlotAxisPropertiesFeature::onActionTriggered( bool isChecked ) RimSummaryPlot* summaryPlot = summaryPlots[0]; - bool connectSignals = true; RimPlotAxisProperties* newPlotAxisProperties = - summaryPlot->addNewAxisProperties( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "New Axis", connectSignals ); + summaryPlot->addNewAxisProperties( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "New Axis" ); summaryPlot->updateConnectedEditors(); RiuPlotMainWindowTools::selectAsCurrentItem( newPlotAxisProperties ); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 4f68e30262..19ecc89b55 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -54,6 +54,7 @@ RimPlotAxisProperties::RimPlotAxisProperties() , axisPositionChanged( this ) , m_enableTitleTextSettings( true ) , m_isRangeSettingsEnabled( true ) + , m_isAlwaysRequired( false ) { CAF_PDM_InitObject( "Axis Properties", ":/LeftAxis16x16.png" ); @@ -97,13 +98,20 @@ RimPlotAxisProperties::RimPlotAxisProperties() updateOptionSensitivity(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::setAlwaysRequired( bool enable ) +{ + m_isAlwaysRequired = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RimPlotAxisProperties::isDeletable() const { - // The default axes (which have index 0) are not deletable - return m_plotAxisIndex != 0; + return !m_isAlwaysRequired; } //-------------------------------------------------------------------------------------------------- @@ -210,6 +218,7 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr scaleGroup.add( &m_valuesFontSize ); scaleGroup.add( &m_plotAxis ); + m_plotAxis.uiCapability()->setUiReadOnly( m_isAlwaysRequired ); uiOrdering.skipRemainingFields( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index a4eebc3389..23aea0b511 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -58,6 +58,8 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface public: RimPlotAxisProperties(); + void setAlwaysRequired( bool enable ); + void setEnableTitleTextSettings( bool enable ); void enableRangeSettings( bool enable ); void setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis, int axisIndex = 0 ); @@ -79,7 +81,6 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface bool isDeletable() const override; - std::vector annotations() const override; void appendAnnotation( RimPlotAxisAnnotation* annotation ) override; void removeAllAnnotations() override; @@ -136,6 +137,7 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface bool m_enableTitleTextSettings; bool m_isRangeSettingsEnabled; + bool m_isAlwaysRequired; caf::PdmField m_titleFontSize; caf::PdmField> m_titlePositionEnum; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 97d30a9813..13cc57feb1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -122,13 +122,15 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) CAF_PDM_InitFieldNoDefault( &m_axisProperties, "AxisProperties", "Axes", ":/Axes16x16.png" ); - bool connectSignals = false; - addNewAxisProperties( RiuPlotAxis::defaultLeft(), "Left", connectSignals ); - addNewAxisProperties( RiuPlotAxis::defaultRight(), "Right", connectSignals ); + auto leftAxis = addNewAxisProperties( RiuPlotAxis::defaultLeft(), "Left" ); + leftAxis->setAlwaysRequired( true ); + + auto rightAxis = addNewAxisProperties( RiuPlotAxis::defaultRight(), "Right" ); + rightAxis->setAlwaysRequired( true ); if ( m_isCrossPlot ) { - addNewAxisProperties( RiuPlotAxis::defaultBottom(), "Bottom", connectSignals ); + addNewAxisProperties( RiuPlotAxis::defaultBottom(), "Bottom" ); } else { @@ -1727,26 +1729,21 @@ void RimSummaryPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimPlotAxisProperties* - RimSummaryPlot::addNewAxisProperties( RiaDefines::PlotAxis plotAxis, const QString& name, bool connectSignals ) +RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiaDefines::PlotAxis plotAxis, const QString& name ) { RiuPlotAxis newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); - return addNewAxisProperties( newPlotAxis, name, connectSignals ); + return addNewAxisProperties( newPlotAxis, name ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name, bool connectSignals ) +RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name ) { RimPlotAxisProperties* axisProperties = new RimPlotAxisProperties; axisProperties->setNameAndAxis( name, plotAxis.axis(), plotAxis.index() ); m_axisProperties.push_back( axisProperties ); - - if ( connectSignals ) - { - connectAxisSignals( axisProperties ); - } + connectAxisSignals( axisProperties ); return axisProperties; } @@ -2488,9 +2485,8 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* destinationCurve ) if ( !destinationCurve->summaryAddressY().uiText().empty() ) axisObjectName = QString::fromStdString( destinationCurve->summaryAddressY().uiText() ); - newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); - bool connectSignals = true; - addNewAxisProperties( newPlotAxis, axisObjectName, connectSignals ); + newPlotAxis = plotWidget()->createNextPlotAxis( plotAxis ); + addNewAxisProperties( newPlotAxis, axisObjectName ); } destinationCurve->setLeftOrRightAxisY( newPlotAxis ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index f92b7e58b8..5300450d93 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -189,7 +189,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping RimPlotAxisPropertiesInterface* axisPropertiesForPlotAxis( RiuPlotAxis plotAxis ) const; - RimPlotAxisProperties* addNewAxisProperties( RiaDefines::PlotAxis, const QString& name, bool connectSignals ); + RimPlotAxisProperties* addNewAxisProperties( RiaDefines::PlotAxis, const QString& name ); public: // RimViewWindow overrides @@ -212,7 +212,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis ); - RimPlotAxisProperties* addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name, bool connectSignals ); + RimPlotAxisProperties* addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name ); protected: // Overridden PDM methods diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp index 3538d71a10..80b89e91a5 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.cpp @@ -215,6 +215,8 @@ int caf::PdmUiFormLayoutObjectEditor::recursivelyConfigureAndUpdateUiOrderingInG labelAndFieldVerticalLayout->addWidget( fieldLabelWidget, 0, Qt::AlignTop ); labelAndFieldVerticalLayout->addWidget( fieldEditorWidget, 1, Qt::AlignTop ); + m_layouts.push_back( labelAndFieldVerticalLayout ); + // Apply margins determined by the editor type // fieldLabelWidget->setContentsMargins(fieldEditor->labelContentMargins()); currentColumn += itemColumnSpan; @@ -489,6 +491,13 @@ void caf::PdmUiFormLayoutObjectEditor::cleanupBeforeSettingPdmObject() } m_groupBoxes.clear(); + + for ( auto l : m_layouts ) + { + delete l; + l = nullptr; + } + m_layouts.clear(); } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.h index 46d9de8885..36edebe077 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFormLayoutObjectEditor.h @@ -47,6 +47,7 @@ class QMinimizePanel; class QGridLayout; class QWidget; +class QVBoxLayout; namespace caf { @@ -110,6 +111,7 @@ private slots: std::map> m_newGroupBoxes; ///< used temporarily to store the new(complete) set of ///< group boxes std::map> m_objectKeywordGroupUiNameExpandedState; + std::vector> m_layouts; }; } // end namespace caf diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp index f4be4b1e61..02bb00ee44 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp @@ -161,11 +161,23 @@ PdmUiTreeViewEditor::~PdmUiTreeViewEditor() m_treeView->removeEventFilter( this ); m_treeViewModel->setPdmItemRoot( nullptr ); - if ( m_mainWidget ) delete m_mainWidget; - if ( m_delegate ) delete m_delegate; - if ( m_treeViewModel ) delete m_treeViewModel; - if ( m_filterModel ) delete m_filterModel; - if ( m_treeView ) delete m_treeView; + delete m_mainWidget; + m_mainWidget = nullptr; + + delete m_delegate; + m_delegate = nullptr; + + delete m_treeViewModel; + m_treeViewModel = nullptr; + + delete m_filterModel; + m_filterModel = nullptr; + + delete m_treeView; + m_treeView = nullptr; + + delete m_layout; + m_layout = nullptr; } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h index 37b461244e..ca3044656d 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h @@ -157,8 +157,8 @@ private slots: bool eventFilter( QObject* obj, QEvent* event ) override; private: - QPointer m_mainWidget; - QVBoxLayout* m_layout; + QPointer m_mainWidget; + QPointer m_layout; QPointer m_treeView; QPointer m_treeViewModel; From 7494751becfadf0a87d2fa965cb97b78eec2fb1b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 4 Mar 2022 13:58:01 +0100 Subject: [PATCH 163/406] Pdf export : Remove theme change before export to PDF Crash seen on Windows related to theme change as part of export to PDF. This is related to export of plots to PDF in dark mode. Investigate other solution. --- .../RicSnapshotViewToFileFeature.cpp | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp index 63bd9e1d94..27bc56b0fb 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp @@ -29,7 +29,6 @@ #include "RimViewWindow.h" #include "RiuFileDialogTools.h" -#include "RiuGuiTheme.h" #include "RiuPlotMainWindow.h" #include "RicSnapshotFilenameGenerator.h" @@ -91,17 +90,6 @@ void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, auto viewWidget = plot->viewWidget(); - // For some reason, the application crashes (seen on Windows 11) if the theme is changed when a plot window is - // maximized. Make sure the MDI windows are displayed as normal, and restore the maximized state - bool maximizedState = viewWidget->isMaximized(); - if ( maximizedState ) viewWidget->showNormal(); - - auto currentTheme = RiuGuiTheme::currentGuiTheme(); - if ( currentTheme != RiaDefines::ThemeEnum::LIGHT ) - { - RiuGuiTheme::updateGuiTheme( RiaDefines::ThemeEnum::LIGHT ); - } - RiaPlotWindowRedrawScheduler::instance()->performScheduledUpdatesAndReplots(); QCoreApplication::processEvents(); QFile pdfFile( fileName ); @@ -148,13 +136,6 @@ void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, { RiaLogging::error( QString( "Could not write PDF to %1" ).arg( fileName ) ); } - - if ( currentTheme != RiaDefines::ThemeEnum::LIGHT ) - { - RiuGuiTheme::updateGuiTheme( currentTheme ); - } - - if ( maximizedState ) viewWidget->showMaximized(); } //-------------------------------------------------------------------------------------------------- From 2e9c6e7a64f56f523b294e6f603e82183c518e12 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Fri, 4 Mar 2022 16:09:29 +0100 Subject: [PATCH 164/406] Allow dragging and dropping ensemble data vectors into summary plots --- .../Summary/RimSummaryAddress.cpp | 8 ------- .../Summary/RimSummaryAddress.h | 2 -- .../Summary/RimSummaryPlot.cpp | 24 ++++++++++++++++++- .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 ++ .../UserInterface/RiuDragDrop.cpp | 2 +- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp index 0acf69eca1..932e938aea 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp @@ -253,11 +253,3 @@ bool RimSummaryAddress::isEnsemble() const { return m_ensembleId >= 0; } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimSummaryAddress::canBeDragged() const -{ - return !isEnsemble(); -} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h index c15687975b..5a1fb208d3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h @@ -57,8 +57,6 @@ class RimSummaryAddress : public caf::PdmObject int ensembleId() const; bool isEnsemble() const; - bool canBeDragged() const; - QString quantityName() const; void ensureCalculationIdIsAssigned(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 13cc57feb1..e36c51c99f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1834,7 +1834,17 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector( obj ); if ( summaryAdr ) { - if ( summaryAdr->isEnsemble() ) continue; + if ( summaryAdr->isEnsemble() ) + { + auto ensemble = RiaSummaryTools::ensembleById( summaryAdr->ensembleId() ); + if ( ensemble ) + { + addNewEnsembleCurveY( summaryAdr->address(), ensemble ); + newCurves++; + } + + continue; + } auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAdr->caseId() ); if ( summaryCase ) @@ -1945,6 +1955,18 @@ void RimSummaryPlot::addNewCurveY( const RifEclipseSummaryAddress& address, RimS addCurveNoUpdate( newCurve ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::addNewEnsembleCurveY( const RifEclipseSummaryAddress& address, RimSummaryCaseCollection* ensemble ) +{ + RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet(); + + curveSet->setSummaryCaseCollection( ensemble ); + curveSet->setSummaryAddress( address ); + ensembleCurveSetCollection()->addCurveSet( curveSet ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 5300450d93..5ba3ee6389 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -42,6 +42,7 @@ class PdmUiTreeOrdering; class RimAsciiDataCurve; class RimGridTimeHistoryCurve; class RimSummaryCase; +class RimSummaryCaseCollection; class RimSummaryCurve; class RimSummaryCurveCollection; class RimEnsembleCurveSet; @@ -269,6 +270,7 @@ private slots: void assignPlotAxis( RimSummaryCurve* curve ); void addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase ); + void addNewEnsembleCurveY( const RifEclipseSummaryAddress& address, RimSummaryCaseCollection* ensemble ); void updateStackedCurveData(); bool updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ); diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index 0a753f4161..ae1ac4925c 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -264,7 +264,7 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const itemflags |= Qt::ItemIsDragEnabled; } auto sumAdr = dynamic_cast( uiItem ); - if ( sumAdr && sumAdr->canBeDragged() ) + if ( sumAdr ) { itemflags |= Qt::ItemIsDragEnabled; } From 7a954804ef48f1d4f5b5f6ca16d249f0a02caa20 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 2 Mar 2022 13:46:06 +0100 Subject: [PATCH 165/406] #8451 Qt Charts: show fewer curve symbols. The "Symbol Skip Distance" is used to space the symbols. Fixes #8451. --- .../ProjectDataModel/RimPlotCurve.cpp | 2 +- .../Summary/RimSummaryPlot.cpp | 1 + .../UserInterface/CMakeLists_files.cmake | 1 + .../UserInterface/RiuPlotWidget.cpp | 7 ++ .../UserInterface/RiuPlotWidget.h | 2 + .../UserInterface/RiuQtChartsPlotCurve.cpp | 109 ++++++++++++++++-- .../UserInterface/RiuQtChartsPlotCurve.h | 8 +- .../UserInterface/RiuQtChartsPlotWidget.cpp | 64 +++++++--- .../UserInterface/RiuQtChartsPlotWidget.h | 13 ++- 9 files changed, 175 insertions(+), 32 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index 4691ffa21a..cb51c7657e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -892,8 +892,8 @@ void RimPlotCurve::updateCurveAppearance() curveColor, fillBrush ); - m_plotCurve->setSymbol( symbol ); m_plotCurve->setSymbolSkipPixelDistance( m_curveAppearance->symbolSkipDistance() ); + m_plotCurve->setSymbol( symbol ); // Make sure the legend lines are long enough to distinguish between line types. // Standard width in Qwt is 8 which is too short. diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index e36c51c99f..d6a9a20ff8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1590,6 +1590,7 @@ void RimSummaryPlot::updateZoomInParentPlot() plotWidget()->updateAxes(); updateZoomFromParentPlot(); + plotWidget()->updateZoomDependentCurveProperties(); plotWidget()->scheduleReplot(); } } diff --git a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake index 375dcf73b4..b3dbc98381 100644 --- a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake @@ -226,6 +226,7 @@ if(RESINSIGHT_USE_QT_CHARTS) list(APPEND QT_MOC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotWidget.h ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryQtChartsPlot.h + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotCurve.h ) endif() diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp index 795a2e659f..fff9a32722 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp @@ -323,3 +323,10 @@ int RiuPlotWidget::defaultMinimumWidth() { return 80; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotWidget::updateZoomDependentCurveProperties() +{ +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.h b/ApplicationLibCode/UserInterface/RiuPlotWidget.h index 42ab278c76..f44810ab0f 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.h @@ -183,6 +183,8 @@ class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow virtual std::pair findClosestCurve( const QPoint& pos, double& distanceToClick ) const = 0; + virtual void updateZoomDependentCurveProperties(); + protected: void updateOverlayFrameLayout(); diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index 551b3c72b4..18d1132f76 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include @@ -202,8 +204,7 @@ void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, CAF_ASSERT( xValues.size() == yValues.size() ); - QtCharts::QLineSeries* line = lineSeries(); - QtCharts::QScatterSeries* scatter = scatterSeries(); + QtCharts::QLineSeries* line = lineSeries(); QVector values( static_cast( xValues.size() ) ); @@ -213,7 +214,88 @@ void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, } line->replace( values ); - scatter->replace( values ); + + updateScatterSeries(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::updateScatterSeries() +{ + double minX = std::numeric_limits::max(); + double maxX = -std::numeric_limits::max(); + + QVector points = lineSeries()->pointsVector(); + + auto axes = lineSeries()->attachedAxes(); + bool foundAxis = false; + for ( auto axis : axes ) + { + if ( axis->orientation() == Qt::Orientation::Horizontal ) + { + QtCharts::QValueAxis* valueAxis = dynamic_cast( axis ); + QtCharts::QDateTimeAxis* dateTimeAxis = dynamic_cast( axis ); + if ( valueAxis ) + { + minX = valueAxis->min(); + maxX = valueAxis->max(); + foundAxis = true; + } + else if ( dateTimeAxis ) + { + minX = dateTimeAxis->min().toMSecsSinceEpoch(); + maxX = dateTimeAxis->max().toMSecsSinceEpoch(); + foundAxis = true; + } + } + } + + if ( !foundAxis ) + { + for ( auto p : points ) + { + minX = std::min( minX, p.x() ); + maxX = std::max( maxX, p.x() ); + } + } + + QVector scatterValues; + if ( !points.empty() ) + { + double range = maxX - minX; + + double displaySize = 1400; + if ( m_plotWidget && m_plotWidget->qtChart() ) + { + // Use the max size since plot area can be small before the widget is shown + displaySize = std::max( displaySize, m_plotWidget->qtChart()->plotArea().width() ); + } + + double rangePerPixel = range / displaySize; + + double skipDistance = rangePerPixel * m_symbolSkipPixelDistance; + + // Always have symbol on first point + scatterValues << points[0]; + + int lastDrawnIndex = 0; + for ( int i = 1; i < static_cast( points.size() ); i++ ) + { + // Skip points until skip distance is reached + double diff = points[i].x() - points[lastDrawnIndex].x(); + + // Always add last point. + bool isLastPoint = i == points.size() - 1; + if ( diff > skipDistance || isLastPoint ) + { + scatterValues << points[i]; + lastDrawnIndex = i; + } + } + } + + scatterSeries()->replace( scatterValues ); } //-------------------------------------------------------------------------------------------------- @@ -255,8 +337,8 @@ void RiuQtChartsPlotCurve::setXAxis( RiuPlotAxis axis ) m_axisX = axis; if ( m_plotWidget ) { - m_plotWidget->setXAxis( axis, lineSeries() ); - m_plotWidget->setXAxis( axis, scatterSeries() ); + m_plotWidget->setXAxis( axis, lineSeries(), this ); + m_plotWidget->setXAxis( axis, scatterSeries(), this ); } } @@ -268,8 +350,8 @@ void RiuQtChartsPlotCurve::setYAxis( RiuPlotAxis axis ) m_axisY = axis; if ( m_plotWidget ) { - m_plotWidget->setYAxis( axis, lineSeries() ); - m_plotWidget->setYAxis( axis, scatterSeries() ); + m_plotWidget->setYAxis( axis, lineSeries(), this ); + m_plotWidget->setYAxis( axis, scatterSeries(), this ); } } @@ -335,8 +417,8 @@ void RiuQtChartsPlotCurve::setVisibleInLegend( bool isVisibleInLegend ) CAF_ASSERT( m_plotWidget->qtChart() ); CAF_ASSERT( m_plotWidget->qtChart()->legend() ); - // The markers can be set visible independent to the visibility state of the containing legend. Use the visibility - // state of the legend to override the visibility flag + // The markers can be set visible independent to the visibility state of the containing legend. Use the + // visibility state of the legend to override the visibility flag if ( !m_plotWidget->qtChart()->legend()->isAttachedToChart() ) isVisibleInLegend = false; if ( !m_plotWidget->qtChart()->legend()->isVisible() ) isVisibleInLegend = false; @@ -395,6 +477,7 @@ void RiuQtChartsPlotCurve::setSymbol( RiuPlotCurveSymbol* symbol ) if ( scatterSeries() ) { qtChartsSymbol->applyToScatterSeries( scatterSeries() ); + updateScatterSeries(); } } else @@ -435,3 +518,11 @@ QPixmap RiuQtChartsPlotCurve::legendIcon( const QSizeF& iconSize ) const { return QPixmap(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::axisRangeChanged() +{ + updateScatterSeries(); +} diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h index 1752f1cbd3..e5d9115871 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h @@ -32,8 +32,9 @@ class RiuPlotCurveSymbol; //================================================================================================== // //================================================================================================== -class RiuQtChartsPlotCurve : public RiuPlotCurve +class RiuQtChartsPlotCurve : public QObject, public RiuPlotCurve { + Q_OBJECT public: explicit RiuQtChartsPlotCurve( RimPlotCurve* ownerRimCurve, const QString& title = QString() ); ~RiuQtChartsPlotCurve() override; @@ -77,6 +78,11 @@ class RiuQtChartsPlotCurve : public RiuPlotCurve RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override; + void updateScatterSeries(); + +public slots: + void axisRangeChanged(); + private: void setSamplesInPlot( const std::vector&, const std::vector& ) override; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index bf95673a3e..44396f14fc 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -612,6 +612,18 @@ void RiuQtChartsPlotWidget::replot() qtChart()->update(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::updateZoomDependentCurveProperties() +{ + for ( auto it : m_scatterSeriesMap ) + { + auto plotCurve = dynamic_cast( it.first ); + if ( plotCurve ) plotCurve->updateScatterSeries(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -782,22 +794,24 @@ void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, RiuPlotAxis xAxis, RiuPlotAxis yAxis ) { - auto addToChart = [this]( std::map& curveSeriesMap, - auto plotCurve, - auto series, - auto xAxis, - auto yAxis ) { + auto addToChart = [this]( std::map& curveSeriesMap, + auto plotCurve, + auto series, + auto xAxis, + auto yAxis, + RiuQtChartsPlotCurve* qtChartsPlotCurve ) { if ( !series->chart() ) { curveSeriesMap[plotCurve] = series; qtChart()->addSeries( series ); - setXAxis( xAxis, series ); - setXAxis( yAxis, series ); + setXAxis( xAxis, series, qtChartsPlotCurve ); + setYAxis( yAxis, series, qtChartsPlotCurve ); } }; - addToChart( m_lineSeriesMap, plotCurve, lineSeries, xAxis, yAxis ); - addToChart( m_scatterSeriesMap, plotCurve, scatterSeries, xAxis, yAxis ); + auto qtChartsPlotCurve = dynamic_cast( plotCurve ); + addToChart( m_lineSeriesMap, plotCurve, lineSeries, xAxis, yAxis, qtChartsPlotCurve ); + addToChart( m_scatterSeriesMap, plotCurve, scatterSeries, xAxis, yAxis, qtChartsPlotCurve ); } //-------------------------------------------------------------------------------------------------- @@ -805,7 +819,7 @@ void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, //-------------------------------------------------------------------------------------------------- QtCharts::QAbstractSeries* RiuQtChartsPlotWidget::getLineSeries( const RiuPlotCurve* plotCurve ) const { - auto series = m_lineSeriesMap.find( plotCurve ); + auto series = m_lineSeriesMap.find( const_cast( plotCurve ) ); if ( series != m_lineSeriesMap.end() ) return series->second; else @@ -817,7 +831,7 @@ QtCharts::QAbstractSeries* RiuQtChartsPlotWidget::getLineSeries( const RiuPlotCu //-------------------------------------------------------------------------------------------------- QtCharts::QAbstractSeries* RiuQtChartsPlotWidget::getScatterSeries( const RiuPlotCurve* plotCurve ) const { - auto series = m_scatterSeriesMap.find( plotCurve ); + auto series = m_scatterSeriesMap.find( const_cast( plotCurve ) ); if ( series != m_scatterSeriesMap.end() ) return series->second; else @@ -846,17 +860,17 @@ void RiuQtChartsPlotWidget::detachItems( RiuPlotWidget::PlotItemType plotItemTyp //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) +void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ) { - attachSeriesToAxis( axis, series ); + attachSeriesToAxis( axis, series, plotCurve ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) +void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ) { - attachSeriesToAxis( axis, series ); + attachSeriesToAxis( axis, series, plotCurve ); } //-------------------------------------------------------------------------------------------------- @@ -873,7 +887,9 @@ void RiuQtChartsPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ) +void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis, + QtCharts::QAbstractSeries* series, + RiuQtChartsPlotCurve* plotCurve ) { // Make sure the axis we are about to set exists. ensureAxisIsCreated( axis ); @@ -896,6 +912,14 @@ void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis, QtCharts::QAbs if ( qobject_cast( newAxis ) || qobject_cast( newAxis ) ) { connect( newAxis, SIGNAL( rangeChanged( double, double ) ), this, SLOT( axisRangeChanged() ), Qt::UniqueConnection ); + if ( plotCurve ) + { + connect( newAxis, + SIGNAL( rangeChanged( double, double ) ), + plotCurve, + SLOT( axisRangeChanged() ), + Qt::UniqueConnection ); + } } else if ( qobject_cast( newAxis ) ) { @@ -904,6 +928,14 @@ void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis, QtCharts::QAbs this, SLOT( axisRangeChanged() ), Qt::UniqueConnection ); + if ( plotCurve ) + { + connect( newAxis, + SIGNAL( rangeChanged( QDateTime, QDateTime ) ), + plotCurve, + SLOT( axisRangeChanged() ), + Qt::UniqueConnection ); + } } } } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index ed124346fd..6cf00b0f25 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -34,6 +34,7 @@ class RiaPlotWindowRedrawScheduler; class RimPlot; class RiuPlotCurve; +class RiuQtChartsPlotCurve; class QEvent; class QLabel; @@ -165,8 +166,8 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget QtCharts::QAbstractSeries* getLineSeries( const RiuPlotCurve* plotCurve ) const; QtCharts::QAbstractSeries* getScatterSeries( const RiuPlotCurve* plotCurve ) const; - void setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ); - void setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ); + void setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); + void setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); const QColor& backgroundColor() const override; @@ -174,8 +175,10 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget std::pair findClosestCurve( const QPoint& pos, double& distanceToClick ) const override; + void updateZoomDependentCurveProperties() override; + protected: - void attachSeriesToAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series ); + void attachSeriesToAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); void resizeEvent( QResizeEvent* event ) override; void keyPressEvent( QKeyEvent* event ) override; @@ -217,6 +220,6 @@ private slots: std::map m_axesEnabled; std::map m_axesAutoScale; - std::map m_lineSeriesMap; - std::map m_scatterSeriesMap; + std::map m_lineSeriesMap; + std::map m_scatterSeriesMap; }; From 93f754102d6f50e8b55eeb2abf94a8689f9f2a6c Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 4 Mar 2022 15:24:51 +0100 Subject: [PATCH 166/406] #8615 Qt Charts: fix use-after-free crash. Fixes #8615. --- ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp | 1 + .../UserInterface/RiuQtChartsPlotCurve.cpp | 8 +++++++- .../UserInterface/RiuQtChartsPlotWidget.cpp | 9 +++++++++ ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index cb51c7657e..19e34c3760 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -131,6 +131,7 @@ RimPlotCurve::~RimPlotCurve() { if ( m_plotCurve ) { + m_plotCurve->detach(); delete m_plotCurve; m_plotCurve = nullptr; } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index 18d1132f76..2e0620d7d1 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -58,6 +58,8 @@ RiuQtChartsPlotCurve::~RiuQtChartsPlotCurve() { if ( m_plotWidget && m_plotWidget->qtChart() ) { + m_plotWidget->detach( this ); + auto* line = lineSeries(); if ( line ) { @@ -184,7 +186,11 @@ void RiuQtChartsPlotCurve::detach() scatterSeries()->hide(); } - if ( m_plotWidget ) setVisibleInLegend( false ); + if ( m_plotWidget ) + { + m_plotWidget->detach( this ); + setVisibleInLegend( false ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 44396f14fc..a56f0ba2f2 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -814,6 +814,15 @@ void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, addToChart( m_scatterSeriesMap, plotCurve, scatterSeries, xAxis, yAxis, qtChartsPlotCurve ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::detach( RiuPlotCurve* plotCurve ) +{ + m_lineSeriesMap.erase( plotCurve ); + m_scatterSeriesMap.erase( plotCurve ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index 6cf00b0f25..c3c05713e2 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -162,6 +162,7 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget QtCharts::QAbstractSeries* scatterSeries, RiuPlotAxis xAxis, RiuPlotAxis yAxis ); + void detach( RiuPlotCurve* plotCurve ); QtCharts::QAbstractSeries* getLineSeries( const RiuPlotCurve* plotCurve ) const; QtCharts::QAbstractSeries* getScatterSeries( const RiuPlotCurve* plotCurve ) const; From 85d3f98f9108a1553a0a8bcf2eb568eefca75819 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Mon, 7 Mar 2022 17:02:16 +0100 Subject: [PATCH 167/406] Allow drag'n'drop of realizations into summary plots Improve "Create Summary Case Group" feature to not delete selected realizations from the source collection. --- .../RicCreateSummaryCaseCollectionFeature.cpp | 20 +- .../Summary/RimSummaryCaseCollection.cpp | 9 +- .../Summary/RimSummaryMultiPlot.cpp | 1 - .../Summary/RimSummaryPlot.cpp | 191 +++++++++++------- .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 + 5 files changed, 142 insertions(+), 83 deletions(-) diff --git a/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp b/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp index 0257a0174a..814194cefe 100644 --- a/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp @@ -18,6 +18,8 @@ #include "RicCreateSummaryCaseCollectionFeature.h" +#include "RiaSummaryTools.h" + #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" @@ -38,11 +40,9 @@ RimSummaryCaseCollection* RicCreateSummaryCaseCollectionFeature::groupSummaryCas const QString& groupName, bool isEnsemble ) { - RimSummaryCaseMainCollection* summaryCaseMainCollection = nullptr; + RimSummaryCaseMainCollection* summaryCaseMainCollection = RiaSummaryTools::summaryCaseMainCollection(); if ( !cases.empty() ) { - cases[0]->firstAncestorOrThisOfTypeAsserted( summaryCaseMainCollection ); - auto newGroup = summaryCaseMainCollection->addCaseCollection( cases, groupName, isEnsemble ); summaryCaseMainCollection->updateConnectedEditors(); @@ -84,7 +84,17 @@ void RicCreateSummaryCaseCollectionFeature::onActionTriggered( bool isChecked ) caf::SelectionManager::instance()->objectsByType( &selection ); if ( selection.size() == 0 ) return; - groupSummaryCases( selection, "" ); + std::vector duplicates; + + for ( const auto sumCase : selection ) + { + auto copy = + dynamic_cast( sumCase->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + + duplicates.push_back( copy ); + } + + groupSummaryCases( duplicates, "" ); } //-------------------------------------------------------------------------------------------------- @@ -92,6 +102,6 @@ void RicCreateSummaryCaseCollectionFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicCreateSummaryCaseCollectionFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText( "Group Summary Cases" ); + actionToSetup->setText( "Create Summary Case Group" ); actionToSetup->setIcon( QIcon( ":/SummaryGroup16x16.png" ) ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index 6ec9752c3f..15e140f7e8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -1005,10 +1005,13 @@ void RimSummaryCaseCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiT } m_dataVectorFolders->updateUiTreeOrdering( uiTreeOrdering ); - auto subnode = uiTreeOrdering.add( "Realizations", ":/Folder.png" ); - for ( auto& smcase : m_cases ) + if ( !m_cases.empty() ) { - subnode->add( smcase ); + auto subnode = uiTreeOrdering.add( "Realizations", ":/Folder.png" ); + for ( auto& smcase : m_cases ) + { + subnode->add( smcase ); + } } uiTreeOrdering.skipRemainingChildren( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 1480bf501c..29a29d9f74 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -36,7 +36,6 @@ #include "RimSummaryPlotNameHelper.h" #include "RimSummaryPlotSourceStepping.h" -#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RiuSummaryVectorSelectionUi.h" #include "cafPdmUiComboBoxEditor.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index d6a9a20ff8..40679a1773 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1823,6 +1823,115 @@ bool RimSummaryPlot::autoPlotTitle() const return m_useAutoPlotTitle; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimSummaryPlot::handleSummaryCaseDrop( RimSummaryCase* summaryCase ) +{ + int newCurves = 0; + + std::map> dataVectorMap; + + for ( auto& curve : summaryCurves() ) + { + const auto curveAddress = curve->summaryAddressY(); + dataVectorMap[curveAddress].insert( curve->summaryCaseY() ); + } + + for ( const auto& [addr, cases] : dataVectorMap ) + { + if ( cases.count( summaryCase ) > 0 ) continue; + + addNewCurveY( addr, summaryCase ); + newCurves++; + } + + return newCurves; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* addressCollection ) +{ + int newCurves = 0; + auto droppedName = addressCollection->name().toStdString(); + + if ( addressCollection->isEnsemble() ) return 0; + + auto summaryCase = RiaSummaryTools::summaryCaseById( addressCollection->caseId() ); + if ( summaryCase ) + { + if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) + { + std::map> dataVectorMap; + + for ( auto& curve : summaryCurves() ) + { + const auto curveAddress = curve->summaryAddressY(); + if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL ) + { + dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellName() ); + } + } + + for ( auto& [vectorName, wellNames] : dataVectorMap ) + { + if ( wellNames.count( droppedName ) > 0 ) continue; + + addNewCurveY( RifEclipseSummaryAddress::wellAddress( vectorName, droppedName ), summaryCase ); + newCurves++; + } + } + else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) + { + std::map> dataVectorMap; + + for ( auto& curve : summaryCurves() ) + { + const auto curveAddress = curve->summaryAddressY(); + if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_GROUP ) + { + dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellGroupName() ); + } + } + + for ( auto& [vectorName, wellGroupNames] : dataVectorMap ) + { + if ( wellGroupNames.count( droppedName ) > 0 ) continue; + + addNewCurveY( RifEclipseSummaryAddress::wellGroupAddress( vectorName, droppedName ), summaryCase ); + newCurves++; + } + } + else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) + { + std::map> dataVectorMap; + + for ( auto& curve : summaryCurves() ) + { + const auto curveAddress = curve->summaryAddressY(); + if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_REGION ) + { + dataVectorMap[curveAddress.quantityName()].insert( curveAddress.regionNumber() ); + } + } + + int droppedRegion = std::stoi( droppedName ); + + for ( auto& [vectorName, regionNumbers] : dataVectorMap ) + { + if ( regionNumbers.count( droppedRegion ) > 0 ) continue; + + addNewCurveY( RifEclipseSummaryAddress::regionAddress( vectorName, droppedRegion ), summaryCase ); + newCurves++; + } + } + } + + return newCurves; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1832,6 +1941,13 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector( obj ); + if ( summaryCase ) + { + newCurves += handleSummaryCaseDrop( summaryCase ); + continue; + } + auto summaryAdr = dynamic_cast( obj ); if ( summaryAdr ) { @@ -1843,7 +1959,6 @@ void RimSummaryPlot::handleDroppedObjects( const std::vectoraddress(), ensemble ); newCurves++; } - continue; } @@ -1859,79 +1974,7 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector( obj ); if ( addressCollection ) { - auto droppedName = addressCollection->name().toStdString(); - - if ( addressCollection->isEnsemble() ) continue; - - auto summaryCase = RiaSummaryTools::summaryCaseById( addressCollection->caseId() ); - if ( summaryCase ) - { - if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) - { - std::map> dataVectorMap; - - for ( auto& curve : summaryCurves() ) - { - const auto curveAddress = curve->summaryAddressY(); - if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL ) - { - dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellName() ); - } - } - - for ( auto& [vectorName, wellNames] : dataVectorMap ) - { - if ( wellNames.count( droppedName ) > 0 ) continue; - - addNewCurveY( RifEclipseSummaryAddress::wellAddress( vectorName, droppedName ), summaryCase ); - newCurves++; - } - } - else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) - { - std::map> dataVectorMap; - - for ( auto& curve : summaryCurves() ) - { - const auto curveAddress = curve->summaryAddressY(); - if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_GROUP ) - { - dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellGroupName() ); - } - } - - for ( auto& [vectorName, wellGroupNames] : dataVectorMap ) - { - if ( wellGroupNames.count( droppedName ) > 0 ) continue; - - addNewCurveY( RifEclipseSummaryAddress::wellGroupAddress( vectorName, droppedName ), summaryCase ); - newCurves++; - } - } - else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) - { - std::map> dataVectorMap; - - for ( auto& curve : summaryCurves() ) - { - const auto curveAddress = curve->summaryAddressY(); - if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_REGION ) - { - dataVectorMap[curveAddress.quantityName()].insert( curveAddress.regionNumber() ); - } - } - - int droppedRegion = std::stoi( droppedName ); - - for ( auto& [vectorName, regionNumbers] : dataVectorMap ) - { - if ( regionNumbers.count( droppedRegion ) > 0 ) continue; - - addNewCurveY( RifEclipseSummaryAddress::regionAddress( vectorName, droppedRegion ), summaryCase ); - newCurves++; - } - } - } + newCurves += handleAddressCollectionDrop( addressCollection ); continue; } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 5ba3ee6389..8e91e95ed5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -41,6 +41,7 @@ class PdmUiTreeOrdering; class RimAsciiDataCurve; class RimGridTimeHistoryCurve; +class RimSummaryAddressCollection; class RimSummaryCase; class RimSummaryCaseCollection; class RimSummaryCurve; @@ -276,6 +277,9 @@ private slots: bool updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ); bool updateStackedCurveDataForRelevantAxes(); + int handleSummaryCaseDrop( RimSummaryCase* summaryCase ); + int handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl ); + private: #ifdef USE_QTCHARTS caf::PdmField m_useQtChartsPlot; From 6700c210861255008de73e0c371ceea2cfcba364 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 7 Mar 2022 09:36:18 +0100 Subject: [PATCH 168/406] Janitor : Use RimWellLogTrack in RimDepthTrackPlot --- .../RicExportToLasFileFeature.cpp | 9 +++-- .../ProjectDataModel/RimDepthTrackPlot.cpp | 34 ++++++++++++------- .../ProjectDataModel/RimDepthTrackPlot.h | 13 +++---- 3 files changed, 33 insertions(+), 23 deletions(-) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp index 61c6949ea2..70d8b30b7d 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileFeature.cpp @@ -52,14 +52,13 @@ std::vector RicExportToLasFileFeature::exportToLasFiles( const QString& bool convertCurveUnits ) { std::vector allCurves; - std::vector plots = plotWindow->visiblePlots(); + auto plots = plotWindow->visiblePlots(); - for ( RimPlot* plot : plots ) + for ( auto plot : plots ) { - RimWellLogTrack* track = dynamic_cast( plot ); - if ( track ) + if ( plot ) { - std::vector curves = track->visibleCurves(); + std::vector curves = plot->visibleCurves(); allCurves.insert( allCurves.end(), curves.begin(), curves.end() ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index 309c682fc2..9d76dfbed4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -178,9 +178,9 @@ RimDepthTrackPlot& RimDepthTrackPlot::operator=( RimDepthTrackPlot&& rhs ) RimPlotWindow::operator=( std::move( rhs ) ); // Move all tracks - std::vector plots = rhs.m_plots.childObjects(); + auto plots = rhs.m_plots.childObjects(); rhs.m_plots.clear(); - for ( RimPlot* plot : plots ) + for ( auto plot : plots ) { m_plots.push_back( plot ); } @@ -245,7 +245,7 @@ size_t RimDepthTrackPlot::plotCount() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RimDepthTrackPlot::plotIndex( const RimPlot* plot ) const +size_t RimDepthTrackPlot::plotIndex( const RimWellLogTrack* plot ) const { return m_plots.index( plot ); } @@ -268,16 +268,23 @@ RimPlot* RimDepthTrackPlot::plotByIndex( size_t index ) const //-------------------------------------------------------------------------------------------------- std::vector RimDepthTrackPlot::plots() const { - return m_plots.childObjects(); + std::vector baseClassPlots; + + for ( auto p : m_plots.childObjects() ) + { + baseClassPlots.push_back( p ); + } + + return baseClassPlots; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimDepthTrackPlot::visiblePlots() const +std::vector RimDepthTrackPlot::visiblePlots() const { - std::vector allVisiblePlots; - for ( RimPlot* plot : m_plots() ) + std::vector allVisiblePlots; + for ( auto plot : m_plots() ) { if ( plot->showWindow() ) { @@ -1049,16 +1056,19 @@ caf::PdmFieldHandle* RimDepthTrackPlot::userDescriptionField() //-------------------------------------------------------------------------------------------------- void RimDepthTrackPlot::insertPlot( RimPlot* plot, size_t index ) { - if ( plot ) + auto wellLogTrack = dynamic_cast( plot ); + CVF_ASSERT( plot && !wellLogTrack && "Only type RimWellLogTrack is supported in RimDepthTrackPlot" ); + + if ( wellLogTrack ) { - m_plots.insert( index, plot ); + m_plots.insert( index, wellLogTrack ); if ( m_viewer ) { - plot->createPlotWidget(); - m_viewer->insertPlot( plot->plotWidget(), index ); + wellLogTrack->createPlotWidget(); + m_viewer->insertPlot( wellLogTrack->plotWidget(), index ); } - plot->setShowWindow( true ); + wellLogTrack->setShowWindow( true ); onPlotAdditionOrRemoval(); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h index a65d01bb90..8d7a667d42 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h @@ -43,6 +43,7 @@ class RiuWellLogPlot; class RimPlot; class RimEnsembleCurveSet; class RiuPlotAxis; +class RimWellLogTrack; class QKeyEvent; @@ -83,15 +84,15 @@ class RimDepthTrackPlot : public RimTypedPlotCollection, public RimPlot QString description() const override; size_t plotCount() const override; - size_t plotIndex( const RimPlot* plot ) const; + size_t plotIndex( const RimWellLogTrack* plot ) const; RimPlot* plotByIndex( size_t index ) const; int columnCount() const override; - std::vector plots() const override; - std::vector visiblePlots() const; - void insertPlot( RimPlot* plot, size_t index ) final; - void removePlot( RimPlot* plot ) final; + std::vector plots() const override; + std::vector visiblePlots() const; + void insertPlot( RimPlot* plot, size_t index ) final; + void removePlot( RimPlot* plot ) final; DepthTypeEnum depthType() const; void setDepthType( DepthTypeEnum depthType ); @@ -191,7 +192,7 @@ class RimDepthTrackPlot : public RimTypedPlotCollection, public RimPlot caf::PdmField m_axisValueFontSize; caf::PdmChildField m_nameConfig; - caf::PdmChildArrayField m_plots; + caf::PdmChildArrayField m_plots; caf::PdmField> m_depthEqualization; caf::PdmPtrField m_ensembleCurveSet; From 728885a6c87dbc73011f58450075f843a15f867c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 8 Mar 2022 08:42:21 +0100 Subject: [PATCH 169/406] Janitor : Fix invalid rename introduce by horizontal/vertical depth log plots Fix deprecated --- ApplicationExeCode/CMakeLists.txt | 6 ------ ApplicationLibCode/CMakeLists.txt | 6 ------ ApplicationLibCode/Commands/CMakeLists.txt | 6 ------ .../RicNewStimPlanModelPlotFeature.cpp | 2 +- .../RicNewWellBoreStabilityPlotFeature.cpp | 2 +- .../AnalysisPlots/RimAnalysisPlot.h | 4 ++-- .../RimAbstractCorrelationPlot.h | 4 ++-- .../Flow/RimWellDistributionPlot.cpp | 4 ++-- .../Flow/RimWellDistributionPlot.h | 4 ++-- .../GridCrossPlots/RimGridCrossPlot.cpp | 12 ++++++------ .../GridCrossPlots/RimGridCrossPlot.h | 4 ++-- .../ProjectDataModel/RimDepthTrackPlot.cpp | 14 +++++++------- .../ProjectDataModel/RimDepthTrackPlot.h | 4 ++-- .../ProjectDataModel/RimMultiPlot.cpp | 4 ++-- ApplicationLibCode/ProjectDataModel/RimPlot.h | 6 +++--- .../ProjectDataModel/RimVfpPlot.cpp | 4 ++-- ApplicationLibCode/ProjectDataModel/RimVfpPlot.h | 4 ++-- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 12 ++++++------ .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 ++-- .../ProjectDataModel/WellLog/RimWellLogCurve.cpp | 2 +- .../ProjectDataModel/WellLog/RimWellLogTrack.cpp | 16 ++++++++++++++++ .../ProjectDataModel/WellLog/RimWellLogTrack.h | 7 +++++-- .../UserInterface/RiuWellLogPlot.cpp | 2 +- 23 files changed, 67 insertions(+), 66 deletions(-) diff --git a/ApplicationExeCode/CMakeLists.txt b/ApplicationExeCode/CMakeLists.txt index 17db20b730..b27051c6ad 100644 --- a/ApplicationExeCode/CMakeLists.txt +++ b/ApplicationExeCode/CMakeLists.txt @@ -210,12 +210,6 @@ if(MSVC) set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005") - if(Qt5Core_VERSION_STRING GREATER_EQUAL 5.10) - # Disable warning for deprecated functions in newer versions of Qt - # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=msvc-160 - set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996") - endif() - if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14) # The following warning is generated over 800 times from a qwt header only # using VS2015 Disabling temporarily warning C4505 'function' : unreferenced diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index 586d91e4b1..6a270494c6 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -390,12 +390,6 @@ if(MSVC) set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005 /wd4251") - if(Qt5Core_VERSION_STRING GREATER_EQUAL 5.10) - # Disable warning for deprecated functions in newer versions of Qt - # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=msvc-160 - set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996") - endif() - if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14) # The following warning is generated over 800 times from a qwt header only # using VS2015 Disabling temporarily warning C4505 'function' : unreferenced diff --git a/ApplicationLibCode/Commands/CMakeLists.txt b/ApplicationLibCode/Commands/CMakeLists.txt index fdc96a1fbc..238341ac98 100644 --- a/ApplicationLibCode/Commands/CMakeLists.txt +++ b/ApplicationLibCode/Commands/CMakeLists.txt @@ -110,12 +110,6 @@ if(MSVC) set(BUILD_FLAGS_FOR_MSVC "/wd4190 /wd4100 /wd4127 /wd4245 /wd4005 /wd4573") - if(Qt5Core_VERSION_STRING GREATER_EQUAL 5.10) - # Disable warning for deprecated functions in newer versions of Qt - # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-3-c4996?view=msvc-160 - set(BUILD_FLAGS_FOR_MSVC "${BUILD_FLAGS_FOR_MSVC} /wd4996") - endif() - if(CMAKE_CXX_COMPILER_VERSION LESS_EQUAL 19.14) # The following warning is generated over 800 times from a qwt header only # using VS2015 Disabling temporarily warning C4505 'function' : unreferenced diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp index 184768440d..32f59360fe 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp @@ -172,7 +172,7 @@ RimStimPlanModelPlot* RicNewStimPlanModelPlotFeature::createPlot( RimStimPlanMod plot->setLegendsVisible( true ); plot->setLegendsHorizontal( false ); plot->setDepthType( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH ); - plot->setAutoScaleDepthEnabled( true ); + plot->setAutoScaleDepthValuesEnabled( true ); } RiuPlotMainWindowTools::selectAsCurrentItem( plot ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp index 7891b7fe54..0fa87faedf 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp @@ -114,7 +114,7 @@ RimWellBoreStabilityPlot* plot->setLegendsVisible( true ); plot->setLegendsHorizontal( true ); plot->setDepthType( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH_RKB ); - plot->setAutoScaleDepthEnabled( true ); + plot->setAutoScaleDepthValuesEnabled( true ); RicNewWellLogPlotFeatureImpl::updateAfterCreation( plot ); } diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h index f104e69bb4..53a70a0636 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h @@ -136,8 +136,8 @@ class RimAnalysisPlot : public RimPlot void reattachAllCurves() override {} void updateAxes() override; void onAxisSelected( int axis, bool toggle ) override; - void setAutoScalePropertyValuesEnabled( bool enabled ) override {} - void setAutoScaleDepthValuesEnabled( bool enabled ) override {} + void setAutoScaleXEnabled( bool enabled ) override {} + void setAutoScaleYEnabled( bool enabled ) override {} void updateLegend() override{}; QString asciiDataForPlotExport() const override { return ""; } diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h index f764d7f118..f134284d07 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h @@ -107,8 +107,8 @@ class RimAbstractCorrelationPlot : public RimPlot RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; void reattachAllCurves() override {} - void setAutoScalePropertyValuesEnabled( bool enabled ) override {} - void setAutoScaleDepthValuesEnabled( bool enabled ) override {} + void setAutoScaleXEnabled( bool enabled ) override {} + void setAutoScaleYEnabled( bool enabled ) override {} void updateLegend() override; QString asciiDataForPlotExport() const override { return ""; } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp index 71f9872698..b7d01acf39 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp @@ -127,7 +127,7 @@ RiuPlotWidget* RimWellDistributionPlot::plotWidget() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellDistributionPlot::setAutoScalePropertyValuesEnabled( bool /*enabled*/ ) +void RimWellDistributionPlot::setAutoScaleXEnabled( bool /*enabled*/ ) { // cvf::Trace::show("RimWellDistributionPlot::setAutoScaleXEnabled()"); } @@ -135,7 +135,7 @@ void RimWellDistributionPlot::setAutoScalePropertyValuesEnabled( bool /*enabled* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellDistributionPlot::setAutoScaleDepthValuesEnabled( bool /*enabled*/ ) +void RimWellDistributionPlot::setAutoScaleYEnabled( bool /*enabled*/ ) { // cvf::Trace::show("RimWellDistributionPlot::setAutoScaleYEnabled()"); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h index 879ccb39f3..1949837277 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h @@ -50,8 +50,8 @@ class RimWellDistributionPlot : public RimPlot // RimPlot implementations RiuPlotWidget* plotWidget() override; - void setAutoScalePropertyValuesEnabled( bool enabled ) override; - void setAutoScaleDepthValuesEnabled( bool enabled ) override; + void setAutoScaleXEnabled( bool enabled ) override; + void setAutoScaleYEnabled( bool enabled ) override; void updateAxes() override; void updateLegend() override; void updateZoomInParentPlot() override; diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index 9103c6c967..87821173b8 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -183,8 +183,8 @@ QImage RimGridCrossPlot::snapshotWindowContent() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlot::zoomAll() { - setAutoScalePropertyValuesEnabled( true ); - setAutoScaleDepthValuesEnabled( true ); + setAutoScaleXEnabled( true ); + setAutoScaleYEnabled( true ); updateZoomInParentPlot(); } @@ -338,7 +338,7 @@ void RimGridCrossPlot::detachAllCurves() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlot::setAutoScalePropertyValuesEnabled( bool enabled ) +void RimGridCrossPlot::setAutoScaleXEnabled( bool enabled ) { m_xAxisProperties->setAutoZoom( enabled ); } @@ -346,7 +346,7 @@ void RimGridCrossPlot::setAutoScalePropertyValuesEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlot::setAutoScaleDepthValuesEnabled( bool enabled ) +void RimGridCrossPlot::setAutoScaleYEnabled( bool enabled ) { m_yAxisProperties->setAutoZoom( enabled ); } @@ -457,8 +457,8 @@ void RimGridCrossPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter //-------------------------------------------------------------------------------------------------- void RimGridCrossPlot::onPlotZoomed() { - setAutoScalePropertyValuesEnabled( false ); - setAutoScaleDepthValuesEnabled( false ); + setAutoScaleXEnabled( false ); + setAutoScaleYEnabled( false ); updateZoomFromParentPlot(); } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h index f50d2c0d09..36d460f79d 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h @@ -102,8 +102,8 @@ class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface void updateZoomInParentPlot() override; void updateZoomFromParentPlot() override; - void setAutoScalePropertyValuesEnabled( bool enabled ) override; - void setAutoScaleDepthValuesEnabled( bool enabled ) override; + void setAutoScaleXEnabled( bool enabled ) override; + void setAutoScaleYEnabled( bool enabled ) override; caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; void onAxisSelected( int axis, bool toggle ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index 9d76dfbed4..0f1d993e06 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -363,7 +363,7 @@ void RimDepthTrackPlot::setDepthAxisRange( double minimumDepth, double maximumDe m_minVisibleDepth.uiCapability()->updateConnectedEditors(); m_maxVisibleDepth.uiCapability()->updateConnectedEditors(); - setAutoScaleDepthEnabled( false ); + setAutoScaleDepthValuesEnabled( false ); updateZoom(); } @@ -1057,7 +1057,7 @@ caf::PdmFieldHandle* RimDepthTrackPlot::userDescriptionField() void RimDepthTrackPlot::insertPlot( RimPlot* plot, size_t index ) { auto wellLogTrack = dynamic_cast( plot ); - CVF_ASSERT( plot && !wellLogTrack && "Only type RimWellLogTrack is supported in RimDepthTrackPlot" ); + CVF_ASSERT( wellLogTrack && "Only type RimWellLogTrack is supported in RimDepthTrackPlot" ); if ( wellLogTrack ) { @@ -1211,9 +1211,9 @@ RiuPlotAxis RimDepthTrackPlot::valueAxis() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDepthTrackPlot::setAutoScaleXEnabled( bool enabled ) +void RimDepthTrackPlot::setAutoScalePropertyValuesEnabled( bool enabled ) { - for ( RimPlot* plot : plots() ) + for ( auto plot : m_plots.childObjects() ) { plot->setAutoScalePropertyValuesEnabled( enabled ); } @@ -1222,7 +1222,7 @@ void RimDepthTrackPlot::setAutoScaleXEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDepthTrackPlot::setAutoScaleDepthEnabled( bool enabled ) +void RimDepthTrackPlot::setAutoScaleDepthValuesEnabled( bool enabled ) { m_isAutoScaleDepthEnabled = enabled; m_isAutoScaleDepthEnabled.uiCapability()->updateConnectedEditors(); @@ -1233,8 +1233,8 @@ void RimDepthTrackPlot::setAutoScaleDepthEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- void RimDepthTrackPlot::zoomAll() { - setAutoScaleXEnabled( true ); - setAutoScaleDepthEnabled( true ); + setAutoScalePropertyValuesEnabled( true ); + setAutoScaleDepthValuesEnabled( true ); updateZoom(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h index 8d7a667d42..dd83cd65aa 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h @@ -108,8 +108,8 @@ class RimDepthTrackPlot : public RimTypedPlotCollection, public RimPlot RiuPlotAxis depthAxis() const; RiuPlotAxis valueAxis() const; - void setAutoScaleXEnabled( bool enabled ); - void setAutoScaleDepthEnabled( bool enabled ); + void setAutoScalePropertyValuesEnabled( bool enabled ); + void setAutoScaleDepthValuesEnabled( bool enabled ); void zoomAll() override; void updateZoom(); diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index fba50a9191..1f753607b6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -406,7 +406,7 @@ void RimMultiPlot::setAutoScaleXEnabled( bool enabled ) { for ( RimPlot* plot : plots() ) { - plot->setAutoScalePropertyValuesEnabled( enabled ); + plot->setAutoScaleXEnabled( enabled ); } } @@ -417,7 +417,7 @@ void RimMultiPlot::setAutoScaleYEnabled( bool enabled ) { for ( RimPlot* plot : plots() ) { - plot->setAutoScaleDepthValuesEnabled( enabled ); + plot->setAutoScaleYEnabled( enabled ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.h b/ApplicationLibCode/ProjectDataModel/RimPlot.h index d792075e98..5f84ce8d9b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.h @@ -71,9 +71,9 @@ class RimPlot : public QObject, public RimPlotWindow void updateAfterInsertingIntoMultiPlot(); // Pure virtual interface methods - virtual void setAutoScalePropertyValuesEnabled( bool enabled ) = 0; - virtual void setAutoScaleDepthValuesEnabled( bool enabled ) = 0; - virtual void updateAxes() = 0; + virtual void setAutoScaleXEnabled( bool enabled ) = 0; + virtual void setAutoScaleYEnabled( bool enabled ) = 0; + virtual void updateAxes() = 0; virtual void updateLegend() = 0; diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp index 78f5d39043..9c92736097 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp @@ -175,14 +175,14 @@ RiuPlotWidget* RimVfpPlot::plotWidget() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimVfpPlot::setAutoScalePropertyValuesEnabled( bool /*enabled*/ ) +void RimVfpPlot::setAutoScaleXEnabled( bool /*enabled*/ ) { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimVfpPlot::setAutoScaleDepthValuesEnabled( bool /*enabled*/ ) +void RimVfpPlot::setAutoScaleYEnabled( bool /*enabled*/ ) { } diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h index 991391e107..ca832c04b7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h @@ -48,8 +48,8 @@ class RimVfpPlot : public RimPlot // RimPlot implementations RiuPlotWidget* plotWidget() override; - void setAutoScalePropertyValuesEnabled( bool enabled ) override; - void setAutoScaleDepthValuesEnabled( bool enabled ) override; + void setAutoScaleXEnabled( bool enabled ) override; + void setAutoScaleYEnabled( bool enabled ) override; void updateAxes() override; void updateLegend() override; QString asciiDataForPlotExport() const override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 40679a1773..8425275d13 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1130,8 +1130,8 @@ void RimSummaryPlot::removeAllTimeAnnotations() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::zoomAll() { - setAutoScalePropertyValuesEnabled( true ); - setAutoScaleDepthValuesEnabled( true ); + setAutoScaleXEnabled( true ); + setAutoScaleYEnabled( true ); updateZoomInParentPlot(); } @@ -2016,8 +2016,8 @@ void RimSummaryPlot::addNewEnsembleCurveY( const RifEclipseSummaryAddress& addre //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::onPlotZoomed() { - setAutoScalePropertyValuesEnabled( false ); - setAutoScaleDepthValuesEnabled( false ); + setAutoScaleXEnabled( false ); + setAutoScaleYEnabled( false ); updateZoomFromParentPlot(); } @@ -2400,7 +2400,7 @@ std::vector RimSummaryPlot::fieldsToShowInToolbar() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::setAutoScalePropertyValuesEnabled( bool enabled ) +void RimSummaryPlot::setAutoScaleXEnabled( bool enabled ) { for ( auto ap : m_axisProperties ) { @@ -2415,7 +2415,7 @@ void RimSummaryPlot::setAutoScalePropertyValuesEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::setAutoScaleDepthValuesEnabled( bool enabled ) +void RimSummaryPlot::setAutoScaleYEnabled( bool enabled ) { for ( auto ap : m_axisProperties ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 8e91e95ed5..d76de226b5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -163,8 +163,8 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping virtual RimSummaryPlotSourceStepping* sourceSteppingObjectForKeyEventHandling() const; virtual std::vector fieldsToShowInToolbar(); - void setAutoScalePropertyValuesEnabled( bool enabled ) override; - void setAutoScaleDepthValuesEnabled( bool enabled ) override; + void setAutoScaleXEnabled( bool enabled ) override; + void setAutoScaleYEnabled( bool enabled ) override; RiuPlotWidget* plotWidget() override; void zoomAll() override; void updateZoomInParentPlot() override; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp index dc1dc71753..ccb9058a01 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp @@ -314,7 +314,7 @@ void RimWellLogCurve::updateZoomInParentPlot() } if ( updateDepthZoom ) { - wellLogPlot->setAutoScaleDepthEnabled( true ); + wellLogPlot->setAutoScaleDepthValuesEnabled( true ); } wellLogPlot->updateZoom(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index f31b700f00..9ef9f96384 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -1355,6 +1355,22 @@ void RimWellLogTrack::setAndUpdateSimWellFormationNamesData( RimCase* rimCase, c } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::setAutoScaleXEnabled( bool enabled ) +{ + CAF_ASSERT( "A well log track can be both vertical and horizontal, use setAutoScalePropertyValuesEnabled " ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::setAutoScaleYEnabled( bool enabled ) +{ + CAF_ASSERT( "A well log track can be both vertical and horizontal, use setAutoScaleDepthValuesEnabled " ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index d22fca5172..0eaa609bed 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -139,8 +139,11 @@ class RimWellLogTrack : public RimPlot bool useBranchDetection ); void setAndUpdateSimWellFormationNamesData( RimCase* rimCase, const QString& simWellName ); - void setAutoScalePropertyValuesEnabled( bool enabled ) override; - void setAutoScaleDepthValuesEnabled( bool enabled ) override; + [[deprecated( "Use setAutoScalePropertyValuesEnabled() instead." )]] void setAutoScaleXEnabled( bool enabled ) override; + [[deprecated( "Use setAutoScaleDepthValuesEnabled() instead." )]] void setAutoScaleYEnabled( bool enabled ) override; + + void setAutoScalePropertyValuesEnabled( bool enabled ); + void setAutoScaleDepthValuesEnabled( bool enabled ); void setAutoScalePropertyValuesIfNecessary(); void availablePropertyValueRange( double* minX, double* maxX ); diff --git a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp index c5aa4667bf..d5c648ed1b 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp @@ -145,7 +145,7 @@ void RiuWellLogPlot::slotSetMinDepth( int value ) double delta = value - minimumDepth; depthTrackPlot()->setDepthAxisRange( minimumDepth + delta, maximumDepth + delta ); - depthTrackPlot()->setAutoScaleDepthEnabled( false ); + depthTrackPlot()->setAutoScaleDepthValuesEnabled( false ); } //-------------------------------------------------------------------------------------------------- From d7555cbf4c2e15a7940dcea8db6dd594dfc0674d Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 8 Mar 2022 16:16:07 +0100 Subject: [PATCH 170/406] Add support for giving all axes with the same label the same range. --- .../Resources/AxesSync16x16.png | Bin 0 -> 263 bytes ApplicationExeCode/Resources/ResInsight.qrc | 3 +- .../ProjectDataModel/RimMultiPlot.cpp | 4 +- .../Summary/RimSummaryMultiPlot.cpp | 74 ++++++++++++++++++ .../Summary/RimSummaryMultiPlot.h | 6 ++ 5 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 ApplicationExeCode/Resources/AxesSync16x16.png diff --git a/ApplicationExeCode/Resources/AxesSync16x16.png b/ApplicationExeCode/Resources/AxesSync16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..3d6480f791183c5d75090077a901d9e8c182b9aa GIT binary patch literal 263 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!63?wyl`GbKJV{wqX6T`Z5GB1G~mUKs7M+SzC z{oH>NS%G|;0G|+7RaI44S=pMJnv*9_{{R19O-*gyym?n%+|SuE`SzP9_uoCQ-?#9| z$5*Kv`<{M$oxW+p&DW3E*w|QESp@|J7wi1E4K#snolZAnalysisPlotFilter16x16.png AppLogo48x48.png Axes16x16.png - BottomAxis16x16.png + AxesSync16x16.png + BottomAxis16x16.png Bullet.png CascadeWindows.svg Case.svg diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 1f753607b6..6cd9459b7d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -87,7 +87,7 @@ RimMultiPlot::RimMultiPlot() CAF_PDM_InitFieldNoDefault( &m_subTitleFontSize, "SubTitleFontSize", "Sub Plot Title Font Size" ); m_subTitleFontSize = caf::FontTools::RelativeSize::Large; - CAF_PDM_InitField( &m_pagePreviewMode, "PagePreviewMode", false, "Page Preview Mode" ); + CAF_PDM_InitField( &m_pagePreviewMode, "PagePreviewMode", false, "Page Preview Mode", "", "Page Preview" ); m_pagePreviewMode.uiCapability()->setUiEditorTypeName( caf::PdmUiToolButtonEditor::uiEditorTypeName() ); m_pagePreviewMode.uiCapability()->setUiIconFromResourceString( ":/PagePreview16x16.png" ); m_viewer = nullptr; @@ -192,6 +192,8 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index ) { setTickmarkCount( plot, m_majorTickmarkCount() ); + if ( index > m_plots.size() ) index = m_plots.size(); + m_plots.insert( index, plot ); if ( m_viewer ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 29a29d9f74..ffff0cb7e5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -39,9 +39,12 @@ #include "RiuSummaryVectorSelectionUi.h" #include "cafPdmUiComboBoxEditor.h" +#include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeSelectionEditor.h" +#include + CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); //-------------------------------------------------------------------------------------------------- /// @@ -54,6 +57,11 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() CAF_PDM_InitField( &m_autoPlotTitles, "AutoPlotTitles", true, "Auto Plot Titles" ); CAF_PDM_InitField( &m_autoPlotTitlesOnSubPlots, "AutoPlotTitlesSubPlots", true, "Auto Plot Titles Sub Plots" ); + CAF_PDM_InitField( &m_syncAxisRanges, "SyncAxisRanges", false, "", "", "Sync Axis Ranges in All Plots" ); + m_syncAxisRanges.xmlCapability()->disableIO(); + m_syncAxisRanges.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + m_syncAxisRanges.uiCapability()->setUiIconFromResourceString( ":/AxesSync16x16.png" ); + CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); m_sourceStepping = new RimSummaryPlotSourceStepping; m_sourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS ); @@ -222,12 +230,34 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi onLoadDataAndUpdate(); updateLayout(); } + else if ( changedField == &m_syncAxisRanges ) + { + syncAxisRanges(); + m_syncAxisRanges = false; + } else { RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue ); } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + if ( &m_syncAxisRanges == field ) + { + caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast( attribute ); + if ( attrib ) + { + attrib->m_buttonText = "Sync Axes"; + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -360,6 +390,8 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() { std::vector toolBarFields; + toolBarFields.push_back( &m_syncAxisRanges ); + auto& sourceObject = m_sourceStepping(); if ( sourceObject ) { @@ -377,3 +409,45 @@ bool RimSummaryMultiPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent ) { return RimSummaryPlotControls::handleKeyEvents( m_sourceStepping(), keyEvent ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::syncAxisRanges() +{ + std::map> axisRanges; + + // gather current min/max values for each category (axis label) + for ( auto plot : summaryPlots() ) + { + for ( auto axis : plot->plotAxes() ) + { + double minVal = axis->visibleRangeMin(); + double maxVal = axis->visibleRangeMax(); + + if ( axisRanges.count( axis->name() ) == 0 ) + { + axisRanges[axis->name()] = std::make_pair( axis->visibleRangeMin(), axis->visibleRangeMax() ); + } + else + { + auto& [currentMin, currentMax] = axisRanges[axis->name()]; + axisRanges[axis->name()] = std::make_pair( std::min( currentMin, minVal ), std::max( currentMax, maxVal ) ); + } + } + } + + // set all plots to use the global min/max values for each category + for ( auto plot : summaryPlots() ) + { + for ( auto axis : plot->plotAxes() ) + { + const auto& [minVal, maxVal] = axisRanges[axis->name()]; + axis->setAutoZoom( false ); + axis->setVisibleRangeMin( minVal ); + axis->setVisibleRangeMax( maxVal ); + } + + plot->updateAxes(); + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 3c7a90c35c..ee72b31cea 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -59,6 +59,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep std::vector fieldsToShowInToolbar(); + void syncAxisRanges(); + protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; @@ -66,6 +68,9 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void populateNameHelper( RimSummaryPlotNameHelper* nameHelper ); + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; std::vector summaryPlots() const; @@ -76,6 +81,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep private: caf::PdmField m_autoPlotTitles; caf::PdmField m_autoPlotTitlesOnSubPlots; + caf::PdmField m_syncAxisRanges; caf::PdmChildField m_sourceStepping; From cdbeec7ff8f44e4d203d6bb63bd9d60c1e3c92c9 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 8 Mar 2022 16:25:27 +0100 Subject: [PATCH 171/406] Remove unused include --- .../ProjectDataModel/Summary/RimSummaryMultiPlot.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index ffff0cb7e5..2ce1367176 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -43,8 +43,6 @@ #include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeSelectionEditor.h" -#include - CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); //-------------------------------------------------------------------------------------------------- /// From 0d45b88d091ae4a281f7bbe811b933c8ea422063 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Wed, 9 Mar 2022 01:04:02 +0100 Subject: [PATCH 172/406] Fix indent --- ApplicationExeCode/Resources/ResInsight.qrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index 2ee65e58d8..878f4b2413 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -13,8 +13,8 @@ AnalysisPlotFilter16x16.png AppLogo48x48.png Axes16x16.png - AxesSync16x16.png - BottomAxis16x16.png + AxesSync16x16.png + BottomAxis16x16.png Bullet.png CascadeWindows.svg Case.svg From c9b762fb16bc45af7e8eed6016d0169898dac38d Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 10 Mar 2022 13:13:44 +0100 Subject: [PATCH 173/406] Merge pull request #8654 from OPM/filter_wheelevents Summary Multiplot: page scroll and zoom fixes --- ApplicationExeCode/Resources/DisableZoom.png | Bin 0 -> 1294 bytes ApplicationExeCode/Resources/DisableZoom.svg | 70 ++++++++++++++++++ ApplicationExeCode/Resources/ResInsight.qrc | 1 + ApplicationExeCode/Resources/ZoomAll.svg | 58 +++++++++++++-- .../Application/RiaGuiApplication.cpp | 11 ++- .../ProjectDataModel/RimMultiPlot.cpp | 11 +++ .../ProjectDataModel/RimMultiPlot.h | 2 + .../ProjectDataModel/RimPlotWindow.cpp | 8 ++ .../ProjectDataModel/RimPlotWindow.h | 2 + .../Summary/RimSummaryMultiPlot.cpp | 55 +++++++++++++- .../Summary/RimSummaryMultiPlot.h | 2 + .../UserInterface/RiuMultiPlotBook.cpp | 28 +++++++ .../UserInterface/RiuMultiPlotBook.h | 7 ++ 13 files changed, 244 insertions(+), 11 deletions(-) create mode 100644 ApplicationExeCode/Resources/DisableZoom.png create mode 100644 ApplicationExeCode/Resources/DisableZoom.svg diff --git a/ApplicationExeCode/Resources/DisableZoom.png b/ApplicationExeCode/Resources/DisableZoom.png new file mode 100644 index 0000000000000000000000000000000000000000..5f14b04504d2f2aca16ca59aa99ddeafd14b4767 GIT binary patch literal 1294 zcmV+p1@ZccP)qmh*fbqahKmj-l>{m*)Ypr*P$e(e0RT5Rfu>&jxR#~Uj zqziZ*cyq8I{{j$^(ZFWlt}^rQK)X`vsMflmlybG!6YZQk0msh!(Q%wqYisLwR|Vkv z{){jTcLHOr>03a6?IIEmw1J3>1)71UfjS@n7K_OCK>^svJFRoAl*($Y+eD;P%SOKM z&kVzG1274=1l%to`)UHP|NKkLacbZx5&58eV%|hIL&I?n>WGC$S`&4)c1j302gz*l>uy$0k{Zk ziUwTB0XJ819!Wz8Z)2aO%mS%6z3qk0Et9m9dHalYyF<@`!m7(iY4%> z3zHN)4}1!I1?%)j`M!v>8$1bH*DwD}{ zRNEkuTrM{>2!i#%LjX#t7c-emTg?CfA~GLS4-%LoeG6D6BIgEJ+rLLPn@wr0*8sPa z+0O#=MC4G-02X34@CndlO+COC%xgIUoO2u}p|u{bwZ0cv08F-XFDRv6(po=<$t_hO z2JDL0u3dXWPft$<(+6A^7lD-!b3c}g$gjTdPYc6vFEFwi#DD;ih{#Ax)3FGcfvNqG z6fsTf=dSC%n@*?yk+^Dwhy}P(R++XD?HVXeCz%d{RoCIzJ+I`>euX6wU36z0M0Xl%uz + + + + No Entry + + + + + + + + diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index 878f4b2413..3006ecae82 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -258,6 +258,7 @@ view-snapshots.svg well-log-plot.svg window-management.svg + DisableZoom.png fs_CellFace.glsl diff --git a/ApplicationExeCode/Resources/ZoomAll.svg b/ApplicationExeCode/Resources/ZoomAll.svg index 306d8cb4e7..5aa7e97096 100644 --- a/ApplicationExeCode/Resources/ZoomAll.svg +++ b/ApplicationExeCode/Resources/ZoomAll.svg @@ -1,5 +1,53 @@ - - - - - \ No newline at end of file + + + + + + + + + diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index bfab7335f7..796b4cfa67 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -1687,11 +1687,16 @@ bool RiaGuiApplication::notify( QObject* receiver, QEvent* event ) { if ( event->type() == QEvent::KeyPress ) { - QKeyEvent* keyEvent = static_cast( event ); - - RimPlotWindow* plot = dynamic_cast( activePlotWindow() ); + QKeyEvent* keyEvent = static_cast( event ); + RimPlotWindow* plot = dynamic_cast( activePlotWindow() ); if ( plot ) done = plot->handleGlobalKeyEvent( keyEvent ); } + else if ( event->type() == QEvent::Wheel ) + { + QWheelEvent* wheelEvent = static_cast( event ); + RimPlotWindow* plot = dynamic_cast( activePlotWindow() ); + if ( plot ) done = plot->handleGlobalWheelEvent( wheelEvent ); + } if ( !done ) { done = QApplication::notify( receiver, event ); diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 6cd9459b7d..f22ee46235 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -906,3 +906,14 @@ void RimMultiPlot::cleanupBeforeClose() m_viewer = nullptr; } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimMultiPlot::isMouseCursorInsidePlot() +{ + if ( !m_viewer ) return false; + + QPoint curpos = m_viewer->mapFromGlobal( QCursor::pos() ); + return ( m_viewer->rect().contains( curpos ) ); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 2e9f255e39..8a0be401de 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -141,6 +141,8 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection + CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); //-------------------------------------------------------------------------------------------------- /// @@ -60,6 +62,11 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() m_syncAxisRanges.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_syncAxisRanges.uiCapability()->setUiIconFromResourceString( ":/AxesSync16x16.png" ); + CAF_PDM_InitField( &m_disableWheelZoom, "DisableWheelZoom", true, "", "", "Disable Mouse Wheel Zooming in Multi Summary Plot" ); + m_disableWheelZoom.xmlCapability()->disableIO(); + m_disableWheelZoom.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + m_disableWheelZoom.uiCapability()->setUiIconFromResourceString( ":/DisableZoom.png" ); + CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); m_sourceStepping = new RimSummaryPlotSourceStepping; m_sourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS ); @@ -388,6 +395,7 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() { std::vector toolBarFields; + toolBarFields.push_back( &m_disableWheelZoom ); toolBarFields.push_back( &m_syncAxisRanges ); auto& sourceObject = m_sourceStepping(); @@ -405,7 +413,48 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() //-------------------------------------------------------------------------------------------------- bool RimSummaryMultiPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent ) { - return RimSummaryPlotControls::handleKeyEvents( m_sourceStepping(), keyEvent ); + if ( !RimSummaryPlotControls::handleKeyEvents( m_sourceStepping(), keyEvent ) ) + { + if ( isMouseCursorInsidePlot() ) + { + if ( keyEvent->key() == Qt::Key_PageUp ) + { + m_viewer->goToPrevPage(); + return true; + } + else if ( keyEvent->key() == Qt::Key_PageDown ) + { + m_viewer->goToNextPage(); + return true; + } + } + return false; + } + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryMultiPlot::handleGlobalWheelEvent( QWheelEvent* wheelEvent ) +{ + if ( m_disableWheelZoom ) + { + if ( isMouseCursorInsidePlot() ) + { + if ( wheelEvent->angleDelta().y() > 0 ) + { + m_viewer->goToPrevPage(); + } + else if ( wheelEvent->angleDelta().y() < 0 ) + { + m_viewer->goToNextPage(); + } + + return true; + } + } + return false; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index ee72b31cea..5c89288ea6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -63,6 +63,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; + bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override; private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; @@ -82,6 +83,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep caf::PdmField m_autoPlotTitles; caf::PdmField m_autoPlotTitlesOnSubPlots; caf::PdmField m_syncAxisRanges; + caf::PdmField m_disableWheelZoom; caf::PdmChildField m_sourceStepping; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index e35a81d327..fb7d2ac677 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -99,6 +99,7 @@ RiuMultiPlotBook::RiuMultiPlotBook( RimMultiPlot* plotDefinition, QWidget* paren , m_titleVisible( true ) , m_subTitlesVisible( true ) , m_previewMode( true ) + , m_currentPageIndex( 0 ) { const int spacing = 8; @@ -585,3 +586,30 @@ void RiuMultiPlotBook::applyLook() m_book->setPalette( newPalette ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::changeCurrentPage( int pageDiff ) +{ + m_currentPageIndex += pageDiff; + if ( m_currentPageIndex >= (int)m_pages.size() ) m_currentPageIndex = (int)m_pages.size() - 1; + if ( m_currentPageIndex < 0 ) m_currentPageIndex = 0; + if ( !m_pages.isEmpty() ) m_scrollArea->ensureWidgetVisible( m_pages[m_currentPageIndex] ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::goToNextPage() +{ + changeCurrentPage( 1 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::goToPrevPage() +{ + changeCurrentPage( -1 ); +} diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index 4a8072cc91..ee56dd5e90 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -86,6 +86,9 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void renderTo( QPaintDevice* painter ); + void goToNextPage(); + void goToPrevPage(); + protected: void contextMenuEvent( QContextMenuEvent* ) override; @@ -107,6 +110,9 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow const QList>& pages() const; RiuMultiPlotPage* createPage(); void applyLook(); + + void changeCurrentPage( int pageDiff ); + private slots: virtual void performUpdate(); @@ -125,4 +131,5 @@ private slots: bool m_titleVisible; bool m_subTitlesVisible; bool m_previewMode; + int m_currentPageIndex; }; From 721ba508de1dbfefe8e4a54b40d49b4b5c962a3a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 11 Mar 2022 08:41:53 +0100 Subject: [PATCH 174/406] Axis sync: Reset zoom to make sure the complete range for min/max is available --- .../ProjectDataModel/Summary/RimSummaryMultiPlot.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index b014d1c782..adf6bfeebc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -464,6 +464,9 @@ void RimSummaryMultiPlot::syncAxisRanges() { std::map> axisRanges; + // Reset zoom to make sure the complete range for min/max is available + zoomAll(); + // gather current min/max values for each category (axis label) for ( auto plot : summaryPlots() ) { From ceecf2e54c1848764cb61102eecfc9b3cec95d62 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 9 Mar 2022 10:20:55 +0100 Subject: [PATCH 175/406] #8611 QtChart : Improve time axis grid intervals Use QCatetoryAxis to display date labels Use Qwt label formatting and scale dividing tools to produce text labels --- .../UserInterface/CMakeLists_files.cmake | 2 + .../UserInterface/RiuQtChartsPlotWidget.cpp | 162 +++++++++++------- .../UserInterface/RiuQtChartsPlotWidget.h | 13 ++ .../UserInterface/RiuQwtDateScaleWrapper.cpp | 126 ++++++++++++++ .../UserInterface/RiuQwtDateScaleWrapper.h | 45 +++++ .../UserInterface/RiuSummaryQtChartsPlot.cpp | 2 +- 6 files changed, 283 insertions(+), 67 deletions(-) create mode 100644 ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.h diff --git a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake index b3dbc98381..3d2f925de4 100644 --- a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake @@ -99,6 +99,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuFileDialogTools.h ${CMAKE_CURRENT_LIST_DIR}/RiuGuiTheme.h ${CMAKE_CURRENT_LIST_DIR}/RiuQssSyntaxHighlighter.h + ${CMAKE_CURRENT_LIST_DIR}/RiuQwtDateScaleWrapper.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -199,6 +200,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuQssSyntaxHighlighter.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuTextEditWithCompletion.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuTextContentFrame.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuQwtDateScaleWrapper.cpp ) if(RESINSIGHT_USE_QT_CHARTS) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index a56f0ba2f2..68b38d5bfe 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -31,12 +31,13 @@ #include "RiuPlotWidget.h" #include "RiuQtChartView.h" #include "RiuQtChartsPlotCurve.h" +#include "RiuQwtDateScaleWrapper.h" #include "cafAssert.h" #include "cvfTrace.h" -#include +#include #include #include #include @@ -52,6 +53,7 @@ using namespace QtCharts; //-------------------------------------------------------------------------------------------------- RiuQtChartsPlotWidget::RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* parent ) : RiuPlotWidget( plotDefinition, parent ) + , m_dateScaleWrapper( new RiuQwtDateScaleWrapper() ) { CAF_ASSERT( m_plotDefinition ); @@ -59,7 +61,7 @@ RiuQtChartsPlotWidget::RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* layout->setContentsMargins( 0, 0, 0, 0 ); setLayout( layout ); - QtCharts::QChart* chart = new QtCharts::QChart(); + QChart* chart = new QChart(); chart->layout()->setContentsMargins( 0, 0, 0, 0 ); chart->setBackgroundRoundness( 0 ); chart->setAcceptDrops( true ); @@ -90,6 +92,9 @@ RiuQtChartsPlotWidget::~RiuQtChartsPlotWidget() { m_plotDefinition->detachAllCurves(); } + + delete m_dateScaleWrapper; + m_dateScaleWrapper = nullptr; } //-------------------------------------------------------------------------------------------------- @@ -97,6 +102,25 @@ RiuQtChartsPlotWidget::~RiuQtChartsPlotWidget() //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotWidget::axisRangeChanged() { + auto catAxis = categoryAxis(); + if ( catAxis ) + { + auto min = catAxis->min(); + auto max = catAxis->max(); + + auto existingLabels = catAxis->categoriesLabels(); + for ( const auto& l : existingLabels ) + { + catAxis->remove( l ); + } + + auto positionLabel = m_dateScaleWrapper->positionsAndLabels( min, max ); + for ( auto [pos, label] : positionLabel ) + { + catAxis->append( label, pos ); + } + } + if ( qtChart()->isZoomed() ) emit plotZoomed(); } @@ -158,7 +182,7 @@ void RiuQtChartsPlotWidget::setAxisFontsAndAlignment( RiuPlotAxis axis, //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int valueFontSize, bool titleBold, int alignment ) { - for ( auto axisTitlePair : m_axisTitles ) + for ( const auto& axisTitlePair : m_axisTitles ) { setAxisFontsAndAlignment( axisTitlePair.first, titleFontSize, valueFontSize, titleBold, alignment ); } @@ -194,9 +218,6 @@ void RiuQtChartsPlotWidget::setAxisFormat( RiuPlotAxis axis, const QString& form auto logAxis = dynamic_cast( ax ); if ( logAxis ) logAxis->setLabelFormat( format ); - - auto dateAxis = dynamic_cast( ax ); - if ( dateAxis ) dateAxis->setFormat( format ); } //-------------------------------------------------------------------------------------------------- @@ -319,9 +340,6 @@ std::pair RiuQtChartsPlotWidget::axisRange( RiuPlotAxis axis ) c auto logAxis = dynamic_cast( ax ); if ( logAxis ) return std::make_pair( logAxis->min(), logAxis->max() ); - auto dateAxis = dynamic_cast( ax ); - if ( dateAxis ) return std::make_pair( dateAxis->min().toMSecsSinceEpoch(), dateAxis->max().toMSecsSinceEpoch() ); - return std::make_pair( 0.0, 1.0 ); } @@ -612,6 +630,20 @@ void RiuQtChartsPlotWidget::replot() qtChart()->update(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QCategoryAxis* RiuQtChartsPlotWidget::categoryAxis() +{ + for ( const auto& a : m_axes ) + { + auto catAxis = dynamic_cast( a.second ); + if ( catAxis ) return catAxis; + } + + return nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -624,6 +656,17 @@ void RiuQtChartsPlotWidget::updateZoomDependentCurveProperties() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::setFormatStrings( const QString& dateFormat, + const QString& timeFormat, + RiaQDateTimeTools::DateFormatComponents dateComponents, + RiaQDateTimeTools::TimeFormatComponents timeComponents ) +{ + m_dateScaleWrapper->setFormatStrings( dateFormat, timeFormat, dateComponents, timeComponents ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -671,8 +714,7 @@ void RiuQtChartsPlotWidget::setAxisMaxMajor( RiuPlotAxis axis, int maxMajor ) } else { - QDateTimeAxis* dateAxis = dynamic_cast( ax ); - if ( dateAxis ) dateAxis->setTickCount( maxMajor ); + m_dateScaleWrapper->setMaxMajorTicks( maxMajor ); } } @@ -704,14 +746,7 @@ void RiuQtChartsPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale ) //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max ) { - if ( axisScaleType( axis ) == RiuPlotWidget::AxisScaleType::DATE ) - { - plotAxis( axis )->setRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) ); - } - else - { - plotAxis( axis )->setRange( min, max ); - } + plotAxis( axis )->setRange( min, max ); } //-------------------------------------------------------------------------------------------------- @@ -738,7 +773,9 @@ void RiuQtChartsPlotWidget::setAxisScaleType( RiuPlotAxis axis, RiuQtChartsPlotW } else if ( axisScaleType == AxisScaleType::DATE ) { - insertaxis = new QDateTimeAxis; + auto categoryAxis = new QCategoryAxis; + categoryAxis->setLabelsPosition( QCategoryAxis::AxisLabelsPosition::AxisLabelsPositionOnValue ); + insertaxis = categoryAxis; } else if ( axisScaleType == AxisScaleType::LINEAR ) { @@ -780,7 +817,7 @@ RiuPlotCurve* RiuQtChartsPlotWidget::createPlotCurve( RimPlotCurve* ownerRimCurv //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QtCharts::QChart* RiuQtChartsPlotWidget::qtChart() +QChart* RiuQtChartsPlotWidget::qtChart() { return m_viewer->chart(); } @@ -788,18 +825,18 @@ QtCharts::QChart* RiuQtChartsPlotWidget::qtChart() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, - QtCharts::QAbstractSeries* lineSeries, - QtCharts::QAbstractSeries* scatterSeries, - RiuPlotAxis xAxis, - RiuPlotAxis yAxis ) +void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, + QAbstractSeries* lineSeries, + QAbstractSeries* scatterSeries, + RiuPlotAxis xAxis, + RiuPlotAxis yAxis ) { - auto addToChart = [this]( std::map& curveSeriesMap, - auto plotCurve, - auto series, - auto xAxis, - auto yAxis, - RiuQtChartsPlotCurve* qtChartsPlotCurve ) { + auto addToChart = [this]( std::map& curveSeriesMap, + auto plotCurve, + auto series, + auto xAxis, + auto yAxis, + RiuQtChartsPlotCurve* qtChartsPlotCurve ) { if ( !series->chart() ) { curveSeriesMap[plotCurve] = series; @@ -826,7 +863,7 @@ void RiuQtChartsPlotWidget::detach( RiuPlotCurve* plotCurve ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QtCharts::QAbstractSeries* RiuQtChartsPlotWidget::getLineSeries( const RiuPlotCurve* plotCurve ) const +QAbstractSeries* RiuQtChartsPlotWidget::getLineSeries( const RiuPlotCurve* plotCurve ) const { auto series = m_lineSeriesMap.find( const_cast( plotCurve ) ); if ( series != m_lineSeriesMap.end() ) @@ -838,7 +875,7 @@ QtCharts::QAbstractSeries* RiuQtChartsPlotWidget::getLineSeries( const RiuPlotCu //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QtCharts::QAbstractSeries* RiuQtChartsPlotWidget::getScatterSeries( const RiuPlotCurve* plotCurve ) const +QAbstractSeries* RiuQtChartsPlotWidget::getScatterSeries( const RiuPlotCurve* plotCurve ) const { auto series = m_scatterSeriesMap.find( const_cast( plotCurve ) ); if ( series != m_scatterSeriesMap.end() ) @@ -869,7 +906,7 @@ void RiuQtChartsPlotWidget::detachItems( RiuPlotWidget::PlotItemType plotItemTyp //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ) +void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ) { attachSeriesToAxis( axis, series, plotCurve ); } @@ -877,7 +914,7 @@ void RiuQtChartsPlotWidget::setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSerie //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ) +void RiuQtChartsPlotWidget::setYAxis( RiuPlotAxis axis, QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ) { attachSeriesToAxis( axis, series, plotCurve ); } @@ -896,9 +933,7 @@ void RiuQtChartsPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis, - QtCharts::QAbstractSeries* series, - RiuQtChartsPlotCurve* plotCurve ) +void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis, QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ) { // Make sure the axis we are about to set exists. ensureAxisIsCreated( axis ); @@ -930,22 +965,6 @@ void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis, Qt::UniqueConnection ); } } - else if ( qobject_cast( newAxis ) ) - { - connect( newAxis, - SIGNAL( rangeChanged( QDateTime, QDateTime ) ), - this, - SLOT( axisRangeChanged() ), - Qt::UniqueConnection ); - if ( plotCurve ) - { - connect( newAxis, - SIGNAL( rangeChanged( QDateTime, QDateTime ) ), - plotCurve, - SLOT( axisRangeChanged() ), - Qt::UniqueConnection ); - } - } } } @@ -954,7 +973,7 @@ void RiuQtChartsPlotWidget::attachSeriesToAxis( RiuPlotAxis axis, //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotWidget::addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool isAutoScale ) { - QValueAxis* axis = new QValueAxis(); + auto* axis = new QValueAxis(); qtChart()->addAxis( axis, mapPlotAxisToQtAlignment( plotAxis.axis() ) ); m_axes[plotAxis] = axis; m_axesEnabled[plotAxis] = isEnabled; @@ -967,7 +986,7 @@ void RiuQtChartsPlotWidget::addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool RiuPlotAxis RiuQtChartsPlotWidget::createNextPlotAxis( RiaDefines::PlotAxis axis ) { int minIdx = -1; - for ( auto a : m_axes ) + for ( const auto& a : m_axes ) { if ( a.first.axis() == axis ) { @@ -1009,18 +1028,12 @@ void RiuQtChartsPlotWidget::rescaleAxis( RiuPlotAxis axis ) QVector points; for ( auto attachedAxis : attachedAxes ) { - QValueAxis* valueAxis = dynamic_cast( attachedAxis ); + auto* valueAxis = dynamic_cast( attachedAxis ); if ( valueAxis && valueAxis->orientation() == orr && dynamic_cast( series ) ) { points = dynamic_cast( series )->pointsVector(); } - QDateTimeAxis* dateTimeAxis = dynamic_cast( attachedAxis ); - if ( dateTimeAxis && dateTimeAxis->orientation() == orr && dynamic_cast( series ) ) - { - points = dynamic_cast( series )->pointsVector(); - } - for ( auto p : points ) { if ( orr == Qt::Orientation::Horizontal ) @@ -1041,9 +1054,26 @@ void RiuQtChartsPlotWidget::rescaleAxis( RiuPlotAxis axis ) // Block signals to avoid triggering RimSummaryPlot::onPlotZoomed pAxis->blockSignals( true ); - if ( axisScaleType( axis ) == RiuPlotWidget::AxisScaleType::DATE ) + if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) { - pAxis->setRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) ); + auto catAxis = categoryAxis(); + if ( catAxis ) + { + auto existingLabels = catAxis->categoriesLabels(); + for ( const auto& l : existingLabels ) + { + catAxis->remove( l ); + } + + auto [adjustedMin, adjustedMax, tickCount] = m_dateScaleWrapper->adjustedRange( min, max ); + catAxis->setRange( adjustedMin, adjustedMax ); + + auto positionLabel = m_dateScaleWrapper->positionsAndLabels( adjustedMin, adjustedMax ); + for ( auto [pos, label] : positionLabel ) + { + catAxis->append( label, pos ); + } + } } else { diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index c3c05713e2..d68be9cc0c 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -21,6 +21,7 @@ #include "RiaDefines.h" #include "RiaPlotDefines.h" +#include "RiaQDateTimeTools.h" #include "RiuPlotWidget.h" @@ -41,6 +42,7 @@ class QLabel; class QPainter; class QPaintDevice; class QWheelEvent; +class RiuQwtDateScaleWrapper; namespace QtCharts { @@ -49,6 +51,7 @@ class QChart; class QAbstractSeries; class QAbstractAxis; class QChartView; +class QCategoryAxis; }; // namespace QtCharts //================================================================================================== @@ -178,6 +181,11 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget void updateZoomDependentCurveProperties() override; + void setFormatStrings( const QString& dateFormat, + const QString& timeFormat, + RiaQDateTimeTools::DateFormatComponents dateComponents, + RiaQDateTimeTools::TimeFormatComponents timeComponents ); + protected: void attachSeriesToAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); @@ -215,6 +223,9 @@ private slots: static int defaultMinimumWidth(); void replot() override; + QtCharts::QCategoryAxis* categoryAxis(); + +private: QPointer m_viewer; std::map m_axes; @@ -223,4 +234,6 @@ private slots: std::map m_lineSeriesMap; std::map m_scatterSeriesMap; + + RiuQwtDateScaleWrapper* m_dateScaleWrapper; }; diff --git a/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp b/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp new file mode 100644 index 0000000000..e9d12148d2 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp @@ -0,0 +1,126 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuQwtDateScaleWrapper.h" +#include "RiuQwtPlotTools.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuQwtDateScaleWrapper::RiuQwtDateScaleWrapper() + : m_scaleEngine( Qt::UTC ) + , m_maxMajorTicks( 7 ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtDateScaleWrapper::setFormatStrings( const QString& dateFormat, + const QString& timeFormat, + RiaQDateTimeTools::DateFormatComponents dateComponents, + RiaQDateTimeTools::TimeFormatComponents timeComponents ) +{ + std::set intervals = { QwtDate::Year, + QwtDate::Month, + QwtDate::Week, + QwtDate::Day, + QwtDate::Hour, + QwtDate::Minute, + QwtDate::Second, + QwtDate::Millisecond }; + + for ( QwtDate::IntervalType interval : intervals ) + { + m_scaleDraw.setDateFormat( interval, + RiuQwtPlotTools::dateTimeFormatForInterval( interval, + dateFormat, + timeFormat, + dateComponents, + timeComponents ) ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtDateScaleWrapper::setMaxMajorTicks( int tickCount ) +{ + m_maxMajorTicks = tickCount; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::tuple RiuQwtDateScaleWrapper::adjustedRange( const double& min, const double& max ) const +{ + double stepSize = 0.0; + + double adjustedMin = min; + double adjustedMax = max; + m_scaleEngine.autoScale( m_maxMajorTicks, adjustedMin, adjustedMax, stepSize ); + + auto scaleDiv = m_scaleEngine.divideScale( adjustedMin, adjustedMax, m_maxMajorTicks, 0 ); + auto ticks = scaleDiv.ticks( QwtScaleDiv::MajorTick ); + + return { adjustedMin, adjustedMax, ticks.size() - 1 }; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuQwtDateScaleWrapper::formatStringForRange( const QDateTime& min, const QDateTime& max ) +{ + auto intervalType = m_scaleEngine.intervalType( min, max, m_maxMajorTicks ); + auto dateFormat = m_scaleDraw.dateFormat( intervalType ); + + return dateFormat; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector> RiuQwtDateScaleWrapper::positionsAndLabels( const double& min, const double& max ) +{ + double stepSize = 0.0; + + double adjustedMin = min; + double adjustedMax = max; + m_scaleEngine.autoScale( m_maxMajorTicks, adjustedMin, adjustedMax, stepSize ); + + auto scaleDiv = m_scaleEngine.divideScale( adjustedMin, adjustedMax, m_maxMajorTicks, 0 ); + auto ticks = scaleDiv.ticks( QwtScaleDiv::MajorTick ); + + m_scaleDraw.setScaleDiv( scaleDiv ); + + auto formatString = + formatStringForRange( QDateTime::fromMSecsSinceEpoch( min ), QDateTime::fromMSecsSinceEpoch( max ) ); + + std::vector> valueAndLabel; + for ( auto t : ticks ) + { + auto qwtLabel = m_scaleDraw.label( t ); + auto labelText = QDateTime::fromMSecsSinceEpoch( t ).toString( formatString ); + + valueAndLabel.emplace_back( t, labelText ); + } + + return valueAndLabel; +} diff --git a/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.h b/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.h new file mode 100644 index 0000000000..dbdf506ae5 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include "RiaQDateTimeTools.h" + +#include +#include + +class RiuQwtDateScaleWrapper +{ +public: + RiuQwtDateScaleWrapper(); + + void setFormatStrings( const QString& dateFormat, + const QString& timeFormat, + RiaQDateTimeTools::DateFormatComponents dateComponents, + RiaQDateTimeTools::TimeFormatComponents timeComponents ); + + void setMaxMajorTicks( int tickCount ); + QString formatStringForRange( const QDateTime& min, const QDateTime& max ); + + std::tuple adjustedRange( const double& min, const double& max ) const; + std::vector> positionsAndLabels( const double& min, const double& max ); + +private: + QwtDateScaleDraw m_scaleDraw; + QwtDateScaleEngine m_scaleEngine; + int m_maxMajorTicks; +}; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp index 688c4ce013..3c49d08f2d 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp @@ -62,7 +62,7 @@ void RiuSummaryQtChartsPlot::useDateBasedTimeAxis( const QString& RiaQDateTimeTools::TimeFormatComponents timeComponents ) { m_plotWidget->setAxisScaleType( RiuPlotAxis::defaultBottom(), RiuPlotWidget::AxisScaleType::DATE ); - RiuQtChartsPlotTools::enableDateBasedBottomXAxis( m_plotWidget, dateFormat, timeFormat, dateComponents, timeComponents ); + m_plotWidget->setFormatStrings( dateFormat, timeFormat, dateComponents, timeComponents ); } //-------------------------------------------------------------------------------------------------- From 262aed3c8d4db9546ae1842057e52a628c03a723 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 11 Mar 2022 11:12:42 +0100 Subject: [PATCH 176/406] #8663 QtCharts: Update labels when date format changes --- ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp | 1 + ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 8425275d13..a017817cda 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -217,6 +217,7 @@ void RimSummaryPlot::updateAxes() updateTimeAxis( timeAxisProperties() ); } + plotWidget()->updateAxes(); plotWidget()->scheduleReplot(); updateZoomInParentPlot(); diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 68b38d5bfe..7c04256af2 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -803,6 +803,7 @@ void RiuQtChartsPlotWidget::setAxisScaleType( RiuPlotAxis axis, RiuQtChartsPlotW //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotWidget::updateAxes() { + axisRangeChanged(); m_viewer->chart()->update(); } From 0bab8a9834e4d92330c6b3d52c259b14948101e7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 11 Mar 2022 13:11:24 +0100 Subject: [PATCH 177/406] Fix update issues when switching from axis side (#8664) * #8610 Ensemble import : Set default axis * Summary Axis : Delete previous axis when switching side * Janitor: Use auto and empty() --- .../Summary/RimEnsembleCurveSet.cpp | 4 +- .../Summary/RimEnsembleCurveSet.h | 2 +- .../Summary/RimSummaryPlot.cpp | 82 +++++++++++-------- .../UserInterface/RiuQtChartsPlotWidget.cpp | 21 ++++- .../UserInterface/RiuQtChartsPlotWidget.h | 4 +- 5 files changed, 71 insertions(+), 42 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 666a065317..a6fafc692c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -1685,6 +1685,8 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectorhideEnsembleCurves() ) return; + setLeftOrRightAxisY( axisY() ); + RimSummaryAddress* addr = m_yValuesSummaryAddress(); if ( plot && addr->address().category() != RifEclipseSummaryAddress::SUMMARY_INVALID ) { @@ -2095,7 +2097,7 @@ RiuPlotAxis RimEnsembleCurveSet::axisY() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSet::setAxisY( RiuPlotAxis plotAxis ) +void RimEnsembleCurveSet::setLeftOrRightAxisY( RiuPlotAxis plotAxis ) { RimSummaryPlot* plot = nullptr; firstAncestorOrThisOfTypeAsserted( plot ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index ea55d6f90c..4075be02dc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -168,7 +168,7 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt std::vector generateColorsForCases( const std::vector& summaryCases ) const; RiuPlotAxis axisY() const; - void setAxisY( RiuPlotAxis plotAxis ); + void setLeftOrRightAxisY( RiuPlotAxis plotAxis ); protected: void initAfterRead() override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index a017817cda..8705a24a67 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -93,8 +93,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryPlot, "SummaryPlot" ); /// //-------------------------------------------------------------------------------------------------- RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) - : RimPlot() - , m_isCrossPlot( isCrossPlot ) + : m_isCrossPlot( isCrossPlot ) { CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" ); @@ -134,7 +133,7 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) } else { - RimSummaryTimeAxisProperties* timeAxisProperties = new RimSummaryTimeAxisProperties; + auto* timeAxisProperties = new RimSummaryTimeAxisProperties; m_axisProperties.push_back( timeAxisProperties ); } @@ -142,7 +141,7 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) m_textCurveSetEditor.uiCapability()->setUiTreeHidden( true ); m_textCurveSetEditor = new RimSummaryPlotFilterTextCurveSetEditor; - m_nameHelperAllCurves.reset( new RimSummaryPlotNameHelper ); + m_nameHelperAllCurves = std::make_unique(); CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); m_sourceStepping = new RimSummaryPlotSourceStepping; @@ -240,9 +239,9 @@ bool RimSummaryPlot::isLogarithmicScaleEnabled( RiuPlotAxis plotAxis ) const RimSummaryTimeAxisProperties* RimSummaryPlot::timeAxisProperties() { // Find the first time axis (which is correct since there is only one). - for ( auto ap : m_axisProperties ) + for ( const auto& ap : m_axisProperties ) { - RimSummaryTimeAxisProperties* timeAxis = dynamic_cast( ap.p() ); + auto* timeAxis = dynamic_cast( ap.p() ); if ( timeAxis ) return timeAxis; } @@ -267,12 +266,11 @@ time_t RimSummaryPlot::firstTimeStepOfFirstCurve() } } - if ( firstCurve && firstCurve->timeStepsY().size() > 0 ) + if ( firstCurve && !firstCurve->timeStepsY().empty() ) { return firstCurve->timeStepsY()[0]; } - else - return time_t( 0 ); + return time_t( 0 ); } //-------------------------------------------------------------------------------------------------- @@ -673,7 +671,7 @@ void RimSummaryPlot::setPlotInfoLabel( const QString& label ) font.setBold( true ); qwtText.setFont( font ); - m_plotInfoLabel.reset( new QwtPlotTextLabel() ); + m_plotInfoLabel = std::make_unique(); m_plotInfoLabel->setText( qwtText ); m_plotInfoLabel->setMargin( 10 ); } @@ -683,7 +681,7 @@ void RimSummaryPlot::setPlotInfoLabel( const QString& label ) //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::showPlotInfoLabel( bool show ) { - RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast( plotWidget() ); + auto* qwtPlotWidget = dynamic_cast( plotWidget() ); if ( !qwtPlotWidget ) return; if ( show ) @@ -791,7 +789,7 @@ void RimSummaryPlot::updateAxis( RiaDefines::PlotAxis plotAxis ) RiuPlotAxis riuPlotAxis = yAxisProperties->plotAxisType(); if ( riuPlotAxis.axis() == plotAxis ) { - RimPlotAxisProperties* axisProperties = dynamic_cast( yAxisProperties ); + auto* axisProperties = dynamic_cast( yAxisProperties ); if ( yAxisProperties->isActive() && hasVisibleCurvesForAxis( riuPlotAxis ) && axisProperties ) { plotWidget()->enableAxis( riuPlotAxis, true ); @@ -931,17 +929,17 @@ std::vector RimSummaryPlot::visibleSummaryCurvesForAxis( RiuPl //-------------------------------------------------------------------------------------------------- bool RimSummaryPlot::hasVisibleCurvesForAxis( RiuPlotAxis plotAxis ) const { - if ( visibleSummaryCurvesForAxis( plotAxis ).size() > 0 ) + if ( !visibleSummaryCurvesForAxis( plotAxis ).empty() ) { return true; } - if ( visibleTimeHistoryCurvesForAxis( plotAxis ).size() > 0 ) + if ( !visibleTimeHistoryCurvesForAxis( plotAxis ).empty() ) { return true; } - if ( visibleAsciiDataCurvesForAxis( plotAxis ).size() > 0 ) + if ( !visibleAsciiDataCurvesForAxis( plotAxis ).empty() ) { return true; } @@ -969,7 +967,7 @@ std::vector RimSummaryPlot::visibleTimeHistoryCurvesFo { std::vector curves; - for ( auto c : m_gridTimeHistoryCurves ) + for ( const auto& c : m_gridTimeHistoryCurves ) { if ( c->isCurveVisible() ) { @@ -990,7 +988,7 @@ std::vector RimSummaryPlot::visibleAsciiDataCurvesForAxis( R { std::vector curves; - for ( auto c : m_asciiDataCurves ) + for ( const auto& c : m_asciiDataCurves ) { if ( c->isCurveVisible() ) { @@ -1023,8 +1021,8 @@ void RimSummaryPlot::updateTimeAxis( RimSummaryTimeAxisProperties* timeAxisPrope RiaQDateTimeTools::DateFormatComponents dateComponents = timeAxisProperties->dateComponents(); RiaQDateTimeTools::TimeFormatComponents timeComponents = timeAxisProperties->timeComponents(); - QString dateFormat = timeAxisProperties->dateFormat(); - QString timeFormat = timeAxisProperties->timeFormat(); + const QString& dateFormat = timeAxisProperties->dateFormat(); + const QString& timeFormat = timeAxisProperties->timeFormat(); m_summaryPlot->useDateBasedTimeAxis( dateFormat, timeFormat, dateComponents, timeComponents ); } @@ -1096,7 +1094,7 @@ void RimSummaryPlot::addTimeAnnotation( time_t time ) { RimSummaryTimeAxisProperties* axisProps = timeAxisProperties(); { - RimTimeAxisAnnotation* annotation = new RimTimeAxisAnnotation; + auto* annotation = new RimTimeAxisAnnotation; annotation->setTime( time ); axisProps->appendAnnotation( annotation ); @@ -1110,7 +1108,7 @@ void RimSummaryPlot::addTimeRangeAnnotation( time_t startTime, time_t endTime ) { RimSummaryTimeAxisProperties* axisProps = timeAxisProperties(); { - RimTimeAxisAnnotation* annotation = new RimTimeAxisAnnotation; + auto* annotation = new RimTimeAxisAnnotation; annotation->setTimeRange( startTime, endTime ); axisProps->appendAnnotation( annotation ); @@ -1584,7 +1582,7 @@ void RimSummaryPlot::updateZoomInParentPlot() { if ( plotWidget() ) { - for ( auto axisProperty : m_axisProperties ) + for ( const auto& axisProperty : m_axisProperties ) { updateZoomForAxis( axisProperty->plotAxisType() ); } @@ -1742,7 +1740,7 @@ RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiaDefines::PlotAxi //-------------------------------------------------------------------------------------------------- RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name ) { - RimPlotAxisProperties* axisProperties = new RimPlotAxisProperties; + auto* axisProperties = new RimPlotAxisProperties; axisProperties->setNameAndAxis( name, plotAxis.axis(), plotAxis.index() ); m_axisProperties.push_back( axisProperties ); connectAxisSignals( axisProperties ); @@ -1773,15 +1771,29 @@ void RimSummaryPlot::axisPositionChanged( const caf::SignalEmitter* emitter, if ( curve->axisY() == oldPlotAxis ) curve->setLeftOrRightAxisY( fixedUpPlotAxis ); } + for ( auto curveSet : ensembleCurveSetCollection()->curveSets() ) + { + if ( curveSet->axisY() == oldPlotAxis ) curveSet->setLeftOrRightAxisY( fixedUpPlotAxis ); + } + // Remove the now unused axis (but keep the default axis) if ( oldPlotAxis != RiuPlotAxis::defaultLeft() && oldPlotAxis != RiuPlotAxis::defaultRight() ) { auto oldAxisProperties = axisPropertiesForPlotAxis( oldPlotAxis ); if ( oldAxisProperties ) m_axisProperties.removeChildObject( oldAxisProperties ); } + + std::set usedPlotAxis; + for ( const auto& axisProperties : m_axisProperties ) + { + usedPlotAxis.insert( axisProperties->plotAxisType() ); + } + + plotWidget()->pruneAxes( usedPlotAxis ); } - updateAxes(); + // This is probably to much, but difficult to find the required updates + loadDataAndUpdate(); } //-------------------------------------------------------------------------------------------------- @@ -1994,7 +2006,7 @@ void RimSummaryPlot::handleDroppedObjects( const std::vectorsetSummaryCaseY( summaryCase ); newCurve->setSummaryAddressYAndApplyInterpolation( address ); addCurveNoUpdate( newCurve ); @@ -2005,7 +2017,7 @@ void RimSummaryPlot::addNewCurveY( const RifEclipseSummaryAddress& address, RimS //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::addNewEnsembleCurveY( const RifEclipseSummaryAddress& address, RimSummaryCaseCollection* ensemble ) { - RimEnsembleCurveSet* curveSet = new RimEnsembleCurveSet(); + auto* curveSet = new RimEnsembleCurveSet(); curveSet->setSummaryCaseCollection( ensemble ); curveSet->setSummaryAddress( address ); @@ -2096,7 +2108,7 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent m_summaryPlot = std::make_unique( this, mainWindowParent ); #endif - for ( auto axisProperties : m_axisProperties ) + for ( const auto& axisProperties : m_axisProperties ) { plotWidget()->ensureAxisIsCreated( axisProperties->plotAxisType() ); } @@ -2173,7 +2185,7 @@ void RimSummaryPlot::initAfterRead() copyAxis( RiuPlotAxis::defaultBottom(), m_timeAxisProperties_OBSOLETE.v() ); } - for ( auto axisProperties : m_axisProperties ) + for ( const auto& axisProperties : m_axisProperties ) { auto plotAxisProperties = dynamic_cast( axisProperties.p() ); if ( plotAxisProperties ) @@ -2403,7 +2415,7 @@ std::vector RimSummaryPlot::fieldsToShowInToolbar() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::setAutoScaleXEnabled( bool enabled ) { - for ( auto ap : m_axisProperties ) + for ( const auto& ap : m_axisProperties ) { if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_TOP || ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) @@ -2418,7 +2430,7 @@ void RimSummaryPlot::setAutoScaleXEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::setAutoScaleYEnabled( bool enabled ) { - for ( auto ap : m_axisProperties ) + for ( const auto& ap : m_axisProperties ) { if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) @@ -2452,7 +2464,7 @@ bool RimSummaryPlot::isDeletable() const std::vector RimSummaryPlot::plotAxes() const { std::vector axisProps; - for ( auto ap : m_axisProperties ) + for ( const auto& ap : m_axisProperties ) { axisProps.push_back( ap ); } @@ -2569,22 +2581,22 @@ void RimSummaryPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childAr { for ( caf::PdmObjectHandle* reffingObj : referringObjects ) { - RimSummaryCurve* curve = dynamic_cast( reffingObj ); - RimEnsembleCurveSet* curveSet = dynamic_cast( reffingObj ); + auto* curve = dynamic_cast( reffingObj ); + auto* curveSet = dynamic_cast( reffingObj ); if ( curve ) { curve->setLeftOrRightAxisY( RiuPlotAxis::defaultLeft() ); } else if ( curveSet ) { - curveSet->setAxisY( RiuPlotAxis::defaultLeft() ); + curveSet->setLeftOrRightAxisY( RiuPlotAxis::defaultLeft() ); } } if ( plotWidget() ) { std::set usedPlotAxis; - for ( auto axisProperties : m_axisProperties ) + for ( const auto& axisProperties : m_axisProperties ) { usedPlotAxis.insert( axisProperties->plotAxisType() ); } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 7c04256af2..015654a8c6 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -981,6 +981,22 @@ void RiuQtChartsPlotWidget::addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool m_axesAutoScale[plotAxis] = isAutoScale; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::deleteAxis( RiuPlotAxis axis ) +{ + auto toBeDeleted = plotAxis( axis ); + + qtChart()->removeAxis( toBeDeleted ); + m_axes.erase( axis ); + m_axesEnabled.erase( axis ); + m_axesAutoScale.erase( axis ); + + delete toBeDeleted; + toBeDeleted = nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1195,10 +1211,7 @@ void RiuQtChartsPlotWidget::pruneAxes( const std::set& usedAxes ) { if ( usedAxes.count( plotAxis ) == 0 ) { - // This axis is now unused, and can be disabled - qtAxis->setVisible( false ); - m_axesEnabled[plotAxis] = false; - m_axesAutoScale[plotAxis] = false; + deleteAxis( plotAxis ); } } } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index d68be9cc0c..aaf51aac69 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -217,7 +217,9 @@ private slots: void axisRangeChanged(); private: - void addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool isAutoScale ); + void addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool isAutoScale ); + void deleteAxis( RiuPlotAxis plotAxis ); + static Qt::Alignment mapPlotAxisToQtAlignment( RiaDefines::PlotAxis axis ); static int defaultMinimumWidth(); From 72fc47e003740554a3421b9945a38a234a2832d1 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 7 Mar 2022 13:47:56 +0100 Subject: [PATCH 178/406] #8452 QtCharts: Add fill color and pattern --- .../RimPlotCurveAppearance.cpp | 2 + .../UserInterface/RiuQtChartsPlotCurve.cpp | 108 +++++++++++++++--- .../UserInterface/RiuQtChartsPlotCurve.h | 6 + .../UserInterface/RiuQtChartsPlotWidget.cpp | 16 +++ .../UserInterface/RiuQtChartsPlotWidget.h | 5 +- 5 files changed, 118 insertions(+), 19 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp index 17161f0231..62d84becd4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp @@ -69,6 +69,7 @@ void RimPlotCurveAppearance::FillStyle::setUp() addItem( Qt::BDiagPattern, "DIAG_FILL", "Diagonal Lines" ); addItem( Qt::CrossPattern, "CROSS_FILL", "Mesh" ); addItem( Qt::DiagCrossPattern, "DIAG_CROSS_FILL", "Diagonal Mesh" ); + setDefault( Qt::NoBrush ); } } // namespace caf @@ -386,6 +387,7 @@ void RimPlotCurveAppearance::resetAppearance() setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); setSymbol( RiuPlotCurveSymbol::SYMBOL_NONE ); setSymbolSkipDistance( 10 ); + setFillStyle( Qt::NoBrush ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index 2e0620d7d1..8916f6d8c4 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -44,11 +44,16 @@ RiuQtChartsPlotCurve::RiuQtChartsPlotCurve( RimPlotCurve* ownerRimCurve, const Q m_lineSeries = new QtCharts::QLineSeries(); m_lineSeries->setName( title ); + m_areaSeries = new QtCharts::QAreaSeries(); + m_areaSeries->setName( title ); + m_scatterSeries = new QtCharts::QScatterSeries(); m_scatterSeries->setName( title ); m_axisX = RiuPlotAxis::defaultBottom(); m_axisY = RiuPlotAxis::defaultLeft(); + + m_isVisibleInLegend = false; } //-------------------------------------------------------------------------------------------------- @@ -69,6 +74,15 @@ RiuQtChartsPlotCurve::~RiuQtChartsPlotCurve() delete line; } + auto* area = areaSeries(); + if ( area ) + { + m_plotWidget->qtChart()->removeSeries( area ); + + // removeSeries() releases chart ownership of the data, delete data to avoid memory leak + delete area; + } + auto* scatter = scatterSeries(); if ( scatter ) { @@ -83,6 +97,9 @@ RiuQtChartsPlotCurve::~RiuQtChartsPlotCurve() delete m_lineSeries; m_lineSeries = nullptr; + delete m_areaSeries; + m_areaSeries = nullptr; + delete m_scatterSeries; m_scatterSeries = nullptr; } @@ -95,6 +112,7 @@ void RiuQtChartsPlotCurve::setTitle( const QString& title ) if ( !isQtChartObjectsPresent() ) return; lineSeries()->setName( title ); + areaSeries()->setName( title ); scatterSeries()->setName( title ); } @@ -117,6 +135,22 @@ void RiuQtChartsPlotCurve::setAppearance( RiuQwtPlotCurveDefines::LineStyleEnum lineSeries()->setPen( curvePen ); lineSeries()->setBrush( fillBrush ); + + areaSeries()->setPen( curvePen ); + areaSeries()->setBrush( fillBrush ); + + if ( fillBrush.style() == Qt::NoBrush ) + { + lineSeries()->show(); + areaSeries()->hide(); + setVisibleInLegend( m_isVisibleInLegend ); + } + else + { + lineSeries()->hide(); + areaSeries()->show(); + setVisibleInLegend( m_isVisibleInLegend ); + } } //-------------------------------------------------------------------------------------------------- @@ -127,6 +161,7 @@ void RiuQtChartsPlotCurve::setBrush( const QBrush& brush ) if ( !isQtChartObjectsPresent() ) return; lineSeries()->setBrush( brush ); + areaSeries()->setBrush( brush ); } //-------------------------------------------------------------------------------------------------- @@ -141,16 +176,19 @@ void RiuQtChartsPlotCurve::attachToPlot( RiuPlotWidget* plotWidget ) { m_plotWidget->qtChart()->legend()->setMarkerShape( QtCharts::QLegend::MarkerShape::MarkerShapeFromSeries ); setVisibleInLegend( true ); + lineSeries()->show(); } else { if ( !m_lineSeries ) m_lineSeries = new QtCharts::QLineSeries(); + if ( !m_areaSeries ) m_areaSeries = new QtCharts::QAreaSeries(); if ( !m_scatterSeries ) m_scatterSeries = new QtCharts::QScatterSeries(); - m_plotWidget->attach( this, m_lineSeries, m_scatterSeries, m_axisX, m_axisY ); + m_plotWidget->attach( this, m_lineSeries, m_areaSeries, m_scatterSeries, m_axisX, m_axisY ); // Plot widget takes ownership. m_lineSeries = nullptr; + m_areaSeries = nullptr; m_scatterSeries = nullptr; } @@ -181,6 +219,12 @@ void RiuQtChartsPlotCurve::detach() line->hide(); } + QtCharts::QAreaSeries* area = areaSeries(); + if ( area ) + { + area->hide(); + } + if ( scatterSeries() ) { scatterSeries()->hide(); @@ -210,8 +254,6 @@ void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, CAF_ASSERT( xValues.size() == yValues.size() ); - QtCharts::QLineSeries* line = lineSeries(); - QVector values( static_cast( xValues.size() ) ); for ( int i = 0; i < static_cast( xValues.size() ); i++ ) @@ -219,8 +261,13 @@ void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, values[i] = QPointF( xValues[i], yValues[i] ); } + QtCharts::QLineSeries* line = lineSeries(); line->replace( values ); + QtCharts::QLineSeries* upper = new QtCharts::QLineSeries; + upper->replace( values ); + areaSeries()->setUpperSeries( upper ); + updateScatterSeries(); } @@ -344,6 +391,7 @@ void RiuQtChartsPlotCurve::setXAxis( RiuPlotAxis axis ) if ( m_plotWidget ) { m_plotWidget->setXAxis( axis, lineSeries(), this ); + m_plotWidget->setXAxis( axis, areaSeries(), this ); m_plotWidget->setXAxis( axis, scatterSeries(), this ); } } @@ -357,6 +405,7 @@ void RiuQtChartsPlotCurve::setYAxis( RiuPlotAxis axis ) if ( m_plotWidget ) { m_plotWidget->setYAxis( axis, lineSeries(), this ); + m_plotWidget->setYAxis( axis, areaSeries(), this ); m_plotWidget->setYAxis( axis, scatterSeries(), this ); } } @@ -428,23 +477,21 @@ void RiuQtChartsPlotCurve::setVisibleInLegend( bool isVisibleInLegend ) if ( !m_plotWidget->qtChart()->legend()->isAttachedToChart() ) isVisibleInLegend = false; if ( !m_plotWidget->qtChart()->legend()->isVisible() ) isVisibleInLegend = false; - bool showScatterMarker = isVisibleInLegend; - if ( !m_symbol ) showScatterMarker = false; - - if ( scatterSeries() ) - { - auto markers = m_plotWidget->qtChart()->legend()->markers( scatterSeries() ); - if ( !markers.isEmpty() ) markers[0]->setVisible( showScatterMarker ); - } + bool showScatterMarker = isVisibleInLegend && m_symbol; + bool showLineMarker = isVisibleInLegend && !m_symbol; - bool showLineMarker = isVisibleInLegend; - if ( showScatterMarker ) showLineMarker = false; + auto setLegendVisibility = [this]( auto series, bool isVisible ) { + if ( series ) + { + auto markers = m_plotWidget->qtChart()->legend()->markers( series ); + if ( !markers.isEmpty() ) markers[0]->setVisible( isVisible ); + } + }; - if ( lineSeries() ) - { - auto lineSeriesMarkers = m_plotWidget->qtChart()->legend()->markers( lineSeries() ); - if ( !lineSeriesMarkers.isEmpty() ) lineSeriesMarkers[0]->setVisible( showLineMarker ); - } + m_isVisibleInLegend = showLineMarker || showScatterMarker; + setLegendVisibility( lineSeries(), showLineMarker ); + setLegendVisibility( areaSeries(), false ); + setLegendVisibility( scatterSeries(), showScatterMarker ); } //-------------------------------------------------------------------------------------------------- @@ -469,6 +516,17 @@ QtCharts::QScatterSeries* RiuQtChartsPlotCurve::scatterSeries() const return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QtCharts::QAreaSeries* RiuQtChartsPlotCurve::areaSeries() const +{ + if ( m_areaSeries ) return m_areaSeries; + if ( m_plotWidget ) return dynamic_cast( m_plotWidget->getAreaSeries( this ) ); + + return nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -484,15 +542,29 @@ void RiuQtChartsPlotCurve::setSymbol( RiuPlotCurveSymbol* symbol ) { qtChartsSymbol->applyToScatterSeries( scatterSeries() ); updateScatterSeries(); + updateLineAndAreaSeries(); } } else { m_symbol.reset(); if ( scatterSeries() ) scatterSeries()->hide(); + updateLineAndAreaSeries(); } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::updateLineAndAreaSeries() +{ + bool isFilled = areaSeries() && areaSeries()->brush().style() != Qt::NoBrush; + bool isLine = lineSeries() && lineSeries()->pen().style() != Qt::PenStyle::NoPen; + if ( areaSeries() ) areaSeries()->setVisible( isFilled ); + if ( lineSeries() ) lineSeries()->setVisible( isLine ); + setVisibleInLegend( m_isVisibleInLegend ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h index e5d9115871..d42e86192e 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h @@ -23,6 +23,7 @@ #include "cvfBoundingBox.h" +#include #include #include @@ -76,6 +77,8 @@ class RiuQtChartsPlotCurve : public QObject, public RiuPlotCurve void setSymbol( RiuPlotCurveSymbol* symbol ) override; + void updateLineAndAreaSeries(); + RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override; void updateScatterSeries(); @@ -89,14 +92,17 @@ public slots: bool isQtChartObjectsPresent() const; QtCharts::QLineSeries* lineSeries() const; QtCharts::QScatterSeries* scatterSeries() const; + QtCharts::QAreaSeries* areaSeries() const; cvf::BoundingBox computeBoundingBox() const; private: QtCharts::QLineSeries* m_lineSeries; QtCharts::QScatterSeries* m_scatterSeries; + QtCharts::QAreaSeries* m_areaSeries; std::shared_ptr m_symbol; QPointer m_plotWidget; RiuPlotAxis m_axisX; RiuPlotAxis m_axisY; + bool m_isVisibleInLegend; }; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 015654a8c6..ba5f9572ee 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -828,6 +828,7 @@ QChart* RiuQtChartsPlotWidget::qtChart() //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, QAbstractSeries* lineSeries, + QAbstractSeries* areaSeries, QAbstractSeries* scatterSeries, RiuPlotAxis xAxis, RiuPlotAxis yAxis ) @@ -849,6 +850,7 @@ void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, auto qtChartsPlotCurve = dynamic_cast( plotCurve ); addToChart( m_lineSeriesMap, plotCurve, lineSeries, xAxis, yAxis, qtChartsPlotCurve ); + addToChart( m_areaSeriesMap, plotCurve, areaSeries, xAxis, yAxis, qtChartsPlotCurve ); addToChart( m_scatterSeriesMap, plotCurve, scatterSeries, xAxis, yAxis, qtChartsPlotCurve ); } @@ -858,6 +860,7 @@ void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, void RiuQtChartsPlotWidget::detach( RiuPlotCurve* plotCurve ) { m_lineSeriesMap.erase( plotCurve ); + m_areaSeriesMap.erase( plotCurve ); m_scatterSeriesMap.erase( plotCurve ); } @@ -873,6 +876,18 @@ QAbstractSeries* RiuQtChartsPlotWidget::getLineSeries( const RiuPlotCurve* plotC return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QAbstractSeries* RiuQtChartsPlotWidget::getAreaSeries( const RiuPlotCurve* plotCurve ) const +{ + auto series = m_areaSeriesMap.find( const_cast( plotCurve ) ); + if ( series != m_areaSeriesMap.end() ) + return series->second; + else + return nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -895,6 +910,7 @@ void RiuQtChartsPlotWidget::detachItems( RiuPlotWidget::PlotItemType plotItemTyp if ( plotItemType == RiuPlotWidget::PlotItemType::CURVE ) { m_lineSeriesMap.clear(); + m_areaSeriesMap.clear(); m_scatterSeriesMap.clear(); qtChart()->removeAllSeries(); } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index aaf51aac69..7c654f288c 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -161,13 +161,15 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget QtCharts::QChart* qtChart(); void attach( RiuPlotCurve* plotCurve, - QtCharts::QAbstractSeries* lineseries, + QtCharts::QAbstractSeries* lineSeries, + QtCharts::QAbstractSeries* areaSeries, QtCharts::QAbstractSeries* scatterSeries, RiuPlotAxis xAxis, RiuPlotAxis yAxis ); void detach( RiuPlotCurve* plotCurve ); QtCharts::QAbstractSeries* getLineSeries( const RiuPlotCurve* plotCurve ) const; + QtCharts::QAbstractSeries* getAreaSeries( const RiuPlotCurve* plotCurve ) const; QtCharts::QAbstractSeries* getScatterSeries( const RiuPlotCurve* plotCurve ) const; void setXAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); @@ -235,6 +237,7 @@ private slots: std::map m_axesAutoScale; std::map m_lineSeriesMap; + std::map m_areaSeriesMap; std::map m_scatterSeriesMap; RiuQwtDateScaleWrapper* m_dateScaleWrapper; From 806a149809abb7e44719280e064d928aaa933677 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 11 Mar 2022 13:24:01 +0100 Subject: [PATCH 179/406] Fix several deprecation warnings (#8657) * Use constructor instead of nullptr for WindowFlags * Use constructor instead of nullptr for Alignment * Disable deprecation warning for QProcess * Add string split method to RaTextStringTools * Add caf.cpp used to manage Qt function deprecations * Use position() --- .../Application/Tools/RiaGitDiff.cpp | 4 + .../Application/Tools/RiaImageFileCompare.cpp | 5 ++ .../Application/Tools/RiaQDateTimeTools.cpp | 14 +++- .../Application/Tools/RiaQDateTimeTools.h | 2 + .../Tools/RiaRegressionTestRunner.cpp | 5 +- .../Tools/RiaSummaryStringTools.cpp | 5 +- .../Application/Tools/RiaTextFileCompare.cpp | 5 ++ .../Application/Tools/RiaTextStringTools.cpp | 24 ++++++ .../Application/Tools/RiaTextStringTools.h | 7 +- .../RicNewStimPlanFractureTemplateFeature.cpp | 2 +- .../RicCreateEnsembleSurfaceFeature.cpp | 3 +- .../RicCreateEnsembleWellLogFeature.cpp | 3 +- .../RicNewSummaryEnsembleCurveSetFeature.cpp | 3 +- ...icPasteAsciiDataToSummaryPlotFeatureUi.cpp | 7 +- .../RicSummaryPlotFeatureImpl.cpp | 3 +- .../RicAppendPointsToPolygonFilterFeature.cpp | 6 +- .../FileInterface/RifColorLegendData.cpp | 13 ++- .../RifColumnBasedUserDataParser.cpp | 3 +- .../FileInterface/RifCsvUserDataParser.cpp | 3 +- .../RifEclipseInputFileTools.cpp | 3 +- .../RifEclipseOutputFileTools.cpp | 2 +- .../RifEnsembleFractureStatisticsExporter.cpp | 35 ++++---- .../FileInterface/RifFaultRAJsonWriter.cpp | 28 ++++--- .../FileInterface/RifFaultRAXmlWriter.cpp | 10 ++- .../FileInterface/RifFileParseTools.cpp | 4 + .../RifPerforationIntervalReader.cpp | 4 +- .../FileInterface/RifReaderFmuRft.cpp | 3 +- .../FileInterface/RifReaderMockModel.cpp | 4 +- .../FileInterface/RifReaderObservedData.cpp | 4 +- .../RifStimPlanModelGeologicalFrkExporter.cpp | 32 ++++---- .../RifStimPlanModelPerfsFrkExporter.cpp | 24 +++--- .../FileInterface/RifStimPlanXmlReader.cpp | 4 +- .../FileInterface/RifWellIAFileWriter.cpp | 20 ++--- .../RifWellPathFormationReader.cpp | 6 +- .../RimPolylinesFromFileAnnotation.cpp | 6 +- .../CellFilters/RimCellFilterIntervalTool.cpp | 6 +- .../Completions/RimPerforationInterval.cpp | 5 +- .../ProcessControl/RimProcess.cpp | 5 ++ .../Rim3dOverlayInfoConfig.cpp | 8 +- .../ProjectDataModel/RimProject.cpp | 3 +- .../ProjectDataModel/RimTools.cpp | 6 +- .../Summary/RimEnsembleCurveSet.cpp | 4 +- ...RimSummaryPlotFilterTextCurveSetEditor.cpp | 5 +- .../Summary/RimSummaryPlotManager.cpp | 3 +- .../WellLog/RimWellLogTrack.cpp | 16 ++-- .../RimcSummaryPlotCollection.cpp | 4 +- .../ReservoirDataModel/RigEquil.cpp | 4 +- .../UnitTests/ObservedDataParser-Test.cpp | 15 ++-- .../UnitTests/RiaDateStringParser-Test.cpp | 18 ++--- .../RifTextDataTableFormatter-Test.cpp | 8 +- .../RigHexIntersectionTools-Test.cpp | 10 ++- .../UserInterface/RiuCadNavigation.cpp | 12 ++- .../UserInterface/RiuCategoryLegendFrame.cpp | 4 +- .../UserInterface/RiuDragDrop.cpp | 2 +- .../RiuFemTimeHistoryResultAccessor.cpp | 14 ++-- .../UserInterface/RiuGeoQuestNavigation.cpp | 12 ++- .../RiuGridStatisticsHistogramWidget.h | 2 +- .../UserInterface/RiuMultiPlotPage.cpp | 11 +-- .../UserInterface/RiuPlotCurveSymbol.cpp | 2 +- .../UserInterface/RiuProjectPropertyView.h | 4 +- .../UserInterface/RiuQtChartsPlotWidget.cpp | 11 ++- .../UserInterface/RiuQwtPlotWheelZoomer.cpp | 13 +-- .../UserInterface/RiuRmsNavigation.cpp | 12 ++- .../RiuScalarMapperLegendFrame.cpp | 4 +- .../UserInterface/RiuSimpleHistogramWidget.h | 2 +- .../UserInterface/RiuTextContentFrame.cpp | 4 +- .../cafPdmCore/CMakeLists.txt | 2 + .../cafProjectDataModel/cafPdmCore/caf.cpp | 81 +++++++++++++++++++ .../cafProjectDataModel/cafPdmCore/caf.h | 48 +++++++++++ .../cafTestApplication/CustomObjectEditor.h | 2 +- .../cafTestApplication/WidgetLayoutTest.h | 2 +- .../cafUserInterface/cafPdmUiListView.h | 2 +- .../cafUserInterface/cafPdmUiTableView.h | 2 +- .../cafUserInterface/cafPdmUiTreeView.h | 2 +- Fwk/AppFwk/cafViewer/cafOpenGLWidget.h | 2 +- 75 files changed, 472 insertions(+), 206 deletions(-) create mode 100644 Fwk/AppFwk/cafProjectDataModel/cafPdmCore/caf.cpp create mode 100644 Fwk/AppFwk/cafProjectDataModel/cafPdmCore/caf.h diff --git a/ApplicationLibCode/Application/Tools/RiaGitDiff.cpp b/ApplicationLibCode/Application/Tools/RiaGitDiff.cpp index 2a86a6bfe3..332e9712f4 100644 --- a/ApplicationLibCode/Application/Tools/RiaGitDiff.cpp +++ b/ApplicationLibCode/Application/Tools/RiaGitDiff.cpp @@ -23,6 +23,10 @@ #include #include +// Disable deprecation warning for QProcess::start() +#ifdef _MSC_VER +#pragma warning( disable : 4996 ) +#endif //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaImageFileCompare.cpp b/ApplicationLibCode/Application/Tools/RiaImageFileCompare.cpp index 3667f596bf..66c86da047 100644 --- a/ApplicationLibCode/Application/Tools/RiaImageFileCompare.cpp +++ b/ApplicationLibCode/Application/Tools/RiaImageFileCompare.cpp @@ -19,6 +19,11 @@ #include "RiaImageFileCompare.h" #include +// Disable deprecation warning for QProcess::start() +#ifdef _MSC_VER +#pragma warning( disable : 4996 ) +#endif + //================================================================================================== // // diff --git a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp index ce0ef34965..387fdc9b3b 100644 --- a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp @@ -210,6 +210,18 @@ QDateTime RiaQDateTimeTools::subtractPeriod( const QDateTime& dt, RiaQDateTimeTo return subtractSpan( dt, timeSpan( period ) ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QDateTime RiaQDateTimeTools::createDateTime( const QDate& date ) +{ +#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 ) + return date.startOfDay(); +#else + return QDateTime( date, QTime( 0, 0 ) ); +#endif +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -239,7 +251,7 @@ QDateTime RiaQDateTimeTools::createUtcDateTime() //-------------------------------------------------------------------------------------------------- QDateTime RiaQDateTimeTools::createUtcDateTime( const QDate& date ) { - auto qdt = QDateTime( date ); + auto qdt = createDateTime( date ); qdt.setTimeSpec( currentTimeSpec() ); return qdt; } diff --git a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h index fe62adfd74..7a4861a16a 100644 --- a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h +++ b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h @@ -97,6 +97,8 @@ class RiaQDateTimeTools static QDateTime addPeriod( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period ); static QDateTime subtractPeriod( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period ); + static QDateTime createDateTime( const QDate& date ); + static QDateTime epoch(); static QDateTime createUtcDateTime(); diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp index 04bface28e..8c6c2a214b 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp @@ -26,6 +26,7 @@ #include "RiaProjectModifier.h" #include "RiaRegressionTest.h" #include "RiaTextFileCompare.h" +#include "RiaTextStringTools.h" #include "RicfCommandFileExecutor.h" @@ -538,7 +539,7 @@ QString RiaRegressionTestRunner::diff2htmlHeaderText( const QString& testRootPat QString html; QString oldProjPath = QDir::fromNativeSeparators( testRootPath ); - QStringList pathFolders = oldProjPath.split( "/", QString::KeepEmptyParts ); + QStringList pathFolders = oldProjPath.split( "/" ); QString path; for ( const auto& f : pathFolders ) @@ -611,7 +612,7 @@ void RiaRegressionTestRunner::executeRegressionTests() testConfig.readSettingsFromApplicationStore(); QString testPath = testConfig.regressionTestFolder(); - QStringList testFilter = testConfig.testFilter().split( ";", QString::SkipEmptyParts ); + QStringList testFilter = RiaTextStringTools::splitSkipEmptyParts( testConfig.testFilter(), ";" ); if ( testConfig.appendTestsAfterTestFilter ) { diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp index 313c7588fa..522a9490d3 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp @@ -21,6 +21,7 @@ #include "RiaLogging.h" #include "RiaStdStringTools.h" #include "RiaSummaryTools.h" +#include "RiaTextStringTools.h" #include "RifEclipseSummaryAddress.h" #include "RifReaderEclipseSummary.h" @@ -217,9 +218,7 @@ std::pair, std::vector> //-------------------------------------------------------------------------------------------------- QStringList RiaSummaryStringTools::splitIntoWords( const QString& text ) { - QStringList words = text.split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); - - return words; + return RiaTextStringTools::splitSkipEmptyParts( text, QRegExp( "\\s+" ) ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaTextFileCompare.cpp b/ApplicationLibCode/Application/Tools/RiaTextFileCompare.cpp index b5e0a660ff..141af981c7 100644 --- a/ApplicationLibCode/Application/Tools/RiaTextFileCompare.cpp +++ b/ApplicationLibCode/Application/Tools/RiaTextFileCompare.cpp @@ -22,6 +22,11 @@ #include +// Disable deprecation warning for QProcess::start() +#ifdef _MSC_VER +#pragma warning( disable : 4996 ) +#endif + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp b/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp index ba790d1cd0..9efda3fc7e 100644 --- a/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaTextStringTools.cpp @@ -127,3 +127,27 @@ QString RiaTextStringTools::trimNonAlphaNumericCharacters( const QString& s ) trimmedString.replace( trimRe, "" ); return trimmedString; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const QString& sep /*= " " */ ) +{ +#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 ) + return text.split( sep, Qt::SkipEmptyParts, Qt::CaseInsensitive ); +#else + return text.split( sep, QString::SkipEmptyParts, Qt::CaseInsensitive ); +#endif +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RiaTextStringTools::splitSkipEmptyParts( const QString& text, const QRegExp& regExp ) +{ +#if QT_VERSION >= QT_VERSION_CHECK( 5, 14, 0 ) + return text.split( regExp, Qt::SkipEmptyParts ); +#else + return text.split( regExp, QString::SkipEmptyParts ); +#endif +} diff --git a/ApplicationLibCode/Application/Tools/RiaTextStringTools.h b/ApplicationLibCode/Application/Tools/RiaTextStringTools.h index 8e4a5ca95d..974b4789f6 100644 --- a/ApplicationLibCode/Application/Tools/RiaTextStringTools.h +++ b/ApplicationLibCode/Application/Tools/RiaTextStringTools.h @@ -18,7 +18,8 @@ #pragma once -class QString; +#include + class QStringList; //-------------------------------------------------------------------------------------------------- @@ -31,4 +32,8 @@ QString trimAndRemoveDoubleSpaces( const QString& s ); QString commonRoot( const QStringList& stringList ); QString commonSuffix( const QStringList& stringList ); QString trimNonAlphaNumericCharacters( const QString& s ); + +QStringList splitSkipEmptyParts( const QString& text, const QString& sep = " " ); +QStringList splitSkipEmptyParts( const QString& text, const QRegExp& regExp ); + } // namespace RiaTextStringTools diff --git a/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.cpp index 3831f42c2c..5bb0726c7d 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanFractureTemplateFeature.cpp @@ -85,7 +85,7 @@ std::vector RicNewStimPlanFractureTemplateFeature: defaultDir, "StimPlan XML File (*.xml);;All files(*.*)" ); - auto templates = createNewTemplatesFromFiles( fileNames.toVector().toStdVector() ); + auto templates = createNewTemplatesFromFiles( std::vector( fileNames.begin(), fileNames.end() ) ); if ( !fileNames.isEmpty() ) { diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceFeature.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceFeature.cpp index 9b1c31c497..60964df995 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceFeature.cpp @@ -84,7 +84,8 @@ void RicCreateEnsembleSurfaceFeature::openDialogAndExecuteCommand() if ( propertyDialog.exec() == QDialog::Accepted ) { - executeCommand( *ui, result.files.toVector().toStdVector() ); + auto stdVector = std::vector( result.files.begin(), result.files.end() ); + executeCommand( *ui, stdVector ); } } diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp index d9ab651e14..ee672001d4 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogFeature.cpp @@ -106,7 +106,8 @@ void RicCreateEnsembleWellLogFeature::openDialogAndExecuteCommand() if ( propertyDialog.exec() == QDialog::Accepted && !ui->properties().empty() ) { - executeCommand( *ui, result.files.toStdList() ); + auto stdList = std::list( result.files.begin(), result.files.end() ); + executeCommand( *ui, stdList ); } } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp index 634f49d33f..0441c678a7 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp @@ -21,6 +21,7 @@ #include "RiaColorTables.h" #include "RiaGuiApplication.h" #include "RiaPreferencesSummary.h" +#include "RiaTextStringTools.h" #include "RiaSummaryTools.h" #include "RimEnsembleCurveFilter.h" @@ -62,7 +63,7 @@ std::vector RiaPreferencesSummary* prefs = RiaPreferencesSummary::current(); QString curvesTextFilter = prefs->defaultSummaryCurvesTextFilter(); - QStringList curveFilters = curvesTextFilter.split( ";", QString::SkipEmptyParts ); + QStringList curveFilters = RiaTextStringTools::splitSkipEmptyParts( curvesTextFilter, ";" ); std::set addrs = ensemble->ensembleSummaryAddresses(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp index 239171e268..803b168c3e 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp @@ -18,6 +18,7 @@ #include "RicPasteAsciiDataToSummaryPlotFeatureUi.h" +#include "RiaTextStringTools.h" #include "RifCsvUserDataParser.h" #include "cafPdmUiItem.h" @@ -329,7 +330,7 @@ RicPasteAsciiDataToSummaryPlotFeatureUi::DateFormat std::vector values; { - QStringList split = dateString.split( ".", QString::SkipEmptyParts ); + QStringList split = RiaTextStringTools::splitSkipEmptyParts( dateString, "." ); if ( split.size() == 3 ) { values.push_back( split.at( 0 ).toInt() ); @@ -342,7 +343,7 @@ RicPasteAsciiDataToSummaryPlotFeatureUi::DateFormat } { - QStringList split = dateString.split( "-", QString::SkipEmptyParts ); + QStringList split = RiaTextStringTools::splitSkipEmptyParts( dateString, "-" ); if ( split.size() == 3 ) { values.push_back( split.at( 0 ).toInt() ); @@ -355,7 +356,7 @@ RicPasteAsciiDataToSummaryPlotFeatureUi::DateFormat } { - QStringList split = dateString.split( "/", QString::SkipEmptyParts ); + QStringList split = RiaTextStringTools::splitSkipEmptyParts( dateString, "/" ); if ( split.size() == 3 ) { values.push_back( split.at( 0 ).toInt() ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index 7c71deba0c..3a8ff1bcd1 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -27,6 +27,7 @@ #include "RiaLogging.h" #include "RiaPreferencesSummary.h" #include "RiaSummaryStringTools.h" +#include "RiaTextStringTools.h" #include "RicCreateSummaryCaseCollectionFeature.h" #include "RicImportGeneralDataFeature.h" @@ -70,7 +71,7 @@ std::vector RicSummaryPlotFeatureImpl::addDefaultCurvesToPlot( RiaPreferencesSummary* prefs = RiaPreferencesSummary::current(); QString curvesTextFilter = prefs->defaultSummaryCurvesTextFilter(); - QStringList curveFilters = curvesTextFilter.split( ";", QString::SkipEmptyParts ); + QStringList curveFilters = RiaTextStringTools::splitSkipEmptyParts( curvesTextFilter, ";" ); bool addHistoryCurve = false; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicAppendPointsToPolygonFilterFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicAppendPointsToPolygonFilterFeature.cpp index 2b986fd7f5..bcd6d48837 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicAppendPointsToPolygonFilterFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicAppendPointsToPolygonFilterFeature.cpp @@ -18,7 +18,7 @@ #include "RicAppendPointsToPolygonFilterFeature.h" -CAF_CMD_SOURCE_INIT( RicAppendPointsToPolygonFilterFeature, "RicAppendPointsToPolygonFilterFeature" ); +#include "RiaTextStringTools.h" #include "RimPolygonFilter.h" #include "RimPolylineTarget.h" @@ -30,6 +30,8 @@ CAF_CMD_SOURCE_INIT( RicAppendPointsToPolygonFilterFeature, "RicAppendPointsToPo #include #include +CAF_CMD_SOURCE_INIT( RicAppendPointsToPolygonFilterFeature, "RicAppendPointsToPolygonFilterFeature" ); + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -62,7 +64,7 @@ void RicAppendPointsToPolygonFilterFeature::onActionTriggered( bool isChecked ) if ( clipboard ) { QString content = clipboard->text(); - listOfThreeDoubles = content.split( "\n", QString::SkipEmptyParts ); + listOfThreeDoubles = RiaTextStringTools::splitSkipEmptyParts( content, "\n" ); } std::vector points; diff --git a/ApplicationLibCode/FileInterface/RifColorLegendData.cpp b/ApplicationLibCode/FileInterface/RifColorLegendData.cpp index f5af7a30d4..f2342c811b 100644 --- a/ApplicationLibCode/FileInterface/RifColorLegendData.cpp +++ b/ApplicationLibCode/FileInterface/RifColorLegendData.cpp @@ -18,6 +18,7 @@ #include "RifColorLegendData.h" +#include "RiaTextStringTools.h" #include "RigFormationNames.h" #include "cafAssert.h" @@ -66,7 +67,7 @@ cvf::ref RifColorLegendData::readLyrFormationNameFile( const while ( !stream.atEnd() ) { QString line = stream.readLine(); - QStringList lineSegs = line.split( "'", QString::KeepEmptyParts ); + QStringList lineSegs = line.split( "'" ); if ( lineSegs.size() == 0 ) continue; // Empty line if ( lineSegs.size() == 1 ) continue; // No name present. Comment line ? @@ -84,16 +85,14 @@ cvf::ref RifColorLegendData::readLyrFormationNameFile( const QString numberString = lineSegs[2]; if ( commentMarkPos >= 0 ) numberString.truncate( commentMarkPos ); - QString colorWord = numberString.split( " ", QString::SkipEmptyParts ).last(); // extract last word which may - // contain formation color + // extract last word which may contain formation color + QString colorWord = RiaTextStringTools::splitSkipEmptyParts( numberString ).last(); if ( QColor::isValidColor( colorWord ) ) numberString.remove( colorWord ); // remove color if present as last word on line - QStringList numberWords = numberString.split( QRegExp( "-" ), QString::SkipEmptyParts ); // extract words - // containing - // formation - // number(s) + // extract words containing formation number(s) + QStringList numberWords = RiaTextStringTools::splitSkipEmptyParts( numberString, QRegExp( "-" ) ); if ( numberWords.size() == 2 ) // formation range with or without color at end of line { diff --git a/ApplicationLibCode/FileInterface/RifColumnBasedUserDataParser.cpp b/ApplicationLibCode/FileInterface/RifColumnBasedUserDataParser.cpp index 2a34731bd5..ab9cdf70b0 100644 --- a/ApplicationLibCode/FileInterface/RifColumnBasedUserDataParser.cpp +++ b/ApplicationLibCode/FileInterface/RifColumnBasedUserDataParser.cpp @@ -23,6 +23,7 @@ #include "RiaDateStringParser.h" #include "RiaLogging.h" +#include "RiaTextStringTools.h" #include "cvfAssert.h" @@ -116,7 +117,7 @@ void RifColumnBasedUserDataParser::parseTableData( const QString& data ) do { QString qLine = QString::fromStdString( line ); - QStringList entries = qLine.split( " ", QString::SkipEmptyParts ); + QStringList entries = RiaTextStringTools::splitSkipEmptyParts( qLine ); if ( stepTypeIndex > -1 && (unsigned int)entries.size() < columnInfos.size() ) { diff --git a/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp b/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp index 6fe91ff015..cf491a8b75 100644 --- a/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp +++ b/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp @@ -30,6 +30,7 @@ #include "SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h" +#include "caf.h" #include "cvfAssert.h" #include @@ -733,7 +734,7 @@ QLocale RifCsvUserDataParser::localeFromDecimalSeparator( const QString& decimal { if ( decimalSeparator == "," ) { - return QLocale::Norwegian; + return caf::norwegianLocale(); } return QLocale::c(); } diff --git a/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp index 95a9da6c0a..ad889028ec 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseInputFileTools.cpp @@ -48,6 +48,7 @@ #include #include +#include "RiaTextStringTools.h" #include "ert/ecl/ecl_box.hpp" #include "ert/ecl/ecl_grid.hpp" #include "ert/ecl/ecl_kw.h" @@ -813,7 +814,7 @@ void RifEclipseInputFileTools::parseAndReadPathAliasKeyword( const QString& // definition; 'I+' line.remove( "'" ); - QStringList entries = line.split( " ", QString::SkipEmptyParts ); + QStringList entries = RiaTextStringTools::splitSkipEmptyParts( line ); if ( entries.size() < 2 ) { continue; diff --git a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp index 3880e7d296..fafa451292 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseOutputFileTools.cpp @@ -673,7 +673,7 @@ void RifEclipseOutputFileTools::createReportStepsMetaData( std::vectoryear, restart_header->month, restart_header->day ) ); reportStep.dateTime = reportDateTime; } diff --git a/ApplicationLibCode/FileInterface/RifEnsembleFractureStatisticsExporter.cpp b/ApplicationLibCode/FileInterface/RifEnsembleFractureStatisticsExporter.cpp index a220691015..878bd10c3e 100644 --- a/ApplicationLibCode/FileInterface/RifEnsembleFractureStatisticsExporter.cpp +++ b/ApplicationLibCode/FileInterface/RifEnsembleFractureStatisticsExporter.cpp @@ -18,11 +18,10 @@ #include "RifEnsembleFractureStatisticsExporter.h" -// #include "RiaEclipseUnitTools.h" - -// #include "RimStimPlanModel.h" #include "RiaDefines.h" #include "RigSlice2D.h" + +#include "caf.h" #include "cafAssert.h" #include @@ -61,7 +60,7 @@ bool RifEnsembleFractureStatisticsExporter::writeAsStimPlanXml( const std::vecto //-------------------------------------------------------------------------------------------------- void RifEnsembleFractureStatisticsExporter::appendHeaderToStream( QTextStream& stream ) { - stream << "" << endl << "" << endl; + stream << "" << caf::endl << "" << caf::endl; } //-------------------------------------------------------------------------------------------------- @@ -76,15 +75,15 @@ void RifEnsembleFractureStatisticsExporter::appendPropertiesToStream( { CAF_ASSERT( statistics.size() == properties.size() ); - stream << "" << endl; + stream << "" << caf::endl; for ( size_t s = 0; s < statistics.size(); s++ ) { QString propertyName = properties[s].first; QString propertyUnit = properties[s].second; - stream << QString( "" ).arg( propertyName ).arg( propertyUnit ) << endl; - stream << QString( "" << caf::endl; + stream << "" << caf::endl; } - stream << "" << endl; + stream << "" << caf::endl; } //-------------------------------------------------------------------------------------------------- @@ -116,7 +115,7 @@ void RifEnsembleFractureStatisticsExporter::appendOrientationToStream( QTextStre if ( orientation != RigStimPlanFractureDefinition::Orientation::UNDEFINED ) { QString orientationString = getStringForOrientation( orientation ); - stream << QString( "%1" ).arg( orientationString ) << endl; + stream << QString( "%1" ).arg( orientationString ) << caf::endl; } } @@ -130,19 +129,19 @@ void RifEnsembleFractureStatisticsExporter::appendGridDimensionsToStream( QTextS { QString unitString = getStringForUnitSystem( unitSystem ); stream << QString( "" ).arg( gridXs.size() ).arg( gridYs.size() ).arg( unitString ) - << endl; + << caf::endl; stream << "["; for ( auto x : gridXs ) stream << x << " "; - stream << "]" << endl; + stream << "]" << caf::endl; stream << "["; for ( auto y : gridYs ) stream << y << " "; - stream << "]" << endl; + stream << "]" << caf::endl; - stream << "" << endl; + stream << "" << caf::endl; } //-------------------------------------------------------------------------------------------------- @@ -150,7 +149,7 @@ void RifEnsembleFractureStatisticsExporter::appendGridDimensionsToStream( QTextS //-------------------------------------------------------------------------------------------------- void RifEnsembleFractureStatisticsExporter::appendFooterToStream( QTextStream& stream ) { - stream << "" << endl; + stream << "" << caf::endl; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifFaultRAJsonWriter.cpp b/ApplicationLibCode/FileInterface/RifFaultRAJsonWriter.cpp index 23630bcf28..712f3b9407 100644 --- a/ApplicationLibCode/FileInterface/RifFaultRAJsonWriter.cpp +++ b/ApplicationLibCode/FileInterface/RifFaultRAJsonWriter.cpp @@ -23,6 +23,8 @@ #include "RimGenericParameter.h" #include "RimParameterGroup.h" +#include "caf.h" + #include #include @@ -40,12 +42,12 @@ bool RifFaultRAJSonWriter::writeToPreprocFile( RimFaultRAPreprocSettings& settin { QTextStream stream( &file ); - stream << "{" << endl; - stream << "\"odb_path\": \"" + settings.geomechCaseFilename() + "\"," << endl; - stream << "\"time_start\": \"" + settings.startTimeStepGeoMech() + "\"," << endl; - stream << "\"time_end\": \"" + settings.endTimeStepGeoMech() + "\"," << endl; - stream << "\"out_path\": \"" + settings.outputAbaqusDirectory() + "\"" << endl; - stream << "}" << endl; + stream << "{" << caf::endl; + stream << "\"odb_path\": \"" + settings.geomechCaseFilename() + "\"," << caf::endl; + stream << "\"time_start\": \"" + settings.startTimeStepGeoMech() + "\"," << caf::endl; + stream << "\"time_end\": \"" + settings.endTimeStepGeoMech() + "\"," << caf::endl; + stream << "\"out_path\": \"" + settings.outputAbaqusDirectory() + "\"" << caf::endl; + stream << "}" << caf::endl; file.close(); } @@ -73,26 +75,26 @@ bool RifFaultRAJSonWriter::writeToPostprocFile( int faultID, RimFaultRAPostprocS { QTextStream stream( &file ); - stream << "{" << endl; + stream << "{" << caf::endl; if ( settings->geomechEnabled() ) { if ( QFile::exists( settings->advancedMacrisDatabase() ) ) - stream << "\"MacrisCalcCalibration_path\": \"" + settings->advancedMacrisDatabase() + "\"," << endl; + stream << "\"MacrisCalcCalibration_path\": \"" + settings->advancedMacrisDatabase() + "\"," << caf::endl; } if ( QFile::exists( settings->basicMacrisDatabase() ) ) - stream << "\"MacrisCalc_path\": \"" + settings->basicMacrisDatabase() + "\"," << endl; + stream << "\"MacrisCalc_path\": \"" + settings->basicMacrisDatabase() + "\"," << caf::endl; - stream << "\"base_directory_path\": \"" + settings->outputBaseDirectory() + "\"," << endl; + stream << "\"base_directory_path\": \"" + settings->outputBaseDirectory() + "\"," << caf::endl; for ( auto p : settings->parameters()->parameters() ) { - stream << "\"" + p->name() + "\" : " + p->stringValue() + "," << endl; + stream << "\"" + p->name() + "\" : " + p->stringValue() + "," << caf::endl; } - stream << "\"tsurf_loadsteps\": [ " + settings->stepsToLoad().join( ',' ) + " ]" << endl; - stream << "}" << endl; + stream << "\"tsurf_loadsteps\": [ " + settings->stepsToLoad().join( ',' ) + " ]" << caf::endl; + stream << "}" << caf::endl; file.close(); } diff --git a/ApplicationLibCode/FileInterface/RifFaultRAXmlWriter.cpp b/ApplicationLibCode/FileInterface/RifFaultRAXmlWriter.cpp index 282b3ace13..801a067e29 100644 --- a/ApplicationLibCode/FileInterface/RifFaultRAXmlWriter.cpp +++ b/ApplicationLibCode/FileInterface/RifFaultRAXmlWriter.cpp @@ -21,6 +21,8 @@ #include "RimFaultRASettings.h" #include "RimGenericParameter.h" +#include "caf.h" + #include #include @@ -56,15 +58,15 @@ bool RifFaultRAXmlWriter::writeParametersToXML( QString filename, std::list" << endl; - stream << "" << endl; + stream << "" << caf::endl; + stream << "" << caf::endl; for ( auto& p : params ) { QString tmpStr = QString( "<%1>%2" ).arg( p->name(), p->stringValue() ); - stream << tmpStr << endl; + stream << tmpStr << caf::endl; } - stream << "" << endl; + stream << "" << caf::endl; bResult = true; } diff --git a/ApplicationLibCode/FileInterface/RifFileParseTools.cpp b/ApplicationLibCode/FileInterface/RifFileParseTools.cpp index ca7d4e6884..c355bb6f24 100644 --- a/ApplicationLibCode/FileInterface/RifFileParseTools.cpp +++ b/ApplicationLibCode/FileInterface/RifFileParseTools.cpp @@ -18,6 +18,10 @@ #include "RifFileParseTools.h" +// Disable deprecation warning for QString::SkipEmptyParts +#ifdef _MSC_VER +#pragma warning( disable : 4996 ) +#endif //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifPerforationIntervalReader.cpp b/ApplicationLibCode/FileInterface/RifPerforationIntervalReader.cpp index aa807ad5a5..c52bdb53e9 100644 --- a/ApplicationLibCode/FileInterface/RifPerforationIntervalReader.cpp +++ b/ApplicationLibCode/FileInterface/RifPerforationIntervalReader.cpp @@ -18,6 +18,8 @@ #include "RifPerforationIntervalReader.h" +#include "RiaTextStringTools.h" + #include #include @@ -79,7 +81,7 @@ void RifPerforationIntervalReader::readFileIntoMap( const QString& // Replace any tabs with spaces to enable splitting on spaces line.replace( "\t", " " ); - QStringList parts = line.split( " ", QString::SkipEmptyParts ); + QStringList parts = RiaTextStringTools::splitSkipEmptyParts( line ); if ( line.startsWith( "WELLNAME" ) ) { diff --git a/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp b/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp index ea4d7d9653..8cbe04d2bd 100644 --- a/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp @@ -18,6 +18,7 @@ #include "RifReaderFmuRft.h" #include "RiaLogging.h" +#include "RiaQDateTimeTools.h" #include "cafAssert.h" @@ -438,7 +439,7 @@ RifReaderFmuRft::WellObservationMap RifReaderFmuRft::loadWellDates( QDir& dir, Q return WellObservationMap(); } - QDateTime dateTime( QDate( year, month, day ) ); + QDateTime dateTime = RiaQDateTimeTools::createDateTime( QDate( year, month, day ) ); dateTime.setTimeSpec( Qt::UTC ); WellObservationSet observationSet( dateTime, measurementIndex ); validObservations.insert( std::make_pair( wellName, observationSet ) ); diff --git a/ApplicationLibCode/FileInterface/RifReaderMockModel.cpp b/ApplicationLibCode/FileInterface/RifReaderMockModel.cpp index 2598adef9b..420fa204ca 100644 --- a/ApplicationLibCode/FileInterface/RifReaderMockModel.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderMockModel.cpp @@ -20,6 +20,8 @@ #include "RifReaderMockModel.h" +#include "RiaQDateTimeTools.h" + #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" #include "RigEclipseResultInfo.h" @@ -43,7 +45,7 @@ bool RifReaderMockModel::open( const QString& fileName, RigEclipseCaseData* ecli for ( int i = 0; i < static_cast( m_reservoirBuilder.timeStepCount() ); i++ ) { - dates.push_back( QDateTime( QDate( 2012 + i, 6, 1 ) ) ); + dates.push_back( RiaQDateTimeTools::createDateTime( QDate( 2012 + i, 6, 1 ) ) ); days.push_back( i ); repNumbers.push_back( i ); } diff --git a/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp b/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp index 41d3a8446a..0f0ec0bae0 100644 --- a/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp @@ -18,6 +18,8 @@ #include "RifReaderObservedData.h" +#include "caf.h" + #include "RifCsvUserDataParser.h" #include "RifEclipseSummaryAddress.h" @@ -50,7 +52,7 @@ bool RifReaderObservedData::open( const QString& h AsciiDataParseOptions parseOptions; parseOptions.dateFormat = "yyyy-MM-dd"; parseOptions.cellSeparator = "\t"; - parseOptions.locale = QLocale::Norwegian; + parseOptions.locale = caf::norwegianLocale(); QString data; QTextStream out( &data ); diff --git a/ApplicationLibCode/FileInterface/RifStimPlanModelGeologicalFrkExporter.cpp b/ApplicationLibCode/FileInterface/RifStimPlanModelGeologicalFrkExporter.cpp index cb921fa19f..655b50fd55 100644 --- a/ApplicationLibCode/FileInterface/RifStimPlanModelGeologicalFrkExporter.cpp +++ b/ApplicationLibCode/FileInterface/RifStimPlanModelGeologicalFrkExporter.cpp @@ -29,6 +29,8 @@ #include "RimStimPlanModel.h" #include "RimStimPlanModelCalculator.h" +#include "caf.h" + #include #include #include @@ -273,7 +275,7 @@ bool RifStimPlanModelGeologicalFrkExporter::writeToCsvFile( const QString& //-------------------------------------------------------------------------------------------------- void RifStimPlanModelGeologicalFrkExporter::appendHeaderToStream( QTextStream& stream ) { - stream << "" << '\n' << "" << endl; + stream << "" << '\n' << "" << caf::endl; } //-------------------------------------------------------------------------------------------------- @@ -283,23 +285,23 @@ void RifStimPlanModelGeologicalFrkExporter::appendToStream( QTextStream& const QString& label, const std::vector& values ) { - stream << "" << endl - << "" << endl - << label << endl - << "" << endl - << "" << endl - << 1 << endl - << "" << endl - << "" << endl - << values.size() << endl - << "" << endl - << "" << endl; + stream << "" << caf::endl + << "" << caf::endl + << label << caf::endl + << "" << caf::endl + << "" << caf::endl + << 1 << caf::endl + << "" << caf::endl + << "" << caf::endl + << values.size() << caf::endl + << "" << caf::endl + << "" << caf::endl; for ( auto val : values ) { - stream << val << endl; + stream << val << caf::endl; } - stream << "" << '\n' << "" << endl; + stream << "" << '\n' << "" << caf::endl; } //-------------------------------------------------------------------------------------------------- @@ -307,7 +309,7 @@ void RifStimPlanModelGeologicalFrkExporter::appendToStream( QTextStream& //-------------------------------------------------------------------------------------------------- void RifStimPlanModelGeologicalFrkExporter::appendFooterToStream( QTextStream& stream ) { - stream << "" << endl; + stream << "" << caf::endl; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifStimPlanModelPerfsFrkExporter.cpp b/ApplicationLibCode/FileInterface/RifStimPlanModelPerfsFrkExporter.cpp index 901ca11efb..0658f50b73 100644 --- a/ApplicationLibCode/FileInterface/RifStimPlanModelPerfsFrkExporter.cpp +++ b/ApplicationLibCode/FileInterface/RifStimPlanModelPerfsFrkExporter.cpp @@ -27,6 +27,8 @@ #include "RigWellPath.h" #include "RigWellPathGeometryTools.h" +#include "caf.h" + #include #include @@ -75,7 +77,7 @@ bool RifStimPlanModelPerfsFrkExporter::writeToFile( RimStimPlanModel* stimPlanMo //-------------------------------------------------------------------------------------------------- void RifStimPlanModelPerfsFrkExporter::appendHeaderToStream( QTextStream& stream ) { - stream << "" << '\n' << "" << endl; + stream << "" << '\n' << "" << caf::endl; } //-------------------------------------------------------------------------------------------------- @@ -83,7 +85,7 @@ void RifStimPlanModelPerfsFrkExporter::appendHeaderToStream( QTextStream& stream //-------------------------------------------------------------------------------------------------- void RifStimPlanModelPerfsFrkExporter::appendFractureOrientationToStream( QTextStream& stream, bool isTransverse ) { - stream << "" << '\n' << static_cast( isTransverse ) << '\n' << "" << endl; + stream << "" << '\n' << static_cast( isTransverse ) << '\n' << "" << caf::endl; } //-------------------------------------------------------------------------------------------------- @@ -91,14 +93,14 @@ void RifStimPlanModelPerfsFrkExporter::appendFractureOrientationToStream( QTextS //-------------------------------------------------------------------------------------------------- void RifStimPlanModelPerfsFrkExporter::appendPerforationToStream( QTextStream& stream, int index, double topMD, double bottomMD ) { - stream << "" << endl - << "" << endl - << topMD << endl - << "" << endl - << "" << endl - << bottomMD << endl - << "" << endl - << "" << endl; + stream << "" << caf::endl + << "" << caf::endl + << topMD << caf::endl + << "" << caf::endl + << "" << caf::endl + << bottomMD << caf::endl + << "" << caf::endl + << "" << caf::endl; } //-------------------------------------------------------------------------------------------------- @@ -106,7 +108,7 @@ void RifStimPlanModelPerfsFrkExporter::appendPerforationToStream( QTextStream& s //-------------------------------------------------------------------------------------------------- void RifStimPlanModelPerfsFrkExporter::appendFooterToStream( QTextStream& stream ) { - stream << "" << endl; + stream << "" << caf::endl; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp b/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp index 2c08b87ee2..72a5aa8a0d 100644 --- a/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp +++ b/ApplicationLibCode/FileInterface/RifStimPlanXmlReader.cpp @@ -22,6 +22,8 @@ #include "RiaEclipseUnitTools.h" #include "RiaFractureDefines.h" #include "RiaLogging.h" +#include "RiaTextStringTools.h" + #include "RigStimPlanFractureDefinition.h" #include @@ -474,7 +476,7 @@ void RifStimPlanXmlReader::getGriddingValues( QXmlStreamReader& xmlStream, QString gridValuesString = xmlStream.readElementText().replace( '\n', ' ' ); gridValuesString = gridValuesString.replace( '[', ' ' ).replace( ']', ' ' ); - for ( const QString& value : gridValuesString.split( ' ', QString::SkipEmptyParts ) ) + for ( const QString& value : RiaTextStringTools::splitSkipEmptyParts( gridValuesString ) ) { if ( value.size() > 0 ) { diff --git a/ApplicationLibCode/FileInterface/RifWellIAFileWriter.cpp b/ApplicationLibCode/FileInterface/RifWellIAFileWriter.cpp index 41436e7ac7..059ea44095 100644 --- a/ApplicationLibCode/FileInterface/RifWellIAFileWriter.cpp +++ b/ApplicationLibCode/FileInterface/RifWellIAFileWriter.cpp @@ -24,6 +24,8 @@ #include "RimWellIAModelData.h" #include "RimWellIASettings.h" +#include "caf.h" + #include #include @@ -41,11 +43,11 @@ bool RifWellIAFileWriter::writeToJsonFile( RimWellIASettings& settings, QString& { QTextStream stream( &file ); - stream << "{" << endl; + stream << "{" << caf::endl; stream << "\"comments\": \"All units are SI unless mentioned otherwise; temperature is in Celcius; use forward " "slash (/) in 'directory' definition\"," - << endl; - stream << "\"directory\": \"" + settings.outputBaseDirectory() + "\"," << endl; + << caf::endl; + stream << "\"directory\": \"" + settings.outputBaseDirectory() + "\"," << caf::endl; stream << "\"output_name\": \"" + settings.name() + "\""; RimParameterGroups mergedGroups; @@ -63,9 +65,9 @@ bool RifWellIAFileWriter::writeToJsonFile( RimWellIASettings& settings, QString& for ( auto& group : mergedGroups.groups() ) { - stream << "," << endl; + stream << "," << caf::endl; - stream << "\"" + group->name() + "\": {" << endl; + stream << "\"" + group->name() + "\": {" << caf::endl; const auto& parameters = group->parameters(); @@ -78,13 +80,13 @@ bool RifWellIAFileWriter::writeToJsonFile( RimWellIASettings& settings, QString& { stream << ","; } - stream << endl; + stream << caf::endl; } stream << " }"; } - stream << endl << "}" << endl; + stream << caf::endl << "}" << caf::endl; file.close(); } else @@ -114,7 +116,7 @@ bool RifWellIAFileWriter::writeToCSVFile( RimWellIASettings& settings, QString& stream << "Time_days, Pcasing_Pa, P_form_Pa, Temp_C," "U1-1,U2,U3,U1-2,U2,U3,U1-3,U2,U3,U1-4,U2,U3,U1-5,U2,U3,U1-6,U2,U3,U1-7,U2,U3,U1-8,U2,U3," "X,Y,Z,X2,Y,Z,X3,Y,Z,X4,Y,Z,X5,Y,Z,X6,Y,Z,X7,Y,Z,X8,Y,Z"; - stream << endl; + stream << caf::endl; for ( auto& modeldata : settings.modelData() ) { @@ -145,7 +147,7 @@ bool RifWellIAFileWriter::writeToCSVFile( RimWellIASettings& settings, QString& stream << ","; stream << pos.z(); } - stream << endl; + stream << caf::endl; } } else diff --git a/ApplicationLibCode/FileInterface/RifWellPathFormationReader.cpp b/ApplicationLibCode/FileInterface/RifWellPathFormationReader.cpp index bc488c18d7..c4bce7b0d1 100644 --- a/ApplicationLibCode/FileInterface/RifWellPathFormationReader.cpp +++ b/ApplicationLibCode/FileInterface/RifWellPathFormationReader.cpp @@ -155,7 +155,7 @@ void RifWellPathFormationReader::readFile( const QString& filePath, QString line = data.readLine().toLower(); removeWhiteSpaces( &line ); - header = line.split( ';', QString::KeepEmptyParts ); + header = line.split( ';' ); } static const QString wellNameText = "wellname"; @@ -172,7 +172,7 @@ void RifWellPathFormationReader::readFile( const QString& filePath, { QString line = data.readLine(); - QStringList dataLine = line.split( ';', QString::KeepEmptyParts ); + QStringList dataLine = line.split( ';' ); if ( dataLine.size() != header.size() ) continue; bool conversionOk; @@ -224,7 +224,7 @@ void RifWellPathFormationReader::readFile( const QString& filePath, { QString line = data.readLine(); - QStringList dataLine = line.split( ';', QString::KeepEmptyParts ); + QStringList dataLine = line.split( ';' ); if ( dataLine.size() != header.size() ) continue; QString wellName = dataLine[wellNameIndex]; diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp index d3798411bc..0a42c0587f 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylinesFromFileAnnotation.cpp @@ -19,7 +19,9 @@ #include "RimPolylinesFromFileAnnotation.h" #include "RiaLogging.h" +#include "RiaTextStringTools.h" #include "RigPolyLinesData.h" + #include "RimAnnotationCollection.h" #include "RimAnnotationLineAppearance.h" @@ -86,10 +88,10 @@ void RimPolylinesFromFileAnnotation::readPolyLinesFile( QString* errorMessage ) while ( !stream.atEnd() ) { QString line = stream.readLine(); - QStringList commentLineSegs = line.split( "#", QString::KeepEmptyParts ); + QStringList commentLineSegs = line.split( "#" ); if ( commentLineSegs.empty() ) continue; // Empty line - QStringList lineSegs = commentLineSegs[0].split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); + QStringList lineSegs = RiaTextStringTools::splitSkipEmptyParts( commentLineSegs[0], QRegExp( "\\s+" ) ); if ( lineSegs.empty() ) continue; // No data diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterIntervalTool.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterIntervalTool.cpp index e552a1b029..1bcd9a2405 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterIntervalTool.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterIntervalTool.cpp @@ -18,6 +18,8 @@ #include "RimCellFilterIntervalTool.h" +#include "RiaTextStringTools.h" + #include //-------------------------------------------------------------------------------------------------- @@ -104,11 +106,11 @@ void RimCellFilterIntervalTool::setInterval( bool enabled, QString intervalText if ( !enabled ) return; - QStringList parts = intervalText.split( ',', QString::SkipEmptyParts ); + QStringList parts = RiaTextStringTools::splitSkipEmptyParts( intervalText, "," ); for ( auto& part : parts ) { - QStringList minmax = part.split( '-', QString::SkipEmptyParts ); + QStringList minmax = RiaTextStringTools::splitSkipEmptyParts( part, "-" ); switch ( minmax.size() ) { case 1: diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp index 2eb0c2e460..07aa19f75c 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationInterval.cpp @@ -21,6 +21,7 @@ #include "RiaColorTables.h" #include "RiaEclipseUnitTools.h" +#include "RiaQDateTimeTools.h" #include "RigCaseCellResultsData.h" #include "RigWellPath.h" @@ -99,7 +100,7 @@ void RimPerforationInterval::setCustomStartDate( const QDate& date ) { if ( date.isValid() ) { - m_startDate = QDateTime( date ); + m_startDate = RiaQDateTimeTools::createDateTime( date ); } } @@ -110,7 +111,7 @@ void RimPerforationInterval::setCustomEndDate( const QDate& date ) { if ( date.isValid() ) { - m_endDate = QDateTime( date ); + m_endDate = RiaQDateTimeTools::createDateTime( date ); } } diff --git a/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp b/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp index 6629a7fce1..815ead8a87 100644 --- a/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp +++ b/ApplicationLibCode/ProjectDataModel/ProcessControl/RimProcess.cpp @@ -25,6 +25,11 @@ #include +// Disable deprecation warning for QProcess::start() +#ifdef _MSC_VER +#pragma warning( disable : 4996 ) +#endif + CAF_PDM_SOURCE_INIT( RimProcess, "RimProcess" ); int RimProcess::m_nextProcessId = 1; diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp index e90f418438..fb825d6450 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dOverlayInfoConfig.cpp @@ -29,14 +29,10 @@ #include "RigActiveCellInfo.h" #include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" -// #include "RigEclipseMultiPropertyStatCalc.h" -// #include "RigEclipseNativeVisibleCellsStatCalc.h" -// #include "RigFemNativeVisibleCellsStatCalc.h" #include "RigFemPartCollection.h" #include "RigFemPartResultsCollection.h" #include "RigFemResultAddress.h" #include "RigFlowDiagResults.h" -// #include "RigFlowDiagVisibleCellsStatCalc.h" #include "RigGeoMechCaseData.h" #include "RigMainGrid.h" @@ -64,6 +60,8 @@ #include "RiuViewer.h" +#include "caf.h" + #include CAF_PDM_SOURCE_INIT( Rim3dOverlayInfoConfig, "View3dOverlayInfoConfig" ); @@ -289,7 +287,7 @@ QString Rim3dOverlayInfoConfig::caseInfoText( RimEclipseView* eclipseView ) { QString caseName = eclipseView->eclipseCase()->caseUserDescription(); - QLocale localeWithSpaceAsGroupSeparator( QLocale::Norwegian ); + QLocale localeWithSpaceAsGroupSeparator( caf::norwegianLocale() ); RimEclipseContourMapView* contourMap = dynamic_cast( eclipseView ); if ( contourMap && contourMap->contourMapProjection() ) diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index da016e3a61..ce31ce0e29 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -25,6 +25,7 @@ #include "RiaFilePathTools.h" #include "RiaGuiApplication.h" #include "RiaProjectFileVersionTools.h" +#include "RiaTextStringTools.h" #include "RiaVersionInfo.h" #include "RicfCommandObject.h" @@ -1517,7 +1518,7 @@ class GlobalPathListMapper GlobalPathListMapper( const QString& globalPathListTable ) { m_maxUsedIdNumber = 0; - QStringList pathPairs = globalPathListTable.split( ";", QString::SkipEmptyParts ); + QStringList pathPairs = RiaTextStringTools::splitSkipEmptyParts( globalPathListTable, ";" ); for ( const QString& pathIdPathPair : pathPairs ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimTools.cpp b/ApplicationLibCode/ProjectDataModel/RimTools.cpp index 305aebc686..dffce8d8a3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTools.cpp @@ -125,13 +125,13 @@ QString RimTools::relocateFile( const QString& originalFileName, QFileInfo fileNameFileInfo( QDir::fromNativeSeparators( fileName ) ); QString fileNamePath = fileNameFileInfo.path(); QString fileNameWithoutPath = fileNameFileInfo.fileName(); - QStringList fileNamePathElements = fileNamePath.split( "/", QString::KeepEmptyParts ); + QStringList fileNamePathElements = fileNamePath.split( "/" ); QString oldProjPath = QDir::fromNativeSeparators( oldProjectPath ); - QStringList oldProjPathElements = oldProjPath.split( "/", QString::KeepEmptyParts ); + QStringList oldProjPathElements = oldProjPath.split( "/" ); QString newProjPath = QDir::fromNativeSeparators( newProjectPath ); - QStringList newProjPathElements = newProjPath.split( "/", QString::KeepEmptyParts ); + QStringList newProjPathElements = newProjPath.split( "/" ); // Find the possible equal start of the old project path, and the referenced file diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index a6fafc692c..d3056f3c0f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -739,8 +739,8 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi } else if ( changedField == &m_minDateRange || changedField == &m_maxDateRange ) { - m_minTimeStep = RiaTimeTTools::fromQDateTime( QDateTime( m_minDateRange() ) ); - m_maxTimeStep = RiaTimeTTools::fromQDateTime( QDateTime( m_maxDateRange() ) ); + m_minTimeStep = RiaTimeTTools::fromQDateTime( RiaQDateTimeTools::createDateTime( m_minDateRange() ) ); + m_maxTimeStep = RiaTimeTTools::fromQDateTime( RiaQDateTimeTools::createDateTime( m_maxDateRange() ) ); updateCurveColors(); updateTimeAnnotations(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp index 022944f91b..e6b1769d16 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp @@ -23,6 +23,7 @@ #include "RiaStdStringTools.h" #include "RiaStringListSerializer.h" #include "RiaSummaryCurveDefinition.h" +#include "RiaTextStringTools.h" #include "RifReaderEclipseSummary.h" #include "RifSummaryReaderInterface.h" @@ -183,7 +184,7 @@ void RimSummaryPlotFilterTextCurveSetEditor::updateTextFilter() // Todo: possibly check grid time history curves also QStringList allCurveAddressFilters = - curveFilterTextWithoutOutdatedLabel().split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); + RiaTextStringTools::splitSkipEmptyParts( curveFilterTextWithoutOutdatedLabel(), QRegExp( "\\s+" ) ); std::vector usedFilters; std::set filteredAddressesFromSource; @@ -440,7 +441,7 @@ void RimSummaryPlotFilterTextCurveSetEditor::updateParentPlot() std::set curveDefinitions; QStringList allCurveAddressFilters = - curveFilterTextWithoutOutdatedLabel().split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); + RiaTextStringTools::splitSkipEmptyParts( curveFilterTextWithoutOutdatedLabel(), QRegExp( "\\s+" ) ); std::vector accumulatedUsedFilters( allCurveAddressFilters.size(), false ); for ( SummarySource* currSource : selectedSummarySources() ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index c5d72bdf7f..1d6dded4fe 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -22,6 +22,7 @@ #include "RiaStringListSerializer.h" #include "RiaSummaryStringTools.h" #include "RiaSummaryTools.h" +#include "RiaTextStringTools.h" #include "RifReaderEclipseSummary.h" #include "RifSummaryReaderInterface.h" @@ -507,7 +508,7 @@ std::set RimSummaryPlotManager::filteredAddresses() if ( nativeAddresses.empty() ) return {}; - QStringList allCurveAddressFilters = m_filterText().split( QRegExp( "\\s+" ), QString::SkipEmptyParts ); + QStringList allCurveAddressFilters = RiaTextStringTools::splitSkipEmptyParts( m_filterText(), QRegExp( "\\s+" ) ); return RiaSummaryStringTools::computeFilteredAddresses( allCurveAddressFilters, nativeAddresses, m_includeDiffCurves ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 9ef9f96384..4e149ef509 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -92,6 +92,7 @@ #include "cafPdmUiSliderEditor.h" #include "cafSelectionManager.h" +#include "caf.h" #include "cvfAssert.h" #include @@ -2108,29 +2109,30 @@ RimDepthTrackPlot* RimWellLogTrack::parentWellLogPlot() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::handleWheelEvent( QWheelEvent* event ) +void RimWellLogTrack::handleWheelEvent( QWheelEvent* wheelEvent ) { RimDepthTrackPlot* wellLogPlot = nullptr; this->firstAncestorOrThisOfType( wellLogPlot ); if ( wellLogPlot ) { - if ( event->modifiers() & Qt::ControlModifier ) + if ( wheelEvent->modifiers() & Qt::ControlModifier ) { double zoomCenter = 0.0; + auto position = caf::position( wheelEvent ); if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) { QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtPlot::yLeft ); - zoomCenter = scaleMap.invTransform( event->pos().y() ); + zoomCenter = scaleMap.invTransform( position.y() ); } else { QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtPlot::xTop ); - zoomCenter = scaleMap.invTransform( event->pos().x() ); + zoomCenter = scaleMap.invTransform( position.x() ); } - if ( event->delta() > 0 ) + if ( wheelEvent->angleDelta().y() > 0 ) { wellLogPlot->setDepthAxisRangeByFactorAndCenter( RI_SCROLLWHEEL_ZOOMFACTOR, zoomCenter ); } @@ -2141,8 +2143,8 @@ void RimWellLogTrack::handleWheelEvent( QWheelEvent* event ) } else { - wellLogPlot->setDepthAxisRangeByPanDepth( event->delta() < 0 ? RI_SCROLLWHEEL_PANFACTOR - : -RI_SCROLLWHEEL_PANFACTOR ); + wellLogPlot->setDepthAxisRangeByPanDepth( wheelEvent->angleDelta().y() < 0 ? RI_SCROLLWHEEL_PANFACTOR + : -RI_SCROLLWHEEL_PANFACTOR ); } } } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp index a42e0a7fca..33f18549da 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp @@ -23,6 +23,8 @@ #include "SummaryPlotCommands/RicNewSummaryPlotFeature.h" #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" +#include "RiaTextStringTools.h" + #include "RimSummaryCase.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" @@ -56,7 +58,7 @@ RimcSummaryPlotCollection_newSummaryPlot::RimcSummaryPlotCollection_newSummaryPl //-------------------------------------------------------------------------------------------------- caf::PdmObjectHandle* RimcSummaryPlotCollection_newSummaryPlot::execute() { - QStringList addressStrings = m_addressString().split( ";", QString::SkipEmptyParts ); + QStringList addressStrings = RiaTextStringTools::splitSkipEmptyParts( m_addressString(), ";" ); RimSummaryPlot* newPlot = nullptr; if ( m_ensemble ) diff --git a/ApplicationLibCode/ReservoirDataModel/RigEquil.cpp b/ApplicationLibCode/ReservoirDataModel/RigEquil.cpp index a2ac817220..ef37801f87 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEquil.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEquil.cpp @@ -18,6 +18,8 @@ #include "RigEquil.h" +#include "RiaTextStringTools.h" + #include //-------------------------------------------------------------------------------------------------- @@ -133,7 +135,7 @@ RigEquil RigEquil::parseString( const QString& keywordData ) QString line( keywordData ); line.replace( "\t", " " ); - QStringList items = line.split( " ", QString::SkipEmptyParts ); + QStringList items = RiaTextStringTools::splitSkipEmptyParts( line ); if ( items.size() > 0 ) { datumDepth = items.at( 0 ).toDouble(); diff --git a/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp b/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp index 4da0bff5f7..2d6890c44c 100644 --- a/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp +++ b/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp @@ -1,16 +1,19 @@ #include "gtest/gtest.h" +#include "RiaQDateTimeTools.h" #include "RifColumnBasedUserData.h" #include "RifColumnBasedUserDataParser.h" #include "RifCsvUserDataParser.h" +#include "RifEclipseUserDataKeywordTools.h" #include "RifEclipseUserDataParserTools.h" #include "RifKeywordVectorParser.h" #include "SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h" -#include "RiaQDateTimeTools.h" -#include "RifEclipseUserDataKeywordTools.h" #include #include + +#include "caf.h" + #include //-------------------------------------------------------------------------------------------------- @@ -21,7 +24,7 @@ TEST( RifColumnBasedAsciiParserTest, TestDateFormatYyyymmddWithDash ) AsciiDataParseOptions parseOptions; parseOptions.dateFormat = "yyyy-MM-dd"; parseOptions.cellSeparator = "\t"; - parseOptions.locale = QLocale::Norwegian; + parseOptions.locale = caf::norwegianLocale(); parseOptions.timeSeriesColumnName = "Date"; QString data; @@ -78,7 +81,7 @@ TEST( RifColumnBasedAsciiParserTest, TestDateFormatYymmddWithDot ) AsciiDataParseOptions parseOptions; parseOptions.dateFormat = "yy.MM.dd"; parseOptions.cellSeparator = "\t"; - parseOptions.locale = QLocale::Norwegian; + parseOptions.locale = caf::norwegianLocale(); parseOptions.timeSeriesColumnName = "Date"; QString data; @@ -133,7 +136,7 @@ TEST( RifColumnBasedAsciiParserTest, TestDateFormatDdmmyyWithDot ) AsciiDataParseOptions parseOptions; parseOptions.dateFormat = "dd.MM.yy"; parseOptions.cellSeparator = "\t"; - parseOptions.locale = QLocale::Norwegian; + parseOptions.locale = caf::norwegianLocale(); parseOptions.timeSeriesColumnName = "Date"; QString data; @@ -188,7 +191,7 @@ TEST( RifColumnBasedAsciiParserTest, TestDecimalLocaleNorwegian ) parseOptions.dateFormat = "yy.MM.dd"; parseOptions.cellSeparator = "\t"; parseOptions.decimalSeparator = ","; - parseOptions.locale = QLocale::Norwegian; + parseOptions.locale = caf::norwegianLocale(); parseOptions.timeSeriesColumnName = "Date"; QString data; diff --git a/ApplicationLibCode/UnitTests/RiaDateStringParser-Test.cpp b/ApplicationLibCode/UnitTests/RiaDateStringParser-Test.cpp index 5000eecd40..e38543570d 100644 --- a/ApplicationLibCode/UnitTests/RiaDateStringParser-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiaDateStringParser-Test.cpp @@ -14,7 +14,7 @@ //-------------------------------------------------------------------------------------------------- TEST( RiaDateStringParserTest, ParseYearFirstWithSeparators ) { - QDateTime may2ndDT = QDateTime( QDate( 2011, 05, 02 ) ); + QDateTime may2ndDT = RiaQDateTimeTools::createDateTime( QDate( 2011, 05, 02 ) ); may2ndDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() ); std::vector may2ndStrings = { "2011 05 02", @@ -33,7 +33,7 @@ TEST( RiaDateStringParserTest, ParseYearFirstWithSeparators ) EXPECT_TRUE( may2ndDT == parsedDate ); } - QDateTime nov24thDT = QDateTime( QDate( 1992, 11, 24 ) ); + QDateTime nov24thDT = RiaQDateTimeTools::createDateTime( QDate( 1992, 11, 24 ) ); nov24thDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() ); std::vector nov24thStrings = { "1992-11-24", "1992-Nov-24", "1992-nov-24", "1992.11.24" }; @@ -48,7 +48,7 @@ TEST( RiaDateStringParserTest, ParseYearFirstWithSeparators ) //-------------------------------------------------------------------------------------------------- TEST( RiaDateStringParserTest, ParseDayFirstWithSeparators ) { - QDateTime may2ndDT = QDateTime( QDate( 2011, 05, 02 ) ); + QDateTime may2ndDT = RiaQDateTimeTools::createDateTime( QDate( 2011, 05, 02 ) ); may2ndDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() ); std::vector may2ndStrings = { "02 05 2011", @@ -66,7 +66,7 @@ TEST( RiaDateStringParserTest, ParseDayFirstWithSeparators ) EXPECT_TRUE( may2ndDT == parsedDate ); } - QDateTime nov24thDT = QDateTime( QDate( 1992, 11, 24 ) ); + QDateTime nov24thDT = RiaQDateTimeTools::createDateTime( QDate( 1992, 11, 24 ) ); nov24thDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() ); std::vector nov24thStrings = { "24-11-1992", "24-Nov-1992", "24.Nov 1992", "24.11.1992" }; @@ -81,7 +81,7 @@ TEST( RiaDateStringParserTest, ParseDayFirstWithSeparators ) //-------------------------------------------------------------------------------------------------- TEST( RiaDateStringParserTest, ParseMonthFirstWithSeparators ) { - QDateTime may2ndDT = QDateTime( QDate( 2011, 05, 02 ) ); + QDateTime may2ndDT = RiaQDateTimeTools::createDateTime( QDate( 2011, 05, 02 ) ); may2ndDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() ); std::vector may2ndStrings = { "May 02 2011", "may 02 2011", "May_02_2011", "May.02.2011", "May 02. 2011" }; @@ -91,7 +91,7 @@ TEST( RiaDateStringParserTest, ParseMonthFirstWithSeparators ) EXPECT_TRUE( may2ndDT == parsedDate ); } - QDateTime nov24thDT = QDateTime( QDate( 1992, 11, 24 ) ); + QDateTime nov24thDT = RiaQDateTimeTools::createDateTime( QDate( 1992, 11, 24 ) ); nov24thDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() ); std::vector nov24thStrings = { "11-24-1992", "Nov-24-1992", "Nov 24. 1992", "11.24.1992", "11 24 1992" }; @@ -106,8 +106,8 @@ TEST( RiaDateStringParserTest, ParseMonthFirstWithSeparators ) //-------------------------------------------------------------------------------------------------- TEST( RiaDateStringParserTest, ParseWithoutSeparators ) { - QDateTime may2ndDT = QDateTime( QDate( 2011, 05, 02 ) ); - QDateTime feb5thDT = QDateTime( QDate( 2011, 02, 05 ) ); + QDateTime may2ndDT = RiaQDateTimeTools::createDateTime( QDate( 2011, 05, 02 ) ); + QDateTime feb5thDT = RiaQDateTimeTools::createDateTime( QDate( 2011, 02, 05 ) ); may2ndDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() ); feb5thDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() ); @@ -122,7 +122,7 @@ TEST( RiaDateStringParserTest, ParseWithoutSeparators ) EXPECT_FALSE( may2ndDT == RiaDateStringParser::parseDateString( may2ndMonthFirstString ) ); EXPECT_TRUE( feb5thDT == RiaDateStringParser::parseDateString( may2ndMonthFirstString ) ); - QDateTime nov24thDT = QDateTime( QDate( 1992, 11, 24 ) ); + QDateTime nov24thDT = RiaQDateTimeTools::createDateTime( QDate( 1992, 11, 24 ) ); nov24thDT.setTimeSpec( RiaQDateTimeTools::currentTimeSpec() ); std::vector nov24thStrings = { "19921124", "24111992", "921124", "241192", "11241992", "112492" }; diff --git a/ApplicationLibCode/UnitTests/RifTextDataTableFormatter-Test.cpp b/ApplicationLibCode/UnitTests/RifTextDataTableFormatter-Test.cpp index f645c83d83..e449e636fb 100644 --- a/ApplicationLibCode/UnitTests/RifTextDataTableFormatter-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifTextDataTableFormatter-Test.cpp @@ -1,5 +1,7 @@ #include "gtest/gtest.h" +#include "RiaTextStringTools.h" + #include "RifTextDataTableFormatter.h" #include @@ -106,7 +108,7 @@ TEST( RifTextDataTableFormatter, LongLine ) formatter.rowCompleted(); formatter.tableCompleted(); - QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts ); + QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegExp( "[\r\n]" ) ); for ( QString line : tableLines ) { std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; @@ -153,7 +155,7 @@ TEST( RifTextDataTableFormatter, LongLine132 ) formatter.rowCompleted(); formatter.tableCompleted(); - QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts ); + QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegExp( "[\r\n]" ) ); for ( QString line : tableLines ) { std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; @@ -200,7 +202,7 @@ TEST( RifTextDataTableFormatter, LongLine133 ) formatter.rowCompleted(); formatter.tableCompleted(); - QStringList tableLines = tableText.split( QRegExp( "[\r\n]" ), QString::SkipEmptyParts ); + QStringList tableLines = RiaTextStringTools::splitSkipEmptyParts( tableText, QRegExp( "[\r\n]" ) ); for ( QString line : tableLines ) { std::cout << QString( "Line: \"%1\"" ).arg( line ).toStdString() << std::endl; diff --git a/ApplicationLibCode/UnitTests/RigHexIntersectionTools-Test.cpp b/ApplicationLibCode/UnitTests/RigHexIntersectionTools-Test.cpp index 067ed98c4c..da42aecd14 100644 --- a/ApplicationLibCode/UnitTests/RigHexIntersectionTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigHexIntersectionTools-Test.cpp @@ -18,8 +18,10 @@ #include "gtest/gtest.h" -#include "QDateTime" -#include "QDebug" +#include +#include +#include + #include "RigHexIntersectionTools.h" //-------------------------------------------------------------------------------------------------- @@ -74,12 +76,12 @@ TEST( RigHexIntersectionTools, DISABLED_planeHexCellIntersectionPerformanceTest fracturePlaneNotIntersecting.setFromPointAndNormal( cvf::Vec3d( 1.5, 1.5, 1.5 ), cvf::Vec3d( 1, 0, 0 ) ); fracturePlaneIntersecting.setFromPointAndNormal( cvf::Vec3d( 0.5, 0.5, 0.5 ), cvf::Vec3d( 1, 0, 0 ) ); - QTime timeTotal; + QElapsedTimer timeTotal; timeTotal.start(); for ( int run = 0; run < 5; run++ ) { - QTime timeLocal; + QElapsedTimer timeLocal; timeLocal.start(); for ( int i = 0; i < 2000000; i++ ) diff --git a/ApplicationLibCode/UserInterface/RiuCadNavigation.cpp b/ApplicationLibCode/UserInterface/RiuCadNavigation.cpp index 1b2bda65de..74423d6cab 100644 --- a/ApplicationLibCode/UserInterface/RiuCadNavigation.cpp +++ b/ApplicationLibCode/UserInterface/RiuCadNavigation.cpp @@ -18,7 +18,10 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiuCadNavigation.h" + +#include "caf.h" #include "cafViewer.h" + #include "cvfCamera.h" #include "cvfHitItemCollection.h" #include "cvfManipulatorTrackball.h" @@ -121,18 +124,19 @@ bool RiuCadNavigation::handleInputEvent( QInputEvent* inputEvent ) { if ( inputEvent->modifiers() == Qt::NoModifier ) { - QWheelEvent* we = static_cast( inputEvent ); + QWheelEvent* we = static_cast( inputEvent ); + auto position = caf::position( we ); - updatePointOfInterestDuringZoomIfNecessary( we->x(), we->y() ); + updatePointOfInterestDuringZoomIfNecessary( position.x(), position.y() ); if ( m_isRotCenterInitialized ) { int translatedMousePosX, translatedMousePosY; - cvfEventPos( we->x(), we->y(), &translatedMousePosX, &translatedMousePosY ); + cvfEventPos( position.x(), position.y(), &translatedMousePosX, &translatedMousePosY ); cvf::ref ray = createZoomRay( translatedMousePosX, translatedMousePosY ); - zoomAlongRay( ray.p(), -we->delta() ); + zoomAlongRay( ray.p(), -we->angleDelta().y() ); } isEventHandled = true; } diff --git a/ApplicationLibCode/UserInterface/RiuCategoryLegendFrame.cpp b/ApplicationLibCode/UserInterface/RiuCategoryLegendFrame.cpp index 19a81a3ba7..3902c4130b 100644 --- a/ApplicationLibCode/UserInterface/RiuCategoryLegendFrame.cpp +++ b/ApplicationLibCode/UserInterface/RiuCategoryLegendFrame.cpp @@ -1,5 +1,7 @@ #include "RiuCategoryLegendFrame.h" +#include "RiaTextStringTools.h" + #include "cafCategoryLegend.h" #include "cvfqtUtils.h" @@ -29,7 +31,7 @@ RiuCategoryLegendFrame::~RiuCategoryLegendFrame() void RiuCategoryLegendFrame::layoutInfo( LayoutInfo* layout ) const { QFontMetrics fontMetrics( this->font() ); - QStringList titleLines = m_title.split( "\n", QString::SkipEmptyParts ); + QStringList titleLines = RiaTextStringTools::splitSkipEmptyParts( m_title, "\n" ); layout->charHeight = fontMetrics.height(); layout->charAscent = fontMetrics.ascent(); diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index ae1ac4925c..3ce3db5d58 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -235,7 +235,7 @@ Qt::DropActions RiuDragDrop::supportedDropActions() const //-------------------------------------------------------------------------------------------------- Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const { - Qt::ItemFlags itemflags = nullptr; + Qt::ItemFlags itemflags; if ( index.isValid() && RiaGuiApplication::activeMainWindow() ) { diff --git a/ApplicationLibCode/UserInterface/RiuFemTimeHistoryResultAccessor.cpp b/ApplicationLibCode/UserInterface/RiuFemTimeHistoryResultAccessor.cpp index 394791ce81..31188b51b6 100644 --- a/ApplicationLibCode/UserInterface/RiuFemTimeHistoryResultAccessor.cpp +++ b/ApplicationLibCode/UserInterface/RiuFemTimeHistoryResultAccessor.cpp @@ -19,6 +19,8 @@ #include "RiuFemTimeHistoryResultAccessor.h" +#include "RiaNumberFormat.h" + #include "RigFemClosestResultIndexCalculator.h" #include "RigFemPart.h" #include "RigFemPartCollection.h" @@ -26,6 +28,7 @@ #include "RigFemPartResultsCollection.h" #include "RigFemTypes.h" #include "RigGeoMechCaseData.h" + #include "RiuGeoMechXfTensorResultAccessor.h" #include // Needed for HUGE_VAL on Linux @@ -101,11 +104,12 @@ QString RiuFemTimeHistoryResultAccessor::geometrySelectionText() const cvf::Vec3d domainCoord = m_intersectionPointInDomain; text += QString( ", ijk[%1, %2, %3] " ).arg( i ).arg( j ).arg( k ); - QString formattedText; - formattedText.sprintf( "Intersection point : [E: %.2f, N: %.2f, Depth: %.2f]", - domainCoord.x(), - domainCoord.y(), - -domainCoord.z() ); + auto xTxt = RiaNumberFormat::valueToText( domainCoord.x(), RiaNumberFormat::NumberFormatType::FIXED, 2 ); + auto yTxt = RiaNumberFormat::valueToText( domainCoord.y(), RiaNumberFormat::NumberFormatType::FIXED, 2 ); + auto zTxt = RiaNumberFormat::valueToText( -domainCoord.z(), RiaNumberFormat::NumberFormatType::FIXED, 2 ); + + QString formattedText = + QString( "Intersection point : [E: %1, N: %2, Depth: %3]" ).arg( xTxt ).arg( yTxt ).arg( zTxt ); text += formattedText; } diff --git a/ApplicationLibCode/UserInterface/RiuGeoQuestNavigation.cpp b/ApplicationLibCode/UserInterface/RiuGeoQuestNavigation.cpp index 72c810824a..58b7108aee 100644 --- a/ApplicationLibCode/UserInterface/RiuGeoQuestNavigation.cpp +++ b/ApplicationLibCode/UserInterface/RiuGeoQuestNavigation.cpp @@ -18,7 +18,10 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiuGeoQuestNavigation.h" + +#include "caf.h" #include "cafViewer.h" + #include "cvfCamera.h" #include "cvfHitItemCollection.h" #include "cvfManipulatorTrackball.h" @@ -132,18 +135,19 @@ bool RiuGeoQuestNavigation::handleInputEvent( QInputEvent* inputEvent ) { if ( inputEvent->modifiers() == Qt::NoModifier ) { - QWheelEvent* we = static_cast( inputEvent ); + QWheelEvent* we = static_cast( inputEvent ); + auto position = caf::position( we ); - updatePointOfInterestDuringZoomIfNecessary( we->x(), we->y() ); + updatePointOfInterestDuringZoomIfNecessary( position.x(), position.y() ); if ( m_isRotCenterInitialized ) { int translatedMousePosX, translatedMousePosY; - cvfEventPos( we->x(), we->y(), &translatedMousePosX, &translatedMousePosY ); + cvfEventPos( position.x(), position.y(), &translatedMousePosX, &translatedMousePosY ); cvf::ref ray = createZoomRay( translatedMousePosX, translatedMousePosY ); - zoomAlongRay( ray.p(), -we->delta() ); + zoomAlongRay( ray.p(), -we->angleDelta().y() ); } isEventHandled = true; } diff --git a/ApplicationLibCode/UserInterface/RiuGridStatisticsHistogramWidget.h b/ApplicationLibCode/UserInterface/RiuGridStatisticsHistogramWidget.h index 135d8adfd2..29d44de659 100644 --- a/ApplicationLibCode/UserInterface/RiuGridStatisticsHistogramWidget.h +++ b/ApplicationLibCode/UserInterface/RiuGridStatisticsHistogramWidget.h @@ -29,7 +29,7 @@ class QStringList; class RiuGridStatisticsHistogramWidget : public QWidget { public: - RiuGridStatisticsHistogramWidget( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); + RiuGridStatisticsHistogramWidget( QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() ); void setHistogramData( double min, double max, const std::vector& histogram ); void setPercentiles( double pmin, double pmax ); diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index aa21512750..130ad7da85 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -627,17 +627,12 @@ void RiuMultiPlotPage::reinsertPlotWidgets() plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize ); { - int left = 0; - int top = 0; - int right = 0; - int bot = 0; - - plotWidgets[visibleIndex]->getContentsMargins( &left, &top, &right, &bot ); - bot = 40; + auto margins = plotWidgets[visibleIndex]->contentsMargins(); + margins.setBottom( 40 ); // Adjust the space below a graph to make sure the heading of the row below is closest to the // corresponding graph - plotWidgets[visibleIndex]->setContentsMargins( left, top, right, bot ); + plotWidgets[visibleIndex]->setContentsMargins( margins ); } plotWidgets[visibleIndex]->show(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.cpp b/ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.cpp index 648a0c5d08..040c609c68 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotCurveSymbol.cpp @@ -129,7 +129,7 @@ QRect RiuPlotCurveSymbol::labelBoundingRect( const QPainter* painter, const QRec int symbolWidth = symbolRect.width(); int symbolHeight = symbolRect.height(); - int labelWidth = painter->fontMetrics().width( label ); + int labelWidth = painter->fontMetrics().horizontalAdvance( label ); int labelHeight = painter->fontMetrics().height(); QPoint labelPosition; diff --git a/ApplicationLibCode/UserInterface/RiuProjectPropertyView.h b/ApplicationLibCode/UserInterface/RiuProjectPropertyView.h index 981ca5b825..8e3855a26d 100644 --- a/ApplicationLibCode/UserInterface/RiuProjectPropertyView.h +++ b/ApplicationLibCode/UserInterface/RiuProjectPropertyView.h @@ -33,7 +33,7 @@ class PdmObjectHandle; class RiuProjectAndPropertyView : public QWidget { public: - RiuProjectAndPropertyView( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); + RiuProjectAndPropertyView( QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() ); void setPdmItem( caf::PdmUiItem* object ); void showProperties( caf::PdmObjectHandle* object ); @@ -41,4 +41,4 @@ class RiuProjectAndPropertyView : public QWidget private: caf::PdmUiTreeView* m_projectTreeView; caf::PdmUiPropertyView* m_propertyView; -}; \ No newline at end of file +}; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index ba5f9572ee..bccc6a72eb 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -33,6 +33,7 @@ #include "RiuQtChartsPlotCurve.h" #include "RiuQwtDateScaleWrapper.h" +#include "caf.h" #include "cafAssert.h" #include "cvfTrace.h" @@ -1160,9 +1161,9 @@ void RiuQtChartsPlotWidget::dropEvent( QDropEvent* event ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::wheelEvent( QWheelEvent* event ) +void RiuQtChartsPlotWidget::wheelEvent( QWheelEvent* wheelEvent ) { - float factor = event->angleDelta().y() > 0 ? 0.9 : 1.1; + float factor = wheelEvent->angleDelta().y() > 0 ? 0.9 : 1.1; QRectF plotAreaRect = m_viewer->chart()->plotArea(); QPointF centerPoint = plotAreaRect.center(); @@ -1171,14 +1172,16 @@ void RiuQtChartsPlotWidget::wheelEvent( QWheelEvent* event ) plotAreaRect.setWidth( plotAreaRect.width() * factor ); plotAreaRect.setHeight( plotAreaRect.height() * factor ); + auto position = caf::position( wheelEvent ); + // Find new center which keeps the mouse location in the same place in the plot - QPointF newCenterPoint( ( 2 * centerPoint - event->pos() ) - ( centerPoint - event->pos() ) / factor ); + QPointF newCenterPoint( ( 2 * centerPoint - position ) - ( centerPoint - position ) / factor ); plotAreaRect.moveCenter( newCenterPoint ); // Zoom in on the adjusted plot area m_viewer->chart()->zoomIn( plotAreaRect ); - event->accept(); + wheelEvent->accept(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp index ec0fbc790a..9d6dfa7aef 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp @@ -18,6 +18,8 @@ #include "RiuQwtPlotWheelZoomer.h" +#include "caf.h" + #include "qwt_plot.h" #include "qwt_scale_div.h" @@ -86,15 +88,16 @@ bool RiuQwtPlotWheelZoomer::eventFilter( QObject* watched, QEvent* event ) if ( wheelEvent ) { double zoomFactor = 1.0 / RIU_SCROLLWHEEL_ZOOMFACTOR; - if ( wheelEvent->delta() > 0 ) + if ( wheelEvent->angleDelta().y() > 0 ) { zoomFactor = RIU_SCROLLWHEEL_ZOOMFACTOR; } - zoomOnAxis( m_plot, QwtPlot::xBottom, zoomFactor, wheelEvent->pos().x() ); - zoomOnAxis( m_plot, QwtPlot::xTop, zoomFactor, wheelEvent->pos().x() ); - zoomOnAxis( m_plot, QwtPlot::yLeft, zoomFactor, wheelEvent->pos().y() ); - zoomOnAxis( m_plot, QwtPlot::yRight, zoomFactor, wheelEvent->pos().y() ); + auto position = caf::position( wheelEvent ); + zoomOnAxis( m_plot, QwtPlot::xBottom, zoomFactor, position.x() ); + zoomOnAxis( m_plot, QwtPlot::xTop, zoomFactor, position.x() ); + zoomOnAxis( m_plot, QwtPlot::yLeft, zoomFactor, position.y() ); + zoomOnAxis( m_plot, QwtPlot::yRight, zoomFactor, position.y() ); m_plot->replot(); emit zoomUpdated(); diff --git a/ApplicationLibCode/UserInterface/RiuRmsNavigation.cpp b/ApplicationLibCode/UserInterface/RiuRmsNavigation.cpp index 945bfa186c..520c858f1e 100644 --- a/ApplicationLibCode/UserInterface/RiuRmsNavigation.cpp +++ b/ApplicationLibCode/UserInterface/RiuRmsNavigation.cpp @@ -18,7 +18,10 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiuRmsNavigation.h" + +#include "caf.h" #include "cafViewer.h" + #include "cvfCamera.h" #include "cvfHitItemCollection.h" #include "cvfManipulatorTrackball.h" @@ -157,18 +160,19 @@ bool RiuRmsNavigation::handleInputEvent( QInputEvent* inputEvent ) { if ( inputEvent->modifiers() == Qt::NoModifier ) { - QWheelEvent* we = static_cast( inputEvent ); + QWheelEvent* we = static_cast( inputEvent ); + auto position = caf::position( we ); - updatePointOfInterestDuringZoomIfNecessary( we->x(), we->y() ); + updatePointOfInterestDuringZoomIfNecessary( position.x(), position.y() ); if ( m_isRotCenterInitialized ) { int translatedMousePosX, translatedMousePosY; - cvfEventPos( we->x(), we->y(), &translatedMousePosX, &translatedMousePosY ); + cvfEventPos( position.x(), position.y(), &translatedMousePosX, &translatedMousePosY ); cvf::ref ray = createZoomRay( translatedMousePosX, translatedMousePosY ); - zoomAlongRay( ray.p(), -we->delta() ); + zoomAlongRay( ray.p(), -we->angleDelta().y() ); } isEventHandled = true; } diff --git a/ApplicationLibCode/UserInterface/RiuScalarMapperLegendFrame.cpp b/ApplicationLibCode/UserInterface/RiuScalarMapperLegendFrame.cpp index cbc36c2c9d..6bc6fd50c6 100644 --- a/ApplicationLibCode/UserInterface/RiuScalarMapperLegendFrame.cpp +++ b/ApplicationLibCode/UserInterface/RiuScalarMapperLegendFrame.cpp @@ -17,6 +17,8 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiuScalarMapperLegendFrame.h" +#include "RiaTextStringTools.h" + #include "cvfScalarMapperDiscreteLinear.h" #include "cvfScalarMapperDiscreteLog.h" #include "cvfString.h" @@ -72,7 +74,7 @@ void RiuScalarMapperLegendFrame::setTickFormat( NumberFormat format ) void RiuScalarMapperLegendFrame::layoutInfo( LayoutInfo* layout ) const { QFontMetrics fontMetrics( this->font() ); - QStringList titleLines = m_title.split( "\n", QString::SkipEmptyParts ); + QStringList titleLines = RiaTextStringTools::splitSkipEmptyParts( m_title, "\n" ); layout->charHeight = fontMetrics.height(); layout->charAscent = fontMetrics.ascent(); diff --git a/ApplicationLibCode/UserInterface/RiuSimpleHistogramWidget.h b/ApplicationLibCode/UserInterface/RiuSimpleHistogramWidget.h index 697bc16128..14afcecf69 100644 --- a/ApplicationLibCode/UserInterface/RiuSimpleHistogramWidget.h +++ b/ApplicationLibCode/UserInterface/RiuSimpleHistogramWidget.h @@ -29,7 +29,7 @@ class QStringList; class RiuSimpleHistogramWidget : public QWidget { public: - RiuSimpleHistogramWidget( const QString& objectName, QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); + RiuSimpleHistogramWidget( const QString& objectName, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() ); void setHistogramData( double min, double max, const std::vector& histogram ); void setPercentiles( double pmin, double pmax ); diff --git a/ApplicationLibCode/UserInterface/RiuTextContentFrame.cpp b/ApplicationLibCode/UserInterface/RiuTextContentFrame.cpp index cd7ac88644..4e54368360 100644 --- a/ApplicationLibCode/UserInterface/RiuTextContentFrame.cpp +++ b/ApplicationLibCode/UserInterface/RiuTextContentFrame.cpp @@ -18,6 +18,8 @@ #include "RiuTextContentFrame.h" +#include "RiaTextStringTools.h" + #include "RiaFontCache.h" #include "RiaPreferences.h" @@ -168,7 +170,7 @@ void RiuTextContentFrame::paintEvent( QPaintEvent* e ) void RiuTextContentFrame::layoutInfo( LayoutInfo* layout ) const { QFontMetrics fontMetrics( this->font() ); - QStringList titleLines = m_text.split( "\n", QString::SkipEmptyParts ); + QStringList titleLines = RiaTextStringTools::splitSkipEmptyParts( m_text, "\n" ); layout->charHeight = fontMetrics.height(); layout->charAscent = fontMetrics.ascent(); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt index 9637b34f47..40d4e76c70 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/CMakeLists.txt @@ -16,6 +16,8 @@ find_package( set(QT_LIBRARIES Qt5::Core) set(PROJECT_FILES + caf.h + caf.cpp cafAssert.h cafAppEnum.h cafClassTypeName.h diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/caf.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/caf.cpp new file mode 100644 index 0000000000..63544caf05 --- /dev/null +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/caf.cpp @@ -0,0 +1,81 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2020- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library 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. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library 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 Lesser General Public License at <> +// for more details. +// +//################################################################################################## +#include "caf.h" + +#include "QtGui/qevent.h" +#include +#include + +namespace caf +{ +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QLocale norwegianLocale() +{ +#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 ) + return QLocale::NorwegianBokmal; +#else + return QLocale::Norwegian; +#endif +} // namespace caf::norwegianLocale() + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QTextStream& endl( QTextStream& s ) +{ + // https: // github.com/qt/qtbase/blob/dev/src/corelib/serialization/qtextstream.cpp#L2845 +#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 ) + return s << QLatin1Char( '\n' ) << Qt::flush; +#else + return s << QLatin1Char( '\n' ) << flush; +#endif +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QPointF position( QWheelEvent* wheelEvent ) +{ +#if QT_VERSION >= QT_VERSION_CHECK( 5, 15, 0 ) + return wheelEvent->position(); +#else + return wheelEvent->pos(); +#endif +} + +} // namespace caf diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/caf.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/caf.h new file mode 100644 index 0000000000..22264b50d4 --- /dev/null +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/caf.h @@ -0,0 +1,48 @@ +//################################################################################################## +// +// Custom Visualization Core library +// Copyright (C) 2020- Ceetron Solutions AS +// +// This library may be used under the terms of either the GNU General Public License or +// the GNU Lesser General Public License as follows: +// +// GNU General Public License Usage +// This library 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. +// +// This library is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at <> +// for more details. +// +// GNU Lesser General Public License Usage +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation; either version 2.1 of the License, or +// (at your option) any later version. +// +// This library 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 Lesser General Public License at <> +// for more details. +// +//################################################################################################## +#pragma once + +class QLocale; +class QTextStream; +class QPointF; +class QWheelEvent; + +namespace caf +{ +QLocale norwegianLocale(); +QTextStream& endl( QTextStream& s ); +QPointF position( QWheelEvent* wheelEvent ); +}; // namespace caf diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/CustomObjectEditor.h b/Fwk/AppFwk/cafTests/cafTestApplication/CustomObjectEditor.h index bd8108ddcc..a5f9d3d1c7 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/CustomObjectEditor.h +++ b/Fwk/AppFwk/cafTests/cafTestApplication/CustomObjectEditor.h @@ -69,7 +69,7 @@ class CustomObjectEditor : public PdmUiFormLayoutObjectEditor void defineGridLayout(int rowCount, int columnCount); // See QGridLayout::addWidget - void addWidget(QWidget* widget, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment = nullptr); + void addWidget(QWidget* widget, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment = Qt::Alignment()); void removeWidget(QWidget* widget); void addBlankCell(int row, int column); diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/WidgetLayoutTest.h b/Fwk/AppFwk/cafTests/cafTestApplication/WidgetLayoutTest.h index 68dba8027a..bc2fb3d031 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/WidgetLayoutTest.h +++ b/Fwk/AppFwk/cafTests/cafTestApplication/WidgetLayoutTest.h @@ -10,7 +10,7 @@ class WidgetLayoutTest : public QWidget Q_OBJECT public: - WidgetLayoutTest(QWidget* parent = nullptr, Qt::WindowFlags f = nullptr); + WidgetLayoutTest(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); ~WidgetLayoutTest() override; private: diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiListView.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiListView.h index 2a526e1cab..e374cb84ab 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiListView.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiListView.h @@ -52,7 +52,7 @@ class PdmUiListView : public QWidget { Q_OBJECT public: - PdmUiListView( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); + PdmUiListView( QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() ); ~PdmUiListView() override; void setPdmObject( caf::PdmObjectCollection* object ); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.h index ec4d81d909..1c41eba05f 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableView.h @@ -59,7 +59,7 @@ class PdmUiTableView : public QWidget { Q_OBJECT public: - PdmUiTableView( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); + PdmUiTableView( QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() ); ~PdmUiTableView() override; void setChildArrayField( PdmChildArrayFieldHandle* childArrayField ); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h index a26cde58ae..f7c579bc2b 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.h @@ -64,7 +64,7 @@ class PdmUiTreeView : public QWidget { Q_OBJECT public: - PdmUiTreeView( QWidget* parent = nullptr, Qt::WindowFlags f = nullptr ); + PdmUiTreeView( QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags() ); ~PdmUiTreeView() override; void enableDefaultContextMenu( bool enable ); diff --git a/Fwk/AppFwk/cafViewer/cafOpenGLWidget.h b/Fwk/AppFwk/cafViewer/cafOpenGLWidget.h index 32b66ae291..0da8fe54cc 100644 --- a/Fwk/AppFwk/cafViewer/cafOpenGLWidget.h +++ b/Fwk/AppFwk/cafViewer/cafOpenGLWidget.h @@ -59,7 +59,7 @@ class OpenGLWidget : public QGLWidget QWidget* parent, OpenGLWidget* shareWidget = nullptr, Qt::WindowFlags f = nullptr ); - OpenGLWidget( OpenGLWidget* shareWidget, QWidget* parent, Qt::WindowFlags f = nullptr ); + OpenGLWidget( OpenGLWidget* shareWidget, QWidget* parent, Qt::WindowFlags f = Qt::WindowFlags() ); cvf::OpenGLContext* cvfOpenGLContext() const; void cvfShutdownOpenGLContext(); From 7238894bf6f2a69adf353a28493850ffea92bb07 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sat, 12 Mar 2022 16:43:48 +0100 Subject: [PATCH 180/406] Janitor: Set minimum Qt version to 5.12 --- ApplicationExeCode/CMakeLists.txt | 8 ++------ ApplicationLibCode/CMakeLists.txt | 8 ++------ CMakeLists.txt | 4 +++- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/ApplicationExeCode/CMakeLists.txt b/ApplicationExeCode/CMakeLists.txt index b27051c6ad..6bb12a4c88 100644 --- a/ApplicationExeCode/CMakeLists.txt +++ b/ApplicationExeCode/CMakeLists.txt @@ -21,15 +21,11 @@ endif() # Open GL find_package(OpenGL) -find_package( - Qt5 - COMPONENTS Core - QUIET -) +find_package(Qt5 ${RI_QT_MINIMUM_VERSION} COMPONENTS Core) if(Qt5Core_FOUND) find_package( - Qt5 + Qt5 ${RI_QT_MINIMUM_VERSION} COMPONENTS Core Gui OpenGL diff --git a/ApplicationLibCode/CMakeLists.txt b/ApplicationLibCode/CMakeLists.txt index 6a270494c6..7623a3eb23 100644 --- a/ApplicationLibCode/CMakeLists.txt +++ b/ApplicationLibCode/CMakeLists.txt @@ -25,15 +25,11 @@ option(RESINSIGHT_TREAT_WARNINGS_AS_ERRORS "Treat warnings as errors (stops build)" OFF ) -find_package( - Qt5 - COMPONENTS Core - QUIET -) +find_package(Qt5 ${RI_QT_MINIMUM_VERSION} COMPONENTS Core) if(Qt5Core_FOUND) find_package( - Qt5 + Qt5 ${RI_QT_MINIMUM_VERSION} COMPONENTS Core Gui OpenGL diff --git a/CMakeLists.txt b/CMakeLists.txt index a24dd8b881..76534ca226 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -398,8 +398,10 @@ list(APPEND THIRD_PARTY_LIBRARIES NRLib) # ############################################################################## # Qt # ############################################################################## +set(RI_QT_MINIMUM_VERSION 5.12) + find_package( - Qt5 + Qt5 ${RI_QT_MINIMUM_VERSION} COMPONENTS Core Gui OpenGL From 88ed302dc323f7e6c8527cfa0c196cdce83f6cf6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 14 Mar 2022 07:17:04 +0100 Subject: [PATCH 181/406] Update clang-tidy.yml --- .github/workflows/clang-tidy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index aab8d4e566..63c2f42e3c 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -35,7 +35,7 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v2 with: - version: 5.9.9 + version: 5.12.12 modules: qtscript qtcharts dir: '${{ github.workspace }}/Qt/' cached: ${{ steps.cache-qt.outputs.cache-hit }} From 5b819b7635b44c1079f6a6a79069375bdcaff4b8 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 14 Mar 2022 07:19:05 +0100 Subject: [PATCH 182/406] Update clang-tidy.yml --- .github/workflows/clang-tidy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 63c2f42e3c..c125691c7b 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -31,7 +31,7 @@ jobs: uses: actions/cache@v2 with: path: ${{ github.workspace }}/Qt/ - key: ${{ matrix.config.os }}-QtCache-v03 + key: ${{ matrix.config.os }}-QtCache-5-12-12 - name: Install Qt uses: jurplel/install-qt-action@v2 with: From e435e28e7d575b0ad4df0d35c6ccdb4ee96434c8 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 11 Mar 2022 15:02:13 +0100 Subject: [PATCH 183/406] #8660 Axis range: If water cut is assigned, use 0..1 as axis value range --- .../Summary/RimSummaryPlot.cpp | 30 +++++++++++++++++-- .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 ++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 8705a24a67..1ea1c47b19 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -24,6 +24,7 @@ #include "RiaPlotDefines.h" #include "RiaPreferences.h" #include "RiaRegressionTestRunner.h" +#include "RiaStdStringTools.h" #include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryCurveDefinition.h" #include "RiaSummaryTools.h" @@ -216,8 +217,11 @@ void RimSummaryPlot::updateAxes() updateTimeAxis( timeAxisProperties() ); } - plotWidget()->updateAxes(); - plotWidget()->scheduleReplot(); + if ( plotWidget() ) + { + plotWidget()->updateAxes(); + plotWidget()->scheduleReplot(); + } updateZoomInParentPlot(); } @@ -858,6 +862,11 @@ void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis ) plotWidget()->setAxisScale( yAxisProps->plotAxisType(), min, max ); } + else if ( plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || + plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT && isOnlyWaterCutCurvesVisible( plotAxis ) ) + { + plotWidget()->setAxisScale( yAxisProps->plotAxisType(), 0.0, 1.0 ); + } else { plotWidget()->setAxisAutoScale( yAxisProps->plotAxisType(), true ); @@ -873,6 +882,23 @@ void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis ) plotWidget()->setAxisInverted( yAxisProps->plotAxisType(), yAxisProps->isAxisInverted() ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryPlot::isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis ) +{ + size_t waterCutCurveCount = 0; + auto curves = visibleSummaryCurvesForAxis( plotAxis ); + for ( auto c : curves ) + { + auto quantityName = c->summaryAddressY().quantityName(); + + if ( RiaStdStringTools::endsWith( quantityName, "WCT" ) ) waterCutCurveCount++; + } + + return ( waterCutCurveCount == curves.size() ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index d76de226b5..3365161185 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -280,6 +280,8 @@ private slots: int handleSummaryCaseDrop( RimSummaryCase* summaryCase ); int handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl ); + bool isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis ); + private: #ifdef USE_QTCHARTS caf::PdmField m_useQtChartsPlot; From 0ca70249aeb5381c46daee07fdc07a15cb307484 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 14 Mar 2022 09:18:48 +0100 Subject: [PATCH 184/406] Move defines to RiaDateTimeDefines --- .../Application/CMakeLists_files.cmake | 2 + .../Application/RiaDateTimeDefines.cpp | 60 ++++++++++ .../Application/RiaDateTimeDefines.h | 59 ++++++++++ .../Application/RiaPreferences.cpp | 9 +- .../Application/RiaPreferences.h | 10 +- .../Application/Tools/RiaQDateTimeTools.cpp | 104 ++++++------------ .../Application/Tools/RiaQDateTimeTools.h | 80 ++++---------- .../Application/Tools/RiaSummaryTools.cpp | 8 +- .../Application/Tools/RiaSummaryTools.h | 10 +- .../Tools/RiaTimeHistoryCurveResampler.cpp | 52 +++++---- .../Tools/RiaTimeHistoryCurveResampler.h | 19 ++-- .../RicShowPlotDataFeature.cpp | 21 ++-- .../RicShowPlotDataFeature.h | 2 - .../Commands/RicResampleDialog.cpp | 12 +- .../Commands/RicResampleDialog.h | 12 +- .../RicAsciiExportSummaryPlotFeature.cpp | 8 +- .../RicAsciiExportSummaryPlotFeature.h | 11 +- .../AnalysisPlots/RimAnalysisPlot.cpp | 12 +- .../RimAbstractCorrelationPlot.cpp | 14 ++- .../RimSimWellInViewTools.cpp | 2 +- .../RimTimeAxisAnnotation.cpp | 14 ++- .../Summary/RimDerivedSummaryCase.cpp | 1 + .../Summary/RimEnsembleCurveSet.cpp | 8 +- .../Summary/RimEnsembleCurveSet.h | 12 +- .../Summary/RimEnsembleStatisticsCase.cpp | 5 +- .../Summary/RimSummaryCurve.cpp | 5 +- .../Summary/RimSummaryCurve.h | 6 +- .../Summary/RimSummaryCurvesData.cpp | 36 +++--- .../Summary/RimSummaryCurvesData.h | 14 +-- .../Summary/RimSummaryPlot.cpp | 10 +- .../ProjectDataModel/Summary/RimSummaryPlot.h | 5 +- .../Summary/RimSummaryTimeAxisProperties.cpp | 25 +++-- .../Summary/RimSummaryTimeAxisProperties.h | 15 ++- .../RimcSummaryCase.cpp | 6 +- .../RiaTimeHistoryCurveTools-Test.cpp | 40 +++---- .../UserInterface/RiuQtChartsPlotTools.cpp | 36 +++--- .../UserInterface/RiuQtChartsPlotTools.h | 20 ++-- .../UserInterface/RiuQtChartsPlotWidget.cpp | 8 +- .../UserInterface/RiuQtChartsPlotWidget.h | 10 +- .../UserInterface/RiuQwtDateScaleWrapper.cpp | 8 +- .../UserInterface/RiuQwtDateScaleWrapper.h | 8 +- .../UserInterface/RiuQwtPlotTools.cpp | 54 +++++---- .../UserInterface/RiuQwtPlotTools.h | 23 ++-- .../UserInterface/RiuSummaryPlot.h | 11 +- .../UserInterface/RiuSummaryQtChartsPlot.cpp | 8 +- .../UserInterface/RiuSummaryQtChartsPlot.h | 12 +- .../UserInterface/RiuSummaryQwtPlot.cpp | 8 +- .../UserInterface/RiuSummaryQwtPlot.h | 12 +- .../UserInterface/RiuTextDialog.h | 2 - 49 files changed, 495 insertions(+), 434 deletions(-) create mode 100644 ApplicationLibCode/Application/RiaDateTimeDefines.cpp create mode 100644 ApplicationLibCode/Application/RiaDateTimeDefines.h diff --git a/ApplicationLibCode/Application/CMakeLists_files.cmake b/ApplicationLibCode/Application/CMakeLists_files.cmake index cb87a9bae2..1a4af7591e 100644 --- a/ApplicationLibCode/Application/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/CMakeLists_files.cmake @@ -26,6 +26,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaResultNames.h ${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.h ${CMAKE_CURRENT_LIST_DIR}/RiaRftDefines.h + ${CMAKE_CURRENT_LIST_DIR}/RiaDateTimeDefines.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -56,6 +57,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaResultNames.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaRftDefines.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaDateTimeDefines.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Application/RiaDateTimeDefines.cpp b/ApplicationLibCode/Application/RiaDateTimeDefines.cpp new file mode 100644 index 0000000000..bbac4778a0 --- /dev/null +++ b/ApplicationLibCode/Application/RiaDateTimeDefines.cpp @@ -0,0 +1,60 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiaDateTimeDefines.h" + +#include "cafAppEnum.h" + +namespace caf +{ +template <> +void caf::AppEnum::setUp() +{ + addItem( RiaDefines::DateFormatComponents::DATE_FORMAT_NONE, "NO_DATE", "No Date" ); + addItem( RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR, "YEAR", "Year Only" ); + addItem( RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH, "YEAR_MONTH", "Year and Month" ); + addItem( RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY, "YEAR_MONTH_DAY", "Year, Month and Day" ); + setDefault( RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); +} + +template <> +void caf::AppEnum::setUp() +{ + addItem( RiaDefines::TimeFormatComponents::TIME_FORMAT_NONE, "NO_TIME", "No Time of Day" ); + addItem( RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR, "HOUR", "Hour Only" ); + addItem( RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE, "HOUR_MINUTE", "Hour and Minute" ); + addItem( RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND, + "HOUR_MINUTE_SECONDS", + "Hour, Minutes and Seconds" ); + setDefault( RiaDefines::TimeFormatComponents::TIME_FORMAT_NONE ); +} + +template <> +void caf::AppEnum::setUp() +{ + addItem( RiaDefines::DateTimePeriod::NONE, "NONE", "None" ); + addItem( RiaDefines::DateTimePeriod::DAY, "DAY", "Day" ); + addItem( RiaDefines::DateTimePeriod::WEEK, "WEEK", "Week" ); + addItem( RiaDefines::DateTimePeriod::MONTH, "MONTH", "Month" ); + addItem( RiaDefines::DateTimePeriod::QUARTER, "QUARTER", "Quarter" ); + addItem( RiaDefines::DateTimePeriod::HALFYEAR, "HALFYEAR", "Half Year" ); + addItem( RiaDefines::DateTimePeriod::YEAR, "YEAR", "Year" ); + addItem( RiaDefines::DateTimePeriod::DECADE, "DECADE", "Decade" ); + setDefault( RiaDefines::DateTimePeriod::NONE ); +} +} // namespace caf diff --git a/ApplicationLibCode/Application/RiaDateTimeDefines.h b/ApplicationLibCode/Application/RiaDateTimeDefines.h new file mode 100644 index 0000000000..dcd235464d --- /dev/null +++ b/ApplicationLibCode/Application/RiaDateTimeDefines.h @@ -0,0 +1,59 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafAppEnum.h" + +namespace RiaDefines +{ +enum class DateFormatComponents +{ + DATE_FORMAT_UNSPECIFIED = -2, + DATE_FORMAT_NONE = -1, + DATE_FORMAT_YEAR = 0, + DATE_FORMAT_YEAR_MONTH, + DATE_FORMAT_YEAR_MONTH_DAY, +}; + +enum class TimeFormatComponents +{ + TIME_FORMAT_UNSPECIFIED = -2, + TIME_FORMAT_NONE = -1, + TIME_FORMAT_HOUR, + TIME_FORMAT_HOUR_MINUTE, + TIME_FORMAT_HOUR_MINUTE_SECOND, + TIME_FORMAT_HOUR_MINUTE_SECOND_MILLISECOND, + TIME_FORMAT_SIZE +}; + +enum class DateTimePeriod +{ + NONE = -1, + DAY, + WEEK, + MONTH, + QUARTER, + HALFYEAR, + YEAR, + DECADE +}; + +using DateTimePeriodEnum = caf::AppEnum; + +}; // namespace RiaDefines diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index c846d52c19..07f57ac13c 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -26,6 +26,7 @@ #include "RiaPreferencesGeoMech.h" #include "RiaPreferencesSummary.h" #include "RiaPreferencesSystem.h" +#include "RiaQDateTimeTools.h" #include "RiaValidRegExpValidator.h" #include "RifReaderSettings.h" @@ -461,7 +462,8 @@ QList RiaPreferences::calculateValueOptions( const caf:: { QDate exampleDate = QDate( 2019, 8, 16 ); QString fullDateFormat = - RiaQDateTimeTools::dateFormatString( dateFormat, RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + RiaQDateTimeTools::dateFormatString( dateFormat, + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); QString uiText = QString( "%1 (%2)" ).arg( fullDateFormat ).arg( exampleDate.toString( fullDateFormat ) ); uiText.replace( "AP", "AM/PM" ); options.push_back( caf::PdmOptionItemInfo( uiText, QVariant::fromValue( dateFormat ) ) ); @@ -474,7 +476,7 @@ QList RiaPreferences::calculateValueOptions( const caf:: QTime exampleTime = QTime( 15, 48, 22 ); QString timeFormatString = RiaQDateTimeTools::timeFormatString( timeFormat, - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ); QString uiText = QString( "%1 (%2)" ).arg( timeFormatString ).arg( exampleTime.toString( timeFormatString ) ); uiText.replace( "AP", "AM/PM" ); options.push_back( caf::PdmOptionItemInfo( uiText, QVariant::fromValue( timeFormat ) ) ); @@ -660,7 +662,8 @@ const QString& RiaPreferences::timeFormat() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiaPreferences::dateTimeFormat( DateFormatComponents dateComponents, TimeFormatComponents timeComponents ) const +QString RiaPreferences::dateTimeFormat( RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ) const { return QString( "%1 %2" ) .arg( RiaQDateTimeTools::dateFormatString( m_dateFormat(), dateComponents ) ) diff --git a/ApplicationLibCode/Application/RiaPreferences.h b/ApplicationLibCode/Application/RiaPreferences.h index 272148b53b..9f112e8eba 100644 --- a/ApplicationLibCode/Application/RiaPreferences.h +++ b/ApplicationLibCode/Application/RiaPreferences.h @@ -21,9 +21,9 @@ #pragma once +#include "RiaDateTimeDefines.h" #include "RiaDefines.h" #include "RiaFontCache.h" -#include "RiaQDateTimeTools.h" #include "cafAppEnum.h" #include "cafPdmChildField.h" @@ -52,9 +52,6 @@ class RiaPreferences : public caf::PdmObject CAF_PDM_HEADER_INIT; public: - using DateFormatComponents = RiaQDateTimeTools::DateFormatComponents; - using TimeFormatComponents = RiaQDateTimeTools::TimeFormatComponents; - using FontSizeEnum = RiaFontCache::FontSizeEnum; using PageSizeEnum = caf::AppEnum; using PageOrientationEnum = caf::AppEnum; @@ -75,8 +72,9 @@ class RiaPreferences : public caf::PdmObject const QString& dateFormat() const; const QString& timeFormat() const; - QString dateTimeFormat( DateFormatComponents dateComponents = DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY, - TimeFormatComponents timeComponents = TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ) const; + QString dateTimeFormat( + RiaDefines::DateFormatComponents dateComponents = RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY, + RiaDefines::TimeFormatComponents timeComponents = RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ) const; bool searchPlotTemplateFoldersRecursively() const; QStringList plotTemplateFolders() const; diff --git a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp index 387fdc9b3b..a3ed7e6d32 100644 --- a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.cpp @@ -40,47 +40,6 @@ const DateTimeSpan RiaQDateTimeTools::TIMESPAN_HALFYEAR = DateTimeSpan( 0, 6, 0 const DateTimeSpan RiaQDateTimeTools::TIMESPAN_YEAR = DateTimeSpan( 1, 0, 0 ); const DateTimeSpan RiaQDateTimeTools::TIMESPAN_DECADE = DateTimeSpan( 10, 0, 0 ); -namespace caf -{ -// clang-format off - -template <> -void caf::AppEnum::setUp() -{ - addItem( RiaQDateTimeTools::DATE_FORMAT_NONE, "NO_DATE", "No Date" ); - addItem( RiaQDateTimeTools::DATE_FORMAT_YEAR, "YEAR", "Year Only" ); - addItem( RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH, "YEAR_MONTH", "Year and Month" ); - addItem( RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY, "YEAR_MONTH_DAY", "Year, Month and Day" ); - setDefault( RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); -} - -template <> -void caf::AppEnum::setUp() -{ - addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_NONE, "NO_TIME", "No Time of Day" ); - addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR, "HOUR", "Hour Only" ); - addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE, "HOUR_MINUTE", "Hour and Minute" ); - addItem( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND, "HOUR_MINUTE_SECONDS", "Hour, Minutes and Seconds" ); - setDefault( RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_NONE ); -} - -template <> -void caf::AppEnum::setUp() -{ - addItem( RiaQDateTimeTools::DateTimePeriod::NONE, "NONE", "None" ); - addItem( RiaQDateTimeTools::DateTimePeriod::DAY, "DAY", "Day" ); - addItem( RiaQDateTimeTools::DateTimePeriod::WEEK, "WEEK", "Week" ); - addItem( RiaQDateTimeTools::DateTimePeriod::MONTH, "MONTH", "Month" ); - addItem( RiaQDateTimeTools::DateTimePeriod::QUARTER, "QUARTER", "Quarter" ); - addItem( RiaQDateTimeTools::DateTimePeriod::HALFYEAR, "HALFYEAR", "Half Year" ); - addItem( RiaQDateTimeTools::DateTimePeriod::YEAR, "YEAR", "Year" ); - addItem( RiaQDateTimeTools::DateTimePeriod::DECADE, "DECADE", "Decade" ); - setDefault( RiaQDateTimeTools::DateTimePeriod::NONE ); -} - -// clang-format on -} // namespace caf - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -197,7 +156,7 @@ QDateTime RiaQDateTimeTools::subtractSpan( const QDateTime& dt, DateTimeSpan spa //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QDateTime RiaQDateTimeTools::addPeriod( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period ) +QDateTime RiaQDateTimeTools::addPeriod( const QDateTime& dt, RiaDefines::DateTimePeriod period ) { return addSpan( dt, timeSpan( period ) ); } @@ -205,7 +164,7 @@ QDateTime RiaQDateTimeTools::addPeriod( const QDateTime& dt, RiaQDateTimeTools:: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QDateTime RiaQDateTimeTools::subtractPeriod( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period ) +QDateTime RiaQDateTimeTools::subtractPeriod( const QDateTime& dt, RiaDefines::DateTimePeriod period ) { return subtractSpan( dt, timeSpan( period ) ); } @@ -287,23 +246,23 @@ bool RiaQDateTimeTools::lessThan( const QDateTime& dt1, const QDateTime& dt2 ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const DateTimeSpan RiaQDateTimeTools::timeSpan( RiaQDateTimeTools::DateTimePeriod period ) +const DateTimeSpan RiaQDateTimeTools::timeSpan( RiaDefines::DateTimePeriod period ) { switch ( period ) { - case RiaQDateTimeTools::DateTimePeriod::DAY: + case RiaDefines::DateTimePeriod::DAY: return TIMESPAN_DAY; - case RiaQDateTimeTools::DateTimePeriod::WEEK: + case RiaDefines::DateTimePeriod::WEEK: return TIMESPAN_WEEK; - case RiaQDateTimeTools::DateTimePeriod::MONTH: + case RiaDefines::DateTimePeriod::MONTH: return TIMESPAN_MONTH; - case RiaQDateTimeTools::DateTimePeriod::QUARTER: + case RiaDefines::DateTimePeriod::QUARTER: return TIMESPAN_QUARTER; - case RiaQDateTimeTools::DateTimePeriod::HALFYEAR: + case RiaDefines::DateTimePeriod::HALFYEAR: return TIMESPAN_HALFYEAR; - case RiaQDateTimeTools::DateTimePeriod::YEAR: + case RiaDefines::DateTimePeriod::YEAR: return TIMESPAN_YEAR; - case RiaQDateTimeTools::DateTimePeriod::DECADE: + case RiaDefines::DateTimePeriod::DECADE: return TIMESPAN_DECADE; } CVF_ASSERT( false ); @@ -313,7 +272,7 @@ const DateTimeSpan RiaQDateTimeTools::timeSpan( RiaQDateTimeTools::DateTimePerio //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QDateTime RiaQDateTimeTools::truncateTime( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period ) +QDateTime RiaQDateTimeTools::truncateTime( const QDateTime& dt, RiaDefines::DateTimePeriod period ) { int y = dt.date().year(); int m = dt.date().month(); @@ -322,19 +281,19 @@ QDateTime RiaQDateTimeTools::truncateTime( const QDateTime& dt, RiaQDateTimeTool switch ( period ) { - case RiaQDateTimeTools::DateTimePeriod::DAY: + case RiaDefines::DateTimePeriod::DAY: return createUtcDateTime( QDate( y, m, d ) ); - case RiaQDateTimeTools::DateTimePeriod::WEEK: + case RiaDefines::DateTimePeriod::WEEK: return createUtcDateTime( QDate( y, m, d ).addDays( -dow + 1 ) ); - case RiaQDateTimeTools::DateTimePeriod::MONTH: + case RiaDefines::DateTimePeriod::MONTH: return createUtcDateTime( QDate( y, m, 1 ) ); - case RiaQDateTimeTools::DateTimePeriod::QUARTER: + case RiaDefines::DateTimePeriod::QUARTER: return createUtcDateTime( QDate( y, ( ( m - 1 ) / 3 ) * 3 + 1, 1 ) ); - case RiaQDateTimeTools::DateTimePeriod::HALFYEAR: + case RiaDefines::DateTimePeriod::HALFYEAR: return createUtcDateTime( QDate( y, ( ( m - 1 ) / 6 ) * 6 + 1, 1 ) ); - case RiaQDateTimeTools::DateTimePeriod::YEAR: + case RiaDefines::DateTimePeriod::YEAR: return createUtcDateTime( QDate( y, 1, 1 ) ); - case RiaQDateTimeTools::DateTimePeriod::DECADE: + case RiaDefines::DateTimePeriod::DECADE: return createUtcDateTime( QDate( ( y / 10 ) * 10, 1, 1 ) ); } CVF_ASSERT( false ); @@ -344,13 +303,13 @@ QDateTime RiaQDateTimeTools::truncateTime( const QDateTime& dt, RiaQDateTimeTool //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RiaQDateTimeTools::dateTimePeriods() +std::vector RiaQDateTimeTools::dateTimePeriods() { - std::vector allPeriods; + std::vector allPeriods; - for ( size_t i = 0; i < DateTimePeriodEnum::size(); i++ ) + for ( size_t i = 0; i < RiaDefines::DateTimePeriodEnum::size(); i++ ) { - allPeriods.push_back( DateTimePeriodEnum::fromIndex( i ) ); + allPeriods.push_back( RiaDefines::DateTimePeriodEnum::fromIndex( i ) ); } return allPeriods; @@ -359,9 +318,9 @@ std::vector RiaQDateTimeTools::dateTimePeriod //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiaQDateTimeTools::dateTimePeriodName( RiaQDateTimeTools::DateTimePeriod period ) +QString RiaQDateTimeTools::dateTimePeriodName( RiaDefines::DateTimePeriod period ) { - return DateTimePeriodEnum::uiText( period ); + return RiaDefines::DateTimePeriodEnum::uiText( period ); } //-------------------------------------------------------------------------------------------------- @@ -482,14 +441,17 @@ std::vector RiaQDateTimeTools::supportedTimeFormats() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiaQDateTimeTools::dateFormatString( const QString& fullDateFormat, DateFormatComponents dateComponents ) +QString RiaQDateTimeTools::dateFormatString( const QString& fullDateFormat, RiaDefines::DateFormatComponents dateComponents ) { - if ( dateComponents == DATE_FORMAT_NONE ) return ""; + if ( dateComponents == RiaDefines::DateFormatComponents::DATE_FORMAT_NONE ) return ""; + + auto enumValue = static_cast::type>( dateComponents ); + if ( enumValue < 0 ) return ""; QStringList allVariants = fullDateFormat.split( ";" ); - if ( static_cast( dateComponents ) < allVariants.size() ) + if ( enumValue < allVariants.size() ) { - return allVariants[dateComponents]; + return allVariants[enumValue]; } CVF_ASSERT( false && "Date format string is malformed" ); return ""; @@ -498,9 +460,9 @@ QString RiaQDateTimeTools::dateFormatString( const QString& fullDateFormat, Date //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiaQDateTimeTools::timeFormatString( const QString& fullTimeFormat, TimeFormatComponents timeComponents ) +QString RiaQDateTimeTools::timeFormatString( const QString& fullTimeFormat, RiaDefines::TimeFormatComponents timeComponents ) { - if ( timeComponents == TimeFormatComponents::TIME_FORMAT_NONE ) return ""; + if ( timeComponents == RiaDefines::TimeFormatComponents::TIME_FORMAT_NONE ) return ""; QStringList allVariants = fullTimeFormat.split( ";" ); if ( static_cast( timeComponents ) < allVariants.size() ) diff --git a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h index 7a4861a16a..2da11175f4 100644 --- a/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h +++ b/ApplicationLibCode/Application/Tools/RiaQDateTimeTools.h @@ -18,13 +18,15 @@ #pragma once +#include "RiaDateTimeDefines.h" + +#include "cafAppEnum.h" + #include #include #include -#include "cafAppEnum.h" - class QDateTime; class QDate; class QTime; @@ -40,49 +42,7 @@ class PdmOptionItemInfo; //================================================================================================== class RiaQDateTimeTools { - static const DateTimeSpan TIMESPAN_DAY; - static const DateTimeSpan TIMESPAN_WEEK; - static const DateTimeSpan TIMESPAN_MONTH; - static const DateTimeSpan TIMESPAN_QUARTER; - static const DateTimeSpan TIMESPAN_HALFYEAR; - static const DateTimeSpan TIMESPAN_YEAR; - static const DateTimeSpan TIMESPAN_DECADE; - public: - enum DateFormatComponents - { - DATE_FORMAT_UNSPECIFIED = -2, - DATE_FORMAT_NONE = -1, - DATE_FORMAT_YEAR = 0, - DATE_FORMAT_YEAR_MONTH, - DATE_FORMAT_YEAR_MONTH_DAY, - DATE_FORMAT_SIZE - }; - - enum class TimeFormatComponents - { - TIME_FORMAT_UNSPECIFIED = -2, - TIME_FORMAT_NONE = -1, - TIME_FORMAT_HOUR, - TIME_FORMAT_HOUR_MINUTE, - TIME_FORMAT_HOUR_MINUTE_SECOND, - TIME_FORMAT_HOUR_MINUTE_SECOND_MILLISECOND, - TIME_FORMAT_SIZE - }; - - enum class DateTimePeriod - { - NONE = -1, - DAY, - WEEK, - MONTH, - QUARTER, - HALFYEAR, - YEAR, - DECADE - }; - using DateTimePeriodEnum = caf::AppEnum; - static Qt::TimeSpec currentTimeSpec(); static QDateTime fromString( const QString& dateString, const QString& format ); @@ -94,8 +54,8 @@ class RiaQDateTimeTools static QDateTime addYears( const QDateTime& dt, double years ); static QDateTime addSpan( const QDateTime& dt, DateTimeSpan span ); static QDateTime subtractSpan( const QDateTime& dt, DateTimeSpan span ); - static QDateTime addPeriod( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period ); - static QDateTime subtractPeriod( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period ); + static QDateTime addPeriod( const QDateTime& dt, RiaDefines::DateTimePeriod period ); + static QDateTime subtractPeriod( const QDateTime& dt, RiaDefines::DateTimePeriod period ); static QDateTime createDateTime( const QDate& date ); @@ -108,11 +68,11 @@ class RiaQDateTimeTools static bool lessThan( const QDateTime& dt1, const QDateTime& dt2 ); - static const DateTimeSpan timeSpan( RiaQDateTimeTools::DateTimePeriod period ); - static QDateTime truncateTime( const QDateTime& dt, RiaQDateTimeTools::DateTimePeriod period ); + static const DateTimeSpan timeSpan( RiaDefines::DateTimePeriod period ); + static QDateTime truncateTime( const QDateTime& dt, RiaDefines::DateTimePeriod period ); - static std::vector dateTimePeriods(); - static QString dateTimePeriodName( RiaQDateTimeTools::DateTimePeriod period ); + static std::vector dateTimePeriods(); + static QString dateTimePeriodName( RiaDefines::DateTimePeriod period ); // This function uses C locale to make sure the text representation of a date is stable, independent of the locale // settings on local machine. Required for stable regression testing. @@ -124,16 +84,24 @@ class RiaQDateTimeTools static std::vector supportedDateFormats(); static std::vector supportedTimeFormats(); - static QString - dateFormatString( const QString& fullDateFormat, - DateFormatComponents dateComponents = DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); - static QString - timeFormatString( const QString& fullTimeFormat, - TimeFormatComponents timeComponents = TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ); + static QString dateFormatString( + const QString& fullDateFormat, + RiaDefines::DateFormatComponents dateComponents = RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); + static QString timeFormatString( const QString& fullTimeFormat, + RiaDefines::TimeFormatComponents timeComponents = + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ); static QList createOptionItems( const std::vector& timeSteps ); private: + static const DateTimeSpan TIMESPAN_DAY; + static const DateTimeSpan TIMESPAN_WEEK; + static const DateTimeSpan TIMESPAN_MONTH; + static const DateTimeSpan TIMESPAN_QUARTER; + static const DateTimeSpan TIMESPAN_HALFYEAR; + static const DateTimeSpan TIMESPAN_YEAR; + static const DateTimeSpan TIMESPAN_DECADE; + static quint64 secondsInDay(); static quint64 secondsInYear(); }; diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp index 4566231e47..6614fce282 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp @@ -221,10 +221,10 @@ void RiaSummaryTools::getSummaryCasesAndAddressesForCalculation( int /// //-------------------------------------------------------------------------------------------------- std::pair, std::vector> - RiaSummaryTools::resampledValuesForPeriod( const RifEclipseSummaryAddress& address, - const std::vector& timeSteps, - std::vector& values, - RiaQDateTimeTools::DateTimePeriod period ) + RiaSummaryTools::resampledValuesForPeriod( const RifEclipseSummaryAddress& address, + const std::vector& timeSteps, + std::vector& values, + RiaDefines::DateTimePeriod period ) { RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( values, timeSteps ); diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.h b/ApplicationLibCode/Application/Tools/RiaSummaryTools.h index e38d8aa5ea..1b8fa4f175 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.h +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.h @@ -18,7 +18,7 @@ #pragma once -#include "RiaQDateTimeTools.h" +#include "RiaDateTimeDefines.h" #include @@ -66,10 +66,10 @@ class RiaSummaryTools std::vector& addresses ); static std::pair, std::vector> - resampledValuesForPeriod( const RifEclipseSummaryAddress& address, - const std::vector& timeSteps, - std::vector& values, - RiaQDateTimeTools::DateTimePeriod period ); + resampledValuesForPeriod( const RifEclipseSummaryAddress& address, + const std::vector& timeSteps, + std::vector& values, + RiaDefines::DateTimePeriod period ); static RimSummaryCase* summaryCaseById( int caseId ); static RimSummaryCaseCollection* ensembleById( int ensembleId ); diff --git a/ApplicationLibCode/Application/Tools/RiaTimeHistoryCurveResampler.cpp b/ApplicationLibCode/Application/Tools/RiaTimeHistoryCurveResampler.cpp index 88deb2a5ef..d88b9dffc6 100644 --- a/ApplicationLibCode/Application/Tools/RiaTimeHistoryCurveResampler.cpp +++ b/ApplicationLibCode/Application/Tools/RiaTimeHistoryCurveResampler.cpp @@ -19,6 +19,7 @@ #include #include +#include "RiaQDateTimeTools.h" #include "RiaTimeHistoryCurveResampler.h" #include @@ -67,7 +68,7 @@ void RiaTimeHistoryCurveResampler::setCurveData( const std::vector& valu //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaTimeHistoryCurveResampler::resampleAndComputePeriodEndValues( RiaQDateTimeTools::DateTimePeriod period ) +void RiaTimeHistoryCurveResampler::resampleAndComputePeriodEndValues( RiaDefines::DateTimePeriod period ) { computePeriodEndValues( period ); } @@ -75,7 +76,7 @@ void RiaTimeHistoryCurveResampler::resampleAndComputePeriodEndValues( RiaQDateTi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaTimeHistoryCurveResampler::resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod period ) +void RiaTimeHistoryCurveResampler::resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod period ) { computeWeightedMeanValues( period ); } @@ -99,22 +100,22 @@ const std::vector& RiaTimeHistoryCurveResampler::resampledValues() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RiaTimeHistoryCurveResampler::timeStepsFromTimeRange( RiaQDateTimeTools::DateTimePeriod period, - time_t minTime, - time_t maxTime ) +std::vector RiaTimeHistoryCurveResampler::timeStepsFromTimeRange( RiaDefines::DateTimePeriod period, + time_t minTime, + time_t maxTime ) { if ( minTime > maxTime ) return std::vector(); - auto firstOriginalTimeStep = QDT::fromTime_t( minTime ); - auto lastOriginalTimeStep = QDT::fromTime_t( maxTime ); + auto firstOriginalTimeStep = RiaQDateTimeTools::fromTime_t( minTime ); + auto lastOriginalTimeStep = RiaQDateTimeTools::fromTime_t( maxTime ); auto currTimeStep = firstResampledTimeStep( firstOriginalTimeStep, period ); std::vector timeSteps; - while ( QDT::lessThan( currTimeStep, lastOriginalTimeStep ) ) + while ( RiaQDateTimeTools::lessThan( currTimeStep, lastOriginalTimeStep ) ) { timeSteps.push_back( currTimeStep.toSecsSinceEpoch() ); - currTimeStep = QDT::addPeriod( currTimeStep, period ); + currTimeStep = RiaQDateTimeTools::addPeriod( currTimeStep, period ); } timeSteps.push_back( currTimeStep.toSecsSinceEpoch() ); @@ -124,7 +125,7 @@ std::vector RiaTimeHistoryCurveResampler::timeStepsFromTimeRange( RiaQDa //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaTimeHistoryCurveResampler::computeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod period ) +void RiaTimeHistoryCurveResampler::computeWeightedMeanValues( RiaDefines::DateTimePeriod period ) { size_t origDataSize = m_originalValues.second.size(); size_t oi = 0; @@ -141,9 +142,11 @@ void RiaTimeHistoryCurveResampler::computeWeightedMeanValues( RiaQDateTimeTools: m_values.reserve( m_timeSteps.size() ); for ( size_t i = 0; i < m_timeSteps.size(); i++ ) { - double wMean = 0.0; - time_t periodStart = i > 0 ? m_timeSteps[i - 1] - : QDT::subtractPeriod( QDT::fromTime_t( m_timeSteps[0] ), period ).toSecsSinceEpoch(); + double wMean = 0.0; + time_t periodStart = + i > 0 ? m_timeSteps[i - 1] + : RiaQDateTimeTools::subtractPeriod( RiaQDateTimeTools::fromTime_t( m_timeSteps[0] ), period ) + .toSecsSinceEpoch(); time_t periodEnd = m_timeSteps[i]; time_t periodLength = periodEnd - periodStart; @@ -197,7 +200,7 @@ void RiaTimeHistoryCurveResampler::computeWeightedMeanValues( RiaQDateTimeTools: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaTimeHistoryCurveResampler::computePeriodEndValues( RiaQDateTimeTools::DateTimePeriod period ) +void RiaTimeHistoryCurveResampler::computePeriodEndValues( RiaDefines::DateTimePeriod period ) { size_t origDataSize = m_originalValues.second.size(); size_t oi = 0; @@ -246,20 +249,20 @@ void RiaTimeHistoryCurveResampler::clearData() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaTimeHistoryCurveResampler::computeResampledTimeSteps( RiaQDateTimeTools::DateTimePeriod period ) +void RiaTimeHistoryCurveResampler::computeResampledTimeSteps( RiaDefines::DateTimePeriod period ) { - CVF_ASSERT( period != RiaQDateTimeTools::DateTimePeriod::NONE && m_originalValues.second.size() > 0 ); + CVF_ASSERT( period != RiaDefines::DateTimePeriod::NONE && m_originalValues.second.size() > 0 ); - auto firstOriginalTimeStep = QDT::fromTime_t( m_originalValues.second.front() ); - auto lastOriginalTimeStep = QDT::fromTime_t( m_originalValues.second.back() ); + auto firstOriginalTimeStep = RiaQDateTimeTools::fromTime_t( m_originalValues.second.front() ); + auto lastOriginalTimeStep = RiaQDateTimeTools::fromTime_t( m_originalValues.second.back() ); clearData(); auto currTimeStep = firstResampledTimeStep( firstOriginalTimeStep, period ); - while ( QDT::lessThan( currTimeStep, lastOriginalTimeStep ) ) + while ( RiaQDateTimeTools::lessThan( currTimeStep, lastOriginalTimeStep ) ) { m_timeSteps.push_back( currTimeStep.toSecsSinceEpoch() ); - currTimeStep = QDT::addPeriod( currTimeStep, period ); + currTimeStep = RiaQDateTimeTools::addPeriod( currTimeStep, period ); } // Add last time step @@ -269,12 +272,13 @@ void RiaTimeHistoryCurveResampler::computeResampledTimeSteps( RiaQDateTimeTools: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QDateTime RiaTimeHistoryCurveResampler::firstResampledTimeStep( const QDateTime& firstTimeStep, - RiaQDateTimeTools::DateTimePeriod period ) +QDateTime RiaTimeHistoryCurveResampler::firstResampledTimeStep( const QDateTime& firstTimeStep, + RiaDefines::DateTimePeriod period ) { - QDateTime truncatedTime = QDT::truncateTime( firstTimeStep, period ); + QDateTime truncatedTime = RiaQDateTimeTools::truncateTime( firstTimeStep, period ); - if ( QDT::lessThan( truncatedTime, firstTimeStep ) ) return QDT::addPeriod( truncatedTime, period ); + if ( RiaQDateTimeTools::lessThan( truncatedTime, firstTimeStep ) ) + return RiaQDateTimeTools::addPeriod( truncatedTime, period ); return truncatedTime; } diff --git a/ApplicationLibCode/Application/Tools/RiaTimeHistoryCurveResampler.h b/ApplicationLibCode/Application/Tools/RiaTimeHistoryCurveResampler.h index e917aadec7..d33ca73057 100644 --- a/ApplicationLibCode/Application/Tools/RiaTimeHistoryCurveResampler.h +++ b/ApplicationLibCode/Application/Tools/RiaTimeHistoryCurveResampler.h @@ -19,12 +19,10 @@ #pragma once #include "RiaCurveDataTools.h" -#include "RiaQDateTimeTools.h" +#include "RiaDateTimeDefines.h" #include -using QDT = RiaQDateTimeTools; - //================================================================================================== /// //================================================================================================== @@ -35,22 +33,21 @@ class RiaTimeHistoryCurveResampler void setCurveData( const std::vector& values, const std::vector& timeSteps ); - void resampleAndComputePeriodEndValues( RiaQDateTimeTools::DateTimePeriod period ); - void resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod period ); + void resampleAndComputePeriodEndValues( RiaDefines::DateTimePeriod period ); + void resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod period ); const std::vector& resampledTimeSteps() const; const std::vector& resampledValues() const; - static std::vector - timeStepsFromTimeRange( RiaQDateTimeTools::DateTimePeriod period, time_t minTime, time_t maxTime ); + static std::vector timeStepsFromTimeRange( RiaDefines::DateTimePeriod period, time_t minTime, time_t maxTime ); private: - void computeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod period ); - void computePeriodEndValues( RiaQDateTimeTools::DateTimePeriod period ); + void computeWeightedMeanValues( RiaDefines::DateTimePeriod period ); + void computePeriodEndValues( RiaDefines::DateTimePeriod period ); void clearData(); - void computeResampledTimeSteps( RiaQDateTimeTools::DateTimePeriod period ); - static QDateTime firstResampledTimeStep( const QDateTime& firstTimestep, RiaQDateTimeTools::DateTimePeriod period ); + void computeResampledTimeSteps( RiaDefines::DateTimePeriod period ); + static QDateTime firstResampledTimeStep( const QDateTime& firstTimestep, RiaDefines::DateTimePeriod period ); inline double interpolatedValue( time_t t, time_t t1, double v1, time_t t2, double v2 ); private: diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp index b026ff5352..7d3dc74ed2 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.cpp @@ -21,6 +21,7 @@ #include "RiaFeatureCommandContext.h" #include "RiaGuiApplication.h" #include "RiaPreferencesSummary.h" +#include "RiaQDateTimeTools.h" #include "RimGridCrossPlot.h" #include "RimGridCrossPlotCurve.h" @@ -64,8 +65,8 @@ class RiuTabbedSummaryPlotTextProvider : public RiuTabbedTextProvider { auto allTabs = tabs(); CVF_ASSERT( tabIndex < (int)allTabs.size() ); - RiaQDateTimeTools::DateTimePeriod timePeriod = allTabs[tabIndex]; - if ( timePeriod == RiaQDateTimeTools::DateTimePeriod::NONE ) + RiaDefines::DateTimePeriod timePeriod = allTabs[tabIndex]; + if ( timePeriod == RiaDefines::DateTimePeriod::NONE ) { return "No Resampling"; } @@ -79,7 +80,7 @@ class RiuTabbedSummaryPlotTextProvider : public RiuTabbedTextProvider { CVF_ASSERT( m_summaryPlot.notNull() && "Need to check that provider is valid" ); - RiaQDateTimeTools::DateTimePeriod timePeriod = indexToPeriod( tabIndex ); + RiaDefines::DateTimePeriod timePeriod = indexToPeriod( tabIndex ); if ( m_summaryPlot->containsResamplableCurves() ) { @@ -89,27 +90,25 @@ class RiuTabbedSummaryPlotTextProvider : public RiuTabbedTextProvider } else { - return m_summaryPlot->asciiDataForSummaryPlotExport( RiaQDateTimeTools::DateTimePeriod::NONE, true ); + return m_summaryPlot->asciiDataForSummaryPlotExport( RiaDefines::DateTimePeriod::NONE, true ); } } int tabCount() const override { return (int)tabs().size(); } private: - static RiaQDateTimeTools::DateTimePeriod indexToPeriod( int tabIndex ) + static RiaDefines::DateTimePeriod indexToPeriod( int tabIndex ) { auto allTabs = tabs(); CVF_ASSERT( tabIndex < (int)allTabs.size() ); - RiaQDateTimeTools::DateTimePeriod timePeriod = allTabs[tabIndex]; + RiaDefines::DateTimePeriod timePeriod = allTabs[tabIndex]; return timePeriod; } - static std::vector tabs() + static std::vector tabs() { - std::vector dateTimePeriods = RiaQDateTimeTools::dateTimePeriods(); - dateTimePeriods.erase( std::remove( dateTimePeriods.begin(), - dateTimePeriods.end(), - RiaQDateTimeTools::DateTimePeriod::DECADE ), + std::vector dateTimePeriods = RiaQDateTimeTools::dateTimePeriods(); + dateTimePeriods.erase( std::remove( dateTimePeriods.begin(), dateTimePeriods.end(), RiaDefines::DateTimePeriod::DECADE ), dateTimePeriods.end() ); return dateTimePeriods; } diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h index eea9017d87..3e3c4a36f8 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicShowPlotDataFeature.h @@ -18,8 +18,6 @@ #pragma once -#include "RiaQDateTimeTools.h" - #include "cafCmdFeature.h" #include diff --git a/ApplicationLibCode/Commands/RicResampleDialog.cpp b/ApplicationLibCode/Commands/RicResampleDialog.cpp index f3e4b1b16c..7d153ec128 100644 --- a/ApplicationLibCode/Commands/RicResampleDialog.cpp +++ b/ApplicationLibCode/Commands/RicResampleDialog.cpp @@ -18,6 +18,8 @@ #include "RicResampleDialog.h" +#include "RiaQDateTimeTools.h" + #include "RiuTools.h" #include @@ -97,13 +99,13 @@ RicResampleDialogResult RicResampleDialog::openDialog( QWidget* parent /*= 0*/, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicResampleDialog::setPeriodOptions( const std::vector& dateTimePeriods ) +void RicResampleDialog::setPeriodOptions( const std::vector& dateTimePeriods ) { QStringList s; for ( auto& period : dateTimePeriods ) { - QString text = period != RiaQDateTimeTools::DateTimePeriod::NONE ? RiaQDateTimeTools::dateTimePeriodName( period ) - : "No Resampling"; + QString text = period != RiaDefines::DateTimePeriod::NONE ? RiaQDateTimeTools::dateTimePeriodName( period ) + : "No Resampling"; m_timePeriodCombo->addItem( text, QVariant( (int)period ) ); } } @@ -111,10 +113,10 @@ void RicResampleDialog::setPeriodOptions( const std::vectorcurrentIndex(); - return (RiaQDateTimeTools::DateTimePeriod)m_timePeriodCombo->itemData( currIndex ).toInt(); + return (RiaDefines::DateTimePeriod)m_timePeriodCombo->itemData( currIndex ).toInt(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/RicResampleDialog.h b/ApplicationLibCode/Commands/RicResampleDialog.h index 8feb1068e7..ea68da6cb3 100644 --- a/ApplicationLibCode/Commands/RicResampleDialog.h +++ b/ApplicationLibCode/Commands/RicResampleDialog.h @@ -18,7 +18,7 @@ #pragma once -#include "RiaQDateTimeTools.h" +#include "RiaDateTimeDefines.h" #include "cafPdmPointer.h" @@ -49,8 +49,8 @@ class RicResampleDialog : public QDialog static RicResampleDialogResult openDialog( QWidget* parent = nullptr, const QString& caption = QString() ); private: - void setPeriodOptions( const std::vector& dateTimePeriods ); - RiaQDateTimeTools::DateTimePeriod selectedDateTimePeriod() const; + void setPeriodOptions( const std::vector& dateTimePeriods ); + RiaDefines::DateTimePeriod selectedDateTimePeriod() const; private slots: void slotDialogOkClicked(); @@ -69,12 +69,12 @@ private slots: class RicResampleDialogResult { public: - RicResampleDialogResult( bool ok, RiaQDateTimeTools::DateTimePeriod period ) + RicResampleDialogResult( bool ok, RiaDefines::DateTimePeriod period ) : ok( ok ) , period( period ) { } - bool ok; - RiaQDateTimeTools::DateTimePeriod period; + bool ok; + RiaDefines::DateTimePeriod period; }; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.cpp index ca91b371f3..f92ee8c3c5 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.cpp @@ -170,10 +170,10 @@ bool RicAsciiExportSummaryPlotFeature::exportTextToFile( const QString& fileName //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RicAsciiExportSummaryPlotFeature::exportAsciiForSummaryPlot( const QString& fileName, - const RimSummaryPlot* summaryPlot, - RiaQDateTimeTools::DateTimePeriod resamplingPeriod, - bool showTimeAsLongString ) +bool RicAsciiExportSummaryPlotFeature::exportAsciiForSummaryPlot( const QString& fileName, + const RimSummaryPlot* summaryPlot, + RiaDefines::DateTimePeriod resamplingPeriod, + bool showTimeAsLongString ) { QString text = summaryPlot->description(); text.append( summaryPlot->asciiDataForSummaryPlotExport( resamplingPeriod, showTimeAsLongString ) ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.h index 76a7078e62..77d021bb07 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicAsciiExportSummaryPlotFeature.h @@ -18,8 +18,7 @@ #pragma once -#include "RiaQDateTimeTools.h" - +#include "RiaDateTimeDefines.h" #include "cafCmdFeature.h" class RimSummaryPlot; @@ -42,8 +41,8 @@ class RicAsciiExportSummaryPlotFeature : public caf::CmdFeature void setupActionLook( QAction* actionToSetup ) override; private: - static bool exportAsciiForSummaryPlot( const QString& fileName, - const RimSummaryPlot* selectedSummaryPlots, - RiaQDateTimeTools::DateTimePeriod resamplingPeriod, - bool showTimeAsLongString ); + static bool exportAsciiForSummaryPlot( const QString& fileName, + const RimSummaryPlot* selectedSummaryPlots, + RiaDefines::DateTimePeriod resamplingPeriod, + bool showTimeAsLongString ); }; diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index 5c26851b52..0177e0dedf 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -21,6 +21,7 @@ #include "RiaDefines.h" #include "RiaPlotDefines.h" #include "RiaPreferences.h" +#include "RiaQDateTimeTools.h" #include "RiaSummaryCurveDefinition.h" #include "RiaTextStringTools.h" @@ -611,11 +612,12 @@ QList RimAnalysisPlot::calculateValueOptions( const caf: filteredTimeStepIndices.erase( std::unique( filteredTimeStepIndices.begin(), filteredTimeStepIndices.end() ), filteredTimeStepIndices.end() ); - QString dateFormatString = RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), - RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + QString dateFormatString = + RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); QString timeFormatString = RiaQDateTimeTools::timeFormatString( RiaPreferences::current()->timeFormat(), - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); QString dateTimeFormatString = QString( "%1 %2" ).arg( dateFormatString ).arg( timeFormatString ); bool showTime = m_timeStepFilter() == RimTimeStepFilter::TS_ALL || @@ -1645,8 +1647,8 @@ void RimAnalysisPlot::updatePlotTitle() if ( !autoTitle.isEmpty() ) autoTitle += " @ "; QString formatString = - RiaPreferences::current()->dateTimeFormat( RiaQDateTimeTools::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY, - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_NONE ); + RiaPreferences::current()->dateTimeFormat( RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY, + RiaDefines::TimeFormatComponents::TIME_FORMAT_NONE ); autoTitle += m_selectedTimeSteps()[0].toString( formatString ); } diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp index de7643318c..8aeeb188d8 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp @@ -275,11 +275,12 @@ QList std::vector filteredTimeStepIndices = RimTimeStepFilter::filteredTimeStepIndices( allDateTimes, 0, (int)allDateTimes.size() - 1, m_timeStepFilter(), 1 ); - QString dateFormatString = RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), - RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + QString dateFormatString = + RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); QString timeFormatString = RiaQDateTimeTools::timeFormatString( RiaPreferences::current()->timeFormat(), - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); QString dateTimeFormatString = QString( "%1 %2" ).arg( dateFormatString ).arg( timeFormatString ); bool showTime = m_timeStepFilter == RimTimeStepFilter::TS_ALL || RimTimeStepFilter::TS_INTERVAL_DAYS; @@ -607,11 +608,12 @@ QDateTime RimAbstractCorrelationPlot::timeStep() const //-------------------------------------------------------------------------------------------------- QString RimAbstractCorrelationPlot::timeStepString() const { - QString dateFormatString = RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), - RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + QString dateFormatString = + RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); QString timeFormatString = RiaQDateTimeTools::timeFormatString( RiaPreferences::current()->timeFormat(), - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); return timeStep().toString( dateFormatString ) + " " + timeStep().toString( timeFormatString ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp index 6c69e11233..18a903ff73 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewTools.cpp @@ -168,7 +168,7 @@ double RimSimWellInViewTools::extractValueForTimeStep( RifSummaryReaderInterface } auto [resampledTimeSteps, resampledValues] = - RiaSummaryTools::resampledValuesForPeriod( addr, timeSteps, values, RiaQDateTimeTools::DateTimePeriod::DAY ); + RiaSummaryTools::resampledValuesForPeriod( addr, timeSteps, values, RiaDefines::DateTimePeriod::DAY ); time_t currentTime_t = currentDate.toSecsSinceEpoch(); diff --git a/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.cpp index 82d1dc5315..dd0fc474d4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTimeAxisAnnotation.cpp @@ -57,12 +57,13 @@ void RimTimeAxisAnnotation::setTime( time_t time ) { m_value = RiaTimeTTools::toDouble( time ); - QString dateFormatString = RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), - RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + QString dateFormatString = + RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); QString timeFormatString = RiaQDateTimeTools::timeFormatString( RiaPreferences::current()->timeFormat(), - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); QString dateTimeFormatString = QString( "%1 %2" ).arg( dateFormatString ).arg( timeFormatString ); @@ -80,12 +81,13 @@ void RimTimeAxisAnnotation::setTimeRange( time_t startTime, time_t endTime ) m_rangeStart = RiaTimeTTools::toDouble( startTime ); m_rangeEnd = RiaTimeTTools::toDouble( endTime ); - QString dateFormatString = RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), - RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + QString dateFormatString = + RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); QString timeFormatString = RiaQDateTimeTools::timeFormatString( RiaPreferences::current()->timeFormat(), - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); QString dateTimeFormatString = QString( "%1 %2" ).arg( dateFormatString ).arg( timeFormatString ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp index 233c1e3080..b6874171ca 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp @@ -20,6 +20,7 @@ #include "RiaCurveMerger.h" #include "RiaLogging.h" +#include "RiaQDateTimeTools.h" #include "RifDerivedEnsembleReader.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index d3056f3c0f..ba20062352 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -21,6 +21,7 @@ #include "RiaColorTools.h" #include "RiaGuiApplication.h" #include "RiaPreferences.h" +#include "RiaQDateTimeTools.h" #include "RiaResultNames.h" #include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryCurveDefinition.h" @@ -1175,11 +1176,12 @@ QList RimEnsembleCurveSet::calculateValueOptions( const filteredTimeStepIndices.erase( std::unique( filteredTimeStepIndices.begin(), filteredTimeStepIndices.end() ), filteredTimeStepIndices.end() ); - QString dateFormatString = RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), - RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + QString dateFormatString = + RiaQDateTimeTools::dateFormatString( RiaPreferences::current()->dateFormat(), + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); QString timeFormatString = RiaQDateTimeTools::timeFormatString( RiaPreferences::current()->timeFormat(), - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); QString dateTimeFormatString = QString( "%1 %2" ).arg( dateFormatString ).arg( timeFormatString ); bool showTime = m_timeStepFilter() == RimTimeStepFilter::TS_ALL || diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index 4075be02dc..4694a23533 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -22,8 +22,8 @@ #include "RifEclipseSummaryAddressQMetaType.h" #include "RifSummaryReaderInterface.h" +#include "RiaDateTimeDefines.h" #include "RiaPlotDefines.h" -#include "RiaQDateTimeTools.h" #include "RimEnsembleCurveSetColorManager.h" #include "RimEnsembleCurveSetInterface.h" @@ -216,11 +216,11 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt caf::PdmPointer m_currentSummaryCurve; - caf::PdmPtrField m_yValuesSummaryCaseCollection; - caf::PdmChildField m_yValuesSummaryAddress; - caf::PdmField m_yValuesSummaryAddressUiField; - caf::PdmField m_yPushButtonSelectSummaryAddress; - caf::PdmField m_resampling; + caf::PdmPtrField m_yValuesSummaryCaseCollection; + caf::PdmChildField m_yValuesSummaryAddress; + caf::PdmField m_yValuesSummaryAddressUiField; + caf::PdmField m_yPushButtonSelectSummaryAddress; + caf::PdmField m_resampling; caf::PdmField m_colorMode; caf::PdmField m_color; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp index 8fd7c45f0a..9b1614291b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp @@ -161,10 +161,7 @@ void RimEnsembleStatisticsCase::calculate( const std::vector su if ( !includeIncompleteCurves && timeSteps.size() != values.size() ) continue; auto [resampledTimeSteps, resampledValues] = - RiaSummaryTools::resampledValuesForPeriod( inputAddress, - timeSteps, - values, - RiaQDateTimeTools::DateTimePeriod::DAY ); + RiaSummaryTools::resampledValuesForPeriod( inputAddress, timeSteps, values, RiaDefines::DateTimePeriod::DAY ); if ( allTimeSteps.empty() ) allTimeSteps = resampledTimeSteps; caseAndTimeStepValues.push_back( resampledValues ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 38e627f727..aecf7f74eb 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -24,6 +24,7 @@ #include "RiaLogging.h" #include "RiaPlotDefines.h" #include "RiaPreferencesSummary.h" +#include "RiaQDateTimeTools.h" #include "RiaResultNames.h" #include "RiaSummaryCurveDefinition.h" #include "RiaSummaryTools.h" @@ -664,7 +665,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot ) } else { - if ( m_resampling() != RiaQDateTimeTools::DateTimePeriod::NONE ) + if ( m_resampling() != RiaDefines::DateTimePeriod::NONE ) { auto [resampledTimeSteps, resampledValues] = RiaSummaryTools::resampledValuesForPeriod( m_yValuesSummaryAddress->address(), @@ -884,7 +885,7 @@ void RimSummaryCurve::appendOptionItemsForSummaryAddresses( QList errorValuesY() const; @@ -134,7 +134,7 @@ class RimSummaryCurve : public RimStackablePlotCurve caf::PdmField m_yValuesSummaryAddressUiField; caf::PdmField m_yPushButtonSelectSummaryAddress; - caf::PdmField m_resampling; + caf::PdmField m_resampling; // X values caf::PdmPtrField m_xValuesSummaryCase; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp index 1cbcba7995..daf51ac1a2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurvesData.cpp @@ -77,7 +77,7 @@ void RimSummaryCurvesData::populateAsciiDataCurvesData( std::vector& curves, const std::vector& asciiCurves, const std::vector& gridCurves, - RiaQDateTimeTools::DateTimePeriod resamplingPeriod, + RiaDefines::DateTimePeriod resamplingPeriod, bool showTimeAsLongString ) { QString out; @@ -242,16 +242,16 @@ void RimSummaryCurvesData::populateSummaryCurvesData( std::vectorclear(); - if ( period != RiaQDateTimeTools::DateTimePeriod::NONE ) + if ( period != RiaDefines::DateTimePeriod::NONE ) { // Prepare result data resultCurvesData->resamplePeriod = period; @@ -333,7 +333,7 @@ void RimSummaryCurvesData::appendToExportData( QString& { RimSummaryCurvesData data = RimSummaryCurvesData::concatCurvesData( curvesData ); - if ( data.resamplePeriod != RiaQDateTimeTools::DateTimePeriod::NONE ) + if ( data.resamplePeriod != RiaDefines::DateTimePeriod::NONE ) { time_t minTimeStep = std::numeric_limits::max(); time_t maxTimeStep = 0; @@ -385,40 +385,40 @@ void RimSummaryCurvesData::appendToExportData( QString& { default: // Fall through to NONE - case RiaQDateTimeTools::DateTimePeriod::NONE: + case RiaDefines::DateTimePeriod::NONE: timeText = timseStepUtc.toString( "yyyy-MM-dd hh:mm:ss " ); break; - case RiaQDateTimeTools::DateTimePeriod::DAY: + case RiaDefines::DateTimePeriod::DAY: timeText = oneDayEarlier.toString( "yyyy-MM-dd " ); break; - case RiaQDateTimeTools::DateTimePeriod::WEEK: + case RiaDefines::DateTimePeriod::WEEK: { timeText = oneDayEarlier.toString( "yyyy" ); int weekNumber = oneDayEarlier.date().weekNumber(); timeText += QString( "-W%1" ).arg( weekNumber, 2, 10, zeroChar ); break; } - case RiaQDateTimeTools::DateTimePeriod::MONTH: + case RiaDefines::DateTimePeriod::MONTH: timeText = oneDayEarlier.toString( "yyyy-MM" ); break; - case RiaQDateTimeTools::DateTimePeriod::QUARTER: + case RiaDefines::DateTimePeriod::QUARTER: { int quarterNumber = oneDayEarlier.date().month() / 3; timeText = oneDayEarlier.toString( "yyyy" ); timeText += QString( "-Q%1" ).arg( quarterNumber ); break; } - case RiaQDateTimeTools::DateTimePeriod::HALFYEAR: + case RiaDefines::DateTimePeriod::HALFYEAR: { int halfYearNumber = oneDayEarlier.date().month() / 6; timeText = oneDayEarlier.toString( "yyyy" ); timeText += QString( "-H%1" ).arg( halfYearNumber ); break; } - case RiaQDateTimeTools::DateTimePeriod::YEAR: + case RiaDefines::DateTimePeriod::YEAR: timeText = oneDayEarlier.toString( "yyyy" ); break; - case RiaQDateTimeTools::DateTimePeriod::DECADE: + case RiaDefines::DateTimePeriod::DECADE: timeText = oneDayEarlier.toString( "yyyy" ); break; } @@ -473,8 +473,8 @@ RimSummaryCurvesData RimSummaryCurvesData::concatCurvesData( const std::vector @@ -66,7 +66,7 @@ class RimSummaryCurvesData static QString createTextForExport( const std::vector& curves, const std::vector& asciiCurves, const std::vector& gridCurves, - RiaQDateTimeTools::DateTimePeriod resamplingPeriod, + RiaDefines::DateTimePeriod resamplingPeriod, bool showTimeAsLongString ); private: @@ -77,10 +77,10 @@ class RimSummaryCurvesData RimSummaryCurvesData* curvesData ); static void populateAsciiDataCurvesData( std::vector curves, RimSummaryCurvesData* curvesData ); - static void prepareCaseCurvesForExport( RiaQDateTimeTools::DateTimePeriod period, - ResampleAlgorithm algorithm, - const RimSummaryCurvesData& inputCurvesData, - RimSummaryCurvesData* resultCurvesData ); + static void prepareCaseCurvesForExport( RiaDefines::DateTimePeriod period, + ResampleAlgorithm algorithm, + const RimSummaryCurvesData& inputCurvesData, + RimSummaryCurvesData* resultCurvesData ); static void appendToExportDataForCase( QString& out, const std::vector& timeSteps, @@ -95,7 +95,7 @@ class RimSummaryCurvesData QString createCaseId( const QString& caseName, const QString& ensembleName ); public: - RiaQDateTimeTools::DateTimePeriod resamplePeriod; + RiaDefines::DateTimePeriod resamplePeriod; std::vector caseIds; std::vector> timeSteps; std::vector> allCurveData; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 1ea1c47b19..9fed24ab17 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -300,14 +300,14 @@ RiuPlotWidget* RimSummaryPlot::plotWidget() //-------------------------------------------------------------------------------------------------- QString RimSummaryPlot::asciiDataForPlotExport() const { - return asciiDataForSummaryPlotExport( RiaQDateTimeTools::DateTimePeriod::YEAR, false ); + return asciiDataForSummaryPlotExport( RiaDefines::DateTimePeriod::YEAR, false ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimSummaryPlot::asciiDataForSummaryPlotExport( RiaQDateTimeTools::DateTimePeriod resamplingPeriod, - bool showTimeAsLongString ) const +QString RimSummaryPlot::asciiDataForSummaryPlotExport( RiaDefines::DateTimePeriod resamplingPeriod, + bool showTimeAsLongString ) const { std::vector curves; this->descendantsIncludingThisOfType( curves ); @@ -1044,8 +1044,8 @@ void RimSummaryPlot::updateTimeAxis( RimSummaryTimeAxisProperties* timeAxisPrope if ( timeAxisProperties->timeMode() == RimSummaryTimeAxisProperties::DATE ) { - RiaQDateTimeTools::DateFormatComponents dateComponents = timeAxisProperties->dateComponents(); - RiaQDateTimeTools::TimeFormatComponents timeComponents = timeAxisProperties->timeComponents(); + RiaDefines::DateFormatComponents dateComponents = timeAxisProperties->dateComponents(); + RiaDefines::TimeFormatComponents timeComponents = timeAxisProperties->timeComponents(); const QString& dateFormat = timeAxisProperties->dateFormat(); const QString& timeFormat = timeAxisProperties->timeFormat(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 3365161185..39217afb34 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -18,8 +18,8 @@ #pragma once +#include "RiaDateTimeDefines.h" #include "RiaPlotDefines.h" -#include "RiaQDateTimeTools.h" #include "RifEclipseSummaryAddress.h" @@ -127,8 +127,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping QWidget* viewWidget() override; QString asciiDataForPlotExport() const override; - QString asciiDataForSummaryPlotExport( RiaQDateTimeTools::DateTimePeriod resamplingPeriod, - bool showTimeAsLongString ) const; + QString asciiDataForSummaryPlotExport( RiaDefines::DateTimePeriod resamplingPeriod, bool showTimeAsLongString ) const; std::vector summaryAndEnsembleCurves() const; std::set summaryAndEnsembleCurveDefinitions() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index 557c640986..88c01c8ab0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -21,6 +21,7 @@ #include "RiaApplication.h" #include "RiaFontCache.h" #include "RiaPreferences.h" +#include "RiaQDateTimeTools.h" #include "RimSummaryPlot.h" @@ -364,7 +365,8 @@ QList QDate exampleDate = QDate( 2019, 8, 16 ); QString fullDateFormat = RiaQDateTimeTools::dateFormatString( dateFormat, - dateComponents( RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ) ); + dateComponents( + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ) ); QString uiText = QString( "%1 (%2)" ).arg( fullDateFormat ).arg( exampleDate.toString( fullDateFormat ) ); uiText.replace( "AP", "AM/PM" ); options.push_back( caf::PdmOptionItemInfo( uiText, QVariant::fromValue( dateFormat ) ) ); @@ -378,7 +380,7 @@ QList QString timeFormatString = RiaQDateTimeTools::timeFormatString( timeFormat, timeComponents( - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ) ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ) ); QString uiText = QString( "%1 (%2)" ).arg( timeFormatString ).arg( exampleTime.toString( timeFormatString ) ); uiText.replace( "AP", "AM/PM" ); options.push_back( caf::PdmOptionItemInfo( uiText, QVariant::fromValue( timeFormat ) ) ); @@ -474,12 +476,11 @@ double RimSummaryTimeAxisProperties::fromDaysToDisplayUnitScale() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaQDateTimeTools::DateFormatComponents - RimSummaryTimeAxisProperties::dateComponents( RiaQDateTimeTools::DateFormatComponents fallback ) const +RiaDefines::DateFormatComponents RimSummaryTimeAxisProperties::dateComponents( RiaDefines::DateFormatComponents fallback ) const { if ( m_automaticDateComponents() ) return fallback; - RiaQDateTimeTools::DateFormatComponents components = m_dateComponents(); + RiaDefines::DateFormatComponents components = m_dateComponents(); return components; } @@ -487,12 +488,11 @@ RiaQDateTimeTools::DateFormatComponents //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaQDateTimeTools::TimeFormatComponents - RimSummaryTimeAxisProperties::timeComponents( RiaQDateTimeTools::TimeFormatComponents fallback ) const +RiaDefines::TimeFormatComponents RimSummaryTimeAxisProperties::timeComponents( RiaDefines::TimeFormatComponents fallback ) const { if ( m_automaticDateComponents() ) return fallback; - RiaQDateTimeTools::TimeFormatComponents components = m_timeComponents(); + RiaDefines::TimeFormatComponents components = m_timeComponents(); return components; } @@ -578,11 +578,11 @@ void RimSummaryTimeAxisProperties::defineUiOrdering( QString uiConfigName, caf:: { caf::PdmUiGroup* advancedGroup = timeGroup->addNewGroup( "Date/Time Label Format" ); advancedGroup->setCollapsedByDefault( true ); - if ( m_automaticDateComponents() || m_dateComponents() != RiaQDateTimeTools::DATE_FORMAT_NONE ) + if ( m_automaticDateComponents() || m_dateComponents() != RiaDefines::DateFormatComponents::DATE_FORMAT_NONE ) { advancedGroup->add( &m_dateFormat ); } - if ( m_automaticDateComponents() || m_timeComponents() != RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_NONE ) + if ( m_automaticDateComponents() || m_timeComponents() != RiaDefines::TimeFormatComponents::TIME_FORMAT_NONE ) { advancedGroup->add( &m_timeFormat ); } @@ -684,7 +684,8 @@ void RimSummaryTimeAxisProperties::defineEditorAttribute( const caf::PdmFieldHan if ( dateAttrib ) { dateAttrib->dateFormat = - RiaQDateTimeTools::dateFormatString( m_dateFormat(), RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + RiaQDateTimeTools::dateFormatString( m_dateFormat(), + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); } } else if ( field == &m_visibleTimeRangeMin || field == &m_visibleTimeRangeMax ) @@ -694,7 +695,7 @@ void RimSummaryTimeAxisProperties::defineEditorAttribute( const caf::PdmFieldHan { timeAttrib->timeFormat = RiaQDateTimeTools::timeFormatString( m_timeFormat(), - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h index 02336e1d4f..699ef2f1c5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h @@ -18,7 +18,7 @@ #pragma once -#include "RiaQDateTimeTools.h" +#include "RiaDateTimeDefines.h" #include "RimPlotAxisPropertiesInterface.h" #include "RimTimeAxisAnnotation.h" @@ -57,8 +57,8 @@ class RimSummaryTimeAxisProperties : public RimPlotAxisPropertiesInterface YEARS }; - typedef caf::AppEnum DateFormatEnum; - typedef caf::AppEnum TimeFormatEnum; + typedef caf::AppEnum DateFormatEnum; + typedef caf::AppEnum TimeFormatEnum; public: RimSummaryTimeAxisProperties(); @@ -75,11 +75,10 @@ class RimSummaryTimeAxisProperties : public RimPlotAxisPropertiesInterface double fromTimeTToDisplayUnitScale(); double fromDaysToDisplayUnitScale(); - RiaQDateTimeTools::DateFormatComponents - dateComponents( RiaQDateTimeTools::DateFormatComponents fallback = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED ) const; - RiaQDateTimeTools::TimeFormatComponents - timeComponents( RiaQDateTimeTools::TimeFormatComponents fallback = - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) const; + RiaDefines::DateFormatComponents dateComponents( + RiaDefines::DateFormatComponents fallback = RiaDefines::DateFormatComponents::DATE_FORMAT_UNSPECIFIED ) const; + RiaDefines::TimeFormatComponents timeComponents( + RiaDefines::TimeFormatComponents fallback = RiaDefines::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) const; std::vector annotations() const override; void appendAnnotation( RimPlotAxisAnnotation* annotation ) override; diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp index d772a811c8..616dcdf3b5 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryCase.cpp @@ -220,10 +220,10 @@ caf::PdmObjectHandle* RimSummaryCase_resampleValues::execute() const auto& timeValues = sumReader->timeSteps( adr ); - QString periodString = m_resamplingPeriod().trimmed(); - RiaQDateTimeTools::DateTimePeriod period = RiaQDateTimeTools::DateTimePeriodEnum::fromText( periodString ); + QString periodString = m_resamplingPeriod().trimmed(); + RiaDefines::DateTimePeriod period = RiaDefines::DateTimePeriodEnum::fromText( periodString ); - if ( period != RiaQDateTimeTools::DateTimePeriod::NONE ) + if ( period != RiaDefines::DateTimePeriod::NONE ) { auto [resampledTimeSteps, resampledValues] = RiaSummaryTools::resampledValuesForPeriod( adr, timeValues, values, period ); diff --git a/ApplicationLibCode/UnitTests/RiaTimeHistoryCurveTools-Test.cpp b/ApplicationLibCode/UnitTests/RiaTimeHistoryCurveTools-Test.cpp index fcabcb6677..4826dfb52f 100644 --- a/ApplicationLibCode/UnitTests/RiaTimeHistoryCurveTools-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiaTimeHistoryCurveTools-Test.cpp @@ -35,7 +35,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_Resampling_NoPeriod ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 1, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2018-03-01" ), resampler.resampledTimeSteps()[0] ); @@ -52,7 +52,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_Resampling_Decade ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::DECADE ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::DECADE ); EXPECT_EQ( 4, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "1990-01-01" ), resampler.resampledTimeSteps()[0] ); @@ -72,7 +72,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_Resampling_Year ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::YEAR ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::YEAR ); EXPECT_EQ( 5, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2015-01-01" ), resampler.resampledTimeSteps()[0] ); @@ -93,7 +93,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_Resampling_HalfYear ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::HALFYEAR ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::HALFYEAR ); EXPECT_EQ( 5, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2016-07-01" ), resampler.resampledTimeSteps()[0] ); @@ -114,7 +114,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_Resampling_Quarter ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::QUARTER ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::QUARTER ); EXPECT_EQ( 7, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2016-10-01" ), resampler.resampledTimeSteps()[0] ); @@ -137,7 +137,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_Resampling_Month ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 6, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2017-10-01" ), resampler.resampledTimeSteps()[0] ); @@ -159,7 +159,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_Resampling_Week ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::WEEK ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::WEEK ); EXPECT_EQ( 10, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2017-11-06" ), resampler.resampledTimeSteps()[0] ); @@ -185,7 +185,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_Resampling_NoSampleCrossingPeriodBounda RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::YEAR ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::YEAR ); EXPECT_EQ( 1, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2018-01-01" ), resampler.resampledTimeSteps()[0] ); @@ -202,7 +202,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_SingleSample ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 1, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2018-03-01" ), resampler.resampledTimeSteps()[0] ); @@ -222,7 +222,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_Days ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::DAY ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::DAY ); EXPECT_EQ( 5, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2018-02-03" ), resampler.resampledTimeSteps()[0] ); @@ -256,7 +256,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_Decade ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::DECADE ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::DECADE ); EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] ); @@ -287,7 +287,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_SamplesStartBeforePeriod ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] ); @@ -320,7 +320,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_SamplesStartBeforePeriod_T RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] ); @@ -349,7 +349,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_SamplesStartAndEndMatchPer RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 2, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2018-02-01" ), resampler.resampledTimeSteps().front() ); @@ -379,7 +379,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_SamplesStartMatchPeriodSta RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] ); @@ -409,7 +409,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_WeightedMean_MultipleSamplesInLastPerio RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputeWeightedMeanValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputeWeightedMeanValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 2, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] ); @@ -433,7 +433,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_PeriodEndValues_SingleSample ) RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputePeriodEndValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputePeriodEndValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 1, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2018-03-01" ), resampler.resampledTimeSteps()[0] ); @@ -459,7 +459,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_PeriodEndValues_SamplesStartBeforePerio RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputePeriodEndValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputePeriodEndValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( tp0, resampler.resampledTimeSteps()[0] ); @@ -486,7 +486,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_PeriodEndValues_SamplesStartMatchPeriod RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputePeriodEndValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputePeriodEndValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 3, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2018-02-01" ), resampler.resampledTimeSteps()[0] ); @@ -509,7 +509,7 @@ TEST( RiaTimeHistoryCurveResampler, Test_PeriodEndValues_SamplesStartAndEndMatch RiaTimeHistoryCurveResampler resampler; resampler.setCurveData( dataValues, toSecsSinceEpochVector( timeStrings ) ); - resampler.resampleAndComputePeriodEndValues( RiaQDateTimeTools::DateTimePeriod::MONTH ); + resampler.resampleAndComputePeriodEndValues( RiaDefines::DateTimePeriod::MONTH ); EXPECT_EQ( 2, (int)resampler.resampledTimeSteps().size() ); EXPECT_EQ( toSecsSinceEpoch( "2018-02-01" ), resampler.resampledTimeSteps().front() ); diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp index bb64a0e03b..a129a30b56 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.cpp @@ -15,13 +15,15 @@ // for more details. // ///////////////////////////////////////////////////////////////////////////////// -#include "RiuQtChartsPlotTools.h" -#include "RiaPlotDefines.h" -#include "RiuGuiTheme.h" +#include "RiuQtChartsPlotTools.h" #include "RiaApplication.h" +#include "RiaPlotDefines.h" #include "RiaPreferences.h" +#include "RiaQDateTimeTools.h" + +#include "RiuGuiTheme.h" #include "RiuQtChartsPlotWidget.h" //-------------------------------------------------------------------------------------------------- @@ -72,11 +74,11 @@ void RiuQtChartsPlotTools::setDefaultAxes( RiuQtChartsPlotWidget* plot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotTools::enableDateBasedBottomXAxis( RiuQtChartsPlotWidget* plot, - const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ) +void RiuQtChartsPlotTools::enableDateBasedBottomXAxis( RiuQtChartsPlotWidget* plot, + const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ) { QString format = dateTimeFormatForInterval( dateFormat, timeFormat, dateComponents, timeComponents ); plot->setAxisFormat( RiuPlotAxis::defaultBottom(), format ); @@ -85,21 +87,19 @@ void RiuQtChartsPlotTools::enableDateBasedBottomXAxis( RiuQtChartsPlotWidget* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiuQtChartsPlotTools::dateTimeFormatForInterval( const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ) +QString RiuQtChartsPlotTools::dateTimeFormatForInterval( const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ) { - if ( dateComponents != RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED && - timeComponents != RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) + if ( dateComponents != RiaDefines::DateFormatComponents::DATE_FORMAT_UNSPECIFIED && + timeComponents != RiaDefines::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) { return RiaQDateTimeTools::timeFormatString( timeFormat, timeComponents ) + "\n" + RiaQDateTimeTools::dateFormatString( dateFormat, dateComponents ); } // Default: - return RiaQDateTimeTools::timeFormatString( timeFormat, RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_NONE ) + - "\n" + - RiaQDateTimeTools::dateFormatString( dateFormat, - RiaQDateTimeTools::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); + return RiaQDateTimeTools::timeFormatString( timeFormat, RiaDefines::TimeFormatComponents::TIME_FORMAT_NONE ) + "\n" + + RiaQDateTimeTools::dateFormatString( dateFormat, RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.h index e809ad2de4..58a7744c9b 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotTools.h @@ -17,7 +17,7 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once -#include "RiaQDateTimeTools.h" +#include "RiaDateTimeDefines.h" class RiuQtChartsPlotWidget; @@ -27,14 +27,14 @@ class RiuQtChartsPlotTools static void setCommonPlotBehaviour( RiuQtChartsPlotWidget* plot ); static void setDefaultAxes( RiuQtChartsPlotWidget* plot ); static void enableDateBasedBottomXAxis( - RiuQtChartsPlotWidget* plot, - const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED, - RiaQDateTimeTools::TimeFormatComponents timeComponents = RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ); + RiuQtChartsPlotWidget* plot, + const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents = RiaDefines::DateFormatComponents::DATE_FORMAT_UNSPECIFIED, + RiaDefines::TimeFormatComponents timeComponents = RiaDefines::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ); - static QString dateTimeFormatForInterval( const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ); + static QString dateTimeFormatForInterval( const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ); }; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index bccc6a72eb..bcc535f08f 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -660,10 +660,10 @@ void RiuQtChartsPlotWidget::updateZoomDependentCurveProperties() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQtChartsPlotWidget::setFormatStrings( const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ) +void RiuQtChartsPlotWidget::setFormatStrings( const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ) { m_dateScaleWrapper->setFormatStrings( dateFormat, timeFormat, dateComponents, timeComponents ); } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index 7c654f288c..c67ee6f70d 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -19,9 +19,9 @@ #pragma once +#include "RiaDateTimeDefines.h" #include "RiaDefines.h" #include "RiaPlotDefines.h" -#include "RiaQDateTimeTools.h" #include "RiuPlotWidget.h" @@ -183,10 +183,10 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget void updateZoomDependentCurveProperties() override; - void setFormatStrings( const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ); + void setFormatStrings( const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ); protected: void attachSeriesToAxis( RiuPlotAxis axis, QtCharts::QAbstractSeries* series, RiuQtChartsPlotCurve* plotCurve ); diff --git a/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp b/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp index e9d12148d2..a1432d74db 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp @@ -33,10 +33,10 @@ RiuQwtDateScaleWrapper::RiuQwtDateScaleWrapper() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtDateScaleWrapper::setFormatStrings( const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ) +void RiuQwtDateScaleWrapper::setFormatStrings( const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ) { std::set intervals = { QwtDate::Year, QwtDate::Month, diff --git a/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.h b/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.h index dbdf506ae5..ee37ecd6d1 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.h +++ b/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.h @@ -27,10 +27,10 @@ class RiuQwtDateScaleWrapper public: RiuQwtDateScaleWrapper(); - void setFormatStrings( const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ); + void setFormatStrings( const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ); void setMaxMajorTicks( int tickCount ); QString formatStringForRange( const QDateTime& min, const QDateTime& max ); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp index d997d2838b..0a1e0489a9 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp @@ -21,6 +21,7 @@ #include "RiaApplication.h" #include "RiaPreferences.h" +#include "RiaQDateTimeTools.h" #include "qwt_date_scale_draw.h" #include "qwt_date_scale_engine.h" @@ -126,11 +127,11 @@ void RiuQwtPlotTools::setDefaultAxes( QwtPlot* plot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotTools::enableDateBasedBottomXAxis( QwtPlot* plot, - const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ) +void RiuQwtPlotTools::enableDateBasedBottomXAxis( QwtPlot* plot, + const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ) { QwtDateScaleDraw* scaleDraw = new QwtDateScaleDraw( Qt::UTC ); @@ -157,14 +158,14 @@ void RiuQwtPlotTools::enableDateBasedBottomXAxis( QwtPlot* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiuQwtPlotTools::dateTimeFormatForInterval( QwtDate::IntervalType interval, - const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ) +QString RiuQwtPlotTools::dateTimeFormatForInterval( QwtDate::IntervalType interval, + const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ) { - if ( dateComponents != RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED && - timeComponents != RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) + if ( dateComponents != RiaDefines::DateFormatComponents::DATE_FORMAT_UNSPECIFIED && + timeComponents != RiaDefines::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) { return RiaQDateTimeTools::timeFormatString( timeFormat, timeComponents ) + "\n" + RiaQDateTimeTools::dateFormatString( dateFormat, dateComponents ); @@ -175,44 +176,49 @@ QString RiuQwtPlotTools::dateTimeFormatForInterval( QwtDate::IntervalType { case QwtDate::Millisecond: return RiaQDateTimeTools::timeFormatString( timeFormat, - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND_MILLISECOND ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND_MILLISECOND ); case QwtDate::Second: return RiaQDateTimeTools::timeFormatString( timeFormat, - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ); case QwtDate::Minute: { QString fullFormat = RiaQDateTimeTools::timeFormatString( timeFormat, - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); + RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE ); fullFormat += "\n"; fullFormat += - RiaQDateTimeTools::dateFormatString( dateFormat, RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + RiaQDateTimeTools::dateFormatString( dateFormat, + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); return fullFormat; } case QwtDate::Hour: { QString fullFormat = - RiaQDateTimeTools::timeFormatString( timeFormat, - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_HOUR ); + RiaQDateTimeTools::timeFormatString( timeFormat, RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR ); if ( !fullFormat.endsWith( "AP" ) ) { fullFormat += ":00"; } fullFormat += "\n"; fullFormat += - RiaQDateTimeTools::dateFormatString( dateFormat, RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + RiaQDateTimeTools::dateFormatString( dateFormat, + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); return fullFormat; } case QwtDate::Day: - return RiaQDateTimeTools::dateFormatString( dateFormat, RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + return RiaQDateTimeTools::dateFormatString( dateFormat, + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); case QwtDate::Week: - return RiaQDateTimeTools::dateFormatString( dateFormat, RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH ); + return RiaQDateTimeTools::dateFormatString( dateFormat, + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH ); case QwtDate::Month: - return RiaQDateTimeTools::dateFormatString( dateFormat, RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH ); + return RiaQDateTimeTools::dateFormatString( dateFormat, + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH ); case QwtDate::Year: - return RiaQDateTimeTools::dateFormatString( dateFormat, RiaQDateTimeTools::DATE_FORMAT_YEAR ); + return RiaQDateTimeTools::dateFormatString( dateFormat, RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR ); default: - return RiaQDateTimeTools::dateFormatString( dateFormat, RiaQDateTimeTools::DATE_FORMAT_YEAR_MONTH_DAY ); + return RiaQDateTimeTools::dateFormatString( dateFormat, + RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY ); } } } diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h index 2d2cbed420..e567f9acae 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h @@ -17,8 +17,9 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include "RiaDateTimeDefines.h" #include "RiaPlotDefines.h" -#include "RiaQDateTimeTools.h" + #include #include #include @@ -29,17 +30,17 @@ class RiuQwtPlotTools static void setCommonPlotBehaviour( QwtPlot* plot ); static void setDefaultAxes( QwtPlot* plot ); static void enableDateBasedBottomXAxis( - QwtPlot* plot, - const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED, - RiaQDateTimeTools::TimeFormatComponents timeComponents = RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ); + QwtPlot* plot, + const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents = RiaDefines::DateFormatComponents::DATE_FORMAT_UNSPECIFIED, + RiaDefines::TimeFormatComponents timeComponents = RiaDefines::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ); - static QString dateTimeFormatForInterval( QwtDate::IntervalType interval, - const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ); + static QString dateTimeFormatForInterval( QwtDate::IntervalType interval, + const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ); static QwtPlotShapeItem* createBoxShape( const QString& label, double startX, diff --git a/ApplicationLibCode/UserInterface/RiuSummaryPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryPlot.h index 791c07aa96..87fd5cca17 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryPlot.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryPlot.h @@ -18,7 +18,7 @@ #pragma once -#include "RiaQDateTimeTools.h" +#include "RiaDateTimeDefines.h" #include #include @@ -40,11 +40,10 @@ class RiuSummaryPlot : public QObject ~RiuSummaryPlot() override; virtual void useDateBasedTimeAxis( - const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED, - RiaQDateTimeTools::TimeFormatComponents timeComponents = - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) = 0; + const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents = RiaDefines::DateFormatComponents::DATE_FORMAT_UNSPECIFIED, + RiaDefines::TimeFormatComponents timeComponents = RiaDefines::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) = 0; virtual void useTimeBasedTimeAxis() = 0; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp index 3c49d08f2d..9fc1356f97 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp @@ -56,10 +56,10 @@ RiuSummaryQtChartsPlot::~RiuSummaryQtChartsPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuSummaryQtChartsPlot::useDateBasedTimeAxis( const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ) +void RiuSummaryQtChartsPlot::useDateBasedTimeAxis( const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ) { m_plotWidget->setAxisScaleType( RiuPlotAxis::defaultBottom(), RiuPlotWidget::AxisScaleType::DATE ); m_plotWidget->setFormatStrings( dateFormat, timeFormat, dateComponents, timeComponents ); diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h index 80dd2ea8fe..eda7e71429 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h @@ -18,7 +18,7 @@ #pragma once -#include "RiaQDateTimeTools.h" +#include "RiaDateTimeDefines.h" #include "RiuQtChartsPlotWidget.h" #include "RiuSummaryPlot.h" @@ -41,11 +41,11 @@ class RiuSummaryQtChartsPlot : public RiuSummaryPlot RiuSummaryQtChartsPlot( RimSummaryPlot* plot ); ~RiuSummaryQtChartsPlot() override; - void useDateBasedTimeAxis( const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED, - RiaQDateTimeTools::TimeFormatComponents timeComponents = - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) override; + void useDateBasedTimeAxis( + const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents = RiaDefines::DateFormatComponents::DATE_FORMAT_UNSPECIFIED, + RiaDefines::TimeFormatComponents timeComponents = RiaDefines::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) override; void useTimeBasedTimeAxis() override; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp index d7d8c9e94b..1b8932f168 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -145,10 +145,10 @@ RiuSummaryQwtPlot::~RiuSummaryQwtPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuSummaryQwtPlot::useDateBasedTimeAxis( const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents, - RiaQDateTimeTools::TimeFormatComponents timeComponents ) +void RiuSummaryQwtPlot::useDateBasedTimeAxis( const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents, + RiaDefines::TimeFormatComponents timeComponents ) { RiuQwtPlotTools::enableDateBasedBottomXAxis( m_plotWidget->qwtPlot(), dateFormat, timeFormat, dateComponents, timeComponents ); } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h index 1e1a909005..a5ff1f4ad7 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.h @@ -18,7 +18,7 @@ #pragma once -#include "RiaQDateTimeTools.h" +#include "RiaDateTimeDefines.h" #include "RiuInterfaceToViewWindow.h" #include "RiuQwtPlotWidget.h" @@ -47,11 +47,11 @@ class RiuSummaryQwtPlot : public RiuSummaryPlot RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent = nullptr ); ~RiuSummaryQwtPlot() override; - void useDateBasedTimeAxis( const QString& dateFormat, - const QString& timeFormat, - RiaQDateTimeTools::DateFormatComponents dateComponents = RiaQDateTimeTools::DATE_FORMAT_UNSPECIFIED, - RiaQDateTimeTools::TimeFormatComponents timeComponents = - RiaQDateTimeTools::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) override; + void useDateBasedTimeAxis( + const QString& dateFormat, + const QString& timeFormat, + RiaDefines::DateFormatComponents dateComponents = RiaDefines::DateFormatComponents::DATE_FORMAT_UNSPECIFIED, + RiaDefines::TimeFormatComponents timeComponents = RiaDefines::TimeFormatComponents::TIME_FORMAT_UNSPECIFIED ) override; void useTimeBasedTimeAxis() override; diff --git a/ApplicationLibCode/UserInterface/RiuTextDialog.h b/ApplicationLibCode/UserInterface/RiuTextDialog.h index a57c39eb46..453990de54 100644 --- a/ApplicationLibCode/UserInterface/RiuTextDialog.h +++ b/ApplicationLibCode/UserInterface/RiuTextDialog.h @@ -18,8 +18,6 @@ #pragma once -#include "RiaQDateTimeTools.h" - #include #include #include From 20ec6e20f2fec8ade45d2e515d406481b44c27b6 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 14 Mar 2022 14:58:30 +0100 Subject: [PATCH 185/406] Summary Plot: fix axis logic for left axis --- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 9fed24ab17..4a7f076e61 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -862,8 +862,9 @@ void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis ) plotWidget()->setAxisScale( yAxisProps->plotAxisType(), min, max ); } - else if ( plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || - plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT && isOnlyWaterCutCurvesVisible( plotAxis ) ) + else if ( ( plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || + plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) && + isOnlyWaterCutCurvesVisible( plotAxis ) ) { plotWidget()->setAxisScale( yAxisProps->plotAxisType(), 0.0, 1.0 ); } From b98bd579d7ad7eaec281c4f516987af411b05aa1 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 15 Mar 2022 08:27:07 +0100 Subject: [PATCH 186/406] Janitor: Silence deprecation warnings for Qwt and nightcharts --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76534ca226..e2aff03d9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -440,6 +440,8 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") target_compile_options(qwt PRIVATE -Wno-deprecated-copy) elseif(MSVC) target_compile_options(qwt PRIVATE /wd4996 /wd4005) +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(qwt PRIVATE -Wno-deprecated) endif() if(RESINSIGHT_ENABLE_UNITY_BUILD) @@ -460,6 +462,8 @@ list(APPEND THIRD_PARTY_LIBRARIES qwt) add_subdirectory(ThirdParty/nightcharts) if(MSVC) target_compile_options(nightcharts PRIVATE /wd4996) +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_compile_options(nightcharts PRIVATE -Wno-deprecated) endif() list(APPEND THIRD_PARTY_LIBRARIES nightcharts) From 72ff44071d04beddb8c5985f4d37d2df4198d035 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 15 Mar 2022 15:32:48 +0100 Subject: [PATCH 187/406] Merge pull request #8691 from OPM/platform-offscreen Add example for headless plot export using Python Fix childPtrArray issue --- .../PythonExamples/headless_plot_export.py | 35 +++++++++++++++++++ GrpcInterface/RiaGrpcServiceInterface.cpp | 8 +++-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 GrpcInterface/Python/rips/PythonExamples/headless_plot_export.py diff --git a/GrpcInterface/Python/rips/PythonExamples/headless_plot_export.py b/GrpcInterface/Python/rips/PythonExamples/headless_plot_export.py new file mode 100644 index 0000000000..af5c527bdc --- /dev/null +++ b/GrpcInterface/Python/rips/PythonExamples/headless_plot_export.py @@ -0,0 +1,35 @@ +import sys +import os + +import rips + +use_platform_offscreen = True +if use_platform_offscreen: + # To use offscreen, the path to fonts must be specified in the environment variable QT_QPA_FONTDIR="C:/windows/fonts" + resinsight = rips.Instance.launch( + command_line_parameters=["-platform offscreen", "--size", 1200, 1000] + ) + + qpa_fontdir = os.environ["QT_QPA_FONTDIR"] + print("Environment var QT_QPA_FONTDIR : " + qpa_fontdir) +else: + resinsight = rips.Instance.find() + +summary_filename = "NORNE.SMSPEC" + +project = resinsight.project +summary_case = project.import_summary_case(summary_filename) + +summary_plot_collection = project.descendants(rips.SummaryPlotCollection)[0] + +summary_plot_collection.new_summary_plot(summary_cases=[summary_case], address="FOPR") +summary_plot_collection.new_summary_plot( + summary_cases=[summary_case], address="WOPR:A*;WOPR:B*" +) + +plots = resinsight.project.plots() +for plot in plots: + plot.export_snapshot() + # plot.export_snapshot(output_format="PDF") + +resinsight.exit() diff --git a/GrpcInterface/RiaGrpcServiceInterface.cpp b/GrpcInterface/RiaGrpcServiceInterface.cpp index 896b66821d..308a5cd761 100644 --- a/GrpcInterface/RiaGrpcServiceInterface.cpp +++ b/GrpcInterface/RiaGrpcServiceInterface.cpp @@ -181,9 +181,13 @@ void RiaGrpcServiceInterface::copyPdmObjectFromRipsToCaf( const rips::PdmObject* auto scriptability = field->template capability(); if ( scriptability ) { - if ( !dynamic_cast( field ) ) + bool isPdmPtrArrayField = ( dynamic_cast( field ) && + !dynamic_cast( field ) ); + + if ( !isPdmPtrArrayField && !dynamic_cast( field ) ) { - // Recursive object update is not supported + // Update of child objects and child object arrays are not supported + // Update of PdmPtrArrayField is supported, used by RimcSummaryPlotCollection_newSummaryPlot // https://github.com/OPM/ResInsight/issues/7794 continue; } From 75a3d3d8f106c5dfe80f247fdc959c3835867dd2 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Tue, 15 Mar 2022 15:57:15 +0100 Subject: [PATCH 188/406] Summary Multiplot: drag/drop updates (#8692) Drag'n'drop improvements - accept drops in empty multiplot areas to create new plots --- .../ProjectDataModel/RimMultiPlot.cpp | 24 -------- .../ProjectDataModel/RimMultiPlot.h | 1 - .../Summary/RimSummaryMultiPlot.cpp | 36 ++++++++++- .../Summary/RimSummaryMultiPlot.h | 4 ++ .../Summary/RimSummaryPlot.cpp | 53 +++++++++------- .../ProjectDataModel/Summary/RimSummaryPlot.h | 7 ++- .../UserInterface/RiuDragDrop.cpp | 60 +++++++++++++++++++ .../UserInterface/RiuDragDrop.h | 3 + .../UserInterface/RiuMultiPlotBook.cpp | 44 ++++++++++++-- .../UserInterface/RiuMultiPlotBook.h | 6 +- .../UserInterface/RiuMultiPlotPage.cpp | 1 + .../UserInterface/RiuPlotWidget.cpp | 51 +--------------- 12 files changed, 189 insertions(+), 101 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index f22ee46235..1ed97138e3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -260,30 +260,6 @@ void RimMultiPlot::movePlotsToThis( const std::vector& plotsToMove, in this->updateAllRequiredEditors(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimMultiPlot::insertPlots( const std::vector& plots ) -{ - for ( auto plot : plots ) - { - if ( plot ) - { - setTickmarkCount( plot, m_majorTickmarkCount() ); - m_plots.insert( -1, plot ); - - if ( m_viewer ) - { - plot->createPlotWidget(); - m_viewer->insertPlot( plot->plotWidget(), -1 ); - } - plot->setShowWindow( true ); - plot->updateAfterInsertingIntoMultiPlot(); - } - } - onPlotAdditionOrRemoval(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 8a0be401de..7107db02ae 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -77,7 +77,6 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection& plots, int insertAtPosition ); - void insertPlots( const std::vector& plots ); void deleteAllPlots() override; size_t plotCount() const override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index adf6bfeebc..a654ee9f14 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -92,7 +92,10 @@ void RimSummaryMultiPlot::addPlot( RimPlot* plot ) { RimSummaryPlot* sumPlot = dynamic_cast( plot ); CVF_ASSERT( sumPlot != nullptr ); - if ( sumPlot ) RimMultiPlot::addPlot( plot ); + if ( sumPlot ) + { + RimMultiPlot::addPlot( plot ); + } } //-------------------------------------------------------------------------------------------------- @@ -102,7 +105,36 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) { RimSummaryPlot* sumPlot = dynamic_cast( plot ); CVF_ASSERT( sumPlot != nullptr ); - if ( sumPlot ) RimMultiPlot::insertPlot( plot, index ); + if ( sumPlot ) + { + RimMultiPlot::insertPlot( plot, index ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::addPlot( const std::vector& objects ) +{ + RimSummaryPlot* plot = new RimSummaryPlot(); + plot->enableAutoPlotTitle( true ); + + addPlot( plot ); + + plot->handleDroppedObjects( objects ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::removePlot( RimPlot* plot ) +{ + RimSummaryPlot* sumPlot = dynamic_cast( plot ); + CVF_ASSERT( sumPlot != nullptr ); + if ( sumPlot ) + { + RimMultiPlot::removePlot( plot ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 5c89288ea6..a09702c4d9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -24,6 +24,7 @@ #include "cafPdmChildField.h" #include "cafPdmObject.h" #include "cafPdmPtrArrayField.h" +#include "cafSignal.h" #include @@ -56,11 +57,14 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void addPlot( RimPlot* plot ) override; void insertPlot( RimPlot* plot, size_t index ) override; + void removePlot( RimPlot* plot ) override; std::vector fieldsToShowInToolbar(); void syncAxisRanges(); + void addPlot( const std::vector& objects ); + protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 4a7f076e61..50cc8ab6be 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -94,7 +94,8 @@ CAF_PDM_SOURCE_INIT( RimSummaryPlot, "SummaryPlot" ); /// //-------------------------------------------------------------------------------------------------- RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) - : m_isCrossPlot( isCrossPlot ) + : RimPlot() + , m_isCrossPlot( isCrossPlot ) { CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" ); @@ -1972,6 +1973,34 @@ int RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* ad return newCurves; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimSummaryPlot::handleSummaryAddressDrop( RimSummaryAddress* summaryAddr ) +{ + int newCurves = 0; + + if ( summaryAddr->isEnsemble() ) + { + auto ensemble = RiaSummaryTools::ensembleById( summaryAddr->ensembleId() ); + if ( ensemble ) + { + addNewEnsembleCurveY( summaryAddr->address(), ensemble ); + newCurves++; + } + } + else + { + auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAddr->caseId() ); + if ( summaryCase ) + { + addNewCurveY( summaryAddr->address(), summaryCase ); + newCurves++; + } + } + return newCurves; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1988,26 +2017,10 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector( obj ); - if ( summaryAdr ) + auto summaryAddr = dynamic_cast( obj ); + if ( summaryAddr ) { - if ( summaryAdr->isEnsemble() ) - { - auto ensemble = RiaSummaryTools::ensembleById( summaryAdr->ensembleId() ); - if ( ensemble ) - { - addNewEnsembleCurveY( summaryAdr->address(), ensemble ); - newCurves++; - } - continue; - } - - auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAdr->caseId() ); - if ( summaryCase ) - { - addNewCurveY( summaryAdr->address(), summaryCase ); - newCurves++; - } + newCurves += handleSummaryAddressDrop( summaryAddr ); continue; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 39217afb34..f5bd50ffd1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -30,6 +30,7 @@ #include "RiuSummaryPlot.h" #include "cafPdmChildArrayField.h" +#include "cafPdmObjectHandle.h" #include "cafPdmPtrArrayField.h" #include "cafPdmPtrField.h" @@ -37,10 +38,12 @@ #include #include +#include class PdmUiTreeOrdering; class RimAsciiDataCurve; class RimGridTimeHistoryCurve; +class RimSummaryAddress; class RimSummaryAddressCollection; class RimSummaryCase; class RimSummaryCaseCollection; @@ -199,6 +202,8 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping bool isDeletable() const override; + void handleDroppedObjects( const std::vector& objects ) override; + private: RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; @@ -226,7 +231,6 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void onLoadDataAndUpdate() override; - void handleDroppedObjects( const std::vector& objects ) override; QImage snapshotWindowContent() override; @@ -278,6 +282,7 @@ private slots: int handleSummaryCaseDrop( RimSummaryCase* summaryCase ); int handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl ); + int handleSummaryAddressDrop( RimSummaryAddress* summaryAddr ); bool isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis ); diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index 3ce3db5d58..2db478ede0 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -33,6 +33,7 @@ #include "RimMimeData.h" #include "RimMultiPlot.h" #include "RimPlot.h" +#include "RimProject.h" #include "RimSummaryAddress.h" #include "RimSummaryAddressCollection.h" #include "RimSummaryCase.h" @@ -57,6 +58,8 @@ #include "cafSelectionManager.h" #include +#include +#include #include //-------------------------------------------------------------------------------------------------- @@ -764,3 +767,60 @@ bool RiuDragDrop::handleSurfaceCollectionDrop( Qt::DropAction action, return true; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiuDragDrop::handleGenericDropEvent( QEvent* event, std::vector& droppedObjects ) +{ + if ( !event ) return false; + + const MimeDataWithIndexes* mimeData = nullptr; + Qt::KeyboardModifiers keyModifiers; + + if ( event->type() == QEvent::Drop ) + { + // These drop events come from Qwt + auto dropEvent = static_cast( event ); + if ( dropEvent ) + { + mimeData = qobject_cast( dropEvent->mimeData() ); + keyModifiers = dropEvent->keyboardModifiers(); + + dropEvent->acceptProposedAction(); + } + } + else if ( event->type() == QEvent::GraphicsSceneDrop ) + { + // These drop events come from QtChart + auto dropEvent = static_cast( event ); + if ( dropEvent ) + { + mimeData = qobject_cast( dropEvent->mimeData() ); + + dropEvent->acceptProposedAction(); + } + } + + if ( mimeData ) + { + QString mimeType = caf::PdmUiDragDropInterface::mimeTypeForObjectReferenceList(); + + auto data = mimeData->data( mimeType ); + + QStringList objectReferences; + QDataStream in( &data, QIODevice::ReadOnly ); + in >> objectReferences; + + auto proj = RimProject::current(); + for ( const auto& objRef : objectReferences ) + { + auto obj = caf::PdmReferenceHelper::objectFromReference( proj, objRef ); + if ( obj ) droppedObjects.push_back( obj ); + } + + return true; + } + + return false; +} diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.h b/ApplicationLibCode/UserInterface/RiuDragDrop.h index 36a7dd980a..294b3cfd7f 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.h +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.h @@ -40,6 +40,7 @@ class RimSurfaceCollection; class RimWellLogPlot; class RimWellLogTrack; class RimWellLogCurve; +class QEvent; //-------------------------------------------------------------------------------------------------- /// @@ -53,6 +54,8 @@ class RiuDragDrop : public caf::PdmUiDragDropInterface static std::vector draggedObjectsFromTreeView( caf::PdmUiTreeView* dragSource, const QMimeData* data ); + static bool handleGenericDropEvent( QEvent* event, std::vector& droppedObjects ); + protected: Qt::DropActions supportedDropActions() const override; Qt::ItemFlags flags( const QModelIndex& index ) const override; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index fb7d2ac677..84f0cb63e9 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -23,8 +23,10 @@ #include "RimContextCommandBuilder.h" #include "RimMultiPlot.h" +#include "RimSummaryMultiPlot.h" #include "RimWellLogTrack.h" +#include "RiuDragDrop.h" #include "RiuMainWindow.h" #include "RiuMultiPlotPage.h" #include "RiuPlotMainWindow.h" @@ -125,6 +127,7 @@ RiuMultiPlotBook::RiuMultiPlotBook( RimMultiPlot* plotDefinition, QWidget* paren this->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding ); setFocusPolicy( Qt::StrongFocus ); + setAcceptDrops( true ); QSize pageSize = m_plotDefinition->pageLayout().fullRectPixels( RiaGuiApplication::applicationResolution() ).size(); applyPagePreviewBookSize( pageSize.width() ); @@ -590,9 +593,9 @@ void RiuMultiPlotBook::applyLook() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotBook::changeCurrentPage( int pageDiff ) +void RiuMultiPlotBook::changeCurrentPage( int pageNumber ) { - m_currentPageIndex += pageDiff; + m_currentPageIndex = pageNumber; if ( m_currentPageIndex >= (int)m_pages.size() ) m_currentPageIndex = (int)m_pages.size() - 1; if ( m_currentPageIndex < 0 ) m_currentPageIndex = 0; if ( !m_pages.isEmpty() ) m_scrollArea->ensureWidgetVisible( m_pages[m_currentPageIndex] ); @@ -603,7 +606,7 @@ void RiuMultiPlotBook::changeCurrentPage( int pageDiff ) //-------------------------------------------------------------------------------------------------- void RiuMultiPlotBook::goToNextPage() { - changeCurrentPage( 1 ); + changeCurrentPage( m_currentPageIndex + 1 ); } //-------------------------------------------------------------------------------------------------- @@ -611,5 +614,38 @@ void RiuMultiPlotBook::goToNextPage() //-------------------------------------------------------------------------------------------------- void RiuMultiPlotBook::goToPrevPage() { - changeCurrentPage( -1 ); + changeCurrentPage( m_currentPageIndex - 1 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::goToLastPage() +{ + changeCurrentPage( m_pages.size() - 1 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::dragEnterEvent( QDragEnterEvent* event ) +{ + event->acceptProposedAction(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::dropEvent( QDropEvent* event ) +{ + std::vector objects; + + if ( RiuDragDrop::handleGenericDropEvent( event, objects ) ) + { + RimSummaryMultiPlot* multiPlot = dynamic_cast( m_plotDefinition.p() ); + if ( multiPlot ) + { + multiPlot->addPlot( objects ); + } + } } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index ee56dd5e90..ace642a8ec 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -88,6 +88,7 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void goToNextPage(); void goToPrevPage(); + void goToLastPage(); protected: void contextMenuEvent( QContextMenuEvent* ) override; @@ -104,6 +105,9 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow QList> visiblePlotWidgets() const; + void dragEnterEvent( QDragEnterEvent* event ) override; + void dropEvent( QDropEvent* event ) override; + private: void deleteAllPages(); void createPages(); @@ -111,7 +115,7 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow RiuMultiPlotPage* createPage(); void applyLook(); - void changeCurrentPage( int pageDiff ); + void changeCurrentPage( int pageNumber ); private slots: virtual void performUpdate(); diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 130ad7da85..62c7781b0f 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -100,6 +100,7 @@ RiuMultiPlotPage::RiuMultiPlotPage( RimPlotWindow* plotDefinition, QWidget* pare new RiuPlotObjectPicker( m_plotTitle, m_plotDefinition ); setFocusPolicy( Qt::StrongFocus ); + setAcceptDrops( true ); this->setObjectName( QString( "%1" ).arg( reinterpret_cast( this ) ) ); diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp index fff9a32722..1fd7ea5437 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.cpp @@ -244,56 +244,11 @@ bool RiuPlotWidget::handleDragDropEvent( QEvent* event ) } } - const MimeDataWithIndexes* mimeData = nullptr; + std::vector objects; - if ( event->type() == QEvent::Drop ) + if ( RiuDragDrop::handleGenericDropEvent( event, objects ) ) { - // These drop events come from Qwt - auto dropEvent = dynamic_cast( event ); - if ( dropEvent ) - { - mimeData = qobject_cast( dropEvent->mimeData() ); - - dropEvent->acceptProposedAction(); - } - } - - if ( event->type() == QEvent::GraphicsSceneDrop ) - { - // These drop events come from QtChart - auto dropEvent = dynamic_cast( event ); - if ( dropEvent ) - { - mimeData = qobject_cast( dropEvent->mimeData() ); - - dropEvent->acceptProposedAction(); - } - } - - if ( mimeData ) - { - std::vector objects; - - QString mimeType = caf::PdmUiDragDropInterface::mimeTypeForObjectReferenceList(); - - auto data = mimeData->data( mimeType ); - - QStringList objectReferences; - QDataStream in( &data, QIODevice::ReadOnly ); - in >> objectReferences; - - auto proj = RimProject::current(); - for ( const auto& objRef : objectReferences ) - { - auto obj = caf::PdmReferenceHelper::objectFromReference( proj, objRef ); - if ( obj ) objects.push_back( obj ); - } - - if ( m_plotDefinition ) - { - m_plotDefinition->handleDroppedObjects( objects ); - } - + if ( m_plotDefinition ) m_plotDefinition->handleDroppedObjects( objects ); return true; } From ffc84457c61d0ca2379e952c590ed49bf2526319 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Wed, 16 Mar 2022 14:14:14 +0100 Subject: [PATCH 189/406] Summary Multiplot: add button to create plot copy (#8698) * Add button to create a duplicate of the active summary multiplot * Block dropping other things than RimSummaryAddress objects in empty areas --- .../Summary/RimSummaryMultiPlot.cpp | 37 ++++++++++++++++--- .../Summary/RimSummaryMultiPlot.h | 6 +++ .../Summary/RimSummaryMultiPlotCollection.cpp | 36 ++++++++++++++++++ .../Summary/RimSummaryMultiPlotCollection.h | 5 +++ 4 files changed, 79 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index a654ee9f14..a9e69ce8cc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -32,6 +32,7 @@ #include "RimSummaryPlotControls.h" #include "RimMultiPlot.h" +#include "RimSummaryAddress.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotNameHelper.h" #include "RimSummaryPlotSourceStepping.h" @@ -50,6 +51,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); /// //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlot::RimSummaryMultiPlot() + : duplicatePlot( this ) { CAF_PDM_InitObject( "Multi Summary Plot" ); this->setDeletable( true ); @@ -62,6 +64,11 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() m_syncAxisRanges.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_syncAxisRanges.uiCapability()->setUiIconFromResourceString( ":/AxesSync16x16.png" ); + CAF_PDM_InitField( &m_createPlotDuplicate, "DuplicatePlot", false, "", "", "Duplicate Plot" ); + m_createPlotDuplicate.xmlCapability()->disableIO(); + m_createPlotDuplicate.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + m_createPlotDuplicate.uiCapability()->setUiIconFromResourceString( ":/Copy.svg" ); + CAF_PDM_InitField( &m_disableWheelZoom, "DisableWheelZoom", true, "", "", "Disable Mouse Wheel Zooming in Multi Summary Plot" ); m_disableWheelZoom.xmlCapability()->disableIO(); m_disableWheelZoom.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); @@ -116,12 +123,18 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::addPlot( const std::vector& objects ) { - RimSummaryPlot* plot = new RimSummaryPlot(); - plot->enableAutoPlotTitle( true ); + if ( objects.empty() ) return; + + RimSummaryAddress* addr = dynamic_cast( objects[0] ); + if ( addr ) + { + RimSummaryPlot* plot = new RimSummaryPlot(); + plot->enableAutoPlotTitle( true ); - addPlot( plot ); + addPlot( plot ); - plot->handleDroppedObjects( objects ); + plot->handleDroppedObjects( objects ); + } } //-------------------------------------------------------------------------------------------------- @@ -269,8 +282,13 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi } else if ( changedField == &m_syncAxisRanges ) { - syncAxisRanges(); m_syncAxisRanges = false; + syncAxisRanges(); + } + else if ( changedField == &m_createPlotDuplicate ) + { + m_createPlotDuplicate = false; + duplicate(); } else { @@ -429,6 +447,7 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() toolBarFields.push_back( &m_disableWheelZoom ); toolBarFields.push_back( &m_syncAxisRanges ); + toolBarFields.push_back( &m_createPlotDuplicate ); auto& sourceObject = m_sourceStepping(); if ( sourceObject ) @@ -533,3 +552,11 @@ void RimSummaryMultiPlot::syncAxisRanges() plot->updateAxes(); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::duplicate() +{ + duplicatePlot.send( this ); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index a09702c4d9..8f67b5064c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -41,6 +41,9 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep { CAF_PDM_HEADER_INIT; +public: + caf::Signal duplicatePlot; + public: RimSummaryMultiPlot(); ~RimSummaryMultiPlot() override; @@ -83,11 +86,14 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void updatePlotWindowTitle() override; + void duplicate(); + private: caf::PdmField m_autoPlotTitles; caf::PdmField m_autoPlotTitlesOnSubPlots; caf::PdmField m_syncAxisRanges; caf::PdmField m_disableWheelZoom; + caf::PdmField m_createPlotDuplicate; caf::PdmChildField m_sourceStepping; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp index ce87a179a1..427bae37c0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -20,6 +20,8 @@ #include "RimProject.h" #include "RimSummaryMultiPlot.h" +#include "RiuPlotMainWindowTools.h" + #include "cafPdmFieldReorderCapability.h" CAF_PDM_SOURCE_INIT( RimSummaryMultiPlotCollection, "RimSummaryMultiPlotCollection" ); @@ -43,6 +45,17 @@ RimSummaryMultiPlotCollection::~RimSummaryMultiPlotCollection() { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlotCollection::initAfterRead() +{ + for ( auto& plot : m_summaryMultiPlots ) + { + plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -65,6 +78,7 @@ std::vector RimSummaryMultiPlotCollection::multiPlots() co void RimSummaryMultiPlotCollection::addMultiSummaryPlot( RimSummaryMultiPlot* plot ) { m_summaryMultiPlots().push_back( plot ); + plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot ); } //-------------------------------------------------------------------------------------------------- @@ -83,3 +97,25 @@ size_t RimSummaryMultiPlotCollection::plotCount() const { return m_summaryMultiPlots.size(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlotCollection::onDuplicatePlot( const caf::SignalEmitter* emitter, RimSummaryMultiPlot* plotToDuplicate ) +{ + if ( !plotToDuplicate ) return; + + auto plotCopy = dynamic_cast( + plotToDuplicate->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + + addMultiSummaryPlot( plotCopy ); + + plotCopy->resolveReferencesRecursively(); + plotCopy->initAfterReadRecursively(); + plotCopy->updateAllRequiredEditors(); + plotCopy->loadDataAndUpdate(); + + updateConnectedEditors(); + + RiuPlotMainWindowTools::selectAsCurrentItem( plotCopy, true ); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h index 0b8cd4572e..b6e96db115 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h @@ -44,6 +44,11 @@ class RimSummaryMultiPlotCollection : public caf::PdmObject, public RimPlotColle void addMultiSummaryPlot( RimSummaryMultiPlot* plot ); +protected: + void onDuplicatePlot( const caf::SignalEmitter* emitter, RimSummaryMultiPlot* plotToDuplicate ); + + void initAfterRead() override; + private: caf::PdmChildArrayField m_summaryMultiPlots; }; From 8d3f381b4f11e167b8998979944765b25253b83f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 18 Mar 2022 13:16:07 +0100 Subject: [PATCH 190/406] Janitor: Update qwt to 6.2.0 --- .../AnalysisPlots/RimAnalysisPlot.cpp | 1 + .../CorrelationPlots/RimCorrelationPlot.cpp | 1 + .../Summary/RimSummaryPlot.cpp | 1 + .../Summary/RimSummaryPlotAxisFormatter.cpp | 1 + .../WellLog/RimWellLogTrack.cpp | 2 + .../RigWellPathGeometryTools.cpp | 105 +++++++++++++----- .../RigWellPathGeometryTools.h | 19 ++-- .../RiuGroupedBarChartBuilder.cpp | 2 + .../RiuFlowCharacteristicsPlot.cpp | 3 + .../UserInterface/RiuGridCrossQwtPlot.cpp | 2 +- .../UserInterface/RiuMohrsCirclePlot.cpp | 1 + .../UserInterface/RiuMultiPlotBook.cpp | 1 + .../UserInterface/RiuMultiPlotPage.cpp | 1 + .../UserInterface/RiuPlotAnnotationTool.cpp | 1 + .../UserInterface/RiuPlotAnnotationTool.h | 1 + .../UserInterface/RiuPvtPlotPanel.cpp | 1 + .../UserInterface/RiuQwtCurvePointTracker.cpp | 1 + .../UserInterface/RiuQwtDateScaleWrapper.cpp | 2 + .../UserInterface/RiuQwtLinearScaleEngine.cpp | 2 + .../UserInterface/RiuQwtPlotCurve.cpp | 2 + .../UserInterface/RiuQwtPlotItemGroup.cpp | 4 + .../UserInterface/RiuQwtPlotWheelZoomer.cpp | 2 + .../UserInterface/RiuQwtPlotWidget.cpp | 2 + .../UserInterface/RiuQwtScalePicker.cpp | 1 + .../RiuRelativePermeabilityPlotPanel.cpp | 1 + .../UserInterface/RiuSummaryQwtPlot.cpp | 2 +- .../RiuTofAccumulatedPhaseFractionsPlot.cpp | 1 + .../RiuWellPathComponentPlotItem.cpp | 1 + ThirdParty/qwt | 2 +- 29 files changed, 130 insertions(+), 36 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index 0177e0dedf..7f9e6565ff 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -57,6 +57,7 @@ #include "cafPdmUiListEditor.h" #include "cafPdmUiTreeSelectionEditor.h" +#include #include #include diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp index 9d5ad0e1fe..67be2cb914 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp @@ -43,6 +43,7 @@ #include "qwt_plot.h" #include "qwt_plot_barchart.h" +#include "qwt_text.h" #include #include diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 50cc8ab6be..ec02313955 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -76,6 +76,7 @@ #include "qwt_plot.h" #include "qwt_plot_curve.h" #include "qwt_plot_textlabel.h" +#include "qwt_text.h" #include #include diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index 064896664f..e47d63d221 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -39,6 +39,7 @@ #include "qwt_plot.h" #include "qwt_plot_curve.h" #include "qwt_scale_draw.h" +#include "qwt_text.h" #include #include diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 4e149ef509..914dacb13e 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -95,6 +95,8 @@ #include "caf.h" #include "cvfAssert.h" +#include "qwt_scale_map.h" + #include #include diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp index e849e2b0c4..a1ecd0f8b2 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.cpp @@ -24,9 +24,64 @@ #include "cvfMatrix3.h" #include "RiaOffshoreSphericalCoords.h" + +#include "qwt_curve_fitter.h" +#include "qwt_spline.h" +#include "qwt_spline_curve_fitter.h" + #include #include +int RigWellPathGeometryTools::lookup( double x, const QPolygonF& values ) +{ +#if 0 + //qLowerBound/qHigherBound ??? +#endif + int i1; + const int size = values.size(); + + if ( x <= values[0].x() ) + i1 = 0; + else if ( x >= values[size - 2].x() ) + i1 = size - 2; + else + { + i1 = 0; + int i2 = size - 2; + int i3 = 0; + + while ( i2 - i1 > 1 ) + { + i3 = i1 + ( ( i2 - i1 ) >> 1 ); + + if ( values[i3].x() > x ) + i2 = i3; + else + i1 = i3; + } + } + return i1; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigWellPathGeometryTools::value( double x, const QPolygonF& values ) +{ + if ( values.size() == 0 ) return 0.0; + + const int i = lookup( x, values ); + + if ( i >= values.size() - 1 ) return values.back().y(); + + auto low = values[i]; + auto high = values[i + 1]; + + auto delta = ( x - low.x() ) / ( high.x() - low.x() ); + + return ( 1 - delta ) * low.y() + delta * high.y(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -97,24 +152,24 @@ std::vector RigWellPathGeometryTools::interpolateMdFromTvd( const std::v std::vector interpolatedMdValues; interpolatedMdValues.reserve( tvdValuesToInterpolateFrom.size() ); - QwtSpline spline = createSpline( originalMdValues, originalTvdValues ); - std::vector segmentStartIndices = findSplineSegmentsContainingRoots( spline, tvdValuesToInterpolateFrom ); + auto splinePoints = createSplinePoints( originalMdValues, originalTvdValues ); + std::vector segmentStartIndices = findSplineSegmentsContainingRoots( splinePoints, tvdValuesToInterpolateFrom ); for ( size_t i = 0; i < segmentStartIndices.size(); ++i ) { double currentTVDValue = tvdValuesToInterpolateFrom[i]; - double startMD = spline.points().front().x(); - double endMD = spline.points().back().y(); + double startMD = splinePoints.front().x(); + double endMD = splinePoints.back().y(); if ( segmentStartIndices[i] != -1 ) { int startIndex = segmentStartIndices[i]; int endIndex = startIndex + 1; // Search interval for best MD value - startMD = spline.points()[startIndex].x(); - endMD = spline.points().back().y(); + startMD = splinePoints[startIndex].x(); + endMD = splinePoints.back().y(); - if ( endIndex < spline.points().size() ) + if ( endIndex < splinePoints.size() ) { if ( !interpolatedMdValues.empty() ) { @@ -125,10 +180,10 @@ std::vector RigWellPathGeometryTools::interpolateMdFromTvd( const std::v } startMD = std::max( startMD, interpolatedMdValues.back() + 0.1 * mdDiff ); } - endMD = spline.points()[endIndex].x(); + endMD = splinePoints[endIndex].x(); } } - double mdValue = solveForX( spline, startMD, endMD, currentTVDValue ); + double mdValue = solveForX( splinePoints, startMD, endMD, currentTVDValue ); interpolatedMdValues.push_back( mdValue ); } return interpolatedMdValues; @@ -193,7 +248,7 @@ std::pair /// //-------------------------------------------------------------------------------------------------- std::vector - RigWellPathGeometryTools::findSplineSegmentsContainingRoots( const QwtSpline& spline, + RigWellPathGeometryTools::findSplineSegmentsContainingRoots( const QPolygonF& points, const std::vector& tvdValuesToInterpolateFrom ) { std::vector segmentStartIndices; @@ -206,9 +261,9 @@ std::vector bool foundMatch = false; // Increment current_it until we find an interval containing our TVD - while ( currentSplineStartIndex < spline.points().size() - 2 ) + while ( currentSplineStartIndex < points.size() - 2 ) { - double diffCurrent = spline.points()[currentSplineStartIndex].y() - tvdValue; + double diffCurrent = points[currentSplineStartIndex].y() - tvdValue; if ( std::abs( diffCurrent ) < 1.0e-8 ) // Current is matching the point { foundMatch = true; @@ -217,7 +272,7 @@ std::vector int nextStartIndex = currentSplineStartIndex + 1; - double diffNext = spline.points()[nextStartIndex].y() - tvdValue; + double diffNext = points[nextStartIndex].y() - tvdValue; if ( diffCurrent * diffNext < 0.0 ) // One is above, the other is below { foundMatch = true; @@ -325,7 +380,7 @@ cvf::Vec3d RigWellPathGeometryTools::estimateDominantDirectionInXYPlane( const s //-------------------------------------------------------------------------------------------------- /// Golden-section minimization: https://en.wikipedia.org/wiki/Golden-section_search //-------------------------------------------------------------------------------------------------- -double RigWellPathGeometryTools::solveForX( const QwtSpline& spline, double minX, double maxX, double y ) +double RigWellPathGeometryTools::solveForX( const QPolygonF& spline, double minX, double maxX, double y ) { const double phi = ( 1.0 + std::sqrt( 5.0 ) ) / 2.0; const double tol = 1.0e-8; @@ -334,8 +389,8 @@ double RigWellPathGeometryTools::solveForX( const QwtSpline& spline, double minX double c = b - ( b - a ) / phi; double d = a + ( b - a ) / phi; - double fc = spline.value( c ) - y; - double fd = spline.value( d ) - y; + double fc = value( c, spline ) - y; + double fd = value( d, spline ) - y; for ( int n = 0; n < 100; ++n ) { @@ -350,7 +405,8 @@ double RigWellPathGeometryTools::solveForX( const QwtSpline& spline, double minX d = c; fd = fc; c = b - ( b - a ) / phi; - fc = spline.value( c ) - y; + + fc = value( c, spline ) - y; } else { @@ -358,7 +414,7 @@ double RigWellPathGeometryTools::solveForX( const QwtSpline& spline, double minX c = d; fc = fd; d = a + ( b - a ) / phi; - fd = spline.value( d ) - y; + fd = value( d, spline ) - y; } } return ( a + b ) / 2.0; @@ -367,8 +423,8 @@ double RigWellPathGeometryTools::solveForX( const QwtSpline& spline, double minX //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QwtSpline RigWellPathGeometryTools::createSpline( const std::vector& originalMdValues, - const std::vector& originalTvdValues ) +QPolygonF RigWellPathGeometryTools::createSplinePoints( const std::vector& originalMdValues, + const std::vector& originalTvdValues ) { QPolygonF polygon; for ( size_t i = 0; i < originalMdValues.size(); ++i ) @@ -376,7 +432,9 @@ QwtSpline RigWellPathGeometryTools::createSpline( const std::vector& ori polygon << QPointF( originalMdValues[i], originalTvdValues[i] ); } QwtSplineCurveFitter curveFitter; - QPolygonF splinePoints = curveFitter.fitCurve( polygon ); + double tolerance = 0.5; + auto splinePoints = curveFitter.spline()->polygon( polygon, tolerance ); + if ( splinePoints.empty() ) splinePoints = polygon; // Extend spline from 0.0 (if it does not already exist) to a large value for MD // This is to force a specific and known extrapolation. @@ -405,8 +463,5 @@ QwtSpline RigWellPathGeometryTools::createSpline( const std::vector& ori splinePoints.push_back( endPoint ); } - QwtSpline spline; - spline.setPoints( splinePoints ); - - return spline; + return splinePoints; } diff --git a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.h b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.h index 94fbfef20e..dd4a9873b2 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.h +++ b/ApplicationLibCode/ReservoirDataModel/RigWellPathGeometryTools.h @@ -20,12 +20,10 @@ #include "cvfVector3.h" -#include -#include - -#include +#include #include +#include class RigWellPath; @@ -56,10 +54,15 @@ class RigWellPathGeometryTools const std::vector& vertices ); static cvf::Vec3d estimateDominantDirectionInXYPlane( const std::vector& vertices ); - static double solveForX( const QwtSpline& spline, double minX, double maxX, double y ); + static double solveForX( const QPolygonF& spline, double minX, double maxX, double y ); - static QwtSpline createSpline( const std::vector& originalMdValues, - const std::vector& originalTvdValues ); - static std::vector findSplineSegmentsContainingRoots( const QwtSpline& spline, + static QPolygonF createSplinePoints( const std::vector& originalMdValues, + const std::vector& originalTvdValues ); + + static std::vector findSplineSegmentsContainingRoots( const QPolygonF& points, const std::vector& tvdValuesToInterpolateFrom ); + + // Temporary helper function to method removed from Qwt >= 6.2 + static int lookup( double x, const QPolygonF& values ); + static double value( double x, const QPolygonF& values ); }; diff --git a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp index 0a0a26ad84..c7fa929834 100644 --- a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp +++ b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp @@ -36,7 +36,9 @@ #include "qwt_scale_widget.h" #include +#include +#include #include #include diff --git a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp index 324e217fa7..c0dbb96896 100644 --- a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp @@ -41,6 +41,7 @@ #include "qwt_legend.h" #include "qwt_plot.h" #include "qwt_plot_zoomer.h" +#include "qwt_text.h" #include #include @@ -48,6 +49,8 @@ #include #include +#include // Needed for HUGE_VAL on Linux + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp index e7a13fb9da..c3892b4e86 100644 --- a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp @@ -70,7 +70,7 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* paren // Attach a zoomer for the right axis m_zoomerRight = new RiuQwtPlotZoomer( qwtPlot()->canvas() ); - m_zoomerRight->setAxis( QwtPlot::xTop, QwtPlot::yRight ); + m_zoomerRight->setAxes( QwtPlot::xTop, QwtPlot::yRight ); m_zoomerRight->setTrackerMode( QwtPicker::AlwaysOff ); m_zoomerRight->initMousePattern( 1 ); diff --git a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp index c503a2933e..323332e79e 100644 --- a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp @@ -40,6 +40,7 @@ #include "cvfAssert.h" #include +#include #include #include diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 84f0cb63e9..49abeb7d2f 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 62c7781b0f..6533d4f49b 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include #include diff --git a/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp b/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp index 0aedbfb7b7..d88c025bf2 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp @@ -25,6 +25,7 @@ #include "qwt_plot.h" #include "qwt_plot_zoneitem.h" +#include "qwt_text.h" #include diff --git a/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.h b/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.h index c6477db97e..a37f45664f 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.h +++ b/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.h @@ -25,6 +25,7 @@ #include #include +#include #include class QString; diff --git a/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp b/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp index 15419d3f20..cbff8e39c3 100644 --- a/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp @@ -38,6 +38,7 @@ #include "qwt_plot_marker.h" #include "qwt_plot_picker.h" #include "qwt_symbol.h" +#include "qwt_text.h" #include #include diff --git a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp index 437c6c4e68..c425cd187d 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp @@ -26,6 +26,7 @@ #include "qwt_date_scale_draw.h" #include "qwt_plot_curve.h" +#include "qwt_text.h" #include // For DBL_MAX diff --git a/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp b/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp index a1432d74db..a9dd286629 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtDateScaleWrapper.cpp @@ -19,6 +19,8 @@ #include "RiuQwtDateScaleWrapper.h" #include "RiuQwtPlotTools.h" +#include "qwt_text.h" + #include //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtLinearScaleEngine.cpp b/ApplicationLibCode/UserInterface/RiuQwtLinearScaleEngine.cpp index 633b11ea58..ff167eabc1 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtLinearScaleEngine.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtLinearScaleEngine.cpp @@ -18,6 +18,8 @@ #include "RiuQwtLinearScaleEngine.h" +#include "qwt_interval.h" + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index 110fd7e76a..3a236c85b2 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -27,6 +27,7 @@ #include "RiuQwtSymbol.h" #include "qwt_date.h" +#include "qwt_graphic.h" #include "qwt_interval_symbol.h" #include "qwt_painter.h" #include "qwt_plot_curve.h" @@ -35,6 +36,7 @@ #include "qwt_scale_map.h" #include "qwt_symbol.h" +#include #include //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotItemGroup.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotItemGroup.cpp index ac3a8bb28a..6a25b43d8f 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotItemGroup.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotItemGroup.cpp @@ -18,6 +18,10 @@ #include "RiuQwtPlotItemGroup.h" +#include "qwt_graphic.h" + +#include + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp index 9d6dfa7aef..0d0bd8a990 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp @@ -20,8 +20,10 @@ #include "caf.h" +#include "qwt_interval.h" #include "qwt_plot.h" #include "qwt_scale_div.h" +#include "qwt_scale_map.h" #include #include diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index c82520bd19..eb87b6a852 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -61,6 +61,8 @@ #include #include #include +#include +#include #include #include diff --git a/ApplicationLibCode/UserInterface/RiuQwtScalePicker.cpp b/ApplicationLibCode/UserInterface/RiuQwtScalePicker.cpp index bcc528c96b..2a67545413 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtScalePicker.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtScalePicker.cpp @@ -6,6 +6,7 @@ #include #include +#include #include //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index 7e8562050d..4c6993fa0c 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -41,6 +41,7 @@ #include "qwt_plot_curve.h" #include "qwt_plot_marker.h" #include "qwt_scale_engine.h" +#include "qwt_text.h" #include #include diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp index 1b8932f168..d26df7d761 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -107,7 +107,7 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*= // Attach a zoomer for the right axis m_zoomerRight = new RiuQwtPlotZoomer( m_plotWidget->qwtPlot()->canvas() ); - m_zoomerRight->setAxis( QwtPlot::xTop, QwtPlot::yRight ); + m_zoomerRight->setAxes( QwtPlot::xTop, QwtPlot::yRight ); m_zoomerRight->setTrackerMode( QwtPicker::AlwaysOff ); m_zoomerRight->initMousePattern( 1 ); diff --git a/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp b/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp index cf85d1873c..6a36a8a9bb 100644 --- a/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp @@ -35,6 +35,7 @@ #include "qwt_plot_curve.h" #include "qwt_plot_grid.h" #include "qwt_plot_layout.h" +#include "qwt_text.h" #include #include diff --git a/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp b/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp index 4f8ab03a94..94abab598d 100644 --- a/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellPathComponentPlotItem.cpp @@ -38,6 +38,7 @@ #include "qwt_plot.h" #include "qwt_plot_marker.h" #include "qwt_plot_shapeitem.h" +#include "qwt_text.h" #include #include diff --git a/ThirdParty/qwt b/ThirdParty/qwt index 0bd598c700..b207fdae66 160000 --- a/ThirdParty/qwt +++ b/ThirdParty/qwt @@ -1 +1 @@ -Subproject commit 0bd598c7008afbaa7216755fb9a4ac0da2e612eb +Subproject commit b207fdae66a346cb36c78acefaff1ae6d93416c9 From e20adcdb692271009714d7dd17d428fe46b5c94a Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Mon, 21 Mar 2022 11:31:25 +0100 Subject: [PATCH 191/406] Further Summary Multiplot improvements (#8707) * Create a specialized summary plot page for showing multi plots * Make summary plots always show in grid of selected size. * Allow dragging summary addresses into empty main window area * Limit grid to 4x4 cells --- .../RicSummaryPlotBuilder.cpp | 26 ++- .../RicSummaryPlotBuilder.h | 4 +- .../ProjectDataModel/RimMultiPlot.cpp | 1 - .../Summary/RimSummaryMultiPlotCollection.cpp | 4 +- .../Summary/RimSummaryMultiPlotCollection.h | 2 +- .../Summary/RimSummaryNameHelper.cpp | 5 - .../Summary/RimSummaryPlot.cpp | 22 ++- .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 + .../UserInterface/CMakeLists_files.cmake | 3 + .../UserInterface/RiuMultiPlotBook.cpp | 14 +- .../UserInterface/RiuMultiPlotPage.cpp | 52 +++--- .../UserInterface/RiuMultiPlotPage.h | 8 +- .../UserInterface/RiuPlotMainWindow.cpp | 30 ++++ .../UserInterface/RiuPlotMainWindow.h | 2 + .../UserInterface/RiuSummaryMultiPlotPage.cpp | 163 ++++++++++++++++++ .../UserInterface/RiuSummaryMultiPlotPage.h | 44 +++++ 16 files changed, 343 insertions(+), 39 deletions(-) create mode 100644 ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.h diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 5fe5ed645a..690c3bb457 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -338,6 +338,30 @@ RimMultiPlot* RicSummaryPlotBuilder::createAndAppendMultiPlot( const std::vector return plotWindow; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot* + RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( const std::vector& objects ) +{ + RimProject* project = RimProject::current(); + RimSummaryMultiPlotCollection* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); + + auto* plotWindow = new RimSummaryMultiPlot; + plotWindow->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) ); + plotWindow->setAsPlotMdiWindow(); + plotCollection->addSummaryMultiPlot( plotWindow ); + + plotWindow->addPlot( objects ); + + plotCollection->updateAllRequiredEditors(); + plotWindow->loadDataAndUpdate(); + + RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); + + return plotWindow; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -369,7 +393,7 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con auto* plotWindow = new RimSummaryMultiPlot(); plotWindow->setMultiPlotTitle( QString( "Multi Summary Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) ); plotWindow->setAsPlotMdiWindow(); - plotCollection->addMultiSummaryPlot( plotWindow ); + plotCollection->addSummaryMultiPlot( plotWindow ); appendPlotsToSummaryMultiPlot( plotWindow, plots ); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h index 5af00cd7f7..2328846a74 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h @@ -31,7 +31,8 @@ class RimSummaryMultiPlot; namespace caf { class PdmObject; -} +class PdmObjectHandle; +} // namespace caf #include #include @@ -75,6 +76,7 @@ class RicSummaryPlotBuilder static void appendPlotsToMultiPlot( RimMultiPlot* multiPlot, const std::vector& plots ); static RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vector& plots ); + static RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vector& objects ); static void appendPlotsToSummaryMultiPlot( RimSummaryMultiPlot* multiPlot, const std::vector& plots ); static RimSummaryPlot* createPlot( const std::set& addresses, diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 1ed97138e3..a32eaa7530 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -46,7 +46,6 @@ void RimMultiPlot::ColumnCountEnum::setUp() addItem( RimMultiPlot::ColumnCount::COLUMNS_2, "2", "2 Columns" ); addItem( RimMultiPlot::ColumnCount::COLUMNS_3, "3", "3 Columns" ); addItem( RimMultiPlot::ColumnCount::COLUMNS_4, "4", "4 Columns" ); - addItem( RimMultiPlot::ColumnCount::COLUMNS_UNLIMITED, "UNLIMITED", "Unlimited" ); setDefault( RimMultiPlot::ColumnCount::COLUMNS_2 ); } template <> diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp index 427bae37c0..4510f59f5d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -75,7 +75,7 @@ std::vector RimSummaryMultiPlotCollection::multiPlots() co //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlotCollection::addMultiSummaryPlot( RimSummaryMultiPlot* plot ) +void RimSummaryMultiPlotCollection::addSummaryMultiPlot( RimSummaryMultiPlot* plot ) { m_summaryMultiPlots().push_back( plot ); plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot ); @@ -108,7 +108,7 @@ void RimSummaryMultiPlotCollection::onDuplicatePlot( const caf::SignalEmitter* e auto plotCopy = dynamic_cast( plotToDuplicate->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); - addMultiSummaryPlot( plotCopy ); + addSummaryMultiPlot( plotCopy ); plotCopy->resolveReferencesRecursively(); plotCopy->initAfterReadRecursively(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h index b6e96db115..d0b612cfe6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h @@ -42,7 +42,7 @@ class RimSummaryMultiPlotCollection : public caf::PdmObject, public RimPlotColle std::vector multiPlots() const; - void addMultiSummaryPlot( RimSummaryMultiPlot* plot ); + void addSummaryMultiPlot( RimSummaryMultiPlot* plot ); protected: void onDuplicatePlot( const caf::SignalEmitter* emitter, RimSummaryMultiPlot* plotToDuplicate ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp index 38a4550894..f56ca8b32c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp @@ -86,10 +86,5 @@ QString RimSummaryNameHelper::aggregatedPlotTitle( const RimSummaryNameHelper& o RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( quantity, true ) ); } - if ( title.isEmpty() ) - { - title = "Plot Title"; - } - return title; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index ec02313955..2c60d4977e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -154,6 +154,11 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) m_sourceStepping.uiCapability()->setUiTreeChildrenHidden( true ); m_sourceStepping.xmlCapability()->disableIO(); + CAF_PDM_InitFieldNoDefault( &m_alternatePlotName, "AlternateName", "AlternateName" ); + m_alternatePlotName.uiCapability()->setUiReadOnly( true ); + m_alternatePlotName.uiCapability()->setUiHidden( true ); + m_alternatePlotName.xmlCapability()->disableIO(); + setPlotInfoLabel( "Filters Active" ); // Obsolete axis fields @@ -1361,6 +1366,10 @@ void RimSummaryPlot::addAsciiDataCruve( RimAsciiDataCurve* curve ) //-------------------------------------------------------------------------------------------------- caf::PdmFieldHandle* RimSummaryPlot::userDescriptionField() { + if ( m_description().isEmpty() ) + { + return &m_alternatePlotName; + } return &m_description; } @@ -2103,7 +2112,6 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& { mainOptions->add( &m_useAutoPlotTitle ); mainOptions->add( &m_description ); - mainOptions->add( &m_rowSpan ); mainOptions->add( &m_colSpan ); } m_description.uiCapability()->setUiReadOnly( m_useAutoPlotTitle ); @@ -2349,11 +2357,19 @@ void RimSummaryPlot::deleteAllPlotCurves() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updateCurveNames() { + m_alternatePlotName = ""; + + QStringList shortCurveNames; + if ( m_summaryCurveCollection->isCurvesVisible() ) { for ( auto c : summaryCurves() ) { - if ( c->isCurveVisible() ) c->updateCurveNameNoLegendUpdate(); + if ( c->isCurveVisible() ) + { + c->updateCurveNameNoLegendUpdate(); + shortCurveNames.append( QString::fromStdString( c->summaryAddressY().quantityName() ) ); + } } } @@ -2361,6 +2377,8 @@ void RimSummaryPlot::updateCurveNames() { curveSet->updateEnsembleLegendItem(); } + + m_alternatePlotName = shortCurveNames.join( "," ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index f5bd50ffd1..7d4de4bc1f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -31,6 +31,7 @@ #include "cafPdmChildArrayField.h" #include "cafPdmObjectHandle.h" +#include "cafPdmProxyValueField.h" #include "cafPdmPtrArrayField.h" #include "cafPdmPtrField.h" @@ -294,6 +295,7 @@ private slots: caf::PdmField m_useAutoPlotTitle; caf::PdmField m_description; + caf::PdmField m_alternatePlotName; caf::PdmChildArrayField m_gridTimeHistoryCurves; caf::PdmChildField m_summaryCurveCollection; diff --git a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake index 3d2f925de4..fb2833eeda 100644 --- a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake @@ -54,6 +54,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuPickItemInfo.h ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.h ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.h + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryMultiPlotPage.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.h ${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.h @@ -155,6 +156,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuPickItemInfo.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryMultiPlotPage.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.cpp @@ -255,6 +257,7 @@ list( ${CMAKE_CURRENT_LIST_DIR}/RiuTreeViewEventFilter.h ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.h ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.h + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryMultiPlotPage.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.h diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 49abeb7d2f..ad3437ae0f 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -32,6 +32,7 @@ #include "RiuPlotMainWindow.h" #include "RiuPlotObjectPicker.h" #include "RiuPlotWidget.h" +#include "RiuSummaryMultiPlotPage.h" #include "cafCmdFeatureMenuBuilder.h" #include "cafSelectionManager.h" @@ -551,7 +552,18 @@ const QList>& RiuMultiPlotBook::pages() const //-------------------------------------------------------------------------------------------------- RiuMultiPlotPage* RiuMultiPlotBook::createPage() { - RiuMultiPlotPage* page = new RiuMultiPlotPage( m_plotDefinition, this ); + RiuMultiPlotPage* page; + + RimSummaryMultiPlot* sumMultPlot = dynamic_cast( m_plotDefinition.p() ); + + if ( sumMultPlot ) + { + page = new RiuSummaryMultiPlotPage( sumMultPlot, this ); + } + else + { + page = new RiuMultiPlotPage( m_plotDefinition, this ); + } // Reapply plot settings page->setPlotTitle( m_plotTitle ); diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 6533d4f49b..68dd1eb9b0 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -572,43 +572,23 @@ void RiuMultiPlotPage::reinsertPlotWidgets() { clearGridLayout(); - auto titleFont = m_plotTitle->font(); - titleFont.setPixelSize( m_titleFontPixelSize ); - m_plotTitle->setFont( titleFont ); - - for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx ) - { - if ( m_plotWidgets[tIdx] ) - { - m_plotWidgets[tIdx]->hide(); - } - if ( m_legends[tIdx] ) - { - m_legends[tIdx]->hide(); - } - if ( m_subTitles[tIdx] ) - { - m_subTitles[tIdx]->hide(); - } - } - QList> subTitles = this->subTitlesForVisiblePlots(); QList> legends = this->legendsForVisiblePlots(); QList> plotWidgets = this->visiblePlotWidgets(); if ( !plotWidgets.empty() ) { - auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() ); + auto [rowCount, columnCount] = this->rowAndColumnCount( plotWidgets.size() ); int row = 0; int column = 0; for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex ) { int expectedColSpan = static_cast( plotWidgets[visibleIndex]->colSpan() ); - int colSpan = std::min( expectedColSpan, rowAndColumnCount.second ); + int colSpan = std::min( expectedColSpan, columnCount ); int rowSpan = plotWidgets[visibleIndex]->rowSpan(); - std::tie( row, column ) = findAvailableRowAndColumn( row, column, colSpan, rowAndColumnCount.second ); + std::tie( row, column ) = findAvailableRowAndColumn( row, column, colSpan, columnCount ); m_gridLayout->addWidget( subTitles[visibleIndex], 3 * row, column, 1, colSpan ); if ( legends[visibleIndex] ) @@ -745,6 +725,22 @@ void RiuMultiPlotPage::clearGridLayout() delete m_gridLayout; m_gridLayout = new QGridLayout( m_plotWidgetFrame ); } + + for ( int tIdx = 0; tIdx < m_plotWidgets.size(); ++tIdx ) + { + if ( m_plotWidgets[tIdx] ) + { + m_plotWidgets[tIdx]->hide(); + } + if ( m_legends[tIdx] ) + { + m_legends[tIdx]->hide(); + } + if ( m_subTitles[tIdx] ) + { + m_subTitles[tIdx]->hide(); + } + } } //-------------------------------------------------------------------------------------------------- @@ -860,3 +856,13 @@ void RiuMultiPlotPage::applyLook() setGraphicsEffect( nullptr ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotPage::updateTitleFont() +{ + auto titleFont = m_plotTitle->font(); + titleFont.setPixelSize( m_titleFontPixelSize ); + m_plotTitle->setFont( titleFont ); +} diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h index 0eae4164ca..525c9e3585 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h @@ -112,8 +112,11 @@ class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, p virtual bool showYAxis( int row, int column ) const; - void reinsertPlotWidgets(); - int alignCanvasTops(); + virtual void reinsertPlotWidgets(); + + void updateTitleFont(); + + int alignCanvasTops(); void clearGridLayout(); @@ -124,6 +127,7 @@ class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, p std::pair findAvailableRowAndColumn( int startRow, int startColumn, int columnSpan, int columnCount ) const; void applyLook(); + private slots: virtual void performUpdate(); void onLegendUpdated(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index f5a9f66cd1..44a1b780b9 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -26,12 +26,16 @@ #include "RiaRegressionTestRunner.h" #include "RiaSummaryTools.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" + #include "RimEnsembleCurveSetCollection.h" +#include "RimMainPlotCollection.h" #include "RimMultiPlot.h" #include "RimProject.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCurveCollection.h" #include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" #include "RimSummaryPlotFilterTextCurveSetEditor.h" @@ -46,6 +50,7 @@ #include "SummaryPlotCommands/RicSummaryPlotEditorDialog.h" #include "RiuDockWidgetTools.h" +#include "RiuDragDrop.h" #include "RiuMdiSubWindow.h" #include "RiuMessagePanel.h" #include "RiuMultiPlotPage.h" @@ -86,6 +91,8 @@ RiuPlotMainWindow::RiuPlotMainWindow() createToolBars(); createDockPanels(); + setAcceptDrops( true ); + // Store the layout so we can offer reset option m_initialDockAndToolbarLayout = saveState( 0 ); @@ -1154,3 +1161,26 @@ bool RiuPlotMainWindow::isAnyMdiSubWindowVisible() { return m_mdiArea->subWindowList().size() > 0; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindow::dragEnterEvent( QDragEnterEvent* event ) +{ + QPoint curpos = m_mdiArea->mapFromGlobal( QCursor::pos() ); + + if ( m_mdiArea->rect().contains( curpos ) ) event->acceptProposedAction(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindow::dropEvent( QDropEvent* event ) +{ + std::vector objects; + + if ( RiuDragDrop::handleGenericDropEvent( event, objects ) ) + { + RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( objects ); + } +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 2814b8e6c9..3c16eafebe 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -98,6 +98,8 @@ class RiuPlotMainWindow : public RiuMainWindowBase protected: void closeEvent( QCloseEvent* event ) override; void keyPressEvent( QKeyEvent* ) override; + void dragEnterEvent( QDragEnterEvent* event ) override; + void dropEvent( QDropEvent* event ) override; private: void setPdmRoot( caf::PdmObject* pdmRoot ); diff --git a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp new file mode 100644 index 0000000000..ae40c70197 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp @@ -0,0 +1,163 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuSummaryMultiPlotPage.h" + +#include "RimSummaryMultiPlot.h" + +#include "RiuPlotWidget.h" +#include "RiuQwtPlotLegend.h" + +#include +#include + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuSummaryMultiPlotPage::RiuSummaryMultiPlotPage( RimSummaryMultiPlot* plotDefinition, QWidget* parent ) + : RiuMultiPlotPage( plotDefinition, parent ) + , m_summaryMultiPlot( plotDefinition ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuSummaryMultiPlotPage::~RiuSummaryMultiPlotPage() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSummaryMultiPlotPage::reinsertPlotWidgets() +{ + if ( m_gridLayout ) + { + for ( int phIdx = 0; phIdx < m_placeholderWidgets.size(); phIdx++ ) + { + m_gridLayout->removeWidget( m_placeholderWidgets[phIdx] ); + m_placeholderWidgets[phIdx]->hide(); + } + } + + clearGridLayout(); + updateTitleFont(); + + int cols = m_summaryMultiPlot->columnCount(); + int rows = m_summaryMultiPlot->rowsPerPage(); + int nPlots = visiblePlotWidgets().size(); + + int nCells = cols * rows; + reservePlaceholders( nCells - nPlots ); + + QList> subTitles = this->subTitlesForVisiblePlots(); + QList> legends = this->legendsForVisiblePlots(); + QList> plotWidgets = this->visiblePlotWidgets(); + + int visibleIndex = 0; + int phIndex = 0; + + for ( int row = 0; row < rows; row++ ) + { + for ( int col = 0; col < cols; col++ ) + { + if ( visibleIndex >= nPlots ) + { + m_gridLayout->addWidget( m_placeholderWidgets[phIndex], row * 3 + 2, col ); + m_gridLayout->setRowStretch( row * 3 + 2, 1 ); + m_gridLayout->setColumnStretch( col, 6 ); + m_placeholderWidgets[phIndex]->show(); + phIndex++; + continue; + } + + int expectedColSpan = plotWidgets[visibleIndex]->colSpan(); + int colSpan = std::min( expectedColSpan, cols - col ); + + m_gridLayout->addWidget( subTitles[visibleIndex], 3 * row, col, 1, colSpan ); + if ( legends[visibleIndex] ) + { + m_gridLayout->addWidget( legends[visibleIndex], 3 * row + 1, col, 1, colSpan, Qt::AlignHCenter | Qt::AlignBottom ); + } + m_gridLayout->addWidget( plotWidgets[visibleIndex], 3 * row + 2, col, 1, colSpan ); + + subTitles[visibleIndex]->setVisible( m_showSubTitles ); + QFont subTitleFont = subTitles[visibleIndex]->font(); + subTitleFont.setPixelSize( m_subTitleFontPixelSize ); + subTitles[visibleIndex]->setFont( subTitleFont ); + + plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultLeft(), + showYAxis( row, col ), + showYAxis( row, col ) ); + plotWidgets[visibleIndex]->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), showYAxis( row, col ) ); + plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize ); + + // Adjust the space below a graph to make sure the heading of the row below is closest to the + // corresponding graph + auto margins = plotWidgets[visibleIndex]->contentsMargins(); + margins.setBottom( 40 ); + plotWidgets[visibleIndex]->setContentsMargins( margins ); + plotWidgets[visibleIndex]->show(); + + if ( legends[visibleIndex] ) + { + if ( m_plotDefinition->legendsVisible() ) + { + int legendColumns = 1; + if ( m_plotDefinition->legendsHorizontal() ) + { + legendColumns = 0; // unlimited + } + legends[visibleIndex]->setMaxColumns( legendColumns ); + QFont legendFont = legends[visibleIndex]->font(); + legendFont.setPixelSize( m_legendFontPixelSize ); + legends[visibleIndex]->setFont( legendFont ); + legends[visibleIndex]->show(); + } + else + { + legends[visibleIndex]->hide(); + } + } + // Set basic row and column stretches + m_gridLayout->setRowStretch( 3 * row + 2, 1 ); + for ( int c = col; c < col + colSpan; c++ ) + { + int colStretch = 6; // Empirically chosen to try to counter the width of the axis on the first track + if ( showYAxis( row, col ) ) colStretch += 1; + m_gridLayout->setColumnStretch( c, std::max( colStretch, m_gridLayout->columnStretch( c ) ) ); + } + + visibleIndex++; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSummaryMultiPlotPage::reservePlaceholders( int count ) +{ + while ( m_placeholderWidgets.size() < count ) + { + m_placeholderWidgets.push_back( new QWidget( this ) ); + } +} diff --git a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.h b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.h new file mode 100644 index 0000000000..e4de6c9103 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include "RiuMultiPlotPage.h" + +class RimSummaryMultiPlot; + +#include +#include +#include + +class RiuSummaryMultiPlotPage : public RiuMultiPlotPage +{ + Q_OBJECT + +public: + RiuSummaryMultiPlotPage( RimSummaryMultiPlot* plotDefinition, QWidget* parent = nullptr ); + ~RiuSummaryMultiPlotPage() override; + +protected: + void reinsertPlotWidgets() override; + + void reservePlaceholders( int count ); + +private: + RimSummaryMultiPlot* m_summaryMultiPlot; + QList> m_placeholderWidgets; +}; From 560917a481c0917e07ad6c0d4811db3bfe659188 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Mon, 21 Mar 2022 12:23:50 +0100 Subject: [PATCH 192/406] Rename NewSummaryPlot command to what it actually is - OpenSummaryPlotEditor command. Remove unused includes. Move Single Summary Plots to bottom of tree and show them as Single Summary Plots. --- .../Application/Tools/RiaImportEclipseCaseTools.cpp | 1 - .../Commands/RicConvertGroupToEnsembleFeature.cpp | 2 -- .../Commands/RicImportEnsembleFeature.cpp | 1 - .../Commands/RicImportSummaryCasesFeature.cpp | 1 - .../Commands/RicImportSummaryGroupFeature.cpp | 2 -- .../SummaryPlotCommands/CMakeLists_files.cmake | 4 ++-- ...Feature.cpp => RicOpenSummaryPlotEditorFeature.cpp} | 10 +++++----- ...PlotFeature.h => RicOpenSummaryPlotEditorFeature.h} | 2 +- .../RicPasteAsciiDataToSummaryPlotFeature.cpp | 1 - .../ProjectDataModel/RimContextCommandBuilder.cpp | 10 +++++----- ApplicationLibCode/ProjectDataModel/RimProject.cpp | 9 ++++----- .../Summary/RimSummaryMultiPlotCollection.cpp | 4 ++-- .../Summary/RimSummaryPlotCollection.cpp | 4 ++-- .../RimcSummaryPlotCollection.cpp | 1 - 14 files changed, 21 insertions(+), 31 deletions(-) rename ApplicationLibCode/Commands/SummaryPlotCommands/{RicNewSummaryPlotFeature.cpp => RicOpenSummaryPlotEditorFeature.cpp} (93%) rename ApplicationLibCode/Commands/SummaryPlotCommands/{RicNewSummaryPlotFeature.h => RicOpenSummaryPlotEditorFeature.h} (95%) diff --git a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp index 929df52f96..aa24155225 100644 --- a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp @@ -21,7 +21,6 @@ #include "ApplicationCommands/RicShowMainWindowFeature.h" #include "SummaryPlotCommands/RicNewSummaryCurveFeature.h" -#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h" #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" #include "RiaApplication.h" diff --git a/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.cpp b/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.cpp index 76f5c55b9f..2b43fa84c4 100644 --- a/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.cpp +++ b/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.cpp @@ -37,8 +37,6 @@ #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" -#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h" - #include "cafSelectionManagerTools.h" #include diff --git a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp index 8e5f05b181..5a24a893bf 100644 --- a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp @@ -45,7 +45,6 @@ #include "RiuPlotMainWindow.h" #include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h" -#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h" #include #include diff --git a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp index 5830d65bbc..8cc3c057ce 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp @@ -44,7 +44,6 @@ #include "RiuPlotMainWindowTools.h" #include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h" -#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h" #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" #include "cafProgressInfo.h" diff --git a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp index 3ef95e4bc0..d6aa90fa91 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp @@ -37,8 +37,6 @@ #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" -#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h" - #include #include diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index 6ee0d2b92c..ae7cbc1ec2 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -1,5 +1,5 @@ set(SOURCE_GROUP_HEADER_FILES - ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicOpenSummaryPlotEditorFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewDefaultSummaryPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCurveFeature.h @@ -48,7 +48,7 @@ set(SOURCE_GROUP_HEADER_FILES ) set(SOURCE_GROUP_SOURCE_FILES - ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicOpenSummaryPlotEditorFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewDefaultSummaryPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCurveFeature.cpp diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp similarity index 93% rename from ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp rename to ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp index 88128ba82b..770ab6d326 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp @@ -16,7 +16,7 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RicNewSummaryPlotFeature.h" +#include "RicOpenSummaryPlotEditorFeature.h" #include "RiaSummaryTools.h" @@ -44,12 +44,12 @@ #include -CAF_CMD_SOURCE_INIT( RicNewSummaryPlotFeature, "RicNewSummaryPlotFeature" ); +CAF_CMD_SOURCE_INIT( RicOpenSummaryPlotEditorFeature, "RicOpenSummaryPlotEditorFeature" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RicNewSummaryPlotFeature::isCommandEnabled() +bool RicOpenSummaryPlotEditorFeature::isCommandEnabled() { RimSummaryPlotCollection* sumPlotColl = nullptr; RimCustomObjectiveFunctionCollection* customObjFuncCollection = nullptr; @@ -81,7 +81,7 @@ bool RicNewSummaryPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicNewSummaryPlotFeature::onActionTriggered( bool isChecked ) +void RicOpenSummaryPlotEditorFeature::onActionTriggered( bool isChecked ) { RimProject* project = RimProject::current(); CVF_ASSERT( project ); @@ -140,7 +140,7 @@ void RicNewSummaryPlotFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicNewSummaryPlotFeature::setupActionLook( QAction* actionToSetup ) +void RicOpenSummaryPlotEditorFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setText( "Open Summary Plot Editor" ); actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.h similarity index 95% rename from ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h rename to ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.h index 88a5407e10..c36c873c34 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.h @@ -25,7 +25,7 @@ //================================================================================================== /// //================================================================================================== -class RicNewSummaryPlotFeature : public caf::CmdFeature +class RicOpenSummaryPlotEditorFeature : public caf::CmdFeature { CAF_CMD_HEADER_INIT; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp index 387ceabf03..ee6a89a8c6 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp @@ -19,7 +19,6 @@ #include "RicPasteAsciiDataToSummaryPlotFeature.h" #include "OperationsUsingObjReferences/RicPasteFeatureImpl.h" -#include "RicNewSummaryPlotFeature.h" #include "RicPasteAsciiDataToSummaryPlotFeatureUi.h" #include "RiaLogging.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 041d4149c6..8880f2fa59 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -559,7 +559,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicPasteSummaryPlotFeature"; menuBuilder << "RicPasteAsciiDataToSummaryPlotFeature"; menuBuilder << "Separator"; - menuBuilder << "RicNewSummaryPlotFeature"; + menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "Separator"; menuBuilder << "RicShowSummaryCurveCalculatorFeature"; @@ -769,7 +769,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder.subMenuEnd(); menuBuilder.addSeparator(); menuBuilder << "RicNewDerivedEnsembleFeature"; - menuBuilder << "RicNewSummaryPlotFeature"; + menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder.addSeparator(); @@ -785,7 +785,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicImportEnsembleFeature"; menuBuilder.subMenuEnd(); menuBuilder.addSeparator(); - menuBuilder << "RicNewSummaryPlotFeature"; + menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder.addSeparator(); @@ -794,7 +794,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() if ( !dynamic_cast( firstUiItem ) ) { menuBuilder << "RicShowSummaryCurveCalculatorFeature"; - // menuBuilder << "RicNewSummaryPlotFeature"; + // menuBuilder << "RicOpenSummaryPlotEditorFeature"; } } else if ( dynamic_cast( firstUiItem ) ) @@ -1063,7 +1063,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicShowTotalAllocationDataFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; - menuBuilder << "RicNewSummaryPlotFeature"; + menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index ce31ce0e29..e59cb3ecf5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -1374,11 +1374,6 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q { if ( mainPlotCollection ) { - if ( mainPlotCollection->summaryPlotCollection() ) - { - uiTreeOrdering.add( mainPlotCollection->summaryPlotCollection() ); - } - if ( mainPlotCollection->summaryMultiPlotCollection() ) { uiTreeOrdering.add( mainPlotCollection->summaryMultiPlotCollection() ); @@ -1455,6 +1450,10 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q statisticsItemCollection->add( mainPlotCollection->ensembleFractureStatisticsPlotCollection() ); } #endif + if ( mainPlotCollection->summaryPlotCollection() ) + { + uiTreeOrdering.add( mainPlotCollection->summaryPlotCollection() ); + } } } else if ( uiConfigName == "PlotWindow.DataSources" ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp index 4510f59f5d..8e99af0080 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -31,9 +31,9 @@ CAF_PDM_SOURCE_INIT( RimSummaryMultiPlotCollection, "RimSummaryMultiPlotCollecti //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlotCollection::RimSummaryMultiPlotCollection() { - CAF_PDM_InitObject( "Summary Multi Plots", ":/MultiPlot16x16.png" ); + CAF_PDM_InitObject( "Summary Plots", ":/MultiPlot16x16.png" ); - CAF_PDM_InitFieldNoDefault( &m_summaryMultiPlots, "MultiSummaryPlots", "Multi Summary Plots" ); + CAF_PDM_InitFieldNoDefault( &m_summaryMultiPlots, "MultiSummaryPlots", "Summary Plots" ); m_summaryMultiPlots.uiCapability()->setUiTreeHidden( true ); caf::PdmFieldReorderCapability::addToField( &m_summaryMultiPlots ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp index 5936afc101..b83ada7e01 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp @@ -37,9 +37,9 @@ CAF_PDM_SOURCE_INIT( RimSummaryPlotCollection, "SummaryPlotCollection" ); //-------------------------------------------------------------------------------------------------- RimSummaryPlotCollection::RimSummaryPlotCollection() { - CAF_PDM_InitScriptableObject( "Summary Plots", ":/SummaryPlotsLight16x16.png" ); + CAF_PDM_InitScriptableObject( "Single Summary Plots", ":/SummaryPlotsLight16x16.png" ); - CAF_PDM_InitFieldNoDefault( &m_summaryPlots, "SummaryPlots", "Summary Plots" ); + CAF_PDM_InitFieldNoDefault( &m_summaryPlots, "SummaryPlots", "Single Summary Plots" ); m_summaryPlots.uiCapability()->setUiTreeHidden( true ); caf::PdmFieldReorderCapability::addToField( &m_summaryPlots ); } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp index 33f18549da..fffa3b293b 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp @@ -20,7 +20,6 @@ #include "SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.h" #include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h" -#include "SummaryPlotCommands/RicNewSummaryPlotFeature.h" #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" #include "RiaTextStringTools.h" From c00aea75fb89586dc0d0a69dc77f3a8854bbf144 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 11 Mar 2022 16:02:30 +0100 Subject: [PATCH 193/406] #8662 QtCharts: Implement tooltip when hovering over curves --- .../Summary/CMakeLists_files.cmake | 2 + .../RimEnsembleCurveInfoTextProvider.cpp | 39 ++++++ .../RimEnsembleCurveInfoTextProvider.h | 32 +++++ .../UserInterface/CMakeLists_files.cmake | 2 + .../RiuPlotCurveInfoTextProvider.h | 33 ++++++ .../UserInterface/RiuQtChartsPlotWidget.cpp | 61 +++++++++- .../UserInterface/RiuQtChartsPlotWidget.h | 14 ++- .../UserInterface/RiuQtChartsToolTip.cpp | 112 ++++++++++++++++++ .../UserInterface/RiuQtChartsToolTip.h | 48 ++++++++ .../UserInterface/RiuQwtCurvePointTracker.cpp | 15 +-- .../UserInterface/RiuQwtCurvePointTracker.h | 25 ++-- .../UserInterface/RiuSummaryQtChartsPlot.cpp | 4 +- .../UserInterface/RiuSummaryQwtPlot.cpp | 24 +--- .../UserInterface/RiuWellLogTrack.cpp | 10 +- 14 files changed, 365 insertions(+), 56 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveInfoTextProvider.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveInfoTextProvider.h create mode 100644 ApplicationLibCode/UserInterface/RiuPlotCurveInfoTextProvider.h create mode 100644 ApplicationLibCode/UserInterface/RiuQtChartsToolTip.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuQtChartsToolTip.h diff --git a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake index e96af9970f..c5b777c780 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -45,6 +45,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.h + ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveInfoTextProvider.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -94,6 +95,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveInfoTextProvider.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveInfoTextProvider.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveInfoTextProvider.cpp new file mode 100644 index 0000000000..f023f4835b --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveInfoTextProvider.cpp @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimEnsembleCurveInfoTextProvider.h" + +#include "RimSummaryCase.h" +#include "RimSummaryCurve.h" + +#include "RiuPlotCurve.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimEnsembleCurveInfoTextProvider::curveInfoText( RiuPlotCurve* riuCurve ) const +{ + // RiuPlotCurve* riuCurve = dynamic_cast( curve ); + RimSummaryCurve* sumCurve = nullptr; + if ( riuCurve ) + { + sumCurve = dynamic_cast( riuCurve->ownerRimCurve() ); + } + + return sumCurve && sumCurve->summaryCaseY() ? sumCurve->summaryCaseY()->displayCaseName() : ""; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveInfoTextProvider.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveInfoTextProvider.h new file mode 100644 index 0000000000..12ce1ab84d --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveInfoTextProvider.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiuPlotCurveInfoTextProvider.h" + +#include + +//================================================================================================== +// +//================================================================================================== +class RimEnsembleCurveInfoTextProvider : public RiuPlotCurveInfoTextProvider +{ +public: + QString curveInfoText( RiuPlotCurve* ) const override; +}; diff --git a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake index fb2833eeda..891d30170a 100644 --- a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake @@ -214,6 +214,7 @@ if(RESINSIGHT_USE_QT_CHARTS) ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotWidget.h ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotTools.h ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotCurveSymbol.h + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsToolTip.h ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryQtChartsPlot.h ) @@ -225,6 +226,7 @@ if(RESINSIGHT_USE_QT_CHARTS) ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotWidget.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsPlotCurveSymbol.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuQtChartsToolTip.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryQtChartsPlot.cpp ) diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurveInfoTextProvider.h b/ApplicationLibCode/UserInterface/RiuPlotCurveInfoTextProvider.h new file mode 100644 index 0000000000..70fe084dc9 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuPlotCurveInfoTextProvider.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2015- Equinor 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include + +class RiuPlotCurve; + +//-------------------------------------------------------------------------------------------------- +/// Interface for retrieving curve info text +//-------------------------------------------------------------------------------------------------- +class RiuPlotCurveInfoTextProvider +{ +public: + virtual QString curveInfoText( RiuPlotCurve* curve ) const = 0; +}; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index bcc535f08f..9ed59149bb 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -27,10 +27,12 @@ #include "RiuDraggableOverlayFrame.h" #include "RiuGuiTheme.h" +#include "RiuPlotCurveInfoTextProvider.h" #include "RiuPlotMainWindowTools.h" #include "RiuPlotWidget.h" #include "RiuQtChartView.h" #include "RiuQtChartsPlotCurve.h" +#include "RiuQtChartsToolTip.h" #include "RiuQwtDateScaleWrapper.h" #include "caf.h" @@ -52,9 +54,13 @@ using namespace QtCharts; //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQtChartsPlotWidget::RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* parent ) +RiuQtChartsPlotWidget::RiuQtChartsPlotWidget( RimPlot* plotDefinition, + QWidget* parent, + RiuPlotCurveInfoTextProvider* plotCurveNameProvider ) : RiuPlotWidget( plotDefinition, parent ) + , m_plotCurveNameProvider( plotCurveNameProvider ) , m_dateScaleWrapper( new RiuQwtDateScaleWrapper() ) + , m_toolTip( nullptr ) { CAF_ASSERT( m_plotDefinition ); @@ -853,6 +859,8 @@ void RiuQtChartsPlotWidget::attach( RiuPlotCurve* plotCurve, addToChart( m_lineSeriesMap, plotCurve, lineSeries, xAxis, yAxis, qtChartsPlotCurve ); addToChart( m_areaSeriesMap, plotCurve, areaSeries, xAxis, yAxis, qtChartsPlotCurve ); addToChart( m_scatterSeriesMap, plotCurve, scatterSeries, xAxis, yAxis, qtChartsPlotCurve ); + + connect( dynamic_cast( lineSeries ), &QLineSeries::hovered, this, &RiuQtChartsPlotWidget::tooltip ); } //-------------------------------------------------------------------------------------------------- @@ -1234,3 +1242,54 @@ void RiuQtChartsPlotWidget::pruneAxes( const std::set& usedAxes ) } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::tooltip( const QPointF& point, bool state ) +{ + QAbstractSeries* series = qobject_cast( sender() ); + if ( !m_toolTip ) m_toolTip = new RiuQtChartsToolTip( qtChart(), series ); + + if ( state ) + { + QString nameFromSeries = createNameFromSeries( series ); + + QDateTime date = QDateTime::fromMSecsSinceEpoch( point.x() ); + QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale( date, "hh:mm dd.MMMM.yyyy" ); + + QString text = QString( "%1 (%2)" ).arg( point.y() ).arg( dateString ); + + if ( !nameFromSeries.isEmpty() ) text.prepend( nameFromSeries + ": " ); + + m_toolTip->setText( text ); + + m_toolTip->setAnchor( point ); + m_toolTip->setSeries( series ); + m_toolTip->setZValue( 200 ); + m_toolTip->updateGeometry(); + m_toolTip->show(); + } + else + { + m_toolTip->hide(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuQtChartsPlotWidget::createNameFromSeries( QAbstractSeries* series ) const +{ + if ( !m_plotCurveNameProvider ) return ""; + + for ( auto [plotCurve, plotSeries] : m_lineSeriesMap ) + { + if ( plotSeries == series ) + { + return m_plotCurveNameProvider->curveInfoText( plotCurve ); + } + } + + return ""; +} diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index c67ee6f70d..bb593885bd 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -36,6 +36,9 @@ class RiaPlotWindowRedrawScheduler; class RimPlot; class RiuPlotCurve; class RiuQtChartsPlotCurve; +class RiuQtChartsToolTip; +class RiuPlotCurveSymbol; +class RiuPlotCurveInfoTextProvider; class QEvent; class QLabel; @@ -64,7 +67,9 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget Q_OBJECT public: - RiuQtChartsPlotWidget( RimPlot* plotDefinition, QWidget* parent = nullptr ); + RiuQtChartsPlotWidget( RimPlot* plotDefinition, + QWidget* parent = nullptr, + RiuPlotCurveInfoTextProvider* plotCurveNameProvider = nullptr ); ~RiuQtChartsPlotWidget() override; int axisTitleFontSize( RiuPlotAxis axis ) const override; @@ -217,6 +222,7 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget private slots: void axisRangeChanged(); + void tooltip( const QPointF& point, bool state ); private: void addAxis( RiuPlotAxis plotAxis, bool isEnabled, bool isAutoScale ); @@ -229,6 +235,8 @@ private slots: QtCharts::QCategoryAxis* categoryAxis(); + QString createNameFromSeries( QtCharts::QAbstractSeries* series ) const; + private: QPointer m_viewer; @@ -240,5 +248,7 @@ private slots: std::map m_areaSeriesMap; std::map m_scatterSeriesMap; - RiuQwtDateScaleWrapper* m_dateScaleWrapper; + RiuQwtDateScaleWrapper* m_dateScaleWrapper; + RiuQtChartsToolTip* m_toolTip; + RiuPlotCurveInfoTextProvider* m_plotCurveNameProvider; }; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.cpp new file mode 100644 index 0000000000..151f9a8f31 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.cpp @@ -0,0 +1,112 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiuQtChartsToolTip.h" + +#include +#include +#include +#include +#include + +using namespace QtCharts; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuQtChartsToolTip::RiuQtChartsToolTip( QChart* chart, QtCharts::QAbstractSeries* series ) + : QGraphicsItem( chart ) + , m_chart( chart ) + , m_series( series ) + , m_radius( 10 ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QRectF RiuQtChartsToolTip::boundingRect() const +{ + QPointF anchor = mapFromParent( m_chart->mapToPosition( m_anchor, m_series ) ); + QRectF rect = m_rect.united( m_textRect ); + rect.setLeft( std::min( rect.left(), anchor.x() ) ); + rect.setRight( std::max( rect.right(), anchor.x() ) ); + rect.setTop( std::min( rect.top(), anchor.y() ) ); + rect.setBottom( std::max( rect.bottom(), anchor.y() ) ); + return rect; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsToolTip::paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget ) +{ + Q_UNUSED( option ) + Q_UNUSED( widget ) + QPainterPath path; + + QPointF anchor = mapFromParent( m_chart->mapToPosition( m_anchor, m_series ) ); + + path.addEllipse( anchor, m_radius, m_radius ); + path = path.simplified(); + + painter->setPen( QPen( Qt::black ) ); + + painter->drawPath( path ); + painter->drawText( m_textRect, m_text ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsToolTip::setSeries( QAbstractSeries* series ) +{ + m_series = series; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsToolTip::setText( const QString& text ) +{ + m_text = text; + QFontMetrics metrics( m_font ); + m_textRect = metrics.boundingRect( QRect( 0, 0, 150, 150 ), Qt::AlignLeft, m_text ); + m_textRect.translate( m_radius, 0 ); + prepareGeometryChange(); + + m_rect.setRect( -m_radius, -m_radius, m_radius, m_radius ); + m_rect.moveCenter( QPoint( m_radius, m_radius ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsToolTip::setAnchor( QPointF point ) +{ + m_anchor = point; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsToolTip::updateGeometry() +{ + prepareGeometryChange(); + setPos( m_chart->mapToPosition( m_anchor, m_series ) ); +} diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.h b/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.h new file mode 100644 index 0000000000..d741bb83f9 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuQtChartsToolTip.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include +#include + +class RiuQtChartsToolTip : public QGraphicsItem +{ +public: + RiuQtChartsToolTip( QtCharts::QChart* parent, QtCharts::QAbstractSeries* series ); + + void setSeries( QtCharts::QAbstractSeries* series ); + void setText( const QString& text ); + void setAnchor( QPointF point ); + void updateGeometry(); + + QRectF boundingRect() const override; + void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget ) override; + +private: + QString m_text; + QRectF m_textRect; + QRectF m_rect; + QPointF m_anchor; + QFont m_font; + int m_radius; + QtCharts::QChart* m_chart; + QtCharts::QAbstractSeries* m_series; +}; diff --git a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp index c425cd187d..8d23423eda 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp @@ -20,12 +20,13 @@ #include "RiaQDateTimeTools.h" #include "RiuGuiTheme.h" - -#include "qwt_plot_marker.h" -#include "qwt_symbol.h" +#include "RiuPlotCurve.h" +#include "RiuPlotCurveInfoTextProvider.h" #include "qwt_date_scale_draw.h" #include "qwt_plot_curve.h" +#include "qwt_plot_marker.h" +#include "qwt_symbol.h" #include "qwt_text.h" #include // For DBL_MAX @@ -35,9 +36,9 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtCurvePointTracker::RiuQwtCurvePointTracker( QwtPlot* plot, - bool isMainAxisHorizontal, - IPlotCurveInfoTextProvider* curveInfoTextProvider ) +RiuQwtCurvePointTracker::RiuQwtCurvePointTracker( QwtPlot* plot, + bool isMainAxisHorizontal, + RiuPlotCurveInfoTextProvider* curveInfoTextProvider ) : QwtPlotPicker( plot->canvas() ) , m_plot( plot ) , m_isMainAxisHorizontal( isMainAxisHorizontal ) @@ -187,7 +188,7 @@ QPointF RiuQwtCurvePointTracker::closestCurvePoint( const QPoint& cursorPositio if ( curveInfoText && closestCurve && m_curveInfoTextProvider ) { - *curveInfoText = m_curveInfoTextProvider->curveInfoText( closestCurve ); + *curveInfoText = m_curveInfoTextProvider->curveInfoText( dynamic_cast( closestCurve ) ); } if ( dateScaleDraw ) diff --git a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h index 0f4ff14d9c..6aba3e04ce 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h +++ b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h @@ -24,7 +24,7 @@ class QwtPlotMarker; class QwtPlotCurve; -class IPlotCurveInfoTextProvider; +class RiuPlotCurveInfoTextProvider; //-------------------------------------------------------------------------------------------------- /// Class to add mouse over-tracking of curve points with text marker @@ -32,9 +32,9 @@ class IPlotCurveInfoTextProvider; class RiuQwtCurvePointTracker : public QwtPlotPicker { public: - explicit RiuQwtCurvePointTracker( QwtPlot* plot, - bool isMainAxisHorizontal, - IPlotCurveInfoTextProvider* curveInfoTextProvider = nullptr ); + explicit RiuQwtCurvePointTracker( QwtPlot* plot, + bool isMainAxisHorizontal, + RiuPlotCurveInfoTextProvider* curveInfoTextProvider = nullptr ); ~RiuQwtCurvePointTracker() override; protected: @@ -52,17 +52,8 @@ class RiuQwtCurvePointTracker : public QwtPlotPicker QwtPlot::Axis relatedXAxis, QwtPlot::Axis relatedYAxis ) const; - QPointer m_plot; - QwtPlotMarker* m_plotMarker; - bool m_isMainAxisHorizontal; - IPlotCurveInfoTextProvider* m_curveInfoTextProvider; -}; - -//-------------------------------------------------------------------------------------------------- -/// Interface for retrieving curve info text -//-------------------------------------------------------------------------------------------------- -class IPlotCurveInfoTextProvider -{ -public: - virtual QString curveInfoText( QwtPlotCurve* curve ) = 0; + QPointer m_plot; + QwtPlotMarker* m_plotMarker; + bool m_isMainAxisHorizontal; + RiuPlotCurveInfoTextProvider* m_curveInfoTextProvider; }; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp index 9fc1356f97..91c8b0b134 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp @@ -20,6 +20,7 @@ #include "RiaPreferences.h" +#include "RimEnsembleCurveInfoTextProvider.h" #include "RimSummaryPlot.h" #include "RiuPlotCurve.h" @@ -32,7 +33,7 @@ RiuSummaryQtChartsPlot::RiuSummaryQtChartsPlot( RimSummaryPlot* plot ) : RiuSummaryPlot( plot ) { - m_plotWidget = new RiuQtChartsPlotWidget( plot ); + m_plotWidget = new RiuQtChartsPlotWidget( plot, nullptr, new RimEnsembleCurveInfoTextProvider ); m_plotWidget->setContextMenuPolicy( Qt::CustomContextMenu ); connect( m_plotWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( showContextMenu( QPoint ) ) ); @@ -43,7 +44,6 @@ RiuSummaryQtChartsPlot::RiuSummaryQtChartsPlot( RimSummaryPlot* plot ) m_plotWidget->setInternalLegendVisible( true ); } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp index d26df7d761..e903f22da5 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -23,6 +23,7 @@ #include "Commands/CorrelationPlotCommands/RicNewCorrelationPlotFeature.h" +#include "RimEnsembleCurveInfoTextProvider.h" #include "RimPlotAxisAnnotation.h" #include "RimPlotAxisProperties.h" #include "RimPlotAxisPropertiesInterface.h" @@ -67,28 +68,7 @@ #include -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class EnsembleCurveInfoTextProvider : public IPlotCurveInfoTextProvider -{ -public: - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - QString curveInfoText( QwtPlotCurve* curve ) override - { - RiuPlotCurve* riuCurve = dynamic_cast( curve ); - RimSummaryCurve* sumCurve = nullptr; - if ( riuCurve ) - { - sumCurve = dynamic_cast( riuCurve->ownerRimCurve() ); - } - - return sumCurve && sumCurve->summaryCaseY() ? sumCurve->summaryCaseY()->displayCaseName() : ""; - } -}; -static EnsembleCurveInfoTextProvider ensembleCurveInfoTextProvider; +static RimEnsembleCurveInfoTextProvider ensembleCurveInfoTextProvider; //-------------------------------------------------------------------------------------------------- /// diff --git a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp index 3a3766b95f..1ebdbd35f5 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp @@ -27,6 +27,7 @@ #include "RiuGuiTheme.h" #include "RiuPlotCurve.h" +#include "RiuPlotCurveInfoTextProvider.h" #include "RiuQwtCurvePointTracker.h" #include "RiuQwtPlotTools.h" @@ -41,7 +42,7 @@ class RiuWellLogCurvePointTracker : public RiuQwtCurvePointTracker { public: - RiuWellLogCurvePointTracker( QwtPlot* plot, IPlotCurveInfoTextProvider* curveInfoTextProvider, RimWellLogTrack* track ) + RiuWellLogCurvePointTracker( QwtPlot* plot, RiuPlotCurveInfoTextProvider* curveInfoTextProvider, RimWellLogTrack* track ) : RiuQwtCurvePointTracker( plot, false, curveInfoTextProvider ) , m_wellLogTrack( track ) { @@ -105,16 +106,15 @@ class RiuWellLogCurvePointTracker : public RiuQwtCurvePointTracker //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class WellLogCurveInfoTextProvider : public IPlotCurveInfoTextProvider +class WellLogCurveInfoTextProvider : public RiuPlotCurveInfoTextProvider { public: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- - QString curveInfoText( QwtPlotCurve* curve ) override + QString curveInfoText( RiuPlotCurve* riuCurve ) const override { - RiuPlotCurve* riuCurve = dynamic_cast( curve ); - RimWellLogCurve* wlCurve = nullptr; + RimWellLogCurve* wlCurve = nullptr; if ( riuCurve ) { wlCurve = dynamic_cast( riuCurve->ownerRimCurve() ); From c03252a581cd02556a987b14d01e85165f435364 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 14 Mar 2022 16:47:25 +0100 Subject: [PATCH 194/406] #8662 QtCharts: Snap tooltip to closest curve point. --- .../UserInterface/RiuQtChartsPlotWidget.cpp | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 9ed59149bb..adfbb6090b 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -47,6 +47,7 @@ #include #include +#include #include using namespace QtCharts; @@ -1251,20 +1252,52 @@ void RiuQtChartsPlotWidget::tooltip( const QPointF& point, bool state ) QAbstractSeries* series = qobject_cast( sender() ); if ( !m_toolTip ) m_toolTip = new RiuQtChartsToolTip( qtChart(), series ); + auto xySeries = dynamic_cast( series ); + + auto snapToPoint = point; + + if ( xySeries ) + { + auto points = xySeries->pointsVector(); + int closestIndex = -1; + for ( int i = 0; i < points.size() - 1; i++ ) + { + if ( point.x() > points[i + 1].x() ) continue; + + if ( points[i].x() < point.x() && point.x() < points[i + 1].x() ) + { + if ( std::fabs( points[i].x() - point.x() ) < std::fabs( point.x() - points[i + 1].x() ) ) + { + closestIndex = i; + } + else + { + closestIndex = i + 1; + } + break; + } + } + + if ( closestIndex > 0 ) + { + snapToPoint = points[closestIndex]; + } + } + if ( state ) { QString nameFromSeries = createNameFromSeries( series ); - QDateTime date = QDateTime::fromMSecsSinceEpoch( point.x() ); + QDateTime date = QDateTime::fromMSecsSinceEpoch( snapToPoint.x() ); QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale( date, "hh:mm dd.MMMM.yyyy" ); - QString text = QString( "%1 (%2)" ).arg( point.y() ).arg( dateString ); + QString text = QString( "%1 (%2)" ).arg( snapToPoint.y() ).arg( dateString ); if ( !nameFromSeries.isEmpty() ) text.prepend( nameFromSeries + ": " ); m_toolTip->setText( text ); - m_toolTip->setAnchor( point ); + m_toolTip->setAnchor( snapToPoint ); m_toolTip->setSeries( series ); m_toolTip->setZValue( 200 ); m_toolTip->updateGeometry(); From 2f2933174bcbdfa143db4dd55b82850207f5ea30 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 22 Mar 2022 10:18:20 +0100 Subject: [PATCH 195/406] Python : Split parameters into list of strings Avoid space in parameters to be sent to ResInsight, always use list of strings --- .../Python/rips/PythonExamples/headless_plot_export.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GrpcInterface/Python/rips/PythonExamples/headless_plot_export.py b/GrpcInterface/Python/rips/PythonExamples/headless_plot_export.py index af5c527bdc..21e5731386 100644 --- a/GrpcInterface/Python/rips/PythonExamples/headless_plot_export.py +++ b/GrpcInterface/Python/rips/PythonExamples/headless_plot_export.py @@ -7,7 +7,7 @@ if use_platform_offscreen: # To use offscreen, the path to fonts must be specified in the environment variable QT_QPA_FONTDIR="C:/windows/fonts" resinsight = rips.Instance.launch( - command_line_parameters=["-platform offscreen", "--size", 1200, 1000] + command_line_parameters=["-platform", "offscreen", "--size", 1200, 1000] ) qpa_fontdir = os.environ["QT_QPA_FONTDIR"] From 2aec91e66d8def460027cbf9c65e69afc59b202f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 21 Mar 2022 11:27:30 +0100 Subject: [PATCH 196/406] Janitor : Add offscreen dynamic library when bundling Qt --- ApplicationExeCode/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ApplicationExeCode/CMakeLists.txt b/ApplicationExeCode/CMakeLists.txt index 6bb12a4c88..443e6c5b40 100644 --- a/ApplicationExeCode/CMakeLists.txt +++ b/ApplicationExeCode/CMakeLists.txt @@ -476,6 +476,10 @@ if(RESINSIGHT_PRIVATE_INSTALL) install(FILES ${QT_PLUGIN_PATH}/iconengines/libqsvgicon.so DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/iconengines/ ) + # Required when using --platform offscreen + install(FILES ${QT_PLUGIN_PATH}/platforms/libqoffscreen.so + DESTINATION ${RESINSIGHT_INSTALL_FOLDER}/platforms/ + ) # Required by xcb module used to create OpenGL widgets install( From f45637b7f017325d92ac11d0c2366703c29c15f4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 23 Mar 2022 13:35:47 +0100 Subject: [PATCH 197/406] #8715 Fix multi summary title and legend updates --- .../Summary/RimSummaryMultiPlot.cpp | 30 +++++++++++++++++-- .../Summary/RimSummaryMultiPlot.h | 4 +++ .../Summary/RimSummaryPlot.cpp | 6 ++++ .../ProjectDataModel/Summary/RimSummaryPlot.h | 3 ++ 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index a9e69ce8cc..1e999d1ca3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -101,6 +101,9 @@ void RimSummaryMultiPlot::addPlot( RimPlot* plot ) CVF_ASSERT( sumPlot != nullptr ); if ( sumPlot ) { + // Not required to connect signal here, as RimSummaryMultiPlot::insertPlot() will always be called from + // RimMultiPlot::addPlot() + RimMultiPlot::addPlot( plot ); } } @@ -114,6 +117,7 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) CVF_ASSERT( sumPlot != nullptr ); if ( sumPlot ) { + sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); RimMultiPlot::insertPlot( plot, index ); } } @@ -131,9 +135,9 @@ void RimSummaryMultiPlot::addPlot( const std::vector& obj RimSummaryPlot* plot = new RimSummaryPlot(); plot->enableAutoPlotTitle( true ); - addPlot( plot ); - plot->handleDroppedObjects( objects ); + + addPlot( plot ); } } @@ -508,6 +512,19 @@ bool RimSummaryMultiPlot::handleGlobalWheelEvent( QWheelEvent* wheelEvent ) return false; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::initAfterRead() +{ + RimMultiPlot::initAfterRead(); + + for ( auto plot : summaryPlots() ) + { + plot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -560,3 +577,12 @@ void RimSummaryMultiPlot::duplicate() { duplicatePlot.send( this ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::onSubPlotChanged( const caf::SignalEmitter* emitter ) +{ + updatePlotWindowTitle(); + applyPlotWindowTitleToWidgets(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 8f67b5064c..6e5b821757 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -72,6 +72,9 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override; + + void initAfterRead() override; + private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; @@ -87,6 +90,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void updatePlotWindowTitle() override; void duplicate(); + void onSubPlotChanged( const caf::SignalEmitter* emitter ); private: caf::PdmField m_autoPlotTitles; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 2c60d4977e..003c73fb2e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -97,6 +97,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryPlot, "SummaryPlot" ); RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) : RimPlot() , m_isCrossPlot( isCrossPlot ) + , curvesChanged( this ) { CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" ); @@ -1289,6 +1290,8 @@ void RimSummaryPlot::deleteCurves( const std::vector& curves ) RiuPlotMainWindowTools::refreshToolbars(); updateCaseNameHasChanged(); + + curvesChanged.send(); } //-------------------------------------------------------------------------------------------------- @@ -2046,6 +2049,8 @@ void RimSummaryPlot::handleDroppedObjects( const std::vectorscheduleReplot(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 7d4de4bc1f..91ba4e15da 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -79,6 +79,9 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping Q_OBJECT; CAF_PDM_HEADER_INIT; +public: + caf::Signal<> curvesChanged; + public: RimSummaryPlot( bool isCrossPlot = false ); ~RimSummaryPlot() override; From 696c6a15faa45f69a6f499b50c68b11b28ccfe0b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 23 Mar 2022 13:07:08 +0100 Subject: [PATCH 198/406] #8676 QtChart : Create curve legend widget for multiplot --- .../ProjectDataModel/RimPlot.cpp | 10 +++ ApplicationLibCode/ProjectDataModel/RimPlot.h | 3 + .../Summary/RimSummaryPlot.cpp | 28 +++++++ .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 + .../UserInterface/RiuMultiPlotPage.cpp | 11 +++ .../UserInterface/RiuQtChartsPlotCurve.cpp | 54 +++++++------ .../RiuQtChartsPlotCurveSymbol.cpp | 56 +++++++++++++ .../RiuQtChartsPlotCurveSymbol.h | 2 + .../UserInterface/RiuQtChartsPlotWidget.cpp | 7 ++ .../UserInterface/RiuQtChartsPlotWidget.h | 3 + .../UserInterface/RiuQwtPlotLegend.cpp | 26 ++++++ .../UserInterface/RiuQwtPlotLegend.h | 4 + .../UserInterface/RiuQwtPlotTools.cpp | 80 ++++++++++++++++++- .../UserInterface/RiuQwtPlotTools.h | 6 ++ 14 files changed, 267 insertions(+), 25 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index c8db87e8a9..be39945899 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -30,6 +30,8 @@ #include "cafPdmObject.h" +#include "qwt_legend_data.h" + namespace caf { template <> @@ -289,6 +291,14 @@ void RimPlot::handleDroppedObjects( const std::vector& ob { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimPlot::visibleCurvesForLegend() +{ + return {}; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.h b/ApplicationLibCode/ProjectDataModel/RimPlot.h index 5f84ce8d9b..48d7aae63e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.h @@ -35,6 +35,7 @@ class QWheelEvent; class RiuPlotWidget; class RiuPlotCurve; class RiuPlotItem; +class RimPlotCurve; //================================================================================================== /// @@ -101,6 +102,8 @@ class RimPlot : public QObject, public RimPlotWindow virtual caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const; virtual void handleDroppedObjects( const std::vector& objects ); + virtual std::vector visibleCurvesForLegend(); + protected: virtual RiuPlotWidget* doCreatePlotViewWidget( QWidget* parent ) = 0; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 003c73fb2e..97f83d0ce8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1789,6 +1789,34 @@ RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiuPlotAxis plotAxi return axisProperties; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryPlot::visibleCurvesForLegend() +{ + std::vector curves; + + for ( auto c : summaryCurves() ) + { + if ( !c->isCurveVisible() ) continue; + if ( !c->showInLegend() ) continue; + curves.push_back( c ); + } + + for ( auto curveSet : curveSets() ) + { + if ( !curveSet->isCurvesVisible() ) continue; + if ( curveSet->colorMode() == RimEnsembleCurveSetColorManager::ColorMode::SINGLE_COLOR ) + { + auto curveSetCurves = curveSet->curves(); + + if ( !curveSetCurves.empty() ) curves.push_back( curveSetCurves.front() ); + } + } + + return curves; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 91ba4e15da..e16977c485 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -199,6 +199,8 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping RimPlotAxisProperties* addNewAxisProperties( RiaDefines::PlotAxis, const QString& name ); + std::vector visibleCurvesForLegend() override; + public: // RimViewWindow overrides void deleteViewWidget() override; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 68dd1eb9b0..dc635d6158 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -29,13 +29,16 @@ #include "RimContextCommandBuilder.h" #include "RimMultiPlot.h" +#include "RimPlotCurve.h" #include "RimWellLogTrack.h" #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" #include "RiuPlotObjectPicker.h" #include "RiuPlotWidget.h" +#include "RiuQtChartsPlotWidget.h" #include "RiuQwtPlotLegend.h" +#include "RiuQwtPlotTools.h" #include "RiuQwtPlotWidget.h" #include "cafCmdFeatureMenuBuilder.h" @@ -176,6 +179,14 @@ void RiuMultiPlotPage::insertPlot( RiuPlotWidget* plotWidget, size_t index ) SIGNAL( legendDataChanged( const QVariant&, const QList& ) ), SLOT( updateLegend( const QVariant&, const QList& ) ) ); } + else + { + auto qtchartPlotWidget = dynamic_cast( plotWidget ); + legend->connect( qtchartPlotWidget, + SIGNAL( legendDataChanged( const QList& ) ), + SLOT( updateLegend( const QList& ) ) ); + } + QObject::connect( legend, SIGNAL( legendUpdated() ), this, SLOT( onLegendUpdated() ) ); legend->contentsWidget()->layout()->setAlignment( Qt::AlignBottom | Qt::AlignHCenter ); diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index 8916f6d8c4..8faf157f69 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -276,40 +276,48 @@ void RiuQtChartsPlotCurve::setSamplesInPlot( const std::vector& xValues, //-------------------------------------------------------------------------------------------------- void RiuQtChartsPlotCurve::updateScatterSeries() { + if ( !scatterSeries() ) return; + double minX = std::numeric_limits::max(); double maxX = -std::numeric_limits::max(); - QVector points = lineSeries()->pointsVector(); + QVector points; - auto axes = lineSeries()->attachedAxes(); - bool foundAxis = false; - for ( auto axis : axes ) + if ( lineSeries() ) { - if ( axis->orientation() == Qt::Orientation::Horizontal ) + points = lineSeries()->pointsVector(); + + bool foundAxis = false; + + auto axes = lineSeries()->attachedAxes(); + for ( auto axis : axes ) { - QtCharts::QValueAxis* valueAxis = dynamic_cast( axis ); - QtCharts::QDateTimeAxis* dateTimeAxis = dynamic_cast( axis ); - if ( valueAxis ) - { - minX = valueAxis->min(); - maxX = valueAxis->max(); - foundAxis = true; - } - else if ( dateTimeAxis ) + if ( axis->orientation() == Qt::Orientation::Horizontal ) { - minX = dateTimeAxis->min().toMSecsSinceEpoch(); - maxX = dateTimeAxis->max().toMSecsSinceEpoch(); - foundAxis = true; + QtCharts::QValueAxis* valueAxis = dynamic_cast( axis ); + QtCharts::QDateTimeAxis* dateTimeAxis = dynamic_cast( axis ); + if ( valueAxis ) + { + minX = valueAxis->min(); + maxX = valueAxis->max(); + foundAxis = true; + } + else if ( dateTimeAxis ) + { + minX = dateTimeAxis->min().toMSecsSinceEpoch(); + maxX = dateTimeAxis->max().toMSecsSinceEpoch(); + foundAxis = true; + } } } - } - if ( !foundAxis ) - { - for ( auto p : points ) + if ( !foundAxis ) { - minX = std::min( minX, p.x() ); - maxX = std::max( maxX, p.x() ); + for ( auto p : points ) + { + minX = std::min( minX, p.x() ); + maxX = std::max( maxX, p.x() ); + } } } diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp index 50aad6fa70..fe91037e38 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.cpp @@ -138,6 +138,62 @@ void RiuQtChartsPlotCurveSymbol::applyToScatterSeries( QtCharts::QScatterSeries* series->setColor( m_color ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QImage RiuQtChartsPlotCurveSymbol::image() const +{ + if ( m_style == PointSymbolEnum::SYMBOL_NONE ) + { + return QImage(); + } + + if ( m_style == PointSymbolEnum::SYMBOL_RECT ) + { + return createRectImage(); + } + else if ( m_style == PointSymbolEnum::SYMBOL_ELLIPSE ) + { + return createEllipseImage(); + } + else if ( m_style == PointSymbolEnum::SYMBOL_CROSS ) + { + return createCrossImage(); + } + else if ( m_style == PointSymbolEnum::SYMBOL_XCROSS ) + { + return createXCrossImage(); + } + else if ( m_style == PointSymbolEnum::SYMBOL_DIAMOND ) + { + return createDiamondImage(); + } + else if ( m_style == PointSymbolEnum::SYMBOL_HEXAGON ) + { + return createHexagonImage(); + } + else if ( m_style == PointSymbolEnum::SYMBOL_STAR1 ) + { + return createStar1Image(); + } + else if ( m_style == PointSymbolEnum::SYMBOL_STAR1 ) + { + return createStar1Image(); + } + else if ( m_style == PointSymbolEnum::SYMBOL_STAR2 ) + { + return createStar2Image(); + } + else if ( m_style == PointSymbolEnum::SYMBOL_TRIANGLE || m_style == PointSymbolEnum::SYMBOL_UP_TRIANGLE || + m_style == PointSymbolEnum::SYMBOL_DOWN_TRIANGLE || m_style == PointSymbolEnum::SYMBOL_LEFT_TRIANGLE || + m_style == PointSymbolEnum::SYMBOL_RIGHT_TRIANGLE ) + { + return createTriangleImage( m_style ); + } + + return QImage(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h index 7f9a531934..5fd3d02fbf 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurveSymbol.h @@ -60,6 +60,8 @@ class RiuQtChartsPlotCurveSymbol : public RiuPlotCurveSymbol void applyToScatterSeries( QtCharts::QScatterSeries* series ) const; + QImage image() const; + private: QImage createTriangleImage( RiuPlotCurveSymbol::PointSymbolEnum symbolStyle ) const; QImage createRectImage() const; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index adfbb6090b..3cd91a5ace 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -34,6 +34,7 @@ #include "RiuQtChartsPlotCurve.h" #include "RiuQtChartsToolTip.h" #include "RiuQwtDateScaleWrapper.h" +#include "RiuQwtPlotTools.h" #include "caf.h" #include "cafAssert.h" @@ -333,6 +334,7 @@ void RiuQtChartsPlotWidget::clearLegend() { QLegend* legend = qtChart()->legend(); legend->detachFromChart(); + legend->hide(); } //-------------------------------------------------------------------------------------------------- @@ -496,6 +498,11 @@ void RiuQtChartsPlotWidget::updateLayout() void RiuQtChartsPlotWidget::updateLegend() { qtChart()->legend()->update(); + + auto curves = plotDefinition()->visibleCurvesForLegend(); + + auto legendData = RiuQwtPlotTools::createLegendData( curves ); + emit legendDataChanged( legendData ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index bb593885bd..5523c36a54 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -28,6 +28,8 @@ #include "cafPdmObject.h" #include "cafPdmPointer.h" +#include "qwt_legend_data.h" + #include #include @@ -219,6 +221,7 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget signals: void plotZoomed(); + void legendDataChanged( const QList& data ); private slots: void axisRangeChanged(); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp index 5c5e251da9..c98fd6caf9 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp @@ -18,6 +18,7 @@ #include "RiuQwtPlotLegend.h" #include "qwt_dyngrid_layout.h" +#include "qwt_legend_label.h" #include #include @@ -109,3 +110,28 @@ void RiuQwtPlotLegend::updateLegend( const QVariant& variant, const QList& legendData ) +{ + // Delete all existing widgets + deleteAll(); + + // Create legend widgets based on legendData + updateLegend( QVariant(), legendData ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotLegend::deleteAll() +{ + auto widgets = contentsWidget()->findChildren(); + for ( auto w : widgets ) + { + w->hide(); + w->deleteLater(); + } +} diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.h b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.h index ebcc18bea6..e5db48035b 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.h @@ -28,10 +28,14 @@ class RiuQwtPlotLegend : public QwtLegend QSize sizeHint() const override; public slots: void updateLegend( const QVariant&, const QList& ) override; + void updateLegend( const QList& ); signals: void legendUpdated(); +private: + void deleteAll(); + private: int m_columnCount; }; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp index 0a1e0489a9..ef0d774e60 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp @@ -17,14 +17,21 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiuQwtPlotTools.h" -#include "RiuGuiTheme.h" - #include "RiaApplication.h" +#include "RiaColorTools.h" #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" +#include "RimPlotCurve.h" + +#include "RiuGuiTheme.h" +#include "RiuQtChartsPlotCurveSymbol.h" +#include "RiuQwtPlotLegend.h" + #include "qwt_date_scale_draw.h" #include "qwt_date_scale_engine.h" +#include "qwt_graphic.h" +#include "qwt_painter.h" #include "qwt_plot.h" #include "qwt_plot_grid.h" #include "qwt_plot_layout.h" @@ -32,6 +39,7 @@ #include "qwt_scale_widget.h" #include + #include //-------------------------------------------------------------------------------------------------- @@ -266,3 +274,71 @@ RiaDefines::PlotAxis RiuQwtPlotTools::fromQwtPlotAxis( QwtPlot::Axis axis ) return RiaDefines::PlotAxis::PLOT_AXIS_TOP; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotTools::updateLegendData( RiuQwtPlotLegend* legend, const std::vector& curves ) +{ + QList legendDataList = createLegendData( curves ); + + legend->updateLegend( QVariant(), legendDataList ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RiuQwtPlotTools::createLegendData( const std::vector& curves ) +{ + QList legendDataList; + + for ( auto c : curves ) + { + QwtLegendData test; + test.setValue( QwtLegendData::Role::TitleRole, c->curveName() ); + + c->updateUiIconFromPlotSymbol(); + auto icon = c->uiIcon(); + auto size = icon->availableSizes().first(); + // see QwtPlotCurve::legendIcon + + QwtGraphic graphic; + { + graphic.setDefaultSize( size ); + graphic.setRenderHint( QwtGraphic::RenderPensUnscaled, true ); + + QPainter painter( &graphic ); + painter.setRenderHint( QPainter::Antialiasing ); + + { + QPen pn; + pn.setCapStyle( Qt::FlatCap ); + pn.setColor( RiaColorTools::toQColor( c->color() ) ); + + painter.setPen( pn ); + + const double y = 0.5 * size.height(); + QwtPainter::drawLine( &painter, 0.0, y, size.width(), y ); + } + + if ( c->symbol() != RiuQtChartsPlotCurveSymbol::SYMBOL_NONE ) + { + RiuQtChartsPlotCurveSymbol symbol( c->symbol() ); + symbol.setSize( size.height() / 2, size.height() / 2 ); + symbol.setColor( RiaColorTools::toQColor( c->color() ) ); + + auto image = symbol.image(); + + QPoint p( size.width() / 4, size.height() / 4 ); + painter.drawImage( p, image ); + } + } + + QVariant v = QVariant::fromValue( graphic ); + test.setValue( QwtLegendData::Role::IconRole, v ); + + legendDataList.push_back( test ); + } + + return legendDataList; +} diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h index e567f9acae..73c3ab72f5 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h @@ -24,6 +24,9 @@ #include #include +class RiuQwtPlotLegend; +class RimPlotCurve; + class RiuQwtPlotTools { public: @@ -61,6 +64,9 @@ class RiuQwtPlotTools static QwtPlot::Axis toQwtPlotAxis( RiaDefines::PlotAxis ); static RiaDefines::PlotAxis fromQwtPlotAxis( QwtPlot::Axis ); + + static void updateLegendData( RiuQwtPlotLegend* legend, const std::vector& curves ); + static QList createLegendData( const std::vector& curves ); }; //-------------------------------------------------------------------------------------------------- From 8feb0c363b24ed998bb4eceac7ed6a381aa483fa Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 24 Mar 2022 11:22:27 +0100 Subject: [PATCH 199/406] #8307 Input Eclipse Case: Handle trailing line comment --- .../RifEclipseTextFileReader.cpp | 9 +++++++- .../RifEclipseTextFileReader-Test.cpp | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseTextFileReader.cpp b/ApplicationLibCode/FileInterface/RifEclipseTextFileReader.cpp index 255ae2a9e0..d42d186349 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseTextFileReader.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseTextFileReader.cpp @@ -88,7 +88,8 @@ std::pair> { std::vector values; - const auto commentChar = '-'; + const auto commentChar = '-'; + const auto commentString = "--"; std::string keywordName; std::string_view line; @@ -121,6 +122,12 @@ std::pair> if ( keywordName.empty() ) { + auto found = line.find_first_of( commentString ); + if ( found != std::string::npos ) + { + line = line.substr( 0, found ); + } + trim( line ); if ( !line.empty() ) { diff --git a/ApplicationLibCode/UnitTests/RifEclipseTextFileReader-Test.cpp b/ApplicationLibCode/UnitTests/RifEclipseTextFileReader-Test.cpp index 592b91d085..dde1ee92c8 100644 --- a/ApplicationLibCode/UnitTests/RifEclipseTextFileReader-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifEclipseTextFileReader-Test.cpp @@ -82,6 +82,29 @@ TEST( RifEclipseTextFileReader, DISABLED_ReadKeywordsAndValuesPerformanceTest ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( RifEclipseTextFileReader, ReadKeywordsWithComment ) +{ + QString faceTexts = "SPECGRID -- Generated : simulator name\n" + "124 134 41 1 F /\n" + "COORDSYS -- Generated : simulator name\n" + " 1 41 INCOMP /\n "; + + auto stdString = faceTexts.toStdString(); + + size_t bytesRead = 0; + auto objects = RifEclipseTextFileReader::readKeywordAndValues( stdString, 0, bytesRead ); + { + std::string toMatch( "SPECGRID" ); + EXPECT_STREQ( objects.first.data(), toMatch.data() ); + + auto values = objects.second; + EXPECT_FLOAT_EQ( values[0], 124.0 ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- From 8d3f41ded88700e9239a3c97a5448a32f82acc2a Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Fri, 25 Mar 2022 11:39:12 +0100 Subject: [PATCH 200/406] Merge pull request #8732 from OPM/summarymultiplot_updates2 Summary Multiplot updates --- ApplicationLibCode/Application/RiaDefines.cpp | 20 ++++ ApplicationLibCode/Application/RiaDefines.h | 17 ++++ .../Application/RiaPreferences.cpp | 1 + .../Application/RiaPreferencesSummary.cpp | 72 ++++++++++++++ .../Application/RiaPreferencesSummary.h | 15 +++ .../Tools/RiaImportEclipseCaseTools.cpp | 6 +- .../RicNewSummaryMultiPlotFeature.cpp | 93 ++++++++++--------- .../RicNewSummaryMultiPlotFeature.h | 21 ++--- ...wSummaryMultiPlotFromDataVectorFeature.cpp | 2 +- .../RicSummaryPlotBuilder.cpp | 57 +++++++++++- .../RicSummaryPlotBuilder.h | 4 + .../Commands/RicImportEnsembleFeature.cpp | 3 +- .../Commands/RicImportSummaryCasesFeature.cpp | 11 ++- .../RicNewDefaultSummaryPlotFeature.cpp | 25 ++++- .../RicNewSummaryEnsembleCurveSetFeature.h | 4 +- .../RicSummaryPlotEditorUi.cpp | 85 ++++++++--------- .../RicSummaryPlotEditorUi.h | 3 + .../RicSummaryPlotFeatureImpl.cpp | 56 +---------- .../RicDeleteSubPlotFeature.cpp | 10 +- .../RimContextCommandBuilder.cpp | 17 +++- .../ProjectDataModel/RimMultiPlot.cpp | 51 ++++------ .../ProjectDataModel/RimMultiPlot.h | 21 ++--- .../ProjectDataModel/RimPlotWindow.cpp | 2 +- .../Summary/RimSummaryMultiPlot.cpp | 69 +++----------- .../Summary/RimSummaryMultiPlot.h | 7 +- .../UserInterface/RiuDragDrop.cpp | 10 +- .../UserInterface/RiuMainWindowBase.cpp | 1 - .../UserInterface/RiuMultiPlotBook.cpp | 31 ++++++- .../UserInterface/RiuMultiPlotBook.h | 8 +- .../UserInterface/RiuMultiPlotPage.cpp | 2 +- .../UserInterface/RiuMultiPlotPage.h | 10 -- .../UserInterface/RiuPlotMainWindow.cpp | 1 - 32 files changed, 421 insertions(+), 314 deletions(-) diff --git a/ApplicationLibCode/Application/RiaDefines.cpp b/ApplicationLibCode/Application/RiaDefines.cpp index 14b776c50a..fc77aa4405 100644 --- a/ApplicationLibCode/Application/RiaDefines.cpp +++ b/ApplicationLibCode/Application/RiaDefines.cpp @@ -135,6 +135,26 @@ void AppEnum::setUp() setDefault( RiaDefines::RINavigationPolicy::NAVIGATION_POLICY_RMS ); } +template <> +void caf::AppEnum::setUp() +{ + addItem( RiaDefines::ColumnCount::COLUMNS_1, "1", "1 Column" ); + addItem( RiaDefines::ColumnCount::COLUMNS_2, "2", "2 Columns" ); + addItem( RiaDefines::ColumnCount::COLUMNS_3, "3", "3 Columns" ); + addItem( RiaDefines::ColumnCount::COLUMNS_4, "4", "4 Columns" ); + setDefault( RiaDefines::ColumnCount::COLUMNS_2 ); +} + +template <> +void caf::AppEnum::setUp() +{ + addItem( RiaDefines::RowCount::ROWS_1, "1", "1 Row" ); + addItem( RiaDefines::RowCount::ROWS_2, "2", "2 Rows" ); + addItem( RiaDefines::RowCount::ROWS_3, "3", "3 Rows" ); + addItem( RiaDefines::RowCount::ROWS_4, "4", "4 Rows" ); + setDefault( RiaDefines::RowCount::ROWS_2 ); +} + } // namespace caf //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaDefines.h b/ApplicationLibCode/Application/RiaDefines.h index 6bf6a1e3a9..29893e8960 100644 --- a/ApplicationLibCode/Application/RiaDefines.h +++ b/ApplicationLibCode/Application/RiaDefines.h @@ -187,4 +187,21 @@ bool isInjector( WellProductionType wellProductionType ); QString stringListSeparator(); +enum class ColumnCount +{ + COLUMNS_1 = 1, + COLUMNS_2 = 2, + COLUMNS_3 = 3, + COLUMNS_4 = 4, + COLUMNS_UNLIMITED = 1000, +}; + +enum class RowCount +{ + ROWS_1 = 1, + ROWS_2 = 2, + ROWS_3 = 3, + ROWS_4 = 4, +}; + }; // namespace RiaDefines diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index 07f57ac13c..39d0254929 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -288,6 +288,7 @@ void RiaPreferences::defineEditorAttribute( const caf::PdmFieldHandle* field, caf::PdmUiEditorAttribute* attribute ) { m_readerSettings->defineEditorAttribute( field, uiConfigName, attribute ); + m_summaryPreferences->defineEditorAttribute( field, uiConfigName, attribute ); { caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast( attribute ); diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp index c3f3ff2c9b..91c3a17a0e 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp @@ -22,6 +22,7 @@ #include "RiaPreferences.h" #include "cafPdmUiCheckBoxEditor.h" +#include "cafPdmUiComboBoxEditor.h" #include @@ -55,6 +56,7 @@ void RiaPreferencesSummary::SummaryReaderModeType::setUp() addItem( RiaPreferencesSummary::SummaryReaderMode::OPM_COMMON, "OPM_COMMON", "ESMRY (opm-common)" ); setDefault( RiaPreferencesSummary::SummaryReaderMode::HDF5_OPM_COMMON ); } + } // namespace caf CAF_PDM_SOURCE_INIT( RiaPreferencesSummary, "RiaPreferencesSummary" ); @@ -137,6 +139,11 @@ RiaPreferencesSummary::RiaPreferencesSummary() true, "Use Multiple Threads for Import of Summary Files" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useMultipleThreadsWhenLoadingSummaryCases ); + + CAF_PDM_InitFieldNoDefault( &m_defaultColumnCount, "DefaultNumberOfColumns", "Columns" ); + m_defaultColumnCount = RiaDefines::ColumnCount::COLUMNS_2; + CAF_PDM_InitFieldNoDefault( &m_defaultRowsPerPage, "DefaultRowsPerPage", "Rows per Page" ); + m_defaultRowsPerPage = RiaDefines::RowCount::ROWS_2; } //-------------------------------------------------------------------------------------------------- @@ -221,6 +228,11 @@ void RiaPreferencesSummary::appendItemsToPlottingGroup( caf::PdmUiOrdering& uiOr uiOrdering.add( &m_defaultSummaryCurvesTextFilter ); uiOrdering.add( &m_defaultSummaryHistoryCurveStyle ); uiOrdering.add( &m_showSummaryTimeAsLongString ); + + auto multiGroup = uiOrdering.addNewGroup( "Multi Plot Defaults" ); + + multiGroup->add( &m_defaultColumnCount ); + multiGroup->add( &m_defaultRowsPerPage ); } //-------------------------------------------------------------------------------------------------- @@ -316,6 +328,23 @@ void RiaPreferencesSummary::defineUiOrdering( QString uiConfigName, caf::PdmUiOr uiOrdering.skipRemainingFields(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaPreferencesSummary::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + if ( field == &m_defaultRowsPerPage || field == &m_defaultColumnCount ) + { + auto myattr = dynamic_cast( attribute ); + if ( myattr ) + { + myattr->iconSize = QSize( 24, 16 ); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -362,6 +391,49 @@ QList options.push_back( caf::PdmOptionItemInfo( allowImport.uiText(), RiaPreferencesSummary::SummaryRestartFilesImportMode::IMPORT ) ); } + else if ( fieldNeedingOptions == &m_defaultColumnCount ) + { + for ( size_t i = 0; i < ColumnCountEnum::size(); ++i ) + { + RiaDefines::ColumnCount enumVal = ColumnCountEnum::fromIndex( i ); + QString columnCountString = ( enumVal == RiaDefines::ColumnCount::COLUMNS_UNLIMITED ) + ? "Unlimited" + : QString( "%1" ).arg( static_cast( enumVal ) ); + QString iconPath = QString( ":/Columns%1.png" ).arg( columnCountString ); + options.push_back( caf::PdmOptionItemInfo( ColumnCountEnum::uiText( enumVal ), + enumVal, + false, + caf::IconProvider( iconPath, QSize( 24, 16 ) ) ) ); + } + } + else if ( fieldNeedingOptions == &m_defaultRowsPerPage ) + { + for ( size_t i = 0; i < RowCountEnum::size(); ++i ) + { + RiaDefines::RowCount enumVal = RowCountEnum::fromIndex( i ); + QString iconPath = QString( ":/Rows%1.png" ).arg( static_cast( enumVal ) ); + options.push_back( caf::PdmOptionItemInfo( RowCountEnum::uiText( enumVal ), + enumVal, + false, + caf::IconProvider( iconPath, QSize( 24, 16 ) ) ) ); + } + } return options; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::ColumnCount RiaPreferencesSummary::defaultMultiPlotColumnCount() const +{ + return m_defaultColumnCount(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::RowCount RiaPreferencesSummary::defaultMultiPlotRowCount() const +{ + return m_defaultRowsPerPage(); +} diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.h b/ApplicationLibCode/Application/RiaPreferencesSummary.h index a7d267cc77..3824c13fc7 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.h +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.h @@ -22,6 +22,8 @@ #include "cafPdmField.h" #include "cafPdmObject.h" +#include "RiaDefines.h" + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -54,6 +56,9 @@ class RiaPreferencesSummary : public caf::PdmObject }; using SummaryHistoryCurveStyleModeType = caf::AppEnum; + using ColumnCountEnum = caf::AppEnum; + using RowCountEnum = caf::AppEnum; + public: RiaPreferencesSummary(); @@ -80,6 +85,13 @@ class RiaPreferencesSummary : public caf::PdmObject SummaryHistoryCurveStyleMode defaultSummaryHistoryCurveStyle() const; + RiaDefines::ColumnCount defaultMultiPlotColumnCount() const; + RiaDefines::RowCount defaultMultiPlotRowCount() const; + + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; + protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, @@ -104,4 +116,7 @@ class RiaPreferencesSummary : public caf::PdmObject caf::PdmField m_createH5SummaryFileThreadCount; caf::PdmField m_summaryReader; + + caf::PdmField m_defaultColumnCount; + caf::PdmField m_defaultRowsPerPage; }; diff --git a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp index aa24155225..4059b437ba 100644 --- a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp @@ -20,6 +20,7 @@ #include "ApplicationCommands/RicShowMainWindowFeature.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "SummaryPlotCommands/RicNewSummaryCurveFeature.h" #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" @@ -195,10 +196,7 @@ bool RiaImportEclipseCaseTools::openEclipseCasesFromFile( const QStringList& if ( !newSumCases.empty() ) { - RimSummaryPlotCollection* summaryPlotColl = project->mainPlotCollection()->summaryPlotCollection(); - - RicSummaryPlotFeatureImpl::ensureAtLeastOnePlot( summaryPlotColl, newSumCases.front() ); - + RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( { newSumCases.front() }, {} ); RiuPlotMainWindowTools::setExpanded( newSumCases.front() ); } } diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp index decf510dd2..efcda8508f 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp @@ -18,8 +18,12 @@ #include "RicNewSummaryMultiPlotFeature.h" -#include "RimMultiPlotCollection.h" +#include "RicSummaryPlotBuilder.h" + +#include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" #include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" #include "RicSummaryPlotBuilder.h" @@ -29,27 +33,23 @@ #include -RICF_SOURCE_INIT( RicNewSummaryMultiPlotFeature, "RicNewSummaryMultiPlotFeature", "createSummaryMultiPlot" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RicNewSummaryMultiPlotFeature::RicNewSummaryMultiPlotFeature() -{ - CAF_PDM_InitFieldNoDefault( &m_plots, "plots", "Plots" ); -} +CAF_CMD_SOURCE_INIT( RicNewSummaryMultiPlotFeature, "RicNewSummaryMultiPlotFeature" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool RicNewSummaryMultiPlotFeature::isCommandEnabled() { - auto plots = selectedPlots(); - std::vector selectedUiItems; caf::SelectionManager::instance()->selectedItems( selectedUiItems ); - return !plots.empty() && plots.size() == selectedUiItems.size(); + if ( selectedCollection( selectedUiItems ) ) return true; + + std::vector selectedIndividualSummaryCases; + std::vector selectedEnsembles; + if ( selectedCases( &selectedIndividualSummaryCases, &selectedEnsembles ) ) return true; + + return false; } //-------------------------------------------------------------------------------------------------- @@ -57,13 +57,25 @@ bool RicNewSummaryMultiPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicNewSummaryMultiPlotFeature::onActionTriggered( bool isChecked ) { - m_plots.v().clear(); - auto plots = selectedPlots(); - for ( RimPlot* plot : plots ) + std::vector selectedUiItems; + caf::SelectionManager::instance()->selectedItems( selectedUiItems ); + + RimSummaryMultiPlotCollection* coll = selectedCollection( selectedUiItems ); + if ( coll ) + { + std::vector objects = {}; + RimSummaryMultiPlot* multiPlot = RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( objects ); + + return; + } + + std::vector selectedIndividualSummaryCases; + std::vector selectedEnsembles; + + if ( selectedCases( &selectedIndividualSummaryCases, &selectedEnsembles ) ) { - m_plots.v().push_back( reinterpret_cast( plot ) ); + RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( selectedIndividualSummaryCases, selectedEnsembles ); } - execute(); } //-------------------------------------------------------------------------------------------------- @@ -71,47 +83,42 @@ void RicNewSummaryMultiPlotFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicNewSummaryMultiPlotFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText( "Create Summary Multi Plot from Selected Plots" ); + actionToSetup->setText( "New Summary Plot" ); actionToSetup->setIcon( QIcon( ":/MultiPlot16x16.png" ) ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RicNewSummaryMultiPlotFeature::selectedPlots() +RimSummaryMultiPlotCollection* RicNewSummaryMultiPlotFeature::selectedCollection( std::vector& items ) { - std::vector uiItems; - caf::SelectionManager::instance()->selectedItems( uiItems ); - - std::vector plots; - for ( caf::PdmUiItem* uiItem : uiItems ) + for ( caf::PdmUiItem* uiItem : items ) { - RimSummaryPlot* summaryPlot = dynamic_cast( uiItem ); - if ( summaryPlot ) - { - plots.push_back( summaryPlot ); - } + RimSummaryMultiPlotCollection* coll = dynamic_cast( uiItem ); + if ( coll ) return coll; } - return plots; + return nullptr; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -caf::PdmScriptResponse RicNewSummaryMultiPlotFeature::execute() +bool RicNewSummaryMultiPlotFeature::selectedCases( std::vector* selectedIndividualSummaryCases, + std::vector* selectedEnsembles ) { - if ( !m_plots().empty() ) - { - std::vector plots; - for ( auto ptr : m_plots() ) - { - plots.push_back( reinterpret_cast( ptr ) ); - } - - auto copyOfPlots = RicSummaryPlotBuilder::duplicateSummaryPlots( plots ); + CAF_ASSERT( selectedIndividualSummaryCases && selectedEnsembles ); - RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( copyOfPlots ); + caf::SelectionManager::instance()->objectsByTypeStrict( selectedEnsembles ); + if ( !selectedEnsembles->empty() ) + { + return true; + } + // Second try selected summary cases + caf::SelectionManager::instance()->objectsByTypeStrict( selectedIndividualSummaryCases ); + if ( !selectedIndividualSummaryCases->empty() ) + { + return true; } - return caf::PdmScriptResponse(); + return false; } diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h index 67c9370ce1..bc16de116b 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.h @@ -18,26 +18,22 @@ #pragma once -#include "RicfCommandObject.h" - #include "cafCmdFeature.h" #include "cafPdmField.h" +#include "cafPdmUiItem.h" #include -class RimSummaryPlot; +class RimSummaryMultiPlotCollection; +class RimSummaryCase; +class RimSummaryCaseCollection; //================================================================================================== /// //================================================================================================== -class RicNewSummaryMultiPlotFeature : public caf::CmdFeature, public RicfCommandObject +class RicNewSummaryMultiPlotFeature : public caf::CmdFeature { - RICF_HEADER_INIT; - -public: - RicNewSummaryMultiPlotFeature(); - - caf::PdmScriptResponse execute() override; + CAF_CMD_HEADER_INIT; protected: bool isCommandEnabled() override; @@ -45,7 +41,8 @@ class RicNewSummaryMultiPlotFeature : public caf::CmdFeature, public RicfCommand void setupActionLook( QAction* actionToSetup ) override; private: - static std::vector selectedPlots(); + RimSummaryMultiPlotCollection* selectedCollection( std::vector& items ); - caf::PdmField> m_plots; + bool selectedCases( std::vector* selectedIndividualSummaryCases, + std::vector* selectedEnsembles ); }; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp index 0ef4b3f488..24baa42c6b 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp @@ -110,6 +110,6 @@ void RicNewSummaryMultiPlotFromDataVectorFeature::onActionTriggered( bool isChec //-------------------------------------------------------------------------------------------------- void RicNewSummaryMultiPlotFromDataVectorFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText( "New Multi Summary Plot" ); + actionToSetup->setText( "New Summary Plot" ); actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); } diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 690c3bb457..58a10c87a4 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -18,6 +18,9 @@ #include "RicSummaryPlotBuilder.h" +#include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h" +#include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" + #include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryTools.h" @@ -357,7 +360,8 @@ RimSummaryMultiPlot* plotCollection->updateAllRequiredEditors(); plotWindow->loadDataAndUpdate(); - RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); + RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); + RiuPlotMainWindowTools::setExpanded( plotWindow, true ); return plotWindow; } @@ -369,7 +373,7 @@ void RicSummaryPlotBuilder::appendPlotsToMultiPlot( RimMultiPlot* multiPlot, con { for ( auto plot : plots ) { - // Remove the currently window controller, as this will be managed by the multi plot + // Remove the current window controller, as this will be managed by the multi plot // This must be done before adding the plot to the multi plot to ensure that the viewer widget is recreated plot->revokeMdiWindowStatus(); @@ -382,6 +386,50 @@ void RicSummaryPlotBuilder::appendPlotsToMultiPlot( RimMultiPlot* multiPlot, con } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot* + RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( const std::vector& cases, + const std::vector& ensembles ) +{ + RimProject* project = RimProject::current(); + auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); + + auto* plotWindow = new RimSummaryMultiPlot(); + plotWindow->setAsPlotMdiWindow(); + plotCollection->addSummaryMultiPlot( plotWindow ); + + RimSummaryPlot* plot = new RimSummaryPlot(); + plot->setAsPlotMdiWindow(); + plot->enableAutoPlotTitle( true ); + + for ( auto sumCase : cases ) + { + RicSummaryPlotFeatureImpl::addDefaultCurvesToPlot( plot, sumCase ); + } + + for ( auto ensemble : ensembles ) + { + RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSets( plot, ensemble ); + } + + plot->applyDefaultCurveAppearances(); + plot->loadDataAndUpdate(); + + plotCollection->updateConnectedEditors(); + + appendPlotsToSummaryMultiPlot( plotWindow, { plot } ); + + plotCollection->updateAllRequiredEditors(); + plotWindow->loadDataAndUpdate(); + plotWindow->updateAllRequiredEditors(); + + RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); + + return plotWindow; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -391,7 +439,6 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); auto* plotWindow = new RimSummaryMultiPlot(); - plotWindow->setMultiPlotTitle( QString( "Multi Summary Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) ); plotWindow->setAsPlotMdiWindow(); plotCollection->addSummaryMultiPlot( plotWindow ); @@ -399,10 +446,10 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con plotCollection->updateAllRequiredEditors(); plotWindow->loadDataAndUpdate(); - - RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); plotWindow->updateAllRequiredEditors(); + RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); + return plotWindow; } diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h index 2328846a74..aebc65cce7 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h @@ -75,6 +75,10 @@ class RicSummaryPlotBuilder static RimMultiPlot* createAndAppendMultiPlot( const std::vector& plots ); static void appendPlotsToMultiPlot( RimMultiPlot* multiPlot, const std::vector& plots ); + static RimSummaryMultiPlot* + createAndAppendDefaultSummaryMultiPlot( const std::vector& cases, + const std::vector& ensembles ); + static RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vector& plots ); static RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vector& objects ); static void appendPlotsToSummaryMultiPlot( RimSummaryMultiPlot* multiPlot, const std::vector& plots ); diff --git a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp index 5a24a893bf..96a0433e7d 100644 --- a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp @@ -44,6 +44,7 @@ #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h" #include @@ -123,7 +124,7 @@ void RicImportEnsembleFeature::importSingleEnsemble( const QStringList& summaryCase->updateAutoShortName(); } - RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetsAndUpdate( { ensemble } ); + RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( {}, { ensemble } ); } std::vector allCases; diff --git a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp index 8cc3c057ce..d0d94415a6 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp @@ -36,6 +36,7 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" @@ -43,6 +44,7 @@ #include "RiuPlotMainWindow.h" #include "RiuPlotMainWindowTools.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h" #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" @@ -83,11 +85,9 @@ void RicImportSummaryCasesFeature::onActionTriggered( bool isChecked ) addSummaryCases( cases ); if ( !cases.empty() ) { - auto objectToSelect = RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( cases.front() ); - if ( objectToSelect ) + for ( auto sumcase : cases ) { - RiuPlotMainWindowTools::setExpanded( objectToSelect ); - RiuPlotMainWindowTools::selectAsCurrentItem( objectToSelect ); + RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( { sumcase }, {} ); } } @@ -136,7 +136,8 @@ bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles( const QStr addSummaryCases( *cases ); if ( !cases->empty() && doCreateDefaultPlot ) { - auto objectToSelect = RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( cases->back() ); + auto objectToSelect = RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( { cases->back() }, {} ); + if ( objectToSelect ) { RiuPlotMainWindowTools::setExpanded( objectToSelect ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp index 25b78cc2df..f759e2f163 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp @@ -20,6 +20,7 @@ #include "RiaSummaryTools.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RicEditSummaryPlotFeature.h" #include "RicNewSummaryCurveFeature.h" #include "RicNewSummaryEnsembleCurveSetFeature.h" @@ -36,6 +37,7 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" @@ -129,6 +131,13 @@ RimSummaryPlot* RicNewDefaultSummaryPlotFeature::createFromSummaryCases( RimSumm //-------------------------------------------------------------------------------------------------- bool RicNewDefaultSummaryPlotFeature::isCommandEnabled() { + RimSummaryMultiPlot* multiPlot = + dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + if ( multiPlot ) + { + return true; + } + std::vector selectedIndividualSummaryCases; std::vector selectedEnsembles; @@ -152,6 +161,16 @@ bool RicNewDefaultSummaryPlotFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicNewDefaultSummaryPlotFeature::onActionTriggered( bool isChecked ) { + RimSummaryMultiPlot* multiPlot = + dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + if ( multiPlot ) + { + RimSummaryPlot* plot = new RimSummaryPlot(); + plot->enableAutoPlotTitle( true ); + RicSummaryPlotBuilder::appendPlotsToSummaryMultiPlot( multiPlot, { plot } ); + return; + } + std::vector selectedIndividualSummaryCases; std::vector selectedEnsembles; extractPlotObjectsFromSelection( &selectedIndividualSummaryCases, &selectedEnsembles ); @@ -178,13 +197,13 @@ void RicNewDefaultSummaryPlotFeature::setupActionLook( QAction* actionToSetup ) extractPlotObjectsFromSelection( &selectedIndividualSummaryCases, &selectedEnsembles ); - if ( !selectedIndividualSummaryCases.empty() ) + if ( !selectedEnsembles.empty() ) { - actionToSetup->setText( "New Summary Plot" ); + actionToSetup->setText( "Add Ensemble Summary Plot" ); } else { - actionToSetup->setText( "New Ensemble Summary Plot" ); + actionToSetup->setText( "Add Summary Plot" ); } actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h index 4089320943..8612987488 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h @@ -35,15 +35,13 @@ class RicNewSummaryEnsembleCurveSetFeature : public caf::CmdFeature public: static RimSummaryPlot* createPlotForCurveSetsAndUpdate( std::vector ensembles ); + static std::vector addDefaultCurveSets( RimSummaryPlot* plot, RimSummaryCaseCollection* ensemble ); protected: bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; -private: - static std::vector addDefaultCurveSets( RimSummaryPlot* plot, RimSummaryCaseCollection* ensemble ); - private: RimSummaryPlot* selectedSummaryPlot() const; }; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index 6d485b7b33..34fffe857f 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -42,6 +42,7 @@ #include "RimSummaryCurve.h" #include "RimSummaryCurveAutoName.h" #include "RimSummaryCurveCollection.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" @@ -83,6 +84,7 @@ std::vector toVector( const std::set& set ); /// //-------------------------------------------------------------------------------------------------- RicSummaryPlotEditorUi::RicSummaryPlotEditorUi() + : m_plotContainer( nullptr ) { CAF_PDM_InitFieldNoDefault( &m_targetPlot, "TargetPlot", "Target Plot" ); @@ -162,6 +164,7 @@ void RicSummaryPlotEditorUi::updateFromSummaryPlot( RimSummaryPlot* if ( m_targetPlot ) { + targetPlot->firstAncestorOfType( m_plotContainer ); populateCurveCreator( *m_targetPlot ); syncPreviewCurvesFromUiSelection(); setInitialCurveVisibility( targetPlot ); @@ -172,6 +175,7 @@ void RicSummaryPlotEditorUi::updateFromSummaryPlot( RimSummaryPlot* setDefaultCurveSelection( defaultSources ); m_previewPlot->enableAutoPlotTitle( true ); syncPreviewCurvesFromUiSelection(); + m_plotContainer = nullptr; } caf::PdmUiItem::updateConnectedEditors(); @@ -262,19 +266,25 @@ QList { QList options; - if ( fieldNeedingOptions == &m_targetPlot ) + if ( m_targetPlot && ( fieldNeedingOptions == &m_targetPlot ) ) { - RimProject* proj = RimProject::current(); - - RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection(); - // Create New Plot item QString displayName = "( New Plot )"; options.push_back( caf::PdmOptionItemInfo( displayName, nullptr ) ); - if ( summaryPlotColl ) + if ( m_plotContainer ) + { + m_plotContainer->summaryPlotItemInfos( &options ); + } + else { - summaryPlotColl->summaryPlotItemInfos( &options ); + RimProject* proj = RimProject::current(); + + RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection(); + if ( summaryPlotColl ) + { + summaryPlotColl->summaryPlotItemInfos( &options ); + } } } @@ -841,52 +851,39 @@ void RicSummaryPlotEditorUi::createNewPlot() { RimProject* proj = RimProject::current(); + RimSummaryPlot* newSummaryPlot = nullptr; + RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection(); - if ( summaryPlotColl ) + + if ( m_plotContainer ) { - RimSummaryPlot* newSummaryPlot = nullptr; - if ( m_useAutoPlotTitleProxy() ) - { - newSummaryPlot = summaryPlotColl->createSummaryPlotWithAutoTitle(); - } - else - { - QString candidatePlotName; - if ( m_previewPlot ) - { - candidatePlotName = m_previewPlot->generatedPlotTitleFromAllCurves(); - } + newSummaryPlot = new RimSummaryPlot(); + newSummaryPlot->setAsPlotMdiWindow(); + newSummaryPlot->enableAutoPlotTitle( true ); + m_plotContainer->addPlot( newSummaryPlot ); + } + else if ( summaryPlotColl ) + { + newSummaryPlot = summaryPlotColl->createSummaryPlotWithAutoTitle(); + } - { - bool ok = false; - candidatePlotName = QInputDialog::getText( nullptr, - "New Summary Plot Name", - "New Summary Plot Name", - QLineEdit::Normal, - candidatePlotName, - &ok, - RiuTools::defaultDialogFlags() ); - if ( !ok ) - { - return; - } + if ( newSummaryPlot ) + { + newSummaryPlot->loadDataAndUpdate(); - newSummaryPlot = summaryPlotColl->createNamedSummaryPlot( candidatePlotName ); - } + if ( m_plotContainer ) + { + m_plotContainer->updateConnectedEditors(); } - - if ( newSummaryPlot ) + else if ( summaryPlotColl ) { - newSummaryPlot->loadDataAndUpdate(); - summaryPlotColl->updateConnectedEditors(); + } - m_targetPlot = newSummaryPlot; - updateTargetPlot(); + m_targetPlot = newSummaryPlot; - RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); - } + RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); + mainPlotWindow->updateSummaryPlotToolBar(); } } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h index 850d071660..668015bc94 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h @@ -41,6 +41,7 @@ class PdmObject; }; class RimSummaryCase; +class RimSummaryMultiPlot; class RimSummaryCurveAutoName; class RimSummaryPlot; class RiaSummaryCurveDefinition; @@ -133,4 +134,6 @@ class RicSummaryPlotEditorUi : public caf::PdmObject caf::PdmField m_closeButtonField; std::unique_ptr m_summaryCurveSelectionEditor; + + RimSummaryMultiPlot* m_plotContainer; }; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index 3a8ff1bcd1..8e5cdd0da7 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -51,6 +51,7 @@ #include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCurve.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" @@ -78,61 +79,6 @@ std::vector RicSummaryPlotFeatureImpl::addDefaultCurvesToPlot( return addCurvesFromAddressFiltersToPlot( curveFilters, plot, summaryCase, addHistoryCurve ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicSummaryPlotFeatureImpl::ensureAtLeastOnePlot( RimSummaryPlotCollection* summaryPlotCollection, - RimSummaryCase* summaryCase ) -{ - if ( summaryPlotCollection && summaryCase ) - { - if ( summaryPlotCollection->plots().empty() ) - { - auto objectToSelect = createDefaultSummaryPlot( summaryCase ); - if ( objectToSelect ) - { - RiuPlotMainWindowTools::setExpanded( objectToSelect ); - RiuPlotMainWindowTools::selectAsCurrentItem( objectToSelect ); - } - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmObject* RicSummaryPlotFeatureImpl::createDefaultSummaryPlot( RimSummaryCase* summaryCase ) -{ - RimSummaryPlotCollection* summaryPlotCollection = RimProject::current()->mainPlotCollection->summaryPlotCollection(); - - RiaPreferencesSummary* prefs = RiaPreferencesSummary::current(); - - caf::PdmObject* itemToSelect = nullptr; - - if ( summaryPlotCollection && summaryCase && !prefs->defaultSummaryCurvesTextFilter().isEmpty() ) - { - auto plot = summaryPlotCollection->createSummaryPlotWithAutoTitle(); - - std::vector curves = RicSummaryPlotFeatureImpl::addDefaultCurvesToPlot( plot, summaryCase ); - - plot->applyDefaultCurveAppearances(); - plot->loadDataAndUpdate(); - - summaryPlotCollection->updateConnectedEditors(); - - if ( curves.size() ) - { - itemToSelect = curves[0]; - } - else - { - itemToSelect = plot; - } - } - - return itemToSelect; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp index 46e328c56c..ec5b74e0f2 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp @@ -77,6 +77,12 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked ) caf::SelectionManager::instance()->objectsByType( &selection ); std::set alteredPlotWindows; + for ( RimPlot* plot : selection ) + { + if ( !plot ) continue; + caf::SelectionManager::instance()->removeObjectFromAllSelections( plot ); + } + for ( RimPlot* plot : selection ) { if ( !plot ) continue; @@ -89,8 +95,6 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked ) { alteredPlotWindows.insert( multiPlot ); multiPlot->removePlot( plot ); - caf::SelectionManager::instance()->removeObjectFromAllSelections( plot ); - multiPlot->updateConnectedEditors(); delete plot; } @@ -98,8 +102,6 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked ) { alteredPlotWindows.insert( wellLogPlot ); wellLogPlot->removePlot( plot ); - caf::SelectionManager::instance()->removeObjectFromAllSelections( plot ); - wellLogPlot->updateConnectedEditors(); delete plot; } diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 8880f2fa59..32de1ab957 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -126,6 +126,8 @@ #include "RimSummaryCrossPlotCollection.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" #include "RimSurface.h" @@ -564,6 +566,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "Separator"; menuBuilder << "RicShowSummaryCurveCalculatorFeature"; } + else if ( dynamic_cast( firstUiItem ) ) + { + menuBuilder << "RicNewSummaryMultiPlotFeature"; + } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewAnalysisPlotFeature"; @@ -768,6 +774,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicImportEnsembleFeature"; menuBuilder.subMenuEnd(); menuBuilder.addSeparator(); + menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; @@ -785,6 +792,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicImportEnsembleFeature"; menuBuilder.subMenuEnd(); menuBuilder.addSeparator(); + menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; @@ -1023,6 +1031,12 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() { menuBuilder << "RicReloadPlotTemplatesFeature"; } + else if ( dynamic_cast( firstUiItem ) ) + { + menuBuilder << "RicNewDefaultSummaryPlotFeature"; + menuBuilder << "Separator"; + menuBuilder << "RicSnapshotViewToPdfFeature"; + } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicSnapshotViewToPdfFeature"; @@ -1062,10 +1076,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicShowPlotDataFeature"; menuBuilder << "RicShowTotalAllocationDataFeature"; + menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewDefaultSummaryPlotFeature"; - menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder << "RicSummaryCurveSwitchAxisFeature"; menuBuilder << "RicNewDerivedSummaryFeature"; @@ -1188,7 +1202,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() } else if ( dynamic_cast( firstUiItem ) ) { - menuBuilder << "RicNewSummaryPlotFromDataVectorFeature"; menuBuilder << "RicNewSummaryMultiPlotFromDataVectorFeature"; } #ifdef USE_ODB_API diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index a32eaa7530..59bd6ea1a5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -19,6 +19,7 @@ #include "RimMultiPlot.h" #include "RiaPreferences.h" +#include "RiaPreferencesSummary.h" #include "RimPlot.h" #include "RimProject.h" @@ -37,29 +38,6 @@ #include -namespace caf -{ -template <> -void RimMultiPlot::ColumnCountEnum::setUp() -{ - addItem( RimMultiPlot::ColumnCount::COLUMNS_1, "1", "1 Column" ); - addItem( RimMultiPlot::ColumnCount::COLUMNS_2, "2", "2 Columns" ); - addItem( RimMultiPlot::ColumnCount::COLUMNS_3, "3", "3 Columns" ); - addItem( RimMultiPlot::ColumnCount::COLUMNS_4, "4", "4 Columns" ); - setDefault( RimMultiPlot::ColumnCount::COLUMNS_2 ); -} -template <> -void RimMultiPlot::RowCountEnum::setUp() -{ - addItem( RimMultiPlot::RowCount::ROWS_1, "1", "1 Row" ); - addItem( RimMultiPlot::RowCount::ROWS_2, "2", "2 Rows" ); - addItem( RimMultiPlot::RowCount::ROWS_3, "3", "3 Rows" ); - addItem( RimMultiPlot::RowCount::ROWS_4, "4", "4 Rows" ); - setDefault( RimMultiPlot::RowCount::ROWS_2 ); -} - -} // namespace caf - CAF_PDM_SOURCE_INIT( RimMultiPlot, "MultiPlot" ); //-------------------------------------------------------------------------------------------------- @@ -77,8 +55,11 @@ RimMultiPlot::RimMultiPlot() auto reorderability = caf::PdmFieldReorderCapability::addToField( &m_plots ); reorderability->orderChanged.connect( this, &RimMultiPlot::onPlotsReordered ); + RiaPreferencesSummary* sumPrefs = RiaPreferencesSummary::current(); CAF_PDM_InitFieldNoDefault( &m_columnCount, "NumberOfColumns", "Number of Columns" ); + m_columnCount = sumPrefs->defaultMultiPlotColumnCount(); CAF_PDM_InitFieldNoDefault( &m_rowsPerPage, "RowsPerPage", "Rows per Page" ); + m_rowsPerPage = sumPrefs->defaultMultiPlotRowCount(); CAF_PDM_InitField( &m_showIndividualPlotTitles, "ShowPlotTitles", true, "Show Sub Plot Titles" ); CAF_PDM_InitFieldNoDefault( &m_majorTickmarkCount, "MajorTickmarkCount", "Major Tickmark Count" ); @@ -401,7 +382,7 @@ void RimMultiPlot::setAutoScaleYEnabled( bool enabled ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimMultiPlot::setColumnCount( RiuMultiPlotPage::ColumnCount columnCount ) +void RimMultiPlot::setColumnCount( RiaDefines::ColumnCount columnCount ) { m_columnCount = columnCount; } @@ -409,7 +390,7 @@ void RimMultiPlot::setColumnCount( RiuMultiPlotPage::ColumnCount columnCount ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimMultiPlot::setRowCount( RowCount rowCount ) +void RimMultiPlot::setRowCount( RiaDefines::RowCount rowCount ) { m_rowsPerPage = rowCount; } @@ -440,7 +421,7 @@ void RimMultiPlot::setTickmarkCount( RimPlot* plot, RimPlotAxisPropertiesInterfa //-------------------------------------------------------------------------------------------------- int RimMultiPlot::columnCount() const { - if ( m_columnCount() == ColumnCount::COLUMNS_UNLIMITED ) + if ( m_columnCount() == RiaDefines::ColumnCount::COLUMNS_UNLIMITED ) { return std::numeric_limits::max(); } @@ -452,22 +433,22 @@ int RimMultiPlot::columnCount() const //-------------------------------------------------------------------------------------------------- int RimMultiPlot::rowsPerPage() const { - RimMultiPlot::RowCount rowEnum = m_rowsPerPage().value(); + RiaDefines::RowCount rowEnum = m_rowsPerPage().value(); int rowCount = 2; switch ( rowEnum ) { - case RimMultiPlot::RowCount::ROWS_1: + case RiaDefines::RowCount::ROWS_1: rowCount = 1; break; - case RimMultiPlot::RowCount::ROWS_2: + case RiaDefines::RowCount::ROWS_2: rowCount = 2; break; - case RimMultiPlot::RowCount::ROWS_3: + case RiaDefines::RowCount::ROWS_3: rowCount = 3; break; - case RimMultiPlot::RowCount::ROWS_4: + case RiaDefines::RowCount::ROWS_4: rowCount = 4; break; default: @@ -754,8 +735,8 @@ QList RimMultiPlot::calculateValueOptions( const caf::Pd { for ( size_t i = 0; i < ColumnCountEnum::size(); ++i ) { - ColumnCount enumVal = ColumnCountEnum::fromIndex( i ); - QString columnCountString = ( enumVal == ColumnCount::COLUMNS_UNLIMITED ) + RiaDefines::ColumnCount enumVal = ColumnCountEnum::fromIndex( i ); + QString columnCountString = ( enumVal == RiaDefines::ColumnCount::COLUMNS_UNLIMITED ) ? "Unlimited" : QString( "%1" ).arg( static_cast( enumVal ) ); QString iconPath = QString( ":/Columns%1.png" ).arg( columnCountString ); @@ -769,8 +750,8 @@ QList RimMultiPlot::calculateValueOptions( const caf::Pd { for ( size_t i = 0; i < RowCountEnum::size(); ++i ) { - RowCount enumVal = RowCountEnum::fromIndex( i ); - QString iconPath = QString( ":/Rows%1.png" ).arg( static_cast( enumVal ) ); + RiaDefines::RowCount enumVal = RowCountEnum::fromIndex( i ); + QString iconPath = QString( ":/Rows%1.png" ).arg( static_cast( enumVal ) ); options.push_back( caf::PdmOptionItemInfo( RowCountEnum::uiText( enumVal ), enumVal, false, diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 7107db02ae..0a1b0e3f95 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -18,6 +18,8 @@ #pragma once +#include "RiaDefines.h" + #include "RimAbstractPlotCollection.h" #include "RimPlot.h" #include "RimPlotAxisPropertiesInterface.h" @@ -44,19 +46,8 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection; - - enum class RowCount - { - ROWS_1 = 1, - ROWS_2 = 2, - ROWS_3 = 3, - ROWS_4 = 4, - }; - using RowCountEnum = caf::AppEnum; - - friend class RimSummaryMultiPlot; + using ColumnCountEnum = caf::AppEnum; + using RowCountEnum = caf::AppEnum; public: RimMultiPlot(); @@ -90,8 +81,8 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection( RiuMultiPlotPage::ColumnCount::COLUMNS_UNLIMITED ); + return static_cast( RiaDefines::ColumnCount::COLUMNS_UNLIMITED ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 1e999d1ca3..f89cfa52e4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -327,6 +327,7 @@ void RimSummaryMultiPlot::updatePlotWindowTitle() populateNameHelper( m_nameHelper.get() ); auto title = m_nameHelper->plotTitle(); + if ( title.isEmpty() ) title = "Empty Plot"; setMultiPlotTitle( title ); } @@ -386,62 +387,6 @@ std::vector RimSummaryMultiPlot::summaryPlots() const return typedPlots; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const std::vector& graphs ) -{ - auto columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_2; - auto rowCount = RimMultiPlot::RowCount::ROWS_2; - auto tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT; - - bool showTitleSubGraph = true; - if ( graphs.size() == 1 ) - { - showTitleSubGraph = false; - tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_MANY; - } - else if ( 4 < graphs.size() && graphs.size() <= 6 ) - { - columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_3; - rowCount = RimMultiPlot::RowCount::ROWS_2; - tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW; - } - else if ( 6 < graphs.size() && graphs.size() <= 12 ) - { - columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_4; - rowCount = RimMultiPlot::RowCount::ROWS_3; - tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW; - } - else - { - columnCount = RiuMultiPlotPage::ColumnCount::COLUMNS_4; - rowCount = RimMultiPlot::RowCount::ROWS_4; - tickmarkCount = RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_VERY_FEW; - } - - plot->setAutoTitlePlot( true ); - plot->setAutoTitleGraphs( showTitleSubGraph ); - - plot->setColumnCount( columnCount ); - plot->setRowCount( rowCount ); - plot->setShowPlotTitles( showTitleSubGraph ); - plot->setTickmarkCount( tickmarkCount ); - - for ( auto graph : graphs ) - { - plot->addPlot( graph ); - - graph->resolveReferencesRecursively(); - graph->revokeMdiWindowStatus(); - graph->setShowWindow( true ); - - graph->loadDataAndUpdate(); - } - - plot->loadDataAndUpdate(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -570,6 +515,18 @@ void RimSummaryMultiPlot::syncAxisRanges() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::summaryPlotItemInfos( QList* optionInfos ) const +{ + for ( RimSummaryPlot* plot : summaryPlots() ) + { + QString displayName = plot->description(); + optionInfos->push_back( caf::PdmOptionItemInfo( displayName, plot, false, plot->uiCapability()->uiIconProvider() ) ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 6e5b821757..b7d11d8b44 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -24,8 +24,11 @@ #include "cafPdmChildField.h" #include "cafPdmObject.h" #include "cafPdmPtrArrayField.h" +#include "cafPdmUiItem.h" #include "cafSignal.h" +#include + #include class RimSummaryPlot; @@ -68,6 +71,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void addPlot( const std::vector& objects ); + void summaryPlotItemInfos( QList* optionInfos ) const; + protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override; @@ -85,8 +90,6 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep std::vector summaryPlots() const; - static void insertGraphsIntoPlot( RimSummaryMultiPlot* plot, const std::vector& graphs ); - void updatePlotWindowTitle() override; void duplicate(); diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index 2db478ede0..9db74aaae8 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -778,6 +778,8 @@ bool RiuDragDrop::handleGenericDropEvent( QEvent* event, std::vectortype() == QEvent::Drop ) { // These drop events come from Qwt @@ -788,6 +790,8 @@ bool RiuDragDrop::handleGenericDropEvent( QEvent* event, std::vectorkeyboardModifiers(); dropEvent->acceptProposedAction(); + dropEvent->accept(); + bResult = true; } } else if ( event->type() == QEvent::GraphicsSceneDrop ) @@ -799,6 +803,8 @@ bool RiuDragDrop::handleGenericDropEvent( QEvent* event, std::vector( dropEvent->mimeData() ); dropEvent->acceptProposedAction(); + dropEvent->accept(); + bResult = true; } } @@ -819,8 +825,8 @@ bool RiuDragDrop::handleGenericDropEvent( QEvent* event, std::vectorshow(); - dw->raise(); } } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index ad3437ae0f..6f3860218f 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -104,6 +104,8 @@ RiuMultiPlotBook::RiuMultiPlotBook( RimMultiPlot* plotDefinition, QWidget* paren , m_subTitlesVisible( true ) , m_previewMode( true ) , m_currentPageIndex( 0 ) + , m_goToLastPageAfterUpdate( false ) + , m_pageTimerId( -1 ) { const int spacing = 8; @@ -168,6 +170,7 @@ void RiuMultiPlotBook::addPlot( RiuPlotWidget* plotWidget ) void RiuMultiPlotBook::insertPlot( RiuPlotWidget* plotWidget, size_t index ) { m_plotWidgets.insert( static_cast( index ), plotWidget ); + m_goToLastPageAfterUpdate = true; scheduleUpdate(); } @@ -461,6 +464,24 @@ void RiuMultiPlotBook::performUpdate() deleteAllPages(); createPages(); updateGeometry(); + // use a timer to trigger a viewer page change, if needed + if ( m_goToLastPageAfterUpdate ) + { + m_pageTimerId = startTimer( 100 ); + m_goToLastPageAfterUpdate = false; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::timerEvent( QTimerEvent* event ) +{ + if ( event->timerId() == m_pageTimerId ) + { + killTimer( m_pageTimerId ); + goToLastPage(); + } } //-------------------------------------------------------------------------------------------------- @@ -501,8 +522,8 @@ void RiuMultiPlotBook::createPages() { CAF_ASSERT( m_plotDefinition ); - QList> plotWidgets = this->visiblePlotWidgets(); - auto rowAndColumnCount = this->rowAndColumnCount( plotWidgets.size() ); + QList> plotWidgets = this->visiblePlotWidgets(); + auto [rowCount, columnCount] = this->rowAndColumnCount( plotWidgets.size() ); int rowsPerPage = m_plotDefinition->rowsPerPage(); int row = 0; @@ -514,9 +535,9 @@ void RiuMultiPlotBook::createPages() for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex ) { int expectedColSpan = static_cast( plotWidgets[visibleIndex]->colSpan() ); - int colSpan = std::min( expectedColSpan, rowAndColumnCount.second ); + int colSpan = std::min( expectedColSpan, columnCount ); - std::tie( row, column ) = page->findAvailableRowAndColumn( row, column, colSpan, rowAndColumnCount.second ); + std::tie( row, column ) = page->findAvailableRowAndColumn( row, column, colSpan, columnCount ); if ( row >= rowsPerPage ) { page = createPage(); @@ -609,7 +630,7 @@ void RiuMultiPlotBook::applyLook() void RiuMultiPlotBook::changeCurrentPage( int pageNumber ) { m_currentPageIndex = pageNumber; - if ( m_currentPageIndex >= (int)m_pages.size() ) m_currentPageIndex = (int)m_pages.size() - 1; + if ( m_currentPageIndex >= m_pages.size() ) m_currentPageIndex = m_pages.size() - 1; if ( m_currentPageIndex < 0 ) m_currentPageIndex = 0; if ( !m_pages.isEmpty() ) m_scrollArea->ensureWidgetVisible( m_pages[m_currentPageIndex] ); } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index ace642a8ec..3c07c42668 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -53,9 +53,6 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow { Q_OBJECT -public: - using ColumnCount = RiuMultiPlotPage::ColumnCount; - public: RiuMultiPlotBook( RimMultiPlot* plotDefinition, QWidget* parent = nullptr ); ~RiuMultiPlotBook() override; @@ -108,6 +105,8 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void dragEnterEvent( QDragEnterEvent* event ) override; void dropEvent( QDropEvent* event ) override; + void timerEvent( QTimerEvent* event ) override; + private: void deleteAllPages(); void createPages(); @@ -136,4 +135,7 @@ private slots: bool m_subTitlesVisible; bool m_previewMode; int m_currentPageIndex; + + bool m_goToLastPageAfterUpdate; + int m_pageTimerId; }; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index dc635d6158..3cb72dc1f1 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -537,7 +537,7 @@ void RiuMultiPlotPage::onSelectionManagerSelectionChanged( const std::set& for ( RiuPlotWidget* plotWidget : m_plotWidgets ) { - CAF_ASSERT( plotWidget ); + if ( !plotWidget ) continue; RimPlot* plot = plotWidget->plotDefinition(); if ( !plot ) continue; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h index 525c9e3585..9c1f3c66a5 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h @@ -53,16 +53,6 @@ class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, p { Q_OBJECT -public: - enum class ColumnCount - { - COLUMNS_1 = 1, - COLUMNS_2 = 2, - COLUMNS_3 = 3, - COLUMNS_4 = 4, - COLUMNS_UNLIMITED = 1000, - }; - public: RiuMultiPlotPage( RimPlotWindow* plotDefinition, QWidget* parent = nullptr ); ~RiuMultiPlotPage() override; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 44a1b780b9..fa32515631 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -1025,7 +1025,6 @@ void RiuPlotMainWindow::selectedObjectsChanged() // The only way to get to this code is by selection change initiated from the project tree view // As we are activating an MDI-window, the focus is given to this MDI-window // Set focus back to the tree view to be able to continue keyboard tree view navigation - projectTree->raise(); projectTree->treeView()->setFocus(); } } From 4366e53733009e846b72fb8c005af6d0c7ba78dc Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 24 Mar 2022 15:33:56 +0100 Subject: [PATCH 201/406] #8728 Help Menu : Add search issues and create new issue --- .../ApplicationCommands/RicHelpFeatures.cpp | 64 +++++++++++++++++++ .../ApplicationCommands/RicHelpFeatures.h | 26 ++++++++ .../UserInterface/RiuMainWindow.cpp | 2 + .../UserInterface/RiuPlotMainWindow.cpp | 2 + 4 files changed, 94 insertions(+) diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.cpp index 0060f471be..62f84045f4 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.cpp +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.cpp @@ -41,6 +41,8 @@ CAF_CMD_SOURCE_INIT( RicHelpCommandLineFeature, "RicHelpCommandLineFeature" ); CAF_CMD_SOURCE_INIT( RicHelpSummaryCommandLineFeature, "RicHelpSummaryCommandLineFeature" ); CAF_CMD_SOURCE_INIT( RicHelpOpenUsersGuideFeature, "RicHelpOpenUsersGuideFeature" ); CAF_CMD_SOURCE_INIT( RicSearchHelpFeature, "RicSearchHelpFeature" ); +CAF_CMD_SOURCE_INIT( RicSearchIssuesHelpFeature, "RicSearchIssuesHelpFeature" ); +CAF_CMD_SOURCE_INIT( RicCreateNewIssueHelpFeature, "RicCreateNewIssueHelpFeature" ); //-------------------------------------------------------------------------------------------------- /// @@ -308,3 +310,65 @@ void RicSearchHelpFeature::setupActionLook( QAction* actionToSetup ) applyShortcutWithHintToAction( actionToSetup, QKeySequence::HelpContents ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSearchIssuesHelpFeature::isCommandEnabled() +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSearchIssuesHelpFeature::onActionTriggered( bool isChecked ) +{ + QString usersGuideUrl = "https://github.com/OPM/ResInsight/issues"; + + if ( !QDesktopServices::openUrl( usersGuideUrl ) ) + { + QErrorMessage* errorHandler = QErrorMessage::qtHandler(); + errorHandler->showMessage( "Failed open browser with the following url\n\n" + usersGuideUrl ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSearchIssuesHelpFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Search Issues" ); + actionToSetup->setIcon( QIcon( ":/HelpCircle.svg" ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicCreateNewIssueHelpFeature::isCommandEnabled() +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateNewIssueHelpFeature::onActionTriggered( bool isChecked ) +{ + QString usersGuideUrl = "https://github.com/OPM/ResInsight/issues/new"; + + if ( !QDesktopServices::openUrl( usersGuideUrl ) ) + { + QErrorMessage* errorHandler = QErrorMessage::qtHandler(); + errorHandler->showMessage( "Failed open browser with the following url\n\n" + usersGuideUrl ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateNewIssueHelpFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Create New Issue" ); + actionToSetup->setIcon( QIcon( ":/HelpCircle.svg" ) ); +} diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.h b/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.h index c788574438..b15c338f6b 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicHelpFeatures.h @@ -84,3 +84,29 @@ class RicSearchHelpFeature : public caf::CmdFeature void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; }; + +//================================================================================================== +/// +//================================================================================================== +class RicSearchIssuesHelpFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; + +//================================================================================================== +/// +//================================================================================================== +class RicCreateNewIssueHelpFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index d4a68a8fd2..af9e8106eb 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -561,6 +561,8 @@ void RiuMainWindow::createMenus() helpMenu->addSeparator(); helpMenu->addAction( cmdFeatureMgr->action( "RicHelpOpenUsersGuideFeature" ) ); helpMenu->addAction( cmdFeatureMgr->action( "RicSearchHelpFeature" ) ); + helpMenu->addAction( cmdFeatureMgr->action( "RicSearchIssuesHelpFeature" ) ); + helpMenu->addAction( cmdFeatureMgr->action( "RicCreateNewIssueHelpFeature" ) ); connect( helpMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshHelpActions() ) ); } diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index fa32515631..63eff0a5bd 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -356,6 +356,8 @@ void RiuPlotMainWindow::createMenus() helpMenu->addSeparator(); helpMenu->addAction( cmdFeatureMgr->action( "RicHelpOpenUsersGuideFeature" ) ); helpMenu->addAction( cmdFeatureMgr->action( "RicSearchHelpFeature" ) ); + helpMenu->addAction( cmdFeatureMgr->action( "RicSearchIssuesHelpFeature" ) ); + helpMenu->addAction( cmdFeatureMgr->action( "RicCreateNewIssueHelpFeature" ) ); connect( helpMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshHelpActions() ) ); } From f41c772f03fd7b7aea30718f1f749cc6380f5e5a Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 25 Mar 2022 16:58:07 +0100 Subject: [PATCH 202/406] Show plot curves at the first level below a summary plot. --- .../Summary/RimSummaryPlot.cpp | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 97f83d0ce8..7767a1d20d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1554,23 +1554,25 @@ QImage RimSummaryPlot::snapshotWindowContent() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) { - if ( uiConfigName == RicSummaryPlotEditorUi::CONFIGURATION_NAME ) + bool isPlotEditor = ( uiConfigName == RicSummaryPlotEditorUi::CONFIGURATION_NAME ); + + if ( !isPlotEditor ) uiTreeOrdering.add( &m_axisProperties ); + + for ( auto& curve : m_summaryCurveCollection->curves() ) { - uiTreeOrdering.add( &m_summaryCurveCollection ); - if ( !m_isCrossPlot ) - { - uiTreeOrdering.add( &m_ensembleCurveSetCollection ); - } + uiTreeOrdering.add( curve ); } - else - { - uiTreeOrdering.add( &m_axisProperties ); - uiTreeOrdering.add( &m_summaryCurveCollection ); - if ( !m_isCrossPlot ) + if ( !m_isCrossPlot ) + { + for ( auto& curveSet : m_ensembleCurveSetCollection->curveSets() ) { - uiTreeOrdering.add( &m_ensembleCurveSetCollection ); + uiTreeOrdering.add( curveSet ); } + } + + if ( !isPlotEditor ) + { uiTreeOrdering.add( &m_gridTimeHistoryCurves ); uiTreeOrdering.add( &m_asciiDataCurves ); } From 2eb1713866e3aabfe23323870fbb5882969a85c6 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Wed, 30 Mar 2022 15:54:11 +0200 Subject: [PATCH 203/406] Fix mouse wheel not working in 3D view if a plot window is created. Fix issue with multiplot sometimes being shown incorrectly when switching between fullscreen plots --- .../Application/RiaGuiApplication.cpp | 18 ++++++--- .../ProjectDataModel/RimMultiPlot.cpp | 4 +- .../UserInterface/RiuMultiPlotBook.cpp | 39 ++++++++++++++++--- .../UserInterface/RiuMultiPlotBook.h | 6 ++- 4 files changed, 51 insertions(+), 16 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 796b4cfa67..f97813af96 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -1687,15 +1687,21 @@ bool RiaGuiApplication::notify( QObject* receiver, QEvent* event ) { if ( event->type() == QEvent::KeyPress ) { - QKeyEvent* keyEvent = static_cast( event ); - RimPlotWindow* plot = dynamic_cast( activePlotWindow() ); - if ( plot ) done = plot->handleGlobalKeyEvent( keyEvent ); + if ( activeWindow() != mainWindow() ) + { + QKeyEvent* keyEvent = static_cast( event ); + RimPlotWindow* plot = dynamic_cast( activePlotWindow() ); + if ( plot ) done = plot->handleGlobalKeyEvent( keyEvent ); + } } else if ( event->type() == QEvent::Wheel ) { - QWheelEvent* wheelEvent = static_cast( event ); - RimPlotWindow* plot = dynamic_cast( activePlotWindow() ); - if ( plot ) done = plot->handleGlobalWheelEvent( wheelEvent ); + if ( activeWindow() != mainWindow() ) + { + QWheelEvent* wheelEvent = static_cast( event ); + RimPlotWindow* plot = dynamic_cast( activePlotWindow() ); + if ( plot ) done = plot->handleGlobalWheelEvent( wheelEvent ); + } } if ( !done ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 59bd6ea1a5..d9618af083 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -869,7 +869,5 @@ void RimMultiPlot::cleanupBeforeClose() bool RimMultiPlot::isMouseCursorInsidePlot() { if ( !m_viewer ) return false; - - QPoint curpos = m_viewer->mapFromGlobal( QCursor::pos() ); - return ( m_viewer->rect().contains( curpos ) ); + return m_viewer->underMouse(); } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 6f3860218f..1d295b64d5 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -104,8 +104,9 @@ RiuMultiPlotBook::RiuMultiPlotBook( RimMultiPlot* plotDefinition, QWidget* paren , m_subTitlesVisible( true ) , m_previewMode( true ) , m_currentPageIndex( 0 ) - , m_goToLastPageAfterUpdate( false ) + , m_goToPageAfterUpdate( false ) , m_pageTimerId( -1 ) + , m_pageToGoTo( 0 ) { const int spacing = 8; @@ -126,6 +127,9 @@ RiuMultiPlotBook::RiuMultiPlotBook( RimMultiPlot* plotDefinition, QWidget* paren m_scrollArea->setVisible( true ); m_book->setVisible( true ); + m_scrollArea->viewport()->installEventFilter( this ); + m_scrollArea->verticalScrollBar()->installEventFilter( this ); + setAutoFillBackground( true ); this->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding ); @@ -170,7 +174,8 @@ void RiuMultiPlotBook::addPlot( RiuPlotWidget* plotWidget ) void RiuMultiPlotBook::insertPlot( RiuPlotWidget* plotWidget, size_t index ) { m_plotWidgets.insert( static_cast( index ), plotWidget ); - m_goToLastPageAfterUpdate = true; + m_goToPageAfterUpdate = true; + m_pageToGoTo = -2; scheduleUpdate(); } @@ -376,6 +381,7 @@ void RiuMultiPlotBook::contextMenuEvent( QContextMenuEvent* event ) //-------------------------------------------------------------------------------------------------- void RiuMultiPlotBook::showEvent( QShowEvent* event ) { + m_goToPageAfterUpdate = true; QWidget::showEvent( event ); performUpdate(); if ( m_previewMode ) @@ -388,6 +394,15 @@ void RiuMultiPlotBook::showEvent( QShowEvent* event ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::hideEvent( QHideEvent* event ) +{ + m_pageToGoTo = m_currentPageIndex; + QWidget::hideEvent( event ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -465,10 +480,10 @@ void RiuMultiPlotBook::performUpdate() createPages(); updateGeometry(); // use a timer to trigger a viewer page change, if needed - if ( m_goToLastPageAfterUpdate ) + if ( m_goToPageAfterUpdate ) { - m_pageTimerId = startTimer( 100 ); - m_goToLastPageAfterUpdate = false; + m_pageTimerId = startTimer( 100 ); + m_goToPageAfterUpdate = false; } } @@ -480,7 +495,8 @@ void RiuMultiPlotBook::timerEvent( QTimerEvent* event ) if ( event->timerId() == m_pageTimerId ) { killTimer( m_pageTimerId ); - goToLastPage(); + changeCurrentPage( m_pageToGoTo ); + RiaGuiApplication::instance()->mainPlotWindow()->raise(); } } @@ -629,6 +645,7 @@ void RiuMultiPlotBook::applyLook() //-------------------------------------------------------------------------------------------------- void RiuMultiPlotBook::changeCurrentPage( int pageNumber ) { + if ( pageNumber < -1 ) pageNumber = m_pages.size() - 1; m_currentPageIndex = pageNumber; if ( m_currentPageIndex >= m_pages.size() ) m_currentPageIndex = m_pages.size() - 1; if ( m_currentPageIndex < 0 ) m_currentPageIndex = 0; @@ -683,3 +700,13 @@ void RiuMultiPlotBook::dropEvent( QDropEvent* event ) } } } + +bool RiuMultiPlotBook::eventFilter( QObject* obj, QEvent* event ) +{ + if ( event->type() == QEvent::Wheel ) + { + event->accept(); + return true; + } + return QWidget::eventFilter( obj, event ); +} diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index 3c07c42668..debe9476cf 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -91,6 +91,7 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void contextMenuEvent( QContextMenuEvent* ) override; void showEvent( QShowEvent* event ) override; + void hideEvent( QHideEvent* event ) override; void resizeEvent( QResizeEvent* event ) override; void applyPagePreviewBookSize( int frameWidth ); @@ -107,6 +108,8 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void timerEvent( QTimerEvent* event ) override; + bool eventFilter( QObject* obj, QEvent* ev ) override; + private: void deleteAllPages(); void createPages(); @@ -136,6 +139,7 @@ private slots: bool m_previewMode; int m_currentPageIndex; - bool m_goToLastPageAfterUpdate; + bool m_goToPageAfterUpdate; + int m_pageToGoTo; int m_pageTimerId; }; From ebba37a6235f85020ac16206ba50c0e59a207f0a Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 31 Mar 2022 12:34:07 +0200 Subject: [PATCH 204/406] Merge pull request #8754 from OPM/multiplot_improvements Summary Multiplot: add new plot from a single curve in an ensemble plot and improve general plot performance --- ApplicationLibCode/Application/RiaDefines.h | 20 ++++++ .../RiaPlotWindowRedrawScheduler.cpp | 35 +++++----- .../RiaPlotWindowRedrawScheduler.h | 22 ++++-- .../CMakeLists_files.cmake | 2 + .../RicNewSummaryPlotFromCurveFeature.cpp | 67 +++++++++++++++++++ .../RicNewSummaryPlotFromCurveFeature.h | 37 ++++++++++ .../RicNewSummaryPlotFromDataVectorFeature.h | 1 - .../RicSummaryPlotBuilder.cpp | 18 +++++ .../RicSummaryPlotBuilder.h | 2 + .../UserInterface/RiuMultiPlotBook.cpp | 2 +- .../UserInterface/RiuMultiPlotPage.cpp | 38 ++++++++--- .../UserInterface/RiuMultiPlotPage.h | 9 ++- .../UserInterface/RiuSummaryPlot.cpp | 9 +++ .../UserInterface/RiuWellLogPlot.cpp | 2 +- .../UserInterface/RiuWellLogPlot.h | 2 +- 15 files changed, 227 insertions(+), 39 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.h diff --git a/ApplicationLibCode/Application/RiaDefines.h b/ApplicationLibCode/Application/RiaDefines.h index 29893e8960..37333eb608 100644 --- a/ApplicationLibCode/Application/RiaDefines.h +++ b/ApplicationLibCode/Application/RiaDefines.h @@ -204,4 +204,24 @@ enum class RowCount ROWS_4 = 4, }; +enum class MultiPlotPageUpdateType : uint32_t +{ + NONE = 0b0000, + LEGEND = 0b0001, + PLOT = 0b0010, + ALL = 0b0011 +}; + +constexpr enum MultiPlotPageUpdateType operator|( const enum MultiPlotPageUpdateType selfValue, + const enum MultiPlotPageUpdateType inValue ) +{ + return ( enum MultiPlotPageUpdateType )( uint32_t( selfValue ) | uint32_t( inValue ) ); +} + +constexpr enum MultiPlotPageUpdateType operator&( const enum MultiPlotPageUpdateType selfValue, + const enum MultiPlotPageUpdateType inValue ) +{ + return ( enum MultiPlotPageUpdateType )( uint32_t( selfValue ) & uint32_t( inValue ) ); +} + }; // namespace RiaDefines diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp index 5e64f7534f..86e2403c07 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp @@ -51,9 +51,17 @@ void RiaPlotWindowRedrawScheduler::scheduleMultiPlotWindowUpdate( RiuMultiPlotBo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaPlotWindowRedrawScheduler::scheduleMultiPlotPageUpdate( RiuMultiPlotPage* plotPage ) +void RiaPlotWindowRedrawScheduler::scheduleMultiPlotPageUpdate( RiuMultiPlotPage* plotPage, + RiaDefines::MultiPlotPageUpdateType updateType ) { - m_plotPagesToUpdate.push_back( plotPage ); + if ( m_plotPagesToUpdate.count( plotPage ) == 0 ) + { + m_plotPagesToUpdate[plotPage] = updateType; + } + else + { + m_plotPagesToUpdate[plotPage] = m_plotPagesToUpdate[plotPage] | updateType; + } startTimer( 0 ); } @@ -90,17 +98,16 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates() //-------------------------------------------------------------------------------------------------- void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() { - std::vector> plotWindowsToUpdate; - std::vector> plotPagesToUpdate; - std::vector> plotWidgetsToReplot; + std::vector> plotWindowsToUpdate; + std::vector> plotWidgetsToReplot; + std::map, RiaDefines::MultiPlotPageUpdateType> pagesToUpdate; + pagesToUpdate.swap( m_plotPagesToUpdate ); plotWindowsToUpdate.swap( m_plotWindowsToUpdate ); - plotPagesToUpdate.swap( m_plotPagesToUpdate ); plotWidgetsToReplot.swap( m_plotWidgetsToReplot ); std::set> updatedPlots; std::set> updatedPlotWindows; - std::set> updatedPlotPages; for ( QPointer plotWindow : plotWindowsToUpdate ) { @@ -108,8 +115,7 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() { for ( RiuMultiPlotPage* page : plotWindow->pages() ) { - plotPagesToUpdate.erase( std::remove( plotPagesToUpdate.begin(), plotPagesToUpdate.end(), page ), - plotPagesToUpdate.end() ); + if ( pagesToUpdate.count( page ) > 0 ) pagesToUpdate.erase( page ); } plotWindow->performUpdate(); @@ -117,16 +123,13 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() } } - for ( QPointer plotPage : plotPagesToUpdate ) + for ( auto& [page, updateType] : pagesToUpdate ) { - if ( !plotPage.isNull() && !updatedPlotPages.count( plotPage ) ) - { - plotPage->performUpdate(); - updatedPlotPages.insert( plotPage ); - } + if ( page.isNull() ) continue; + + page->performUpdate( updateType ); } - // Perform update and replot. Make sure we handle legend update for ( QPointer plot : plotWidgetsToReplot ) { if ( !plot.isNull() && !updatedPlots.count( plot ) ) diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h index 13868d5d43..c9f5a249f0 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h @@ -19,11 +19,14 @@ #include "cafPdmPointer.h" +#include "RiaDefines.h" + #include #include #include #include +#include #include class RiuMultiPlotPage; @@ -36,11 +39,14 @@ class RiaPlotWindowRedrawScheduler : public QObject public: static RiaPlotWindowRedrawScheduler* instance(); - void scheduleMultiPlotWindowUpdate( RiuMultiPlotBook* plotWindow ); - void scheduleMultiPlotPageUpdate( RiuMultiPlotPage* plotWindow ); - void schedulePlotWidgetReplot( RiuPlotWidget* plotWidget ); - void clearAllScheduledUpdates(); - void performScheduledUpdatesAndReplots(); + + void scheduleMultiPlotWindowUpdate( RiuMultiPlotBook* plotWindow ); + void scheduleMultiPlotPageUpdate( + RiuMultiPlotPage* plotWindow, + RiaDefines::MultiPlotPageUpdateType updateType = RiaDefines::MultiPlotPageUpdateType::ALL ); + void schedulePlotWidgetReplot( RiuPlotWidget* plotWidget ); + void clearAllScheduledUpdates(); + void performScheduledUpdatesAndReplots(); private slots: void slotUpdateAndReplotScheduledItemsWhenReady(); @@ -52,8 +58,10 @@ private slots: void startTimer( int msecs ); private: + std::map, RiaDefines::MultiPlotPageUpdateType> m_plotPagesToUpdate; + std::vector> m_plotWidgetsToReplot; std::vector> m_plotWindowsToUpdate; - std::vector> m_plotPagesToUpdate; - QScopedPointer m_plotWindowUpdateTimer; + + QScopedPointer m_plotWindowUpdateTimer; }; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake index 6e5569c6ca..cee56cd506 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake @@ -4,6 +4,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromDataVectorFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -12,6 +13,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromDataVectorFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.cpp new file mode 100644 index 0000000000..63f972b298 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.cpp @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicNewSummaryPlotFromCurveFeature.h" + +#include "RimSummaryCurve.h" +#include "RimSummaryPlot.h" + +#include "RicSummaryPlotBuilder.h" + +#include +#include + +CAF_CMD_SOURCE_INIT( RicNewSummaryPlotFromCurveFeature, "RicNewSummaryPlotFromCurveFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicNewSummaryPlotFromCurveFeature::isCommandEnabled() +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSummaryPlotFromCurveFeature::onActionTriggered( bool isChecked ) +{ + QVariant userData = this->userData(); + if ( !userData.isNull() && userData.canConvert() ) + { + RimSummaryCurve* curve = static_cast( userData.value() ); + + auto curveCopy = + dynamic_cast( curve->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + + RimSummaryPlot* plot = RicSummaryPlotBuilder::createPlot( { curveCopy } ); + + std::vector plots = { plot }; + + RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( plots ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicNewSummaryPlotFromCurveFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "New Summary Plot from Curve" ); + actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.h new file mode 100644 index 0000000000..31bdf6aa9e --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.h @@ -0,0 +1,37 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RicfCommandObject.h" + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicNewSummaryPlotFromCurveFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + // Overrides + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.h index efadef9496..b9e65e2a45 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.h @@ -30,7 +30,6 @@ class RicNewSummaryPlotFromDataVectorFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; protected: - // Overrides bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 58a10c87a4..718ed2af7f 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -472,6 +472,24 @@ void RicSummaryPlotBuilder::appendPlotsToSummaryMultiPlot( RimSummaryMultiPlot* } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryPlot* RicSummaryPlotBuilder::createPlot( const std::vector& summaryCurves ) +{ + auto* plot = new RimSummaryPlot(); + plot->enableAutoPlotTitle( true ); + + for ( auto& curve : summaryCurves ) + { + plot->addCurveNoUpdate( curve ); + } + + plot->applyDefaultCurveAppearances(); + + return plot; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h index aebc65cce7..2ab6669521 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h @@ -83,6 +83,8 @@ class RicSummaryPlotBuilder static RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vector& objects ); static void appendPlotsToSummaryMultiPlot( RimSummaryMultiPlot* multiPlot, const std::vector& plots ); + static RimSummaryPlot* createPlot( const std::vector& summaryCurves ); + static RimSummaryPlot* createPlot( const std::set& addresses, const std::vector& summaryCases, const std::vector& ensembles ); diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 1d295b64d5..ea152de7cf 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -562,7 +562,7 @@ void RiuMultiPlotBook::createPages() } CAF_ASSERT( plotWidgets[visibleIndex] ); page->addPlot( plotWidgets[visibleIndex] ); - page->performUpdate(); + page->performUpdate( RiaDefines::MultiPlotPageUpdateType::ALL ); } // Set page numbers in title when there's more than one page diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 3cb72dc1f1..3e790389a5 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -322,10 +322,10 @@ int RiuMultiPlotPage::indexOfPlotWidget( RiuPlotWidget* plotWidget ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotPage::scheduleUpdate() +void RiuMultiPlotPage::scheduleUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ) { CAF_ASSERT( m_plotDefinition ); - RiaPlotWindowRedrawScheduler::instance()->scheduleMultiPlotPageUpdate( this ); + RiaPlotWindowRedrawScheduler::instance()->scheduleMultiPlotPageUpdate( this, whatToUpdate ); } //-------------------------------------------------------------------------------------------------- @@ -444,7 +444,7 @@ QLabel* RiuMultiPlotPage::createTitleLabel() const void RiuMultiPlotPage::showEvent( QShowEvent* event ) { QWidget::showEvent( event ); - performUpdate(); + performUpdate( RiaDefines::MultiPlotPageUpdateType::ALL ); } //-------------------------------------------------------------------------------------------------- @@ -560,12 +560,24 @@ bool RiuMultiPlotPage::showYAxis( int row, int column ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotPage::performUpdate() +void RiuMultiPlotPage::performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ) { - applyLook(); - updateMarginsFromPageLayout(); - reinsertPlotWidgets(); - alignCanvasTops(); + if ( whatToUpdate == RiaDefines::MultiPlotPageUpdateType::ALL ) + { + applyLook(); + updateMarginsFromPageLayout(); + + reinsertPlotWidgets(); + alignCanvasTops(); + } + else + { + if ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::LEGEND ) == RiaDefines::MultiPlotPageUpdateType::LEGEND ) + { + refreshLegends(); + alignCanvasTops(); + } + } } //-------------------------------------------------------------------------------------------------- @@ -573,7 +585,15 @@ void RiuMultiPlotPage::performUpdate() //-------------------------------------------------------------------------------------------------- void RiuMultiPlotPage::onLegendUpdated() { - scheduleUpdate(); + scheduleUpdate( RiaDefines::MultiPlotPageUpdateType::LEGEND ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotPage::refreshLegends() +{ + // TODO - might need to do something here, but at the moment it looks like alignCanvasTops() is sufficient } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h index 9c1f3c66a5..e50cdb6dde 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h @@ -19,6 +19,8 @@ #include "RiuInterfaceToViewWindow.h" +#include "RiaDefines.h" + #include "cafPdmPointer.h" #include "cafSelectionChangedReceiver.h" @@ -76,8 +78,8 @@ class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, p bool previewModeEnabled() const; void setPagePreviewModeEnabled( bool previewMode ); - void scheduleUpdate(); - void scheduleReplotOfAllPlots(); + void scheduleUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate = RiaDefines::MultiPlotPageUpdateType::ALL ); + void scheduleReplotOfAllPlots(); virtual void updateVerticalScrollBar( double visibleMin, double visibleMax, double totalMin, double totalMax ) {} void updateSubTitles(); @@ -103,6 +105,7 @@ class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, p virtual bool showYAxis( int row, int column ) const; virtual void reinsertPlotWidgets(); + virtual void refreshLegends(); void updateTitleFont(); @@ -119,7 +122,7 @@ class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, p void applyLook(); private slots: - virtual void performUpdate(); + virtual void performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ); void onLegendUpdated(); protected: diff --git a/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp index 8c644d53cd..58bdd23988 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp @@ -31,6 +31,7 @@ #include "cafCmdFeatureMenuBuilder.h" #include +#include #include @@ -87,6 +88,14 @@ void RiuSummaryPlot::showContextMenu( QPoint pos ) if ( ensemble && ensemble->isEnsemble() ) { clickedQuantityName = QString::fromStdString( clickedEnsembleCurveSet->summaryAddress().uiText() ); + + if ( curveClicked ) + { + QVariant curveVariant( QVariant::fromValue( static_cast( summaryCurve ) ) ); + menuBuilder.addCmdFeatureWithUserData( "RicNewSummaryPlotFromCurveFeature", + "Create New Plot from Curve", + curveVariant ); + } } } diff --git a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp index d5c648ed1b..c24427b4ec 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogPlot.cpp @@ -151,7 +151,7 @@ void RiuWellLogPlot::slotSetMinDepth( int value ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::performUpdate() +void RiuWellLogPlot::performUpdate( RiaDefines::MultiPlotPageUpdateType /* whatToUpdate */ ) { m_horizontalTrackScrollBar->setVisible( false ); m_verticalTrackScrollBar->setVisible( false ); diff --git a/ApplicationLibCode/UserInterface/RiuWellLogPlot.h b/ApplicationLibCode/UserInterface/RiuWellLogPlot.h index 68c5bfff7e..9be0f46575 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogPlot.h +++ b/ApplicationLibCode/UserInterface/RiuWellLogPlot.h @@ -45,7 +45,7 @@ class RiuWellLogPlot : public RiuMultiPlotPage private slots: void slotSetMinDepth( int value ); - void performUpdate() override; + void performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ) override; private: QPointer m_verticalTrackScrollBarLayout; From 28dcd47d73fb5b9eb95d264bd69b2afdb6e0b5c5 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Sun, 27 Mar 2022 20:25:03 +0200 Subject: [PATCH 205/406] Hide summary multiplot tree node if only one summary plot --- .../Summary/RimSummaryMultiPlot.cpp | 14 ++++++-- .../Summary/RimSummaryMultiPlot.h | 8 +++-- .../Summary/RimSummaryMultiPlotCollection.cpp | 33 +++++++++++++++++++ .../Summary/RimSummaryMultiPlotCollection.h | 3 ++ 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index f89cfa52e4..ef9dd41c54 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -52,6 +52,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlot::RimSummaryMultiPlot() : duplicatePlot( this ) + , refreshTree( this ) { CAF_PDM_InitObject( "Multi Summary Plot" ); this->setDeletable( true ); @@ -101,9 +102,6 @@ void RimSummaryMultiPlot::addPlot( RimPlot* plot ) CVF_ASSERT( sumPlot != nullptr ); if ( sumPlot ) { - // Not required to connect signal here, as RimSummaryMultiPlot::insertPlot() will always be called from - // RimMultiPlot::addPlot() - RimMultiPlot::addPlot( plot ); } } @@ -119,6 +117,7 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) { sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); RimMultiPlot::insertPlot( plot, index ); + signalRefresh(); } } @@ -151,6 +150,7 @@ void RimSummaryMultiPlot::removePlot( RimPlot* plot ) if ( sumPlot ) { RimMultiPlot::removePlot( plot ); + signalRefresh(); } } @@ -535,6 +535,14 @@ void RimSummaryMultiPlot::duplicate() duplicatePlot.send( this ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::signalRefresh() +{ + refreshTree.send( this ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index b7d11d8b44..364d4b1c73 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -46,6 +46,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep public: caf::Signal duplicatePlot; + caf::Signal refreshTree; public: RimSummaryMultiPlot(); @@ -73,11 +74,12 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void summaryPlotItemInfos( QList* optionInfos ) const; + std::vector summaryPlots() const; + protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override; - void initAfterRead() override; private: @@ -88,11 +90,11 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - std::vector summaryPlots() const; - void updatePlotWindowTitle() override; void duplicate(); + void signalRefresh(); + void onSubPlotChanged( const caf::SignalEmitter* emitter ); private: diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp index 8e99af0080..a1ed1abe75 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -19,10 +19,12 @@ #include "RimProject.h" #include "RimSummaryMultiPlot.h" +#include "RimSummaryPlot.h" #include "RiuPlotMainWindowTools.h" #include "cafPdmFieldReorderCapability.h" +#include "cafPdmUiTreeOrdering.h" CAF_PDM_SOURCE_INIT( RimSummaryMultiPlotCollection, "RimSummaryMultiPlotCollection" ); @@ -53,6 +55,7 @@ void RimSummaryMultiPlotCollection::initAfterRead() for ( auto& plot : m_summaryMultiPlots ) { plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot ); + plot->refreshTree.connect( this, &RimSummaryMultiPlotCollection::onRefreshTree ); } } @@ -79,6 +82,7 @@ void RimSummaryMultiPlotCollection::addSummaryMultiPlot( RimSummaryMultiPlot* pl { m_summaryMultiPlots().push_back( plot ); plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot ); + plot->refreshTree.connect( this, &RimSummaryMultiPlotCollection::onRefreshTree ); } //-------------------------------------------------------------------------------------------------- @@ -119,3 +123,32 @@ void RimSummaryMultiPlotCollection::onDuplicatePlot( const caf::SignalEmitter* e RiuPlotMainWindowTools::selectAsCurrentItem( plotCopy, true ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlotCollection::onRefreshTree( const caf::SignalEmitter* emitter, RimSummaryMultiPlot* plotRequesting ) +{ + if ( !plotRequesting ) return; + updateConnectedEditors(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlotCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, + QString uiConfigName /*= ""*/ ) +{ + for ( auto& plot : m_summaryMultiPlots() ) + { + if ( plot->summaryPlots().size() == 1 ) + { + uiTreeOrdering.add( plot->summaryPlots()[0] ); + } + else + { + uiTreeOrdering.add( plot ); + } + } + uiTreeOrdering.skipRemainingChildren( true ); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h index d0b612cfe6..81fafd2f45 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h @@ -45,7 +45,10 @@ class RimSummaryMultiPlotCollection : public caf::PdmObject, public RimPlotColle void addSummaryMultiPlot( RimSummaryMultiPlot* plot ); protected: + void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; + void onDuplicatePlot( const caf::SignalEmitter* emitter, RimSummaryMultiPlot* plotToDuplicate ); + void onRefreshTree( const caf::SignalEmitter* emitter, RimSummaryMultiPlot* plotRequesting ); void initAfterRead() override; From 15f17234c80a499ba688cfb0475c2f0a7168fcb3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 31 Mar 2022 08:57:52 +0200 Subject: [PATCH 206/406] #8747 MultiPlot : Duplicate and append plots for selected objects --- .../Application/RiaSummaryCurveDefinition.cpp | 8 + .../Application/RiaSummaryCurveDefinition.h | 1 + .../CMakeLists_files.cmake | 2 + ...RicAppendSummaryPlotsForObjectsFeature.cpp | 294 ++++++++++++++++++ .../RicAppendSummaryPlotsForObjectsFeature.h | 49 +++ .../RimContextCommandBuilder.cpp | 1 + .../Summary/RimSummaryAddressCollection.cpp | 15 +- .../Summary/RimSummaryAddressCollection.h | 7 +- .../Summary/RimSummaryPlot.cpp | 104 +++---- 9 files changed, 421 insertions(+), 60 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h diff --git a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp b/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp index 4dc0d45ecf..fa6dfa0817 100644 --- a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp +++ b/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp @@ -96,6 +96,14 @@ bool RiaSummaryCurveDefinition::isEnsembleCurve() const return m_isEnsembleCurve; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaSummaryCurveDefinition::setSummaryAddress( const RifEclipseSummaryAddress& address ) +{ + m_summaryAddress = address; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.h b/ApplicationLibCode/Application/RiaSummaryCurveDefinition.h index 9aeb40a761..32b0ffaf93 100644 --- a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.h +++ b/ApplicationLibCode/Application/RiaSummaryCurveDefinition.h @@ -46,6 +46,7 @@ class RiaSummaryCurveDefinition const RifEclipseSummaryAddress& summaryAddress() const; RimSummaryCaseCollection* ensemble() const; bool isEnsembleCurve() const; + void setSummaryAddress( const RifEclipseSummaryAddress& address ); bool operator<( const RiaSummaryCurveDefinition& other ) const; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake index cee56cd506..08f232188e 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake @@ -5,6 +5,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromDataVectorFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForObjectsFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -14,6 +15,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromDataVectorFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForObjectsFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp new file mode 100644 index 0000000000..dbae1c203f --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -0,0 +1,294 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicAppendSummaryPlotsForObjectsFeature.h" + +#include "RiaGuiApplication.h" +#include "RiaLogging.h" +#include "RiaStdStringTools.h" +#include "RiaSummaryAddressAnalyzer.h" + +#include "RicSummaryPlotBuilder.h" + +#include "RimEnsembleCurveSet.h" +#include "RimSummaryAddressCollection.h" +#include "RimSummaryCurve.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" +#include "RimSummaryPlot.h" + +#include "cafAssert.h" +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT( RicAppendSummaryPlotsForObjectsFeature, "RicAppendSummaryPlotsForObjectsFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicAppendSummaryPlotsForObjectsFeature::isCommandEnabled() +{ + return !selectedCollections().empty(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryPlotsForObjectsFeature::onActionTriggered( bool isChecked ) +{ + // - Select a set of objects in Data Source (wells, well groups, regions, ..) + // - Use context menu to activate action + // - For each plot in the current active plot, create a duplicate plot and replace the object name + + auto sumAddressCollections = selectedCollections(); + if ( sumAddressCollections.empty() ) return; + + RiaGuiApplication* app = RiaGuiApplication::instance(); + + auto activePlotWindow = dynamic_cast( app->activePlotWindow() ); + if ( activePlotWindow ) + { + if ( !isSelectionCompatibleWithPlot( sumAddressCollections, activePlotWindow ) ) return; + + std::vector sourcePlots; + { + auto plots = activePlotWindow->plots(); + + for ( auto p : plots ) + { + auto sumPlot = dynamic_cast( p ); + + if ( p ) sourcePlots.push_back( sumPlot ); + } + } + + for ( auto summaryAdrCollection : sumAddressCollections ) + { + auto duplicatedPlots = RicSummaryPlotBuilder::duplicateSummaryPlots( sourcePlots ); + for ( auto duplicatedPlot : duplicatedPlots ) + { + auto curveSets = duplicatedPlot->curveSets(); + if ( !curveSets.empty() ) + { + for ( auto curveSet : curveSets ) + { + auto sourceAddress = curveSet->summaryAddress(); + auto modifiedAdr = modifyAddress( sourceAddress, summaryAdrCollection ); + + curveSet->setSummaryAddress( modifiedAdr ); + } + } + else + { + auto curves = duplicatedPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ); + for ( auto c : curves ) + { + auto sourceAddress = c->summaryAddressY(); + auto modifiedAdr = modifyAddress( sourceAddress, summaryAdrCollection ); + + c->setSummaryAddressY( modifiedAdr ); + } + } + + activePlotWindow->addPlot( duplicatedPlot ); + + duplicatedPlot->resolveReferencesRecursively(); + } + } + + activePlotWindow->loadDataAndUpdate(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryPlotsForObjectsFeature::setupActionLook( QAction* actionToSetup ) +{ + QString objectType = "Objects"; + + auto addresses = selectedCollections(); + + if ( !addresses.empty() ) + { + auto firstAdr = addresses.front(); + if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) + { + objectType = "Wells"; + } + else if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) + { + objectType = "Well Groups"; + } + else if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) + { + objectType = "Regions"; + } + } + + auto text = QString( "Append Plots For " ) + objectType; + actionToSetup->setText( text ); + actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicAppendSummaryPlotsForObjectsFeature::selectedCollections() +{ + std::vector sumAddressCollections; + caf::SelectionManager::instance()->objectsByType( &sumAddressCollections ); + + if ( sumAddressCollections.size() == 1 ) + { + auto coll = sumAddressCollections[0]; + if ( coll->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_FOLDER || + coll->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP_FOLDER || + coll->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION_FOLDER ) + { + // If a folder is selected, return all sub items in folder + auto childObjects = coll->subFolders(); + + return childObjects; + } + } + + return sumAddressCollections; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( + const std::vector& selection, + RimSummaryMultiPlot* summaryMultiPlot ) +{ + if ( !summaryMultiPlot ) return false; + if ( selection.empty() ) return false; + + RiaSummaryAddressAnalyzer analyzer; + bool sourcePlotHasEnsembleData = false; + + { + std::set allAddresses; + + auto curveSets = summaryMultiPlot->curveSets(); + if ( !curveSets.empty() ) + { + for ( auto curveSet : curveSets ) + { + allAddresses.insert( curveSet->summaryAddress() ); + } + sourcePlotHasEnsembleData = true; + } + else + { + auto curves = summaryMultiPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ); + for ( auto c : curves ) + { + allAddresses.insert( c->summaryAddressY() ); + } + } + + analyzer.appendAddresses( allAddresses ); + } + + QString errorText; + auto selectionType = selection.front()->contentType(); + if ( selectionType == RimSummaryAddressCollection::CollectionContentType::WELL ) + { + if ( analyzer.wellNames().size() != 1 ) + { + errorText = "Source plot must contain one well only to be able to duplicate a selection of wells"; + } + } + else if ( selectionType == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) + { + if ( analyzer.wellGroupNames().size() != 1 ) + { + errorText = + "Source plot must contain one well group only to be able to duplicate a selection of well groups"; + } + } + else if ( selectionType == RimSummaryAddressCollection::CollectionContentType::REGION ) + { + if ( analyzer.regionNumbers().size() != 1 ) + { + errorText = "Source plot must contain one region only to be able to duplicate a selection of regions"; + } + } + + if ( sourcePlotHasEnsembleData && selection.front()->ensembleId() == -1 ) + { + errorText = "Source plot must contain single cases to be able to duplicate a selection of single cases"; + } + else if ( !sourcePlotHasEnsembleData && selection.front()->caseId() == -1 ) + { + errorText = + "Source plot must contain ensemble case plots to be able to duplicate a selection of ensemble cases"; + } + + if ( !errorText.isEmpty() ) + { + RiaLogging::error( errorText ); + return false; + } + + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifEclipseSummaryAddress + RicAppendSummaryPlotsForObjectsFeature::modifyAddress( const RifEclipseSummaryAddress& sourceAddress, + RimSummaryAddressCollection* summaryAddressCollection ) +{ + CAF_ASSERT( summaryAddressCollection ); + + auto adr = sourceAddress; + + auto objectName = summaryAddressCollection->name().toStdString(); + if ( summaryAddressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) + { + adr.setWellName( objectName ); + } + else if ( summaryAddressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) + { + adr.setWellGroupName( objectName ); + } + else if ( summaryAddressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) + { + int intValue = RiaStdStringTools::toInt( objectName ); + if ( intValue == -1 ) + { + QString errorText = QString( "Failed to convert region text to region integer value " + "for region text : " ) + + summaryAddressCollection->name(); + + RiaLogging::error( errorText ); + } + else + { + adr.setRegion( intValue ); + } + } + + return adr; +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h new file mode 100644 index 0000000000..1a69a4ac9e --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +#include + +class RimSummaryAddressCollection; +class RimSummaryMultiPlot; +class RifEclipseSummaryAddress; + +//================================================================================================== +/// +//================================================================================================== +class RicAppendSummaryPlotsForObjectsFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + +private: + static std::vector selectedCollections(); + + static bool isSelectionCompatibleWithPlot( const std::vector& selection, + RimSummaryMultiPlot* summaryMultiPlot ); + + RifEclipseSummaryAddress modifyAddress( const RifEclipseSummaryAddress& sourceAddress, + RimSummaryAddressCollection* summaryAddressCollection ); +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 32de1ab957..8341edceb1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1119,6 +1119,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicCloseObservedDataFeature"; menuBuilder << "RicNewMultiPlotFeature"; + menuBuilder << "RicAppendSummaryPlotsForObjectsFeature"; // Work in progress -- End diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index 02240c8f73..5958f342d3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -129,9 +129,9 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::set RimSummaryAddressCollection::subFolders() const +{ + return m_subfolders.childObjects(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h index b8e1060fde..a1e3790e78 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -40,7 +40,10 @@ class RimSummaryAddressCollection : public RimNamedObject WELL_GROUP, REGION, FIELD, - MISC + MISC, + WELL_FOLDER, + WELL_GROUP_FOLDER, + REGION_FOLDER }; public: @@ -66,6 +69,8 @@ class RimSummaryAddressCollection : public RimNamedObject void setEnsembleId( int ensembleId ); int ensembleId() const; + std::vector subFolders() const; + private: RimSummaryAddressCollection* getOrCreateSubfolder( const QString folderName, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 7767a1d20d..7aabc9fc5e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1941,75 +1941,69 @@ int RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* ad int newCurves = 0; auto droppedName = addressCollection->name().toStdString(); - if ( addressCollection->isEnsemble() ) return 0; + auto summaryCase = RiaSummaryTools::summaryCaseById( addressCollection->caseId() ); + auto ensembleCase = RiaSummaryTools::ensembleById( addressCollection->ensembleId() ); - auto summaryCase = RiaSummaryTools::summaryCaseById( addressCollection->caseId() ); - if ( summaryCase ) + std::vector sourceCurveDefs; + std::map> newCurveDefsWithObjectNames; + + if ( summaryCase && !ensembleCase ) { - if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) + for ( auto& curve : summaryCurves() ) { - std::map> dataVectorMap; - - for ( auto& curve : summaryCurves() ) - { - const auto curveAddress = curve->summaryAddressY(); - if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL ) - { - dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellName() ); - } - } + sourceCurveDefs.push_back( curve->curveDefinitionY() ); + } + } - for ( auto& [vectorName, wellNames] : dataVectorMap ) - { - if ( wellNames.count( droppedName ) > 0 ) continue; + if ( ensembleCase ) + { + auto curveSets = m_ensembleCurveSetCollection->curveSets(); + for ( auto curveSet : curveSets ) + { + sourceCurveDefs.push_back( RiaSummaryCurveDefinition( ensembleCase, curveSet->summaryAddress() ) ); + } + } - addNewCurveY( RifEclipseSummaryAddress::wellAddress( vectorName, droppedName ), summaryCase ); - newCurves++; - } + for ( auto& curveDef : sourceCurveDefs ) + { + auto newCurveDef = curveDef; + auto curveAdr = newCurveDef.summaryAddress(); + if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) + { + curveAdr.setWellName( droppedName ); + newCurveDef.setSummaryAddress( curveAdr ); + newCurveDefsWithObjectNames[newCurveDef].insert( curveAdr.wellName() ); } else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) { - std::map> dataVectorMap; - - for ( auto& curve : summaryCurves() ) - { - const auto curveAddress = curve->summaryAddressY(); - if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_GROUP ) - { - dataVectorMap[curveAddress.quantityName()].insert( curveAddress.wellGroupName() ); - } - } - - for ( auto& [vectorName, wellGroupNames] : dataVectorMap ) - { - if ( wellGroupNames.count( droppedName ) > 0 ) continue; - - addNewCurveY( RifEclipseSummaryAddress::wellGroupAddress( vectorName, droppedName ), summaryCase ); - newCurves++; - } + curveAdr.setWellGroupName( droppedName ); + newCurveDef.setSummaryAddress( curveAdr ); + newCurveDefsWithObjectNames[newCurveDef].insert( curveAdr.wellGroupName() ); } else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) { - std::map> dataVectorMap; - - for ( auto& curve : summaryCurves() ) - { - const auto curveAddress = curve->summaryAddressY(); - if ( curveAddress.category() == RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_REGION ) - { - dataVectorMap[curveAddress.quantityName()].insert( curveAddress.regionNumber() ); - } - } - int droppedRegion = std::stoi( droppedName ); - for ( auto& [vectorName, regionNumbers] : dataVectorMap ) - { - if ( regionNumbers.count( droppedRegion ) > 0 ) continue; + curveAdr.setRegion( droppedRegion ); + newCurveDef.setSummaryAddress( curveAdr ); + newCurveDefsWithObjectNames[newCurveDef].insert( std::to_string( curveAdr.regionNumber() ) ); + } + } - addNewCurveY( RifEclipseSummaryAddress::regionAddress( vectorName, droppedRegion ), summaryCase ); - newCurves++; - } + for ( auto& [curveDef, objectNames] : newCurveDefsWithObjectNames ) + { + // Skip adding new curves if the object name is already present for the curve definition + if ( objectNames.count( droppedName ) > 0 ) continue; + + if ( curveDef.ensemble() ) + { + addNewEnsembleCurveY( curveDef.summaryAddress(), curveDef.ensemble() ); + newCurves++; + } + else if ( curveDef.summaryCase() ) + { + addNewCurveY( curveDef.summaryAddress(), curveDef.summaryCase() ); + newCurves++; } } From b822996fc3e48a9dcb69c52da0ef3719294556a5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 31 Mar 2022 14:43:42 +0200 Subject: [PATCH 207/406] FIx regression blocking drag and drop of well names into existing plots --- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 7aabc9fc5e..894403fc4e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1970,23 +1970,27 @@ int RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* ad auto curveAdr = newCurveDef.summaryAddress(); if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) { + auto currentObjectString = curveAdr.wellName(); curveAdr.setWellName( droppedName ); newCurveDef.setSummaryAddress( curveAdr ); - newCurveDefsWithObjectNames[newCurveDef].insert( curveAdr.wellName() ); + newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString ); } else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) { + auto currentObjectString = curveAdr.wellGroupName(); curveAdr.setWellGroupName( droppedName ); newCurveDef.setSummaryAddress( curveAdr ); - newCurveDefsWithObjectNames[newCurveDef].insert( curveAdr.wellGroupName() ); + newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString ); } else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) { + auto currentObjectString = std::to_string( curveAdr.regionNumber() ); + int droppedRegion = std::stoi( droppedName ); curveAdr.setRegion( droppedRegion ); newCurveDef.setSummaryAddress( curveAdr ); - newCurveDefsWithObjectNames[newCurveDef].insert( std::to_string( curveAdr.regionNumber() ) ); + newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString ); } } From 46a8bd58b24aafd2cc2d307b8923c54a5e4c95ef Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 1 Apr 2022 14:04:46 +0200 Subject: [PATCH 208/406] #8761 Multiplot template support --- .../CMakeLists_files.cmake | 6 + ...RicCreateMultiPlotFromSelectionFeature.cpp | 129 ++++++++ .../RicCreateMultiPlotFromSelectionFeature.h | 36 +++ .../RicSaveMultiPlotTemplateFeature.cpp | 294 ++++++++++++++++++ .../RicSaveMultiPlotTemplateFeature.h | 51 +++ ...icSaveMultiPlotTemplateFeatureSettings.cpp | 108 +++++++ .../RicSaveMultiPlotTemplateFeatureSettings.h | 53 ++++ .../RicSummaryPlotTemplateTools.cpp | 224 ++++++++++++- .../RicSummaryPlotTemplateTools.h | 28 ++ .../RimContextCommandBuilder.cpp | 6 + .../ProjectDataModel/RimMultiPlot.cpp | 20 ++ .../ProjectDataModel/RimMultiPlot.h | 3 + .../Summary/RimSummaryAddress.cpp | 14 + .../Summary/RimSummaryAddress.h | 2 + 14 files changed, 970 insertions(+), 4 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.h create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.h create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake index 82de557305..b2601bddfb 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake @@ -6,6 +6,9 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicReloadPlotTemplatesFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateByShortcutFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeatureSettings.h + ${CMAKE_CURRENT_LIST_DIR}/RicCreateMultiPlotFromSelectionFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -16,6 +19,9 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicReloadPlotTemplatesFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateByShortcutFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeatureSettings.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicCreateMultiPlotFromSelectionFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp new file mode 100644 index 0000000000..67a159126f --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp @@ -0,0 +1,129 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicCreateMultiPlotFromSelectionFeature.h" + +#include "RiaGuiApplication.h" +#include "RiaSummaryTools.h" + +#include "RicSummaryPlotTemplateTools.h" + +#include "PlotTemplates/RimPlotTemplateFileItem.h" +#include "RimMainPlotCollection.h" +#include "RimProject.h" +#include "RimSummaryAddressCollection.h" +#include "RimSummaryCase.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" + +#include "RiuPlotMainWindow.h" +#include "RiuPlotMainWindowTools.h" + +#include "cafPdmUiPropertyViewDialog.h" +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT( RicCreateMultiPlotFromSelectionFeature, "RicCreateMultiPlotFromSelectionFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicCreateMultiPlotFromSelectionFeature::isCommandEnabled() +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateMultiPlotFromSelectionFeature::onActionTriggered( bool isChecked ) +{ + QString fileName = RicSummaryPlotTemplateTools::selectPlotTemplatePath(); + auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases(); + auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections(); + + auto summaryAddressCollections = RicSummaryPlotTemplateTools::selectedSummaryAddressCollections(); + + std::vector wellNames; + std::vector wellGroupNames; + std::vector regions; + std::set caseSet; + std::set caseCollectionSet; + + for ( auto a : summaryAddressCollections ) + { + if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) + { + wellNames.push_back( a->name() ); + } + else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) + { + wellGroupNames.push_back( a->name() ); + } + else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) + { + regions.push_back( a->name() ); + } + + auto sumCase = RiaSummaryTools::summaryCaseById( a->caseId() ); + if ( sumCase ) caseSet.insert( sumCase ); + + auto ensemble = RiaSummaryTools::ensembleById( a->ensembleId() ); + if ( ensemble ) caseCollectionSet.insert( ensemble ); + } + + for ( auto sumCase : caseSet ) + { + sumCases.push_back( sumCase ); + } + for ( auto sumCaseCollection : caseCollectionSet ) + { + sumCaseCollections.push_back( sumCaseCollection ); + } + + auto proj = RimProject::current(); + auto collections = proj->mainPlotCollection()->summaryMultiPlotCollection(); + + auto newSummaryPlot = RicSummaryPlotTemplateTools::createMultiPlotFromTemplateFile( fileName ); + if ( !newSummaryPlot ) return; + + collections->addSummaryMultiPlot( newSummaryPlot ); + newSummaryPlot->resolveReferencesRecursively(); + + RicSummaryPlotTemplateTools::setValuesForPlaceholders( newSummaryPlot, + sumCases, + sumCaseCollections, + wellNames, + wellGroupNames, + regions ); + newSummaryPlot->initAfterReadRecursively(); + newSummaryPlot->loadDataAndUpdate(); + collections->updateConnectedEditors(); + + RiuPlotMainWindowTools::selectAsCurrentItem( newSummaryPlot ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateMultiPlotFromSelectionFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Create Summary MultiPlot from Template" ); + actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.h new file mode 100644 index 0000000000..13e98af48f --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.h @@ -0,0 +1,36 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +class RimSummaryCase; + +//================================================================================================== +/// +//================================================================================================== +class RicCreateMultiPlotFromSelectionFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp new file mode 100644 index 0000000000..d8dcb6bfea --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp @@ -0,0 +1,294 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicSaveMultiPlotTemplateFeature.h" + +#include "RicReloadPlotTemplatesFeature.h" +#include "RicSaveMultiPlotTemplateFeatureSettings.h" +#include "RicSummaryPlotTemplateTools.h" + +#include "RiaGuiApplication.h" +#include "RiaLogging.h" +#include "RiaPreferences.h" +#include "RiaSummaryAddressAnalyzer.h" +#include "RiaSummaryTools.h" + +#include "RimEnsembleCurveSet.h" +#include "RimEnsembleCurveSetCollection.h" +#include "RimProject.h" +#include "RimSummaryAddress.h" +#include "RimSummaryCurve.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryPlot.h" + +#include "RiuFileDialogTools.h" + +#include "cafPdmObject.h" +#include "cafPdmUiPropertyViewDialog.h" +#include "cafSelectionManager.h" +#include "cafUtils.h" + +#include +#include +#include +#include + +CAF_CMD_SOURCE_INIT( RicSaveMultiPlotTemplateFeature, "RicSaveMultiPlotTemplateFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSaveMultiPlotTemplateFeature::isCommandEnabled() +{ + if ( selectedSummaryPlot() ) return true; + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSaveMultiPlotTemplateFeature::onActionTriggered( bool isChecked ) +{ + if ( !selectedSummaryPlot() ) return; + + RiaGuiApplication* app = RiaGuiApplication::instance(); + + QString fallbackPath; + auto folders = app->preferences()->plotTemplateFolders(); + if ( !folders.empty() ) + { + // Use the last folder from preferences as the default fall back folder + fallbackPath = folders.back(); + } + + QString startPath = app->lastUsedDialogDirectoryWithFallback( "PLOT_TEMPLATE", fallbackPath ); + + QString templateCandidateName = caf::Utils::makeValidFileBasename( selectedSummaryPlot()->description() ); + + startPath = startPath + "/" + templateCandidateName + ".rpt"; + + RicSaveMultiPlotTemplateFeatureSettings settings; + settings.setFilePath( startPath ); + + caf::PdmUiPropertyViewDialog propertyDialog( nullptr, &settings, "Export Plot Template", "" ); + if ( propertyDialog.exec() != QDialog::Accepted ) return; + + QString fileName = settings.filePath(); + if ( !fileName.isEmpty() ) + { + QFile exportFile( fileName ); + if ( !exportFile.open( QIODevice::WriteOnly | QIODevice::Text ) ) + { + RiaLogging::error( QString( "Save Plot Template : Could not open the file: %1" ).arg( fileName ) ); + return; + } + + QString objectAsText = createTextFromObject( selectedSummaryPlot(), settings ); + + QTextStream stream( &exportFile ); + stream << objectAsText; + + QString absPath = QFileInfo( fileName ).absolutePath(); + bool foundPathInPreferences = false; + for ( const auto& f : folders ) + { + if ( absPath.indexOf( f ) != -1 ) + { + foundPathInPreferences = true; + } + } + + if ( !foundPathInPreferences ) + { + QMessageBox msgBox; + msgBox.setIcon( QMessageBox::Question ); + + QString questionText; + questionText = QString( "The path is not part of the search path for templates.\n\nDo you want to append " + "the destination path to the search path?" ); + + msgBox.setText( questionText ); + msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel ); + + int ret = msgBox.exec(); + if ( ret == QMessageBox::Yes ) + { + app->preferences()->appendPlotTemplateFolders( absPath ); + app->preferences()->writePreferencesToApplicationStore(); + } + } + + app->setLastUsedDialogDirectory( "PLOT_TEMPLATE", absPath ); + + RicReloadPlotTemplatesFeature::rebuildFromDisc(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicSaveMultiPlotTemplateFeature::createTextFromObject( RimSummaryMultiPlot* summaryPlot, + const RicSaveMultiPlotTemplateFeatureSettings& settings ) +{ + if ( !summaryPlot ) return {}; + + QString objectAsText = summaryPlot->writeObjectToXmlString(); + + RiaSummaryAddressAnalyzer analyzer; + + { + std::vector addresses; + { + std::set sourceStrings; + + const QString summaryFieldKeyword = RicSummaryPlotTemplateTools::summaryCaseFieldKeyword(); + for ( const auto& curve : summaryPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) ) + { + auto fieldHandle = curve->findField( summaryFieldKeyword ); + if ( fieldHandle ) + { + auto reference = fieldHandle->xmlCapability()->referenceString(); + sourceStrings.insert( reference ); + } + + addresses.push_back( curve->summaryAddressY() ); + } + + replaceStrings( sourceStrings, + summaryFieldKeyword, + RicSummaryPlotTemplateTools::placeholderTextForSummaryCase(), + objectAsText ); + } + + { + std::set ensembleReferenceStrings; + + const QString summaryGroupFieldKeyword = RicSummaryPlotTemplateTools::summaryGroupFieldKeyword(); + + for ( const auto& curveSet : summaryPlot->curveSets() ) + { + auto fieldHandle = curveSet->findField( summaryGroupFieldKeyword ); + if ( fieldHandle ) + { + auto reference = fieldHandle->xmlCapability()->referenceString(); + ensembleReferenceStrings.insert( reference ); + } + + addresses.push_back( curveSet->summaryAddress() ); + } + + replaceStrings( ensembleReferenceStrings, + summaryGroupFieldKeyword, + RicSummaryPlotTemplateTools::placeholderTextForSummaryGroup(), + objectAsText ); + } + + analyzer.appendAddresses( addresses ); + } + + RimSummaryAddress dummy; + + if ( settings.usePlacholderForWells() ) + { + std::set sourceStrings; + for ( const auto& wellName : analyzer.wellNames() ) + { + sourceStrings.insert( QString::fromStdString( wellName ) ); + } + + replaceStrings( sourceStrings, + dummy.keywordForCategory( RifEclipseSummaryAddress::SUMMARY_WELL ), + RicSummaryPlotTemplateTools::placeholderTextForWell(), + objectAsText ); + } + + if ( settings.usePlacholderForWellGroups() ) + { + std::set sourceStrings; + for ( const auto& wellGroupName : analyzer.wellGroupNames() ) + { + sourceStrings.insert( QString::fromStdString( wellGroupName ) ); + } + + replaceStrings( sourceStrings, + dummy.keywordForCategory( RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ), + RicSummaryPlotTemplateTools::placeholderTextForWellGroup(), + objectAsText ); + } + + if ( settings.usePlacholderForRegions() ) + { + std::vector regionNumbers; + for ( auto regNumber : analyzer.regionNumbers() ) + { + regionNumbers.push_back( regNumber ); + } + + for ( int i = 0; i < static_cast( regionNumbers.size() ); i++ ) + { + // Encode placeholder index. Use negative values below -1 to represent a placeholder index + int index = -( i + 2 ); + + QString fieldKeyword = dummy.keywordForCategory( RifEclipseSummaryAddress::SUMMARY_REGION ); + QString sourceString = QString( "<%1>%2" ).arg( fieldKeyword ).arg( regionNumbers[i] ); + QString replacementTextWithIndex = QString( "<%1>%2" ).arg( fieldKeyword ).arg( index ); + + objectAsText.replace( sourceString, replacementTextWithIndex ); + } + } + + return objectAsText; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSaveMultiPlotTemplateFeature::replaceStrings( const std::set& sourceStrings, + const QString& fieldKeyword, + const QString& placeholderText, + QString& objectAsText ) +{ + size_t index = 0; + for ( const auto& sourceString : sourceStrings ) + { + QString sourceTextWithTags = QString( "<%1>%2" ).arg( fieldKeyword ).arg( sourceString ); + + QString replacementTextWithIndex = + QString( "<%1>%2 %3" ).arg( fieldKeyword ).arg( placeholderText ).arg( index++ ); + + objectAsText.replace( sourceTextWithTags, replacementTextWithIndex ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSaveMultiPlotTemplateFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Save As Plot Template" ); + actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot* RicSaveMultiPlotTemplateFeature::selectedSummaryPlot() const +{ + return dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); +} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.h new file mode 100644 index 0000000000..0d4edbc861 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.h @@ -0,0 +1,51 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +#include + +class RimSummaryMultiPlot; +class RicSaveMultiPlotTemplateFeatureSettings; + +//================================================================================================== +/// +//================================================================================================== +class RicSaveMultiPlotTemplateFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + +private: + static QString createTextFromObject( RimSummaryMultiPlot* summaryPlot, + const RicSaveMultiPlotTemplateFeatureSettings& settings ); + + static void replaceStrings( const std::set& sourceStrings, + const QString& fieldKeyword, + const QString& placeholderText, + QString& objectAsText ); + +private: + RimSummaryMultiPlot* selectedSummaryPlot() const; +}; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp new file mode 100644 index 0000000000..531029b6c1 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp @@ -0,0 +1,108 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#include "RicSaveMultiPlotTemplateFeatureSettings.h" +#include "cafPdmUiFilePathEditor.h" + +CAF_PDM_SOURCE_INIT( RicSaveMultiPlotTemplateFeatureSettings, "RicSaveMultiPlotTemplateFeatureSettings" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicSaveMultiPlotTemplateFeatureSettings::RicSaveMultiPlotTemplateFeatureSettings() +{ + CAF_PDM_InitObject( "Save Summary Plot", ":/CrossSection16x16.png" ); + + CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" ); + + CAF_PDM_InitField( &m_replaceWells, "ReplaceWells", true, "Wells" ); + CAF_PDM_InitField( &m_replaceWellGroups, "ReplaceWellGroups", true, "Well Groups" ); + CAF_PDM_InitField( &m_replaceRegions, "ReplaceRegions", true, "Regions" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSaveMultiPlotTemplateFeatureSettings::setFilePath( const QString& filePath ) +{ + m_filePath = filePath; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicSaveMultiPlotTemplateFeatureSettings::filePath() const +{ + return m_filePath().path(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForWells() const +{ + return m_replaceWells; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForWellGroups() const +{ + return m_replaceWellGroups; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForRegions() const +{ + return m_replaceRegions; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSaveMultiPlotTemplateFeatureSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + uiOrdering.add( &m_filePath ); + + { + auto group = uiOrdering.addNewGroup( "Use Placeholders for Objects" ); + group->add( &m_replaceWells ); + group->add( &m_replaceWellGroups ); + group->add( &m_replaceRegions ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSaveMultiPlotTemplateFeatureSettings::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + if ( field == &m_filePath ) + { + auto attr = dynamic_cast( attribute ); + if ( attr ) + { + attr->m_selectSaveFileName = true; + attr->m_fileSelectionFilter = "Plot Template Files(*.rpt);; All files(*.*)"; + } + } +} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h new file mode 100644 index 0000000000..6fa3fae734 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h @@ -0,0 +1,53 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafFilePath.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" + +//================================================================================================== +/// +//================================================================================================== +class RicSaveMultiPlotTemplateFeatureSettings : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RicSaveMultiPlotTemplateFeatureSettings(); + + void setFilePath( const QString& filePath ); + QString filePath() const; + + bool usePlacholderForWells() const; + bool usePlacholderForWellGroups() const; + bool usePlacholderForRegions() const; + +private: + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; + +private: + caf::PdmField m_filePath; + caf::PdmField m_replaceWells; + caf::PdmField m_replaceWellGroups; + caf::PdmField m_replaceRegions; +}; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index e7ddedd6e3..42d26b4634 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -33,8 +33,10 @@ #include "RimEnsembleCurveSetCollection.h" #include "RimMainPlotCollection.h" #include "RimProject.h" +#include "RimSummaryAddressCollection.h" #include "RimSummaryCase.h" #include "RimSummaryCurve.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotCollection.h" @@ -46,6 +48,132 @@ #include #include +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot* RicSummaryPlotTemplateTools::createMultiPlotFromTemplateFile( const QString& fileName ) +{ + QFile importFile( fileName ); + if ( !importFile.open( QIODevice::ReadOnly | QIODevice::Text ) ) + { + RiaLogging::error( QString( "Create Plot from Template : Could not open the file: %1" ).arg( fileName ) ); + return nullptr; + } + + QTextStream stream( &importFile ); + + QString objectAsText = stream.readAll(); + + caf::PdmObjectHandle* obj = + caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText, + caf::PdmDefaultObjectFactory::instance(), + true ); + + return dynamic_cast( obj ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryMultiPlot* summaryMultiPlot, + const std::vector& selectedSummaryCases, + const std::vector& selectedEnsembles, + const std::vector& wellNames, + const std::vector& wellGroupNames, + const std::vector& regions ) + +{ + // Assumes this plot is inserted into the project. This is required when assigning the ptrFields + RimProject* proj = nullptr; + summaryMultiPlot->firstAncestorOfType( proj ); + CAF_ASSERT( proj ); + + auto plots = summaryMultiPlot->plots(); + for ( auto p : plots ) + { + auto summaryPlot = dynamic_cast( p ); + if ( summaryPlot ) + setValuesForPlaceholders( summaryPlot, selectedSummaryCases, selectedEnsembles, wellNames, wellGroupNames, regions ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryPlot* summaryPlot, + const std::vector& selectedSummaryCases, + const std::vector& selectedEnsembles, + const std::vector& wellNames, + const std::vector& wellGroupNames, + const std::vector& regions ) +{ + // Assumes this plot is inserted into the project. This is required when assigning the ptrFields + RimProject* proj = nullptr; + summaryPlot->firstAncestorOfType( proj ); + CAF_ASSERT( proj ); + + { + // Replace single summary curves data sources + + auto summaryCurves = summaryPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ); + for ( const auto& curve : summaryCurves ) + { + auto fieldHandle = curve->findField( RicSummaryPlotTemplateTools::summaryCaseFieldKeyword() ); + if ( fieldHandle ) + { + bool conversionOk = false; + const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForSummaryCase(); + + auto referenceString = fieldHandle->xmlCapability()->referenceString(); + int indexValue = + RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, referenceString, &conversionOk ); + + if ( conversionOk && indexValue >= 0 && indexValue < static_cast( selectedSummaryCases.size() ) ) + { + auto summaryCaseY = selectedSummaryCases[static_cast( indexValue )]; + curve->setSummaryCaseY( summaryCaseY ); + } + } + + // Replace placeholders with object names from selection + auto curveAdr = curve->summaryAddressY(); + setPlaceholderWellName( &curveAdr, wellNames ); + setPlaceholderWellGroupName( &curveAdr, wellGroupNames ); + setPlaceholderRegion( &curveAdr, regions ); + curve->setSummaryAddressY( curveAdr ); + } + + for ( const auto& curveSet : summaryPlot->curveSets() ) + { + const QString summaryGroupFieldKeyword = RicSummaryPlotTemplateTools::summaryGroupFieldKeyword(); + + auto fieldHandle = curveSet->findField( summaryGroupFieldKeyword ); + if ( fieldHandle ) + { + bool conversionOk = false; + const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForSummaryGroup(); + + auto referenceString = fieldHandle->xmlCapability()->referenceString(); + int indexValue = + RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, referenceString, &conversionOk ); + + if ( conversionOk && indexValue >= 0 && indexValue < static_cast( selectedEnsembles.size() ) ) + { + auto ensembleCase = selectedEnsembles[static_cast( indexValue )]; + curveSet->setSummaryCaseCollection( ensembleCase ); + } + } + + // Replace placeholders with object names from selection + auto curveAdr = curveSet->summaryAddress(); + setPlaceholderWellName( &curveAdr, wellNames ); + setPlaceholderWellGroupName( &curveAdr, wellGroupNames ); + setPlaceholderRegion( &curveAdr, regions ); + curveSet->setSummaryAddress( curveAdr ); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -351,7 +479,7 @@ QString RicSummaryPlotTemplateTools::selectPlotTemplatePath() return fileName; } - return QString(); + return {}; } //-------------------------------------------------------------------------------------------------- @@ -376,6 +504,17 @@ std::vector RicSummaryPlotTemplateTools::selectedSumm return objects; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicSummaryPlotTemplateTools::selectedSummaryAddressCollections() +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType( &objects ); + + return objects; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -397,7 +536,7 @@ QString RicSummaryPlotTemplateTools::summaryGroupFieldKeyword() //-------------------------------------------------------------------------------------------------- QString RicSummaryPlotTemplateTools::placeholderTextForSummaryCase() { - return "CASE_NAME"; + return "__CASE_NAME__"; } //-------------------------------------------------------------------------------------------------- @@ -405,7 +544,23 @@ QString RicSummaryPlotTemplateTools::placeholderTextForSummaryCase() //-------------------------------------------------------------------------------------------------- QString RicSummaryPlotTemplateTools::placeholderTextForSummaryGroup() { - return "ENSEMBLE_NAME"; + return "__ENSEMBLE_NAME__"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicSummaryPlotTemplateTools::placeholderTextForWell() +{ + return "__WELL_NAME__"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicSummaryPlotTemplateTools::placeholderTextForWellGroup() +{ + return "__WELL_GROUP__"; } //-------------------------------------------------------------------------------------------------- @@ -423,7 +578,7 @@ RifEclipseSummaryAddress } } - return RifEclipseSummaryAddress(); + return {}; } //-------------------------------------------------------------------------------------------------- @@ -461,3 +616,64 @@ int RicSummaryPlotTemplateTools::findValueForKeyword( const QString& keyword, co return -1; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotTemplateTools::setPlaceholderWellName( RifEclipseSummaryAddress* summaryAddress, + const std::vector& wellNames ) +{ + if ( wellNames.empty() ) return; + + auto sourceWellName = QString::fromStdString( summaryAddress->wellName() ); + bool conversionOk = false; + const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForWell(); + + int indexValue = RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, sourceWellName, &conversionOk ); + if ( conversionOk && indexValue >= 0 && indexValue < static_cast( wellNames.size() ) ) + { + summaryAddress->setWellName( wellNames[indexValue].toStdString() ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotTemplateTools::setPlaceholderWellGroupName( RifEclipseSummaryAddress* summaryAddress, + const std::vector& wellGroupNames ) +{ + if ( wellGroupNames.empty() ) return; + + auto sourceWellGroupName = QString::fromStdString( summaryAddress->wellGroupName() ); + bool conversionOk = false; + const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForWellGroup(); + + int indexValue = + RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, sourceWellGroupName, &conversionOk ); + if ( conversionOk && indexValue >= 0 && indexValue < static_cast( wellGroupNames.size() ) ) + { + summaryAddress->setWellGroupName( wellGroupNames[indexValue].toStdString() ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSummaryPlotTemplateTools::setPlaceholderRegion( RifEclipseSummaryAddress* summaryAddress, + const std::vector& regions ) +{ + CAF_ASSERT( summaryAddress ); + if ( regions.empty() ) return; + + int indexValue = summaryAddress->regionNumber(); + if ( indexValue < -1 ) + { + indexValue = -( indexValue - 2 ); + + bool conversionOk = false; + if ( conversionOk && indexValue >= 0 && indexValue < static_cast( regions.size() ) ) + { + summaryAddress->setRegion( regions[indexValue].toInt() ); + } + } +} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h index 93166a6039..6fd3dddd34 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h @@ -32,6 +32,8 @@ class RimSummaryPlot; class RimSummaryCase; class RimSummaryCaseCollection; class RifEclipseSummaryAddress; +class RimSummaryMultiPlot; +class RimSummaryAddressCollection; //================================================================================================== /// @@ -39,6 +41,22 @@ class RifEclipseSummaryAddress; class RicSummaryPlotTemplateTools { public: + static RimSummaryMultiPlot* createMultiPlotFromTemplateFile( const QString& fileName ); + + static void setValuesForPlaceholders( RimSummaryMultiPlot* summaryMultiPlot, + const std::vector& selectedSummaryCases, + const std::vector& selectedEnsembles, + const std::vector& wellNames, + const std::vector& wellGroupNames, + const std::vector& regions ); + + static void setValuesForPlaceholders( RimSummaryPlot* summaryPlot, + const std::vector& selectedSummaryCases, + const std::vector& selectedEnsembles, + const std::vector& wellNames, + const std::vector& wellGroupNames, + const std::vector& regions ); + static RimSummaryPlot* createPlotFromTemplateFile( const QString& fileName ); static void appendSummaryPlotToPlotCollection( RimSummaryPlot* summaryPlot, const std::vector& selectedSummaryCases, @@ -55,14 +73,24 @@ class RicSummaryPlotTemplateTools static std::vector selectedSummaryCases(); static std::vector selectedSummaryCaseCollections(); + static std::vector selectedSummaryAddressCollections(); + static QString summaryCaseFieldKeyword(); static QString summaryGroupFieldKeyword(); + static QString placeholderTextForSummaryCase(); static QString placeholderTextForSummaryGroup(); + static QString placeholderTextForWell(); + static QString placeholderTextForWellGroup(); private: static RifEclipseSummaryAddress firstAddressByQuantity( const RifEclipseSummaryAddress& sourceAddress, const std::set& allAddresses ); static int findValueForKeyword( const QString& keyword, const QString& valueString, bool* ok ); + + static void setPlaceholderWellName( RifEclipseSummaryAddress* summaryAddress, const std::vector& wellNames ); + static void setPlaceholderWellGroupName( RifEclipseSummaryAddress* summaryAddress, + const std::vector& wellGroupNames ); + static void setPlaceholderRegion( RifEclipseSummaryAddress* summaryAddress, const std::vector& regions ); }; diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 8341edceb1..2578cbc8b0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -119,6 +119,7 @@ #include "RimStimPlanModelTemplateCollection.h" #include "RimStreamlineInViewCollection.h" #include "RimSummaryAddress.h" +#include "RimSummaryAddressCollection.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" @@ -1036,6 +1037,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "Separator"; menuBuilder << "RicSnapshotViewToPdfFeature"; + menuBuilder << "RicSaveMultiPlotTemplateFeature"; } else if ( dynamic_cast( firstUiItem ) ) { @@ -1045,6 +1047,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() { menuBuilder << "RicNewStreamlineFeature"; } + else if ( dynamic_cast( firstUiItem ) ) + { + menuBuilder << "RicCreateMultiPlotFromSelectionFeature"; + } if ( dynamic_cast( firstUiItem ) ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index d9618af083..05377dbd12 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -20,6 +20,7 @@ #include "RiaPreferences.h" #include "RiaPreferencesSummary.h" +#include "RiaVersionInfo.h" #include "RimPlot.h" #include "RimProject.h" @@ -47,6 +48,9 @@ RimMultiPlot::RimMultiPlot() { CAF_PDM_InitObject( "Multi Plot", ":/MultiPlot16x16.png" ); + CAF_PDM_InitFieldNoDefault( &m_projectFileVersionString, "ProjectFileVersionString", "" ); + m_projectFileVersionString.uiCapability()->setUiHidden( true ); + CAF_PDM_InitField( &m_showPlotWindowTitle, "ShowTitleInPlot", true, "Show Title" ); CAF_PDM_InitField( &m_plotWindowTitle, "PlotDescription", QString( "" ), "Name" ); @@ -131,6 +135,14 @@ QString RimMultiPlot::description() const return multiPlotTitle(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimMultiPlot::projectFileVersionString() const +{ + return m_projectFileVersionString(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -863,6 +875,14 @@ void RimMultiPlot::cleanupBeforeClose() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::setupBeforeSave() +{ + m_projectFileVersionString = STRPRODUCTVER; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 0a1b0e3f95..dd27fe9ca4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -58,6 +58,7 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection m_projectFileVersionString; caf::PdmField m_showPlotWindowTitle; caf::PdmField m_plotWindowTitle; caf::PdmField m_columnCount; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp index 932e938aea..96f752f829 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp @@ -198,6 +198,20 @@ RiaDefines::PhaseType RimSummaryAddress::addressPhaseType() const return RiaDefines::PhaseType::PHASE_NOT_APPLICABLE; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryAddress::keywordForCategory( RifEclipseSummaryAddress::SummaryVarCategory category ) const +{ + // Return the keyword text for supported field replacement in plot templates + + if ( category == RifEclipseSummaryAddress::SUMMARY_WELL ) return m_wellName.keyword(); + if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ) return m_wellGroupName.keyword(); + if ( category == RifEclipseSummaryAddress::SUMMARY_REGION ) return m_regionNumber.keyword(); + + return {}; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h index 5a1fb208d3..dc37e85205 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h @@ -63,6 +63,8 @@ class RimSummaryAddress : public caf::PdmObject RiaDefines::PhaseType addressPhaseType() const; + QString keywordForCategory( RifEclipseSummaryAddress::SummaryVarCategory category ) const; + protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; From 22d6e3f853fb99d90c345bd9c1a43161617a4a79 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Fri, 1 Apr 2022 19:23:27 +0200 Subject: [PATCH 209/406] Merge pull request #8765 from OPM/summarymultiplot_performance2 Summary Multiplot performance improvements and fixes --- .../RiaPlotWindowRedrawScheduler.cpp | 3 +- .../RicSummaryPlotBuilder.cpp | 32 +++++++++++-- .../RicDeleteSubPlotFeature.cpp | 10 ++-- .../ProjectDataModel/RimMultiPlot.cpp | 28 +++++++++-- .../ProjectDataModel/RimMultiPlot.h | 11 +++-- .../ProjectDataModel/RimPlot.cpp | 3 -- .../Summary/RimEnsembleCurveSetCollection.cpp | 12 ++++- .../Summary/RimEnsembleCurveSetCollection.h | 1 + .../Summary/RimSummaryCurveCollection.cpp | 12 ++++- .../Summary/RimSummaryCurveCollection.h | 1 + .../Summary/RimSummaryMultiPlot.cpp | 47 ++++++++++++++----- .../Summary/RimSummaryMultiPlot.h | 6 ++- .../Summary/RimSummaryMultiPlotCollection.cpp | 11 +---- .../Summary/RimSummaryPlot.cpp | 32 +++++++------ .../UserInterface/RiuMultiPlotBook.cpp | 25 +++++++--- .../UserInterface/RiuMultiPlotBook.h | 3 +- .../UserInterface/RiuMultiPlotPage.cpp | 1 + .../UserInterface/RiuSummaryQtChartsPlot.cpp | 4 +- .../UserInterface/RiuSummaryQtChartsPlot.h | 3 +- 19 files changed, 175 insertions(+), 70 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp index 86e2403c07..2054152762 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp @@ -118,7 +118,8 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() if ( pagesToUpdate.count( page ) > 0 ) pagesToUpdate.erase( page ); } - plotWindow->performUpdate(); + const bool regeneratePages = true; + plotWindow->performUpdate( regeneratePages ); updatedPlotWindows.insert( plotWindow ); } } diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 718ed2af7f..bd251f33a2 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -336,7 +336,14 @@ RimMultiPlot* RicSummaryPlotBuilder::createAndAppendMultiPlot( const std::vector plotCollection->updateAllRequiredEditors(); plotWindow->loadDataAndUpdate(); - RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); + if ( !plots.empty() ) + { + RiuPlotMainWindowTools::selectAsCurrentItem( plots[0], true ); + } + else + { + RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow, true ); + } return plotWindow; } @@ -360,8 +367,16 @@ RimSummaryMultiPlot* plotCollection->updateAllRequiredEditors(); plotWindow->loadDataAndUpdate(); - RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); - RiuPlotMainWindowTools::setExpanded( plotWindow, true ); + if ( plotWindow->summaryPlots().size() == 1 ) + { + RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow->summaryPlots()[0] ); + RiuPlotMainWindowTools::setExpanded( plotWindow->summaryPlots()[0], true ); + } + else + { + RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); + RiuPlotMainWindowTools::setExpanded( plotWindow, true ); + } return plotWindow; } @@ -425,7 +440,7 @@ RimSummaryMultiPlot* plotWindow->loadDataAndUpdate(); plotWindow->updateAllRequiredEditors(); - RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); + RiuPlotMainWindowTools::selectAsCurrentItem( plot ); return plotWindow; } @@ -448,7 +463,14 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con plotWindow->loadDataAndUpdate(); plotWindow->updateAllRequiredEditors(); - RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); + if ( !plots.empty() ) + { + RiuPlotMainWindowTools::selectAsCurrentItem( plots[0] ); + } + else + { + RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); + } return plotWindow; } diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp index ec5b74e0f2..72050a6372 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp @@ -75,7 +75,7 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked ) std::vector selection; caf::SelectionManager::instance()->objectsByType( &selection ); - std::set alteredPlotWindows; + std::set alteredPlotWindows; for ( RimPlot* plot : selection ) { @@ -94,18 +94,22 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked ) if ( multiPlot ) { alteredPlotWindows.insert( multiPlot ); - multiPlot->removePlot( plot ); + multiPlot->removePlotNoUpdate( plot ); multiPlot->updateConnectedEditors(); delete plot; } else if ( wellLogPlot ) { - alteredPlotWindows.insert( wellLogPlot ); wellLogPlot->removePlot( plot ); wellLogPlot->updateConnectedEditors(); delete plot; } } + + for ( auto mainplot : alteredPlotWindows ) + { + mainplot->updateAfterPlotRemove(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 05377dbd12..7045f81689 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -190,10 +190,9 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index ) if ( m_viewer ) { - plot->createPlotWidget(); + plot->createPlotWidget( m_viewer ); m_viewer->insertPlot( plot->plotWidget(), index ); } - plot->setShowWindow( true ); plot->updateAfterInsertingIntoMultiPlot(); onPlotAdditionOrRemoval(); @@ -217,6 +216,29 @@ void RimMultiPlot::removePlot( RimPlot* plot ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::removePlotNoUpdate( RimPlot* plot ) +{ + if ( plot ) + { + if ( m_viewer ) + { + m_viewer->removePlotNoUpdate( plot->plotWidget() ); + } + m_plots.removeChildObject( plot ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::updateAfterPlotRemove() +{ + onPlotAdditionOrRemoval(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -851,7 +873,7 @@ void RimMultiPlot::recreatePlotWidgets() for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx ) { - plotVector[tIdx]->createPlotWidget(); + plotVector[tIdx]->createPlotWidget( m_viewer ); m_viewer->addPlot( plotVector[tIdx]->plotWidget() ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index dd27fe9ca4..4333a6f306 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -69,6 +69,9 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection& plots, int insertAtPosition ); + virtual void removePlotNoUpdate( RimPlot* plot ); + virtual void updateAfterPlotRemove(); + void deleteAllPlots() override; size_t plotCount() const override; @@ -122,8 +125,10 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) override; - void onLoadDataAndUpdate() override; - void initAfterRead() override; + + void onLoadDataAndUpdate() override; + void initAfterRead() override; + void applyPlotWindowTitleToWidgets(); void updatePlots(); @@ -131,6 +136,7 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection& referringObjects ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index be39945899..c221fd53f9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -159,9 +159,6 @@ void RimPlot::removeFromMdiAreaAndCollection() void RimPlot::updateAfterInsertingIntoMultiPlot() { loadDataAndUpdate(); - /* updateLegend(); - updateAxes(); - updateLayout(); */ } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp index b2156944cb..f9dc17d1d2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp @@ -93,13 +93,21 @@ void RimEnsembleCurveSetCollection::loadDataAndUpdate( bool updateParentPlot ) /// //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSetCollection::setParentPlotAndReplot( RiuPlotWidget* plot ) +{ + setParentPlotNoReplot( plot ); + + if ( plot ) plot->replot(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEnsembleCurveSetCollection::setParentPlotNoReplot( RiuPlotWidget* plot ) { for ( RimEnsembleCurveSet* curveSet : m_curveSets ) { curveSet->setParentPlotNoReplot( plot ); } - - if ( plot ) plot->replot(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h index 331e986e22..34c17d89c0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.h @@ -44,6 +44,7 @@ class RimEnsembleCurveSetCollection : public caf::PdmObject void loadDataAndUpdate( bool updateParentPlot ); void setParentPlotAndReplot( RiuPlotWidget* plot ); + void setParentPlotNoReplot( RiuPlotWidget* plot ); void detachPlotCurves(); void reattachPlotCurves(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index bd019f859c..d88968c35a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -125,13 +125,21 @@ void RimSummaryCurveCollection::loadDataAndUpdate( bool updateParentPlot ) /// //-------------------------------------------------------------------------------------------------- void RimSummaryCurveCollection::setParentPlotAndReplot( RiuPlotWidget* plot ) +{ + setParentPlotNoReplot( plot ); + + if ( plot ) plot->replot(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurveCollection::setParentPlotNoReplot( RiuPlotWidget* plot ) { for ( RimSummaryCurve* curve : m_curves ) { curve->setParentPlotNoReplot( plot ); } - - if ( plot ) plot->replot(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h index e77dd4392f..ba1a55eeff 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h @@ -64,6 +64,7 @@ class RimSummaryCurveCollection : public caf::PdmObject private: void setParentPlotAndReplot( RiuPlotWidget* plot ); + void setParentPlotNoReplot( RiuPlotWidget* plot ); void detachPlotCurves(); void reattachPlotCurves(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index ef9dd41c54..b9f9c86512 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -52,7 +52,6 @@ CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlot::RimSummaryMultiPlot() : duplicatePlot( this ) - , refreshTree( this ) { CAF_PDM_InitObject( "Multi Summary Plot" ); this->setDeletable( true ); @@ -117,7 +116,6 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) { sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); RimMultiPlot::insertPlot( plot, index ); - signalRefresh(); } } @@ -150,10 +148,30 @@ void RimSummaryMultiPlot::removePlot( RimPlot* plot ) if ( sumPlot ) { RimMultiPlot::removePlot( plot ); - signalRefresh(); } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::removePlotNoUpdate( RimPlot* plot ) +{ + RimSummaryPlot* sumPlot = dynamic_cast( plot ); + CVF_ASSERT( sumPlot != nullptr ); + if ( sumPlot ) + { + RimMultiPlot::removePlotNoUpdate( plot ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::updateAfterPlotRemove() +{ + onPlotAdditionOrRemoval(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -387,6 +405,21 @@ std::vector RimSummaryMultiPlot::summaryPlots() const return typedPlots; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryMultiPlot::visibleSummaryPlots() const +{ + std::vector visiblePlots; + + for ( auto plot : summaryPlots() ) + { + if ( plot->showWindow() ) visiblePlots.push_back( plot ); + } + + return visiblePlots; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -535,14 +568,6 @@ void RimSummaryMultiPlot::duplicate() duplicatePlot.send( this ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::signalRefresh() -{ - refreshTree.send( this ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 364d4b1c73..640f0efca1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -46,7 +46,6 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep public: caf::Signal duplicatePlot; - caf::Signal refreshTree; public: RimSummaryMultiPlot(); @@ -66,6 +65,9 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void insertPlot( RimPlot* plot, size_t index ) override; void removePlot( RimPlot* plot ) override; + void removePlotNoUpdate( RimPlot* plot ) override; + void updateAfterPlotRemove() override; + std::vector fieldsToShowInToolbar(); void syncAxisRanges(); @@ -75,6 +77,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void summaryPlotItemInfos( QList* optionInfos ) const; std::vector summaryPlots() const; + std::vector visibleSummaryPlots() const; protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; @@ -93,7 +96,6 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void updatePlotWindowTitle() override; void duplicate(); - void signalRefresh(); void onSubPlotChanged( const caf::SignalEmitter* emitter ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp index a1ed1abe75..4872f2ecc7 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -55,7 +55,6 @@ void RimSummaryMultiPlotCollection::initAfterRead() for ( auto& plot : m_summaryMultiPlots ) { plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot ); - plot->refreshTree.connect( this, &RimSummaryMultiPlotCollection::onRefreshTree ); } } @@ -82,7 +81,6 @@ void RimSummaryMultiPlotCollection::addSummaryMultiPlot( RimSummaryMultiPlot* pl { m_summaryMultiPlots().push_back( plot ); plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot ); - plot->refreshTree.connect( this, &RimSummaryMultiPlotCollection::onRefreshTree ); } //-------------------------------------------------------------------------------------------------- @@ -141,14 +139,7 @@ void RimSummaryMultiPlotCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering { for ( auto& plot : m_summaryMultiPlots() ) { - if ( plot->summaryPlots().size() == 1 ) - { - uiTreeOrdering.add( plot->summaryPlots()[0] ); - } - else - { - uiTreeOrdering.add( plot ); - } + uiTreeOrdering.add( plot ); } uiTreeOrdering.skipRemainingChildren( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 894403fc4e..f210b1f283 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1586,7 +1586,10 @@ void RimSummaryPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin void RimSummaryPlot::onLoadDataAndUpdate() { updatePlotTitle(); - updateMdiWindowVisibility(); + + RimMultiPlot* plotWindow = nullptr; + firstAncestorOrThisOfType( plotWindow ); + if ( plotWindow == nullptr ) updateMdiWindowVisibility(); if ( m_summaryCurveCollection ) { @@ -1623,18 +1626,17 @@ void RimSummaryPlot::onLoadDataAndUpdate() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updateZoomInParentPlot() { - if ( plotWidget() ) - { - for ( const auto& axisProperty : m_axisProperties ) - { - updateZoomForAxis( axisProperty->plotAxisType() ); - } + if ( !plotWidget() ) return; - plotWidget()->updateAxes(); - updateZoomFromParentPlot(); - plotWidget()->updateZoomDependentCurveProperties(); - plotWidget()->scheduleReplot(); + for ( const auto& axisProperty : m_axisProperties ) + { + updateZoomForAxis( axisProperty->plotAxisType() ); } + + plotWidget()->updateAxes(); + updateZoomFromParentPlot(); + plotWidget()->updateZoomDependentCurveProperties(); + plotWidget()->scheduleReplot(); } //-------------------------------------------------------------------------------------------------- @@ -2180,7 +2182,7 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent if ( useQtCharts ) { - m_summaryPlot = std::make_unique( this ); + m_summaryPlot = std::make_unique( this, mainWindowParent ); } else { @@ -2207,12 +2209,12 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent if ( m_summaryCurveCollection ) { - m_summaryCurveCollection->setParentPlotAndReplot( plotWidget() ); + m_summaryCurveCollection->setParentPlotNoReplot( plotWidget() ); } if ( m_ensembleCurveSetCollection ) { - m_ensembleCurveSetCollection->setParentPlotAndReplot( plotWidget() ); + m_ensembleCurveSetCollection->setParentPlotNoReplot( plotWidget() ); } this->connect( plotWidget(), SIGNAL( plotZoomed() ), SLOT( onPlotZoomed() ) ); @@ -2220,6 +2222,8 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent updatePlotTitle(); } + plotWidget()->setParent( mainWindowParent ); + return plotWidget(); } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index ea152de7cf..4176c29162 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -183,6 +183,15 @@ void RiuMultiPlotBook::insertPlot( RiuPlotWidget* plotWidget, size_t index ) /// //-------------------------------------------------------------------------------------------------- void RiuMultiPlotBook::removePlot( RiuPlotWidget* plotWidget ) +{ + removePlotNoUpdate( plotWidget ); + scheduleUpdate(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::removePlotNoUpdate( RiuPlotWidget* plotWidget ) { if ( !plotWidget ) return; @@ -190,8 +199,6 @@ void RiuMultiPlotBook::removePlot( RiuPlotWidget* plotWidget ) CVF_ASSERT( plotWidgetIdx >= 0 ); m_plotWidgets.removeAt( plotWidgetIdx ); - - scheduleUpdate(); } //-------------------------------------------------------------------------------------------------- @@ -383,7 +390,8 @@ void RiuMultiPlotBook::showEvent( QShowEvent* event ) { m_goToPageAfterUpdate = true; QWidget::showEvent( event ); - performUpdate(); + const bool regeneratePages = false; + performUpdate( regeneratePages ); if ( m_previewMode ) { applyPagePreviewBookSize( width() ); @@ -473,16 +481,19 @@ bool RiuMultiPlotBook::showYAxis( int row, int column ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotBook::performUpdate() +void RiuMultiPlotBook::performUpdate( bool regeneratePages ) { applyLook(); - deleteAllPages(); - createPages(); + if ( regeneratePages || m_pages.size() == 0 ) + { + deleteAllPages(); + createPages(); + } updateGeometry(); // use a timer to trigger a viewer page change, if needed if ( m_goToPageAfterUpdate ) { - m_pageTimerId = startTimer( 100 ); + m_pageTimerId = startTimer( 50 ); m_goToPageAfterUpdate = false; } } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index debe9476cf..92e81807e9 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -62,6 +62,7 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void addPlot( RiuPlotWidget* plotWidget ); void insertPlot( RiuPlotWidget* plotWidget, size_t index ); void removePlot( RiuPlotWidget* plotWidget ); + void removePlotNoUpdate( RiuPlotWidget* plotWidget ); void removeAllPlots(); void setPlotTitle( const QString& plotTitle ); @@ -120,7 +121,7 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void changeCurrentPage( int pageNumber ); private slots: - virtual void performUpdate(); + virtual void performUpdate( bool regeneratePages ); protected: friend class RiaPlotWindowRedrawScheduler; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 3e790389a5..fc29eca0fc 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -62,6 +62,7 @@ #include #include #include +#include #include diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp index 91c8b0b134..ec7a8936c5 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.cpp @@ -30,10 +30,10 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuSummaryQtChartsPlot::RiuSummaryQtChartsPlot( RimSummaryPlot* plot ) +RiuSummaryQtChartsPlot::RiuSummaryQtChartsPlot( RimSummaryPlot* plot, QWidget* parent ) : RiuSummaryPlot( plot ) { - m_plotWidget = new RiuQtChartsPlotWidget( plot, nullptr, new RimEnsembleCurveInfoTextProvider ); + m_plotWidget = new RiuQtChartsPlotWidget( plot, parent, new RimEnsembleCurveInfoTextProvider ); m_plotWidget->setContextMenuPolicy( Qt::CustomContextMenu ); connect( m_plotWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( showContextMenu( QPoint ) ) ); diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h index eda7e71429..26cbf33154 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQtChartsPlot.h @@ -25,6 +25,7 @@ #include +class QWidget; class RimSummaryPlot; class RimPlotAxisPropertiesInterface; @@ -38,7 +39,7 @@ class RiuSummaryQtChartsPlot : public RiuSummaryPlot Q_OBJECT; public: - RiuSummaryQtChartsPlot( RimSummaryPlot* plot ); + RiuSummaryQtChartsPlot( RimSummaryPlot* plot, QWidget* parent ); ~RiuSummaryQtChartsPlot() override; void useDateBasedTimeAxis( From dde0487024a466dc697ed78559144fbac38221f7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 24 Mar 2022 12:53:06 +0100 Subject: [PATCH 210/406] Multiaxis: add support for Qwt multiaxis plot --- .../Commands/RicGridStatisticsDialog.cpp | 8 +- .../AnalysisPlots/RimAnalysisPlot.cpp | 6 +- .../RimCorrelationMatrixPlot.cpp | 10 +- .../GridCrossPlots/RimGridCrossPlot.cpp | 4 +- .../Summary/RimSummaryPlot.cpp | 6 +- .../Summary/RimSummaryPlotAxisFormatter.cpp | 2 +- .../WellLog/RimWellLogTrack.cpp | 32 +++---- .../RiuGroupedBarChartBuilder.cpp | 8 +- .../UserInterface/RiuDockedQwtPlot.cpp | 4 +- .../RiuFlowCharacteristicsPlot.cpp | 20 ++-- .../UserInterface/RiuGridCrossQwtPlot.cpp | 4 +- .../UserInterface/RiuMohrsCirclePlot.cpp | 16 ++-- .../UserInterface/RiuMultiPlotPage.cpp | 6 +- .../UserInterface/RiuPlotAnnotationTool.cpp | 8 +- .../UserInterface/RiuPvtPlotPanel.cpp | 20 ++-- .../UserInterface/RiuQwtCurvePointTracker.cpp | 26 ++--- .../UserInterface/RiuQwtCurvePointTracker.h | 18 ++-- .../UserInterface/RiuQwtPlotCurve.cpp | 4 +- .../UserInterface/RiuQwtPlotTools.cpp | 84 +++++++++------- .../UserInterface/RiuQwtPlotTools.h | 11 ++- .../UserInterface/RiuQwtPlotWheelZoomer.cpp | 14 +-- .../UserInterface/RiuQwtPlotWheelZoomer.h | 8 +- .../UserInterface/RiuQwtPlotWidget.cpp | 96 ++++++++++--------- .../UserInterface/RiuQwtScalePicker.cpp | 2 +- .../RiuRelativePermeabilityPlotPanel.cpp | 49 +++++----- .../UserInterface/RiuResultQwtPlot.cpp | 12 +-- .../UserInterface/RiuSummaryQwtPlot.cpp | 6 +- .../RiuTofAccumulatedPhaseFractionsPlot.cpp | 36 ++++--- .../UserInterface/RiuWellLogTrack.cpp | 14 +-- .../UserInterface/RiuWellLogTrack.h | 2 +- ThirdParty/qwt | 2 +- 31 files changed, 281 insertions(+), 257 deletions(-) diff --git a/ApplicationLibCode/Commands/RicGridStatisticsDialog.cpp b/ApplicationLibCode/Commands/RicGridStatisticsDialog.cpp index b918f0eff2..f54de99c3e 100644 --- a/ApplicationLibCode/Commands/RicGridStatisticsDialog.cpp +++ b/ApplicationLibCode/Commands/RicGridStatisticsDialog.cpp @@ -195,16 +195,16 @@ void RicGridStatisticsDialog::setHistogramData( RimGridView* view ) // Axis double xAxisSize = histogramData.max - histogramData.min; double xAxisExtension = xAxisSize * 0.02; - m_historgramPlot->setAxisScale( QwtPlot::xBottom, + m_historgramPlot->setAxisScale( QwtAxis::XBottom, histogramData.min - xAxisExtension, histogramData.max + xAxisExtension ); - m_aggregatedPlot->setAxisScale( QwtPlot::xBottom, + m_aggregatedPlot->setAxisScale( QwtAxis::XBottom, histogramData.min - xAxisExtension, histogramData.max + xAxisExtension ); // Set y axis label area width - m_historgramPlot->axisScaleDraw( QwtPlot::yLeft )->setMinimumExtent( 60 ); - m_aggregatedPlot->axisScaleDraw( QwtPlot::yLeft )->setMinimumExtent( 60 ); + m_historgramPlot->axisScaleDraw( QwtAxis::YLeft )->setMinimumExtent( 60 ); + m_aggregatedPlot->axisScaleDraw( QwtAxis::YLeft )->setMinimumExtent( 60 ); // Samples hist->setSamples( histSamples ); diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index 7f9e6565ff..dee648804b 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -164,7 +164,7 @@ RimAnalysisPlot::RimAnalysisPlot() CAF_PDM_InitFieldNoDefault( &m_valueAxisProperties, "ValueAxisProperties", "ValueAxisProperties" ); m_valueAxisProperties.uiCapability()->setUiTreeHidden( true ); m_valueAxisProperties = new RimPlotAxisProperties; - m_valueAxisProperties->setNameAndAxis( "Value-Axis", RiuQwtPlotTools::fromQwtPlotAxis( QwtPlot::yLeft ) ); + m_valueAxisProperties->setNameAndAxis( "Value-Axis", RiuQwtPlotTools::fromQwtPlotAxis( QwtAxis::YLeft ) ); m_valueAxisProperties->enableRangeSettings( false ); CAF_PDM_InitFieldNoDefault( &m_plotDataFilterCollection, "PlotDataFilterCollection", "PlotDataFilterCollection" ); @@ -910,7 +910,7 @@ void RimAnalysisPlot::onAxisSelected( int axis, bool toggle ) RiuPlotMainWindowTools::showPlotMainWindow(); caf::PdmObject* itemToSelect = nullptr; - if ( axis == QwtPlot::yLeft ) + if ( axis == QwtAxis::YLeft ) { if ( m_barOrientation == BARS_VERTICAL ) { @@ -921,7 +921,7 @@ void RimAnalysisPlot::onAxisSelected( int axis, bool toggle ) itemToSelect = this; } } - else if ( axis == QwtPlot::xBottom ) + else if ( axis == QwtAxis::XBottom ) { if ( m_barOrientation == BARS_HORIZONTAL ) { diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index 3b5cdcaecc..ccfc228fdd 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -400,8 +400,8 @@ void RimCorrelationMatrixPlot::updateAxes() { if ( !m_plotWidget ) return; - m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::yLeft, new TextScaleDraw( m_resultLabels ) ); - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new RiuQwtLinearScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtAxis::YLeft, new TextScaleDraw( m_resultLabels ) ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YLeft, new RiuQwtLinearScaleEngine ); m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultLeft(), "Result Vector" ); m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), true ); m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultLeft(), @@ -421,8 +421,8 @@ void RimCorrelationMatrixPlot::updateAxes() auto scaleDraw = new TextScaleDraw( m_paramLabels ); scaleDraw->setLabelRotation( 30.0 ); - m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::xBottom, scaleDraw ); - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtAxis::XBottom, scaleDraw ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XBottom, new RiuQwtLinearScaleEngine ); m_plotWidget->setAxisTitleText( RiuPlotAxis::defaultBottom(), "Ensemble Parameter" ); m_plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultBottom(), true ); m_plotWidget->setAxisFontsAndAlignment( RiuPlotAxis::defaultBottom(), @@ -440,7 +440,7 @@ void RimCorrelationMatrixPlot::updateAxes() 0.0, (double)m_paramLabels.size() ); - m_plotWidget->qwtPlot()->setAxisLabelAlignment( QwtPlot::xBottom, Qt::AlignRight ); + m_plotWidget->qwtPlot()->setAxisLabelAlignment( QwtAxis::XBottom, Qt::AlignRight ); } template diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index 87821173b8..6f26414d52 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -376,11 +376,11 @@ void RimGridCrossPlot::onAxisSelected( int axis, bool toggle ) { RiuPlotMainWindowTools::showPlotMainWindow(); RimPlotAxisProperties* properties = nullptr; - if ( axis == QwtPlot::yLeft ) + if ( axis == QwtAxis::YLeft ) { properties = m_yAxisProperties; } - else if ( axis == QwtPlot::xBottom ) + else if ( axis == QwtAxis::XBottom ) { properties = m_xAxisProperties; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index f210b1f283..f036998edd 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -382,15 +382,15 @@ void RimSummaryPlot::onAxisSelected( int axis, bool toggle ) RiuPlotMainWindowTools::showPlotMainWindow(); caf::PdmObject* itemToSelect = nullptr; - if ( axis == QwtPlot::yLeft ) + if ( axis == QwtAxis::YLeft ) { itemToSelect = m_leftYAxisProperties_OBSOLETE; } - else if ( axis == QwtPlot::yRight ) + else if ( axis == QwtAxis::YRight ) { itemToSelect = m_rightYAxisProperties_OBSOLETE; } - else if ( axis == QwtPlot::xBottom ) + else if ( axis == QwtAxis::XBottom ) { if ( m_isCrossPlot ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index e47d63d221..b410483136 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -143,7 +143,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot auto qwtPlotWidget = dynamic_cast( plotWidget ); if ( qwtPlotWidget ) { - QwtPlot::Axis qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); + auto qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis ); if ( m_axisProperties->numberFormat == RimPlotAxisProperties::NUMBER_FORMAT_AUTO && m_axisProperties->scaleFactor() == 1.0 ) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 914dacb13e..a82850a5d1 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -823,11 +823,11 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() this->firstAncestorOrThisOfTypeAsserted( wellLogPlot ); if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) { - m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtPlot::xTop, div ); + m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtAxis::XTop, div ); } else { - m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtPlot::yLeft, div ); + m_plotWidget->qwtPlot()->setAxisScaleDiv( QwtAxis::YLeft, div ); } } else if ( m_explicitTickIntervals ) @@ -1256,13 +1256,13 @@ void RimWellLogTrack::onLoadDataAndUpdate() if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) { - m_plotWidget->setAxisEnabled( QwtPlot::xTop, true ); - m_plotWidget->setAxisEnabled( QwtPlot::xBottom, false ); + m_plotWidget->setAxisEnabled( QwtAxis::XTop, true ); + m_plotWidget->setAxisEnabled( QwtAxis::XBottom, false ); } else { - m_plotWidget->setAxisEnabled( QwtPlot::xTop, false ); - m_plotWidget->setAxisEnabled( QwtPlot::xBottom, true ); + m_plotWidget->setAxisEnabled( QwtAxis::XTop, false ); + m_plotWidget->setAxisEnabled( QwtAxis::XBottom, true ); } } @@ -2034,17 +2034,17 @@ void RimWellLogTrack::updateAxisScaleEngine() if ( m_isLogarithmicScaleEnabled ) { - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new QwtLogScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XTop, new QwtLogScaleEngine ); // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new QwtLogScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XBottom, new QwtLogScaleEngine ); } else { - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new RiuQwtLinearScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XTop, new RiuQwtLinearScaleEngine ); // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new RiuQwtLinearScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XBottom, new RiuQwtLinearScaleEngine ); } } else @@ -2053,17 +2053,17 @@ void RimWellLogTrack::updateAxisScaleEngine() if ( m_isLogarithmicScaleEnabled ) { - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new QwtLogScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YLeft, new QwtLogScaleEngine ); // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yRight, new QwtLogScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YRight, new QwtLogScaleEngine ); } else { - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yLeft, new RiuQwtLinearScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YLeft, new RiuQwtLinearScaleEngine ); // NB! Must assign scale engine to bottom in order to make QwtPlotGrid work - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::yRight, new RiuQwtLinearScaleEngine ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::YRight, new RiuQwtLinearScaleEngine ); } } } @@ -2125,12 +2125,12 @@ void RimWellLogTrack::handleWheelEvent( QWheelEvent* wheelEvent ) if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) { - QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtPlot::yLeft ); + QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtAxis::YLeft ); zoomCenter = scaleMap.invTransform( position.y() ); } else { - QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtPlot::xTop ); + QwtScaleMap scaleMap = m_plotWidget->qwtPlot()->canvasMap( QwtAxis::XTop ); zoomCenter = scaleMap.invTransform( position.x() ); } diff --git a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp index c7fa929834..e094201924 100644 --- a/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp +++ b/ApplicationLibCode/UserInterface/AnalysisPlots/RiuGroupedBarChartBuilder.cpp @@ -670,13 +670,13 @@ void RiuGroupedBarChartBuilder::addBarChartToPlot( QwtPlot* plot, Qt::Orientatio // Set up the axis to contain group texts and tick marks { - QwtPlot::Axis axis = QwtPlot::xBottom; - QwtPlot::Axis valueAxis = QwtPlot::yLeft; + QwtAxis::Position axis = QwtAxis::XBottom; + QwtAxis::Position valueAxis = QwtAxis::YLeft; if ( barOrientation == Qt::Horizontal ) { - axis = QwtPlot::yLeft; - valueAxis = QwtPlot::xBottom; + axis = QwtAxis::YLeft; + valueAxis = QwtAxis::XBottom; } QwtScaleDiv groupAxisScaleDiv( 0, currentBarPosition ); diff --git a/ApplicationLibCode/UserInterface/RiuDockedQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuDockedQwtPlot.cpp index bb2582f570..94c625a4e9 100644 --- a/ApplicationLibCode/UserInterface/RiuDockedQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockedQwtPlot.cpp @@ -39,7 +39,7 @@ RiuDockedQwtPlot::RiuDockedQwtPlot( QWidget* parent /*= nullptr*/ ) //-------------------------------------------------------------------------------------------------- void RiuDockedQwtPlot::applyFontSizes( bool replot /*= false*/ ) { - std::set allAxes = { QwtPlot::xBottom, QwtPlot::yLeft, QwtPlot::xTop, QwtPlot::yRight }; + std::set allAxes = { QwtAxis::XBottom, QwtAxis::YLeft, QwtAxis::XTop, QwtAxis::YRight }; caf::FontTools::FontSize fontSize = RiaPreferences::current()->defaultPlotFontSize(); @@ -54,7 +54,7 @@ void RiuDockedQwtPlot::applyFontSizes( bool replot /*= false*/ ) titleText.setFont( font ); this->setTitle( titleText ); - for ( QwtPlot::Axis axis : allAxes ) + for ( QwtAxis::Position axis : allAxes ) { QwtText text = this->axisTitle( axis ); QFont axisTitleFont = text.font(); diff --git a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp index c0dbb96896..624da965b7 100644 --- a/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuFlowCharacteristicsPlot.cpp @@ -99,20 +99,20 @@ RiuFlowCharacteristicsPlot::RiuFlowCharacteristicsPlot( RimFlowCharacteristicsPl caf::FontTools::RelativeSize::Small ); { - QwtText axisTitle = m_sweepEffPlot->axisTitle( QwtPlot::xBottom ); + QwtText axisTitle = m_sweepEffPlot->axisTitle( QwtAxis::XBottom ); auto font = axisTitle.font(); font.setPointSize( legendFontSize ); axisTitle.setFont( font ); axisTitle.setText( "Dimensionless Time" ); - m_sweepEffPlot->setAxisTitle( QwtPlot::xBottom, axisTitle ); + m_sweepEffPlot->setAxisTitle( QwtAxis::XBottom, axisTitle ); } { - QwtText axisTitle = m_sweepEffPlot->axisTitle( QwtPlot::yLeft ); + QwtText axisTitle = m_sweepEffPlot->axisTitle( QwtAxis::YLeft ); auto font = axisTitle.font(); font.setPointSize( legendFontSize ); axisTitle.setFont( font ); axisTitle.setText( "Sweep Efficiency" ); - m_sweepEffPlot->setAxisTitle( QwtPlot::yLeft, axisTitle ); + m_sweepEffPlot->setAxisTitle( QwtAxis::YLeft, axisTitle ); } RiuQwtPlotTools::setCommonPlotBehaviour( m_flowCapVsStorageCapPlot ); @@ -121,20 +121,20 @@ RiuFlowCharacteristicsPlot::RiuFlowCharacteristicsPlot( RimFlowCharacteristicsPl m_flowCapVsStorageCapPlot->setTitle( "Flow Capacity vs Storage Capacity" ); { - QwtText axisTitle = m_flowCapVsStorageCapPlot->axisTitle( QwtPlot::xBottom ); + QwtText axisTitle = m_flowCapVsStorageCapPlot->axisTitle( QwtAxis::XBottom ); auto font = axisTitle.font(); font.setPointSize( legendFontSize ); axisTitle.setFont( font ); axisTitle.setText( "Storage Capacity [C]" ); - m_flowCapVsStorageCapPlot->setAxisTitle( QwtPlot::xBottom, axisTitle ); + m_flowCapVsStorageCapPlot->setAxisTitle( QwtAxis::XBottom, axisTitle ); } { - QwtText axisTitle = m_flowCapVsStorageCapPlot->axisTitle( QwtPlot::yLeft ); + QwtText axisTitle = m_flowCapVsStorageCapPlot->axisTitle( QwtAxis::YLeft ); auto font = axisTitle.font(); font.setPointSize( legendFontSize ); axisTitle.setFont( font ); axisTitle.setText( "Flow Capacity [F]" ); - m_flowCapVsStorageCapPlot->setAxisTitle( QwtPlot::yLeft, axisTitle ); + m_flowCapVsStorageCapPlot->setAxisTitle( QwtAxis::YLeft, axisTitle ); } } @@ -282,8 +282,8 @@ void RiuFlowCharacteristicsPlot::removeAllCurves() //-------------------------------------------------------------------------------------------------- void zoomAllInPlot( QwtPlot* plot ) { - plot->setAxisAutoScale( QwtPlot::xBottom, true ); - plot->setAxisAutoScale( QwtPlot::yLeft, true ); + plot->setAxisAutoScale( QwtAxis::XBottom, true ); + plot->setAxisAutoScale( QwtAxis::YLeft, true ); plot->replot(); } diff --git a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp index c3892b4e86..a28ad6e771 100644 --- a/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuGridCrossQwtPlot.cpp @@ -70,7 +70,7 @@ RiuGridCrossQwtPlot::RiuGridCrossQwtPlot( RimGridCrossPlot* plot, QWidget* paren // Attach a zoomer for the right axis m_zoomerRight = new RiuQwtPlotZoomer( qwtPlot()->canvas() ); - m_zoomerRight->setAxes( QwtPlot::xTop, QwtPlot::yRight ); + m_zoomerRight->setAxes( QwtAxis::XTop, QwtAxis::YRight ); m_zoomerRight->setTrackerMode( QwtPicker::AlwaysOff ); m_zoomerRight->initMousePattern( 1 ); @@ -200,7 +200,7 @@ void RiuGridCrossQwtPlot::onPlotItemSelected( std::shared_ptr plotI { QPointF sample = curve->sample( pointNumber ); m_selectedPointMarker->setValue( sample ); - m_selectedPointMarker->setAxes( QwtPlot::xBottom, QwtPlot::yLeft ); + m_selectedPointMarker->setAxes( QwtAxis::XBottom, QwtAxis::YLeft ); m_selectedPointMarker->attach( qwtPlot() ); QString curveName, xAxisName, yAxisName; if ( curveText( curve, &curveName, &xAxisName, &yAxisName ) ) diff --git a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp index 323332e79e..478fe7d705 100644 --- a/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuMohrsCirclePlot.cpp @@ -70,13 +70,11 @@ RiuMohrsCirclePlot::RiuMohrsCirclePlot( QWidget* parent ) { RiuQwtPlotTools::setCommonPlotBehaviour( this ); - enableAxis( QwtPlot::xBottom, true ); - enableAxis( QwtPlot::yLeft, true ); - enableAxis( QwtPlot::xTop, false ); - enableAxis( QwtPlot::yRight, false ); + setAxesCount( QwtAxis::XBottom, 1 ); + setAxesCount( QwtAxis::YLeft, 1 ); - setAxisTitle( QwtPlot::xBottom, "Effective Normal Stress" ); - setAxisTitle( QwtPlot::yLeft, "Shear Stress" ); + setAxisTitle( QwtAxis::XBottom, "Effective Normal Stress" ); + setAxisTitle( QwtAxis::YLeft, "Shear Stress" ); applyFontSizes( false ); @@ -459,7 +457,7 @@ void RiuMohrsCirclePlot::updateTransparentCurvesOnPrincipals() qVectorPoints.push_back( QPointF( mohrCircleInfo.principals[2], 0 ) ); transparentCurve->setSamples( qVectorPoints ); - transparentCurve->setYAxis( QwtPlot::yLeft ); + transparentCurve->setYAxis( QwtAxis::YLeft ); transparentCurve->setStyle( QwtPlotCurve::NoCurve ); transparentCurve->setLegendAttribute( QwtPlotCurve::LegendNoAttribute ); @@ -715,8 +713,8 @@ void RiuMohrsCirclePlot::setAxesScaleAndReplot() yMaxDisplayed = heightToKeepAspectRatio; } - this->setAxisScale( QwtPlot::yLeft, 0, yMaxDisplayed ); - this->setAxisScale( QwtPlot::xBottom, xMin, xMaxDisplayed ); + this->setAxisScale( QwtAxis::YLeft, 0, yMaxDisplayed ); + this->setAxisScale( QwtAxis::XBottom, xMin, xMaxDisplayed ); this->replot(); } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index fc29eca0fc..f131a28f46 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -709,9 +709,9 @@ int RiuMultiPlotPage::alignCanvasTops() int row = visibleIndex / rowAndColumnCount.second; if ( plotWidgets[visibleIndex]->axisEnabled( RiuPlotAxis::defaultTop() ) ) { - QFont font = qwtPlotWidget->qwtPlot()->axisFont( QwtPlot::xTop ); + QFont font = qwtPlotWidget->qwtPlot()->axisFont( QwtAxis::XTop ); maxExtents[row] = std::max( maxExtents[row], - qwtPlotWidget->qwtPlot()->axisScaleDraw( QwtPlot::xTop )->extent( font ) ); + qwtPlotWidget->qwtPlot()->axisScaleDraw( QwtAxis::XTop )->extent( font ) ); } } } @@ -722,7 +722,7 @@ int RiuMultiPlotPage::alignCanvasTops() if ( qwtPlotWidget ) { int row = visibleIndex / rowAndColumnCount.second; - qwtPlotWidget->qwtPlot()->axisScaleDraw( QwtPlot::xTop )->setMinimumExtent( maxExtents[row] ); + qwtPlotWidget->qwtPlot()->axisScaleDraw( QwtAxis::XTop )->setMinimumExtent( maxExtents[row] ); if ( legends[visibleIndex] ) { legends[visibleIndex]->adjustSize(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp b/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp index d88c025bf2..35b02f8a98 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotAnnotationTool.cpp @@ -96,7 +96,7 @@ void RiuPlotAnnotationTool::attachNamedRegions( QwtPlot* shading->setBrush( brush ); shading->attach( m_plot ); shading->setZ( -100.0 ); - shading->setXAxis( QwtPlot::xTop ); + shading->setXAxis( QwtAxis::XTop ); m_horizontalMarkers.push_back( std::move( shading ) ); } @@ -335,7 +335,7 @@ void RiuPlotAnnotationTool::horizontalRange( const QString& nam shading->setBrush( brush ); shading->attach( m_plot ); shading->setZ( -100.0 ); - shading->setXAxis( QwtPlot::xBottom ); + shading->setXAxis( QwtAxis::XBottom ); m_horizontalMarkers.push_back( std::move( shading ) ); QwtPlotMarker* line( new QwtPlotMarker() ); @@ -370,7 +370,7 @@ void RiuPlotAnnotationTool::verticalRange( const QString& name, shading->setBrush( brush ); shading->attach( m_plot ); shading->setZ( -100.0 ); - shading->setXAxis( QwtPlot::xBottom ); + shading->setXAxis( QwtAxis::XBottom ); m_verticalMarkers.push_back( std::move( shading ) ); QStringList labels = name.split( " - " ); @@ -414,7 +414,7 @@ void RiuPlotAnnotationTool::verticalLine( QwtPlotMarker* line, curvePen.setColor( color ); curvePen.setWidth( 1 ); - line->setAxes( QwtPlot::xBottom, QwtPlot::yLeft ); + line->setAxes( QwtAxis::XBottom, QwtAxis::YLeft ); line->setLineStyle( QwtPlotMarker::VLine ); line->setLinePen( curvePen ); line->setXValue( xValue ); diff --git a/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp b/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp index cbff8e39c3..d3e19c9daa 100644 --- a/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuPvtPlotPanel.cpp @@ -143,22 +143,22 @@ void RiuPvtPlotWidget::setPlotDefaults( QwtPlot* plot ) // Axis number font { - QFont axisFont = plot->axisFont( QwtPlot::xBottom ); + QFont axisFont = plot->axisFont( QwtAxis::XBottom ); axisFont.setPointSize( 8 ); - plot->setAxisFont( QwtPlot::xBottom, axisFont ); - plot->setAxisFont( QwtPlot::yLeft, axisFont ); + plot->setAxisFont( QwtAxis::XBottom, axisFont ); + plot->setAxisFont( QwtAxis::YLeft, axisFont ); } // Axis title font { - QwtText axisTitle = plot->axisTitle( QwtPlot::xBottom ); + QwtText axisTitle = plot->axisTitle( QwtAxis::XBottom ); QFont axisTitleFont = axisTitle.font(); axisTitleFont.setPointSize( 8 ); axisTitleFont.setBold( false ); axisTitle.setFont( axisTitleFont ); axisTitle.setRenderFlags( Qt::AlignRight ); - plot->setAxisTitle( QwtPlot::xBottom, axisTitle ); - plot->setAxisTitle( QwtPlot::yLeft, axisTitle ); + plot->setAxisTitle( QwtAxis::XBottom, axisTitle ); + plot->setAxisTitle( QwtAxis::YLeft, axisTitle ); } // Title font @@ -170,8 +170,8 @@ void RiuPvtPlotWidget::setPlotDefaults( QwtPlot* plot ) plot->setTitle( plotTitle ); } - plot->setAxisMaxMinor( QwtPlot::xBottom, 2 ); - plot->setAxisMaxMinor( QwtPlot::yLeft, 3 ); + plot->setAxisMaxMinor( QwtAxis::XBottom, 2 ); + plot->setAxisMaxMinor( QwtAxis::YLeft, 3 ); plot->plotLayout()->setAlignCanvasToScales( true ); } @@ -310,9 +310,9 @@ void RiuPvtPlotWidget::plotCurves( RiaDefines::EclipseUnitSystem m_qwtPlot->setTitle( plotTitle ); - m_qwtPlot->setAxisTitle( QwtPlot::xBottom, + m_qwtPlot->setAxisTitle( QwtAxis::XBottom, QString( "Pressure [%1]" ).arg( RiaEclipseUnitTools::unitStringPressure( unitSystem ) ) ); - m_qwtPlot->setAxisTitle( QwtPlot::yLeft, yAxisTitle ); + m_qwtPlot->setAxisTitle( QwtAxis::YLeft, yAxisTitle ); updateTrackerPlotMarkerAndLabelFromPicker(); diff --git a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp index 8d23423eda..0006744d65 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp @@ -103,8 +103,8 @@ QwtText RiuQwtCurvePointTracker::trackerText( const QPoint& pos ) const if ( m_plot ) { - QwtPlot::Axis relatedYAxis = QwtPlot::yLeft; - QwtPlot::Axis relatedXAxis = QwtPlot::xBottom; + QwtAxis::Position relatedYAxis = QwtAxis::YLeft; + QwtAxis::Position relatedXAxis = QwtAxis::XBottom; QString curveInfoText; QString mainAxisValueString; @@ -136,12 +136,12 @@ QwtText RiuQwtCurvePointTracker::trackerText( const QPoint& pos ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QPointF RiuQwtCurvePointTracker::closestCurvePoint( const QPoint& cursorPosition, - QString* curveInfoText, - QString* valueAxisValueString, - QString* mainAxisValueString, - QwtPlot::Axis* relatedXAxis, - QwtPlot::Axis* relatedYAxis ) const +QPointF RiuQwtCurvePointTracker::closestCurvePoint( const QPoint& cursorPosition, + QString* curveInfoText, + QString* valueAxisValueString, + QString* mainAxisValueString, + QwtAxis::Position* relatedXAxis, + QwtAxis::Position* relatedYAxis ) const { QPointF samplePoint; @@ -170,8 +170,8 @@ QPointF RiuQwtCurvePointTracker::closestCurvePoint( const QPoint& cursorPositio { samplePoint = closestCurve->sample( closestPointSampleIndex ); - if ( relatedXAxis ) *relatedXAxis = static_cast( closestCurve->xAxis() ); - if ( relatedYAxis ) *relatedYAxis = static_cast( closestCurve->yAxis() ); + if ( relatedXAxis ) *relatedXAxis = static_cast( closestCurve->xAxis().pos ); + if ( relatedYAxis ) *relatedYAxis = static_cast( closestCurve->yAxis().pos ); } if ( mainAxisValueString ) @@ -227,9 +227,9 @@ QPointF RiuQwtCurvePointTracker::closestCurvePoint( const QPoint& cursorPositio //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtCurvePointTracker::updateClosestCurvePointMarker( const QPointF& closestPoint, - QwtPlot::Axis relatedXAxis, - QwtPlot::Axis relatedYAxis ) const +void RiuQwtCurvePointTracker::updateClosestCurvePointMarker( const QPointF& closestPoint, + QwtAxis::Position relatedXAxis, + QwtAxis::Position relatedYAxis ) const { bool replotRequired = false; diff --git a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h index 6aba3e04ce..9813bf7d61 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h +++ b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h @@ -42,15 +42,15 @@ class RiuQwtCurvePointTracker : public QwtPlotPicker void removeMarkerOnFocusLeave(); QwtText trackerText( const QPoint& pos ) const override; - QPointF closestCurvePoint( const QPoint& cursorPosition, - QString* curveInfoText, - QString* valueAxisValueString, - QString* mainAxisValueString, - QwtPlot::Axis* relatedXAxis, - QwtPlot::Axis* relatedYAxis ) const; - void updateClosestCurvePointMarker( const QPointF& closestPoint, - QwtPlot::Axis relatedXAxis, - QwtPlot::Axis relatedYAxis ) const; + QPointF closestCurvePoint( const QPoint& cursorPosition, + QString* curveInfoText, + QString* valueAxisValueString, + QString* mainAxisValueString, + QwtAxis::Position* relatedXAxis, + QwtAxis::Position* relatedYAxis ) const; + void updateClosestCurvePointMarker( const QPointF& closestPoint, + QwtAxis::Position relatedXAxis, + QwtAxis::Position relatedYAxis ) const; QPointer m_plot; QwtPlotMarker* m_plotMarker; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index 3a236c85b2..2c2e11555f 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -479,7 +479,7 @@ void RiuQwtPlotCurve::setSamplesFromXYErrorValues( const std::vector& //-------------------------------------------------------------------------------------------------- void RiuQwtPlotCurve::setXAxis( RiuPlotAxis axis ) { - QwtPlotCurve::setXAxis( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); + QwtPlotCurve::setXAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); } //-------------------------------------------------------------------------------------------------- @@ -487,7 +487,7 @@ void RiuQwtPlotCurve::setXAxis( RiuPlotAxis axis ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotCurve::setYAxis( RiuPlotAxis axis ) { - QwtPlotCurve::setYAxis( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); + QwtPlotCurve::setYAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp index ef0d774e60..1db703a46a 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp @@ -21,6 +21,7 @@ #include "RiaColorTools.h" #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" +#include "RiuPlotAxis.h" #include "RimPlotCurve.h" @@ -38,6 +39,7 @@ #include "qwt_plot_shapeitem.h" #include "qwt_scale_widget.h" +#include "qwt_axis.h" #include #include @@ -70,18 +72,18 @@ void RiuQwtPlotTools::setCommonPlotBehaviour( QwtPlot* plot ) // Axis number font int axisFontSize = caf::FontTools::absolutePointSize( RiaPreferences::current()->defaultPlotFontSize(), caf::FontTools::RelativeSize::Medium ); - QFont axisFont = plot->axisFont( QwtPlot::xBottom ); + QFont axisFont = plot->axisFont( QwtAxis::XBottom ); axisFont.setPixelSize( caf::FontTools::pointSizeToPixelSize( axisFontSize ) ); - plot->setAxisFont( QwtPlot::xBottom, axisFont ); - plot->setAxisFont( QwtPlot::xTop, axisFont ); - plot->setAxisFont( QwtPlot::yLeft, axisFont ); - plot->setAxisFont( QwtPlot::yRight, axisFont ); + plot->setAxisFont( QwtAxis::XBottom, axisFont ); + plot->setAxisFont( QwtAxis::XTop, axisFont ); + plot->setAxisFont( QwtAxis::YLeft, axisFont ); + plot->setAxisFont( QwtAxis::YRight, axisFont ); // Axis title font - std::vector axes = { QwtPlot::xBottom, QwtPlot::xTop, QwtPlot::yLeft, QwtPlot::yRight }; + std::vector axes = { QwtAxis::XBottom, QwtAxis::XTop, QwtAxis::YLeft, QwtAxis::YRight }; - for ( QwtPlot::Axis axis : axes ) + for ( QwtAxis::Position axis : axes ) { QwtText axisTitle = plot->axisTitle( axis ); QFont axisTitleFont = axisTitle.font(); @@ -118,18 +120,16 @@ void RiuQwtPlotTools::setCommonPlotBehaviour( QwtPlot* plot ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotTools::setDefaultAxes( QwtPlot* plot ) { - plot->enableAxis( QwtPlot::xBottom, true ); - plot->enableAxis( QwtPlot::yLeft, true ); - plot->enableAxis( QwtPlot::xTop, false ); - plot->enableAxis( QwtPlot::yRight, false ); - - plot->axisWidget( QwtPlot::xBottom )->setMargin( 0 ); - plot->axisWidget( QwtPlot::yLeft )->setMargin( 0 ); - plot->axisWidget( QwtPlot::xTop )->setMargin( 0 ); - plot->axisWidget( QwtPlot::yRight )->setMargin( 0 ); - - plot->setAxisMaxMinor( QwtPlot::xBottom, 2 ); - plot->setAxisMaxMinor( QwtPlot::yLeft, 3 ); + plot->setAxesCount( QwtAxis::XBottom, 1 ); + plot->setAxesCount( QwtAxis::YLeft, 1 ); + + plot->axisWidget( QwtAxis::XBottom )->setMargin( 0 ); + plot->axisWidget( QwtAxis::YLeft )->setMargin( 0 ); + plot->axisWidget( QwtAxis::XTop )->setMargin( 0 ); + plot->axisWidget( QwtAxis::YRight )->setMargin( 0 ); + + plot->setAxisMaxMinor( QwtAxis::XBottom, 2 ); + plot->setAxisMaxMinor( QwtAxis::YLeft, 3 ); } //-------------------------------------------------------------------------------------------------- @@ -159,8 +159,8 @@ void RiuQwtPlotTools::enableDateBasedBottomXAxis( QwtPlot* } QwtDateScaleEngine* scaleEngine = new QwtDateScaleEngine( Qt::UTC ); - plot->setAxisScaleEngine( QwtPlot::xBottom, scaleEngine ); - plot->setAxisScaleDraw( QwtPlot::xBottom, scaleDraw ); + plot->setAxisScaleEngine( QwtAxis::XBottom, scaleEngine ); + plot->setAxisScaleDraw( QwtAxis::XBottom, scaleDraw ); } //-------------------------------------------------------------------------------------------------- @@ -248,31 +248,45 @@ QwtPlotShapeItem* RiuQwtPlotTools::createBoxShape( const QString& label, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QwtPlot::Axis RiuQwtPlotTools::toQwtPlotAxis( RiaDefines::PlotAxis axis ) +QwtAxisId RiuQwtPlotTools::toQwtPlotAxis( RiuPlotAxis axis ) +{ + QwtAxis::Position qwtPosition = toQwtPlotAxisEnum( axis.axis() ); + + return { qwtPosition, axis.index() }; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QwtAxis::Position RiuQwtPlotTools::toQwtPlotAxisEnum( RiaDefines::PlotAxis riaPlotAxis ) { - if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) - return QwtPlot::yLeft; - else if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) - return QwtPlot::yRight; - else if ( axis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) - return QwtPlot::xBottom; - - return QwtPlot::xTop; + if ( riaPlotAxis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) + return QwtAxis::YLeft; + else if ( riaPlotAxis == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) + return QwtAxis::YRight; + else if ( riaPlotAxis == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) + return QwtAxis::XBottom; + else if ( riaPlotAxis == RiaDefines::PlotAxis::PLOT_AXIS_TOP ) + return QwtAxis::XTop; + + return QwtAxis::YLeft; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaDefines::PlotAxis RiuQwtPlotTools::fromQwtPlotAxis( QwtPlot::Axis axis ) +RiaDefines::PlotAxis RiuQwtPlotTools::fromQwtPlotAxis( QwtAxis::Position axis ) { - if ( axis == QwtPlot::yLeft ) + if ( axis == QwtAxis::YLeft ) return RiaDefines::PlotAxis::PLOT_AXIS_LEFT; - else if ( axis == QwtPlot::yRight ) + else if ( axis == QwtAxis::YRight ) return RiaDefines::PlotAxis::PLOT_AXIS_RIGHT; - else if ( axis == QwtPlot::xBottom ) + else if ( axis == QwtAxis::XBottom ) return RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM; + else if ( axis == QwtAxis::XTop ) + return RiaDefines::PlotAxis::PLOT_AXIS_TOP; - return RiaDefines::PlotAxis::PLOT_AXIS_TOP; + return RiaDefines::PlotAxis::PLOT_AXIS_LEFT; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h index 73c3ab72f5..573f336d43 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h @@ -20,6 +20,7 @@ #include "RiaDateTimeDefines.h" #include "RiaPlotDefines.h" +#include #include #include #include @@ -27,6 +28,8 @@ class RiuQwtPlotLegend; class RimPlotCurve; +class RiuPlotAxis; + class RiuQwtPlotTools { public: @@ -62,11 +65,13 @@ class RiuQwtPlotTools QColor color, Qt::BrushStyle brushStyle = Qt::SolidPattern ); - static QwtPlot::Axis toQwtPlotAxis( RiaDefines::PlotAxis ); - static RiaDefines::PlotAxis fromQwtPlotAxis( QwtPlot::Axis ); static void updateLegendData( RiuQwtPlotLegend* legend, const std::vector& curves ); static QList createLegendData( const std::vector& curves ); + static QwtAxisId toQwtPlotAxis( RiuPlotAxis riuPlotAxis ); + static QwtAxis::Position toQwtPlotAxisEnum( RiaDefines::PlotAxis riaPlotAxis ); + + static RiaDefines::PlotAxis fromQwtPlotAxis( QwtAxis::Position ); }; //-------------------------------------------------------------------------------------------------- @@ -90,7 +95,7 @@ PlotShapeItemType* RiuQwtPlotTools::createBoxShapeT( const QString& label, polygon.push_back( QPointF( startX, endY ) ); polygon.push_back( QPointF( startX, startY ) ); columnShape->setPolygon( polygon ); - columnShape->setXAxis( QwtPlot::xBottom ); + columnShape->setXAxis( QwtAxis::XBottom ); columnShape->setBrush( QBrush( color, brushStyle ) ); columnShape->setLegendMode( QwtPlotShapeItem::LegendShape ); columnShape->setLegendIconSize( QSize( 16, 16 ) ); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp index 0d0bd8a990..2265f8c9c0 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.cpp @@ -47,7 +47,7 @@ RiuQwtPlotWheelZoomer::RiuQwtPlotWheelZoomer( QwtPlot* plot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWheelZoomer::zoomOnAxis( QwtPlot* plot, QwtPlot::Axis axis, double zoomFactor, int eventPos ) +void RiuQwtPlotWheelZoomer::zoomOnAxis( QwtPlot* plot, QwtAxis::Position axis, double zoomFactor, int eventPos ) { QwtScaleMap scaleMap = plot->canvasMap( axis ); double zoomCenter = scaleMap.invTransform( eventPos ); @@ -75,7 +75,7 @@ void RiuQwtPlotWheelZoomer::zoomOnAxis( QwtPlot* plot, QwtPlot::Axis axis, doubl //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RiuQwtPlotWheelZoomer::axisIsLogarithmic( QwtPlot::Axis axis ) const +bool RiuQwtPlotWheelZoomer::axisIsLogarithmic( QwtAxis::Position axis ) const { auto it = m_axesAreLogarithmic.find( axis ); return it != m_axesAreLogarithmic.end() ? it->second : false; @@ -96,10 +96,10 @@ bool RiuQwtPlotWheelZoomer::eventFilter( QObject* watched, QEvent* event ) } auto position = caf::position( wheelEvent ); - zoomOnAxis( m_plot, QwtPlot::xBottom, zoomFactor, position.x() ); - zoomOnAxis( m_plot, QwtPlot::xTop, zoomFactor, position.x() ); - zoomOnAxis( m_plot, QwtPlot::yLeft, zoomFactor, position.y() ); - zoomOnAxis( m_plot, QwtPlot::yRight, zoomFactor, position.y() ); + zoomOnAxis( m_plot, QwtAxis::XBottom, zoomFactor, position.x() ); + zoomOnAxis( m_plot, QwtAxis::XTop, zoomFactor, position.x() ); + zoomOnAxis( m_plot, QwtAxis::YLeft, zoomFactor, position.y() ); + zoomOnAxis( m_plot, QwtAxis::YRight, zoomFactor, position.y() ); m_plot->replot(); emit zoomUpdated(); @@ -111,7 +111,7 @@ bool RiuQwtPlotWheelZoomer::eventFilter( QObject* watched, QEvent* event ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWheelZoomer::setAxisIsLogarithmic( QwtPlot::Axis axis, bool logarithmic ) +void RiuQwtPlotWheelZoomer::setAxisIsLogarithmic( QwtAxis::Position axis, bool logarithmic ) { m_axesAreLogarithmic[axis] = logarithmic; } diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.h index e589c0aae5..1c32c646f4 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWheelZoomer.h @@ -33,17 +33,17 @@ class RiuQwtPlotWheelZoomer : public QObject bool eventFilter( QObject* watched, QEvent* event ) override; - void setAxisIsLogarithmic( QwtPlot::Axis axis, bool logarithmic ); + void setAxisIsLogarithmic( QwtAxis::Position axis, bool logarithmic ); signals: void zoomUpdated(); private: - void zoomOnAxis( QwtPlot* plot, QwtPlot::Axis axis, double zoomFactor, int eventPos ); - bool axisIsLogarithmic( QwtPlot::Axis axis ) const; + void zoomOnAxis( QwtPlot* plot, QwtAxis::Position axis, double zoomFactor, int eventPos ); + bool axisIsLogarithmic( QwtAxis::Position axis ) const; private: QwtPlot* m_plot; - std::map m_axesAreLogarithmic; + std::map m_axesAreLogarithmic; }; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index eb87b6a852..5636ac75cf 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -121,7 +121,7 @@ int RiuQwtPlotWidget::axisTitleFontSize( RiuPlotAxis axis ) const { if ( axisEnabled( axis ) ) { - return m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ).pointSize(); + return m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).pointSize(); } return -1; } @@ -133,7 +133,7 @@ int RiuQwtPlotWidget::axisValueFontSize( RiuPlotAxis axis ) const { if ( axisEnabled( axis ) ) { - return m_plot->axisTitle( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ).font().pointSize(); + return m_plot->axisTitle( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).font().pointSize(); } return -1; } @@ -148,7 +148,7 @@ void RiuQwtPlotWidget::setAxisFontsAndAlignment( RiuPlotAxis axis, int titleFont // Axis number font - int qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); + auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); QFont axisFont = m_plot->axisFont( qwtAxis ); axisFont.setPixelSize( valueFontPixelSize ); axisFont.setBold( false ); @@ -300,7 +300,7 @@ void RiuQwtPlotWidget::clearLegend() //-------------------------------------------------------------------------------------------------- std::pair RiuQwtPlotWidget::axisRange( RiuPlotAxis axis ) const { - QwtInterval interval = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ).interval(); + QwtInterval interval = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).interval(); return std::make_pair( interval.minValue(), interval.maxValue() ); } @@ -310,7 +310,7 @@ std::pair RiuQwtPlotWidget::axisRange( RiuPlotAxis axis ) const void RiuQwtPlotWidget::setAxisRange( RiuPlotAxis axis, double min, double max ) { // Note: Especially the Y-axis may be inverted - if ( m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) )->testAttribute( QwtScaleEngine::Inverted ) ) + if ( m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->testAttribute( QwtScaleEngine::Inverted ) ) { setAxisScale( axis, max, min ); } @@ -325,7 +325,7 @@ void RiuQwtPlotWidget::setAxisRange( RiuPlotAxis axis, double min, double max ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisInverted( RiuPlotAxis axis, bool isInverted ) { - m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) )->setAttribute( QwtScaleEngine::Inverted, isInverted ); + m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->setAttribute( QwtScaleEngine::Inverted, isInverted ); } //-------------------------------------------------------------------------------------------------- @@ -333,10 +333,8 @@ void RiuQwtPlotWidget::setAxisInverted( RiuPlotAxis axis, bool isInverted ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks ) { - m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ) - ->enableComponent( QwtAbstractScaleDraw::Ticks, enableTicks ); - m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ) - ->enableComponent( QwtAbstractScaleDraw::Labels, enableLabels ); + m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Ticks, enableTicks ); + m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Labels, enableLabels ); recalculateAxisExtents( axis ); } @@ -346,11 +344,11 @@ void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enab void RiuQwtPlotWidget::enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) { QwtPlotItemList plotItems = m_plot->itemList( QwtPlotItem::Rtti_PlotGrid ); - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); + auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); for ( QwtPlotItem* plotItem : plotItems ) { QwtPlotGrid* grid = static_cast( plotItem ); - if ( qwtAxis == QwtPlot::xTop || qwtAxis == QwtPlot::xBottom ) + if ( qwtAxis == QwtAxis::XTop || qwtAxis == QwtAxis::XBottom ) { grid->setXAxis( qwtAxis ); grid->enableX( majorGridLines ); @@ -376,7 +374,7 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiuPlotAxis axis, double minValue, double maxValue ) { - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); + auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); if ( scaleEngine ) { @@ -398,7 +396,7 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis, double rangeMin, double rangeMax ) { - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); + auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); if ( scaleEngine ) { @@ -418,10 +416,10 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis, //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) { - m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMajorTickIntervalCount ); - m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMinorTickIntervalCount ); + m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMajorTickIntervalCount ); + m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMinorTickIntervalCount ); // Reapply axis limits to force Qwt to use the tick settings. - QwtInterval currentRange = m_plot->axisInterval( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); + QwtInterval currentRange = m_plot->axisInterval( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); setAxisScale( axis, currentRange.minValue(), currentRange.maxValue() ); } @@ -430,7 +428,7 @@ void RiuQwtPlotWidget::setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajor //-------------------------------------------------------------------------------------------------- double RiuQwtPlotWidget::majorTickInterval( RiuPlotAxis axis ) const { - QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); + QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); QList majorTicks = scaleDiv.ticks( QwtScaleDiv::MajorTick ); if ( majorTicks.size() < 2 ) return 0.0; @@ -442,7 +440,7 @@ double RiuQwtPlotWidget::majorTickInterval( RiuPlotAxis axis ) const //-------------------------------------------------------------------------------------------------- double RiuQwtPlotWidget::minorTickInterval( RiuPlotAxis axis ) const { - QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( QwtPlot::xTop ); + QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( QwtAxis::XTop ); QList minorTicks = scaleDiv.ticks( QwtScaleDiv::MinorTick ); if ( minorTicks.size() < 2 ) return 0.0; @@ -457,8 +455,8 @@ int RiuQwtPlotWidget::axisExtent( RiuPlotAxis axis ) const auto [rangeMin, rangeMax] = axisRange( axis ); if ( std::abs( rangeMax - rangeMin ) < 1.0e-14 ) return 0; - int lineExtent = 0; - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); + int lineExtent = 0; + auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Ticks ) ) { @@ -467,7 +465,7 @@ int RiuQwtPlotWidget::axisExtent( RiuPlotAxis axis ) const if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Labels ) ) { - QFont tickLabelFont = m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); + QFont tickLabelFont = m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); // Make space for a fairly long value label QSize labelSize = QFontMetrics( tickLabelFont ).boundingRect( QString( "9.9e-9" ) ).size(); @@ -655,9 +653,9 @@ void RiuQwtPlotWidget::applyPlotTitleToQwt() //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::applyAxisTitleToQwt( RiuPlotAxis axis ) { - QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" ); - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); - QwtText axisTitle = m_plot->axisTitle( qwtAxis ); + QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" ); + auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + QwtText axisTitle = m_plot->axisTitle( qwtAxis ); if ( titleToApply != axisTitle.text() ) { axisTitle.setText( titleToApply ); @@ -780,7 +778,7 @@ RimViewWindow* RiuQwtPlotWidget::ownerViewWindow() const void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection ) { int axisId = -1; - for ( int i = 0; i < QwtPlot::axisCnt; ++i ) + for ( int i = 0; i < QwtAxis::AxisPositions; ++i ) { if ( scale == m_plot->axisWidget( i ) ) { @@ -795,8 +793,8 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::recalculateAxisExtents( RiuPlotAxis axis ) { - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); - if ( qwtAxis == QwtPlot::yLeft || qwtAxis == QwtPlot::yRight ) + auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + if ( qwtAxis.pos == QwtAxis::YLeft || qwtAxis.pos == QwtAxis::YRight ) { int extent = axisExtent( axis ); m_plot->axisScaleDraw( qwtAxis )->setMinimumExtent( extent ); @@ -845,8 +843,8 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos, else if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotShape ) { QwtPlotShapeItem* shapeItem = static_cast( *it ); - QPointF scalePos( m_plot->invTransform( QwtPlot::xBottom, pos.x() ), - m_plot->invTransform( QwtPlot::yLeft, pos.y() ) ); + QPointF scalePos( m_plot->invTransform( QwtAxis::XBottom, pos.x() ), + m_plot->invTransform( QwtAxis::YLeft, pos.y() ) ); if ( shapeItem->shape().boundingRect().contains( scalePos ) ) { *closestItem = *it; @@ -856,8 +854,8 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos, else if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotBarChart ) { QwtPlotBarChart* barChart = static_cast( *it ); - QPointF scalePos( m_plot->invTransform( QwtPlot::xBottom, pos.x() ), - m_plot->invTransform( QwtPlot::yLeft, pos.y() ) ); + QPointF scalePos( m_plot->invTransform( QwtAxis::XBottom, pos.x() ), + m_plot->invTransform( QwtAxis::YLeft, pos.y() ) ); bool horizontal = barChart->orientation() == Qt::Horizontal; for ( size_t i = 0; i < barChart->dataSize(); ++i ) @@ -1055,6 +1053,13 @@ QwtPlot* RiuQwtPlotWidget::qwtPlot() const //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis ) { + int requiredCount = axis.index() + 1; + + auto qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis ); + if ( requiredCount > m_plot->axesCount( qwtAxisId.pos ) ) + { + m_plot->setAxesCount( qwtAxisId.pos, requiredCount ); + } } //-------------------------------------------------------------------------------------------------- @@ -1062,7 +1067,9 @@ void RiuQwtPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::enableAxis( RiuPlotAxis axis, bool isEnabled ) { - m_plot->enableAxis( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), isEnabled ); + ensureAxisIsCreated( axis ); + + m_plot->setAxisVisible( RiuQwtPlotTools::toQwtPlotAxis( axis ), isEnabled ); } //-------------------------------------------------------------------------------------------------- @@ -1070,7 +1077,7 @@ void RiuQwtPlotWidget::enableAxis( RiuPlotAxis axis, bool isEnabled ) //-------------------------------------------------------------------------------------------------- bool RiuQwtPlotWidget::axisEnabled( RiuPlotAxis axis ) const { - return m_plot->axisEnabled( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ) ); + return m_plot->isAxisVisible( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); } //-------------------------------------------------------------------------------------------------- @@ -1078,7 +1085,7 @@ bool RiuQwtPlotWidget::axisEnabled( RiuPlotAxis axis ) const //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) { - m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMinor ); + m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMinor ); } //-------------------------------------------------------------------------------------------------- @@ -1086,7 +1093,7 @@ void RiuQwtPlotWidget::setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisMaxMajor( RiuPlotAxis axis, int maxMajor ) { - m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), maxMajor ); + m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMajor ); } //-------------------------------------------------------------------------------------------------- @@ -1103,7 +1110,7 @@ void RiuQwtPlotWidget::removeEventFilter() //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale ) { - m_plot->setAxisAutoScale( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), autoScale ); + m_plot->setAxisAutoScale( RiuQwtPlotTools::toQwtPlotAxis( axis ), autoScale ); } //-------------------------------------------------------------------------------------------------- @@ -1111,7 +1118,7 @@ void RiuQwtPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max ) { - m_plot->setAxisScale( RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ), min, max ); + m_plot->setAxisScale( RiuQwtPlotTools::toQwtPlotAxis( axis ), min, max ); } //-------------------------------------------------------------------------------------------------- @@ -1119,7 +1126,7 @@ void RiuQwtPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max ) //-------------------------------------------------------------------------------------------------- RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiuPlotAxis axis ) const { - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); + auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); QwtLogScaleEngine* logScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); QwtDateScaleEngine* dateScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); @@ -1136,7 +1143,7 @@ RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiuPlotAxis axi //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisScaleType( RiuPlotAxis axis, RiuQwtPlotWidget::AxisScaleType axisScaleType ) { - QwtPlot::Axis qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis.axis() ); + auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); if ( axisScaleType == AxisScaleType::LOGARITHMIC ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLogScaleEngine ); if ( axisScaleType == AxisScaleType::LINEAR ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLinearScaleEngine ); @@ -1156,8 +1163,11 @@ void RiuQwtPlotWidget::updateAxes() //-------------------------------------------------------------------------------------------------- RiuPlotAxis RiuQwtPlotWidget::createNextPlotAxis( RiaDefines::PlotAxis axis ) { - // Qwt does not support multiaxis. Just use the default on the given side. - return RiuPlotAxis( axis ); + auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxisEnum( axis ); + + auto count = m_plot->axesCount( qwtAxis ); + + return RiuPlotAxis( axis, count ); } //-------------------------------------------------------------------------------------------------- @@ -1190,7 +1200,7 @@ const QColor& RiuQwtPlotWidget::backgroundColor() const //-------------------------------------------------------------------------------------------------- bool RiuQwtPlotWidget::isMultiAxisSupported() const { - return false; + return true; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtScalePicker.cpp b/ApplicationLibCode/UserInterface/RiuQwtScalePicker.cpp index 2a67545413..75e640aba2 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtScalePicker.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtScalePicker.cpp @@ -15,7 +15,7 @@ RiuQwtScalePicker::RiuQwtScalePicker( QwtPlot* plot ) : QObject( plot ) { - for ( uint i = 0; i < QwtPlot::axisCnt; i++ ) + for ( uint i = 0; i < QwtAxis::AxisPositions; i++ ) { QwtScaleWidget* scaleWidget = plot->axisWidget( i ); if ( scaleWidget ) scaleWidget->installEventFilter( this ); diff --git a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp index 4c6993fa0c..bd40c5bf8f 100644 --- a/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp +++ b/ApplicationLibCode/UserInterface/RiuRelativePermeabilityPlotPanel.cpp @@ -178,13 +178,11 @@ void RiuRelativePermeabilityPlotPanel::setPlotDefaults( QwtPlot* plot ) plot->setTitle( plotTitle ); } - plot->enableAxis( QwtPlot::xBottom, true ); - plot->enableAxis( QwtPlot::yLeft, true ); - plot->enableAxis( QwtPlot::xTop, false ); - plot->enableAxis( QwtPlot::yRight, false ); + plot->setAxesCount( QwtAxis::XBottom, 1 ); + plot->setAxesCount( QwtAxis::YLeft, 1 ); - plot->setAxisMaxMinor( QwtPlot::xBottom, 2 ); - plot->setAxisMaxMinor( QwtPlot::yLeft, 3 ); + plot->setAxisMaxMinor( QwtAxis::XBottom, 2 ); + plot->setAxisMaxMinor( QwtAxis::YLeft, 3 ); QwtLegend* legend = new QwtLegend( plot ); plot->insertLegend( legend, QwtPlot::BottomLegend ); @@ -306,8 +304,8 @@ void RiuRelativePermeabilityPlotPanel::addTransparentCurve( QwtPlot* curveLeftAxis->setSamples( pointsOnLeftAxis ); curveRightAxis->setSamples( pointsOnRightAxis ); - curveLeftAxis->setYAxis( QwtPlot::yLeft ); - curveRightAxis->setYAxis( QwtPlot::yRight ); + curveLeftAxis->setYAxis( QwtAxis::YLeft ); + curveRightAxis->setYAxis( QwtAxis::YRight ); curveLeftAxis->setStyle( QwtPlotCurve::NoCurve ); curveRightAxis->setStyle( QwtPlotCurve::NoCurve ); @@ -460,7 +458,10 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS } } - plot->enableAxis( QwtPlot::yRight, shouldEnableRightYAxis ); + if ( shouldEnableRightYAxis ) + plot->setAxesCount( QwtAxis::YRight, 1 ); + else + plot->setAxesCount( QwtAxis::YRight, 0 ); addTransparentCurve( plot, points, axes, logScaleLeftAxis ); @@ -476,44 +477,44 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS if ( logScaleLeftAxis ) { - if ( !dynamic_cast( plot->axisScaleEngine( QwtPlot::yLeft ) ) ) + if ( !dynamic_cast( plot->axisScaleEngine( QwtAxis::YLeft ) ) ) { - plot->setAxisScaleEngine( QwtPlot::yLeft, new QwtLogScaleEngine ); + plot->setAxisScaleEngine( QwtAxis::YLeft, new QwtLogScaleEngine ); } } else { - if ( !dynamic_cast( plot->axisScaleEngine( QwtPlot::yLeft ) ) ) + if ( !dynamic_cast( plot->axisScaleEngine( QwtAxis::YLeft ) ) ) { - plot->setAxisScaleEngine( QwtPlot::yLeft, new QwtLinearScaleEngine ); + plot->setAxisScaleEngine( QwtAxis::YLeft, new QwtLinearScaleEngine ); } } if ( fixedXAxis ) { - plot->setAxisScale( QwtPlot::xBottom, 0.0, 1.0 ); - plot->setAxisAutoScale( QwtPlot::xBottom, false ); + plot->setAxisScale( QwtAxis::XBottom, 0.0, 1.0 ); + plot->setAxisAutoScale( QwtAxis::XBottom, false ); } else { - plot->setAxisAutoScale( QwtPlot::xBottom, true ); + plot->setAxisAutoScale( QwtAxis::XBottom, true ); } if ( fixedLeftYAxis ) { if ( logScaleLeftAxis ) { - plot->setAxisScale( QwtPlot::yLeft, 1.0e-6, 1.0 ); + plot->setAxisScale( QwtAxis::YLeft, 1.0e-6, 1.0 ); } else { - plot->setAxisScale( QwtPlot::yLeft, 0.0, 1.0 ); + plot->setAxisScale( QwtAxis::YLeft, 0.0, 1.0 ); } - plot->setAxisAutoScale( QwtPlot::yLeft, false ); + plot->setAxisAutoScale( QwtAxis::YLeft, false ); } else { - plot->setAxisAutoScale( QwtPlot::yLeft, true ); + plot->setAxisAutoScale( QwtAxis::YLeft, true ); } QString titleStr = "Relative Permeability"; @@ -523,9 +524,9 @@ void RiuRelativePermeabilityPlotPanel::plotCurvesInQwt( RiaDefines::EclipseUnitS } plot->setTitle( titleStr ); - plot->setAxisTitle( QwtPlot::xBottom, determineXAxisTitleFromCurveCollection( curveArr ) ); - plot->setAxisTitle( QwtPlot::yLeft, "Kr" ); - plot->setAxisTitle( QwtPlot::yRight, QString( "Pc [%1]" ).arg( RiaEclipseUnitTools::unitStringPressure( unitSystem ) ) ); + plot->setAxisTitle( QwtAxis::XBottom, determineXAxisTitleFromCurveCollection( curveArr ) ); + plot->setAxisTitle( QwtAxis::YLeft, "Kr" ); + plot->setAxisTitle( QwtAxis::YRight, QString( "Pc [%1]" ).arg( RiaEclipseUnitTools::unitStringPressure( unitSystem ) ) ); plot->replot(); } @@ -626,7 +627,7 @@ void RiuRelativePermeabilityPlotPanel::addCurveConstSaturationIntersectionMarker if ( whichYAxis == RIGHT_YAXIS ) { - pointMarker->setYAxis( QwtPlot::yRight ); + pointMarker->setYAxis( QwtAxis::YRight ); } myPlotMarkers->push_back( pointMarker ); diff --git a/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp index d368d102d1..768335ec35 100644 --- a/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuResultQwtPlot.cpp @@ -88,7 +88,7 @@ void RiuResultQwtPlot::addCurve( const RimCase* rimCase, plotCurve->attach( this ); m_plotCurves.push_back( plotCurve ); - this->setAxisScale( QwtPlot::xTop, QwtDate::toDouble( dateTimes.front() ), QwtDate::toDouble( dateTimes.back() ) ); + this->setAxisScale( QwtAxis::XTop, QwtDate::toDouble( dateTimes.front() ), QwtDate::toDouble( dateTimes.back() ) ); this->applyFontSizes( false ); this->replot(); @@ -185,18 +185,16 @@ void RiuResultQwtPlot::setDefaults() { RiuQwtPlotTools::setCommonPlotBehaviour( this ); - enableAxis( QwtPlot::xBottom, true ); - enableAxis( QwtPlot::yLeft, true ); - enableAxis( QwtPlot::xTop, false ); - enableAxis( QwtPlot::yRight, false ); + setAxesCount( QwtAxis::XBottom, 1 ); + setAxesCount( QwtAxis::YLeft, 1 ); QString dateFormat = RiaPreferences::current()->dateFormat(); QString timeFormat = RiaPreferences::current()->timeFormat(); RiuQwtPlotTools::enableDateBasedBottomXAxis( this, dateFormat, timeFormat ); - setAxisMaxMinor( QwtPlot::xBottom, 2 ); - setAxisMaxMinor( QwtPlot::yLeft, 3 ); + setAxisMaxMinor( QwtAxis::XBottom, 2 ); + setAxisMaxMinor( QwtAxis::YLeft, 3 ); applyFontSizes( false ); diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp index e903f22da5..85dad5c4ec 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -87,7 +87,7 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*= // Attach a zoomer for the right axis m_zoomerRight = new RiuQwtPlotZoomer( m_plotWidget->qwtPlot()->canvas() ); - m_zoomerRight->setAxes( QwtPlot::xTop, QwtPlot::yRight ); + m_zoomerRight->setAxes( QwtAxis::XTop, QwtAxis::YRight ); m_zoomerRight->setTrackerMode( QwtPicker::AlwaysOff ); m_zoomerRight->initMousePattern( 1 ); @@ -138,8 +138,8 @@ void RiuSummaryQwtPlot::useDateBasedTimeAxis( const QString& d //-------------------------------------------------------------------------------------------------- void RiuSummaryQwtPlot::useTimeBasedTimeAxis() { - m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xBottom, new QwtLinearScaleEngine() ); - m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtPlot::xBottom, new QwtScaleDraw() ); + m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtAxis::XBottom, new QwtLinearScaleEngine() ); + m_plotWidget->qwtPlot()->setAxisScaleDraw( QwtAxis::XBottom, new QwtScaleDraw() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp b/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp index 6a36a8a9bb..e2735b7d52 100644 --- a/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp @@ -192,7 +192,7 @@ void RiuTofAccumulatedPhaseFractionsPlot::setSamples( std::vector xSampl { maxVal = std::max( val, maxVal ); } - setAxisScale( QwtPlot::xBottom, 0, maxVal ); + setAxisScale( QwtAxis::XBottom, 0, maxVal ); updateAxes(); } replot(); @@ -204,16 +204,14 @@ void RiuTofAccumulatedPhaseFractionsPlot::setSamples( std::vector xSampl void RiuTofAccumulatedPhaseFractionsPlot::setDefaults() { setCommonPlotBehaviour( this ); - setAxisTitle( QwtPlot::xBottom, "Years" ); + setAxisTitle( QwtAxis::XBottom, "Years" ); - enableAxis( QwtPlot::xBottom, true ); - enableAxis( QwtPlot::yLeft, true ); - setAxisScale( QwtPlot::yLeft, 0, 1, 0.2 ); - enableAxis( QwtPlot::xTop, false ); - enableAxis( QwtPlot::yRight, false ); + setAxesCount( QwtAxis::XBottom, 1 ); + setAxesCount( QwtAxis::YLeft, 1 ); + setAxisScale( QwtAxis::YLeft, 0, 1, 0.2 ); - setAxisMaxMinor( QwtPlot::xBottom, 2 ); - setAxisMaxMinor( QwtPlot::yLeft, 3 ); + setAxisMaxMinor( QwtAxis::XBottom, 2 ); + setAxisMaxMinor( QwtAxis::YLeft, 3 ); QSizePolicy sizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); sizePolicy.setHeightForWidth( true ); @@ -255,26 +253,26 @@ void RiuTofAccumulatedPhaseFractionsPlot::setCommonPlotBehaviour( QwtPlot* plot grid->setPen( gridPen ); // Axis number font - QFont axisFont = plot->axisFont( QwtPlot::xBottom ); + QFont axisFont = plot->axisFont( QwtAxis::XBottom ); axisFont.setPointSize( 10 ); - plot->setAxisFont( QwtPlot::xBottom, axisFont ); - plot->setAxisFont( QwtPlot::xTop, axisFont ); - plot->setAxisFont( QwtPlot::yLeft, axisFont ); - plot->setAxisFont( QwtPlot::yRight, axisFont ); + plot->setAxisFont( QwtAxis::XBottom, axisFont ); + plot->setAxisFont( QwtAxis::XTop, axisFont ); + plot->setAxisFont( QwtAxis::YLeft, axisFont ); + plot->setAxisFont( QwtAxis::YRight, axisFont ); // Axis title font - QwtText axisTitle = plot->axisTitle( QwtPlot::xBottom ); + QwtText axisTitle = plot->axisTitle( QwtAxis::XBottom ); QFont axisTitleFont = axisTitle.font(); axisTitleFont.setPointSize( 10 ); axisTitleFont.setBold( false ); axisTitle.setFont( axisTitleFont ); axisTitle.setRenderFlags( Qt::AlignRight ); - plot->setAxisTitle( QwtPlot::xBottom, axisTitle ); - plot->setAxisTitle( QwtPlot::xTop, axisTitle ); - plot->setAxisTitle( QwtPlot::yLeft, axisTitle ); - plot->setAxisTitle( QwtPlot::yRight, axisTitle ); + plot->setAxisTitle( QwtAxis::XBottom, axisTitle ); + plot->setAxisTitle( QwtAxis::XTop, axisTitle ); + plot->setAxisTitle( QwtAxis::YLeft, axisTitle ); + plot->setAxisTitle( QwtAxis::YRight, axisTitle ); // Enable mouse tracking and event filter diff --git a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp index 1ebdbd35f5..fabc6a9a23 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp @@ -58,8 +58,8 @@ class RiuWellLogCurvePointTracker : public RiuQwtCurvePointTracker if ( m_plot ) { - QwtPlot::Axis relatedYAxis = QwtPlot::yLeft; - QwtPlot::Axis relatedXAxis = QwtPlot::xTop; + QwtAxis::Position relatedYAxis = QwtAxis::YLeft; + QwtAxis::Position relatedXAxis = QwtAxis::XTop; QString curveInfoText; QString depthAxisValueString; @@ -135,10 +135,10 @@ static WellLogCurveInfoTextProvider wellLogCurveInfoTextProvider; RiuWellLogTrack::RiuWellLogTrack( RimWellLogTrack* track, QWidget* parent /*= nullptr */ ) : RiuQwtPlotWidget( track, parent ) { - setAxisEnabled( QwtPlot::yLeft, true ); - setAxisEnabled( QwtPlot::yRight, false ); - setAxisEnabled( QwtPlot::xTop, true ); - setAxisEnabled( QwtPlot::xBottom, true ); + setAxisEnabled( QwtAxis::YLeft, true ); + setAxisEnabled( QwtAxis::YRight, false ); + setAxisEnabled( QwtAxis::XTop, true ); + setAxisEnabled( QwtAxis::XBottom, true ); new RiuWellLogCurvePointTracker( this->qwtPlot(), &wellLogCurveInfoTextProvider, track ); } @@ -153,7 +153,7 @@ RiuWellLogTrack::~RiuWellLogTrack() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogTrack::setAxisEnabled( QwtPlot::Axis axis, bool enabled ) +void RiuWellLogTrack::setAxisEnabled( QwtAxis::Position axis, bool enabled ) { RiuPlotAxis plotAxis = RiuPlotAxis( RiuQwtPlotTools::fromQwtPlotAxis( axis ) ); RiuQwtPlotWidget::enableAxis( plotAxis, enabled ); diff --git a/ApplicationLibCode/UserInterface/RiuWellLogTrack.h b/ApplicationLibCode/UserInterface/RiuWellLogTrack.h index 117a2c5ba8..60dda603c6 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogTrack.h +++ b/ApplicationLibCode/UserInterface/RiuWellLogTrack.h @@ -38,5 +38,5 @@ class RiuWellLogTrack : public RiuQwtPlotWidget RiuWellLogTrack( RimWellLogTrack* track, QWidget* parent = nullptr ); ~RiuWellLogTrack() override; - void setAxisEnabled( QwtPlot::Axis axis, bool enabled ); + void setAxisEnabled( QwtAxis::Position axis, bool enabled ); }; diff --git a/ThirdParty/qwt b/ThirdParty/qwt index b207fdae66..d948bfa23d 160000 --- a/ThirdParty/qwt +++ b/ThirdParty/qwt @@ -1 +1 @@ -Subproject commit b207fdae66a346cb36c78acefaff1ae6d93416c9 +Subproject commit d948bfa23d4b628ccff5f5039b9e70515f8a3db9 From 32ec472829f04049b186db4648e0d43ab0415ce8 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 1 Apr 2022 09:31:56 +0200 Subject: [PATCH 211/406] Multiaxis plot: fix moving axis from other side --- .../Summary/RimSummaryPlot.cpp | 9 +- .../UserInterface/RiuPlotWidget.h | 7 +- .../UserInterface/RiuQtChartsPlotWidget.cpp | 8 + .../UserInterface/RiuQtChartsPlotWidget.h | 4 +- .../UserInterface/RiuQwtPlotWidget.cpp | 187 ++++++++++++++---- .../UserInterface/RiuQwtPlotWidget.h | 8 + ThirdParty/qwt | 2 +- 7 files changed, 180 insertions(+), 45 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index f036998edd..53ebc5065e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1854,15 +1854,10 @@ void RimSummaryPlot::axisPositionChanged( const caf::SignalEmitter* emitter, { auto oldAxisProperties = axisPropertiesForPlotAxis( oldPlotAxis ); if ( oldAxisProperties ) m_axisProperties.removeChildObject( oldAxisProperties ); + plotWidget()->moveAxis( oldPlotAxis, newPlotAxis ); } - std::set usedPlotAxis; - for ( const auto& axisProperties : m_axisProperties ) - { - usedPlotAxis.insert( axisProperties->plotAxisType() ); - } - - plotWidget()->pruneAxes( usedPlotAxis ); + updateAxes(); } // This is probably to much, but difficult to find the required updates diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.h b/ApplicationLibCode/UserInterface/RiuPlotWidget.h index f44810ab0f..d8861428c9 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.h @@ -107,9 +107,10 @@ class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow virtual void setAxisTitleText( RiuPlotAxis axis, const QString& title ) = 0; virtual void setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) = 0; - virtual bool isMultiAxisSupported() const = 0; - virtual RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) = 0; - virtual void pruneAxes( const std::set& usedAxes ) = 0; + virtual bool isMultiAxisSupported() const = 0; + virtual RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) = 0; + virtual void pruneAxes( const std::set& usedAxes ) = 0; + virtual void moveAxis( RiuPlotAxis oldAxis, RiuPlotAxis newAxis ) = 0; virtual void setPlotTitle( const QString& plotTitle ) = 0; const QString& plotTitle() const; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 3cd91a5ace..833a96a87b 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -1251,6 +1251,14 @@ void RiuQtChartsPlotWidget::pruneAxes( const std::set& usedAxes ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::moveAxis( RiuPlotAxis oldAxis, RiuPlotAxis newAxis ) +{ + deleteAxis( oldAxis ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index 5523c36a54..3165e6b2e3 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -103,7 +103,9 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget void setAxisFormat( RiuPlotAxis axis, const QString& format ); - void pruneAxes( const std::set& usedAxis ) override; + void pruneAxes( const std::set& usedAxis ) override; + void moveAxis( RiuPlotAxis oldAxis, RiuPlotAxis newAxis ) override; + RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) override; bool isMultiAxisSupported() const override; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 5636ac75cf..07d6ec06ec 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -69,6 +69,8 @@ #include #include +#include "RiaLogging.h" + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -101,6 +103,11 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent ) connect( this, SIGNAL( onKeyPressEvent( QKeyEvent* ) ), plotDefinition, SLOT( onKeyPressEvent( QKeyEvent* ) ) ); connect( this, SIGNAL( onWheelEvent( QWheelEvent* ) ), plotDefinition, SLOT( onWheelEvent( QWheelEvent* ) ) ); connect( this, SIGNAL( destroyed() ), plotDefinition, SLOT( onViewerDestroyed() ) ); + + ensureAxisIsCreated( RiuPlotAxis::defaultLeft() ); + ensureAxisIsCreated( RiuPlotAxis::defaultBottom() ); + ensureAxisIsCreated( RiuPlotAxis::defaultRight() ); + ensureAxisIsCreated( RiuPlotAxis::defaultTop() ); } //-------------------------------------------------------------------------------------------------- @@ -121,7 +128,7 @@ int RiuQwtPlotWidget::axisTitleFontSize( RiuPlotAxis axis ) const { if ( axisEnabled( axis ) ) { - return m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).pointSize(); + return m_plot->axisFont( toQwtPlotAxis( axis ) ).pointSize(); } return -1; } @@ -133,7 +140,7 @@ int RiuQwtPlotWidget::axisValueFontSize( RiuPlotAxis axis ) const { if ( axisEnabled( axis ) ) { - return m_plot->axisTitle( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).font().pointSize(); + return m_plot->axisTitle( toQwtPlotAxis( axis ) ).font().pointSize(); } return -1; } @@ -148,7 +155,7 @@ void RiuQwtPlotWidget::setAxisFontsAndAlignment( RiuPlotAxis axis, int titleFont // Axis number font - auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + auto qwtAxis = toQwtPlotAxis( axis ); QFont axisFont = m_plot->axisFont( qwtAxis ); axisFont.setPixelSize( valueFontPixelSize ); axisFont.setBold( false ); @@ -300,7 +307,7 @@ void RiuQwtPlotWidget::clearLegend() //-------------------------------------------------------------------------------------------------- std::pair RiuQwtPlotWidget::axisRange( RiuPlotAxis axis ) const { - QwtInterval interval = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis ) ).interval(); + QwtInterval interval = m_plot->axisScaleDiv( toQwtPlotAxis( axis ) ).interval(); return std::make_pair( interval.minValue(), interval.maxValue() ); } @@ -310,7 +317,7 @@ std::pair RiuQwtPlotWidget::axisRange( RiuPlotAxis axis ) const void RiuQwtPlotWidget::setAxisRange( RiuPlotAxis axis, double min, double max ) { // Note: Especially the Y-axis may be inverted - if ( m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->testAttribute( QwtScaleEngine::Inverted ) ) + if ( m_plot->axisScaleEngine( toQwtPlotAxis( axis ) )->testAttribute( QwtScaleEngine::Inverted ) ) { setAxisScale( axis, max, min ); } @@ -325,7 +332,7 @@ void RiuQwtPlotWidget::setAxisRange( RiuPlotAxis axis, double min, double max ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisInverted( RiuPlotAxis axis, bool isInverted ) { - m_plot->axisScaleEngine( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->setAttribute( QwtScaleEngine::Inverted, isInverted ); + m_plot->axisScaleEngine( toQwtPlotAxis( axis ) )->setAttribute( QwtScaleEngine::Inverted, isInverted ); } //-------------------------------------------------------------------------------------------------- @@ -333,8 +340,8 @@ void RiuQwtPlotWidget::setAxisInverted( RiuPlotAxis axis, bool isInverted ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enableLabels, bool enableTicks ) { - m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Ticks, enableTicks ); - m_plot->axisScaleDraw( RiuQwtPlotTools::toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Labels, enableLabels ); + m_plot->axisScaleDraw( toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Ticks, enableTicks ); + m_plot->axisScaleDraw( toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Labels, enableLabels ); recalculateAxisExtents( axis ); } @@ -344,7 +351,7 @@ void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( RiuPlotAxis axis, bool enab void RiuQwtPlotWidget::enableGridLines( RiuPlotAxis axis, bool majorGridLines, bool minorGridLines ) { QwtPlotItemList plotItems = m_plot->itemList( QwtPlotItem::Rtti_PlotGrid ); - auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + auto qwtAxis = toQwtPlotAxis( axis ); for ( QwtPlotItem* plotItem : plotItems ) { QwtPlotGrid* grid = static_cast( plotItem ); @@ -374,7 +381,7 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiuPlotAxis axis, double minValue, double maxValue ) { - auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + auto qwtAxis = toQwtPlotAxis( axis ); RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); if ( scaleEngine ) { @@ -396,7 +403,7 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis, double rangeMin, double rangeMax ) { - auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + auto qwtAxis = toQwtPlotAxis( axis ); RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); if ( scaleEngine ) { @@ -416,10 +423,10 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis, //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajorTickIntervalCount, int maxMinorTickIntervalCount ) { - m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMajorTickIntervalCount ); - m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMinorTickIntervalCount ); + m_plot->setAxisMaxMajor( toQwtPlotAxis( axis ), maxMajorTickIntervalCount ); + m_plot->setAxisMaxMinor( toQwtPlotAxis( axis ), maxMinorTickIntervalCount ); // Reapply axis limits to force Qwt to use the tick settings. - QwtInterval currentRange = m_plot->axisInterval( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + QwtInterval currentRange = m_plot->axisInterval( toQwtPlotAxis( axis ) ); setAxisScale( axis, currentRange.minValue(), currentRange.maxValue() ); } @@ -428,7 +435,7 @@ void RiuQwtPlotWidget::setAutoTickIntervalCounts( RiuPlotAxis axis, int maxMajor //-------------------------------------------------------------------------------------------------- double RiuQwtPlotWidget::majorTickInterval( RiuPlotAxis axis ) const { - QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + QwtScaleDiv scaleDiv = m_plot->axisScaleDiv( toQwtPlotAxis( axis ) ); QList majorTicks = scaleDiv.ticks( QwtScaleDiv::MajorTick ); if ( majorTicks.size() < 2 ) return 0.0; @@ -456,7 +463,7 @@ int RiuQwtPlotWidget::axisExtent( RiuPlotAxis axis ) const if ( std::abs( rangeMax - rangeMin ) < 1.0e-14 ) return 0; int lineExtent = 0; - auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + auto qwtAxis = toQwtPlotAxis( axis ); if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Ticks ) ) { @@ -465,7 +472,7 @@ int RiuQwtPlotWidget::axisExtent( RiuPlotAxis axis ) const if ( m_plot->axisScaleDraw( qwtAxis )->hasComponent( QwtAbstractScaleDraw::Labels ) ) { - QFont tickLabelFont = m_plot->axisFont( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + QFont tickLabelFont = m_plot->axisFont( toQwtPlotAxis( axis ) ); // Make space for a fairly long value label QSize labelSize = QFontMetrics( tickLabelFont ).boundingRect( QString( "9.9e-9" ) ).size(); @@ -654,7 +661,7 @@ void RiuQwtPlotWidget::applyPlotTitleToQwt() void RiuQwtPlotWidget::applyAxisTitleToQwt( RiuPlotAxis axis ) { QString titleToApply = m_axisTitlesEnabled[axis] ? m_axisTitles[axis] : QString( "" ); - auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + auto qwtAxis = toQwtPlotAxis( axis ); QwtText axisTitle = m_plot->axisTitle( qwtAxis ); if ( titleToApply != axisTitle.text() ) { @@ -793,7 +800,7 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::recalculateAxisExtents( RiuPlotAxis axis ) { - auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + auto qwtAxis = toQwtPlotAxis( axis ); if ( qwtAxis.pos == QwtAxis::YLeft || qwtAxis.pos == QwtAxis::YRight ) { int extent = axisExtent( axis ); @@ -1053,12 +1060,24 @@ QwtPlot* RiuQwtPlotWidget::qwtPlot() const //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis ) { - int requiredCount = axis.index() + 1; + auto it = m_axisMapping.find( axis ); + if ( it != m_axisMapping.end() ) return; + // Need to create the axis auto qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis ); - if ( requiredCount > m_plot->axesCount( qwtAxisId.pos ) ) + + int requiredCount = axis.index() + 1; + int count = m_plot->axesCount( qwtAxisId.pos ); + if ( requiredCount > count ) { m_plot->setAxesCount( qwtAxisId.pos, requiredCount ); + QwtAxisId newQwtAxis( qwtAxisId.pos, count ); + m_axisMapping.insert( std::make_pair( axis, newQwtAxis ) ); + } + else if ( axis.index() == 0 ) + { + QwtAxisId newQwtAxis( qwtAxisId.pos, 0 ); + m_axisMapping.insert( std::make_pair( axis, newQwtAxis ) ); } } @@ -1069,7 +1088,7 @@ void RiuQwtPlotWidget::enableAxis( RiuPlotAxis axis, bool isEnabled ) { ensureAxisIsCreated( axis ); - m_plot->setAxisVisible( RiuQwtPlotTools::toQwtPlotAxis( axis ), isEnabled ); + m_plot->setAxisVisible( toQwtPlotAxis( axis ), isEnabled ); } //-------------------------------------------------------------------------------------------------- @@ -1077,7 +1096,7 @@ void RiuQwtPlotWidget::enableAxis( RiuPlotAxis axis, bool isEnabled ) //-------------------------------------------------------------------------------------------------- bool RiuQwtPlotWidget::axisEnabled( RiuPlotAxis axis ) const { - return m_plot->isAxisVisible( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + return m_plot->isAxisVisible( toQwtPlotAxis( axis ) ); } //-------------------------------------------------------------------------------------------------- @@ -1085,7 +1104,7 @@ bool RiuQwtPlotWidget::axisEnabled( RiuPlotAxis axis ) const //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) { - m_plot->setAxisMaxMinor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMinor ); + m_plot->setAxisMaxMinor( toQwtPlotAxis( axis ), maxMinor ); } //-------------------------------------------------------------------------------------------------- @@ -1093,7 +1112,7 @@ void RiuQwtPlotWidget::setAxisMaxMinor( RiuPlotAxis axis, int maxMinor ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisMaxMajor( RiuPlotAxis axis, int maxMajor ) { - m_plot->setAxisMaxMajor( RiuQwtPlotTools::toQwtPlotAxis( axis ), maxMajor ); + m_plot->setAxisMaxMajor( toQwtPlotAxis( axis ), maxMajor ); } //-------------------------------------------------------------------------------------------------- @@ -1110,7 +1129,7 @@ void RiuQwtPlotWidget::removeEventFilter() //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale ) { - m_plot->setAxisAutoScale( RiuQwtPlotTools::toQwtPlotAxis( axis ), autoScale ); + m_plot->setAxisAutoScale( toQwtPlotAxis( axis ), autoScale ); } //-------------------------------------------------------------------------------------------------- @@ -1118,7 +1137,15 @@ void RiuQwtPlotWidget::setAxisAutoScale( RiuPlotAxis axis, bool autoScale ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max ) { - m_plot->setAxisScale( RiuQwtPlotTools::toQwtPlotAxis( axis ), min, max ); + setAxisScale( toQwtPlotAxis( axis ), min, max ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::setAxisScale( QwtAxisId axis, double min, double max ) +{ + m_plot->setAxisScale( axis, min, max ); } //-------------------------------------------------------------------------------------------------- @@ -1126,7 +1153,7 @@ void RiuQwtPlotWidget::setAxisScale( RiuPlotAxis axis, double min, double max ) //-------------------------------------------------------------------------------------------------- RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiuPlotAxis axis ) const { - auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + auto qwtAxis = toQwtPlotAxis( axis ); QwtLogScaleEngine* logScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); QwtDateScaleEngine* dateScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); @@ -1143,11 +1170,18 @@ RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiuPlotAxis axi //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::setAxisScaleType( RiuPlotAxis axis, RiuQwtPlotWidget::AxisScaleType axisScaleType ) { - auto qwtAxis = RiuQwtPlotTools::toQwtPlotAxis( axis ); + auto qwtAxis = toQwtPlotAxis( axis ); + setAxisScaleType( qwtAxis, axisScaleType ); +} - if ( axisScaleType == AxisScaleType::LOGARITHMIC ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLogScaleEngine ); - if ( axisScaleType == AxisScaleType::LINEAR ) m_plot->setAxisScaleEngine( qwtAxis, new QwtLinearScaleEngine ); - if ( axisScaleType == AxisScaleType::DATE ) m_plot->setAxisScaleEngine( qwtAxis, new QwtDateScaleEngine ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::setAxisScaleType( QwtAxisId axis, RiuQwtPlotWidget::AxisScaleType axisScaleType ) +{ + if ( axisScaleType == AxisScaleType::LOGARITHMIC ) m_plot->setAxisScaleEngine( axis, new QwtLogScaleEngine ); + if ( axisScaleType == AxisScaleType::LINEAR ) m_plot->setAxisScaleEngine( axis, new QwtLinearScaleEngine ); + if ( axisScaleType == AxisScaleType::DATE ) m_plot->setAxisScaleEngine( axis, new QwtDateScaleEngine ); } //-------------------------------------------------------------------------------------------------- @@ -1208,5 +1242,92 @@ bool RiuQwtPlotWidget::isMultiAxisSupported() const //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::pruneAxes( const std::set& usedAxes ) { - // Currently not supported. +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::moveAxis( RiuPlotAxis oldAxis, RiuPlotAxis newAxis ) +{ + auto countAxis = [this]( RiaDefines::PlotAxis axis ) { + int count = 0; + for ( auto [plotAxis, qwtMapping] : m_axisMapping ) + { + if ( plotAxis.axis() == axis ) count++; + } + return count; + }; + + auto findPlotAxisForQwtAxis = [this]( const QwtAxisId& qwtAxisId ) { + for ( auto [plotAxis, qwtMapping] : m_axisMapping ) + if ( qwtMapping == qwtAxisId ) return plotAxis; + + CAF_ASSERT( false ); + return RiuPlotAxis::defaultLeft(); + }; + + auto isLastItem = [this]( RiuPlotAxis plotAxis, int count ) { + auto qwtAxis = toQwtPlotAxis( plotAxis ); + return qwtAxis.id == ( count - 1 ); + }; + + auto removeAxis = [this, countAxis, isLastItem, findPlotAxisForQwtAxis]( RiuPlotAxis plotAxis ) { + auto qwtAxisPos = RiuQwtPlotTools::toQwtPlotAxisEnum( plotAxis.axis() ); + + int count = countAxis( plotAxis.axis() ); + + bool isLast = isLastItem( plotAxis, count ); + if ( isLast ) + { + // If axis to remove is the last axis item on the given side it + // is safe to let qwt delete it in setAxesCount. + m_axisMapping.erase( plotAxis ); + m_plot->setAxesCount( qwtAxisPos, count - 1 ); + } + else + { + // When the axis to delete is not the last axis item on the given side + // we have to move the last axis into the position of the axis to remove. + + // Move the last item into the spot which has been freed up + auto targetQwtAxis = m_axisMapping.find( plotAxis )->second; + + // Last item on the same side as we are deleting from + auto sourceQwtAxis = QwtAxisId( qwtAxisPos, count - 1 ); + auto sourcePlotAxis = findPlotAxisForQwtAxis( sourceQwtAxis ); + + // Copy properties of the last axis item + setAxisScaleType( targetQwtAxis, axisScaleType( sourcePlotAxis ) ); + auto range = axisRange( sourcePlotAxis ); + setAxisScale( targetQwtAxis, range.first, range.second ); + + bool autoScale = m_plot->axisAutoScale( sourceQwtAxis ); + m_plot->setAxisAutoScale( targetQwtAxis, autoScale ); + + // Finally remove the last item (which has been overwritten the item to remove). + m_axisMapping.erase( plotAxis ); + m_axisMapping.erase( sourcePlotAxis ); + m_axisMapping.insert( std::make_pair( sourcePlotAxis, targetQwtAxis ) ); + m_plot->setAxesCount( qwtAxisPos, count - 1 ); + } + }; + + removeAxis( oldAxis ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QwtAxisId RiuQwtPlotWidget::toQwtPlotAxis( RiuPlotAxis plotAxis ) const +{ + auto it = m_axisMapping.find( plotAxis ); + if ( it != m_axisMapping.end() ) + { + return it->second; + } + else + { + CAF_ASSERT( false ); + return QwtAxisId( 0, 0 ); + } } diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index 23d648874c..e356148b68 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -27,6 +27,8 @@ #include "cafPdmObject.h" #include "cafPdmPointer.h" +#include "qwt_axis_id.h" + #include class RiaPlotWindowRedrawScheduler; @@ -91,6 +93,7 @@ class RiuQwtPlotWidget : public RiuPlotWidget void setAxisTitleText( RiuPlotAxis axis, const QString& title ) override; void setAxisTitleEnabled( RiuPlotAxis axis, bool enable ) override; + void moveAxis( RiuPlotAxis oldAxis, RiuPlotAxis newAxis ) override; void pruneAxes( const std::set& usedAxes ) override; RiuPlotAxis createNextPlotAxis( RiaDefines::PlotAxis axis ) override; bool isMultiAxisSupported() const override; @@ -192,6 +195,10 @@ class RiuQwtPlotWidget : public RiuPlotWidget virtual bool isZoomerActive() const; virtual void endZoomOperations(); + QwtAxisId toQwtPlotAxis( RiuPlotAxis axis ) const; + void setAxisScaleType( QwtAxisId axis, RiuQwtPlotWidget::AxisScaleType axisScaleType ); + void setAxisScale( QwtAxisId axis, double min, double max ); + private: void selectClosestPlotItem( const QPoint& pos, bool toggleItemInSelection = false ); static int defaultMinimumWidth(); @@ -212,6 +219,7 @@ class RiuQwtPlotWidget : public RiuPlotWidget std::map m_originalCurveColors; std::map m_originalZValues; + std::map m_axisMapping; QPointer m_plot; }; diff --git a/ThirdParty/qwt b/ThirdParty/qwt index d948bfa23d..a7272f8e85 160000 --- a/ThirdParty/qwt +++ b/ThirdParty/qwt @@ -1 +1 @@ -Subproject commit d948bfa23d4b628ccff5f5039b9e70515f8a3db9 +Subproject commit a7272f8e852d2e5113f58fb5d1f50946330bf68b From 395541ebe055ed2c94af46c230ea8f735a73a0de Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 1 Apr 2022 10:08:54 +0200 Subject: [PATCH 212/406] Summary Plot: Make the general plot options expanded by default. --- ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 53ebc5065e..214d19b290 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2125,7 +2125,6 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& } caf::PdmUiGroup* mainOptions = uiOrdering.addNewGroup( "General Plot Options" ); - mainOptions->setCollapsedByDefault( true ); #ifdef USE_QTCHARTS mainOptions->add( &m_useQtChartsPlot ); #endif From 288269fad79c02ac6322560c7547ce9ff273df43 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 1 Apr 2022 12:42:26 +0200 Subject: [PATCH 213/406] Multiaxis: Use correct mapping from PlotAxis to QwtAxisId. --- .../Summary/RimSummaryPlotAxisFormatter.cpp | 2 +- .../UserInterface/RiuQwtPlotCurve.cpp | 12 ++++++---- .../UserInterface/RiuQwtPlotCurve.h | 3 +++ .../UserInterface/RiuQwtPlotTools.cpp | 14 +---------- .../UserInterface/RiuQwtPlotTools.h | 4 +--- .../UserInterface/RiuQwtPlotWidget.cpp | 23 +++++++++++-------- .../UserInterface/RiuQwtPlotWidget.h | 7 +++--- 7 files changed, 30 insertions(+), 35 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index b410483136..56ae40ef97 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -143,7 +143,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot auto qwtPlotWidget = dynamic_cast( plotWidget ); if ( qwtPlotWidget ) { - auto qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis ); + auto qwtAxisId = qwtPlotWidget->toQwtPlotAxis( axis ); if ( m_axisProperties->numberFormat == RimPlotAxisProperties::NUMBER_FORMAT_AUTO && m_axisProperties->scaleFactor() == 1.0 ) diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index 2c2e11555f..fa7782ec86 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -308,12 +308,14 @@ QSize RiuQwtPlotCurve::legendIconSize() const //-------------------------------------------------------------------------------------------------- void RiuQwtPlotCurve::attachToPlot( RiuPlotWidget* plotWidget ) { - RiuQwtPlotWidget* qwtPlotWidget = dynamic_cast( plotWidget ); - attach( qwtPlotWidget->qwtPlot() ); + m_plotWidget = dynamic_cast( plotWidget ); + CAF_ASSERT( m_plotWidget ); + + attach( m_plotWidget->qwtPlot() ); if ( m_showErrorBars ) { - m_qwtCurveErrorBars->attach( qwtPlotWidget->qwtPlot() ); + m_qwtCurveErrorBars->attach( m_plotWidget->qwtPlot() ); } } @@ -479,7 +481,7 @@ void RiuQwtPlotCurve::setSamplesFromXYErrorValues( const std::vector& //-------------------------------------------------------------------------------------------------- void RiuQwtPlotCurve::setXAxis( RiuPlotAxis axis ) { - QwtPlotCurve::setXAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + if ( m_plotWidget ) QwtPlotCurve::setXAxis( m_plotWidget->toQwtPlotAxis( axis ) ); } //-------------------------------------------------------------------------------------------------- @@ -487,7 +489,7 @@ void RiuQwtPlotCurve::setXAxis( RiuPlotAxis axis ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotCurve::setYAxis( RiuPlotAxis axis ) { - QwtPlotCurve::setYAxis( RiuQwtPlotTools::toQwtPlotAxis( axis ) ); + if ( m_plotWidget ) QwtPlotCurve::setYAxis( m_plotWidget->toQwtPlotAxis( axis ) ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h index 13ee0a5a68..1bf1e5b673 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h @@ -25,6 +25,7 @@ #include "qwt_plot_curve.h" class QwtPlotIntervalCurve; +class RiuQwtPlotWidget; //================================================================================================== // @@ -101,4 +102,6 @@ class RiuQwtPlotCurve : public RiuPlotCurve, public QwtPlotCurve QwtPlotIntervalCurve* m_qwtCurveErrorBars; bool m_showErrorBars; + + QPointer m_plotWidget; }; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp index 1db703a46a..9ac0460fb8 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.cpp @@ -29,6 +29,7 @@ #include "RiuQtChartsPlotCurveSymbol.h" #include "RiuQwtPlotLegend.h" +#include "qwt_axis.h" #include "qwt_date_scale_draw.h" #include "qwt_date_scale_engine.h" #include "qwt_graphic.h" @@ -39,9 +40,6 @@ #include "qwt_plot_shapeitem.h" #include "qwt_scale_widget.h" -#include "qwt_axis.h" -#include - #include //-------------------------------------------------------------------------------------------------- @@ -245,16 +243,6 @@ QwtPlotShapeItem* RiuQwtPlotTools::createBoxShape( const QString& label, return createBoxShapeT( label, startX, endX, startY, endY, color, brushStyle ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QwtAxisId RiuQwtPlotTools::toQwtPlotAxis( RiuPlotAxis axis ) -{ - QwtAxis::Position qwtPosition = toQwtPlotAxisEnum( axis.axis() ); - - return { qwtPosition, axis.index() }; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h index 573f336d43..058c0fbb46 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotTools.h @@ -65,11 +65,9 @@ class RiuQwtPlotTools QColor color, Qt::BrushStyle brushStyle = Qt::SolidPattern ); - static void updateLegendData( RiuQwtPlotLegend* legend, const std::vector& curves ); static QList createLegendData( const std::vector& curves ); - static QwtAxisId toQwtPlotAxis( RiuPlotAxis riuPlotAxis ); - static QwtAxis::Position toQwtPlotAxisEnum( RiaDefines::PlotAxis riaPlotAxis ); + static QwtAxis::Position toQwtPlotAxisEnum( RiaDefines::PlotAxis riaPlotAxis ); static RiaDefines::PlotAxis fromQwtPlotAxis( QwtAxis::Position ); }; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 07d6ec06ec..19b7c6d4d5 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -1060,23 +1060,26 @@ QwtPlot* RiuQwtPlotWidget::qwtPlot() const //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis ) { + // Check if the axis already exists auto it = m_axisMapping.find( axis ); if ( it != m_axisMapping.end() ) return; - // Need to create the axis - auto qwtAxisId = RiuQwtPlotTools::toQwtPlotAxis( axis ); - - int requiredCount = axis.index() + 1; - int count = m_plot->axesCount( qwtAxisId.pos ); - if ( requiredCount > count ) + // Special handling for default axis (index == 0): + // These are already created by qwt. + if ( axis.index() == 0 ) { - m_plot->setAxesCount( qwtAxisId.pos, requiredCount ); - QwtAxisId newQwtAxis( qwtAxisId.pos, count ); + QwtAxisId newQwtAxis( RiuQwtPlotTools::toQwtPlotAxisEnum( axis.axis() ), 0 ); m_axisMapping.insert( std::make_pair( axis, newQwtAxis ) ); } - else if ( axis.index() == 0 ) + else { - QwtAxisId newQwtAxis( qwtAxisId.pos, 0 ); + auto qwtAxisId = RiuQwtPlotTools::toQwtPlotAxisEnum( axis.axis() ); + + int count = m_plot->axesCount( qwtAxisId ); + int requiredCount = count + 1; + + m_plot->setAxesCount( qwtAxisId, requiredCount ); + QwtAxisId newQwtAxis( qwtAxisId, count ); m_axisMapping.insert( std::make_pair( axis, newQwtAxis ) ); } } diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index e356148b68..26bdabbedb 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -171,6 +171,8 @@ class RiuQwtPlotWidget : public RiuPlotWidget std::pair findClosestCurve( const QPoint& pos, double& distanceToClick ) const override; + QwtAxisId toQwtPlotAxis( RiuPlotAxis axis ) const; + signals: void plotSelected( bool toggleSelection ); void axisSelected( int axisId, bool toggleSelection ); @@ -195,9 +197,8 @@ class RiuQwtPlotWidget : public RiuPlotWidget virtual bool isZoomerActive() const; virtual void endZoomOperations(); - QwtAxisId toQwtPlotAxis( RiuPlotAxis axis ) const; - void setAxisScaleType( QwtAxisId axis, RiuQwtPlotWidget::AxisScaleType axisScaleType ); - void setAxisScale( QwtAxisId axis, double min, double max ); + void setAxisScaleType( QwtAxisId axis, RiuQwtPlotWidget::AxisScaleType axisScaleType ); + void setAxisScale( QwtAxisId axis, double min, double max ); private: void selectClosestPlotItem( const QPoint& pos, bool toggleItemInSelection = false ); From 7cb72688ea802834d4892d521bb505f2ac14edeb Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 1 Apr 2022 13:07:37 +0200 Subject: [PATCH 214/406] Multiaxis: Fix mouse tracking for Qwt plot with multiple axis. --- .../UserInterface/RiuQwtCurvePointTracker.cpp | 26 +++++++++---------- .../UserInterface/RiuQwtCurvePointTracker.h | 16 +++++------- .../UserInterface/RiuWellLogTrack.cpp | 4 +-- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp index 0006744d65..29ab863aba 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.cpp @@ -103,8 +103,8 @@ QwtText RiuQwtCurvePointTracker::trackerText( const QPoint& pos ) const if ( m_plot ) { - QwtAxis::Position relatedYAxis = QwtAxis::YLeft; - QwtAxis::Position relatedXAxis = QwtAxis::XBottom; + QwtAxisId relatedYAxis( QwtAxis::YLeft, 0 ); + QwtAxisId relatedXAxis( QwtAxis::XBottom, 0 ); QString curveInfoText; QString mainAxisValueString; @@ -136,12 +136,12 @@ QwtText RiuQwtCurvePointTracker::trackerText( const QPoint& pos ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QPointF RiuQwtCurvePointTracker::closestCurvePoint( const QPoint& cursorPosition, - QString* curveInfoText, - QString* valueAxisValueString, - QString* mainAxisValueString, - QwtAxis::Position* relatedXAxis, - QwtAxis::Position* relatedYAxis ) const +QPointF RiuQwtCurvePointTracker::closestCurvePoint( const QPoint& cursorPosition, + QString* curveInfoText, + QString* valueAxisValueString, + QString* mainAxisValueString, + QwtAxisId* relatedXAxis, + QwtAxisId* relatedYAxis ) const { QPointF samplePoint; @@ -170,8 +170,8 @@ QPointF RiuQwtCurvePointTracker::closestCurvePoint( const QPoint& cursorPos { samplePoint = closestCurve->sample( closestPointSampleIndex ); - if ( relatedXAxis ) *relatedXAxis = static_cast( closestCurve->xAxis().pos ); - if ( relatedYAxis ) *relatedYAxis = static_cast( closestCurve->yAxis().pos ); + if ( relatedXAxis ) *relatedXAxis = closestCurve->xAxis(); + if ( relatedYAxis ) *relatedYAxis = closestCurve->yAxis(); } if ( mainAxisValueString ) @@ -227,9 +227,9 @@ QPointF RiuQwtCurvePointTracker::closestCurvePoint( const QPoint& cursorPos //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtCurvePointTracker::updateClosestCurvePointMarker( const QPointF& closestPoint, - QwtAxis::Position relatedXAxis, - QwtAxis::Position relatedYAxis ) const +void RiuQwtCurvePointTracker::updateClosestCurvePointMarker( const QPointF& closestPoint, + QwtAxisId relatedXAxis, + QwtAxisId relatedYAxis ) const { bool replotRequired = false; diff --git a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h index 9813bf7d61..260ab76883 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h +++ b/ApplicationLibCode/UserInterface/RiuQwtCurvePointTracker.h @@ -42,15 +42,13 @@ class RiuQwtCurvePointTracker : public QwtPlotPicker void removeMarkerOnFocusLeave(); QwtText trackerText( const QPoint& pos ) const override; - QPointF closestCurvePoint( const QPoint& cursorPosition, - QString* curveInfoText, - QString* valueAxisValueString, - QString* mainAxisValueString, - QwtAxis::Position* relatedXAxis, - QwtAxis::Position* relatedYAxis ) const; - void updateClosestCurvePointMarker( const QPointF& closestPoint, - QwtAxis::Position relatedXAxis, - QwtAxis::Position relatedYAxis ) const; + QPointF closestCurvePoint( const QPoint& cursorPosition, + QString* curveInfoText, + QString* valueAxisValueString, + QString* mainAxisValueString, + QwtAxisId* relatedXAxis, + QwtAxisId* relatedYAxis ) const; + void updateClosestCurvePointMarker( const QPointF& closestPoint, QwtAxisId relatedXAxis, QwtAxisId relatedYAxis ) const; QPointer m_plot; QwtPlotMarker* m_plotMarker; diff --git a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp index fabc6a9a23..73cd2fe029 100644 --- a/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp +++ b/ApplicationLibCode/UserInterface/RiuWellLogTrack.cpp @@ -58,8 +58,8 @@ class RiuWellLogCurvePointTracker : public RiuQwtCurvePointTracker if ( m_plot ) { - QwtAxis::Position relatedYAxis = QwtAxis::YLeft; - QwtAxis::Position relatedXAxis = QwtAxis::XTop; + QwtAxisId relatedYAxis( QwtAxis::YLeft, 0 ); + QwtAxisId relatedXAxis( QwtAxis::XTop, 0 ); QString curveInfoText; QString depthAxisValueString; From 11060078d8d35bbcdb5335e25c3949cc85c5d563 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 1 Apr 2022 15:57:11 +0200 Subject: [PATCH 215/406] RiuQwtPlotWidget: fix actions on selection of axis. --- .../AnalysisPlots/RimAnalysisPlot.cpp | 6 +-- .../AnalysisPlots/RimAnalysisPlot.h | 2 +- .../Flow/RimWellDistributionPlot.cpp | 2 +- .../Flow/RimWellDistributionPlot.h | 2 +- .../GridCrossPlots/RimGridCrossPlot.cpp | 6 +-- .../GridCrossPlots/RimGridCrossPlot.h | 2 +- .../ProjectDataModel/RimPlot.cpp | 2 +- ApplicationLibCode/ProjectDataModel/RimPlot.h | 4 +- .../Summary/RimSummaryPlot.cpp | 23 +---------- .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 +- .../WellLog/RimWellLogTrack.cpp | 2 +- .../WellLog/RimWellLogTrack.h | 2 +- .../UserInterface/RiuQwtPlotWidget.cpp | 41 +++++++++++-------- .../UserInterface/RiuQwtPlotWidget.h | 4 +- 14 files changed, 47 insertions(+), 53 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index dee648804b..ed4ea897ae 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -905,12 +905,12 @@ void RimAnalysisPlot::updateAxes() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimAnalysisPlot::onAxisSelected( int axis, bool toggle ) +void RimAnalysisPlot::onAxisSelected( RiuPlotAxis axis, bool toggle ) { RiuPlotMainWindowTools::showPlotMainWindow(); caf::PdmObject* itemToSelect = nullptr; - if ( axis == QwtAxis::YLeft ) + if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) { if ( m_barOrientation == BARS_VERTICAL ) { @@ -921,7 +921,7 @@ void RimAnalysisPlot::onAxisSelected( int axis, bool toggle ) itemToSelect = this; } } - else if ( axis == QwtAxis::XBottom ) + else if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) { if ( m_barOrientation == BARS_HORIZONTAL ) { diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h index 53a70a0636..a844881374 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h @@ -135,7 +135,7 @@ class RimAnalysisPlot : public RimPlot void reattachAllCurves() override {} void updateAxes() override; - void onAxisSelected( int axis, bool toggle ) override; + void onAxisSelected( RiuPlotAxis axis, bool toggle ) override; void setAutoScaleXEnabled( bool enabled ) override {} void setAutoScaleYEnabled( bool enabled ) override {} void updateLegend() override{}; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp index b7d01acf39..0f17609e86 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp @@ -231,7 +231,7 @@ caf::PdmObject* RimWellDistributionPlot::findPdmObjectFromPlotCurve( const RiuPl //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellDistributionPlot::onAxisSelected( int /*axis*/, bool /*toggle*/ ) +void RimWellDistributionPlot::onAxisSelected( RiuPlotAxis /*axis*/, bool /*toggle*/ ) { // cvf::Trace::show("RimWellDistributionPlot::onAxisSelected()"); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h index 1949837277..26f60d80e4 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h @@ -60,7 +60,7 @@ class RimWellDistributionPlot : public RimPlot void reattachAllCurves() override; void detachAllCurves() override; caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; - void onAxisSelected( int axis, bool toggle ) override; + void onAxisSelected( RiuPlotAxis axis, bool toggle ) override; // RimPlotWindow implementations QString description() const override; diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index 6f26414d52..52b7f95e77 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -372,15 +372,15 @@ caf::PdmObject* RimGridCrossPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlot::onAxisSelected( int axis, bool toggle ) +void RimGridCrossPlot::onAxisSelected( RiuPlotAxis axis, bool toggle ) { RiuPlotMainWindowTools::showPlotMainWindow(); RimPlotAxisProperties* properties = nullptr; - if ( axis == QwtAxis::YLeft ) + if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) { properties = m_yAxisProperties; } - else if ( axis == QwtAxis::XBottom ) + else if ( axis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) { properties = m_xAxisProperties; } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h index 36d460f79d..38259d11dc 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h @@ -105,7 +105,7 @@ class RimGridCrossPlot : public RimPlot, public RimNameConfigHolderInterface void setAutoScaleXEnabled( bool enabled ) override; void setAutoScaleYEnabled( bool enabled ) override; caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; - void onAxisSelected( int axis, bool toggle ) override; + void onAxisSelected( RiuPlotAxis axis, bool toggle ) override; bool isDeletable() const override; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index c221fd53f9..aabcfb98fd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -320,6 +320,6 @@ void RimPlot::onPlotItemSelected( std::shared_ptr, bool, int ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlot::onAxisSelected( int axis, bool toggle ) +void RimPlot::onAxisSelected( RiuPlotAxis axis, bool toggle ) { } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.h b/ApplicationLibCode/ProjectDataModel/RimPlot.h index 48d7aae63e..a2395c04af 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.h @@ -22,6 +22,8 @@ #include "RimPlotWindow.h" +#include "RiuPlotAxis.h" + #include "cafAppEnum.h" #include "cafPdmChildArrayField.h" #include "cafPdmField.h" @@ -119,7 +121,7 @@ class RimPlot : public QObject, public RimPlotWindow virtual void handleWheelEvent( QWheelEvent* event ); private slots: - virtual void onAxisSelected( int axis, bool toggle ); + virtual void onAxisSelected( RiuPlotAxis axis, bool toggle ); virtual void onPlotItemSelected( std::shared_ptr selectedItem, bool toggleItem, int sampleIndex ); void onPlotSelected( bool toggle ); void onViewerDestroyed(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 214d19b290..99506b52cf 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -377,30 +377,11 @@ caf::PdmObject* RimSummaryPlot::findPdmObjectFromPlotCurve( const RiuPlotCurve* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlot::onAxisSelected( int axis, bool toggle ) +void RimSummaryPlot::onAxisSelected( RiuPlotAxis axis, bool toggle ) { RiuPlotMainWindowTools::showPlotMainWindow(); - caf::PdmObject* itemToSelect = nullptr; - if ( axis == QwtAxis::YLeft ) - { - itemToSelect = m_leftYAxisProperties_OBSOLETE; - } - else if ( axis == QwtAxis::YRight ) - { - itemToSelect = m_rightYAxisProperties_OBSOLETE; - } - else if ( axis == QwtAxis::XBottom ) - { - if ( m_isCrossPlot ) - { - itemToSelect = m_bottomAxisProperties_OBSOLETE; - } - else - { - itemToSelect = m_timeAxisProperties_OBSOLETE; - } - } + caf::PdmObject* itemToSelect = axisPropertiesForPlotAxis( axis ); if ( toggle ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index e16977c485..e1072259f5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -178,7 +178,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping caf::PdmObject* findPdmObjectFromPlotCurve( const RiuPlotCurve* curve ) const override; - void onAxisSelected( int axis, bool toggle ) override; + void onAxisSelected( RiuPlotAxis axis, bool toggle ) override; static constexpr int precision() { diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index a82850a5d1..a480312be5 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -1043,7 +1043,7 @@ void RimWellLogTrack::updateZoomFromParentPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::onAxisSelected( int axis, bool toggle ) +void RimWellLogTrack::onAxisSelected( RiuPlotAxis axis, bool toggle ) { if ( toggle ) { diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index 0eaa609bed..59e2357cb5 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -210,7 +210,7 @@ class RimWellLogTrack : public RimPlot QString asciiDataForPlotExport() const override; - void onAxisSelected( int axis, bool toggle ) override; + void onAxisSelected( RiuPlotAxis axis, bool toggle ) override; void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector& referringObjects ) override; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 19b7c6d4d5..ff8c87a4be 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -95,7 +95,7 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent ) setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); connect( this, SIGNAL( plotSelected( bool ) ), plotDefinition, SLOT( onPlotSelected( bool ) ) ); - connect( this, SIGNAL( axisSelected( int, bool ) ), plotDefinition, SLOT( onAxisSelected( int, bool ) ) ); + connect( this, SIGNAL( axisSelected( RiuPlotAxis, bool ) ), plotDefinition, SLOT( onAxisSelected( RiuPlotAxis, bool ) ) ); connect( this, SIGNAL( plotItemSelected( std::shared_ptr, bool, int ) ), plotDefinition, @@ -562,9 +562,9 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event ) m_clickPosition = mouseEvent->pos(); } - if ( watched == this && !m_plot->canvas()->geometry().contains( mouseEvent->pos() ) ) + if ( watched == m_plot && !m_plot->canvas()->geometry().contains( mouseEvent->pos() ) ) { - if ( mouseEvent->type() == QMouseEvent::MouseButtonRelease && ( mouseEvent->button() == Qt::LeftButton ) && + if ( mouseEvent->type() == QMouseEvent::MouseButtonPress && ( mouseEvent->button() == Qt::LeftButton ) && !m_clickPosition.isNull() ) { QWidget* childClicked = m_plot->childAt( m_clickPosition ); @@ -784,15 +784,20 @@ RimViewWindow* RiuQwtPlotWidget::ownerViewWindow() const //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection ) { - int axisId = -1; for ( int i = 0; i < QwtAxis::AxisPositions; ++i ) { - if ( scale == m_plot->axisWidget( i ) ) + QwtAxis::Position pos = static_cast( i ); + int count = m_plot->axesCount( pos ); + for ( int id = 0; id < count; id++ ) { - axisId = i; + QwtAxisId axisId( pos, id ); + if ( scale == m_plot->axisWidget( axisId ) ) + { + emit axisSelected( findPlotAxisForQwtAxis( axisId ), toggleItemInSelection ); + return; + } } } - emit axisSelected( axisId, toggleItemInSelection ); } //-------------------------------------------------------------------------------------------------- @@ -1247,6 +1252,18 @@ void RiuQwtPlotWidget::pruneAxes( const std::set& usedAxes ) { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotAxis RiuQwtPlotWidget::findPlotAxisForQwtAxis( const QwtAxisId& qwtAxisId ) const +{ + for ( auto [plotAxis, qwtMapping] : m_axisMapping ) + if ( qwtMapping == qwtAxisId ) return plotAxis; + + CAF_ASSERT( false ); + return RiuPlotAxis::defaultLeft(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1261,20 +1278,12 @@ void RiuQwtPlotWidget::moveAxis( RiuPlotAxis oldAxis, RiuPlotAxis newAxis ) return count; }; - auto findPlotAxisForQwtAxis = [this]( const QwtAxisId& qwtAxisId ) { - for ( auto [plotAxis, qwtMapping] : m_axisMapping ) - if ( qwtMapping == qwtAxisId ) return plotAxis; - - CAF_ASSERT( false ); - return RiuPlotAxis::defaultLeft(); - }; - auto isLastItem = [this]( RiuPlotAxis plotAxis, int count ) { auto qwtAxis = toQwtPlotAxis( plotAxis ); return qwtAxis.id == ( count - 1 ); }; - auto removeAxis = [this, countAxis, isLastItem, findPlotAxisForQwtAxis]( RiuPlotAxis plotAxis ) { + auto removeAxis = [this, countAxis, isLastItem]( RiuPlotAxis plotAxis ) { auto qwtAxisPos = RiuQwtPlotTools::toQwtPlotAxisEnum( plotAxis.axis() ); int count = countAxis( plotAxis.axis() ); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index 26bdabbedb..0649e8b5a9 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -175,7 +175,7 @@ class RiuQwtPlotWidget : public RiuPlotWidget signals: void plotSelected( bool toggleSelection ); - void axisSelected( int axisId, bool toggleSelection ); + void axisSelected( RiuPlotAxis axisId, bool toggleSelection ); void plotItemSelected( std::shared_ptr plotItem, bool toggleSelection, int sampleIndex ); void onKeyPressEvent( QKeyEvent* event ); void onWheelEvent( QWheelEvent* event ); @@ -200,6 +200,8 @@ class RiuQwtPlotWidget : public RiuPlotWidget void setAxisScaleType( QwtAxisId axis, RiuQwtPlotWidget::AxisScaleType axisScaleType ); void setAxisScale( QwtAxisId axis, double min, double max ); + RiuPlotAxis findPlotAxisForQwtAxis( const QwtAxisId& qwtAxisId ) const; + private: void selectClosestPlotItem( const QPoint& pos, bool toggleItemInSelection = false ); static int defaultMinimumWidth(); From 391d13565ee64215ff8a68a342feb186cc3cfcad Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 4 Apr 2022 10:11:21 +0200 Subject: [PATCH 216/406] RiuPlotWidget: highlight relevant curves when clicking on an axis. --- .../UserInterface/RiuQwtPlotWidget.cpp | 40 ++++++++++++++++--- .../UserInterface/RiuQwtPlotWidget.h | 3 +- 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index ff8c87a4be..28dde58841 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -793,7 +793,12 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS QwtAxisId axisId( pos, id ); if ( scale == m_plot->axisWidget( axisId ) ) { - emit axisSelected( findPlotAxisForQwtAxis( axisId ), toggleItemInSelection ); + resetPlotItemHighlighting(); + highlightPlotItemsForQwtAxis( axisId ); + scheduleReplot(); + + RiuPlotAxis plotAxis = findPlotAxisForQwtAxis( axisId ); + emit axisSelected( plotAxis, toggleItemInSelection ); return; } } @@ -919,7 +924,8 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem if ( closestItem && distanceFromClick < 20 ) { // TODO: highlight all selected curves - highlightPlotItem( closestItem ); + std::set plotItems = { closestItem }; + highlightPlotItems( plotItems ); auto plotItem = std::make_shared( closestItem ); emit plotItemSelected( plotItem, toggleItemInSelection, distanceFromClick < 10 ? closestCurvePoint : -1 ); @@ -950,7 +956,7 @@ void RiuQwtPlotWidget::replot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuQwtPlotWidget::highlightPlotItem( const QwtPlotItem* closestItem ) +void RiuQwtPlotWidget::highlightPlotItems( const std::set& closestItems ) { // NB! Create a copy of the item list before the loop to avoid invalidated iterators when iterating the list // plotCurve->setZ() causes the ordering of items in the list to change @@ -976,7 +982,7 @@ void RiuQwtPlotWidget::highlightPlotItem( const QwtPlotItem* closestItem ) } double zValue = plotCurve->z(); - if ( plotCurve == closestItem ) + if ( closestItems.count( plotCurve ) > 0 ) { plotCurve->setZ( zValue + 100.0 ); } @@ -998,7 +1004,7 @@ void RiuQwtPlotWidget::highlightPlotItem( const QwtPlotItem* closestItem ) m_originalCurveColors.insert( std::make_pair( plotCurve, curveColors ) ); m_originalZValues.insert( std::make_pair( plotCurve, zValue ) ); } - else if ( plotShapeItem && plotItem == closestItem ) + else if ( plotShapeItem && closestItems.count( plotItem ) > 0 ) { QPen pen = plotShapeItem->pen(); pen.setColor( QColor( Qt::green ) ); @@ -1052,6 +1058,30 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting() m_originalZValues.clear(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::highlightPlotItemsForQwtAxis( QwtAxisId axisId ) +{ + std::set plotItems; + auto plotItemList = m_plot->itemList(); + for ( QwtPlotItem* plotItem : plotItemList ) + { + QwtPlotCurve* plotCurve = dynamic_cast( plotItem ); + if ( plotCurve ) + { + QwtAxisId xAxis = plotCurve->xAxis(); + QwtAxisId yAxis = plotCurve->yAxis(); + if ( xAxis == axisId || yAxis == axisId ) + { + plotItems.insert( plotItem ); + } + } + } + + highlightPlotItems( plotItems ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index 0649e8b5a9..26e81ca227 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -207,7 +207,8 @@ class RiuQwtPlotWidget : public RiuPlotWidget static int defaultMinimumWidth(); void replot() override; - void highlightPlotItem( const QwtPlotItem* closestItem ); + void highlightPlotItemsForQwtAxis( QwtAxisId axisId ); + void highlightPlotItems( const std::set& closestItems ); void resetPlotItemHighlighting(); void onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection ); void recalculateAxisExtents( RiuPlotAxis axis ); From ca61e9f9a88946ecd92a952553922dfc25296777 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 4 Apr 2022 14:44:29 +0200 Subject: [PATCH 217/406] Multi Axis: Make sure widget axis is created during assignment of plot axis --- ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 99506b52cf..2ba4fb8864 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1196,6 +1196,8 @@ void RimSummaryPlot::connectCurveToPlot( RimSummaryCurve* curve, bool update, bo connectCurveSignals( curve ); if ( plotWidget() ) { + plotWidget()->ensureAxisIsCreated( curve->axisY() ); + if ( update ) { curve->setParentPlotAndReplot( plotWidget() ); From 45d28de6d3ff0f3349941867c584aadf9b3c02fe Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 4 Apr 2022 15:10:39 +0200 Subject: [PATCH 218/406] #8768 Multi Plot: Add option to sync all sub plots axis properties. --- .../Summary/RimSummaryMultiPlot.cpp | 24 +++++++++++++++++++ .../Summary/RimSummaryMultiPlot.h | 2 ++ .../Summary/RimSummaryPlot.cpp | 20 ++++++++++++++++ .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 +++- 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index b9f9c86512..99c24202c7 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -74,6 +74,8 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() m_disableWheelZoom.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_disableWheelZoom.uiCapability()->setUiIconFromResourceString( ":/DisableZoom.png" ); + CAF_PDM_InitField( &m_syncSubPlotAxes, "SyncSubPlotAxes", false, "Sync Subplot Axes" ); + CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); m_sourceStepping = new RimSummaryPlotSourceStepping; m_sourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS ); @@ -114,6 +116,7 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) CVF_ASSERT( sumPlot != nullptr ); if ( sumPlot ) { + sumPlot->axisChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAxisChanged ); sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); RimMultiPlot::insertPlot( plot, index ); } @@ -287,6 +290,9 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde layoutGroup->add( &m_rowsPerPage ); layoutGroup->add( &m_majorTickmarkCount ); + caf::PdmUiGroup* axesGroup = uiOrdering.addNewGroup( "Axes" ); + axesGroup->add( &m_syncSubPlotAxes ); + uiOrdering.skipRemainingFields( true ); } @@ -499,6 +505,7 @@ void RimSummaryMultiPlot::initAfterRead() for ( auto plot : summaryPlots() ) { + plot->axisChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAxisChanged ); plot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); } } @@ -576,3 +583,20 @@ void RimSummaryMultiPlot::onSubPlotChanged( const caf::SignalEmitter* emitter ) updatePlotWindowTitle(); applyPlotWindowTitleToWidgets(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot ) +{ + if ( !m_syncSubPlotAxes() ) return; + + for ( auto plot : summaryPlots() ) + { + if ( plot != summaryPlot ) + { + plot->copyMatchingAxisPropertiesFromOther( *summaryPlot ); + plot->updateAll(); + } + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 640f0efca1..ce9e708ff5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -98,6 +98,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void duplicate(); void onSubPlotChanged( const caf::SignalEmitter* emitter ); + void onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot ); private: caf::PdmField m_autoPlotTitles; @@ -105,6 +106,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep caf::PdmField m_syncAxisRanges; caf::PdmField m_disableWheelZoom; caf::PdmField m_createPlotDuplicate; + caf::PdmField m_syncSubPlotAxes; caf::PdmChildField m_sourceStepping; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 2ba4fb8864..8a6d6d3cbd 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -98,6 +98,7 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) : RimPlot() , m_isCrossPlot( isCrossPlot ) , curvesChanged( this ) + , axisChanged( this ) { CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" ); @@ -617,6 +618,24 @@ void RimSummaryPlot::copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSu } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::copyMatchingAxisPropertiesFromOther( const RimSummaryPlot& summaryPlot ) +{ + for ( auto apToCopy : summaryPlot.plotAxes() ) + { + for ( auto ap : plotAxes() ) + { + if ( ap->name().compare( apToCopy->name() ) == 0 ) + { + QString data = apToCopy->writeObjectToXmlString(); + ap->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() ); + } + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1743,6 +1762,7 @@ void RimSummaryPlot::connectAxisSignals( RimPlotAxisProperties* axis ) //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::axisSettingsChanged( const caf::SignalEmitter* emitter ) { + axisChanged.send( this ); updateAxes(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index e1072259f5..a0602e4d80 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -80,7 +80,8 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping CAF_PDM_HEADER_INIT; public: - caf::Signal<> curvesChanged; + caf::Signal<> curvesChanged; + caf::Signal axisChanged; public: RimSummaryPlot( bool isCrossPlot = false ); @@ -150,6 +151,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping QString generatedPlotTitleFromAllCurves() const; void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot ); + void copyMatchingAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot ); void updateAll(); void updateLegend() override; From 449b4e47810023a82934e9a9c797a882b3f9d951 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 4 Apr 2022 15:48:51 +0200 Subject: [PATCH 219/406] RimPlotAxisProperties: only allow plot axis positions left and right. --- .../ProjectDataModel/RimPlotAxisProperties.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 19ecc89b55..8175b3f724 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -20,6 +20,7 @@ #include "RimPlotAxisProperties.h" #include "RiaDefines.h" +#include "RiaPlotDefines.h" #include "RiaPreferences.h" #include "RimPlotAxisAnnotation.h" @@ -161,6 +162,19 @@ QList { options = caf::FontTools::relativeSizeValueOptions( RiaPreferences::current()->defaultPlotFontSize() ); } + else if ( fieldNeedingOptions == &m_plotAxis ) + { + std::vector plotAxes = { RiaDefines::PlotAxis::PLOT_AXIS_LEFT, + RiaDefines::PlotAxis::PLOT_AXIS_RIGHT }; + + for ( auto plotAxis : plotAxes ) + { + auto plotAxisEnum = caf::AppEnum( plotAxis ); + + QString uiText = plotAxisEnum.uiText(); + options.push_back( caf::PdmOptionItemInfo( uiText, plotAxisEnum.value() ) ); + } + } return options; } From 1407c6f96f32b7c16ac331b7b89dbb42fb16499f Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 4 Apr 2022 15:50:01 +0200 Subject: [PATCH 220/406] RimPlotAxisProperties: reset "always required" bool on reload. --- ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 8175b3f724..32d60d9dc4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -489,6 +489,7 @@ caf::FontTools::FontSize RimPlotAxisProperties::plotFontSize() const void RimPlotAxisProperties::initAfterRead() { updateOptionSensitivity(); + m_isAlwaysRequired = m_plotAxisIndex == 0; } //-------------------------------------------------------------------------------------------------- From 22673c1073ab38f85ae6f660eee1496349688581 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 6 Apr 2022 08:44:44 +0200 Subject: [PATCH 221/406] Summary Multiplot: Add icon and update text minor adjustments --- .../RicCreateMultiPlotFromSelectionFeature.cpp | 2 +- .../ProjectDataModel/Summary/RimSummaryMultiPlot.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp index 67a159126f..ce3e847df9 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp @@ -124,6 +124,6 @@ void RicCreateMultiPlotFromSelectionFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicCreateMultiPlotFromSelectionFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText( "Create Summary MultiPlot from Template" ); + actionToSetup->setText( "Create Summary Plot from Template" ); actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 99c24202c7..ac4cc355ad 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -53,7 +53,7 @@ CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); RimSummaryMultiPlot::RimSummaryMultiPlot() : duplicatePlot( this ) { - CAF_PDM_InitObject( "Multi Summary Plot" ); + CAF_PDM_InitObject( "Multi Summary Plot", ":/SummaryPlotLight16x16.png" ); this->setDeletable( true ); CAF_PDM_InitField( &m_autoPlotTitles, "AutoPlotTitles", true, "Auto Plot Titles" ); From 6417daf167beec546accd6514b7cddc80865e21b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 6 Apr 2022 08:43:02 +0200 Subject: [PATCH 222/406] #8773 Source Stepping : Realization cases are missing in some cases --- .../Tools/RiaEnsembleNameTools.cpp | 51 +++++++++++++++++ .../Application/Tools/RiaEnsembleNameTools.h | 6 ++ .../Summary/RimSummaryCase.cpp | 56 +------------------ .../ProjectDataModel/Summary/RimSummaryCase.h | 3 - .../Summary/RimSummaryPlotSourceStepping.cpp | 27 ++++++--- 5 files changed, 78 insertions(+), 65 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.cpp b/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.cpp index 3a484c80d3..51f4769348 100644 --- a/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.cpp @@ -22,6 +22,9 @@ #include "RiaTextStringTools.h" #include "RimCaseDisplayNameTools.h" +#include "RimProject.h" +#include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" #include "cafAppEnum.h" @@ -131,6 +134,54 @@ std::vector RiaEnsembleNameTools::groupFilesByEnsemble( const QStri return groupedByIteration; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaEnsembleNameTools::uniqueShortNameForEnsembleCase( RimSummaryCase* summaryCase ) +{ + CAF_ASSERT( summaryCase && summaryCase->ensemble() ); + + auto ensembleCaseName = summaryCase->nativeCaseName(); + auto ensemble = summaryCase->ensemble(); + auto summaryCases = ensemble->allSummaryCases(); + + QStringList summaryFilePaths; + summaryFilePaths.push_back( summaryCase->summaryHeaderFilename() ); + + for ( auto otherSummaryCase : summaryCases ) + { + if ( otherSummaryCase != summaryCase ) + { + summaryFilePaths.push_back( otherSummaryCase->summaryHeaderFilename() ); + } + } + + return RiaEnsembleNameTools::uniqueShortName( summaryCase->summaryHeaderFilename(), summaryFilePaths, ensembleCaseName ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiaEnsembleNameTools::uniqueShortNameForSummaryCase( RimSummaryCase* summaryCase ) +{ + std::set allAutoShortNames; + + std::vector allCases; + RimProject::current()->descendantsOfType( allCases ); + + for ( auto sumCase : allCases ) + { + if ( sumCase && sumCase != summaryCase ) + { + allAutoShortNames.insert( sumCase->displayCaseName() ); + } + } + + return RimCaseDisplayNameTools::uniqueShortName( summaryCase->nativeCaseName(), + allAutoShortNames, + RimCaseDisplayNameTools::CASE_SHORT_NAME_LENGTH ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.h b/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.h index ddf7290f79..d085814b54 100644 --- a/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.h +++ b/ApplicationLibCode/Application/Tools/RiaEnsembleNameTools.h @@ -19,9 +19,12 @@ #pragma once #include + #include #include +class RimSummaryCase; + //================================================================================================== // //================================================================================================== @@ -49,6 +52,9 @@ class RiaEnsembleNameTools static std::vector groupFilesByEnsemble( const QStringList& fileNames, EnsembleGroupingMode groupingMode ); + static QString uniqueShortNameForEnsembleCase( RimSummaryCase* summaryCase ); + static QString uniqueShortNameForSummaryCase( RimSummaryCase* summaryCase ); + private: static QStringList findUniqueEnsembleNames( const QStringList& fileNames, const std::vector& fileNameComponents, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp index d715f50ad1..00c35f0dc6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp @@ -304,58 +304,6 @@ void RimSummaryCase::initAfterRead() refreshMetaData(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryCase::uniqueShortNameForEnsembleCase( RimSummaryCase* summaryCase ) -{ - CAF_ASSERT( summaryCase && summaryCase->ensemble() ); - - QString ensembleCaseName = summaryCase->caseName(); - - auto ensemble = summaryCase->ensemble(); - - std::vector summaryCases = ensemble->allSummaryCases(); - - QRegularExpression trimRe( "^[^a-zA-Z0-9]+" ); - - QStringList summaryFilePaths; - summaryFilePaths.push_back( summaryCase->summaryHeaderFilename() ); - - for ( auto otherSummaryCase : summaryCases ) - { - if ( otherSummaryCase != summaryCase ) - { - summaryFilePaths.push_back( otherSummaryCase->summaryHeaderFilename() ); - } - } - - return RiaEnsembleNameTools::uniqueShortName( summaryCase->summaryHeaderFilename(), summaryFilePaths, ensembleCaseName ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryCase::uniqueShortNameForSummaryCase( RimSummaryCase* summaryCase ) -{ - std::set allAutoShortNames; - - std::vector allCases; - RimProject::current()->descendantsOfType( allCases ); - - for ( RimSummaryCase* sumCase : allCases ) - { - if ( sumCase && sumCase != summaryCase ) - { - allAutoShortNames.insert( sumCase->displayCaseName() ); - } - } - - return RimCaseDisplayNameTools::uniqueShortName( summaryCase->caseName(), - allAutoShortNames, - RimCaseDisplayNameTools::CASE_SHORT_NAME_LENGTH ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -369,11 +317,11 @@ void RimSummaryCase::updateAutoShortName() { if ( ensemble() ) { - m_displayName = RimSummaryCase::uniqueShortNameForEnsembleCase( this ); + m_displayName = RiaEnsembleNameTools::uniqueShortNameForEnsembleCase( this ); } else { - m_displayName = RimSummaryCase::uniqueShortNameForSummaryCase( this ); + m_displayName = RiaEnsembleNameTools::uniqueShortNameForSummaryCase( this ); } } updateTreeItemName(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h index a87b9352cb..52545d57d5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h @@ -95,9 +95,6 @@ class RimSummaryCase : public caf::PdmObject void initAfterRead() override; private: - static QString uniqueShortNameForEnsembleCase( RimSummaryCase* summaryCase ); - static QString uniqueShortNameForSummaryCase( RimSummaryCase* summaryCase ); - void buildChildNodes(); protected: diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 7e9e3fcb20..7c604b2383 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -18,6 +18,7 @@ #include "RimSummaryPlotSourceStepping.h" +#include "RiaEnsembleNameTools.h" #include "RiaGuiApplication.h" #include "RiaStdStringTools.h" #include "RiaSummaryAddressAnalyzer.h" @@ -58,8 +59,8 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() CAF_PDM_InitField( &m_includeEnsembleCasesForCaseStepping, "IncludeEnsembleCasesForCaseStepping", - false, - "Allow Stepping on Ensemble cases" ); + true, + "Include Ensemble Cases in Case List" ); CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name" ); CAF_PDM_InitFieldNoDefault( &m_wellGroupName, "GroupName", "Group Name" ); @@ -195,21 +196,32 @@ QList { return caf::PdmObject::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); } - else if ( fieldNeedingOptions == &m_placeholderForLabel ) + + if ( fieldNeedingOptions == &m_placeholderForLabel ) { return options; } - else if ( fieldNeedingOptions == &m_summaryCase ) + + if ( fieldNeedingOptions == &m_summaryCase ) { auto summaryCases = RimSummaryPlotSourceStepping::summaryCasesForSourceStepping(); for ( auto sumCase : summaryCases ) { - options.append( caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ) ); + if ( sumCase->ensemble() ) + { + auto name = sumCase->ensemble()->name() + " : " + sumCase->displayCaseName(); + options.append( caf::PdmOptionItemInfo( name, sumCase ) ); + } + else + { + options.append( caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ) ); + } } return options; } - else if ( fieldNeedingOptions == &m_ensemble ) + + if ( fieldNeedingOptions == &m_ensemble ) { RimProject* proj = RimProject::current(); for ( auto ensemble : proj->summaryGroups() ) @@ -745,8 +757,7 @@ std::vector RimSummaryPlotSourceStepping::activeFieldsForD m_summaryCase = *( sumCases.begin() ); fields.push_back( &m_summaryCase ); - - m_includeEnsembleCasesForCaseStepping.uiCapability()->setUiHidden( false ); + fields.push_back( &m_includeEnsembleCasesForCaseStepping ); } } From 470d239a076ac2bfa9a35d2de029e43698813923 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 5 Apr 2022 13:52:37 +0200 Subject: [PATCH 223/406] Toolbar Editor : Make sure uiOrdering use unique objects --- Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp index e02a406c18..57314c9426 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp @@ -121,9 +121,9 @@ void PdmUiToolBarEditor::configureAndUpdateUi( const QString& uiConfigName ) } } - PdmUiOrdering config; for ( caf::PdmUiObjectHandle* ownerUiObject : ownerUiObjects ) { + PdmUiOrdering config; ownerUiObject->uiOrdering( uiConfigName, config ); } } From 9bbc7091573d3c364b2cb532455ee3a9ea728ac5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 5 Apr 2022 13:57:47 +0200 Subject: [PATCH 224/406] #8773 Source Stepping : Show data source stepping on summary multiplot --- .../Summary/RimSummaryMultiPlot.cpp | 5 +++++ .../Summary/RimSummaryPlotSourceStepping.cpp | 17 +++++++++++------ .../Summary/RimSummaryPlotSourceStepping.h | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index ac4cc355ad..0ab5bcaaf9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -293,6 +293,11 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde caf::PdmUiGroup* axesGroup = uiOrdering.addNewGroup( "Axes" ); axesGroup->add( &m_syncSubPlotAxes ); + { + auto group = uiOrdering.addNewGroup( "Data Source" ); + m_sourceStepping()->uiOrdering( uiConfigName, *group ); + } + uiOrdering.skipRemainingFields( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 7c604b2383..d43c81781a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -161,7 +161,8 @@ void RimSummaryPlotSourceStepping::applyPrevOtherIdentifier() //-------------------------------------------------------------------------------------------------- std::vector RimSummaryPlotSourceStepping::fieldsToShowInToolbar() { - return activeFieldsForDataSourceStepping(); + bool fieldsForToolbar = true; + return activeFieldsForDataSourceStepping( fieldsForToolbar ); } //-------------------------------------------------------------------------------------------------- @@ -169,7 +170,8 @@ std::vector RimSummaryPlotSourceStepping::fieldsToShowInTo //-------------------------------------------------------------------------------------------------- void RimSummaryPlotSourceStepping::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - auto visible = activeFieldsForDataSourceStepping(); + bool fieldsForToolbar = false; + auto visible = activeFieldsForDataSourceStepping( fieldsForToolbar ); if ( visible.empty() ) { uiOrdering.add( &m_placeholderForLabel ); @@ -209,8 +211,11 @@ QList { if ( sumCase->ensemble() ) { - auto name = sumCase->ensemble()->name() + " : " + sumCase->displayCaseName(); - options.append( caf::PdmOptionItemInfo( name, sumCase ) ); + if ( m_includeEnsembleCasesForCaseStepping() ) + { + auto name = sumCase->ensemble()->name() + " : " + sumCase->displayCaseName(); + options.append( caf::PdmOptionItemInfo( name, sumCase ) ); + } } else { @@ -744,7 +749,7 @@ std::set RimSummaryPlotSourceStepping::summaryCasesCurveCollect //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimSummaryPlotSourceStepping::activeFieldsForDataSourceStepping() +std::vector RimSummaryPlotSourceStepping::activeFieldsForDataSourceStepping( bool toolbarFields ) { std::vector fields; @@ -757,7 +762,7 @@ std::vector RimSummaryPlotSourceStepping::activeFieldsForD m_summaryCase = *( sumCases.begin() ); fields.push_back( &m_summaryCase ); - fields.push_back( &m_includeEnsembleCasesForCaseStepping ); + if ( !toolbarFields ) fields.push_back( &m_includeEnsembleCasesForCaseStepping ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index 22b36a16a5..8b22b2d80f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -78,7 +78,7 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject std::set addressesForCurvesInPlot() const; std::set summaryCasesCurveCollection() const; - std::vector activeFieldsForDataSourceStepping(); + std::vector activeFieldsForDataSourceStepping( bool toolbarFields ); std::set ensembleCollection() const; bool isXAxisStepping() const; From 3590c52cdce5d5adb091b445f13669f439f21d93 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Wed, 6 Apr 2022 17:39:07 +0200 Subject: [PATCH 225/406] Deprecate single summary plots and plot collections. (#8777) * Deprecate single summary plots and plot collections. Replace functionality using summary multi plots. Clean up some code. Fix crash when trying to normalize an empty curve --- .../Application/RiaGuiApplication.cpp | 1 - .../Tools/RiaImportEclipseCaseTools.cpp | 1 - .../Application/Tools/RiaSummaryTools.cpp | 45 ++++++++++++----- .../Application/Tools/RiaSummaryTools.h | 10 ++-- .../RicPlotProductionRateFeature.cpp | 12 +++-- ...wSummaryMultiPlotFromDataVectorFeature.cpp | 1 - ...RicNewSummaryPlotFromDataVectorFeature.cpp | 13 +---- .../RicSummaryPlotBuilder.cpp | 27 +++++++++- .../RicSummaryPlotBuilder.h | 1 + .../RicSelectPlotTemplateUi.cpp | 1 - .../RicSummaryPlotTemplateTools.cpp | 8 ++- .../Commands/RicCloseObservedDataFeature.cpp | 14 ++++-- .../Commands/RicCloseSummaryCaseFeature.cpp | 16 +++--- ...RicCloseSummaryCaseInCollectionFeature.cpp | 1 - .../RicConvertGroupToEnsembleFeature.cpp | 1 - .../Commands/RicDeleteSubItemsFeature.cpp | 27 ++++++++-- .../RicDeleteSummaryCaseCollectionFeature.cpp | 15 +++--- .../Commands/RicImportEnsembleFeature.cpp | 1 - .../Commands/RicImportSummaryCaseFeature.cpp | 1 - .../Commands/RicImportSummaryCasesFeature.cpp | 1 - .../Commands/RicImportSummaryGroupFeature.cpp | 1 - .../Commands/RicReloadSummaryCaseFeature.cpp | 12 +++-- .../Commands/RicReplaceCaseFeature.cpp | 12 +++-- .../Commands/RicReplaceSummaryCaseFeature.cpp | 42 +++++++++------- .../RicDuplicateSummaryCrossPlotFeature.h | 4 -- .../RicDuplicateSummaryPlotFeature.cpp | 8 +-- .../RicDuplicateSummaryPlotFeature.h | 4 -- .../RicEditSummaryCurveCalculationFeature.h | 4 -- .../RicNewDefaultSummaryPlotFeature.cpp | 49 +++---------------- .../RicNewDefaultSummaryPlotFeature.h | 4 +- .../RicNewDerivedEnsembleFeature.h | 4 -- .../RicNewEnsembleCurveFilterFeature.h | 4 -- .../RicNewGridTimeHistoryCurveFeature.cpp | 23 +++------ .../RicNewSummaryCrossPlotCurveFeature.cpp | 1 - .../RicNewSummaryCurveFeature.cpp | 1 - .../RicNewSummaryCurveFeature.h | 3 -- .../RicNewSummaryEnsembleCurveSetFeature.cpp | 13 +++-- .../RicOpenSummaryPlotEditorFeature.cpp | 7 ++- .../RicPasteAsciiDataToSummaryPlotFeature.cpp | 34 ++++--------- .../RicPasteAsciiDataToSummaryPlotFeature.h | 3 -- ...icPasteAsciiDataToSummaryPlotFeatureUi.cpp | 4 +- .../RicPasteAsciiDataToSummaryPlotFeatureUi.h | 2 +- .../RicPasteSummaryPlotFeature.cpp | 31 +----------- .../RicSelectSummaryPlotUI.cpp | 6 +-- .../RicSelectSummaryPlotUI.h | 1 - .../RicSummaryPlotEditorUi.cpp | 22 --------- .../RicSummaryPlotFeatureImpl.cpp | 48 ++++++++++-------- .../RicSummaryPlotFeatureImpl.h | 13 ++--- .../RimContextCommandBuilder.cpp | 15 ++---- .../RimMainPlotCollection.cpp | 39 ++++++++++----- .../ProjectDataModel/RimMainPlotCollection.h | 9 ++-- .../ProjectDataModel/RimProject.cpp | 5 -- .../ProjectDataModel/RimReloadCaseTools.cpp | 11 +++-- .../RimSummaryCalculation.cpp | 30 +++++++----- .../Summary/RimSummaryCase.cpp | 1 - .../Summary/RimSummaryCaseMainCollection.cpp | 4 +- .../Summary/RimSummaryCurve.cpp | 3 +- .../Summary/RimSummaryMultiPlotCollection.cpp | 30 ++++++++++++ .../Summary/RimSummaryMultiPlotCollection.h | 7 +++ .../Summary/RimSummaryPlot.cpp | 1 - .../Summary/RimSummaryPlotManager.cpp | 12 ++--- .../RimcSummaryPlotCollection.cpp | 11 ++--- .../UserInterface/RiuPlotMainWindow.cpp | 3 +- 63 files changed, 351 insertions(+), 387 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index f97813af96..3e373fa651 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -79,7 +79,6 @@ #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCrossPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RimTextAnnotation.h" #include "RimTextAnnotationInView.h" #include "RimViewLinker.h" diff --git a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp index 4059b437ba..92ecd9b282 100644 --- a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp @@ -53,7 +53,6 @@ #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RimWellLogRftCurve.h" #include "Riu3DMainWindowTools.h" diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp index 6614fce282..2c98c62b70 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp @@ -36,8 +36,9 @@ #include "RimSummaryCrossPlot.h" #include "RimSummaryCrossPlotCollection.h" #include "RimSummaryCurve.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "cafPdmObject.h" @@ -46,11 +47,11 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryPlotCollection* RiaSummaryTools::summaryPlotCollection() +RimSummaryMultiPlotCollection* RiaSummaryTools::summaryMultiPlotCollection() { RimProject* project = RimProject::current(); - return project->mainPlotCollection()->summaryPlotCollection(); + return project->mainPlotCollection()->summaryMultiPlotCollection(); } //-------------------------------------------------------------------------------------------------- @@ -79,18 +80,21 @@ RimSummaryCaseMainCollection* RiaSummaryTools::summaryCaseMainCollection() //-------------------------------------------------------------------------------------------------- void RiaSummaryTools::notifyCalculatedCurveNameHasChanged( int calculationId, const QString& currentCurveName ) { - RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); + RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); - for ( RimSummaryPlot* plot : summaryPlotColl->plots() ) + for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() ) { - for ( RimSummaryCurve* curve : plot->summaryCurves() ) + for ( RimSummaryPlot* plot : multiPlot->summaryPlots() ) { - RifEclipseSummaryAddress adr = curve->summaryAddressY(); - if ( adr.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED && adr.id() == calculationId ) + for ( RimSummaryCurve* curve : plot->summaryCurves() ) { - RifEclipseSummaryAddress updatedAdr = - RifEclipseSummaryAddress::calculatedAddress( currentCurveName.toStdString(), calculationId ); - curve->setSummaryAddressYAndApplyInterpolation( updatedAdr ); + RifEclipseSummaryAddress adr = curve->summaryAddressY(); + if ( adr.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED && adr.id() == calculationId ) + { + RifEclipseSummaryAddress updatedAdr = + RifEclipseSummaryAddress::calculatedAddress( currentCurveName.toStdString(), calculationId ); + curve->setSummaryAddressYAndApplyInterpolation( updatedAdr ); + } } } } @@ -119,9 +123,9 @@ RimSummaryPlot* RiaSummaryTools::parentSummaryPlot( caf::PdmObject* object ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryPlotCollection* RiaSummaryTools::parentSummaryPlotCollection( caf::PdmObject* object ) +RimSummaryMultiPlotCollection* RiaSummaryTools::parentSummaryPlotCollection( caf::PdmObject* object ) { - RimSummaryPlotCollection* summaryPlotColl = nullptr; + RimSummaryMultiPlotCollection* summaryPlotColl = nullptr; if ( object ) { @@ -131,6 +135,21 @@ RimSummaryPlotCollection* RiaSummaryTools::parentSummaryPlotCollection( caf::Pdm return summaryPlotColl; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot* RiaSummaryTools::parentSummaryMultiPlot( caf::PdmObject* object ) +{ + RimSummaryMultiPlot* multiPlot = nullptr; + + if ( object ) + { + object->firstAncestorOrThisOfType( multiPlot ); + } + + return multiPlot; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.h b/ApplicationLibCode/Application/Tools/RiaSummaryTools.h index 1b8fa4f175..a0aaea080f 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.h +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.h @@ -24,8 +24,9 @@ #include -class RimSummaryPlotCollection; class RimSummaryPlot; +class RimSummaryMultiPlot; +class RimSummaryMultiPlotCollection; class RimSummaryCrossPlot; class RimSummaryCrossPlotCollection; class RimSummaryCaseMainCollection; @@ -47,14 +48,15 @@ class PdmObject; class RiaSummaryTools { public: - static RimSummaryPlotCollection* summaryPlotCollection(); static RimSummaryCrossPlotCollection* summaryCrossPlotCollection(); static RimSummaryCaseMainCollection* summaryCaseMainCollection(); + static RimSummaryMultiPlotCollection* summaryMultiPlotCollection(); static void notifyCalculatedCurveNameHasChanged( int calculationId, const QString& currentCurveName ); - static RimSummaryPlot* parentSummaryPlot( caf::PdmObject* object ); - static RimSummaryPlotCollection* parentSummaryPlotCollection( caf::PdmObject* object ); + static RimSummaryPlot* parentSummaryPlot( caf::PdmObject* object ); + static RimSummaryMultiPlot* parentSummaryMultiPlot( caf::PdmObject* object ); + static RimSummaryMultiPlotCollection* parentSummaryPlotCollection( caf::PdmObject* object ); static RimSummaryCrossPlot* parentCrossPlot( caf::PdmObject* object ); static RimSummaryCrossPlotCollection* parentCrossPlotCollection( caf::PdmObject* object ); diff --git a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp index 1902028c74..aba7521954 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicPlotProductionRateFeature.cpp @@ -20,6 +20,8 @@ #include "RiaGuiApplication.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" + #include "RifEclipseSummaryAddress.h" #include "RifSummaryReaderInterface.h" @@ -37,8 +39,8 @@ #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveAppearanceCalculator.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindow.h" @@ -80,8 +82,6 @@ void RicPlotProductionRateFeature::onActionTriggered( bool isChecked ) project->activeOilField() ? project->activeOilField()->summaryCaseMainCollection() : nullptr; if ( !sumCaseColl ) return; - RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); - std::vector collection; caf::SelectionManager::instance()->objectsByType( &collection ); @@ -100,7 +100,9 @@ void RicPlotProductionRateFeature::onActionTriggered( bool isChecked ) } description += well->name(); - RimSummaryPlot* plot = summaryPlotColl->createNamedSummaryPlot( description ); + RimSummaryPlot* plot = new RimSummaryPlot(); + plot->setUiName( description ); + RimSummaryMultiPlot* multiPlot = RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( plot ); if ( RimSimWellInViewTools::isInjector( well ) ) { @@ -210,7 +212,7 @@ void RicPlotProductionRateFeature::onActionTriggered( bool isChecked ) } } - summaryPlotColl->updateConnectedEditors(); + multiPlot->updateConnectedEditors(); plot->loadDataAndUpdate(); summaryPlotToSelect = plot; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp index 24baa42c6b..52382ff43b 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp @@ -21,7 +21,6 @@ #include "RiaSummaryTools.h" #include "RimSummaryAddress.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RicSummaryPlotBuilder.h" diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp index fef0068066..3c1b52f5cf 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromDataVectorFeature.cpp @@ -21,7 +21,6 @@ #include "RiaSummaryTools.h" #include "RimSummaryAddress.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RicSummaryPlotBuilder.h" @@ -101,17 +100,7 @@ void RicNewSummaryPlotFromDataVectorFeature::onActionTriggered( bool isChecked ) } auto newPlot = RicSummaryPlotBuilder::createPlot( eclipseAddresses, selectedCases, selectedEnsembles ); - - auto plotCollection = RiaSummaryTools::summaryPlotCollection(); - newPlot->setAsPlotMdiWindow(); - - plotCollection->addPlot( newPlot ); - - newPlot->loadDataAndUpdate(); - - plotCollection->updateConnectedEditors(); - - RiuPlotMainWindowTools::selectAsCurrentItem( newPlot, true ); + RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( newPlot ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index bd251f33a2..d89ef70e77 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -41,7 +41,7 @@ #include "RimSummaryCurve.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryMultiPlotCollection.h" -#include "RimSummaryPlotCollection.h" +#include "RimSummaryPlot.h" #include "RiuPlotMainWindowTools.h" @@ -475,6 +475,31 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con return plotWindow; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( RimSummaryPlot* plot ) +{ + RimProject* project = RimProject::current(); + auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); + + auto* plotWindow = new RimSummaryMultiPlot(); + plotWindow->setColumnCount( RiaDefines::ColumnCount::COLUMNS_1 ); + plotWindow->setRowCount( RiaDefines::RowCount::ROWS_1 ); + plotWindow->setAsPlotMdiWindow(); + plotCollection->addSummaryMultiPlot( plotWindow ); + + appendPlotsToSummaryMultiPlot( plotWindow, { plot } ); + + plotCollection->updateAllRequiredEditors(); + plotWindow->loadDataAndUpdate(); + plotWindow->updateAllRequiredEditors(); + + RiuPlotMainWindowTools::selectAsCurrentItem( plot ); + + return plotWindow; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h index 2ab6669521..1793428cfe 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h @@ -79,6 +79,7 @@ class RicSummaryPlotBuilder createAndAppendDefaultSummaryMultiPlot( const std::vector& cases, const std::vector& ensembles ); + static RimSummaryMultiPlot* createAndAppendSingleSummaryMultiPlot( RimSummaryPlot* plot ); static RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vector& plots ); static RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vector& objects ); static void appendPlotsToSummaryMultiPlot( RimSummaryMultiPlot* multiPlot, const std::vector& plots ); diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp index d502ad93fb..5168a47983 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp @@ -27,7 +27,6 @@ #include "RimMainPlotCollection.h" #include "RimProject.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "cafPdmUiTreeSelectionEditor.h" diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index 42d26b4634..fece5ebd01 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -23,6 +23,7 @@ #include "RiaPreferences.h" #include "RiaSummaryAddressAnalyzer.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RicSelectPlotTemplateUi.h" #include "RifSummaryReaderInterface.h" @@ -38,7 +39,6 @@ #include "RimSummaryCurve.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindow.h" @@ -230,9 +230,7 @@ void RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection( if ( selectedSummaryCases.empty() && selectedEnsembles.empty() ) return; - RimSummaryPlotCollection* plotColl = RimProject::current()->mainPlotCollection()->summaryPlotCollection(); - - plotColl->addPlot( summaryPlot ); + RimSummaryMultiPlot* multiPlot = RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( summaryPlot ); summaryPlot->resolveReferencesRecursively(); summaryPlot->initAfterReadRecursively(); @@ -355,7 +353,7 @@ void RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection( } } - plotColl->updateConnectedEditors(); + multiPlot->updateConnectedEditors(); summaryPlot->loadDataAndUpdate(); } diff --git a/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp b/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp index 93be515e67..0b0f0da643 100644 --- a/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseObservedDataFeature.cpp @@ -26,8 +26,9 @@ #include "RimObservedSummaryData.h" #include "RimProject.h" #include "RimRftPlotCollection.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RimWellRftPlot.h" #include "cafSelectionManager.h" @@ -52,15 +53,18 @@ void RicCloseObservedDataFeature::setupActionLook( QAction* actionToSetup ) //-------------------------------------------------------------------------------------------------- void RicCloseObservedDataFeature::deleteObservedSummaryData( const std::vector& data ) { - RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); + RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); for ( RimObservedSummaryData* observedData : data ) { - for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() ) + for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() ) { - summaryPlot->deleteCurvesAssosiatedWithCase( observedData ); + for ( RimSummaryPlot* summaryPlot : multiPlot->summaryPlots() ) + { + summaryPlot->deleteCurvesAssosiatedWithCase( observedData ); + } + multiPlot->updateConnectedEditors(); } - summaryPlotColl->updateConnectedEditors(); RimObservedDataCollection* observedDataCollection = nullptr; observedData->firstAncestorOrThisOfTypeAsserted( observedDataCollection ); diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp index eb8b8c3a17..e36249b35e 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp @@ -25,8 +25,9 @@ #include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCaseMainCollection.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindow.h" @@ -54,16 +55,19 @@ void RicCloseSummaryCaseFeature::setupActionLook( QAction* actionToSetup ) //-------------------------------------------------------------------------------------------------- void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector& cases ) { - RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); - RimSummaryCaseMainCollection* summaryCaseMainCollection = RiaSummaryTools::summaryCaseMainCollection(); + RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); + RimSummaryCaseMainCollection* summaryCaseMainCollection = RiaSummaryTools::summaryCaseMainCollection(); for ( RimSummaryCase* summaryCase : cases ) { - for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() ) + for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() ) { - summaryPlot->deleteCurvesAssosiatedWithCase( summaryCase ); + for ( RimSummaryPlot* summaryPlot : multiPlot->summaryPlots() ) + { + summaryPlot->deleteCurvesAssosiatedWithCase( summaryCase ); + } + multiPlot->updateConnectedEditors(); } - summaryPlotColl->updateConnectedEditors(); summaryCaseMainCollection->removeCase( summaryCase ); } diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp b/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp index 8a687c126e..c8b32cccb4 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp @@ -29,7 +29,6 @@ #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindow.h" diff --git a/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.cpp b/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.cpp index 2b43fa84c4..7e2a619e77 100644 --- a/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.cpp +++ b/ApplicationLibCode/Commands/RicConvertGroupToEnsembleFeature.cpp @@ -32,7 +32,6 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" -#include "RimSummaryPlotCollection.h" #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" diff --git a/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp b/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp index 46a35c26f8..6784144212 100644 --- a/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp +++ b/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp @@ -19,7 +19,8 @@ #include "RicDeleteSubItemsFeature.h" #include "RimProject.h" -#include "RimSummaryPlotCollection.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimWellPathCollection.h" #include "RimWellPathFractureCollection.h" @@ -63,7 +64,17 @@ void RicDeleteSubItemsFeature::onActionTriggered( bool isChecked ) if ( !RicDeleteSubItemsFeature::hasDeletableSubItems( item ) ) continue; { - auto collection = dynamic_cast( item ); + auto multiPlot = dynamic_cast( item ); + if ( multiPlot ) + { + multiPlot->deleteAllPlots(); + + multiPlot->updateConnectedEditors(); + } + } + + { + auto collection = dynamic_cast( item ); if ( collection ) { collection->deleteAllPlots(); @@ -115,8 +126,16 @@ void RicDeleteSubItemsFeature::setupActionLook( QAction* actionToSetup ) bool RicDeleteSubItemsFeature::hasDeletableSubItems( caf::PdmUiItem* uiItem ) { { - auto collection = dynamic_cast( uiItem ); - if ( collection && !collection->plots().empty() ) + auto multiPlot = dynamic_cast( uiItem ); + if ( multiPlot && !multiPlot->summaryPlots().empty() ) + { + return true; + } + } + + { + auto collection = dynamic_cast( uiItem ); + if ( collection && !collection->multiPlots().empty() ) { return true; } diff --git a/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp b/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp index b7af5220a8..54af08a059 100644 --- a/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicDeleteSummaryCaseCollectionFeature.cpp @@ -26,8 +26,9 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "cafPdmObject.h" #include "cafSelectionManager.h" @@ -44,17 +45,19 @@ CAF_CMD_SOURCE_INIT( RicDeleteSummaryCaseCollectionFeature, "RicDeleteSummaryCas //-------------------------------------------------------------------------------------------------- void RicDeleteSummaryCaseCollectionFeature::deleteSummaryCaseCollection( RimSummaryCaseCollection* caseCollection ) { - RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); + RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); for ( RimSummaryCase* summaryCase : caseCollection->allSummaryCases() ) { - for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() ) + for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() ) { - summaryPlot->deleteCurvesAssosiatedWithCase( summaryCase ); + for ( RimSummaryPlot* summaryPlot : multiPlot->summaryPlots() ) + { + summaryPlot->deleteCurvesAssosiatedWithCase( summaryCase ); + } + multiPlot->updateConnectedEditors(); } } - - summaryPlotColl->updateConnectedEditors(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp index 96a0433e7d..820bfc4d4b 100644 --- a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp @@ -39,7 +39,6 @@ #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" diff --git a/ApplicationLibCode/Commands/RicImportSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryCaseFeature.cpp index 4aebc136b4..d43a020b53 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryCaseFeature.cpp @@ -27,7 +27,6 @@ #include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCaseMainCollection.h" -#include "RimSummaryPlotCollection.h" #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" diff --git a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp index d0d94415a6..301dccc655 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp @@ -38,7 +38,6 @@ #include "RimSummaryCaseMainCollection.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" diff --git a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp index d6aa90fa91..98b2a4bc66 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp @@ -32,7 +32,6 @@ #include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCaseMainCollection.h" -#include "RimSummaryPlotCollection.h" #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" diff --git a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp index 0bdf03d494..4e9b22e805 100644 --- a/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicReloadSummaryCaseFeature.cpp @@ -29,8 +29,9 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "cafPdmObject.h" #include "cafSelectionManager.h" @@ -54,7 +55,7 @@ bool RicReloadSummaryCaseFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicReloadSummaryCaseFeature::onActionTriggered( bool isChecked ) { - RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); + RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); std::vector caseSelection = selectedSummaryCases(); for ( RimSummaryCase* summaryCase : caseSelection ) @@ -68,9 +69,12 @@ void RicReloadSummaryCaseFeature::onActionTriggered( bool isChecked ) RiaLogging::info( QString( "Reloaded data for %1" ).arg( summaryCase->summaryHeaderFilename() ) ); } - for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() ) + for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() ) { - summaryPlot->loadDataAndUpdate(); + for ( RimSummaryPlot* summaryPlot : multiPlot->summaryPlots() ) + { + summaryPlot->loadDataAndUpdate(); + } } } diff --git a/ApplicationLibCode/Commands/RicReplaceCaseFeature.cpp b/ApplicationLibCode/Commands/RicReplaceCaseFeature.cpp index 3fe367eb48..1fb74c865c 100644 --- a/ApplicationLibCode/Commands/RicReplaceCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicReplaceCaseFeature.cpp @@ -30,8 +30,9 @@ #include "RimReloadCaseTools.h" #include "RimSummaryCase.h" #include "RimSummaryCaseMainCollection.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RimTimeStepFilter.h" #include "Riu3dSelectionManager.h" @@ -110,10 +111,13 @@ void RicReplaceCaseFeature::onActionTriggered( bool isChecked ) gridSummaryCase->createSummaryReaderInterface(); gridSummaryCase->createRftReaderInterface(); - RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); - for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() ) + RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); + for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() ) { - summaryPlot->loadDataAndUpdate(); + for ( RimSummaryPlot* summaryPlot : multiPlot->summaryPlots() ) + { + summaryPlot->loadDataAndUpdate(); + } } } } diff --git a/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp index 6acb769081..05608306a3 100644 --- a/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp @@ -36,8 +36,9 @@ #include "RimSummaryCrossPlot.h" #include "RimSummaryCrossPlotCollection.h" #include "RimSummaryCurve.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "cafPdmObject.h" #include "cafSelectionManager.h" @@ -110,31 +111,34 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked ) } } - RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); - for ( RimSummaryPlot* summaryPlot : summaryPlotColl->plots() ) + RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); + for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() ) { - // Update summary curves on calculated data - std::vector summaryCurves = summaryPlot->summaryCurves(); - for ( RimSummaryCurve* summaryCurve : summaryCurves ) + for ( RimSummaryPlot* summaryPlot : multiPlot->summaryPlots() ) { - RifEclipseSummaryAddress summaryAddressY = summaryCurve->summaryAddressY(); - if ( summaryAddressY.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED && - ids.find( summaryAddressY.id() ) != ids.end() ) + // Update summary curves on calculated data + std::vector summaryCurves = summaryPlot->summaryCurves(); + for ( RimSummaryCurve* summaryCurve : summaryCurves ) { - if ( calcColl ) + RifEclipseSummaryAddress summaryAddressY = summaryCurve->summaryAddressY(); + if ( summaryAddressY.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED && + ids.find( summaryAddressY.id() ) != ids.end() ) { - RimSummaryCalculation* calculation = calcColl->findCalculationById( summaryAddressY.id() ); - QString description = calculation->description(); - - RifEclipseSummaryAddress updatedAdr = - RifEclipseSummaryAddress::calculatedAddress( description.toStdString(), calculation->id() ); - summaryCurve->setSummaryAddressYAndApplyInterpolation( updatedAdr ); - summaryCurve->loadDataAndUpdate( true ); + if ( calcColl ) + { + RimSummaryCalculation* calculation = calcColl->findCalculationById( summaryAddressY.id() ); + QString description = calculation->description(); + + RifEclipseSummaryAddress updatedAdr = + RifEclipseSummaryAddress::calculatedAddress( description.toStdString(), calculation->id() ); + summaryCurve->setSummaryAddressYAndApplyInterpolation( updatedAdr ); + summaryCurve->loadDataAndUpdate( true ); + } } } - } - summaryPlot->loadDataAndUpdate(); + summaryPlot->loadDataAndUpdate(); + } } RimSummaryCrossPlotCollection* summaryCrossPlotColl = RiaSummaryTools::summaryCrossPlotCollection(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotFeature.h index f88da1c033..334819020c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryCrossPlotFeature.h @@ -20,10 +20,6 @@ #include "cafCmdFeature.h" -class RimSummaryPlotCollection; -class RimSummaryCase; -class RimSummaryPlot; - //================================================================================================== /// //================================================================================================== diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.cpp index 12a31ba8dd..8d52433dfd 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.cpp @@ -22,8 +22,8 @@ #include "RicPasteSummaryPlotFeature.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "cafSelectionManagerTools.h" #include "cvfAssert.h" @@ -37,15 +37,15 @@ CAF_CMD_SOURCE_INIT( RicDuplicateSummaryPlotFeature, "RicDuplicateSummaryPlotFea //-------------------------------------------------------------------------------------------------- bool RicDuplicateSummaryPlotFeature::isCommandEnabled() { - RimSummaryPlotCollection* sumPlotColl = nullptr; + RimSummaryMultiPlot* multiPlot = nullptr; caf::PdmObject* selObj = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); if ( selObj ) { - sumPlotColl = RiaSummaryTools::parentSummaryPlotCollection( selObj ); + multiPlot = RiaSummaryTools::parentSummaryMultiPlot( selObj ); } - if ( sumPlotColl ) return true; + if ( multiPlot ) return true; return false; } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.h index 2ca3411b64..4bd16223ba 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicDuplicateSummaryPlotFeature.h @@ -20,10 +20,6 @@ #include "cafCmdFeature.h" -class RimSummaryPlotCollection; -class RimSummaryCase; -class RimSummaryPlot; - //================================================================================================== /// //================================================================================================== diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.h index af597d66bb..61c61dab3a 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.h @@ -20,10 +20,6 @@ #include "cafCmdFeature.h" -class RimSummaryPlot; -class RimSummaryPlotCollection; -class RimSummaryCase; - //================================================================================================== /// //================================================================================================== diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp index f759e2f163..ae7509c5d7 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.cpp @@ -39,7 +39,6 @@ #include "RimSummaryCaseMainCollection.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindow.h" #include "RiuPlotMainWindowTools.h" @@ -68,48 +67,15 @@ void extractPlotObjectsFromSelection( std::vector* se { return; } - - RimSummaryPlotCollection* sumPlotColl = - caf::SelectionManager::instance()->selectedItemAncestorOfType(); - - if ( sumPlotColl ) - { - RimSummaryCase* firstIndividualSummaryCase = nullptr; - RimSummaryCaseCollection* firstEnsemble = nullptr; - - auto sumCaseVector = RimProject::current()->allSummaryCases(); - for ( RimSummaryCase* summaryCase : sumCaseVector ) - { - RimSummaryCaseCollection* parentEnsemble = nullptr; - summaryCase->firstAncestorOrThisOfType( parentEnsemble ); - if ( !parentEnsemble && !firstIndividualSummaryCase ) - { - firstIndividualSummaryCase = summaryCase; - break; - } - else if ( parentEnsemble && !firstEnsemble ) - { - firstEnsemble = parentEnsemble; - } - } - if ( firstIndividualSummaryCase ) - { - selectedIndividualSummaryCases->push_back( firstIndividualSummaryCase ); - } - else if ( firstEnsemble ) - { - selectedEnsembles->push_back( firstEnsemble ); - } - } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryPlot* RicNewDefaultSummaryPlotFeature::createFromSummaryCases( RimSummaryPlotCollection* plotCollection, - const std::vector& summaryCases ) +RimSummaryPlot* RicNewDefaultSummaryPlotFeature::createFromSummaryCases( const std::vector& summaryCases ) { - RimSummaryPlot* newPlot = plotCollection->createSummaryPlotWithAutoTitle(); + RimSummaryPlot* newPlot = new RimSummaryPlot(); + newPlot->enableAutoPlotTitle( true ); for ( RimSummaryCase* sumCase : summaryCases ) { @@ -119,10 +85,8 @@ RimSummaryPlot* RicNewDefaultSummaryPlotFeature::createFromSummaryCases( RimSumm newPlot->applyDefaultCurveAppearances(); newPlot->loadDataAndUpdate(); - plotCollection->updateConnectedEditors(); + RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( newPlot ); - RiuPlotMainWindowTools::setExpanded( newPlot ); - RiuPlotMainWindowTools::selectAsCurrentItem( newPlot ); return newPlot; } @@ -154,6 +118,8 @@ bool RicNewDefaultSummaryPlotFeature::isCommandEnabled() if ( customObjFuncCollection || curveFilter ) return false; return !( selectedIndividualSummaryCases.empty() && selectedEnsembles.empty() ); + + return false; } //-------------------------------------------------------------------------------------------------- @@ -177,8 +143,7 @@ void RicNewDefaultSummaryPlotFeature::onActionTriggered( bool isChecked ) if ( !selectedIndividualSummaryCases.empty() ) { - RimSummaryPlotCollection* sumPlotColl = RimProject::current()->mainPlotCollection()->summaryPlotCollection(); - createFromSummaryCases( sumPlotColl, selectedIndividualSummaryCases ); + createFromSummaryCases( selectedIndividualSummaryCases ); } else { diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.h index 9c49add0a5..5dba90a717 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDefaultSummaryPlotFeature.h @@ -22,7 +22,6 @@ #include "cafCmdFeature.h" -class RimSummaryPlotCollection; class RimSummaryCase; class RimSummaryPlot; @@ -34,8 +33,7 @@ class RicNewDefaultSummaryPlotFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; public: - static RimSummaryPlot* createFromSummaryCases( RimSummaryPlotCollection* plotCollection, - const std::vector& summaryCases ); + static RimSummaryPlot* createFromSummaryCases( const std::vector& summaryCases ); protected: bool isCommandEnabled() override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.h index eae29c8dc7..b56f98c1ef 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewDerivedEnsembleFeature.h @@ -20,10 +20,6 @@ #include "cafCmdFeature.h" -class RimSummaryPlotCollection; -class RimSummaryCase; -class RimSummaryPlot; - //================================================================================================== /// //================================================================================================== diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.h index 2984bcde8e..438d9d8858 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.h @@ -20,10 +20,6 @@ #include "cafCmdFeature.h" -class RimSummaryPlotCollection; -class RimSummaryCase; -class RimSummaryPlot; - //================================================================================================== /// //================================================================================================== diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp index db6d312261..4529a9620a 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewGridTimeHistoryCurveFeature.cpp @@ -23,6 +23,7 @@ #include "RigFemResultAddress.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RicNewSummaryCurveFeature.h" #include "RicSelectSummaryPlotUI.h" #include "RicWellLogTools.h" @@ -35,8 +36,9 @@ #include "RimGeoMechView.h" #include "RimGridTimeHistoryCurve.h" #include "RimProject.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "Riu3dSelectionManager.h" #include "RiuPlotMainWindowTools.h" @@ -86,7 +88,7 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot() const QString lastUsedSummaryPlotKey( "lastUsedSummaryPlotKey" ); - RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); + RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); RimSummaryPlot* defaultSelectedPlot = nullptr; { @@ -97,16 +99,6 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot() { defaultSelectedPlot = lastUsedPlot; } - - if ( !defaultSelectedPlot ) - { - defaultSelectedPlot = dynamic_cast( app->activePlotWindow() ); - } - - if ( !defaultSelectedPlot && !summaryPlotColl->plots().empty() ) - { - defaultSelectedPlot = summaryPlotColl->plots().front(); - } } RicSelectSummaryPlotUI featureUi; @@ -126,10 +118,9 @@ RimSummaryPlot* RicNewGridTimeHistoryCurveFeature::userSelectedSummaryPlot() RimSummaryPlot* summaryPlot = nullptr; if ( featureUi.isCreateNewPlotChecked() ) { - RimSummaryPlot* plot = summaryPlotColl->createNamedSummaryPlot( featureUi.newPlotName() ); - - summaryPlotColl->updateConnectedEditors(); - + RimSummaryPlot* plot = new RimSummaryPlot(); + plot->setUiName( featureUi.newPlotName() ); + RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( plot ); plot->loadDataAndUpdate(); summaryPlot = plot; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp index b4c7f2f0a3..70e3385ea6 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp @@ -28,7 +28,6 @@ #include "RimSummaryCrossPlot.h" #include "RimSummaryCrossPlotCollection.h" #include "RimSummaryCurve.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindow.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp index 234422fa28..c03c8c1786 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp @@ -31,7 +31,6 @@ #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindow.h" diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.h index 8286a2f564..12c401b901 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.h @@ -23,9 +23,6 @@ #include class RimSummaryPlot; -class RimSummaryCase; -class RimSummaryCurve; -class RimSummaryPlotCollection; //================================================================================================== /// diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp index 0441c678a7..cc1ac22e64 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp @@ -21,9 +21,9 @@ #include "RiaColorTables.h" #include "RiaGuiApplication.h" #include "RiaPreferencesSummary.h" +#include "RiaSummaryTools.h" #include "RiaTextStringTools.h" -#include "RiaSummaryTools.h" #include "RimEnsembleCurveFilter.h" #include "RimEnsembleCurveFilterCollection.h" #include "RimEnsembleCurveSet.h" @@ -34,11 +34,13 @@ #include "RimProject.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCurve.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindow.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "WellLogCommands/RicWellLogPlotCurveFeatureImpl.h" #include "cafSelectionManager.h" @@ -109,8 +111,9 @@ RimSummaryPlot* if ( prefs->defaultSummaryCurvesTextFilter().isEmpty() ) return nullptr; - RimSummaryPlotCollection* summaryPlotCollection = proj->mainPlotCollection->summaryPlotCollection(); - RimSummaryPlot* plot = summaryPlotCollection->createSummaryPlotWithAutoTitle(); + RimSummaryPlot* plot = new RimSummaryPlot(); + plot->enableAutoPlotTitle( true ); + RimSummaryMultiPlot* multiPlot = RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( plot ); RimEnsembleCurveSet* firstCurveSetCreated = nullptr; for ( RimSummaryCaseCollection* ensemble : ensembles ) @@ -121,7 +124,7 @@ RimSummaryPlot* } plot->loadDataAndUpdate(); - summaryPlotCollection->updateConnectedEditors(); + multiPlot->updateConnectedEditors(); RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow(); if ( mainPlotWindow ) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp index 770ab6d326..09e9d31ec5 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp @@ -35,7 +35,6 @@ #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindow.h" @@ -51,13 +50,13 @@ CAF_CMD_SOURCE_INIT( RicOpenSummaryPlotEditorFeature, "RicOpenSummaryPlotEditorF //-------------------------------------------------------------------------------------------------- bool RicOpenSummaryPlotEditorFeature::isCommandEnabled() { - RimSummaryPlotCollection* sumPlotColl = nullptr; + RimSummaryMultiPlot* multiPlot = nullptr; RimCustomObjectiveFunctionCollection* customObjFuncCollection = nullptr; caf::PdmObject* selObj = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); if ( selObj ) { - sumPlotColl = RiaSummaryTools::parentSummaryPlotCollection( selObj ); + multiPlot = RiaSummaryTools::parentSummaryMultiPlot( selObj ); selObj->firstAncestorOrThisOfType( customObjFuncCollection ); } @@ -66,7 +65,7 @@ bool RicOpenSummaryPlotEditorFeature::isCommandEnabled() auto legendConfig = dynamic_cast( selObj ); if ( ensembleFilter || ensembleFilterColl || legendConfig || customObjFuncCollection ) return false; - if ( sumPlotColl ) return true; + if ( multiPlot ) return true; // Multiple case selections std::vector selectedItems = caf::selectedObjectsByTypeStrict(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp index 8ff7cadccd..c3e547a329 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.cpp @@ -19,14 +19,15 @@ #include "RicPasteAsciiDataToSummaryPlotFeature.h" #include "OperationsUsingObjReferences/RicPasteFeatureImpl.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RicPasteAsciiDataToSummaryPlotFeatureUi.h" #include "RiaLogging.h" #include "RimAsciiDataCurve.h" #include "RimSummaryCurveAppearanceCalculator.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "cafPdmDefaultObjectFactory.h" #include "cafPdmDocument.h" @@ -55,9 +56,9 @@ bool RicPasteAsciiDataToSummaryPlotFeature::isCommandEnabled() if ( !destinationObject ) return false; - RimSummaryPlotCollection* summaryPlotCollection = nullptr; - destinationObject->firstAncestorOrThisOfType( summaryPlotCollection ); - if ( !summaryPlotCollection ) + RimSummaryMultiPlot* multiPlot = nullptr; + destinationObject->firstAncestorOrThisOfType( multiPlot ); + if ( !multiPlot ) { return false; } @@ -79,7 +80,7 @@ void RicPasteAsciiDataToSummaryPlotFeature::onActionTriggered( bool isChecked ) RicPasteAsciiDataToSummaryPlotFeatureUi pasteOptions; caf::PdmSettings::readFieldsFromApplicationStore( &pasteOptions, pasteOptions.contextString() ); - if ( !summaryPlot ) pasteOptions.createNewPlot(); + if ( !summaryPlot ) pasteOptions.setCreateNewPlot(); pasteOptions.setUiModePasteText( text ); caf::PdmUiPropertyViewDialog propertyDialog( nullptr, &pasteOptions, "Set Paste Options", "" ); @@ -91,14 +92,10 @@ void RicPasteAsciiDataToSummaryPlotFeature::onActionTriggered( bool isChecked ) { if ( !summaryPlot ) { - RimSummaryPlotCollection* summaryPlotCollection = nullptr; - destinationObject->firstAncestorOrThisOfType( summaryPlotCollection ); - if ( !summaryPlotCollection ) - { - return; - } - summaryPlot = createSummaryPlotAndAddToPlotCollection( summaryPlotCollection ); - summaryPlotCollection->updateConnectedEditors(); + summaryPlot = new RimSummaryPlot(); + summaryPlot->enableAutoPlotTitle( true ); + + RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( summaryPlot ); } caf::PdmSettings::writeFieldsToApplicationStore( &pasteOptions, pasteOptions.contextString() ); @@ -249,14 +246,3 @@ RicPasteAsciiDataToSummaryPlotFeature::CurveType } return CURVE_UNKNOWN; } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryPlot* - RicPasteAsciiDataToSummaryPlotFeature::createSummaryPlotAndAddToPlotCollection( RimSummaryPlotCollection* plotCollection ) -{ - QString name = QString( "Summary Plot %1" ).arg( plotCollection->plots().size() + 1 ); - - return plotCollection->createNamedSummaryPlot( name ); -} diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h index ce8c0971e3..afe2c11589 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeature.h @@ -26,7 +26,6 @@ class RimSummaryCurve; class RimAsciiDataCurve; class RicPasteAsciiDataToSummaryPlotFeatureUi; -class RimSummaryPlotCollection; class RimSummaryPlot; //================================================================================================== @@ -58,6 +57,4 @@ class RicPasteAsciiDataToSummaryPlotFeature : public caf::CmdFeature const RicPasteAsciiDataToSummaryPlotFeatureUi& settings ); static CurveType guessCurveType( const QString& curveName ); - - static RimSummaryPlot* createSummaryPlotAndAddToPlotCollection( RimSummaryPlotCollection* plotCollection ); }; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp index 4e8f99f65f..a3754cce45 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp @@ -316,7 +316,7 @@ const AsciiDataParseOptions RicPasteAsciiDataToSummaryPlotFeatureUi::parseOption //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicPasteAsciiDataToSummaryPlotFeatureUi::createNewPlot() +void RicPasteAsciiDataToSummaryPlotFeatureUi::setCreateNewPlot() { m_createNewPlot = true; } @@ -558,4 +558,4 @@ void RicPasteAsciiDataToSummaryPlotFeatureUi::updatePreviewTextAndDateFormat() QString RicPasteAsciiDataToSummaryPlotFeatureUi::contextString() const { return QString( "AsciiDataToSummarySettings" ); -} \ No newline at end of file +} diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h index 090b7332a5..ebdcbff9e7 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h @@ -129,7 +129,7 @@ class RicPasteAsciiDataToSummaryPlotFeatureUi : public caf::PdmObject UiMode uiModeImport() const; const AsciiDataParseOptions parseOptions() const; - void createNewPlot(); + void setCreateNewPlot(); QString contextString() const; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp index 887795911c..42d044e090 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryPlotFeature.cpp @@ -23,7 +23,6 @@ #include "RimMultiPlot.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindowTools.h" @@ -56,27 +55,6 @@ void RicPasteSummaryPlotFeature::copyPlotAndAddToCollection( RimSummaryPlot* sou return; } - - RimSummaryPlotCollection* plotColl = caf::firstAncestorOfTypeFromSelectedObject(); - if ( plotColl ) - { - RimSummaryPlot* newSummaryPlot = dynamic_cast( - sourcePlot->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); - CVF_ASSERT( newSummaryPlot ); - - plotColl->addPlot( newSummaryPlot ); - - // Resolve references after object has been inserted into the data model - newSummaryPlot->resolveReferencesRecursively(); - newSummaryPlot->initAfterReadRecursively(); - - QString nameOfCopy = QString( "Copy of " ) + newSummaryPlot->description(); - newSummaryPlot->setDescription( nameOfCopy ); - - plotColl->updateConnectedEditors(); - - newSummaryPlot->loadDataAndUpdate(); - } } //-------------------------------------------------------------------------------------------------- @@ -90,14 +68,7 @@ bool RicPasteSummaryPlotFeature::isCommandEnabled() if ( !destinationObject ) return false; auto multiPlot = caf::firstAncestorOfTypeFromSelectedObject(); - if ( multiPlot ) return true; - - RimSummaryPlotCollection* plotColl = nullptr; - destinationObject->firstAncestorOrThisOfType( plotColl ); - if ( !plotColl ) - { - return false; - } + if ( !multiPlot ) return false; return RicPasteSummaryPlotFeature::summaryPlots().size() > 0; } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp index 7b357d924f..cfbf69aa39 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp @@ -24,8 +24,8 @@ #include "RimEclipseView.h" #include "RimMainPlotCollection.h" #include "RimProject.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" CAF_PDM_SOURCE_INIT( RicSelectSummaryPlotUI, "RicSelectSummaryPlotUI" ); @@ -91,7 +91,7 @@ QList if ( fieldNeedingOptions == &m_selectedSummaryPlot ) { - RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); + RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); summaryPlotColl->summaryPlotItemInfos( &options ); } @@ -104,7 +104,7 @@ QList //-------------------------------------------------------------------------------------------------- void RicSelectSummaryPlotUI::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - if ( RiaSummaryTools::summaryPlotCollection()->plots().empty() ) + if ( RiaSummaryTools::summaryMultiPlotCollection()->multiPlots().empty() ) { m_createNewPlot = true; } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.h index 1c42739f45..441b983c11 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.h @@ -23,7 +23,6 @@ #include "cafPdmPtrField.h" class RimSummaryPlot; -class RimSummaryPlotCollection; //================================================================================================== /// diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index 34fffe857f..eba17f33f3 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -23,7 +23,6 @@ #include "RiaGuiApplication.h" #include "RiaSummaryCurveDefinition.h" -#include "RicSelectSummaryPlotUI.h" #include "RiuSummaryCurveDefinitionKeywords.h" #include "RimDerivedEnsembleCaseCollection.h" @@ -44,7 +43,6 @@ #include "RimSummaryCurveCollection.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuPlotMainWindow.h" #include "RiuPlotMainWindowTools.h" @@ -276,16 +274,6 @@ QList { m_plotContainer->summaryPlotItemInfos( &options ); } - else - { - RimProject* proj = RimProject::current(); - - RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection(); - if ( summaryPlotColl ) - { - summaryPlotColl->summaryPlotItemInfos( &options ); - } - } } return options; @@ -853,8 +841,6 @@ void RicSummaryPlotEditorUi::createNewPlot() RimSummaryPlot* newSummaryPlot = nullptr; - RimSummaryPlotCollection* summaryPlotColl = proj->mainPlotCollection()->summaryPlotCollection(); - if ( m_plotContainer ) { newSummaryPlot = new RimSummaryPlot(); @@ -862,10 +848,6 @@ void RicSummaryPlotEditorUi::createNewPlot() newSummaryPlot->enableAutoPlotTitle( true ); m_plotContainer->addPlot( newSummaryPlot ); } - else if ( summaryPlotColl ) - { - newSummaryPlot = summaryPlotColl->createSummaryPlotWithAutoTitle(); - } if ( newSummaryPlot ) { @@ -875,10 +857,6 @@ void RicSummaryPlotEditorUi::createNewPlot() { m_plotContainer->updateConnectedEditors(); } - else if ( summaryPlotColl ) - { - summaryPlotColl->updateConnectedEditors(); - } m_targetPlot = newSummaryPlot; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index 8e5cdd0da7..f2bb9e18db 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -29,6 +29,7 @@ #include "RiaSummaryStringTools.h" #include "RiaTextStringTools.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RicCreateSummaryCaseCollectionFeature.h" #include "RicImportGeneralDataFeature.h" #include "RicImportSummaryCasesFeature.h" @@ -53,7 +54,6 @@ #include "RimSummaryCurve.h" #include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" @@ -297,8 +297,6 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin RimSummaryPlot* lastPlotCreated = nullptr; - RimSummaryPlotCollection* sumPlotColl = RimProject::current()->mainPlotCollection()->summaryPlotCollection(); - RiaSummaryStringTools::splitAddressFiltersInGridAndSummary( summaryCasesToUse[0], allCurveAddressFilters, &summaryAddressFilters, @@ -318,8 +316,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin RimSummaryPlot* newPlot = nullptr; if ( ensemble ) { - newPlot = createSummaryPlotForEnsemble( sumPlotColl, - summaryCasesToUse, + newPlot = createSummaryPlotForEnsemble( summaryCasesToUse, ensemble, summaryAddressFilters, addHistoryCurves, @@ -328,8 +325,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin } else { - newPlot = - createSummaryPlotForCases( sumPlotColl, summaryCasesToUse, summaryAddressFilters, addHistoryCurves ); + newPlot = createSummaryPlotForCases( summaryCasesToUse, summaryAddressFilters, addHistoryCurves ); } lastPlotCreated = newPlot; @@ -337,12 +333,13 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin newPlot->setLegendsVisible( !hideLegend ); newPlot->setNormalizationEnabled( isNormalizedY ); newPlot->loadDataAndUpdate(); + + RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( newPlot ); } - else // Multiplot, one for each separate summary address + else // Multiple plots, one for each separate summary address, put them all in a summary multiplot { std::vector summaryPlots = - createMultipleSummaryPlotsFromAddresses( sumPlotColl, - summaryCasesToUse, + createMultipleSummaryPlotsFromAddresses( summaryCasesToUse, ensemble, summaryAddressFilters, addHistoryCurves, @@ -357,6 +354,8 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin summaryPlot->setNormalizationEnabled( isNormalizedY ); summaryPlot->loadDataAndUpdate(); } + + RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( summaryPlots ); } } @@ -412,7 +411,9 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin if ( createdCurves.size() ) { - RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle(); + RimSummaryPlot* newPlot = new RimSummaryPlot(); + newPlot->enableAutoPlotTitle( true ); + for ( auto curve : createdCurves ) { newPlot->addGridTimeHistoryCurve( curve ); @@ -422,6 +423,8 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin newPlot->setNormalizationEnabled( isNormalizedY ); newPlot->loadDataAndUpdate(); lastPlotCreated = newPlot; + + RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( newPlot ); } } else // Multiplot @@ -465,7 +468,8 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin if ( createdCurves.size() ) { - RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle(); + RimSummaryPlot* newPlot = new RimSummaryPlot(); + newPlot->enableAutoPlotTitle( true ); for ( auto newCurve : createdCurves ) { newPlot->addGridTimeHistoryCurve( newCurve ); @@ -474,6 +478,8 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin newPlot->setNormalizationEnabled( isNormalizedY ); newPlot->loadDataAndUpdate(); lastPlotCreated = newPlot; + + RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( newPlot ); } } } @@ -482,7 +488,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin if ( lastPlotCreated ) { - sumPlotColl->updateConnectedEditors(); + RimProject::current()->mainPlotCollection()->summaryMultiPlotCollection()->updateConnectedEditors(); RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); // Needed to avoid unnecessary activation of sub windows (plots) @@ -503,15 +509,15 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin } } -RimSummaryPlot* RicSummaryPlotFeatureImpl::createSummaryPlotForEnsemble( RimSummaryPlotCollection* sumPlotColl, - const std::vector& summaryCasesToUse, +RimSummaryPlot* RicSummaryPlotFeatureImpl::createSummaryPlotForEnsemble( const std::vector& summaryCasesToUse, RimSummaryCaseCollection* ensemble, QStringList summaryAddressFilters, bool addHistoryCurves, EnsembleColoringType ensembleColoringStyle, QString ensembleColoringParameter ) { - RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle(); + RimSummaryPlot* newPlot = new RimSummaryPlot(); + newPlot->enableAutoPlotTitle( true ); if ( ensemble ) { @@ -567,12 +573,12 @@ RimEnsembleCurveSet* RicSummaryPlotFeatureImpl::createCurveSet( RimSummaryCaseCo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryPlot* RicSummaryPlotFeatureImpl::createSummaryPlotForCases( RimSummaryPlotCollection* sumPlotColl, - const std::vector& summaryCasesToUse, +RimSummaryPlot* RicSummaryPlotFeatureImpl::createSummaryPlotForCases( const std::vector& summaryCasesToUse, QStringList summaryAddressFilters, bool addHistoryCurves /*= false */ ) { - RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle(); + RimSummaryPlot* newPlot = new RimSummaryPlot(); + newPlot->enableAutoPlotTitle( true ); for ( RimSummaryCase* sumCase : summaryCasesToUse ) { @@ -588,7 +594,6 @@ RimSummaryPlot* RicSummaryPlotFeatureImpl::createSummaryPlotForCases( RimSummary /// //-------------------------------------------------------------------------------------------------- std::vector RicSummaryPlotFeatureImpl::createMultipleSummaryPlotsFromAddresses( - RimSummaryPlotCollection* sumPlotColl, const std::vector& summaryCasesToUse, RimSummaryCaseCollection* ensemble, QStringList summaryAddressFilters, @@ -631,7 +636,8 @@ std::vector RicSummaryPlotFeatureImpl::createMultipleSummaryPlo if ( createdCurves.size() || createdEnsembleCurveSets.size() ) { - RimSummaryPlot* newPlot = sumPlotColl->createSummaryPlotWithAutoTitle(); + RimSummaryPlot* newPlot = new RimSummaryPlot(); + newPlot->enableAutoPlotTitle( true ); for ( auto curve : createdCurves ) { diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h index 21fdb66a35..fc6c09eeeb 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.h @@ -33,7 +33,6 @@ class RimSummaryCurve; class RimSummaryPlot; class RimSummaryCase; class RimSummaryCaseCollection; -class RimSummaryPlotCollection; class RimEnsembleCurveSet; class QStringList; @@ -50,28 +49,24 @@ class RicSummaryPlotFeatureImpl }; static std::vector addDefaultCurvesToPlot( RimSummaryPlot* plot, RimSummaryCase* summaryCase ); - static void ensureAtLeastOnePlot( RimSummaryPlotCollection* summaryPlotCollection, RimSummaryCase* summaryCase ); - static caf::PdmObject* createDefaultSummaryPlot( RimSummaryCase* summaryCase ); + static caf::PdmObject* createDefaultSummaryPlot( RimSummaryCase* summaryCase ); static void createSummaryPlotsFromArgumentLine( const QStringList& arguments ); static RimSummaryPlot* - createSummaryPlotForEnsemble( RimSummaryPlotCollection* sumPlotColl, - const std::vector& summaryCasesToUse, + createSummaryPlotForEnsemble( const std::vector& summaryCasesToUse, RimSummaryCaseCollection* ensemble, QStringList summaryAddressFilters, bool addHistoryCurves = false, EnsembleColoringType ensembleColoringStyle = EnsembleColoringType::NONE, QString ensembleColoringParameter = "" ); - static RimSummaryPlot* createSummaryPlotForCases( RimSummaryPlotCollection* sumPlotColl, - const std::vector& summaryCasesToUse, + static RimSummaryPlot* createSummaryPlotForCases( const std::vector& summaryCasesToUse, QStringList summaryAddressFilters, bool addHistoryCurves = false ); static std::vector - createMultipleSummaryPlotsFromAddresses( RimSummaryPlotCollection* sumPlotColl, - const std::vector& summaryCasesToUse, + createMultipleSummaryPlotsFromAddresses( const std::vector& summaryCasesToUse, RimSummaryCaseCollection* ensemble, QStringList summaryAddressFilters, bool addHistoryCurves = false, diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 2578cbc8b0..2beaa4618a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -130,7 +130,6 @@ #include "RimSummaryMultiPlot.h" #include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RimSurface.h" #include "RimSurfaceCollection.h" #include "RimValveTemplate.h" @@ -557,20 +556,15 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() { menuBuilder << "RicNewVfpPlotFeature"; } - else if ( dynamic_cast( firstUiItem ) ) + else if ( dynamic_cast( firstUiItem ) ) { + menuBuilder << "RicNewSummaryMultiPlotFeature"; + menuBuilder << "Separator"; menuBuilder << "RicPasteSummaryPlotFeature"; menuBuilder << "RicPasteAsciiDataToSummaryPlotFeature"; menuBuilder << "Separator"; - menuBuilder << "RicOpenSummaryPlotEditorFeature"; - menuBuilder << "RicNewDefaultSummaryPlotFeature"; - menuBuilder << "Separator"; menuBuilder << "RicShowSummaryCurveCalculatorFeature"; } - else if ( dynamic_cast( firstUiItem ) ) - { - menuBuilder << "RicNewSummaryMultiPlotFeature"; - } else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewAnalysisPlotFeature"; @@ -778,7 +772,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; menuBuilder << "RicOpenSummaryPlotEditorFeature"; - menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder.addSeparator(); menuBuilder << "RicConvertGroupToEnsembleFeature"; @@ -795,7 +788,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder.addSeparator(); menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicOpenSummaryPlotEditorFeature"; - menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder.addSeparator(); menuBuilder << "RicImportGridModelFromSummaryCaseFeature"; @@ -1085,7 +1077,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; menuBuilder << "RicOpenSummaryPlotEditorFeature"; - menuBuilder << "RicNewDefaultSummaryPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder << "RicSummaryCurveSwitchAxisFeature"; menuBuilder << "RicNewDerivedSummaryFeature"; diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp index a683c5d91a..fb6180036f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp @@ -19,6 +19,8 @@ #include "RimMainPlotCollection.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" + #include "RimAbstractPlotCollection.h" #include "RimAnalysisPlotCollection.h" #include "RimCorrelationPlotCollection.h" @@ -80,9 +82,6 @@ RimMainPlotCollection::RimMainPlotCollection() CAF_PDM_InitFieldNoDefault( &m_pltPlotCollection, "PltPlotCollection", "" ); m_pltPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_summaryPlotCollection, "SummaryPlotCollection", "Summary Plots" ); - m_summaryPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_summaryMultiPlotCollection, "SummaryMultiPlotCollection", "Multi Summary Plots" ); m_summaryMultiPlotCollection.uiCapability()->setUiTreeHidden( true ); @@ -125,7 +124,6 @@ RimMainPlotCollection::RimMainPlotCollection() m_wellLogPlotCollection = new RimWellLogPlotCollection(); m_rftPlotCollection = new RimRftPlotCollection(); m_pltPlotCollection = new RimPltPlotCollection(); - m_summaryPlotCollection = new RimSummaryPlotCollection(); m_summaryMultiPlotCollection = new RimSummaryMultiPlotCollection(); m_summaryCrossPlotCollection = new RimSummaryCrossPlotCollection(); m_flowPlotCollection = new RimFlowPlotCollection(); @@ -140,6 +138,11 @@ RimMainPlotCollection::RimMainPlotCollection() m_gridStatisticsPlotCollection = new RimGridStatisticsPlotCollection; m_ensembleFractureStatisticsPlotCollection = new RimEnsembleFractureStatisticsPlotCollection; #endif + + CAF_PDM_InitFieldNoDefault( &m_summaryPlotCollection_OBSOLETE, "SummaryPlotCollection", "Summary Plots" ); + m_summaryPlotCollection_OBSOLETE.uiCapability()->setUiTreeHidden( true ); + m_summaryPlotCollection_OBSOLETE.xmlCapability()->setIOWritable( false ); + m_summaryPlotCollection_OBSOLETE = new RimSummaryPlotCollection(); } //-------------------------------------------------------------------------------------------------- @@ -149,6 +152,25 @@ RimMainPlotCollection::~RimMainPlotCollection() { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMainPlotCollection::initAfterRead() +{ + std::vector plotsToMove; + for ( auto singlePlot : m_summaryPlotCollection_OBSOLETE()->plots() ) + { + plotsToMove.push_back( singlePlot ); + } + + for ( auto singlePlot : plotsToMove ) + { + m_summaryPlotCollection_OBSOLETE()->removePlot( singlePlot ); + + RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( singlePlot ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -190,14 +212,6 @@ RimPltPlotCollection* RimMainPlotCollection::pltPlotCollection() const return m_pltPlotCollection(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryPlotCollection* RimMainPlotCollection::summaryPlotCollection() const -{ - return m_summaryPlotCollection(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -415,7 +429,6 @@ std::vector RimMainPlotCollection::allPlotCollections() cons { std::vector plotCollections; plotCollections.push_back( wellLogPlotCollection() ); - plotCollections.push_back( summaryPlotCollection() ); plotCollections.push_back( summaryMultiPlotCollection() ); plotCollections.push_back( summaryCrossPlotCollection() ); plotCollections.push_back( gridCrossPlotCollection() ); diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h index bd6d7eb35c..b21e44fa33 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h @@ -34,9 +34,9 @@ class RimPltPlotCollection; class RimGridCrossPlotCollection; class RimMultiPlotCollection; class RimSummaryMultiPlotCollection; -class RimSummaryPlotCollection; class RimSummaryCrossPlotCollection; class RimSummaryPlot; +class RimSummaryPlotCollection; class RifReaderEclipseSummary; class RimEclipseResultCase; class RimFlowPlotCollection; @@ -65,7 +65,6 @@ class RimMainPlotCollection : public caf::PdmObject RimWellLogPlotCollection* wellLogPlotCollection() const; RimRftPlotCollection* rftPlotCollection() const; RimPltPlotCollection* pltPlotCollection() const; - RimSummaryPlotCollection* summaryPlotCollection() const; RimSummaryMultiPlotCollection* summaryMultiPlotCollection() const; RimSummaryCrossPlotCollection* summaryCrossPlotCollection() const; RimAnalysisPlotCollection* analysisPlotCollection() const; @@ -91,6 +90,9 @@ class RimMainPlotCollection : public caf::PdmObject void ensureCalculationIdsAreAssigned(); void loadDataAndUpdateAllPlots(); +protected: + void initAfterRead() override; + private: // Overridden PDM methods caf::PdmFieldHandle* objectToggleField() override; @@ -106,7 +108,6 @@ class RimMainPlotCollection : public caf::PdmObject caf::PdmChildField m_wellLogPlotCollection; caf::PdmChildField m_rftPlotCollection; caf::PdmChildField m_pltPlotCollection; - caf::PdmChildField m_summaryPlotCollection; caf::PdmChildField m_summaryMultiPlotCollection; caf::PdmChildField m_summaryCrossPlotCollection; caf::PdmChildField m_analysisPlotCollection; @@ -123,4 +124,6 @@ class RimMainPlotCollection : public caf::PdmObject #endif caf::PdmField m_show; + + caf::PdmChildField m_summaryPlotCollection_OBSOLETE; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index e59cb3ecf5..891b4e877e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -78,7 +78,6 @@ #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCrossPlotCollection.h" #include "RimSummaryMultiPlotCollection.h" -#include "RimSummaryPlotCollection.h" #include "RimSurfaceCollection.h" #include "RimTools.h" #include "RimUserDefinedPolylinesAnnotation.h" @@ -1450,10 +1449,6 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q statisticsItemCollection->add( mainPlotCollection->ensembleFractureStatisticsPlotCollection() ); } #endif - if ( mainPlotCollection->summaryPlotCollection() ) - { - uiTreeOrdering.add( mainPlotCollection->summaryPlotCollection() ); - } } } else if ( uiConfigName == "PlotWindow.DataSources" ) diff --git a/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp b/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp index 8a57a9901c..be0c9ea10b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.cpp @@ -38,8 +38,8 @@ #include "RimMultiPlotCollection.h" #include "RimProject.h" #include "RimSummaryCaseMainCollection.h" -#include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimWellLogPlot.h" #include "RimWellLogPlotCollection.h" @@ -156,10 +156,11 @@ void RimReloadCaseTools::updateAllPlots() } } - RimSummaryPlotCollection* summaryPlotCollection = project->mainPlotCollection()->summaryPlotCollection(); - if ( summaryPlotCollection ) + RimSummaryMultiPlotCollection* summaryMultiPlotCollection = + project->mainPlotCollection()->summaryMultiPlotCollection(); + if ( summaryMultiPlotCollection ) { - for ( RimSummaryPlot* summaryPlot : summaryPlotCollection->plots() ) + for ( RimSummaryMultiPlot* summaryPlot : summaryMultiPlotCollection->multiPlots() ) { summaryPlot->loadDataAndUpdate(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp index 629ff23e71..74fafdcb77 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp @@ -30,8 +30,9 @@ #include "RimSummaryCalculationCollection.h" #include "RimSummaryCalculationVariable.h" #include "RimSummaryCurve.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RiuExpressionContextMenuManager.h" @@ -475,24 +476,27 @@ void RimSummaryCalculation::updateDependentCurvesAndPlots() this->firstAncestorOrThisOfTypeAsserted( calcColl ); calcColl->rebuildCaseMetaData(); - RimSummaryPlotCollection* summaryPlotCollection = RiaSummaryTools::summaryPlotCollection(); - for ( RimSummaryPlot* sumPlot : summaryPlotCollection->plots() ) + RimSummaryMultiPlotCollection* summaryPlotCollection = RiaSummaryTools::summaryMultiPlotCollection(); + for ( auto multiPlot : summaryPlotCollection->multiPlots() ) { - bool plotContainsCalculatedCurves = false; - - for ( RimSummaryCurve* sumCurve : sumPlot->summaryCurves() ) + for ( RimSummaryPlot* sumPlot : multiPlot->summaryPlots() ) { - if ( sumCurve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED ) + bool plotContainsCalculatedCurves = false; + + for ( RimSummaryCurve* sumCurve : sumPlot->summaryCurves() ) { - sumCurve->updateConnectedEditors(); + if ( sumCurve->summaryAddressY().category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED ) + { + sumCurve->updateConnectedEditors(); - plotContainsCalculatedCurves = true; + plotContainsCalculatedCurves = true; + } } - } - if ( plotContainsCalculatedCurves ) - { - sumPlot->loadDataAndUpdate(); + if ( plotContainsCalculatedCurves ) + { + sumPlot->loadDataAndUpdate(); + } } } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp index 00c35f0dc6..a6a73ef4e0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp @@ -31,7 +31,6 @@ #include "RimSummaryAddress.h" #include "RimSummaryAddressCollection.h" #include "RimSummaryCaseCollection.h" -#include "RimSummaryPlotCollection.h" #include "cafPdmFieldScriptingCapability.h" #include "cafPdmUiTreeOrdering.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index 3464a09cc8..49e098f158 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -42,8 +42,8 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "cafProgressInfo.h" @@ -581,7 +581,7 @@ RimSummaryCaseCollection* RimSummaryCaseMainCollection::defaultAllocator() //-------------------------------------------------------------------------------------------------- void RimSummaryCaseMainCollection::onCaseNameChanged( const SignalEmitter* emitter ) { - RimSummaryPlotCollection* summaryPlotColl = RiaSummaryTools::summaryPlotCollection(); + RimSummaryMultiPlotCollection* summaryPlotColl = RiaSummaryTools::summaryMultiPlotCollection(); summaryPlotColl->updateSummaryNameHasChanged(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index aecf7f74eb..7a0920359e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -44,7 +44,6 @@ #include "RimSummaryCurveCollection.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RimSummaryTimeAxisProperties.h" #include "RimTools.h" @@ -261,6 +260,8 @@ std::vector RimSummaryCurve::valuesY() const RifEclipseSummaryAddress addr = m_yValuesSummaryAddress()->address(); reader->values( addr, &values ); + if ( values.empty() ) return values; + RimSummaryPlot* plot = nullptr; firstAncestorOrThisOfTypeAsserted( plot ); bool isNormalized = plot->isNormalizationEnabled(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp index 4872f2ecc7..09112872b0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -143,3 +143,33 @@ void RimSummaryMultiPlotCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering } uiTreeOrdering.skipRemainingChildren( true ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlotCollection::summaryPlotItemInfos( QList* optionInfos ) const +{ + for ( RimSummaryMultiPlot* multiPlot : multiPlots() ) + { + for ( RimSummaryPlot* plot : multiPlot->summaryPlots() ) + { + QString displayName = plot->description(); + optionInfos->push_back( + caf::PdmOptionItemInfo( displayName, plot, false, plot->uiCapability()->uiIconProvider() ) ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlotCollection::updateSummaryNameHasChanged() +{ + for ( RimSummaryMultiPlot* multiPlot : multiPlots() ) + { + for ( RimSummaryPlot* plot : multiPlot->summaryPlots() ) + { + plot->updateCaseNameHasChanged(); + } + } +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h index 81fafd2f45..d615a79c69 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h @@ -21,6 +21,9 @@ #include "cafPdmChildArrayField.h" #include "cafPdmObject.h" +#include "cafPdmUiItem.h" + +#include class RimSummaryMultiPlot; @@ -44,6 +47,10 @@ class RimSummaryMultiPlotCollection : public caf::PdmObject, public RimPlotColle void addSummaryMultiPlot( RimSummaryMultiPlot* plot ); + void summaryPlotItemInfos( QList* optionInfos ) const; + + void updateSummaryNameHasChanged(); + protected: void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 8a6d6d3cbd..6f3bbf7cba 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -51,7 +51,6 @@ #include "RimSummaryCurveCollection.h" #include "RimSummaryCurvesData.h" #include "RimSummaryPlotAxisFormatter.h" -#include "RimSummaryPlotCollection.h" #include "RimSummaryPlotControls.h" #include "RimSummaryPlotFilterTextCurveSetEditor.h" #include "RimSummaryPlotNameHelper.h" diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index 1d6dded4fe..9c56539c64 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -36,8 +36,8 @@ #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCurve.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" @@ -189,7 +189,7 @@ QList QList options; if ( fieldNeedingOptions == &m_summaryPlot ) { - auto coll = RiaSummaryTools::summaryPlotCollection(); + auto coll = RiaSummaryTools::summaryMultiPlotCollection(); coll->summaryPlotItemInfos( &options ); } else if ( fieldNeedingOptions == &m_filterText ) @@ -419,13 +419,9 @@ void RimSummaryPlotManager::createNewPlot() } else { - auto plotCollection = RiaSummaryTools::summaryPlotCollection(); for ( auto plot : plots ) { - plot->setAsPlotMdiWindow(); - - plotCollection->addPlot( plot ); - + RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( plot ); plot->loadDataAndUpdate(); } } @@ -549,7 +545,7 @@ void RimSummaryPlotManager::updateFilterTextHistory() //-------------------------------------------------------------------------------------------------- void RimSummaryPlotManager::updateProjectTreeAndRefresUi() { - RiaSummaryTools::summaryPlotCollection()->updateConnectedEditors(); + RiaSummaryTools::summaryMultiPlotCollection()->updateConnectedEditors(); updateFilterTextHistory(); m_filterText.uiCapability()->updateConnectedEditors(); diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp index fffa3b293b..296508a476 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcSummaryPlotCollection.cpp @@ -64,8 +64,7 @@ caf::PdmObjectHandle* RimcSummaryPlotCollection_newSummaryPlot::execute() { if ( !addressStrings.empty() ) { - newPlot = RicSummaryPlotFeatureImpl::createSummaryPlotForEnsemble( self(), - std::vector(), + newPlot = RicSummaryPlotFeatureImpl::createSummaryPlotForEnsemble( std::vector(), m_ensemble, addressStrings ); } @@ -79,21 +78,17 @@ caf::PdmObjectHandle* RimcSummaryPlotCollection_newSummaryPlot::execute() std::vector summaryCases = m_summaryCases.ptrReferencedObjects(); if ( !addressStrings.empty() ) { - newPlot = RicSummaryPlotFeatureImpl::createSummaryPlotForCases( self(), - summaryCases, - addressStrings ); + newPlot = RicSummaryPlotFeatureImpl::createSummaryPlotForCases( summaryCases, addressStrings ); } else { - newPlot = RicNewDefaultSummaryPlotFeature::createFromSummaryCases( self(), - summaryCases ); + newPlot = RicNewDefaultSummaryPlotFeature::createFromSummaryCases( summaryCases ); } } if ( newPlot ) { newPlot->loadDataAndUpdate(); - self()->updateAllRequiredEditors(); } return newPlot; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 63eff0a5bd..222f81de60 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -37,7 +37,6 @@ #include "RimSummaryMultiPlot.h" #include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" -#include "RimSummaryPlotCollection.h" #include "RimSummaryPlotFilterTextCurveSetEditor.h" #include "RimSummaryPlotManager.h" #include "RimViewWindow.h" @@ -154,7 +153,7 @@ void RiuPlotMainWindow::initializeGuiNewProjectLoaded() } { - auto* obj = RiaSummaryTools::summaryPlotCollection(); + auto* obj = RiaSummaryTools::summaryMultiPlotCollection(); if ( obj ) { setExpanded( obj ); From d156160daff1a3d52cddbc0d99f503607a6ae789 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 7 Apr 2022 16:24:27 +0200 Subject: [PATCH 226/406] Summary Multiplot: sync plot selection in tree with view (#8788) * Make sure the subplot selected in the tree is shown in the multiplot viewer. * Clean up multiplot toolbar handling a bit * Remove old summary plot toolbar. --- .../Commands/RicCloseSummaryCaseFeature.cpp | 2 +- ...RicCloseSummaryCaseInCollectionFeature.cpp | 2 +- .../Commands/RicImportSummaryCasesFeature.cpp | 4 +- .../Commands/RicImportSummaryGroupFeature.cpp | 3 +- .../CMakeLists_files.cmake | 2 - ...RicActivateCurveFilterInToolbarFeature.cpp | 59 ------------- .../RicActivateCurveFilterInToolbarFeature.h | 34 -------- .../RicNewSummaryCrossPlotCurveFeature.cpp | 2 +- .../RicNewSummaryCurveFeature.cpp | 2 +- .../RicNewSummaryEnsembleCurveSetFeature.cpp | 4 +- .../RicSummaryPlotEditorUi.cpp | 4 +- .../ProjectDataModel/RimMultiPlot.cpp | 32 ++----- .../ProjectDataModel/RimMultiPlot.h | 10 +-- .../RimObservedDataCollection.cpp | 2 +- .../Summary/RimEnsembleCurveSet.cpp | 2 +- .../Summary/RimSummaryCurve.cpp | 4 +- .../Summary/RimSummaryMultiPlot.cpp | 11 +++ .../Summary/RimSummaryMultiPlot.h | 4 +- .../Summary/RimSummaryPlotCollection.cpp | 2 +- ...RimSummaryPlotFilterTextCurveSetEditor.cpp | 2 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 7 +- .../ProjectDataModelCommands/RimcProject.cpp | 2 +- .../UserInterface/RiuMultiPlotBook.cpp | 18 ++++ .../UserInterface/RiuMultiPlotBook.h | 2 + .../UserInterface/RiuPlotMainWindow.cpp | 86 +++---------------- .../UserInterface/RiuPlotMainWindow.h | 3 - .../UserInterface/RiuPlotMainWindowTools.cpp | 1 - 27 files changed, 78 insertions(+), 228 deletions(-) delete mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.cpp delete mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.h diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp index e36249b35e..f55126f8cb 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp @@ -75,7 +75,7 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vectorupdateAllRequiredEditors(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); caf::AsyncPdmObjectVectorDeleter summaryCaseDeleter( cases ); CAF_ASSERT( cases.empty() ); // vector should be empty immediately. diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp b/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp index c8b32cccb4..06fa3973d6 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp @@ -96,5 +96,5 @@ void RicCloseSummaryCaseInCollectionFeature::onActionTriggered( bool isChecked ) } RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } diff --git a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp index 301dccc655..ac34166353 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp @@ -98,7 +98,7 @@ void RicImportSummaryCasesFeature::onActionTriggered( bool isChecked ) RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow(); if ( mainPlotWindow && !cases.empty() ) { - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } std::vector allCases; @@ -147,7 +147,7 @@ bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles( const QStr RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow(); if ( mainPlotWindow && !cases->empty() ) { - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); // Close main window if there are no eclipse cases imported std::vector allCases; diff --git a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp index 98b2a4bc66..6a7bdd22b8 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp @@ -71,8 +71,7 @@ void RicImportSummaryGroupFeature::onActionTriggered( bool isChecked ) if ( mainPlotWindow && !cases.empty() ) { mainPlotWindow->selectAsCurrentItem( cases.back() ); - - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } std::vector allCases; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index ae7cbc1ec2..e2fb7c775f 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -41,7 +41,6 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingSummaryCurveFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicClearSourceSteppingEnsembleCurveSetFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.h - ${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewPlotAxisPropertiesFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.h @@ -90,7 +89,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingSummaryCurveFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicClearSourceSteppingEnsembleCurveSetFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.cpp - ${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewPlotAxisPropertiesFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.cpp diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.cpp deleted file mode 100644 index 8e4ff89a6d..0000000000 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.cpp +++ /dev/null @@ -1,59 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- 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 -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RicActivateCurveFilterInToolbarFeature.h" - -#include "RiaGuiApplication.h" -#include "RiuPlotMainWindow.h" - -#include - -CAF_CMD_SOURCE_INIT( RicActivateCurveFilterInToolbarFeature, "RicActivateCurveFilterInToolbarFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicActivateCurveFilterInToolbarFeature::isCommandEnabled() -{ - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicActivateCurveFilterInToolbarFeature::onActionTriggered( bool isChecked ) -{ - if ( RiaGuiApplication::isRunning() ) - { - auto plotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - if ( plotWindow ) - { - plotWindow->setFocusToLineEditInSummaryToolBar(); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicActivateCurveFilterInToolbarFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Activate Summary Curve Filter Editor" ); - - applyShortcutWithHintToAction( actionToSetup, QKeySequence( tr( "Ctrl+F" ) ) ); -} diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.h deleted file mode 100644 index 8352953ce0..0000000000 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.h +++ /dev/null @@ -1,34 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- 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 -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "cafCmdFeature.h" - -//================================================================================================== -/// -//================================================================================================== -class RicActivateCurveFilterInToolbarFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; -}; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp index 70e3385ea6..995fd126c7 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp @@ -77,7 +77,7 @@ void RicNewSummaryCrossPlotCurveFeature::onActionTriggered( bool isChecked ) RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem( newCurve ); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp index c03c8c1786..73a27ea346 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp @@ -107,7 +107,7 @@ void RicNewSummaryCurveFeature::onActionTriggered( bool isChecked ) app->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem( newCurve ); RiuPlotMainWindow* mainPlotWindow = app->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp index cc1ac22e64..1e96749245 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp @@ -130,7 +130,7 @@ RimSummaryPlot* if ( mainPlotWindow ) { mainPlotWindow->selectAsCurrentItem( firstCurveSetCreated ); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } return plot; } @@ -183,7 +183,7 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered( bool isChecked ) if ( mainPlotWindow && firstCurveSet ) { mainPlotWindow->selectAsCurrentItem( firstCurveSet ); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index eba17f33f3..99a13559fd 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -236,7 +236,7 @@ void RicSummaryPlotEditorUi::fieldChangedByUi( const caf::PdmFieldHandle* change field->setValueWithFieldChanged( true ); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } else if ( changedField == &m_useAutoAppearanceAssignment && m_useAutoAppearanceAssignment ) { @@ -861,7 +861,7 @@ void RicSummaryPlotEditorUi::createNewPlot() m_targetPlot = newSummaryPlot; RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 7045f81689..121e1d804a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -492,30 +492,6 @@ int RimMultiPlot::rowsPerPage() const return rowCount; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimMultiPlot::columnCountField() -{ - return &m_columnCount; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimMultiPlot::rowsPerPageField() -{ - return &m_rowsPerPage; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimMultiPlot::pagePreviewField() -{ - return &m_pagePreviewMode; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -913,3 +889,11 @@ bool RimMultiPlot::isMouseCursorInsidePlot() if ( !m_viewer ) return false; return m_viewer->underMouse(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimMultiPlot::fieldsToShowInToolbar() +{ + return { &m_pagePreviewMode, &m_columnCount, &m_rowsPerPage }; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 4333a6f306..a0af751746 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -89,11 +89,8 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection fieldsToShowInToolbar(); + protected: QImage snapshotWindowContent() override; @@ -129,7 +128,6 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollectionmainPlotWindow(); - if ( mpw ) mpw->updateSummaryPlotToolBar(); + if ( mpw ) mpw->updateMultiPlotToolBar(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index ba20062352..80ecaaadeb 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -795,7 +795,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi plot->updateConnectedEditors(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 7a0920359e..481f39cbf3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -1076,7 +1076,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, plot->updatePlotTitle(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); // If no plot collection is found, we assume that we are inside a curve creator // Update the summary curve collection to make sure the curve names are updated in curve creator UI @@ -1236,7 +1236,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, plot->updateConnectedEditors(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); dataChanged.send(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 0ab5bcaaf9..93ade2680b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -449,6 +449,9 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() toolBarFields.insert( std::end( toolBarFields ), std::begin( fields ), std::end( fields ) ); } + auto multiFields = RimMultiPlot::fieldsToShowInToolbar(); + toolBarFields.insert( std::end( toolBarFields ), std::begin( multiFields ), std::end( multiFields ) ); + return toolBarFields; } @@ -580,6 +583,14 @@ void RimSummaryMultiPlot::duplicate() duplicatePlot.send( this ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::makeSureIsVisible( RimSummaryPlot* summaryPlot ) +{ + if ( summaryPlot->plotWidget() && !m_viewer.isNull() ) m_viewer->scrollToPlot( summaryPlot->plotWidget() ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index ce9e708ff5..c728fa3af5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -68,7 +68,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void removePlotNoUpdate( RimPlot* plot ) override; void updateAfterPlotRemove() override; - std::vector fieldsToShowInToolbar(); + std::vector fieldsToShowInToolbar() override; void syncAxisRanges(); @@ -79,6 +79,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep std::vector summaryPlots() const; std::vector visibleSummaryPlots() const; + void makeSureIsVisible( RimSummaryPlot* plot ); + protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp index b83ada7e01..849f07dc67 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp @@ -112,7 +112,7 @@ void RimSummaryPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* { updateSummaryNameHasChanged(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp index e6b1769d16..62e75f7f39 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp @@ -236,7 +236,7 @@ void RimSummaryPlotFilterTextCurveSetEditor::fieldChangedByUi( const caf::PdmFie RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); if ( mainPlotWindow ) { - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index d43c81781a..6931ce7daa 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -397,9 +397,8 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* ensembleCurveColl->updateConnectedEditors(); } - RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); - bool forceUpdateOfFieldsInToolbar = true; - mainPlotWindow->updateSummaryPlotToolBar( forceUpdateOfFieldsInToolbar ); + RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); + mainPlotWindow->updateMultiPlotToolBar(); return; } @@ -597,7 +596,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* } RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp index 761b62e297..7a2c2be9e6 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp @@ -76,7 +76,7 @@ caf::PdmObjectHandle* RimProject_importSummaryCase::execute() RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); if ( mainPlotWindow && !newCases.empty() ) { - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 4176c29162..46501fe82e 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -663,6 +663,24 @@ void RiuMultiPlotBook::changeCurrentPage( int pageNumber ) if ( !m_pages.isEmpty() ) m_scrollArea->ensureWidgetVisible( m_pages[m_currentPageIndex] ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::scrollToPlot( RiuPlotWidget* plotWidget ) +{ + int pageNum = 0; + + for ( auto& page : m_pages ) + { + if ( page->indexOfPlotWidget( plotWidget ) >= 0 ) + { + changeCurrentPage( pageNum ); + return; + } + pageNum++; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index 92e81807e9..ff25420e97 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -84,6 +84,8 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void renderTo( QPaintDevice* painter ); + void scrollToPlot( RiuPlotWidget* plotWidget ); + void goToNextPage(); void goToPrevPage(); void goToLastPage(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 222f81de60..2eed1333db 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -196,7 +196,6 @@ void RiuPlotMainWindow::cleanupGuiBeforeProjectClose() cleanUpTemporaryWidgets(); m_wellLogPlotToolBarEditor->clear(); - m_summaryPlotToolBarEditor->clear(); m_multiPlotToolBarEditor->clear(); setWindowTitle( "Plots - ResInsight" ); @@ -429,9 +428,6 @@ void RiuPlotMainWindow::createToolBars() m_wellLogPlotToolBarEditor = std::make_unique( "Well Log Plot", this ); m_wellLogPlotToolBarEditor->hide(); - m_summaryPlotToolBarEditor = std::make_unique( "Summary Plot", this ); - m_summaryPlotToolBarEditor->hide(); - m_multiPlotToolBarEditor = std::make_unique( "Multi Plot", this ); m_multiPlotToolBarEditor->hide(); @@ -691,9 +687,8 @@ void RiuPlotMainWindow::updateMultiPlotToolBar() RimMultiPlot* plotWindow = dynamic_cast( m_activePlotViewWindow.p() ); if ( plotWindow ) { - std::vector toolBarFields = { plotWindow->pagePreviewField(), - plotWindow->columnCountField(), - plotWindow->rowsPerPageField() }; + std::vector toolBarFields = plotWindow->fieldsToShowInToolbar(); + m_multiPlotToolBarEditor->setFields( toolBarFields ); m_multiPlotToolBarEditor->updateUi(); m_multiPlotToolBarEditor->show(); @@ -706,61 +701,6 @@ void RiuPlotMainWindow::updateMultiPlotToolBar() refreshToolbars(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::updateSummaryPlotToolBar( bool forceUpdateUi ) -{ - RimSummaryPlot* summaryPlot = dynamic_cast( m_activePlotViewWindow.p() ); - RimSummaryMultiPlot* summaryMultiPlot = dynamic_cast( m_activePlotViewWindow.p() ); - - std::vector toolBarFields; - - if ( summaryMultiPlot ) - { - toolBarFields = summaryMultiPlot->fieldsToShowInToolbar(); - } - else if ( summaryPlot ) - { - toolBarFields = summaryPlot->fieldsToShowInToolbar(); - } - - if ( toolBarFields.size() > 0 ) - { - QString keyword; - - if ( !m_summaryPlotToolBarEditor->isEditorDataValid( toolBarFields ) ) - { - keyword = m_summaryPlotToolBarEditor->keywordForFocusWidget(); - - m_summaryPlotToolBarEditor->setFields( toolBarFields ); - } - - m_summaryPlotToolBarEditor->updateUi( caf::PdmUiToolBarEditor::uiEditorConfigName() ); - m_summaryPlotToolBarEditor->show(); - m_summaryPlotToolBarEditor->setFocusWidgetFromKeyword( keyword ); - } - else - { - m_summaryPlotToolBarEditor->clear(); - m_summaryPlotToolBarEditor->hide(); - } - - refreshToolbars(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::setFocusToLineEditInSummaryToolBar() -{ - if ( m_summaryPlotToolBarEditor ) - { - m_summaryPlotToolBarEditor->setFocusWidgetFromKeyword( - RimSummaryPlotFilterTextCurveSetEditor::curveFilterFieldKeyword() ); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -901,7 +841,6 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow ) } updateWellLogPlotToolBar(); - updateSummaryPlotToolBar(); updateMultiPlotToolBar(); } @@ -1005,20 +944,17 @@ void RiuPlotMainWindow::selectedObjectsChanged() if ( firstSelectedObject ) { - RimSummaryPlot* summaryPlot = nullptr; - firstSelectedObject->firstAncestorOrThisOfType( summaryPlot ); - if ( summaryPlot ) - { - updateSummaryPlotToolBar(); - } - else + RimSummaryMultiPlot* multiSummaryPlot = nullptr; + firstSelectedObject->firstAncestorOrThisOfType( multiSummaryPlot ); + if ( multiSummaryPlot ) { - RimSummaryMultiPlot* multiSummaryPlot = nullptr; - firstSelectedObject->firstAncestorOrThisOfType( multiSummaryPlot ); - if ( multiSummaryPlot ) + updateMultiPlotToolBar(); + + RimSummaryPlot* summaryPlot = nullptr; + firstSelectedObject->firstAncestorOrThisOfType( summaryPlot ); + if ( summaryPlot ) { - updateSummaryPlotToolBar(); - updateMultiPlotToolBar(); + multiSummaryPlot->makeSureIsVisible( summaryPlot ); } } } diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 3c16eafebe..ce3663a78d 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -85,8 +85,6 @@ class RiuPlotMainWindow : public RiuMainWindowBase void updateWellLogPlotToolBar(); void updateMultiPlotToolBar(); - void updateSummaryPlotToolBar( bool forceUpdateUi = false ); - void setFocusToLineEditInSummaryToolBar(); RicSummaryPlotEditorDialog* summaryCurveCreatorDialog( bool createIfNotPresent ); RicSummaryCurveCalculatorDialog* summaryCurveCalculatorDialog( bool createIfNotPresent ); @@ -136,7 +134,6 @@ private slots: std::unique_ptr m_wellLogPlotToolBarEditor; std::unique_ptr m_multiPlotToolBarEditor; - std::unique_ptr m_summaryPlotToolBarEditor; std::unique_ptr m_pdmUiPropertyView; std::unique_ptr m_summaryPlotManagerView; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp index 60390a91e2..c6b4069b40 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp @@ -94,7 +94,6 @@ void RiuPlotMainWindowTools::refreshToolbars() if ( mpw ) { - mpw->updateSummaryPlotToolBar(); mpw->updateWellLogPlotToolBar(); mpw->updateMultiPlotToolBar(); } From 86fda13daaea6c2484eb02d9a651f2f3485f1140 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 7 Apr 2022 12:43:43 +0200 Subject: [PATCH 227/406] Update vcpkg to tag 2022.03.10 --- ThirdParty/vcpkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThirdParty/vcpkg b/ThirdParty/vcpkg index 5568f110b5..af2287382b 160000 --- a/ThirdParty/vcpkg +++ b/ThirdParty/vcpkg @@ -1 +1 @@ -Subproject commit 5568f110b509a9fd90711978a7cb76bae75bb092 +Subproject commit af2287382b1991dbdcb7e5112d236f3323b9dd7a From 6ecb1a8ea0fd883e0892cf7facf885e9a0199c35 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 6 Apr 2022 10:47:10 +0200 Subject: [PATCH 228/406] #8779 Summary Multi Plot : Rearrange property editor Compute common range for all sub plots when activating sync of sub plot axes --- .../Summary/RimSummaryMultiPlot.cpp | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 93ade2680b..a944c6b618 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -270,33 +270,32 @@ void RimSummaryMultiPlot::populateNameHelper( RimSummaryPlotNameHelper* nameHelp //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - caf::PdmUiGroup* titlesGroup = uiOrdering.addNewGroup( "Titles" ); + auto titlesGroup = uiOrdering.addNewGroup( "Main Plot Settings" ); titlesGroup->add( &m_autoPlotTitles ); - titlesGroup->add( &m_autoPlotTitlesOnSubPlots ); - titlesGroup->add( &m_showPlotWindowTitle ); titlesGroup->add( &m_plotWindowTitle ); - titlesGroup->add( &m_showIndividualPlotTitles ); titlesGroup->add( &m_titleFontSize ); - titlesGroup->add( &m_subTitleFontSize ); - caf::PdmUiGroup* legendsGroup = uiOrdering.addNewGroup( "Legends" ); + auto subPlotSettingsGroup = uiOrdering.addNewGroup( "Sub Plot Settings" ); + subPlotSettingsGroup->add( &m_autoPlotTitlesOnSubPlots ); + subPlotSettingsGroup->add( &m_showIndividualPlotTitles ); + subPlotSettingsGroup->add( &m_subTitleFontSize ); + + auto legendsGroup = uiOrdering.addNewGroup( "Legends" ); legendsGroup->add( &m_showPlotLegends ); legendsGroup->add( &m_plotLegendsHorizontal ); legendsGroup->add( &m_legendFontSize ); - caf::PdmUiGroup* layoutGroup = uiOrdering.addNewGroup( "Layout" ); + auto layoutGroup = uiOrdering.addNewGroup( "Layout" ); layoutGroup->add( &m_columnCount ); layoutGroup->add( &m_rowsPerPage ); layoutGroup->add( &m_majorTickmarkCount ); - caf::PdmUiGroup* axesGroup = uiOrdering.addNewGroup( "Axes" ); + auto axesGroup = uiOrdering.addNewGroup( "Axes" ); axesGroup->add( &m_syncSubPlotAxes ); - { - auto group = uiOrdering.addNewGroup( "Data Source" ); - m_sourceStepping()->uiOrdering( uiConfigName, *group ); - } + auto dataSourceGroup = uiOrdering.addNewGroup( "Data Source" ); + m_sourceStepping()->uiOrdering( uiConfigName, *dataSourceGroup ); uiOrdering.skipRemainingFields( true ); } @@ -323,6 +322,10 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi m_createPlotDuplicate = false; duplicate(); } + else if ( changedField == &m_syncSubPlotAxes && m_syncSubPlotAxes() ) + { + syncAxisRanges(); + } else { RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue ); From a0507c85f4fc9eccfb9bde3b567b201eb413595a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 6 Apr 2022 14:07:08 +0200 Subject: [PATCH 229/406] #8779 Summary Multi Plot : Sync time axis properties across sub plots --- .../ProjectDataModel/RimPlotAxisProperties.cpp | 3 +-- .../ProjectDataModel/RimPlotAxisProperties.h | 1 - .../ProjectDataModel/RimPlotAxisPropertiesInterface.cpp | 8 ++++++++ .../ProjectDataModel/RimPlotAxisPropertiesInterface.h | 5 +++++ .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 8 ++++++++ .../Summary/RimSummaryTimeAxisProperties.cpp | 2 ++ 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 32d60d9dc4..83347e00bc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -50,8 +50,7 @@ CAF_PDM_SOURCE_INIT( RimPlotAxisProperties, "SummaryYAxisProperties" ); /// //-------------------------------------------------------------------------------------------------- RimPlotAxisProperties::RimPlotAxisProperties() - : settingsChanged( this ) - , logarithmicChanged( this ) + : logarithmicChanged( this ) , axisPositionChanged( this ) , m_enableTitleTextSettings( true ) , m_isRangeSettingsEnabled( true ) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index 23aea0b511..59339b6253 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -51,7 +51,6 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface }; public: - caf::Signal<> settingsChanged; caf::Signal logarithmicChanged; caf::Signal axisPositionChanged; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp index 2421e4599c..9189c4a337 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp @@ -45,6 +45,14 @@ void RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum::setUp() } } // namespace caf +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimPlotAxisPropertiesInterface::RimPlotAxisPropertiesInterface() + : settingsChanged( this ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h index eb5462f622..b88fb58a4b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h @@ -47,6 +47,11 @@ class RimPlotAxisPropertiesInterface : public caf::PdmObject }; using LegendTickmarkCountEnum = caf::AppEnum; + caf::Signal<> settingsChanged; + +public: + RimPlotAxisPropertiesInterface(); + virtual std::vector annotations() const = 0; virtual void appendAnnotation( RimPlotAxisAnnotation* annotation ) = 0; virtual void removeAllAnnotations() = 0; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 6f3bbf7cba..7498c27f5d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -138,6 +138,8 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) else { auto* timeAxisProperties = new RimSummaryTimeAxisProperties; + timeAxisProperties->settingsChanged.connect( this, &RimSummaryPlot::axisSettingsChanged ); + m_axisProperties.push_back( timeAxisProperties ); } @@ -1770,6 +1772,7 @@ void RimSummaryPlot::axisSettingsChanged( const caf::SignalEmitter* emitter ) //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::axisLogarithmicChanged( const caf::SignalEmitter* emitter, bool isLogarithmic ) { + axisChanged.send( this ); loadDataAndUpdate(); } @@ -2274,6 +2277,11 @@ void RimSummaryPlot::initAfterRead() { connectAxisSignals( plotAxisProperties ); } + auto* timeAxis = dynamic_cast( axisProperties.p() ); + if ( timeAxis ) + { + timeAxis->settingsChanged.connect( this, &RimSummaryPlot::axisSettingsChanged ); + } } for ( auto curve : summaryCurves() ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index 88c01c8ab0..78ad7e23cd 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -669,6 +669,8 @@ void RimSummaryTimeAxisProperties::fieldChangedByUi( const caf::PdmFieldHandle* } rimSummaryPlot->updateAxes(); + + settingsChanged.send(); } //-------------------------------------------------------------------------------------------------- From f099a8c89f9ba240519600ebdf89128c4e5cd86c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 7 Apr 2022 14:06:57 +0200 Subject: [PATCH 230/406] #8779 Summary Multi Plot : Add flag to control visibility of axis number values Useful for making plots anonymized --- .../ProjectDataModel/RimPlotAxisProperties.cpp | 18 ++++++++++++++++++ .../ProjectDataModel/RimPlotAxisProperties.h | 3 +++ .../Summary/RimSummaryPlot.cpp | 2 ++ .../UserInterface/RiuPlotWidget.h | 5 +++-- .../UserInterface/RiuQtChartsPlotWidget.cpp | 7 +++++++ .../UserInterface/RiuQtChartsPlotWidget.h | 1 + .../UserInterface/RiuQwtPlotWidget.cpp | 8 ++++++++ .../UserInterface/RiuQwtPlotWidget.h | 1 + 8 files changed, 43 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 83347e00bc..243df83250 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -82,6 +82,7 @@ RimPlotAxisProperties::RimPlotAxisProperties() CAF_PDM_InitField( &m_isAutoZoom, "AutoZoom", true, "Set Range Automatically" ); CAF_PDM_InitField( &m_isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale" ); CAF_PDM_InitField( &m_isAxisInverted, "AxisInverted", false, "Invert Axis" ); + CAF_PDM_InitField( &m_showNumbers, "ShowNumbers", true, "Show Numbers" ); auto defaultPlotAxis = caf::AppEnum( RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); CAF_PDM_InitField( &m_plotAxis, "PlotAxis", defaultPlotAxis, "Plot Axis" ); @@ -215,6 +216,7 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr { scaleGroup.add( &m_isLogarithmicScaleEnabled ); scaleGroup.add( &m_isAxisInverted ); + scaleGroup.add( &m_showNumbers ); } scaleGroup.add( &numberFormat ); @@ -379,6 +381,22 @@ void RimPlotAxisProperties::setAxisInverted( bool inverted ) m_isAxisInverted = inverted; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotAxisProperties::showNumbers() const +{ + return m_showNumbers; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::setShowNumbers( bool enable ) +{ + m_showNumbers = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index 59339b6253..886d4019e7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -77,6 +77,8 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface void setAutoZoom( bool enableAutoZoom ) override; bool isAxisInverted() const override; void setAxisInverted( bool inverted ); + bool showNumbers() const; + void setShowNumbers( bool enable ); bool isDeletable() const override; @@ -124,6 +126,7 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface caf::PdmField m_displayUnitText; caf::PdmField m_isAutoZoom; caf::PdmField m_isAxisInverted; + caf::PdmField m_showNumbers; caf::PdmField m_visibleRangeMin; caf::PdmField m_visibleRangeMax; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 7498c27f5d..3c1e620c50 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -825,6 +825,8 @@ void RimSummaryPlot::updateAxis( RiaDefines::PlotAxis plotAxis ) { plotWidget()->enableAxis( riuPlotAxis, false ); } + + plotWidget()->enableAxisNumberLabels( riuPlotAxis, axisProperties->showNumbers() ); } } } diff --git a/ApplicationLibCode/UserInterface/RiuPlotWidget.h b/ApplicationLibCode/UserInterface/RiuPlotWidget.h index d8861428c9..fd2bcd16cc 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuPlotWidget.h @@ -92,8 +92,9 @@ class RiuPlotWidget : public QWidget, public RiuInterfaceToViewWindow bool titleBold = false, int alignment = (int)Qt::AlignCenter ) = 0; - virtual void enableAxis( RiuPlotAxis axis, bool isEnabled ) = 0; - virtual bool axisEnabled( RiuPlotAxis axis ) const = 0; + virtual void enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled ) = 0; + virtual void enableAxis( RiuPlotAxis axis, bool isEnabled ) = 0; + virtual bool axisEnabled( RiuPlotAxis axis ) const = 0; virtual void setAxisScale( RiuPlotAxis axis, double min, double max ) = 0; virtual void setAxisAutoScale( RiuPlotAxis axis, bool enable ) = 0; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp index 833a96a87b..8eedb07b43 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.cpp @@ -197,6 +197,13 @@ void RiuQtChartsPlotWidget::setAxesFontsAndAlignment( int titleFontSize, int val } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotWidget::enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h index 3165e6b2e3..ca11c07151 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotWidget.h @@ -86,6 +86,7 @@ class RiuQtChartsPlotWidget : public RiuPlotWidget bool titleBold = false, int alignment = (int)Qt::AlignCenter ) override; + void enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled ) override; void enableAxis( RiuPlotAxis axis, bool isEnabled ) override; bool axisEnabled( RiuPlotAxis axis ) const override; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 28dde58841..a1fd7d90d4 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -1129,6 +1129,14 @@ void RiuQwtPlotWidget::enableAxis( RiuPlotAxis axis, bool isEnabled ) m_plot->setAxisVisible( toQwtPlotAxis( axis ), isEnabled ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled ) +{ + m_plot->axisScaleDraw( toQwtPlotAxis( axis ) )->enableComponent( QwtAbstractScaleDraw::Labels, isEnabled ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index 26e81ca227..2a2cbefeef 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -79,6 +79,7 @@ class RiuQwtPlotWidget : public RiuPlotWidget int alignment = (int)Qt::AlignCenter ) override; void enableAxis( RiuPlotAxis axis, bool isEnabled ) override; + void enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled ) override; bool axisEnabled( RiuPlotAxis axis ) const override; void setAxisScale( RiuPlotAxis axis, double min, double max ) override; From 93614ef2722700886a40e5bde24dd720165b9199 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 7 Apr 2022 21:06:40 +0200 Subject: [PATCH 231/406] Merge pull request #8791 from OPM/8790-rename-to-group Rename summary references to "Group" --- .../Tools/RiaOptionItemFactory.cpp | 2 +- .../Tools/RiaSummaryAddressAnalyzer.cpp | 26 +- .../Tools/RiaSummaryAddressAnalyzer.h | 4 +- ...ellPathExportCompletionDataFeatureImpl.cpp | 4 +- ...RicAppendSummaryPlotsForObjectsFeature.cpp | 13 +- ...RicCreateMultiPlotFromSelectionFeature.cpp | 6 +- .../RicSaveMultiPlotTemplateFeature.cpp | 10 +- ...icSaveMultiPlotTemplateFeatureSettings.cpp | 8 +- .../RicSaveMultiPlotTemplateFeatureSettings.h | 4 +- .../RicSummaryPlotTemplateTools.cpp | 43 +- .../RicSummaryPlotTemplateTools.h | 9 +- .../FileInterface/RifEclEclipseSummary.cpp | 8 +- .../RifEclipseSummaryAddress.cpp | 39 +- .../FileInterface/RifEclipseSummaryAddress.h | 16 +- .../FileInterface/RifEclipseSummaryTools.cpp | 2 +- .../RifEclipseUserDataKeywordTools.cpp | 8 +- .../FileInterface/RifOpmCommonSummary.cpp | 4 +- .../FileInterface/RifReaderObservedData.cpp | 8 +- .../RimWellPathCompletionSettings.cpp | 10 +- .../RimWellPathCompletionSettings.h | 4 +- .../RimDataSourceSteppingTools.cpp | 6 +- .../RimMultipleSummaryPlotNameHelper.cpp | 8 +- .../RimMultipleSummaryPlotNameHelper.h | 4 +- .../Summary/RimObservedSummaryData.cpp | 4 +- .../Summary/RimSummaryAddress.cpp | 10 +- .../Summary/RimSummaryAddress.h | 2 +- .../Summary/RimSummaryAddressCollection.cpp | 6 +- .../Summary/RimSummaryAddressCollection.h | 2 +- .../RimSummaryCurveAppearanceCalculator.cpp | 8 +- .../Summary/RimSummaryCurveAutoName.cpp | 14 +- .../Summary/RimSummaryCurveAutoName.h | 2 +- .../Summary/RimSummaryNameHelper.cpp | 6 +- .../Summary/RimSummaryNameHelper.h | 16 +- .../Summary/RimSummaryPlot.cpp | 4 +- .../Summary/RimSummaryPlotNameHelper.cpp | 22 +- .../Summary/RimSummaryPlotNameHelper.h | 6 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 28 +- .../Summary/RimSummaryPlotSourceStepping.h | 2 +- .../RifEclipseSummaryAddress-Test.cpp | 4 +- .../RiuSummaryVectorDescriptionMap-Test.cpp | 2 +- .../RiuSummaryQuantityNameInfoProvider.cpp | 865 +++++++++--------- .../RiuSummaryVectorSelectionUi.cpp | 20 +- 42 files changed, 629 insertions(+), 640 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaOptionItemFactory.cpp b/ApplicationLibCode/Application/Tools/RiaOptionItemFactory.cpp index 265efca9c4..35d3f9f61c 100644 --- a/ApplicationLibCode/Application/Tools/RiaOptionItemFactory.cpp +++ b/ApplicationLibCode/Application/Tools/RiaOptionItemFactory.cpp @@ -90,7 +90,7 @@ caf::PdmOptionItemInfo case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION: iconText = ":/summary/components/images/region-region.svg"; break; - case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP: + case RifEclipseSummaryAddress::SUMMARY_GROUP: iconText = ":/summary/components/images/group.svg"; break; case RifEclipseSummaryAddress::SUMMARY_WELL: diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp index b7d84ea19f..ede489109d 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp @@ -112,9 +112,9 @@ std::set RiaSummaryAddressAnalyzer::wellNames() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::set RiaSummaryAddressAnalyzer::wellGroupNames() const +std::set RiaSummaryAddressAnalyzer::groupNames() const { - return keysInMap( m_wellGroupNames ); + return keysInMap( m_groupNames ); } //-------------------------------------------------------------------------------------------------- @@ -190,15 +190,15 @@ std::set RiaSummaryAddressAnalyzer //-------------------------------------------------------------------------------------------------- std::vector> RiaSummaryAddressAnalyzer::addressesGroupedByObject() const { - auto wellAdr = valuesInMap( m_wellNames ); - auto wellGroupAdr = valuesInMap( m_wellGroupNames ); - auto regionAdr = valuesInMap( m_regionNumbers ); - auto blockAdr = valuesInMap( m_blocks ); - auto aquiferAdr = valuesInMap( m_aquifers ); + auto wellAdr = valuesInMap( m_wellNames ); + auto groupAdr = valuesInMap( m_groupNames ); + auto regionAdr = valuesInMap( m_regionNumbers ); + auto blockAdr = valuesInMap( m_blocks ); + auto aquiferAdr = valuesInMap( m_aquifers ); std::vector> groupedByObject; groupedByObject.insert( groupedByObject.end(), wellAdr.begin(), wellAdr.end() ); - groupedByObject.insert( groupedByObject.end(), wellGroupAdr.begin(), wellGroupAdr.end() ); + groupedByObject.insert( groupedByObject.end(), groupAdr.begin(), groupAdr.end() ); groupedByObject.insert( groupedByObject.end(), regionAdr.begin(), regionAdr.end() ); groupedByObject.insert( groupedByObject.end(), blockAdr.begin(), blockAdr.end() ); groupedByObject.insert( groupedByObject.end(), aquiferAdr.begin(), aquiferAdr.end() ); @@ -230,9 +230,9 @@ std::vector RiaSummaryAddressAnalyzer::identifierTexts( RifEclipseSumma identifierStrings.push_back( QString::fromStdString( key ) ); } } - else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ) + else if ( category == RifEclipseSummaryAddress::SUMMARY_GROUP ) { - auto keys = keysInMap( m_wellGroupNames ); + auto keys = keysInMap( m_groupNames ); for ( const auto& key : keys ) { identifierStrings.push_back( QString::fromStdString( key ) ); @@ -317,7 +317,7 @@ void RiaSummaryAddressAnalyzer::clear() { m_quantities.clear(); m_wellNames.clear(); - m_wellGroupNames.clear(); + m_groupNames.clear(); m_regionNumbers.clear(); m_categories.clear(); m_wellCompletions.clear(); @@ -393,9 +393,9 @@ void RiaSummaryAddressAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAdd m_quantities.insert( address.quantityName() ); } - if ( !address.wellGroupName().empty() ) + if ( !address.groupName().empty() ) { - m_wellGroupNames.insert( { address.wellGroupName(), address } ); + m_groupNames.insert( { address.groupName(), address } ); } if ( address.regionNumber() != -1 ) diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h index ff00a2e4b6..dc97e366b1 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h +++ b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h @@ -49,7 +49,7 @@ class RiaSummaryAddressAnalyzer std::string quantityNameForTitle() const; std::set wellNames() const; - std::set wellGroupNames() const; + std::set groupNames() const; std::set regionNumbers() const; std::set wellCompletions( const std::string& wellName ) const; @@ -90,7 +90,7 @@ class RiaSummaryAddressAnalyzer mutable std::set m_quantitiesNoMatchingHistory; std::multimap m_wellNames; - std::multimap m_wellGroupNames; + std::multimap m_groupNames; std::multimap m_regionNumbers; std::set> m_wellCompletions; std::set> m_wellSegmentNumbers; diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp index 672c4bbfe1..e0506b957f 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicWellPathExportCompletionDataFeatureImpl.cpp @@ -762,7 +762,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspecsToFile( RimEclips auto ijIntersection = wellPathUpperGridIntersectionIJ( gridCase, wellPath ); formatter.add( completionSettings->wellNameForExport() ) - .add( completionSettings->wellGroupNameForExport() ) + .add( completionSettings->groupNameForExport() ) .addOneBasedCellIndex( ijIntersection.second.x() ) .addOneBasedCellIndex( ijIntersection.second.y() ) .add( completionSettings->referenceDepthForExport() ) @@ -853,7 +853,7 @@ void RicWellPathExportCompletionDataFeatureImpl::exportWelspeclToFile( auto completionSettings = wellPath->completionSettings(); formatter.add( completionSettings->wellNameForExport() ) - .add( completionSettings->wellGroupNameForExport() ) + .add( completionSettings->groupNameForExport() ) .add( lgrName ) .addOneBasedCellIndex( ijIntersection.x() ) .addOneBasedCellIndex( ijIntersection.y() ) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index dbae1c203f..d7bcb0bcdd 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -52,7 +52,7 @@ bool RicAppendSummaryPlotsForObjectsFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicAppendSummaryPlotsForObjectsFeature::onActionTriggered( bool isChecked ) { - // - Select a set of objects in Data Source (wells, well groups, regions, ..) + // - Select a set of objects in Data Source (wells, groups, regions, ..) // - Use context menu to activate action // - For each plot in the current active plot, create a duplicate plot and replace the object name @@ -134,7 +134,7 @@ void RicAppendSummaryPlotsForObjectsFeature::setupActionLook( QAction* actionToS } else if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) { - objectType = "Well Groups"; + objectType = "Groups"; } else if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) { @@ -159,7 +159,7 @@ std::vector RicAppendSummaryPlotsForObjectsFeature { auto coll = sumAddressCollections[0]; if ( coll->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_FOLDER || - coll->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP_FOLDER || + coll->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP_FOLDER || coll->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION_FOLDER ) { // If a folder is selected, return all sub items in folder @@ -220,10 +220,9 @@ bool RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( } else if ( selectionType == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) { - if ( analyzer.wellGroupNames().size() != 1 ) + if ( analyzer.groupNames().size() != 1 ) { - errorText = - "Source plot must contain one well group only to be able to duplicate a selection of well groups"; + errorText = "Source plot must contain one well group only to be able to duplicate a selection of groups"; } } else if ( selectionType == RimSummaryAddressCollection::CollectionContentType::REGION ) @@ -271,7 +270,7 @@ RifEclipseSummaryAddress } else if ( summaryAddressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) { - adr.setWellGroupName( objectName ); + adr.setGroupName( objectName ); } else if ( summaryAddressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) { diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp index ce3e847df9..fcdfe4fada 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp @@ -61,7 +61,7 @@ void RicCreateMultiPlotFromSelectionFeature::onActionTriggered( bool isChecked ) auto summaryAddressCollections = RicSummaryPlotTemplateTools::selectedSummaryAddressCollections(); std::vector wellNames; - std::vector wellGroupNames; + std::vector groupNames; std::vector regions; std::set caseSet; std::set caseCollectionSet; @@ -74,7 +74,7 @@ void RicCreateMultiPlotFromSelectionFeature::onActionTriggered( bool isChecked ) } else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) { - wellGroupNames.push_back( a->name() ); + groupNames.push_back( a->name() ); } else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) { @@ -110,7 +110,7 @@ void RicCreateMultiPlotFromSelectionFeature::onActionTriggered( bool isChecked ) sumCases, sumCaseCollections, wellNames, - wellGroupNames, + groupNames, regions ); newSummaryPlot->initAfterReadRecursively(); newSummaryPlot->loadDataAndUpdate(); diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp index d8dcb6bfea..1e685e48d2 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp @@ -218,17 +218,17 @@ QString RicSaveMultiPlotTemplateFeature::createTextFromObject( RimSummaryMultiPl objectAsText ); } - if ( settings.usePlacholderForWellGroups() ) + if ( settings.usePlacholderForGroups() ) { std::set sourceStrings; - for ( const auto& wellGroupName : analyzer.wellGroupNames() ) + for ( const auto& groupName : analyzer.groupNames() ) { - sourceStrings.insert( QString::fromStdString( wellGroupName ) ); + sourceStrings.insert( QString::fromStdString( groupName ) ); } replaceStrings( sourceStrings, - dummy.keywordForCategory( RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ), - RicSummaryPlotTemplateTools::placeholderTextForWellGroup(), + dummy.keywordForCategory( RifEclipseSummaryAddress::SUMMARY_GROUP ), + RicSummaryPlotTemplateTools::placeholderTextForGroup(), objectAsText ); } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp index 531029b6c1..ef37a2697b 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp @@ -30,7 +30,7 @@ RicSaveMultiPlotTemplateFeatureSettings::RicSaveMultiPlotTemplateFeatureSettings CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" ); CAF_PDM_InitField( &m_replaceWells, "ReplaceWells", true, "Wells" ); - CAF_PDM_InitField( &m_replaceWellGroups, "ReplaceWellGroups", true, "Well Groups" ); + CAF_PDM_InitField( &m_replaceGroups, "ReplaceGroups", true, "Groups" ); CAF_PDM_InitField( &m_replaceRegions, "ReplaceRegions", true, "Regions" ); } @@ -61,9 +61,9 @@ bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForWells() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForWellGroups() const +bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForGroups() const { - return m_replaceWellGroups; + return m_replaceGroups; } //-------------------------------------------------------------------------------------------------- @@ -84,7 +84,7 @@ void RicSaveMultiPlotTemplateFeatureSettings::defineUiOrdering( QString uiConfig { auto group = uiOrdering.addNewGroup( "Use Placeholders for Objects" ); group->add( &m_replaceWells ); - group->add( &m_replaceWellGroups ); + group->add( &m_replaceGroups ); group->add( &m_replaceRegions ); } } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h index 6fa3fae734..371e7466a0 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h @@ -36,7 +36,7 @@ class RicSaveMultiPlotTemplateFeatureSettings : public caf::PdmObject QString filePath() const; bool usePlacholderForWells() const; - bool usePlacholderForWellGroups() const; + bool usePlacholderForGroups() const; bool usePlacholderForRegions() const; private: @@ -48,6 +48,6 @@ class RicSaveMultiPlotTemplateFeatureSettings : public caf::PdmObject private: caf::PdmField m_filePath; caf::PdmField m_replaceWells; - caf::PdmField m_replaceWellGroups; + caf::PdmField m_replaceGroups; caf::PdmField m_replaceRegions; }; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index fece5ebd01..f47ea96994 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -79,8 +79,8 @@ void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryMultiPlot* const std::vector& selectedSummaryCases, const std::vector& selectedEnsembles, const std::vector& wellNames, - const std::vector& wellGroupNames, - const std::vector& regions ) + const std::vector& groupNames, + const std::vector& regions ) { // Assumes this plot is inserted into the project. This is required when assigning the ptrFields @@ -93,7 +93,7 @@ void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryMultiPlot* { auto summaryPlot = dynamic_cast( p ); if ( summaryPlot ) - setValuesForPlaceholders( summaryPlot, selectedSummaryCases, selectedEnsembles, wellNames, wellGroupNames, regions ); + setValuesForPlaceholders( summaryPlot, selectedSummaryCases, selectedEnsembles, wellNames, groupNames, regions ); } } @@ -104,8 +104,8 @@ void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryPlot* const std::vector& selectedSummaryCases, const std::vector& selectedEnsembles, const std::vector& wellNames, - const std::vector& wellGroupNames, - const std::vector& regions ) + const std::vector& groupNames, + const std::vector& regions ) { // Assumes this plot is inserted into the project. This is required when assigning the ptrFields RimProject* proj = nullptr; @@ -138,7 +138,7 @@ void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryPlot* // Replace placeholders with object names from selection auto curveAdr = curve->summaryAddressY(); setPlaceholderWellName( &curveAdr, wellNames ); - setPlaceholderWellGroupName( &curveAdr, wellGroupNames ); + setPlaceholderGroupName( &curveAdr, groupNames ); setPlaceholderRegion( &curveAdr, regions ); curve->setSummaryAddressY( curveAdr ); } @@ -167,7 +167,7 @@ void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryPlot* // Replace placeholders with object names from selection auto curveAdr = curveSet->summaryAddress(); setPlaceholderWellName( &curveAdr, wellNames ); - setPlaceholderWellGroupName( &curveAdr, wellGroupNames ); + setPlaceholderGroupName( &curveAdr, groupNames ); setPlaceholderRegion( &curveAdr, regions ); curveSet->setSummaryAddress( curveAdr ); } @@ -413,11 +413,11 @@ QString RicSummaryPlotTemplateTools::htmlTextFromPlotAndSelection( const RimSumm text += htmlTextFromCount( itemText, requiredCount, selectedCount ); } - if ( !templateAnalyzer.wellGroupNames().empty() ) + if ( !templateAnalyzer.groupNames().empty() ) { - QString itemText = "Well Groups"; - size_t requiredCount = templateAnalyzer.wellGroupNames().size(); - size_t selectedCount = selectionAnalyzer.wellGroupNames().size(); + QString itemText = "Groups"; + size_t requiredCount = templateAnalyzer.groupNames().size(); + size_t selectedCount = selectionAnalyzer.groupNames().size(); text += htmlTextFromCount( itemText, requiredCount, selectedCount ); } @@ -556,7 +556,7 @@ QString RicSummaryPlotTemplateTools::placeholderTextForWell() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RicSummaryPlotTemplateTools::placeholderTextForWellGroup() +QString RicSummaryPlotTemplateTools::placeholderTextForGroup() { return "__WELL_GROUP__"; } @@ -637,20 +637,19 @@ void RicSummaryPlotTemplateTools::setPlaceholderWellName( RifEclipseSummaryAddre //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicSummaryPlotTemplateTools::setPlaceholderWellGroupName( RifEclipseSummaryAddress* summaryAddress, - const std::vector& wellGroupNames ) +void RicSummaryPlotTemplateTools::setPlaceholderGroupName( RifEclipseSummaryAddress* summaryAddress, + const std::vector& groupNames ) { - if ( wellGroupNames.empty() ) return; + if ( groupNames.empty() ) return; - auto sourceWellGroupName = QString::fromStdString( summaryAddress->wellGroupName() ); - bool conversionOk = false; - const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForWellGroup(); + auto sourceGroupName = QString::fromStdString( summaryAddress->groupName() ); + bool conversionOk = false; + const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForGroup(); - int indexValue = - RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, sourceWellGroupName, &conversionOk ); - if ( conversionOk && indexValue >= 0 && indexValue < static_cast( wellGroupNames.size() ) ) + int indexValue = RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, sourceGroupName, &conversionOk ); + if ( conversionOk && indexValue >= 0 && indexValue < static_cast( groupNames.size() ) ) { - summaryAddress->setWellGroupName( wellGroupNames[indexValue].toStdString() ); + summaryAddress->setGroupName( groupNames[indexValue].toStdString() ); } } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h index 6fd3dddd34..8192470f52 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h @@ -47,14 +47,14 @@ class RicSummaryPlotTemplateTools const std::vector& selectedSummaryCases, const std::vector& selectedEnsembles, const std::vector& wellNames, - const std::vector& wellGroupNames, + const std::vector& groupNames, const std::vector& regions ); static void setValuesForPlaceholders( RimSummaryPlot* summaryPlot, const std::vector& selectedSummaryCases, const std::vector& selectedEnsembles, const std::vector& wellNames, - const std::vector& wellGroupNames, + const std::vector& groupNames, const std::vector& regions ); static RimSummaryPlot* createPlotFromTemplateFile( const QString& fileName ); @@ -81,7 +81,7 @@ class RicSummaryPlotTemplateTools static QString placeholderTextForSummaryCase(); static QString placeholderTextForSummaryGroup(); static QString placeholderTextForWell(); - static QString placeholderTextForWellGroup(); + static QString placeholderTextForGroup(); private: static RifEclipseSummaryAddress firstAddressByQuantity( const RifEclipseSummaryAddress& sourceAddress, @@ -90,7 +90,6 @@ class RicSummaryPlotTemplateTools static int findValueForKeyword( const QString& keyword, const QString& valueString, bool* ok ); static void setPlaceholderWellName( RifEclipseSummaryAddress* summaryAddress, const std::vector& wellNames ); - static void setPlaceholderWellGroupName( RifEclipseSummaryAddress* summaryAddress, - const std::vector& wellGroupNames ); + static void setPlaceholderGroupName( RifEclipseSummaryAddress* summaryAddress, const std::vector& groupNames ); static void setPlaceholderRegion( RifEclipseSummaryAddress* summaryAddress, const std::vector& regions ); }; diff --git a/ApplicationLibCode/FileInterface/RifEclEclipseSummary.cpp b/ApplicationLibCode/FileInterface/RifEclEclipseSummary.cpp index 7a3e1ef0c0..228e2b3a65 100644 --- a/ApplicationLibCode/FileInterface/RifEclEclipseSummary.cpp +++ b/ApplicationLibCode/FileInterface/RifEclEclipseSummary.cpp @@ -111,7 +111,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu std::string quantityName; int regionNumber( -1 ); int regionNumber2( -1 ); - std::string wellGroupName; + std::string groupName; std::string wellName; int wellSegmentNumber( -1 ); std::string lgrName; @@ -151,8 +151,8 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu break; case ECL_SMSPEC_GROUP_VAR: { - sumCategory = RifEclipseSummaryAddress::SUMMARY_WELL_GROUP; - wellGroupName = stringFromPointer( ertSumVarNode.get_wgname() ); + sumCategory = RifEclipseSummaryAddress::SUMMARY_GROUP; + groupName = stringFromPointer( ertSumVarNode.get_wgname() ); } break; case ECL_SMSPEC_BLOCK_VAR: @@ -239,7 +239,7 @@ RifEclipseSummaryAddress addressFromErtSmSpecNode( const ecl::smspec_node& ertSu quantityName, regionNumber, regionNumber2, - wellGroupName, + groupName, wellName, wellSegmentNumber, lgrName, diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index c512389c25..b9131c52ca 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -55,8 +55,8 @@ RifEclipseSummaryAddress::RifEclipseSummaryAddress( SummaryVarCategory m_regionNumber = reg2regPair.first; m_regionNumber2 = reg2regPair.second; break; - case SUMMARY_WELL_GROUP: - m_wellGroupName = identifiers[INPUT_WELL_GROUP_NAME]; + case SUMMARY_GROUP: + m_groupName = identifiers[INPUT_GROUP_NAME]; break; case SUMMARY_WELL: m_wellName = identifiers[INPUT_WELL_NAME]; @@ -251,13 +251,13 @@ RifEclipseSummaryAddress //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::wellGroupAddress( const std::string& quantityName, - const std::string& wellGroupName ) +RifEclipseSummaryAddress RifEclipseSummaryAddress::groupAddress( const std::string& quantityName, + const std::string& groupName ) { RifEclipseSummaryAddress addr; - addr.m_variableCategory = SUMMARY_WELL_GROUP; + addr.m_variableCategory = SUMMARY_GROUP; addr.m_quantityName = quantityName; - addr.m_wellGroupName = wellGroupName; + addr.m_groupName = groupName; return addr; } @@ -509,9 +509,9 @@ std::string RifEclipseSummaryAddress::itemUiText() const text += formatUiTextRegionToRegion(); } break; - case SUMMARY_WELL_GROUP: + case SUMMARY_GROUP: { - text += this->wellGroupName(); + text += this->groupName(); } break; case SUMMARY_WELL: @@ -584,8 +584,8 @@ std::string return formatUiTextRegionToRegion(); case INPUT_WELL_NAME: return wellName(); - case INPUT_WELL_GROUP_NAME: - return wellGroupName(); + case INPUT_GROUP_NAME: + return groupName(); case INPUT_CELL_IJK: return blockAsString(); case INPUT_LGR_NAME: @@ -643,8 +643,8 @@ bool RifEclipseSummaryAddress::isValid() const if ( m_regionNumber2 == -1 ) return false; return true; - case SUMMARY_WELL_GROUP: - if ( m_wellGroupName.size() == 0 ) return false; + case SUMMARY_GROUP: + if ( m_groupName.size() == 0 ) return false; return true; case SUMMARY_WELL: @@ -789,8 +789,8 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector } break; - case SUMMARY_WELL_GROUP: - if ( !token1.empty() ) return wellGroupAddress( quantityName, token1 ); + case SUMMARY_GROUP: + if ( !token1.empty() ) return groupAddress( quantityName, token1 ); break; case SUMMARY_WELL: @@ -889,7 +889,7 @@ bool RifEclipseSummaryAddress::isValidEclipseCategory() const case SUMMARY_MISC: case SUMMARY_REGION: case SUMMARY_REGION_2_REGION: - case SUMMARY_WELL_GROUP: + case SUMMARY_GROUP: case SUMMARY_WELL: case SUMMARY_WELL_COMPLETION: case SUMMARY_WELL_LGR: @@ -985,9 +985,9 @@ bool operator==( const RifEclipseSummaryAddress& first, const RifEclipseSummaryA if ( first.regionNumber2() != second.regionNumber2() ) return false; } break; - case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP: + case RifEclipseSummaryAddress::SUMMARY_GROUP: { - if ( first.wellGroupName() != second.wellGroupName() ) return false; + if ( first.groupName() != second.groupName() ) return false; } break; case RifEclipseSummaryAddress::SUMMARY_WELL: @@ -1083,10 +1083,9 @@ bool operator<( const RifEclipseSummaryAddress& first, const RifEclipseSummaryAd return first.regionNumber2() < second.regionNumber2(); } break; - case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP: + case RifEclipseSummaryAddress::SUMMARY_GROUP: { - if ( first.wellGroupName() != second.wellGroupName() ) - return first.wellGroupName() < second.wellGroupName(); + if ( first.groupName() != second.groupName() ) return first.groupName() < second.groupName(); } break; case RifEclipseSummaryAddress::SUMMARY_WELL: diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h index b26940c641..f807c1fc5f 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h @@ -47,7 +47,7 @@ class RifEclipseSummaryAddress SUMMARY_MISC, SUMMARY_REGION, SUMMARY_REGION_2_REGION, - SUMMARY_WELL_GROUP, + SUMMARY_GROUP, SUMMARY_WELL, SUMMARY_WELL_COMPLETION, SUMMARY_WELL_LGR, @@ -65,7 +65,7 @@ class RifEclipseSummaryAddress INPUT_REGION_NUMBER, INPUT_REGION_2_REGION, INPUT_WELL_NAME, - INPUT_WELL_GROUP_NAME, + INPUT_GROUP_NAME, INPUT_CELL_IJK, INPUT_LGR_NAME, INPUT_SEGMENT_NUMBER, @@ -93,7 +93,7 @@ class RifEclipseSummaryAddress const std::string& quantityName, int16_t regionNumber, int16_t regionNumber2, - const std::string& wellGroupName, + const std::string& groupName, const std::string& wellName, int16_t wellSegmentNumber, const std::string& lgrName, @@ -107,7 +107,7 @@ class RifEclipseSummaryAddress , m_quantityName( quantityName ) , m_regionNumber( regionNumber ) , m_regionNumber2( regionNumber2 ) - , m_wellGroupName( wellGroupName ) + , m_groupName( groupName ) , m_wellName( wellName ) , m_wellSegmentNumber( wellSegmentNumber ) , m_lgrName( lgrName ) @@ -136,7 +136,7 @@ class RifEclipseSummaryAddress static RifEclipseSummaryAddress regionAddress( const std::string& quantityName, int regionNumber ); static RifEclipseSummaryAddress regionToRegionAddress( const std::string& quantityName, int regionNumber, int region2Number ); - static RifEclipseSummaryAddress wellGroupAddress( const std::string& quantityName, const std::string& wellGroupName ); + static RifEclipseSummaryAddress groupAddress( const std::string& quantityName, const std::string& groupName ); static RifEclipseSummaryAddress wellAddress( const std::string& quantityName, const std::string& wellName ); static RifEclipseSummaryAddress wellCompletionAddress( const std::string& quantityName, const std::string& wellName, int i, int j, int k ); @@ -172,7 +172,7 @@ class RifEclipseSummaryAddress int regionNumber() const { return m_regionNumber; } int regionNumber2() const { return m_regionNumber2; } - const std::string& wellGroupName() const { return m_wellGroupName; } + const std::string& groupName() const { return m_groupName; } const std::string& wellName() const { return m_wellName; } int wellSegmentNumber() const { return m_wellSegmentNumber; } const std::string& lgrName() const { return m_lgrName; } @@ -195,7 +195,7 @@ class RifEclipseSummaryAddress bool isValid() const; void setQuantityName( const std::string& quantity ) { m_quantityName = quantity; } void setWellName( const std::string& wellName ) { m_wellName = wellName; } - void setWellGroupName( const std::string& wellGroupName ) { m_wellGroupName = wellGroupName; } + void setGroupName( const std::string& groupName ) { m_groupName = groupName; } void setRegion( int region ) { m_regionNumber = (int16_t)region; } void setAquiferNumber( int aquiferNumber ) { m_aquiferNumber = (int16_t)aquiferNumber; } void setCellIjk( const std::string& uiText ); @@ -219,7 +219,7 @@ class RifEclipseSummaryAddress std::pair regionToRegionPairFromUiText( const std::string& s ); std::string m_quantityName; - std::string m_wellGroupName; + std::string m_groupName; std::string m_wellName; std::string m_lgrName; int32_t m_cellI; diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp index 118ea83900..61b3d059de 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp @@ -152,7 +152,7 @@ void RifEclipseSummaryTools::dumpMetaData( RifSummaryReaderInterface* readerEcli for ( const auto& catAddresse : catAddresses ) { std::cout << catAddresse.quantityName() << " " << catAddresse.regionNumber() << " " - << catAddresse.regionNumber2() << " " << catAddresse.wellGroupName() << " " + << catAddresse.regionNumber2() << " " << catAddresse.groupName() << " " << catAddresse.wellName() << " " << catAddresse.wellSegmentNumber() << " " << catAddresse.lgrName() << " " << catAddresse.cellI() << " " << catAddresse.cellJ() << " " << catAddresse.cellK() << std::endl; diff --git a/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp index 36912a1381..600848236d 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp @@ -173,7 +173,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con int regionNumber = -1; int regionNumber2 = -1; - std::string wellGroupName = ""; + std::string groupName = ""; std::string wellName = ""; int wellSegmentNumber = -1; std::string lgrName = ""; @@ -210,11 +210,11 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con } case RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION: break; - case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP: + case RifEclipseSummaryAddress::SUMMARY_GROUP: { if ( columnHeaderText.size() > 0 ) { - wellGroupName = columnHeaderText[0]; + groupName = columnHeaderText[0]; } break; } @@ -284,7 +284,7 @@ RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( con quantityName, regionNumber, regionNumber2, - wellGroupName, + groupName, wellName, wellSegmentNumber, lgrName, diff --git a/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp b/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp index 4fb65e6061..6ac6923eee 100644 --- a/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp +++ b/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp @@ -292,7 +292,7 @@ RifEclipseSummaryAddress RifOpmCommonSummaryTools::createAddressFromSummaryNode( return RifEclipseSummaryAddress::wellAddress( summaryNode.keyword, summaryNode.wgname ); break; case Opm::EclIO::SummaryNode::Category::Group: - return RifEclipseSummaryAddress::wellGroupAddress( summaryNode.keyword, summaryNode.wgname ); + return RifEclipseSummaryAddress::groupAddress( summaryNode.keyword, summaryNode.wgname ); break; case Opm::EclIO::SummaryNode::Category::Field: return RifEclipseSummaryAddress::fieldAddress( summaryNode.keyword ); @@ -328,7 +328,7 @@ RifEclipseSummaryAddress RifOpmCommonSummaryTools::createAddressFromSummaryNode( // The vector "GPR" is defined as Node // The behavior in libecl is to use the category Group // https://github.com/OPM/ResInsight/issues/7838 - return RifEclipseSummaryAddress::wellGroupAddress( summaryNode.keyword, summaryNode.wgname ); + return RifEclipseSummaryAddress::groupAddress( summaryNode.keyword, summaryNode.wgname ); break; case Opm::EclIO::SummaryNode::Category::Network: return RifEclipseSummaryAddress::networkAddress( summaryNode.keyword ); diff --git a/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp b/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp index 0f0ec0bae0..e834f6ff2d 100644 --- a/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp @@ -161,7 +161,7 @@ RifEclipseSummaryAddress RifReaderObservedData::address( const QString& std::string quantityName = quantity.toStdString(); int regionNumber( -1 ); int regionNumber2( -1 ); - std::string wellGroupName; + std::string groupName; std::string wellName; int wellSegmentNumber( -1 ); std::string lgrName; @@ -174,8 +174,8 @@ RifEclipseSummaryAddress RifReaderObservedData::address( const QString& switch ( summaryCategory ) { - case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP: - wellGroupName = identifierName.toStdString(); + case RifEclipseSummaryAddress::SUMMARY_GROUP: + groupName = identifierName.toStdString(); break; case RifEclipseSummaryAddress::SUMMARY_WELL: wellName = identifierName.toStdString(); @@ -191,7 +191,7 @@ RifEclipseSummaryAddress RifReaderObservedData::address( const QString& quantityName, regionNumber, regionNumber2, - wellGroupName, + groupName, wellName, wellSegmentNumber, lgrName, diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp index 979cd4cd34..ce1fc8fdca 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.cpp @@ -81,7 +81,7 @@ RimWellPathCompletionSettings::RimWellPathCompletionSettings() CAF_PDM_InitField( &m_wellNameForExport, "WellNameForExport", QString(), "Well Name" ); m_wellNameForExport.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_wellGroupName, "WellGroupNameForExport", QString(), "Well Group Name" ); + CAF_PDM_InitField( &m_groupName, "WellGroupNameForExport", QString(), "Group Name" ); CAF_PDM_InitField( &m_referenceDepth, "ReferenceDepthForExport", QString(), "Reference Depth for BHP" ); CAF_PDM_InitFieldNoDefault( &m_preferredFluidPhase, "WellTypeForExport", "Preferred Fluid Phase" ); CAF_PDM_InitField( &m_drainageRadiusForPI, "DrainageRadiusForPI", QString( "0.0" ), "Drainage Radius for PI" ); @@ -113,7 +113,7 @@ RimWellPathCompletionSettings::RimWellPathCompletionSettings( const RimWellPathC RimWellPathCompletionSettings& RimWellPathCompletionSettings::operator=( const RimWellPathCompletionSettings& rhs ) { m_wellNameForExport = rhs.m_wellNameForExport; - m_wellGroupName = rhs.m_wellGroupName; + m_groupName = rhs.m_groupName; m_referenceDepth = rhs.m_referenceDepth; m_preferredFluidPhase = rhs.m_preferredFluidPhase; m_drainageRadiusForPI = rhs.m_drainageRadiusForPI; @@ -158,9 +158,9 @@ QString RimWellPathCompletionSettings::wellNameForExport() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimWellPathCompletionSettings::wellGroupNameForExport() const +QString RimWellPathCompletionSettings::groupNameForExport() const { - return formatStringForExport( m_wellGroupName, "1*" ); + return formatStringForExport( m_groupName, "1*" ); } //-------------------------------------------------------------------------------------------------- @@ -280,7 +280,7 @@ void RimWellPathCompletionSettings::defineUiOrdering( QString uiConfigName, caf: { caf::PdmUiGroup* compExportGroup = uiOrdering.addNewGroup( "Completion Export Parameters" ); compExportGroup->add( &m_wellNameForExport ); - compExportGroup->add( &m_wellGroupName ); + compExportGroup->add( &m_groupName ); compExportGroup->add( &m_referenceDepth ); compExportGroup->add( &m_preferredFluidPhase ); compExportGroup->add( &m_drainageRadiusForPI ); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h index b8d1b66588..07f4c1a25d 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathCompletionSettings.h @@ -69,7 +69,7 @@ class RimWellPathCompletionSettings : public caf::PdmObject void setWellNameForExport( const QString& name ); void updateWellPathNameHasChanged( const QString& newWellPathName, const QString& previousWellPathName ); QString wellNameForExport() const; - QString wellGroupNameForExport() const; + QString groupNameForExport() const; QString referenceDepthForExport() const; QString wellTypeNameForExport() const; @@ -99,7 +99,7 @@ class RimWellPathCompletionSettings : public caf::PdmObject friend class RimWellPathCompletions; caf::PdmField m_wellNameForExport; - caf::PdmField m_wellGroupName; + caf::PdmField m_groupName; caf::PdmField m_referenceDepth; caf::PdmField m_preferredFluidPhase; diff --git a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp index 656401d1de..dfe9c762e6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp @@ -104,14 +104,14 @@ bool RimDataSourceSteppingTools::updateAddressIfMatching( const QVariant& return true; } } - else if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ) + else if ( category == RifEclipseSummaryAddress::SUMMARY_GROUP ) { std::string oldString = oldValue.toString().toStdString(); std::string newString = newValue.toString().toStdString(); - if ( adr->wellGroupName() == oldString ) + if ( adr->groupName() == oldString ) { - adr->setWellGroupName( newString ); + adr->setGroupName( newString ); return true; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp index dc484057ed..bd2563aaa5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp @@ -75,10 +75,10 @@ bool RimMultiSummaryPlotNameHelper::isWellNameInTitle() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimMultiSummaryPlotNameHelper::isWellGroupNameInTitle() const +bool RimMultiSummaryPlotNameHelper::isGroupNameInTitle() const { return std::any_of( m_nameHelpers.begin(), m_nameHelpers.end(), []( auto nameHelper ) { - return nameHelper->isWellGroupNameInTitle(); + return nameHelper->isGroupNameInTitle(); } ); } @@ -174,11 +174,11 @@ std::string RimMultiSummaryPlotNameHelper::titleWellName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::string RimMultiSummaryPlotNameHelper::titleWellGroupName() const +std::string RimMultiSummaryPlotNameHelper::titleGroupName() const { for ( auto nameHelper : m_nameHelpers ) { - if ( nameHelper->isWellGroupNameInTitle() ) return nameHelper->titleWellGroupName(); + if ( nameHelper->isGroupNameInTitle() ) return nameHelper->titleGroupName(); } return ""; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h index 15057c87f1..89fca2321a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h @@ -32,7 +32,7 @@ class RimMultiSummaryPlotNameHelper : public RimSummaryNameHelper bool isPlotDisplayingSingleQuantity() const override; bool isWellNameInTitle() const override; - bool isWellGroupNameInTitle() const override; + bool isGroupNameInTitle() const override; bool isRegionInTitle() const override; bool isCaseInTitle() const override; bool isBlockInTitle() const override; @@ -43,7 +43,7 @@ class RimMultiSummaryPlotNameHelper : public RimSummaryNameHelper std::string titleQuantity() const override; std::string titleWellName() const override; - std::string titleWellGroupName() const override; + std::string titleGroupName() const override; std::string titleRegion() const override; std::string titleBlock() const override; std::string titleSegment() const override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp index 7e2c1b140f..b2499ad11a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp @@ -122,8 +122,8 @@ QList using AddressAppEnum = caf::AppEnum; options.push_back( caf::PdmOptionItemInfo( AddressAppEnum::uiText( RifEclipseSummaryAddress::SUMMARY_WELL ), RifEclipseSummaryAddress::SUMMARY_WELL ) ); - options.push_back( caf::PdmOptionItemInfo( AddressAppEnum::uiText( RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ), - RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ) ); + options.push_back( caf::PdmOptionItemInfo( AddressAppEnum::uiText( RifEclipseSummaryAddress::SUMMARY_GROUP ), + RifEclipseSummaryAddress::SUMMARY_GROUP ) ); return options; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp index 96f752f829..9003c24ce4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp @@ -35,7 +35,7 @@ void caf::AppEnum::setUp() addItem( RifEclipseSummaryAddress::SUMMARY_MISC, "SUMMARY_MISC", "Misc" ); addItem( RifEclipseSummaryAddress::SUMMARY_REGION, "SUMMARY_REGION", "Region" ); addItem( RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION, "SUMMARY_REGION_2_REGION", "Region-Region" ); - addItem( RifEclipseSummaryAddress::SUMMARY_WELL_GROUP, "SUMMARY_WELL_GROUP", "Group" ); + addItem( RifEclipseSummaryAddress::SUMMARY_GROUP, "SUMMARY_WELL_GROUP", "Group" ); addItem( RifEclipseSummaryAddress::SUMMARY_WELL, "SUMMARY_WELL", "Well" ); addItem( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION, "SUMMARY_WELL_COMPLETION", "Completion" ); addItem( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR, "SUMMARY_WELL_COMPLETION_LGR", "Lgr-Completion" ); @@ -64,7 +64,7 @@ RimSummaryAddress::RimSummaryAddress() CAF_PDM_InitFieldNoDefault( &m_quantityName, "SummaryQuantityName", "Quantity" ); CAF_PDM_InitFieldNoDefault( &m_regionNumber, "SummaryRegion", "Region" ); CAF_PDM_InitFieldNoDefault( &m_regionNumber2, "SummaryRegion2", "Region2" ); - CAF_PDM_InitFieldNoDefault( &m_wellGroupName, "SummaryWellGroup", "Group" ); + CAF_PDM_InitFieldNoDefault( &m_groupName, "SummaryWellGroup", "Group" ); CAF_PDM_InitFieldNoDefault( &m_wellName, "SummaryWell", "Well" ); CAF_PDM_InitFieldNoDefault( &m_wellSegmentNumber, "SummaryWellSegment", "Well Segment" ); CAF_PDM_InitFieldNoDefault( &m_lgrName, "SummaryLgr", "Grid" ); @@ -120,7 +120,7 @@ void RimSummaryAddress::setAddress( const RifEclipseSummaryAddress& addr ) m_quantityName = addr.quantityName().c_str(); m_regionNumber = addr.regionNumber(); m_regionNumber2 = addr.regionNumber2(); - m_wellGroupName = addr.wellGroupName().c_str(); + m_groupName = addr.groupName().c_str(); m_wellName = addr.wellName().c_str(); m_wellSegmentNumber = addr.wellSegmentNumber(); m_lgrName = addr.lgrName().c_str(); @@ -144,7 +144,7 @@ RifEclipseSummaryAddress RimSummaryAddress::address() m_quantityName().toStdString(), m_regionNumber(), m_regionNumber2(), - m_wellGroupName().toStdString(), + m_groupName().toStdString(), m_wellName().toStdString(), m_wellSegmentNumber(), m_lgrName().toStdString(), @@ -206,7 +206,7 @@ QString RimSummaryAddress::keywordForCategory( RifEclipseSummaryAddress::Summary // Return the keyword text for supported field replacement in plot templates if ( category == RifEclipseSummaryAddress::SUMMARY_WELL ) return m_wellName.keyword(); - if ( category == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ) return m_wellGroupName.keyword(); + if ( category == RifEclipseSummaryAddress::SUMMARY_GROUP ) return m_groupName.keyword(); if ( category == RifEclipseSummaryAddress::SUMMARY_REGION ) return m_regionNumber.keyword(); return {}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h index dc37e85205..50ecbb2653 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h @@ -74,7 +74,7 @@ class RimSummaryAddress : public caf::PdmObject caf::PdmField m_quantityName; caf::PdmField m_regionNumber; caf::PdmField m_regionNumber2; - caf::PdmField m_wellGroupName; + caf::PdmField m_groupName; caf::PdmField m_wellName; caf::PdmField m_wellSegmentNumber; caf::PdmField m_lgrName; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index 5958f342d3..da07c74050 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -131,7 +131,7 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::setaddToSubfolder( QString::fromStdString( address.wellGroupName() ), + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_GROUP: + groups->addToSubfolder( QString::fromStdString( address.groupName() ), CollectionContentType::WELL_GROUP, address, caseId, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h index a1e3790e78..216df03f7f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -42,7 +42,7 @@ class RimSummaryAddressCollection : public RimNamedObject FIELD, MISC, WELL_FOLDER, - WELL_GROUP_FOLDER, + GROUP_FOLDER, REGION_FOLDER }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp index 2405449e43..02a0ed4f96 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp @@ -75,8 +75,8 @@ RimSummaryCurveAppearanceCalculator::RimSummaryCurveAppearanceCalculator( const if ( curveDef.summaryCase() ) m_caseToAppearanceIdxMap[curveDef.summaryCase()] = -1; if ( !curveDef.summaryAddress().wellName().empty() ) m_welToAppearanceIdxMap[curveDef.summaryAddress().wellName()] = -1; - if ( !curveDef.summaryAddress().wellGroupName().empty() ) - m_grpToAppearanceIdxMap[curveDef.summaryAddress().wellGroupName()] = -1; + if ( !curveDef.summaryAddress().groupName().empty() ) + m_grpToAppearanceIdxMap[curveDef.summaryAddress().groupName()] = -1; if ( !( curveDef.summaryAddress().regionNumber() == -1 ) ) m_regToAppearanceIdxMap[curveDef.summaryAddress().regionNumber()] = -1; @@ -350,12 +350,12 @@ void RimSummaryCurveAppearanceCalculator::setupCurveLook( RimSummaryCurve* curve int caseAppearanceIdx = m_caseToAppearanceIdxMap[curve->summaryCaseY()]; int varAppearanceIdx = m_varToAppearanceIdxMap[curve->summaryAddressY().quantityName()]; int welAppearanceIdx = m_welToAppearanceIdxMap[curve->summaryAddressY().wellName()]; - int grpAppearanceIdx = m_grpToAppearanceIdxMap[curve->summaryAddressY().wellGroupName()]; + int grpAppearanceIdx = m_grpToAppearanceIdxMap[curve->summaryAddressY().groupName()]; int regAppearanceIdx = m_regToAppearanceIdxMap[curve->summaryAddressY().regionNumber()]; // Remove index for curves without value at the specific dimension if ( curve->summaryAddressY().wellName().empty() ) welAppearanceIdx = -1; - if ( curve->summaryAddressY().wellGroupName().empty() ) grpAppearanceIdx = -1; + if ( curve->summaryAddressY().groupName().empty() ) grpAppearanceIdx = -1; if ( curve->summaryAddressY().regionNumber() < 0 ) regAppearanceIdx = -1; setOneCurveAppearance( m_caseAppearanceType, m_allSummaryCaseNames.size(), caseAppearanceIdx, curve ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp index 858d374027..cee5a0f1f4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp @@ -49,7 +49,7 @@ RimSummaryCurveAutoName::RimSummaryCurveAutoName() CAF_PDM_InitField( &m_vectorName, "VectorName", true, "Vector Name"); CAF_PDM_InitField( &m_unit, "Unit", false, "Unit"); CAF_PDM_InitField( &m_regionNumber, "RegionNumber", true, "Region Number"); - CAF_PDM_InitField( &m_wellGroupName, "WellGroupName", true, "Group Name"); + CAF_PDM_InitField( &m_groupName, "WellGroupName", true, "Group Name"); CAF_PDM_InitField( &m_wellName, "WellName", true, "Well Name"); CAF_PDM_InitField(&m_wellSegmentNumber, "WellSegmentNumber", true, "Well Segment Number"); CAF_PDM_InitField( &m_lgrName, "LgrName", true, "Lgr Name"); @@ -141,7 +141,7 @@ void RimSummaryCurveAutoName::applySettings( const RimSummaryCurveAutoName& othe m_longVectorName = other.m_longVectorName; m_unit = other.m_unit; m_regionNumber = other.m_regionNumber; - m_wellGroupName = other.m_wellGroupName; + m_groupName = other.m_groupName; m_wellName = other.m_wellName; m_wellSegmentNumber = other.m_wellSegmentNumber; m_lgrName = other.m_lgrName; @@ -287,15 +287,15 @@ void RimSummaryCurveAutoName::appendAddressDetails( std::string& } } break; - case RifEclipseSummaryAddress::SUMMARY_WELL_GROUP: + case RifEclipseSummaryAddress::SUMMARY_GROUP: { - if ( m_wellGroupName ) + if ( m_groupName ) { - bool skipSubString = nameHelper && nameHelper->isWellGroupNameInTitle(); + bool skipSubString = nameHelper && nameHelper->isGroupNameInTitle(); if ( !skipSubString ) { if ( !text.empty() ) text += ":"; - text += summaryAddress.wellGroupName(); + text += summaryAddress.groupName(); } } } @@ -440,7 +440,7 @@ void RimSummaryCurveAutoName::defineUiOrdering( QString uiConfigName, caf::PdmUi uiOrdering.add( &m_caseName ); uiOrdering.add( &m_vectorName ); uiOrdering.add( &m_longVectorName ); - uiOrdering.add( &m_wellGroupName ); + uiOrdering.add( &m_groupName ); uiOrdering.add( &m_wellName ); caf::PdmUiGroup& advanced = *( uiOrdering.addNewGroup( "Advanced" ) ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h index 7687be16b5..786320caf1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h @@ -60,7 +60,7 @@ class RimSummaryCurveAutoName : public caf::PdmObject caf::PdmField m_longVectorName; caf::PdmField m_unit; caf::PdmField m_regionNumber; - caf::PdmField m_wellGroupName; + caf::PdmField m_groupName; caf::PdmField m_wellName; caf::PdmField m_wellSegmentNumber; caf::PdmField m_lgrName; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp index f56ca8b32c..949f5ae63f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp @@ -43,11 +43,11 @@ QString RimSummaryNameHelper::aggregatedPlotTitle( const RimSummaryNameHelper& o title += QString::fromStdString( wellName ); } - auto wellGroupName = this->titleWellGroupName(); - if ( !other.isWellGroupNameInTitle() && !wellGroupName.empty() ) + auto groupName = this->titleGroupName(); + if ( !other.isGroupNameInTitle() && !groupName.empty() ) { if ( !title.isEmpty() ) title += ", "; - title += QString::fromStdString( wellGroupName ); + title += QString::fromStdString( groupName ); } auto region = this->titleRegion(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h index e4278c00e6..215f9abbff 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h @@ -39,7 +39,7 @@ class RimSummaryNameHelper virtual bool isPlotDisplayingSingleQuantity() const = 0; virtual bool isWellNameInTitle() const = 0; - virtual bool isWellGroupNameInTitle() const = 0; + virtual bool isGroupNameInTitle() const = 0; virtual bool isRegionInTitle() const = 0; virtual bool isCaseInTitle() const = 0; virtual bool isBlockInTitle() const = 0; @@ -48,11 +48,11 @@ class RimSummaryNameHelper virtual QString caseName() const = 0; - virtual std::string titleQuantity() const = 0; - virtual std::string titleWellName() const = 0; - virtual std::string titleWellGroupName() const = 0; - virtual std::string titleRegion() const = 0; - virtual std::string titleBlock() const = 0; - virtual std::string titleSegment() const = 0; - virtual std::string titleCompletion() const = 0; + virtual std::string titleQuantity() const = 0; + virtual std::string titleWellName() const = 0; + virtual std::string titleGroupName() const = 0; + virtual std::string titleRegion() const = 0; + virtual std::string titleBlock() const = 0; + virtual std::string titleSegment() const = 0; + virtual std::string titleCompletion() const = 0; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 3c1e620c50..72db9acc68 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1981,8 +1981,8 @@ int RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* ad } else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) { - auto currentObjectString = curveAdr.wellGroupName(); - curveAdr.setWellGroupName( droppedName ); + auto currentObjectString = curveAdr.groupName(); + curveAdr.setGroupName( droppedName ); newCurveDef.setSummaryAddress( curveAdr ); newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp index 4c668a8901..6d4325385f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp @@ -130,9 +130,9 @@ bool RimSummaryPlotNameHelper::isWellNameInTitle() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimSummaryPlotNameHelper::isWellGroupNameInTitle() const +bool RimSummaryPlotNameHelper::isGroupNameInTitle() const { - return !m_titleWellGroupName.empty(); + return !m_titleGroupName.empty(); } //-------------------------------------------------------------------------------------------------- @@ -202,9 +202,9 @@ std::string RimSummaryPlotNameHelper::titleWellName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::string RimSummaryPlotNameHelper::titleWellGroupName() const +std::string RimSummaryPlotNameHelper::titleGroupName() const { - return m_titleWellGroupName; + return m_titleGroupName; } //-------------------------------------------------------------------------------------------------- @@ -262,11 +262,11 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings() { clearTitleSubStrings(); - auto wellNames = m_analyzer->wellNames(); - auto wellGroupNames = m_analyzer->wellGroupNames(); - auto regions = m_analyzer->regionNumbers(); - auto blocks = m_analyzer->blocks(); - auto categories = m_analyzer->categories(); + auto wellNames = m_analyzer->wellNames(); + auto groupNames = m_analyzer->groupNames(); + auto regions = m_analyzer->regionNumbers(); + auto blocks = m_analyzer->blocks(); + auto categories = m_analyzer->categories(); if ( categories.size() == 1 ) { @@ -293,9 +293,9 @@ void RimSummaryPlotNameHelper::extractPlotTitleSubStrings() } } - if ( wellGroupNames.size() == 1 ) + if ( groupNames.size() == 1 ) { - m_titleWellGroupName = *( wellGroupNames.begin() ); + m_titleGroupName = *( groupNames.begin() ); } if ( regions.size() == 1 ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h index 7e7435f962..cb6c3b95a6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h @@ -53,7 +53,7 @@ class RimSummaryPlotNameHelper : public RimSummaryNameHelper bool isPlotDisplayingSingleQuantity() const override; bool isWellNameInTitle() const override; - bool isWellGroupNameInTitle() const override; + bool isGroupNameInTitle() const override; bool isRegionInTitle() const override; bool isCaseInTitle() const override; bool isBlockInTitle() const override; @@ -64,7 +64,7 @@ class RimSummaryPlotNameHelper : public RimSummaryNameHelper std::string titleQuantity() const override; std::string titleWellName() const override; - std::string titleWellGroupName() const override; + std::string titleGroupName() const override; std::string titleRegion() const override; std::string titleBlock() const override; std::string titleSegment() const override; @@ -85,7 +85,7 @@ class RimSummaryPlotNameHelper : public RimSummaryNameHelper std::string m_titleQuantity; std::string m_titleWellName; - std::string m_titleWellGroupName; + std::string m_titleGroupName; std::string m_titleRegion; std::string m_titleBlock; std::string m_titleSegment; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 6931ce7daa..30e3a4505f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -63,7 +63,7 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() "Include Ensemble Cases in Case List" ); CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name" ); - CAF_PDM_InitFieldNoDefault( &m_wellGroupName, "GroupName", "Group Name" ); + CAF_PDM_InitFieldNoDefault( &m_groupName, "GroupName", "Group Name" ); CAF_PDM_InitFieldNoDefault( &m_region, "Region", "Region" ); CAF_PDM_InitFieldNoDefault( &m_quantity, "Quantities", "Quantity" ); @@ -321,9 +321,9 @@ QList { category = RifEclipseSummaryAddress::SUMMARY_REGION; } - else if ( fieldNeedingOptions == &m_wellGroupName ) + else if ( fieldNeedingOptions == &m_groupName ) { - category = RifEclipseSummaryAddress::SUMMARY_WELL_GROUP; + category = RifEclipseSummaryAddress::SUMMARY_GROUP; } else if ( fieldNeedingOptions == &m_cellBlock ) { @@ -436,7 +436,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* } m_wellName.uiCapability()->updateConnectedEditors(); - m_wellGroupName.uiCapability()->updateConnectedEditors(); + m_groupName.uiCapability()->updateConnectedEditors(); m_region.uiCapability()->updateConnectedEditors(); m_quantity.uiCapability()->updateConnectedEditors(); } @@ -459,7 +459,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* } m_wellName.uiCapability()->updateConnectedEditors(); - m_wellGroupName.uiCapability()->updateConnectedEditors(); + m_groupName.uiCapability()->updateConnectedEditors(); m_region.uiCapability()->updateConnectedEditors(); m_quantity.uiCapability()->updateConnectedEditors(); } @@ -505,9 +505,9 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* { summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_REGION; } - else if ( changedField == &m_wellGroupName ) + else if ( changedField == &m_groupName ) { - summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_WELL_GROUP; + summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_GROUP; } else if ( changedField == &m_cellBlock ) { @@ -614,9 +614,9 @@ caf::PdmValueField* RimSummaryPlotSourceStepping::fieldToModify() return &m_wellName; } - if ( analyzer.wellGroupNames().size() == 1 ) + if ( analyzer.groupNames().size() == 1 ) { - return &m_wellGroupName; + return &m_groupName; } if ( analyzer.regionNumbers().size() == 1 ) @@ -820,12 +820,12 @@ std::vector RimSummaryPlotSourceStepping::activeFieldsForD fieldsCommonForAllCurves.push_back( &m_wellName ); } - if ( analyzer.wellGroupNames().size() == 1 ) + if ( analyzer.groupNames().size() == 1 ) { - QString txt = QString::fromStdString( *( analyzer.wellGroupNames().begin() ) ); - m_wellGroupName = txt; + QString txt = QString::fromStdString( *( analyzer.groupNames().begin() ) ); + m_groupName = txt; - fieldsCommonForAllCurves.push_back( &m_wellGroupName ); + fieldsCommonForAllCurves.push_back( &m_groupName ); } if ( analyzer.regionNumbers().size() == 1 ) @@ -1000,7 +1000,7 @@ void RimSummaryPlotSourceStepping::defineEditorAttribute( const caf::PdmFieldHan nextText = RimSummaryPlotControls::caseNextKeyText(); prevText = RimSummaryPlotControls::casePrevKeyText(); } - else if ( field == &m_wellName || field == &m_wellGroupName || field == &m_region ) + else if ( field == &m_wellName || field == &m_groupName || field == &m_region ) { nextText = RimSummaryPlotControls::otherNextKeyText(); prevText = RimSummaryPlotControls::otherPrevKeyText(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index 8b22b2d80f..6c54b87510 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -97,7 +97,7 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject caf::PdmPtrField m_ensemble; caf::PdmField m_wellName; - caf::PdmField m_wellGroupName; + caf::PdmField m_groupName; caf::PdmField m_region; caf::PdmField m_quantity; caf::PdmField m_placeholderForLabel; diff --git a/ApplicationLibCode/UnitTests/RifEclipseSummaryAddress-Test.cpp b/ApplicationLibCode/UnitTests/RifEclipseSummaryAddress-Test.cpp index 40c39dec3e..9c45b6b2cc 100644 --- a/ApplicationLibCode/UnitTests/RifEclipseSummaryAddress-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifEclipseSummaryAddress-Test.cpp @@ -91,9 +91,9 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellGroup ) RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fromEclipseTextAddressParseErrorTokens( addrString ); EXPECT_TRUE( addr.isValid() ); - EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_GROUP, addr.category() ); + EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_GROUP, addr.category() ); EXPECT_EQ( "GOPR", addr.quantityName() ); - EXPECT_EQ( "WELLS1", addr.wellGroupName() ); + EXPECT_EQ( "WELLS1", addr.groupName() ); EXPECT_FALSE( addr.isErrorResult() ); } diff --git a/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp b/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp index ace8b00d5a..c6c93efa1d 100644 --- a/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp @@ -79,7 +79,7 @@ TEST( RiuSummaryQuantityNameInfoProvider, Test6x ) { std::string s( "GLIT" ); auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s ); - EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ); + EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_GROUP ); } { diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp index 968efe5a72..3e538b392b 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp @@ -583,329 +583,323 @@ std::unordered_mappdmField(), + CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_GROUP][0]->pdmField(), "WellGroupWellGroupNames", - "Well groups" ); - CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_GROUP][1]->pdmField(), + "Groups" ); + CAF_PDM_InitFieldNoDefault( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_GROUP][1]->pdmField(), "WellGroupVectors", "Well Group Vectors" ); @@ -959,14 +959,14 @@ void RiuSummaryVectorSelectionUi::defineUiOrdering( QString uiConfigName, caf::P summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION][1]->pdmField(); } - else if ( sumCategory == RifEclipseSummaryAddress::SUMMARY_WELL_GROUP ) + else if ( sumCategory == RifEclipseSummaryAddress::SUMMARY_GROUP ) { { - caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup( "Well Groups" ); - myGroup->add( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_GROUP][0]->pdmField() ); + caf::PdmUiGroup* myGroup = uiOrdering.addNewGroup( "Groups" ); + myGroup->add( m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_GROUP][0]->pdmField() ); } - summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_WELL_GROUP][1]->pdmField(); + summaryiesField = m_identifierFieldsMap[RifEclipseSummaryAddress::SUMMARY_GROUP][1]->pdmField(); } else if ( sumCategory == RifEclipseSummaryAddress::SUMMARY_WELL ) { @@ -1470,7 +1470,7 @@ void RiuSummaryVectorSelectionUi::appendOptionItemsForCategories( QList Date: Fri, 8 Apr 2022 10:46:54 +0200 Subject: [PATCH 232/406] #8782 Summary Plot: drag'n'drop data vector issue Duplicate only matching vectors More rename for Group --- .../RicAppendSummaryPlotsForObjectsFeature.cpp | 6 +++--- .../RicCreateMultiPlotFromSelectionFeature.cpp | 2 +- .../PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp | 2 +- .../Summary/RimSummaryAddressCollection.cpp | 6 +++--- .../Summary/RimSummaryAddressCollection.h | 2 +- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 9 ++++++--- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index d7bcb0bcdd..7643ed725f 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -132,7 +132,7 @@ void RicAppendSummaryPlotsForObjectsFeature::setupActionLook( QAction* actionToS { objectType = "Wells"; } - else if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) + else if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP ) { objectType = "Groups"; } @@ -218,7 +218,7 @@ bool RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( errorText = "Source plot must contain one well only to be able to duplicate a selection of wells"; } } - else if ( selectionType == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) + else if ( selectionType == RimSummaryAddressCollection::CollectionContentType::GROUP ) { if ( analyzer.groupNames().size() != 1 ) { @@ -268,7 +268,7 @@ RifEclipseSummaryAddress { adr.setWellName( objectName ); } - else if ( summaryAddressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) + else if ( summaryAddressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP ) { adr.setGroupName( objectName ); } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp index fcdfe4fada..2f0ce69d0c 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp @@ -72,7 +72,7 @@ void RicCreateMultiPlotFromSelectionFeature::onActionTriggered( bool isChecked ) { wellNames.push_back( a->name() ); } - else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) + else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP ) { groupNames.push_back( a->name() ); } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index f47ea96994..24adcfb19a 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -558,7 +558,7 @@ QString RicSummaryPlotTemplateTools::placeholderTextForWell() //-------------------------------------------------------------------------------------------------- QString RicSummaryPlotTemplateTools::placeholderTextForGroup() { - return "__WELL_GROUP__"; + return "__GROUP__"; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index da07c74050..4381a1ab55 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -29,7 +29,7 @@ void caf::AppEnum::setUp() { addItem( RimSummaryAddressCollection::CollectionContentType::NOT_DEFINED, "NOT_DEFINED", "Not Defined" ); addItem( RimSummaryAddressCollection::CollectionContentType::WELL, "WELL", "Well" ); - addItem( RimSummaryAddressCollection::CollectionContentType::WELL_GROUP, "WELL_GROUP", "Well Group" ); + addItem( RimSummaryAddressCollection::CollectionContentType::GROUP, "GROUP", "Group" ); addItem( RimSummaryAddressCollection::CollectionContentType::REGION, "REGION", "Region" ); addItem( RimSummaryAddressCollection::CollectionContentType::MISC, "MISC", "Miscellaneous" ); addItem( RimSummaryAddressCollection::CollectionContentType::FIELD, "FIELD", "Field" ); @@ -155,7 +155,7 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::setaddToSubfolder( QString::fromStdString( address.groupName() ), - CollectionContentType::WELL_GROUP, + CollectionContentType::GROUP, address, caseId, ensembleId ); @@ -220,7 +220,7 @@ bool RimSummaryAddressCollection::canBeDragged() const { bool ok = m_subfolders.size() == 0; - ok = ok && ( m_contentType == CollectionContentType::WELL || m_contentType == CollectionContentType::WELL_GROUP || + ok = ok && ( m_contentType == CollectionContentType::WELL || m_contentType == CollectionContentType::GROUP || m_contentType == CollectionContentType::REGION ); return ok; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h index 216df03f7f..b3b741fe94 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -37,7 +37,7 @@ class RimSummaryAddressCollection : public RimNamedObject { NOT_DEFINED, WELL, - WELL_GROUP, + GROUP, REGION, FIELD, MISC, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 72db9acc68..3f5cd77428 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1972,21 +1972,24 @@ int RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* ad { auto newCurveDef = curveDef; auto curveAdr = newCurveDef.summaryAddress(); - if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) + if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_WELL ) && + ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) ) { auto currentObjectString = curveAdr.wellName(); curveAdr.setWellName( droppedName ); newCurveDef.setSummaryAddress( curveAdr ); newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString ); } - else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_GROUP ) + else if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_GROUP ) && + ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP ) ) { auto currentObjectString = curveAdr.groupName(); curveAdr.setGroupName( droppedName ); newCurveDef.setSummaryAddress( curveAdr ); newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString ); } - else if ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) + else if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_REGION ) && + ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) ) { auto currentObjectString = std::to_string( curveAdr.regionNumber() ); From 30aaadb58c062f2648b1956ee9c1d121f8334319 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 8 Apr 2022 11:02:16 +0200 Subject: [PATCH 233/406] #8798 Summary Curve Selection : Always show ensemble realizations cases --- ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp | 2 -- .../UserInterface/RiuSummaryVectorSelectionUi.cpp | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 481f39cbf3..c94d08c708 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -1119,7 +1119,6 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, candicateAddress = m_xValuesSummaryAddress->address(); } - dlg.hideEnsembles(); dlg.setCaseAndAddress( candidateCase, candicateAddress ); if ( dlg.exec() == QDialog::Accepted ) @@ -1153,7 +1152,6 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, candicateAddress = m_yValuesSummaryAddress->address(); } - dlg.hideEnsembles(); dlg.setCaseAndAddress( candidateCase, candicateAddress ); if ( dlg.exec() == QDialog::Accepted ) diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp index 21a5d1ba7d..2d5d99da76 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp @@ -144,7 +144,7 @@ RiuSummaryVectorSelectionUi::RiuSummaryVectorSelectionUi() { RifEclipseSummaryAddress::SUMMARY_IMPORTED, { { new SummaryIdentifierAndField( RifEclipseSummaryAddress::INPUT_VECTOR_NAME ) } } }, } ) - , m_showIndividualEnsembleCases( false ) + , m_showIndividualEnsembleCases( true ) { CAF_PDM_InitFieldNoDefault( &m_selectedSources, "SummaryCases", "Cases" ); m_selectedSources.uiCapability()->setAutoAddingOptionFromValue( false ); From 82367e698f6fb6b43f7dd103b28de2a7d3a06233 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 8 Apr 2022 09:09:47 +0200 Subject: [PATCH 234/406] #8560 Fix gray background for default theme --- ApplicationExeCode/Resources/themes/default.qss | 4 ++++ ApplicationLibCode/RiuThemesDirectory.h.cmake | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ApplicationExeCode/Resources/themes/default.qss b/ApplicationExeCode/Resources/themes/default.qss index 0304d4cc46..45893da97c 100644 --- a/ApplicationExeCode/Resources/themes/default.qss +++ b/ApplicationExeCode/Resources/themes/default.qss @@ -84,6 +84,10 @@ QwtPlot["PvtPlot"]::lineMarker["*"] { color: $textColor; } +QLabel, RiuQwtPlotLegend { + background-color: transparent; +} + QwtPlot["PvtPlot"]::pointMarker["*"] { color: $textColor; } diff --git a/ApplicationLibCode/RiuThemesDirectory.h.cmake b/ApplicationLibCode/RiuThemesDirectory.h.cmake index a8572d890e..e945a82982 100644 --- a/ApplicationLibCode/RiuThemesDirectory.h.cmake +++ b/ApplicationLibCode/RiuThemesDirectory.h.cmake @@ -1,3 +1,3 @@ // Test data directory used by unit tests -#define GUI_THEMES_DIR "${CMAKE_CURRENT_LIST_DIR}/Resources/themes" \ No newline at end of file +#define GUI_THEMES_DIR "${CMAKE_CURRENT_LIST_DIR}/../ApplicationExeCode/Resources/themes" From a6eda226f446748ac37f1742450d2ea10720afe6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 19 Apr 2022 09:38:55 +0200 Subject: [PATCH 235/406] #8813 Regression Test : Fix crash in regression tests --- .../Summary/RimSummaryPlotSourceStepping.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 30e3a4505f..155648d3e5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -750,12 +750,14 @@ std::set RimSummaryPlotSourceStepping::summaryCasesCurveCollect //-------------------------------------------------------------------------------------------------- std::vector RimSummaryPlotSourceStepping::activeFieldsForDataSourceStepping( bool toolbarFields ) { + RimProject* proj = RimProject::current(); + if ( !proj ) return {}; + std::vector fields; auto sumCases = summaryCasesCurveCollection(); if ( sumCases.size() == 1 ) { - RimProject* proj = RimProject::current(); if ( proj->allSummaryCases().size() > 1 ) { m_summaryCase = *( sumCases.begin() ); @@ -768,8 +770,6 @@ std::vector RimSummaryPlotSourceStepping::activeFieldsForD auto ensembleColl = ensembleCollection(); if ( ensembleColl.size() == 1 ) { - RimProject* proj = RimProject::current(); - if ( proj->summaryGroups().size() > 1 ) { m_ensemble = *( ensembleColl.begin() ); From c41ab07c1aa03ffc35c674d7210a43fc69f397fc Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 19 Apr 2022 08:26:05 +0200 Subject: [PATCH 236/406] #8809 MultiPlot Snapshot: Use current page for snapshots --- .../UserInterface/RiuMultiPlotBook.cpp | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 46501fe82e..ce118f82b4 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -345,20 +345,29 @@ void RiuMultiPlotBook::renderTo( QPaintDevice* paintDevice ) int resolution = paintDevice->logicalDpiX(); double scaling = resolution / static_cast( RiaGuiApplication::applicationResolution() ); - bool firstPage = true; QPainter painter( paintDevice ); - for ( RiuMultiPlotPage* page : m_pages ) + + auto pagedDevice = dynamic_cast( paintDevice ); + if ( pagedDevice ) { - if ( !firstPage ) + bool firstPage = true; + for ( RiuMultiPlotPage* page : m_pages ) { - QPagedPaintDevice* pagedDevice = dynamic_cast( paintDevice ); - if ( pagedDevice ) + if ( !firstPage ) { pagedDevice->newPage(); } + page->renderTo( &painter, scaling ); + firstPage = false; + } + } + else + { + if ( m_currentPageIndex < m_pages.size() ) + { + auto page = m_pages[m_currentPageIndex]; + page->renderTo( &painter, scaling ); } - page->renderTo( &painter, scaling ); - firstPage = false; } } From db3395da44b9cc84bce5c7fbdee499c9d9c38375 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Tue, 19 Apr 2022 12:34:40 +0200 Subject: [PATCH 237/406] Fix Summary Multiplot subplot colspan issue (#8805) Fix colspan bug for summary multiplots --- .../Summary/RimSummaryMultiPlot.cpp | 16 ++- .../Summary/RimSummaryMultiPlot.h | 2 + .../UserInterface/CMakeLists_files.cmake | 5 +- .../UserInterface/RiuMultiPlotBook.cpp | 43 ++++--- .../UserInterface/RiuMultiPlotBook.h | 15 ++- .../UserInterface/RiuMultiPlotPage.h | 12 +- .../UserInterface/RiuSummaryMultiPlotBook.cpp | 110 ++++++++++++++++++ .../UserInterface/RiuSummaryMultiPlotBook.h | 42 +++++++ .../UserInterface/RiuSummaryMultiPlotPage.cpp | 1 + 9 files changed, 215 insertions(+), 31 deletions(-) create mode 100644 ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp create mode 100644 ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.h diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index a944c6b618..50aeac9d25 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -31,12 +31,12 @@ #include "RimSummaryCurve.h" #include "RimSummaryPlotControls.h" -#include "RimMultiPlot.h" #include "RimSummaryAddress.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotNameHelper.h" #include "RimSummaryPlotSourceStepping.h" +#include "RiuSummaryMultiPlotBook.h" #include "RiuSummaryVectorSelectionUi.h" #include "cafPdmUiComboBoxEditor.h" @@ -619,3 +619,17 @@ void RimSummaryMultiPlot::onSubPlotAxisChanged( const caf::SignalEmitter* emitte } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* RimSummaryMultiPlot::createViewWidget( QWidget* mainWindowParent ) +{ + if ( m_viewer.isNull() ) + { + m_viewer = new RiuSummaryMultiPlotBook( this, mainWindowParent ); + } + recreatePlotWidgets(); + + return m_viewer; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index c728fa3af5..f4828c29ee 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -87,6 +87,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void initAfterRead() override; + QWidget* createViewWidget( QWidget* mainWindowParent ) override; + private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; diff --git a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake index 891d30170a..1faccdfb4b 100644 --- a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake @@ -54,9 +54,10 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuPickItemInfo.h ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.h ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.h - ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryMultiPlotPage.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.h + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryMultiPlotPage.h + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryMultiPlotBook.h ${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.h ${CMAKE_CURRENT_LIST_DIR}/RiuPlotAxis.h ${CMAKE_CURRENT_LIST_DIR}/RiuQwtPlotWidget.h @@ -157,6 +158,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryMultiPlotPage.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryMultiPlotBook.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuPlotWidget.cpp @@ -259,6 +261,7 @@ list( ${CMAKE_CURRENT_LIST_DIR}/RiuTreeViewEventFilter.h ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogPlot.h ${CMAKE_CURRENT_LIST_DIR}/RiuWellLogTrack.h + ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryMultiPlotBook.h ${CMAKE_CURRENT_LIST_DIR}/RiuSummaryMultiPlotPage.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotPage.h ${CMAKE_CURRENT_LIST_DIR}/RiuMultiPlotBook.h diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index ce118f82b4..f8874f35a5 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -594,8 +594,9 @@ void RiuMultiPlotBook::createPages() m_pages[i]->setPlotTitle( QString( "%1 %2/%3" ).arg( m_plotTitle ).arg( pageNumber ).arg( m_pages.size() ) ); } } - m_book->adjustSize(); + adjustBookFrame(); } + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -609,20 +610,24 @@ const QList>& RiuMultiPlotBook::pages() const //-------------------------------------------------------------------------------------------------- RiuMultiPlotPage* RiuMultiPlotBook::createPage() { - RiuMultiPlotPage* page; + RiuMultiPlotPage* page = new RiuMultiPlotPage( m_plotDefinition, this ); - RimSummaryMultiPlot* sumMultPlot = dynamic_cast( m_plotDefinition.p() ); + applyPageSettings( page ); - if ( sumMultPlot ) - { - page = new RiuSummaryMultiPlotPage( sumMultPlot, this ); - } - else - { - page = new RiuMultiPlotPage( m_plotDefinition, this ); - } + m_pages.push_back( page ); + m_bookLayout->addWidget( page ); + + page->setVisible( true ); + return page; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::applyPageSettings( RiuMultiPlotPage* page ) +{ + if ( !page ) return; - // Reapply plot settings page->setPlotTitle( m_plotTitle ); page->setTitleFontSizes( m_plotDefinition->titleFontSize(), m_plotDefinition->subTitleFontSize() ); page->setLegendFontSize( m_plotDefinition->legendFontSize() ); @@ -630,12 +635,6 @@ RiuMultiPlotPage* RiuMultiPlotBook::createPage() page->setTitleVisible( m_titleVisible ); page->setSubTitlesVisible( m_subTitlesVisible ); page->setPagePreviewModeEnabled( m_previewMode ); - - m_pages.push_back( page ); - m_bookLayout->addWidget( page ); - - page->setVisible( true ); - return page; } //-------------------------------------------------------------------------------------------------- @@ -748,3 +747,11 @@ bool RiuMultiPlotBook::eventFilter( QObject* obj, QEvent* event ) } return QWidget::eventFilter( obj, event ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::adjustBookFrame() +{ + m_book->adjustSize(); +} diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index ff25420e97..99708e362d 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -113,12 +113,17 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow bool eventFilter( QObject* obj, QEvent* ev ) override; -private: - void deleteAllPages(); - void createPages(); + virtual void createPages(); + + void adjustBookFrame(); + void applyPageSettings( RiuMultiPlotPage* page ); + const QList>& pages() const; - RiuMultiPlotPage* createPage(); - void applyLook(); + +private: + RiuMultiPlotPage* createPage(); + void deleteAllPages(); + void applyLook(); void changeCurrentPage( int pageNumber ); diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h index e50cdb6dde..40cf4a2c3b 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h @@ -90,6 +90,11 @@ class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, p QSize minimumSizeHint() const override; int heightForWidth( int width ) const override; + std::pair findAvailableRowAndColumn( int startRow, int startColumn, int columnSpan, int columnCount ) const; + +public slots: + virtual void performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ); + protected: void contextMenuEvent( QContextMenuEvent* ) override; QLabel* createTitleLabel() const; @@ -117,17 +122,12 @@ class RiuMultiPlotPage : public QWidget, public caf::SelectionChangedReceiver, p QList> legendsForVisiblePlots() const; QList> subTitlesForVisiblePlots() const; - std::pair findAvailableRowAndColumn( int startRow, int startColumn, int columnSpan, int columnCount ) const; - void applyLook(); private slots: - virtual void performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ); - void onLegendUpdated(); + void onLegendUpdated(); protected: - friend class RiuMultiPlotBook; - QPointer m_layout; QPointer m_plotLayout; QPointer m_plotWidgetFrame; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp new file mode 100644 index 0000000000..db05009753 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp @@ -0,0 +1,110 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#include "RiuSummaryMultiPlotBook.h" + +#include "RimSummaryMultiPlot.h" + +#include "RiuSummaryMultiPlotPage.h" + +#include "RiuPlotWidget.h" + +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuSummaryMultiPlotBook::RiuSummaryMultiPlotBook( RimSummaryMultiPlot* plotDefinition, QWidget* parent ) + : RiuMultiPlotBook( plotDefinition, parent ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuSummaryMultiPlotBook::~RiuSummaryMultiPlotBook() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuSummaryMultiPlotBook::createPages() +{ + CAF_ASSERT( m_plotDefinition ); + + QList> plotWidgets = this->visiblePlotWidgets(); + + int columns = std::max( 1, m_plotDefinition->columnCount() ); + int rowsPerPage = m_plotDefinition->rowsPerPage(); + + int row = 0; + int col = 0; + + RiuSummaryMultiPlotPage* page = createSummaryPage(); + + for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex ) + { + int expectedColSpan = static_cast( plotWidgets[visibleIndex]->colSpan() ); + int colSpan = std::min( expectedColSpan, columns ); + + if ( row >= rowsPerPage ) + { + row = 0; + page = createSummaryPage(); + } + + page->addPlot( plotWidgets[visibleIndex] ); + page->performUpdate( RiaDefines::MultiPlotPageUpdateType::ALL ); + + col += colSpan; + if ( col >= columns ) + { + row++; + col = 0; + } + } + + // Set page numbers in title when there's more than one page + if ( m_pages.size() > 1 ) + { + for ( int i = 0; i < m_pages.size(); ++i ) + { + int pageNumber = i + 1; + m_pages[i]->setPlotTitle( QString( "%1 %2/%3" ).arg( m_plotTitle ).arg( pageNumber ).arg( m_pages.size() ) ); + } + } + adjustBookFrame(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuSummaryMultiPlotPage* RiuSummaryMultiPlotBook::createSummaryPage() +{ + RimSummaryMultiPlot* sumMultPlot = dynamic_cast( m_plotDefinition.p() ); + RiuSummaryMultiPlotPage* page = new RiuSummaryMultiPlotPage( sumMultPlot, this ); + + applyPageSettings( page ); + + m_pages.push_back( page ); + m_bookLayout->addWidget( page ); + + page->setVisible( true ); + return page; +} diff --git a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.h new file mode 100644 index 0000000000..7d3561f410 --- /dev/null +++ b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.h @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include "RiuMultiPlotBook.h" + +class RimSummaryMultiPlot; +class RiuSummaryMultiPlotPage; + +//================================================================================================== +// +// +//================================================================================================== +class RiuSummaryMultiPlotBook : public RiuMultiPlotBook +{ + Q_OBJECT + +public: + RiuSummaryMultiPlotBook( RimSummaryMultiPlot* plotDefinition, QWidget* parent = nullptr ); + ~RiuSummaryMultiPlotBook() override; + +protected: + void createPages() override; + +private: + RiuSummaryMultiPlotPage* createSummaryPage(); +}; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp index ae40c70197..45f6f3a263 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp @@ -147,6 +147,7 @@ void RiuSummaryMultiPlotPage::reinsertPlotWidgets() } visibleIndex++; + col += colSpan - 1; } } } From 3a461473d08c5457a1dc9fb88607d2ed570834da Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 6 Apr 2022 15:34:14 +0200 Subject: [PATCH 238/406] #8767 Multi Plot: Add support for computing range for a summary curve across all realization, regions or wells. --- .../Summary/RimSummaryMultiPlot.cpp | 192 ++++++++++++++++++ .../Summary/RimSummaryMultiPlot.h | 11 + 2 files changed, 203 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 50aeac9d25..7f91f3adaa 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -18,9 +18,14 @@ #include "RimSummaryMultiPlot.h" +#include "RiaApplication.h" +#include "RiaPlotDefines.h" #include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryStringTools.h" +#include "RifEclEclipseSummary.h" +#include "RifEclipseRftAddress.h" +#include "RifEclipseSummaryAddress.h" #include "RimEnsembleCurveSet.h" #include "RimMainPlotCollection.h" #include "RimMultiPlotCollection.h" @@ -45,6 +50,20 @@ #include "cafPdmUiTreeSelectionEditor.h" #include +#include + +namespace caf +{ +template <> +void AppEnum::setUp() +{ + addItem( RimSummaryMultiPlot::AxisRangeAggregation::NONE, "NONE", "Disabled" ); + addItem( RimSummaryMultiPlot::AxisRangeAggregation::WELLS, "WELLS", "Wells" ); + addItem( RimSummaryMultiPlot::AxisRangeAggregation::REGIONS, "REGIONS", "Regions" ); + addItem( RimSummaryMultiPlot::AxisRangeAggregation::REALIZATIONS, "REALIZATIONS", "Realizations" ); + setDefault( RimSummaryMultiPlot::AxisRangeAggregation::NONE ); +} +} // namespace caf CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); //-------------------------------------------------------------------------------------------------- @@ -75,6 +94,7 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() m_disableWheelZoom.uiCapability()->setUiIconFromResourceString( ":/DisableZoom.png" ); CAF_PDM_InitField( &m_syncSubPlotAxes, "SyncSubPlotAxes", false, "Sync Subplot Axes" ); + CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Aggregation" ); CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); m_sourceStepping = new RimSummaryPlotSourceStepping; @@ -293,6 +313,7 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde auto axesGroup = uiOrdering.addNewGroup( "Axes" ); axesGroup->add( &m_syncSubPlotAxes ); + axesGroup->add( &m_axisRangeAggregation ); auto dataSourceGroup = uiOrdering.addNewGroup( "Data Source" ); m_sourceStepping()->uiOrdering( uiConfigName, *dataSourceGroup ); @@ -326,6 +347,13 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi { syncAxisRanges(); } + else if ( changedField == &m_axisRangeAggregation ) + { + if ( m_axisRangeAggregation() != AxisRangeAggregation::NONE ) + computeAggregatedAxisRange(); + else + onLoadDataAndUpdate(); + } else { RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue ); @@ -566,6 +594,170 @@ void RimSummaryMultiPlot::syncAxisRanges() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::computeAggregatedAxisRange() +{ + auto readValues = []( RimSummaryCase* summaryCase, RifEclipseSummaryAddress addr ) { + std::vector values; + if ( summaryCase && summaryCase->summaryReader() ) + { + RifSummaryReaderInterface* reader = summaryCase->summaryReader(); + reader->values( addr, &values ); + } + + return values; + }; + + auto findMinMaxForSummaryCase = [readValues]( RimSummaryCase* summaryCase, RifEclipseSummaryAddress addr ) { + auto values = readValues( summaryCase, addr ); + if ( values.empty() ) return std::make_pair( HUGE_VAL, -HUGE_VAL ); + + auto minMaxPair = std::minmax_element( values.begin(), values.end() ); + double caseMinimum = *minMaxPair.first; + double caseMaximum = *minMaxPair.second; + + return std::make_pair( caseMinimum, caseMaximum ); + }; + + auto summaryCasesForCurve = []( RimSummaryCurve* curve, AxisRangeAggregation axisRangeAggregation ) { + std::vector summaryCases; + + if ( axisRangeAggregation == AxisRangeAggregation::REALIZATIONS ) + { + if ( curve->summaryCaseY() ) + { + auto ensemble = curve->summaryCaseY()->ensemble(); + if ( ensemble ) + { + summaryCases = ensemble->allSummaryCases(); + } + else + { + summaryCases.push_back( curve->summaryCaseY() ); + } + } + } + else if ( axisRangeAggregation == AxisRangeAggregation::WELLS || + axisRangeAggregation == AxisRangeAggregation::REGIONS ) + { + // Use only the current summary case when aggregation across wells/regions + summaryCases.push_back( curve->summaryCaseY() ); + } + + return summaryCases; + }; + + auto addressesForCurve = []( RimSummaryCurve* curve, AxisRangeAggregation axisRangeAggregation ) { + std::vector addresses; + + if ( axisRangeAggregation == AxisRangeAggregation::REALIZATIONS ) + { + RifEclipseSummaryAddress addr = + RifEclipseSummaryAddress::fieldAddress( curve->summaryAddressY().quantityName() ); + addresses = { addr }; + } + else if ( axisRangeAggregation == AxisRangeAggregation::WELLS || + axisRangeAggregation == AxisRangeAggregation::REGIONS ) + { + RiaSummaryAddressAnalyzer analyzer; + auto ensemble = curve->summaryCaseY()->ensemble(); + if ( ensemble ) + { + analyzer.appendAddresses( ensemble->ensembleSummaryAddresses() ); + } + else + { + analyzer.appendAddresses( curve->summaryCaseY()->summaryReader()->allResultAddresses() ); + } + + if ( axisRangeAggregation == AxisRangeAggregation::WELLS ) + { + for ( auto wellName : analyzer.wellNames() ) + { + addresses.push_back( + RifEclipseSummaryAddress::wellAddress( curve->summaryAddressY().quantityName(), wellName ) ); + } + } + + if ( axisRangeAggregation == AxisRangeAggregation::REGIONS ) + { + for ( auto regionNumber : analyzer.regionNumbers() ) + { + addresses.push_back( RifEclipseSummaryAddress::regionAddress( curve->summaryAddressY().quantityName(), + regionNumber ) ); + } + } + } + + return addresses; + }; + + auto findMinMaxForAddressesInSummaryCases = + [findMinMaxForSummaryCase]( const std::vector& addresses, + const std::vector& summaryCases ) { + double minimum = HUGE_VAL; + double maximum = -HUGE_VAL; + for ( auto summaryCase : summaryCases ) + { + for ( auto addr : addresses ) + { + auto [caseMinimum, caseMaximum] = findMinMaxForSummaryCase( summaryCase, addr ); + minimum = std::min( minimum, caseMinimum ); + maximum = std::max( maximum, caseMaximum ); + } + } + + return std::make_pair( minimum, maximum ); + }; + + // gather current min/max values for each category (axis label) + for ( auto plot : summaryPlots() ) + { + std::map> axisRanges; + + for ( auto axis : plot->plotAxes() ) + { + for ( auto curve : plot->summaryAndEnsembleCurves() ) + { + if ( curve->axisY() == axis->plotAxisType() ) + { + std::vector summaryCases = summaryCasesForCurve( curve, m_axisRangeAggregation() ); + std::vector addresses = addressesForCurve( curve, m_axisRangeAggregation() ); + + auto [minimum, maximum] = findMinMaxForAddressesInSummaryCases( addresses, summaryCases ); + + if ( axisRanges.count( axis->plotAxisType() ) == 0 ) + { + axisRanges[axis->plotAxisType()] = std::make_pair( minimum, maximum ); + } + else + { + auto& [currentMin, currentMax] = axisRanges[axis->plotAxisType()]; + axisRanges[axis->plotAxisType()] = + std::make_pair( std::min( currentMin, minimum ), std::max( currentMax, maximum ) ); + } + } + } + } + + // set all plots to use the global min/max values for each category + for ( auto axis : plot->plotAxes() ) + { + const auto& [minVal, maxVal] = axisRanges[axis->plotAxisType()]; + if ( axis->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT && minVal <= maxVal ) + { + axis->setAutoZoom( false ); + axis->setVisibleRangeMin( minVal ); + axis->setVisibleRangeMax( maxVal ); + } + } + + plot->updateAxes(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index f4828c29ee..0d09907328 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -48,6 +48,14 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep caf::Signal duplicatePlot; public: + enum class AxisRangeAggregation + { + NONE, + REGIONS, + WELLS, + REALIZATIONS + }; + RimSummaryMultiPlot(); ~RimSummaryMultiPlot() override; @@ -98,6 +106,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep caf::PdmUiEditorAttribute* attribute ) override; void updatePlotWindowTitle() override; + void computeAggregatedAxisRange(); void duplicate(); @@ -112,6 +121,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep caf::PdmField m_createPlotDuplicate; caf::PdmField m_syncSubPlotAxes; + caf::PdmField> m_axisRangeAggregation; + caf::PdmChildField m_sourceStepping; std::unique_ptr m_nameHelper; From 87b822a80f873c799cdeb9d66cd5918456d92e1c Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 20 Apr 2022 14:25:47 +0200 Subject: [PATCH 239/406] Curve Style : Add support for curve fitting for non-solid line styles --- .../ProjectDataModel/RimPlotCurve.cpp | 7 +++ .../RimPlotCurveAppearance.cpp | 53 +++++++++++-------- .../ProjectDataModel/RimPlotCurveAppearance.h | 4 ++ .../UserInterface/RiuPlotCurve.h | 2 + .../UserInterface/RiuQtChartsPlotCurve.cpp | 8 +++ .../UserInterface/RiuQtChartsPlotCurve.h | 1 + .../UserInterface/RiuQwtPlotCurve.cpp | 25 +++++++++ .../UserInterface/RiuQwtPlotCurve.h | 2 + ThirdParty/qwt | 2 +- 9 files changed, 82 insertions(+), 22 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index 19e34c3760..f5108e91c3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -914,6 +914,13 @@ void RimPlotCurve::updateCurveAppearance() legendIconSize.setWidth( width ); m_plotCurve->setLegendIconSize( legendIconSize ); } + + double tolerance = 0.0; + if ( m_curveAppearance->lineStyle() != RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ) + { + tolerance = m_curveAppearance->curveFittingTolerance(); + } + m_plotCurve->setCurveFittingTolerance( tolerance ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp index 62d84becd4..08e96ad8fe 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp @@ -106,6 +106,13 @@ RimPlotCurveAppearance::RimPlotCurveAppearance() "Minimum pixel distance between symbols", "" ); + CAF_PDM_InitField( &m_curveFittingTolerance, + "CurveFittingTolerance", + 1.0f, + "Curve Fitting Tolerance", + "", + "Value above 0 : Curve fitting tolerance (default 1.0), 0 : disable curve fitting" ); + CAF_PDM_InitFieldNoDefault( &m_symbolLabel, "SymbolLabel", "Symbol Label" ); CAF_PDM_InitField( &m_symbolSize, "SymbolSize", 6, "Symbol Size" ); @@ -126,30 +133,23 @@ void RimPlotCurveAppearance::fieldChangedByUi( const caf::PdmFieldHandle* change const QVariant& oldValue, const QVariant& newValue ) { - if ( &m_curveColor == changedField || &m_curveThickness == changedField || &m_pointSymbol == changedField || - &m_lineStyle == changedField || &m_symbolSkipPixelDistance == changedField || - &m_curveInterpolation == changedField || &m_symbolSize == changedField || &m_symbolEdgeColor == changedField || - &m_fillStyle == changedField || &m_fillColor == changedField ) + if ( &m_pointSymbol == changedField ) { - if ( &m_pointSymbol == changedField ) - { - m_symbolSize.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuPlotCurveSymbol::SYMBOL_NONE ); - m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuPlotCurveSymbol::SYMBOL_NONE ); - } - else if ( &m_lineStyle == changedField ) - { - m_curveThickness.uiCapability()->setUiReadOnly( m_lineStyle() == + m_symbolSize.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuPlotCurveSymbol::SYMBOL_NONE ); + m_symbolSkipPixelDistance.uiCapability()->setUiReadOnly( m_pointSymbol() == RiuPlotCurveSymbol::SYMBOL_NONE ); + } + else if ( &m_lineStyle == changedField ) + { + m_curveThickness.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); + m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() == RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); - m_curveInterpolation.uiCapability()->setUiReadOnly( m_lineStyle() == - RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_NONE ); - } - else if ( &m_fillColor == changedField ) - { - fillColorChanged.send(); - } - - appearanceChanged.send(); } + else if ( &m_fillColor == changedField ) + { + fillColorChanged.send(); + } + + appearanceChanged.send(); } //-------------------------------------------------------------------------------------------------- @@ -198,6 +198,9 @@ void RimPlotCurveAppearance::defineUiOrdering( QString uiConfigName, caf::PdmUiO uiOrdering.add( &m_lineStyle ); uiOrdering.add( &m_curveThickness ); + uiOrdering.add( &m_curveFittingTolerance ); + m_curveFittingTolerance.uiCapability()->setUiReadOnly( m_lineStyle() == + RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); uiOrdering.add( &m_fillStyle ); m_fillStyle.uiCapability()->setUiHidden( !m_fillOptionsVisible ); @@ -422,6 +425,14 @@ cvf::Color3f RimPlotCurveAppearance::fillColor() const return m_fillColor; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +float RimPlotCurveAppearance::curveFittingTolerance() const +{ + return m_curveFittingTolerance(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h index 1159649f2e..f251c52c92 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h @@ -84,6 +84,8 @@ class RimPlotCurveAppearance : public caf::PdmObject void setFillColor( const cvf::Color3f& fillColor ); cvf::Color3f fillColor() const; + float curveFittingTolerance() const; + void setInterpolation( RiuQwtPlotCurveDefines::CurveInterpolationEnum ); RiuQwtPlotCurveDefines::CurveInterpolationEnum interpolation() const; @@ -109,6 +111,8 @@ class RimPlotCurveAppearance : public caf::PdmObject caf::PdmField m_curveThickness; caf::PdmField m_symbolSkipPixelDistance; + caf::PdmField m_curveFittingTolerance; + caf::PdmField m_pointSymbol; caf::PdmField m_lineStyle; caf::PdmField m_fillStyle; diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurve.h b/ApplicationLibCode/UserInterface/RiuPlotCurve.h index f770b52fa4..44cca14c3a 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuPlotCurve.h @@ -129,6 +129,8 @@ class RiuPlotCurve virtual RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const = 0; + virtual void setCurveFittingTolerance( double tolerance ) = 0; + protected: virtual void setSamplesInPlot( const std::vector& xValues, const std::vector& yValues ) = 0; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index 8faf157f69..aeb5ba98aa 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -581,6 +581,14 @@ RiuPlotCurveSymbol* RiuQtChartsPlotCurve::createSymbol( RiuPlotCurveSymbol::Poin return new RiuQtChartsPlotCurveSymbol( symbol ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setCurveFittingTolerance( double tolerance ) +{ + // Not supported +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h index d42e86192e..e312a35deb 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h @@ -80,6 +80,7 @@ class RiuQtChartsPlotCurve : public QObject, public RiuPlotCurve void updateLineAndAreaSeries(); RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override; + void setCurveFittingTolerance( double tolerance ) override; void updateScatterSeries(); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index fa7782ec86..29954f5cc0 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -35,6 +35,7 @@ #include "qwt_point_mapper.h" #include "qwt_scale_map.h" #include "qwt_symbol.h" +#include "qwt_weeding_curve_fitter.h" #include #include @@ -520,3 +521,27 @@ RiuPlotCurveSymbol* RiuQwtPlotCurve::createSymbol( RiuPlotCurveSymbol::PointSymb { return new RiuQwtSymbol( symbol ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::setCurveFittingTolerance( double tolerance ) +{ + bool enableCurveFitting = ( tolerance > 0.0 ); + if ( !enableCurveFitting ) + { + setCurveAttribute( QwtPlotCurve::Fitted, false ); + } + else + { + auto cf = dynamic_cast( curveFitter() ); + if ( !cf ) + { + cf = new QwtWeedingCurveFitter; + setCurveFitter( cf ); + } + setCurveAttribute( QwtPlotCurve::Fitted, true ); + + cf->setTolerance( tolerance ); + } +} diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h index 1bf1e5b673..5654fe4d57 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h @@ -81,6 +81,8 @@ class RiuQwtPlotCurve : public RiuPlotCurve, public QwtPlotCurve void setSymbol( RiuPlotCurveSymbol* symbol ) override; RiuPlotCurveSymbol* createSymbol( RiuPlotCurveSymbol::PointSymbolEnum symbol ) const override; + void setCurveFittingTolerance( double tolerance ) override; + protected: void drawCurve( QPainter* p, int style, diff --git a/ThirdParty/qwt b/ThirdParty/qwt index a7272f8e85..886436d422 160000 --- a/ThirdParty/qwt +++ b/ThirdParty/qwt @@ -1 +1 @@ -Subproject commit a7272f8e852d2e5113f58fb5d1f50946330bf68b +Subproject commit 886436d42226eb2f978735717da03d4e1a912d55 From ed87c9028c936263eadbc6985c96cb3628259bbf Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 20 Apr 2022 10:31:27 +0200 Subject: [PATCH 240/406] #8792 Summary Multiple Axes : Remove axis after delete in project tree --- .../UserInterface/RiuQwtPlotWidget.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index a1fd7d90d4..2853f282f4 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -1288,6 +1288,18 @@ bool RiuQwtPlotWidget::isMultiAxisSupported() const //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::pruneAxes( const std::set& usedAxes ) { + // Make a list of axes to remove since moving the axis invalidates the m_axisMapping iterator + std::vector axesToRemove; + for ( auto [plotAxis, qwtMapping] : m_axisMapping ) + { + if ( usedAxes.count( plotAxis ) == 0 ) + { + axesToRemove.push_back( plotAxis ); + } + } + + for ( auto plotAxis : axesToRemove ) + moveAxis( plotAxis, RiuPlotAxis::defaultLeft() ); } //-------------------------------------------------------------------------------------------------- From caaca138c064500b1a69f8cbf91dfc7e1951299f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 20 Apr 2022 14:29:40 +0200 Subject: [PATCH 241/406] Curve Colors : Add support for color assignment based on summary phase (oil, gas or water) --- .../Application/RiaPreferences.cpp | 12 + .../Application/RiaPreferences.h | 2 + .../RimSummaryCurveAppearanceCalculator.cpp | 285 ++++++++++-------- .../RimSummaryCurveAppearanceCalculator.h | 16 +- .../Summary/RimSummaryPlot.cpp | 82 +++-- .../ProjectDataModel/Summary/RimSummaryPlot.h | 10 +- 6 files changed, 254 insertions(+), 153 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index 39d0254929..f691d8fc7c 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -262,6 +262,9 @@ RiaPreferences::RiaPreferences() CAF_PDM_InitFieldNoDefault( &m_systemPreferences, "systemPreferences", "systemPreferences" ); m_systemPreferences = new RiaPreferencesSystem; + + CAF_PDM_InitField( &m_curveColorByPhase, "curveColorByPhase", true, "Curve Color By Phase" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_curveColorByPhase ); } //-------------------------------------------------------------------------------------------------- @@ -385,6 +388,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Plot Templates" ); group->add( &m_plotTemplateFolders ); group->add( &m_searchPlotTemplateFoldersRecursively ); + group->add( &m_curveColorByPhase ); caf::PdmUiGroup* pageSetup = uiOrdering.addNewGroup( "Page Setup" ); pageSetup->add( &m_pageSize ); @@ -746,6 +750,14 @@ bool RiaPreferences::useQtChartsAsDefaultPlotType() const return m_useQtChartsPlotByDefault; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaPreferences::colorCurvesByPhase() const +{ + return m_curveColorByPhase(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferences.h b/ApplicationLibCode/Application/RiaPreferences.h index 9f112e8eba..700cf537d6 100644 --- a/ApplicationLibCode/Application/RiaPreferences.h +++ b/ApplicationLibCode/Application/RiaPreferences.h @@ -83,6 +83,7 @@ class RiaPreferences : public caf::PdmObject void setDefaultPlotTemplatePath( const QString& templatePath ); bool openExportedPdfInViewer() const; bool useQtChartsAsDefaultPlotType() const; + bool colorCurvesByPhase() const; RiaDefines::ThemeEnum guiTheme() const; @@ -187,6 +188,7 @@ class RiaPreferences : public caf::PdmObject caf::PdmField m_searchPlotTemplateFoldersRecursively; caf::PdmField m_defaultPlotTemplate; caf::PdmField m_useQtChartsPlotByDefault; + caf::PdmField m_curveColorByPhase; // Script paths caf::PdmField m_octaveExecutable; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp index 02a0ed4f96..29b75638db 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp @@ -19,6 +19,7 @@ #include "RimSummaryCurveAppearanceCalculator.h" #include "RiaColorTables.h" +#include "RiaPreferences.h" #include "RiaSummaryCurveDefinition.h" #include "RiuQwtPlotCurve.h" @@ -65,96 +66,25 @@ bool isExcplicitHandled( char secondChar ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryCurveAppearanceCalculator::RimSummaryCurveAppearanceCalculator( const std::set& curveDefinitions ) +RimSummaryCurveAppearanceCalculator::RimSummaryCurveAppearanceCalculator( + const std::vector& curveDefinitions ) { - m_allSummaryCaseNames = getAllSummaryCaseNames(); - m_allSummaryWellNames = getAllSummaryWellNames(); - - for ( const RiaSummaryCurveDefinition& curveDef : curveDefinitions ) - { - if ( curveDef.summaryCase() ) m_caseToAppearanceIdxMap[curveDef.summaryCase()] = -1; - if ( !curveDef.summaryAddress().wellName().empty() ) - m_welToAppearanceIdxMap[curveDef.summaryAddress().wellName()] = -1; - if ( !curveDef.summaryAddress().groupName().empty() ) - m_grpToAppearanceIdxMap[curveDef.summaryAddress().groupName()] = -1; - if ( !( curveDef.summaryAddress().regionNumber() == -1 ) ) - m_regToAppearanceIdxMap[curveDef.summaryAddress().regionNumber()] = -1; - - if ( !curveDef.summaryAddress().quantityName().empty() ) - { - std::string varname = curveDef.summaryAddress().quantityName(); - - if ( curveDef.summaryAddress().isHistoryQuantity() ) - { - varname = varname.substr( 0, varname.size() - 1 ); - } - - m_varToAppearanceIdxMap[varname] = -1; - - // Indexes for sub color ranges - char secondChar = 0; - if ( varname.size() > 1 ) - { - secondChar = varname[1]; - if ( !isExcplicitHandled( secondChar ) ) - { - secondChar = 0; // Consider all others as one group for coloring - } - } - m_secondCharToVarToAppearanceIdxMap[secondChar][varname] = -1; - } - } - - // Select the default appearance type for each data "dimension" - m_caseAppearanceType = NONE; - m_varAppearanceType = NONE; - m_wellAppearanceType = NONE; - m_groupAppearanceType = NONE; - m_regionAppearanceType = NONE; + init( curveDefinitions ); +} - std::set unusedAppearTypes; - unusedAppearTypes.insert( COLOR ); - unusedAppearTypes.insert( GRADIENT ); - unusedAppearTypes.insert( LINE_STYLE ); - unusedAppearTypes.insert( SYMBOL ); - unusedAppearTypes.insert( LINE_THICKNESS ); - m_currentCurveGradient = 0.0f; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCurveAppearanceCalculator::RimSummaryCurveAppearanceCalculator( const std::set& curveDefinitions ) +{ + std::vector curveDefVector; - m_dimensionCount = 0; - if ( m_varToAppearanceIdxMap.size() > 1 ) - { - m_varAppearanceType = *( unusedAppearTypes.begin() ); - unusedAppearTypes.erase( unusedAppearTypes.begin() ); - m_dimensionCount++; - } - if ( m_caseToAppearanceIdxMap.size() > 1 ) - { - m_caseAppearanceType = *( unusedAppearTypes.begin() ); - unusedAppearTypes.erase( unusedAppearTypes.begin() ); - m_dimensionCount++; - } - if ( m_welToAppearanceIdxMap.size() > 1 ) - { - m_wellAppearanceType = *( unusedAppearTypes.begin() ); - unusedAppearTypes.erase( unusedAppearTypes.begin() ); - m_dimensionCount++; - } - if ( m_grpToAppearanceIdxMap.size() > 1 ) + for ( auto c : curveDefinitions ) { - m_groupAppearanceType = *( unusedAppearTypes.begin() ); - unusedAppearTypes.erase( unusedAppearTypes.begin() ); - m_dimensionCount++; - } - if ( m_regToAppearanceIdxMap.size() > 1 ) - { - m_regionAppearanceType = *( unusedAppearTypes.begin() ); - unusedAppearTypes.erase( unusedAppearTypes.begin() ); - m_dimensionCount++; + curveDefVector.emplace_back( c ); } - if ( m_dimensionCount == 0 ) m_varAppearanceType = COLOR; // basically one curve - - updateApperanceIndices(); + init( curveDefVector ); } //-------------------------------------------------------------------------------------------------- @@ -347,8 +277,14 @@ void RimSummaryCurveAppearanceCalculator::setupCurveLook( RimSummaryCurve* curve m_currentCurveBaseColor = cvf::Color3f( 0.5f, 0.5f, 0.5f ); m_currentCurveGradient = 0.0f; + std::string quantityName = curve->summaryAddressY().quantityName(); + if ( curve->summaryAddressY().isHistoryQuantity() ) + { + quantityName = quantityName.substr( 0, quantityName.size() - 1 ); + } + + int varAppearanceIdx = m_varToAppearanceIdxMap[quantityName]; int caseAppearanceIdx = m_caseToAppearanceIdxMap[curve->summaryCaseY()]; - int varAppearanceIdx = m_varToAppearanceIdxMap[curve->summaryAddressY().quantityName()]; int welAppearanceIdx = m_welToAppearanceIdxMap[curve->summaryAddressY().wellName()]; int grpAppearanceIdx = m_grpToAppearanceIdxMap[curve->summaryAddressY().groupName()]; int regAppearanceIdx = m_regToAppearanceIdxMap[curve->summaryAddressY().regionNumber()]; @@ -363,61 +299,162 @@ void RimSummaryCurveAppearanceCalculator::setupCurveLook( RimSummaryCurve* curve setOneCurveAppearance( m_groupAppearanceType, m_grpToAppearanceIdxMap.size(), grpAppearanceIdx, curve ); setOneCurveAppearance( m_regionAppearanceType, m_regToAppearanceIdxMap.size(), regAppearanceIdx, curve ); - if ( m_varAppearanceType == COLOR && m_secondCharToVarToAppearanceIdxMap.size() > 1 ) + bool assignByPhase = false; + if ( RiaPreferences::current()->colorCurvesByPhase() ) { - int subColorIndex = -1; - char secondChar = 0; - std::string varname = curve->summaryAddressY().quantityName(); + assignByPhase = ( m_varAppearanceType == COLOR ); + } + + if ( assignByPhase ) + { + assignColorByPhase( curve, varAppearanceIdx ); + } + else + { + setOneCurveAppearance( m_varAppearanceType, m_varToAppearanceIdxMap.size(), varAppearanceIdx, curve ); + } + + curve->setColor( gradeColor( m_currentCurveBaseColor, m_currentCurveGradient ) ); + + curve->setCurveAppearanceFromCaseType(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurveAppearanceCalculator::assignColorByPhase( RimSummaryCurve* curve, int colorIndex ) +{ + char secondChar = 0; + std::string varname = curve->summaryAddressY().quantityName(); - if ( curve->summaryAddressY().isHistoryQuantity() ) + if ( varname.size() > 1 ) + { + secondChar = varname[1]; + if ( !isExcplicitHandled( secondChar ) ) { - varname = varname.substr( 0, varname.size() - 1 ); + secondChar = 0; // Consider all others as one group for coloring } + } + + if ( secondChar == 'W' ) + { + // Pick blue + m_currentCurveBaseColor = cycledBlueColor( colorIndex ); + } + else if ( secondChar == 'O' ) + { + // Pick Green + m_currentCurveBaseColor = cycledGreenColor( colorIndex ); + } + else if ( secondChar == 'G' ) + { + // Pick Red + m_currentCurveBaseColor = cycledRedColor( colorIndex ); + } + else if ( secondChar == 'V' ) + { + // Pick Brown + m_currentCurveBaseColor = cycledBrownColor( colorIndex ); + } + else + { + m_currentCurveBaseColor = cycledNoneRGBBrColor( colorIndex ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurveAppearanceCalculator::init( const std::vector& curveDefinitions ) +{ + m_allSummaryCaseNames = getAllSummaryCaseNames(); + m_allSummaryWellNames = getAllSummaryWellNames(); - if ( varname.size() > 1 ) + for ( const RiaSummaryCurveDefinition& curveDef : curveDefinitions ) + { + if ( curveDef.summaryCase() ) m_caseToAppearanceIdxMap[curveDef.summaryCase()] = -1; + if ( !curveDef.summaryAddress().wellName().empty() ) + m_welToAppearanceIdxMap[curveDef.summaryAddress().wellName()] = -1; + if ( !curveDef.summaryAddress().groupName().empty() ) + m_grpToAppearanceIdxMap[curveDef.summaryAddress().groupName()] = -1; + if ( !( curveDef.summaryAddress().regionNumber() == -1 ) ) + m_regToAppearanceIdxMap[curveDef.summaryAddress().regionNumber()] = -1; + + if ( !curveDef.summaryAddress().quantityName().empty() ) { - secondChar = varname[1]; - if ( !isExcplicitHandled( secondChar ) ) + std::string varname = curveDef.summaryAddress().quantityName(); + + if ( curveDef.summaryAddress().isHistoryQuantity() ) { - secondChar = 0; // Consider all others as one group for coloring + varname = varname.substr( 0, varname.size() - 1 ); } - } - subColorIndex = m_secondCharToVarToAppearanceIdxMap[secondChar][varname]; + m_varToAppearanceIdxMap[varname] = -1; - if ( secondChar == 'W' ) - { - // Pick blue - m_currentCurveBaseColor = cycledBlueColor( subColorIndex ); - } - else if ( secondChar == 'O' ) - { - // Pick Green - m_currentCurveBaseColor = cycledGreenColor( subColorIndex ); - } - else if ( secondChar == 'G' ) - { - // Pick Red - m_currentCurveBaseColor = cycledRedColor( subColorIndex ); - } - else if ( secondChar == 'V' ) - { - // Pick Brown - m_currentCurveBaseColor = cycledBrownColor( subColorIndex ); - } - else - { - m_currentCurveBaseColor = cycledNoneRGBBrColor( subColorIndex ); + // Indexes for sub color ranges + char secondChar = 0; + if ( varname.size() > 1 ) + { + secondChar = varname[1]; + if ( !isExcplicitHandled( secondChar ) ) + { + secondChar = 0; // Consider all others as one group for coloring + } + } + m_secondCharToVarToAppearanceIdxMap[secondChar][varname] = -1; } } - else + + // Select the default appearance type for each data "dimension" + m_caseAppearanceType = NONE; + m_varAppearanceType = NONE; + m_wellAppearanceType = NONE; + m_groupAppearanceType = NONE; + m_regionAppearanceType = NONE; + + std::set unusedAppearTypes; + unusedAppearTypes.insert( COLOR ); + unusedAppearTypes.insert( GRADIENT ); + unusedAppearTypes.insert( LINE_STYLE ); + unusedAppearTypes.insert( SYMBOL ); + unusedAppearTypes.insert( LINE_THICKNESS ); + m_currentCurveGradient = 0.0f; + + m_dimensionCount = 0; + if ( m_varToAppearanceIdxMap.size() > 1 ) { - setOneCurveAppearance( m_varAppearanceType, m_varToAppearanceIdxMap.size(), varAppearanceIdx, curve ); + m_varAppearanceType = *( unusedAppearTypes.begin() ); + unusedAppearTypes.erase( unusedAppearTypes.begin() ); + m_dimensionCount++; + } + if ( m_caseToAppearanceIdxMap.size() > 1 ) + { + m_caseAppearanceType = *( unusedAppearTypes.begin() ); + unusedAppearTypes.erase( unusedAppearTypes.begin() ); + m_dimensionCount++; + } + if ( m_welToAppearanceIdxMap.size() > 1 ) + { + m_wellAppearanceType = *( unusedAppearTypes.begin() ); + unusedAppearTypes.erase( unusedAppearTypes.begin() ); + m_dimensionCount++; + } + if ( m_grpToAppearanceIdxMap.size() > 1 ) + { + m_groupAppearanceType = *( unusedAppearTypes.begin() ); + unusedAppearTypes.erase( unusedAppearTypes.begin() ); + m_dimensionCount++; + } + if ( m_regToAppearanceIdxMap.size() > 1 ) + { + m_regionAppearanceType = *( unusedAppearTypes.begin() ); + unusedAppearTypes.erase( unusedAppearTypes.begin() ); + m_dimensionCount++; } - curve->setColor( gradeColor( m_currentCurveBaseColor, m_currentCurveGradient ) ); + if ( m_dimensionCount == 0 ) m_varAppearanceType = COLOR; // basically one curve - curve->setCurveAppearanceFromCaseType(); + updateApperanceIndices(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h index 86e261b22e..66706df477 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h @@ -24,6 +24,8 @@ #include #include +#include +#include class RimSummaryCurve; class RimSummaryCase; @@ -34,6 +36,7 @@ class RimSummaryCurveAppearanceCalculator { public: explicit RimSummaryCurveAppearanceCalculator( const std::set& curveDefinitions ); + explicit RimSummaryCurveAppearanceCalculator( const std::vector& curveDefinitions ); enum CurveAppearanceType { NONE, @@ -57,6 +60,8 @@ class RimSummaryCurveAppearanceCalculator void setupCurveLook( RimSummaryCurve* curve ); + void assignColorByPhase( RimSummaryCurve* curve, int colorIndex ); + static cvf::Color3f cycledPaletteColor( int colorIndex ); static cvf::Color3f cycledNoneRGBBrColor( int colorIndex ); static cvf::Color3f cycledGreenColor( int colorIndex ); @@ -66,6 +71,7 @@ class RimSummaryCurveAppearanceCalculator static RiuPlotCurveSymbol::PointSymbolEnum cycledSymbol( int index ); private: + void init( const std::vector& curveDefinitions ); void setOneCurveAppearance( CurveAppearanceType appeaType, size_t totalCount, int appeaIdx, RimSummaryCurve* curve ); void updateApperanceIndices(); std::map mapNameToAppearanceIndex( CurveAppearanceType& appearance, @@ -91,11 +97,11 @@ class RimSummaryCurveAppearanceCalculator CurveAppearanceType m_groupAppearanceType; CurveAppearanceType m_regionAppearanceType; - std::map m_caseToAppearanceIdxMap; - std::map m_varToAppearanceIdxMap; - std::map m_welToAppearanceIdxMap; - std::map m_grpToAppearanceIdxMap; - std::map m_regToAppearanceIdxMap; + std::map m_caseToAppearanceIdxMap; + std::unordered_map m_varToAppearanceIdxMap; + std::unordered_map m_welToAppearanceIdxMap; + std::unordered_map m_grpToAppearanceIdxMap; + std::unordered_map m_regToAppearanceIdxMap; std::map> m_secondCharToVarToAppearanceIdxMap; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 3f5cd77428..e6fcb88ae0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -774,6 +774,27 @@ void RimSummaryPlot::applyDefaultCurveAppearances() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::applyDefaultCurveAppearances( std::vector curvesToUpdate ) +{ + std::vector allCurveDefs; + + for ( const auto& curve : this->summaryAndEnsembleCurves() ) + { + allCurveDefs.emplace_back( curve->summaryCaseY(), curve->summaryAddressY(), curve->isEnsembleCurve() ); + } + + RimSummaryCurveAppearanceCalculator curveLookCalc( allCurveDefs ); + + for ( auto& curve : curvesToUpdate ) + { + curve->resetAppearance(); + curveLookCalc.setupCurveLook( curve ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1914,9 +1935,10 @@ bool RimSummaryPlot::autoPlotTitle() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RimSummaryPlot::handleSummaryCaseDrop( RimSummaryCase* summaryCase ) +std::pair> RimSummaryPlot::handleSummaryCaseDrop( RimSummaryCase* summaryCase ) { - int newCurves = 0; + int newCurves = 0; + std::vector curves; std::map> dataVectorMap; @@ -1930,19 +1952,22 @@ int RimSummaryPlot::handleSummaryCaseDrop( RimSummaryCase* summaryCase ) { if ( cases.count( summaryCase ) > 0 ) continue; - addNewCurveY( addr, summaryCase ); + curves.push_back( addNewCurveY( addr, summaryCase ) ); newCurves++; } - return newCurves; + return { newCurves, curves }; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* addressCollection ) +std::pair> + RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* addressCollection ) { - int newCurves = 0; + int newCurves = 0; + std::vector curves; + auto droppedName = addressCollection->name().toStdString(); auto summaryCase = RiaSummaryTools::summaryCaseById( addressCollection->caseId() ); @@ -2013,20 +2038,21 @@ int RimSummaryPlot::handleAddressCollectionDrop( RimSummaryAddressCollection* ad } else if ( curveDef.summaryCase() ) { - addNewCurveY( curveDef.summaryAddress(), curveDef.summaryCase() ); + curves.push_back( addNewCurveY( curveDef.summaryAddress(), curveDef.summaryCase() ) ); newCurves++; } } - return newCurves; + return { newCurves, curves }; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RimSummaryPlot::handleSummaryAddressDrop( RimSummaryAddress* summaryAddr ) +std::pair> RimSummaryPlot::handleSummaryAddressDrop( RimSummaryAddress* summaryAddr ) { - int newCurves = 0; + int newCurves = 0; + std::vector curves; if ( summaryAddr->isEnsemble() ) { @@ -2042,11 +2068,11 @@ int RimSummaryPlot::handleSummaryAddressDrop( RimSummaryAddress* summaryAddr ) auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAddr->caseId() ); if ( summaryCase ) { - addNewCurveY( summaryAddr->address(), summaryCase ); + curves.push_back( addNewCurveY( summaryAddr->address(), summaryCase ) ); newCurves++; } } - return newCurves; + return { newCurves, curves }; } //-------------------------------------------------------------------------------------------------- @@ -2054,35 +2080,51 @@ int RimSummaryPlot::handleSummaryAddressDrop( RimSummaryAddress* summaryAddr ) //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::handleDroppedObjects( const std::vector& objects ) { - int newCurves = 0; + int accumulatedCurveCount = 0; + std::vector curvesToUpdate; for ( auto obj : objects ) { auto summaryCase = dynamic_cast( obj ); if ( summaryCase ) { - newCurves += handleSummaryCaseDrop( summaryCase ); + auto [curveCount, curvesCreated] = handleSummaryCaseDrop( summaryCase ); + accumulatedCurveCount += curveCount; + curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() ); continue; } auto summaryAddr = dynamic_cast( obj ); if ( summaryAddr ) { - newCurves += handleSummaryAddressDrop( summaryAddr ); + auto [curveCount, curvesCreated] = handleSummaryAddressDrop( summaryAddr ); + accumulatedCurveCount += curveCount; + curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() ); continue; } auto addressCollection = dynamic_cast( obj ); if ( addressCollection ) { - newCurves += handleAddressCollectionDrop( addressCollection ); + auto [curveCount, curvesCreated] = handleAddressCollectionDrop( addressCollection ); + accumulatedCurveCount += curveCount; + curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() ); continue; } } - if ( newCurves > 0 ) + if ( accumulatedCurveCount > 0 ) { - applyDefaultCurveAppearances(); + applyDefaultCurveAppearances( curvesToUpdate ); + + // Ensemble curve sets + int colorIndex = 0; + for ( auto& curveSet : this->ensembleCurveSetCollection()->curveSets() ) + { + if ( curveSet->colorMode() != RimEnsembleCurveSet::ColorMode::SINGLE_COLOR ) continue; + curveSet->setColor( RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex++ ) ); + } + loadDataAndUpdate(); curvesChanged.send(); @@ -2094,12 +2136,14 @@ void RimSummaryPlot::handleDroppedObjects( const std::vectorsetSummaryCaseY( summaryCase ); newCurve->setSummaryAddressYAndApplyInterpolation( address ); addCurveNoUpdate( newCurve ); + + return newCurve; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index a0602e4d80..bbaef975d9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -229,7 +229,6 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping RimPlotAxisProperties* addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name ); protected: - // Overridden PDM methods caf::PdmFieldHandle* userDescriptionField() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override; @@ -281,16 +280,17 @@ private slots: void assignPlotAxis( RimSummaryCurve* curve ); - void addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase ); + RimSummaryCurve* addNewCurveY( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase ); void addNewEnsembleCurveY( const RifEclipseSummaryAddress& address, RimSummaryCaseCollection* ensemble ); void updateStackedCurveData(); bool updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ); bool updateStackedCurveDataForRelevantAxes(); - int handleSummaryCaseDrop( RimSummaryCase* summaryCase ); - int handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl ); - int handleSummaryAddressDrop( RimSummaryAddress* summaryAddr ); + std::pair> handleSummaryCaseDrop( RimSummaryCase* summaryCase ); + std::pair> handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl ); + std::pair> handleSummaryAddressDrop( RimSummaryAddress* summaryAddr ); + void applyDefaultCurveAppearances( std::vector curvesToUpdate ); bool isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis ); From c95d79adc2ae91f6c012c408dcecc4f48ac94404 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 20 Apr 2022 15:17:59 +0200 Subject: [PATCH 242/406] #8789 Summary Curve : Improve Append to Plot --- ...RicAppendSummaryPlotsForObjectsFeature.cpp | 253 ++++++++++++------ .../RicAppendSummaryPlotsForObjectsFeature.h | 8 + 2 files changed, 180 insertions(+), 81 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index 7643ed725f..48c4e12a8d 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -39,6 +39,80 @@ CAF_CMD_SOURCE_INIT( RicAppendSummaryPlotsForObjectsFeature, "RicAppendSummaryPlotsForObjectsFeature" ); +class SummaryAdrModifier +{ +public: + SummaryAdrModifier( RimSummaryCurve* curve ) + : m_curve( curve ) + , m_curveSet( nullptr ) + { + } + + SummaryAdrModifier( RimEnsembleCurveSet* curveSet ) + : m_curve( nullptr ) + , m_curveSet( curveSet ) + { + } + + static std::vector createAddressModifiersForPlot( RimSummaryPlot* summaryPlot ) + { + std::vector mods; + if ( summaryPlot ) + { + auto curveSets = summaryPlot->curveSets(); + for ( auto curveSet : curveSets ) + { + mods.emplace_back( SummaryAdrModifier( curveSet ) ); + } + + auto curves = summaryPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ); + for ( auto c : curves ) + { + mods.emplace_back( SummaryAdrModifier( c ) ); + } + } + + return mods; + } + + static std::vector createEclipseSummaryAddress( RimSummaryPlot* summaryPlot ) + { + auto mods = createAddressModifiersForPlot( summaryPlot ); + return convertToEclipseSummaryAddress( mods ); + } + + RifEclipseSummaryAddress address() const + { + if ( m_curve ) return m_curve->summaryAddressY(); + if ( m_curveSet ) return m_curveSet->summaryAddress(); + + return {}; + } + + void setAddress( const RifEclipseSummaryAddress& address ) + { + if ( m_curve ) m_curve->setSummaryAddressY( address ); + if ( m_curveSet ) m_curveSet->setSummaryAddress( address ); + } + +private: + static std::vector + convertToEclipseSummaryAddress( const std::vector& modifiers ) + { + std::vector tmp; + tmp.reserve( modifiers.size() ); + for ( const auto& m : modifiers ) + { + tmp.emplace_back( m.address() ); + } + return tmp; + } + +private: + RimSummaryCurve* m_curve; + RimEnsembleCurveSet* m_curveSet; +}; + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -61,59 +135,36 @@ void RicAppendSummaryPlotsForObjectsFeature::onActionTriggered( bool isChecked ) RiaGuiApplication* app = RiaGuiApplication::instance(); - auto activePlotWindow = dynamic_cast( app->activePlotWindow() ); - if ( activePlotWindow ) - { - if ( !isSelectionCompatibleWithPlot( sumAddressCollections, activePlotWindow ) ) return; - - std::vector sourcePlots; - { - auto plots = activePlotWindow->plots(); + auto summaryMultiPlot = dynamic_cast( app->activePlotWindow() ); + if ( !summaryMultiPlot ) return; - for ( auto p : plots ) - { - auto sumPlot = dynamic_cast( p ); + isSelectionCompatibleWithPlot( sumAddressCollections, summaryMultiPlot ); - if ( p ) sourcePlots.push_back( sumPlot ); - } - } + auto selectionType = sumAddressCollections.front()->contentType(); + auto sourcePlots = summaryMultiPlot->summaryPlots(); + std::vector plotsForOneInstance = plotsForOneInstanceOfObjectType( sourcePlots, selectionType ); - for ( auto summaryAdrCollection : sumAddressCollections ) + for ( auto summaryAdrCollection : sumAddressCollections ) + { + auto duplicatedPlots = RicSummaryPlotBuilder::duplicateSummaryPlots( plotsForOneInstance ); + for ( auto duplicatedPlot : duplicatedPlots ) { - auto duplicatedPlots = RicSummaryPlotBuilder::duplicateSummaryPlots( sourcePlots ); - for ( auto duplicatedPlot : duplicatedPlots ) + auto adrMods = SummaryAdrModifier::createAddressModifiersForPlot( duplicatedPlot ); + for ( auto adrMod : adrMods ) { - auto curveSets = duplicatedPlot->curveSets(); - if ( !curveSets.empty() ) - { - for ( auto curveSet : curveSets ) - { - auto sourceAddress = curveSet->summaryAddress(); - auto modifiedAdr = modifyAddress( sourceAddress, summaryAdrCollection ); - - curveSet->setSummaryAddress( modifiedAdr ); - } - } - else - { - auto curves = duplicatedPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ); - for ( auto c : curves ) - { - auto sourceAddress = c->summaryAddressY(); - auto modifiedAdr = modifyAddress( sourceAddress, summaryAdrCollection ); - - c->setSummaryAddressY( modifiedAdr ); - } - } - - activePlotWindow->addPlot( duplicatedPlot ); - - duplicatedPlot->resolveReferencesRecursively(); + auto sourceAddress = adrMod.address(); + auto modifiedAdr = modifyAddress( sourceAddress, summaryAdrCollection ); + + adrMod.setAddress( modifiedAdr ); } - } - activePlotWindow->loadDataAndUpdate(); + summaryMultiPlot->addPlot( duplicatedPlot ); + + duplicatedPlot->resolveReferencesRecursively(); + } } + + summaryMultiPlot->loadDataAndUpdate(); } //-------------------------------------------------------------------------------------------------- @@ -182,67 +233,47 @@ bool RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( if ( !summaryMultiPlot ) return false; if ( selection.empty() ) return false; + auto selectionType = selection.front()->contentType(); + RiaSummaryAddressAnalyzer analyzer; - bool sourcePlotHasEnsembleData = false; { - std::set allAddresses; + // Find all plots for one object type + auto sourcePlots = summaryMultiPlot->summaryPlots(); - auto curveSets = summaryMultiPlot->curveSets(); - if ( !curveSets.empty() ) - { - for ( auto curveSet : curveSets ) - { - allAddresses.insert( curveSet->summaryAddress() ); - } - sourcePlotHasEnsembleData = true; - } - else + std::vector plotsForObjectType = + RicAppendSummaryPlotsForObjectsFeature::plotsForOneInstanceOfObjectType( sourcePlots, selectionType ); + + for ( auto plot : plotsForObjectType ) { - auto curves = summaryMultiPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ); - for ( auto c : curves ) - { - allAddresses.insert( c->summaryAddressY() ); - } + auto addresses = SummaryAdrModifier::createEclipseSummaryAddress( plot ); + analyzer.appendAddresses( addresses ); } - - analyzer.appendAddresses( allAddresses ); } QString errorText; - auto selectionType = selection.front()->contentType(); if ( selectionType == RimSummaryAddressCollection::CollectionContentType::WELL ) { - if ( analyzer.wellNames().size() != 1 ) + if ( analyzer.wellNames().empty() ) { - errorText = "Source plot must contain one well only to be able to duplicate a selection of wells"; + errorText = "Source plot must contain at least one well to be able to duplicate a selection of wells"; } } else if ( selectionType == RimSummaryAddressCollection::CollectionContentType::GROUP ) { - if ( analyzer.groupNames().size() != 1 ) + if ( analyzer.groupNames().empty() ) { - errorText = "Source plot must contain one well group only to be able to duplicate a selection of groups"; + errorText = "Source plot must contain at least one group to be able to duplicate a selection of groups"; } } else if ( selectionType == RimSummaryAddressCollection::CollectionContentType::REGION ) { - if ( analyzer.regionNumbers().size() != 1 ) + if ( analyzer.regionNumbers().empty() ) { - errorText = "Source plot must contain one region only to be able to duplicate a selection of regions"; + errorText = "Source plot must contain at least one region to be able to duplicate a selection of regions"; } } - if ( sourcePlotHasEnsembleData && selection.front()->ensembleId() == -1 ) - { - errorText = "Source plot must contain single cases to be able to duplicate a selection of single cases"; - } - else if ( !sourcePlotHasEnsembleData && selection.front()->caseId() == -1 ) - { - errorText = - "Source plot must contain ensemble case plots to be able to duplicate a selection of ensemble cases"; - } - if ( !errorText.isEmpty() ) { RiaLogging::error( errorText ); @@ -291,3 +322,63 @@ RifEclipseSummaryAddress return adr; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicAppendSummaryPlotsForObjectsFeature::plotsForOneInstanceOfObjectType( + const std::vector& sourcePlots, + RimSummaryAddressCollection::CollectionContentType objectType ) +{ + std::vector plotsForOneInstance; + + std::string wellNameToMatch; + std::string groupNameToMatch; + int regionToMatch = -1; + + RiaSummaryAddressAnalyzer myAnalyser; + for ( auto sourcePlot : sourcePlots ) + { + auto addresses = SummaryAdrModifier::createEclipseSummaryAddress( sourcePlot ); + myAnalyser.appendAddresses( addresses ); + } + + if ( objectType == RimSummaryAddressCollection::CollectionContentType::WELL ) + { + if ( !myAnalyser.wellNames().empty() ) wellNameToMatch = *( myAnalyser.wellNames().begin() ); + } + else if ( objectType == RimSummaryAddressCollection::CollectionContentType::GROUP ) + { + if ( !myAnalyser.groupNames().empty() ) groupNameToMatch = *( myAnalyser.groupNames().begin() ); + } + else if ( objectType == RimSummaryAddressCollection::CollectionContentType::REGION ) + { + if ( !myAnalyser.regionNumbers().empty() ) regionToMatch = *( myAnalyser.regionNumbers().begin() ); + } + + for ( auto sourcePlot : sourcePlots ) + { + auto addresses = SummaryAdrModifier::createEclipseSummaryAddress( sourcePlot ); + + bool isMatching = false; + for ( const auto& a : addresses ) + { + if ( !wellNameToMatch.empty() && a.wellName() == wellNameToMatch ) + { + isMatching = true; + } + else if ( !groupNameToMatch.empty() && a.groupName() == groupNameToMatch ) + { + isMatching = true; + } + else if ( regionToMatch != -1 && a.regionNumber() == regionToMatch ) + { + isMatching = true; + } + } + + if ( isMatching ) plotsForOneInstance.push_back( sourcePlot ); + } + + return plotsForOneInstance; +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h index 1a69a4ac9e..a38764d59b 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h @@ -18,13 +18,17 @@ #pragma once +#include "RimSummaryAddressCollection.h" + #include "cafCmdFeature.h" +#include #include class RimSummaryAddressCollection; class RimSummaryMultiPlot; class RifEclipseSummaryAddress; +class RimSummaryPlot; //================================================================================================== /// @@ -46,4 +50,8 @@ class RicAppendSummaryPlotsForObjectsFeature : public caf::CmdFeature RifEclipseSummaryAddress modifyAddress( const RifEclipseSummaryAddress& sourceAddress, RimSummaryAddressCollection* summaryAddressCollection ); + + static std::vector + plotsForOneInstanceOfObjectType( const std::vector& sourcePlots, + RimSummaryAddressCollection::CollectionContentType objectType ); }; From 5457c96a6362a7308980353dbe00743205216b34 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Thu, 21 Apr 2022 17:16:36 +0200 Subject: [PATCH 243/406] Remove obsolete open editor command --- .../CMakeLists_files.cmake | 2 - .../RicOpenSummaryPlotEditorFeature.cpp | 146 ------------------ .../RicOpenSummaryPlotEditorFeature.h | 36 ----- .../RimContextCommandBuilder.cpp | 4 - 4 files changed, 188 deletions(-) delete mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp delete mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.h diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index e2fb7c775f..cc983112a8 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -1,5 +1,4 @@ set(SOURCE_GROUP_HEADER_FILES - ${CMAKE_CURRENT_LIST_DIR}/RicOpenSummaryPlotEditorFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewDefaultSummaryPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCurveFeature.h @@ -47,7 +46,6 @@ set(SOURCE_GROUP_HEADER_FILES ) set(SOURCE_GROUP_SOURCE_FILES - ${CMAKE_CURRENT_LIST_DIR}/RicOpenSummaryPlotEditorFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewDefaultSummaryPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCurveFeature.cpp diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp deleted file mode 100644 index 09e9d31ec5..0000000000 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp +++ /dev/null @@ -1,146 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2022 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 -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RicOpenSummaryPlotEditorFeature.h" - -#include "RiaSummaryTools.h" - -#include "RicEditSummaryPlotFeature.h" -#include "RicNewSummaryEnsembleCurveSetFeature.h" -#include "RicSummaryPlotEditorDialog.h" -#include "RicSummaryPlotEditorUi.h" -#include "RicSummaryPlotFeatureImpl.h" - -#include "RimCustomObjectiveFunctionCollection.h" -#include "RimEnsembleCurveFilter.h" -#include "RimEnsembleCurveFilterCollection.h" -#include "RimProject.h" -#include "RimRegularLegendConfig.h" -#include "RimSummaryCase.h" -#include "RimSummaryCaseCollection.h" -#include "RimSummaryCaseMainCollection.h" -#include "RimSummaryPlot.h" - -#include "RiuPlotMainWindow.h" - -#include "cafSelectionManagerTools.h" -#include "cvfAssert.h" - -#include - -CAF_CMD_SOURCE_INIT( RicOpenSummaryPlotEditorFeature, "RicOpenSummaryPlotEditorFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicOpenSummaryPlotEditorFeature::isCommandEnabled() -{ - RimSummaryMultiPlot* multiPlot = nullptr; - RimCustomObjectiveFunctionCollection* customObjFuncCollection = nullptr; - - caf::PdmObject* selObj = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); - if ( selObj ) - { - multiPlot = RiaSummaryTools::parentSummaryMultiPlot( selObj ); - selObj->firstAncestorOrThisOfType( customObjFuncCollection ); - } - - auto ensembleFilter = dynamic_cast( selObj ); - auto ensembleFilterColl = dynamic_cast( selObj ); - auto legendConfig = dynamic_cast( selObj ); - - if ( ensembleFilter || ensembleFilterColl || legendConfig || customObjFuncCollection ) return false; - if ( multiPlot ) return true; - - // Multiple case selections - std::vector selectedItems = caf::selectedObjectsByTypeStrict(); - - for ( auto item : selectedItems ) - { - if ( !dynamic_cast( item ) && !dynamic_cast( item ) ) return false; - } - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicOpenSummaryPlotEditorFeature::onActionTriggered( bool isChecked ) -{ - RimProject* project = RimProject::current(); - CVF_ASSERT( project ); - - std::vector selectedCases = caf::selectedObjectsByType(); - std::vector selectedGroups = caf::selectedObjectsByType(); - - std::vector sourcesToSelect( selectedCases.begin(), selectedCases.end() ); - - if ( sourcesToSelect.empty() && selectedGroups.empty() ) - { - const auto allSingleCases = project->firstSummaryCaseMainCollection()->topLevelSummaryCases(); - const auto allGroups = project->summaryGroups(); - std::vector allEnsembles; - for ( const auto group : allGroups ) - if ( group->isEnsemble() ) allEnsembles.push_back( group ); - - if ( !allSingleCases.empty() ) - { - sourcesToSelect.push_back( allSingleCases.front() ); - } - else if ( !allEnsembles.empty() ) - { - sourcesToSelect.push_back( allEnsembles.front() ); - } - } - - // Append grouped cases - for ( auto group : selectedGroups ) - { - if ( group->isEnsemble() ) - { - sourcesToSelect.push_back( group ); - } - else - { - auto groupCases = group->allSummaryCases(); - sourcesToSelect.insert( sourcesToSelect.end(), groupCases.begin(), groupCases.end() ); - } - } - - auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog( true ); - - if ( !dialog->isVisible() ) - { - dialog->show(); - } - else - { - dialog->raise(); - } - - dialog->updateFromDefaultCases( sourcesToSelect ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicOpenSummaryPlotEditorFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Open Summary Plot Editor" ); - actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); -} diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.h deleted file mode 100644 index c36c873c34..0000000000 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.h +++ /dev/null @@ -1,36 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016- 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 -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "RicfCommandObject.h" - -#include "cafCmdFeature.h" - -//================================================================================================== -/// -//================================================================================================== -class RicOpenSummaryPlotEditorFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; -}; diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 2beaa4618a..7380a02051 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -771,7 +771,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder.addSeparator(); menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; - menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder.addSeparator(); menuBuilder << "RicConvertGroupToEnsembleFeature"; @@ -787,7 +786,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder.subMenuEnd(); menuBuilder.addSeparator(); menuBuilder << "RicNewSummaryMultiPlotFeature"; - menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder.addSeparator(); menuBuilder << "RicImportGridModelFromSummaryCaseFeature"; @@ -795,7 +793,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() if ( !dynamic_cast( firstUiItem ) ) { menuBuilder << "RicShowSummaryCurveCalculatorFeature"; - // menuBuilder << "RicOpenSummaryPlotEditorFeature"; } } else if ( dynamic_cast( firstUiItem ) ) @@ -1076,7 +1073,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; - menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder << "RicSummaryCurveSwitchAxisFeature"; menuBuilder << "RicNewDerivedSummaryFeature"; From 1840a95810fdebc2905bef1872a9fb9fa1a904dd Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 20 Apr 2022 15:46:03 +0200 Subject: [PATCH 244/406] Preferences: Move colorCurvesByPhase and hide Qt Charts settings --- ApplicationLibCode/Application/RiaPreferences.cpp | 13 +------------ ApplicationLibCode/Application/RiaPreferences.h | 2 -- .../Application/RiaPreferencesSummary.cpp | 13 +++++++++++++ .../Application/RiaPreferencesSummary.h | 2 ++ .../Summary/RimSummaryCurveAppearanceCalculator.cpp | 4 ++-- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 1 + 6 files changed, 19 insertions(+), 16 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index f691d8fc7c..fdc86e2425 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -262,9 +262,6 @@ RiaPreferences::RiaPreferences() CAF_PDM_InitFieldNoDefault( &m_systemPreferences, "systemPreferences", "systemPreferences" ); m_systemPreferences = new RiaPreferencesSystem; - - CAF_PDM_InitField( &m_curveColorByPhase, "curveColorByPhase", true, "Curve Color By Phase" ); - caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_curveColorByPhase ); } //-------------------------------------------------------------------------------------------------- @@ -388,7 +385,6 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Plot Templates" ); group->add( &m_plotTemplateFolders ); group->add( &m_searchPlotTemplateFoldersRecursively ); - group->add( &m_curveColorByPhase ); caf::PdmUiGroup* pageSetup = uiOrdering.addNewGroup( "Page Setup" ); pageSetup->add( &m_pageSize ); @@ -399,6 +395,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& pageSetup->add( &m_pageBottomMargin, false ); uiOrdering.add( &m_useQtChartsPlotByDefault ); + m_useQtChartsPlotByDefault.uiCapability()->setUiHidden( true ); QString unitLabel = " [mm]"; if ( QPageSize( m_pageSize() ).definitionUnits() == QPageSize::Inch ) @@ -750,14 +747,6 @@ bool RiaPreferences::useQtChartsAsDefaultPlotType() const return m_useQtChartsPlotByDefault; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RiaPreferences::colorCurvesByPhase() const -{ - return m_curveColorByPhase(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferences.h b/ApplicationLibCode/Application/RiaPreferences.h index 700cf537d6..9f112e8eba 100644 --- a/ApplicationLibCode/Application/RiaPreferences.h +++ b/ApplicationLibCode/Application/RiaPreferences.h @@ -83,7 +83,6 @@ class RiaPreferences : public caf::PdmObject void setDefaultPlotTemplatePath( const QString& templatePath ); bool openExportedPdfInViewer() const; bool useQtChartsAsDefaultPlotType() const; - bool colorCurvesByPhase() const; RiaDefines::ThemeEnum guiTheme() const; @@ -188,7 +187,6 @@ class RiaPreferences : public caf::PdmObject caf::PdmField m_searchPlotTemplateFoldersRecursively; caf::PdmField m_defaultPlotTemplate; caf::PdmField m_useQtChartsPlotByDefault; - caf::PdmField m_curveColorByPhase; // Script paths caf::PdmField m_octaveExecutable; diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp index 91c3a17a0e..a08f4fc2a9 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp @@ -144,6 +144,9 @@ RiaPreferencesSummary::RiaPreferencesSummary() m_defaultColumnCount = RiaDefines::ColumnCount::COLUMNS_2; CAF_PDM_InitFieldNoDefault( &m_defaultRowsPerPage, "DefaultRowsPerPage", "Rows per Page" ); m_defaultRowsPerPage = RiaDefines::RowCount::ROWS_2; + + CAF_PDM_InitField( &m_curveColorByPhase, "curveColorByPhase", true, "Curve Color By Phase" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_curveColorByPhase ); } //-------------------------------------------------------------------------------------------------- @@ -227,6 +230,8 @@ void RiaPreferencesSummary::appendItemsToPlottingGroup( caf::PdmUiOrdering& uiOr { uiOrdering.add( &m_defaultSummaryCurvesTextFilter ); uiOrdering.add( &m_defaultSummaryHistoryCurveStyle ); + uiOrdering.add( &m_curveColorByPhase ); + uiOrdering.add( &m_showSummaryTimeAsLongString ); auto multiGroup = uiOrdering.addNewGroup( "Multi Plot Defaults" ); @@ -291,6 +296,14 @@ QString RiaPreferencesSummary::defaultSummaryCurvesTextFilter() const return m_defaultSummaryCurvesTextFilter; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaPreferencesSummary::colorCurvesByPhase() const +{ + return m_curveColorByPhase(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.h b/ApplicationLibCode/Application/RiaPreferencesSummary.h index 3824c13fc7..7e980f5a9e 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.h +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.h @@ -82,6 +82,7 @@ class RiaPreferencesSummary : public caf::PdmObject SummaryRestartFilesImportMode gridImportMode() const; SummaryRestartFilesImportMode summaryEnsembleImportMode() const; QString defaultSummaryCurvesTextFilter() const; + bool colorCurvesByPhase() const; SummaryHistoryCurveStyleMode defaultSummaryHistoryCurveStyle() const; @@ -105,6 +106,7 @@ class RiaPreferencesSummary : public caf::PdmObject caf::PdmField m_defaultSummaryCurvesTextFilter; caf::PdmField m_defaultSummaryHistoryCurveStyle; + caf::PdmField m_curveColorByPhase; caf::PdmField m_showSummaryTimeAsLongString; caf::PdmField m_useMultipleThreadsWhenLoadingSummaryCases; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp index 29b75638db..4b1482f057 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp @@ -19,7 +19,7 @@ #include "RimSummaryCurveAppearanceCalculator.h" #include "RiaColorTables.h" -#include "RiaPreferences.h" +#include "RiaPreferencesSummary.h" #include "RiaSummaryCurveDefinition.h" #include "RiuQwtPlotCurve.h" @@ -300,7 +300,7 @@ void RimSummaryCurveAppearanceCalculator::setupCurveLook( RimSummaryCurve* curve setOneCurveAppearance( m_regionAppearanceType, m_regToAppearanceIdxMap.size(), regAppearanceIdx, curve ); bool assignByPhase = false; - if ( RiaPreferences::current()->colorCurvesByPhase() ) + if ( RiaPreferencesSummary::current()->colorCurvesByPhase() ) { assignByPhase = ( m_varAppearanceType == COLOR ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index e6fcb88ae0..4db4599a0d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -107,6 +107,7 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) #ifdef USE_QTCHARTS bool useQtChart = RiaPreferences::current()->useQtChartsAsDefaultPlotType(); CAF_PDM_InitScriptableField( &m_useQtChartsPlot, "useQtChartsPlot", useQtChart, "Use Qt Charts" ); + m_useQtChartsPlot.uiCapability()->setUiHidden( true ); #endif CAF_PDM_InitFieldNoDefault( &m_summaryCurveCollection, "SummaryCurveCollection", "" ); m_summaryCurveCollection.uiCapability()->setUiTreeHidden( true ); From ed6cbce71e3dc81c6d15a4bb1ac9ff224c4ebd97 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 21 Apr 2022 13:27:58 +0200 Subject: [PATCH 245/406] #8818 PDF Export : Avoid manipulation of resolution The exported pdf is dependent on the width of the plot window. Remove code related to change of resolution when exporting to PDF. This makes the PDF export consistent and independent to width of view. --- .../RicSnapshotViewToFileFeature.cpp | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp index 27bc56b0fb..031dc372e5 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp @@ -51,7 +51,7 @@ CAF_CMD_SOURCE_INIT( RicSnapshotViewToFileFeature, "RicSnapshotViewToFileFeature //-------------------------------------------------------------------------------------------------- void RicSnapshotViewToFileFeature::saveSnapshotAs( const QString& fileName, RimViewWindow* viewWindow ) { - RimPlotWindow* plotWindow = dynamic_cast( viewWindow ); + auto* plotWindow = dynamic_cast( viewWindow ); if ( plotWindow && fileName.endsWith( ".pdf" ) ) { savePlotPdfReportAs( fileName, plotWindow ); @@ -95,28 +95,15 @@ void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, QFile pdfFile( fileName ); if ( pdfFile.open( QIODevice::WriteOnly ) ) { - int resolution = RiaGuiApplication::applicationResolution(); - int pageWidth = plot->pageLayout().fullRectPixels( resolution ).width(); - int widgetWidth = viewWidget->width(); - int deltaWidth = widgetWidth - pageWidth; + int resolution = RiaGuiApplication::applicationResolution(); - while ( std::abs( deltaWidth ) > 1 ) - { - int newResolution = resolution + deltaWidth / std::abs( deltaWidth ); - pageWidth = plot->pageLayout().fullRectPixels( resolution ).width(); - int newDeltaWidth = widgetWidth - pageWidth; - if ( std::abs( newDeltaWidth ) > std::abs( deltaWidth ) ) break; - - resolution = newResolution; - deltaWidth = newDeltaWidth; - } QPdfWriter pdfPrinter( fileName ); pdfPrinter.setPageLayout( plot->pageLayout() ); pdfPrinter.setCreator( QCoreApplication::applicationName() ); pdfPrinter.setResolution( resolution ); QRect widgetRect = viewWidget->contentsRect(); - RimMultiPlot* multiPlot = dynamic_cast( plot ); + auto* multiPlot = dynamic_cast( plot ); if ( multiPlot && multiPlot->previewModeEnabled() ) { QRect pageRect = pdfPrinter.pageLayout().fullRectPixels( resolution ); @@ -144,7 +131,7 @@ void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, void RicSnapshotViewToFileFeature::saveViewWindowToFile( RimViewWindow* viewWindow, const QString& defaultFileBaseName /*= "image" */ ) { - RimPlotWindow* plotWindow = dynamic_cast( viewWindow ); + auto* plotWindow = dynamic_cast( viewWindow ); QString fileName = generateSaveFileName( defaultFileBaseName, plotWindow != nullptr ); if ( !fileName.isEmpty() ) From 73f5c793e865c5af376c93e934996cfc72b9a4e4 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 22 Apr 2022 22:16:36 +0200 Subject: [PATCH 246/406] Merge pull request #8828 from OPM/summary-axis-cleanup Combine Link axis range with axis range aggregation. Zoom All will now respect the different axis range aggregation method. --- .../Summary/RimSummaryMultiPlot.cpp | 167 +++++++++--------- .../Summary/RimSummaryMultiPlot.h | 11 +- 2 files changed, 89 insertions(+), 89 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 7f91f3adaa..211db93431 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -26,18 +26,18 @@ #include "RifEclEclipseSummary.h" #include "RifEclipseRftAddress.h" #include "RifEclipseSummaryAddress.h" + #include "RimEnsembleCurveSet.h" #include "RimMainPlotCollection.h" #include "RimMultiPlotCollection.h" #include "RimMultipleSummaryPlotNameHelper.h" #include "RimProject.h" +#include "RimSummaryAddress.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" -#include "RimSummaryPlotControls.h" - -#include "RimSummaryAddress.h" #include "RimSummaryPlot.h" +#include "RimSummaryPlotControls.h" #include "RimSummaryPlotNameHelper.h" #include "RimSummaryPlotSourceStepping.h" @@ -49,6 +49,8 @@ #include "cafPdmUiTreeOrdering.h" #include "cafPdmUiTreeSelectionEditor.h" +#include "qwt_scale_engine.h" + #include #include @@ -57,11 +59,12 @@ namespace caf template <> void AppEnum::setUp() { - addItem( RimSummaryMultiPlot::AxisRangeAggregation::NONE, "NONE", "Disabled" ); - addItem( RimSummaryMultiPlot::AxisRangeAggregation::WELLS, "WELLS", "Wells" ); - addItem( RimSummaryMultiPlot::AxisRangeAggregation::REGIONS, "REGIONS", "Regions" ); - addItem( RimSummaryMultiPlot::AxisRangeAggregation::REALIZATIONS, "REALIZATIONS", "Realizations" ); - setDefault( RimSummaryMultiPlot::AxisRangeAggregation::NONE ); + addItem( RimSummaryMultiPlot::AxisRangeAggregation::INDIVIDUAL, "INDIVIDUAL", "Individual" ); + addItem( RimSummaryMultiPlot::AxisRangeAggregation::SUB_PLOTS, "SUB_PLOTS", "All Sub Plots" ); + addItem( RimSummaryMultiPlot::AxisRangeAggregation::WELLS, "WELLS", "All Wells" ); + addItem( RimSummaryMultiPlot::AxisRangeAggregation::REGIONS, "REGIONS", "All Regions" ); + addItem( RimSummaryMultiPlot::AxisRangeAggregation::REALIZATIONS, "REALIZATIONS", "All Realizations" ); + setDefault( RimSummaryMultiPlot::AxisRangeAggregation::INDIVIDUAL ); } } // namespace caf @@ -78,11 +81,6 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() CAF_PDM_InitField( &m_autoPlotTitles, "AutoPlotTitles", true, "Auto Plot Titles" ); CAF_PDM_InitField( &m_autoPlotTitlesOnSubPlots, "AutoPlotTitlesSubPlots", true, "Auto Plot Titles Sub Plots" ); - CAF_PDM_InitField( &m_syncAxisRanges, "SyncAxisRanges", false, "", "", "Sync Axis Ranges in All Plots" ); - m_syncAxisRanges.xmlCapability()->disableIO(); - m_syncAxisRanges.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); - m_syncAxisRanges.uiCapability()->setUiIconFromResourceString( ":/AxesSync16x16.png" ); - CAF_PDM_InitField( &m_createPlotDuplicate, "DuplicatePlot", false, "", "", "Duplicate Plot" ); m_createPlotDuplicate.xmlCapability()->disableIO(); m_createPlotDuplicate.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); @@ -93,7 +91,7 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() m_disableWheelZoom.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_disableWheelZoom.uiCapability()->setUiIconFromResourceString( ":/DisableZoom.png" ); - CAF_PDM_InitField( &m_syncSubPlotAxes, "SyncSubPlotAxes", false, "Sync Subplot Axes" ); + CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" ); CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Aggregation" ); CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); @@ -119,7 +117,7 @@ RimSummaryMultiPlot::~RimSummaryMultiPlot() //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::addPlot( RimPlot* plot ) { - RimSummaryPlot* sumPlot = dynamic_cast( plot ); + auto* sumPlot = dynamic_cast( plot ); CVF_ASSERT( sumPlot != nullptr ); if ( sumPlot ) { @@ -132,7 +130,7 @@ void RimSummaryMultiPlot::addPlot( RimPlot* plot ) //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) { - RimSummaryPlot* sumPlot = dynamic_cast( plot ); + auto* sumPlot = dynamic_cast( plot ); CVF_ASSERT( sumPlot != nullptr ); if ( sumPlot ) { @@ -149,10 +147,10 @@ void RimSummaryMultiPlot::addPlot( const std::vector& obj { if ( objects.empty() ) return; - RimSummaryAddress* addr = dynamic_cast( objects[0] ); + auto* addr = dynamic_cast( objects[0] ); if ( addr ) { - RimSummaryPlot* plot = new RimSummaryPlot(); + auto* plot = new RimSummaryPlot(); plot->enableAutoPlotTitle( true ); plot->handleDroppedObjects( objects ); @@ -166,7 +164,7 @@ void RimSummaryMultiPlot::addPlot( const std::vector& obj //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::removePlot( RimPlot* plot ) { - RimSummaryPlot* sumPlot = dynamic_cast( plot ); + auto* sumPlot = dynamic_cast( plot ); CVF_ASSERT( sumPlot != nullptr ); if ( sumPlot ) { @@ -179,7 +177,7 @@ void RimSummaryMultiPlot::removePlot( RimPlot* plot ) //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::removePlotNoUpdate( RimPlot* plot ) { - RimSummaryPlot* sumPlot = dynamic_cast( plot ); + auto* sumPlot = dynamic_cast( plot ); CVF_ASSERT( sumPlot != nullptr ); if ( sumPlot ) { @@ -312,8 +310,8 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde layoutGroup->add( &m_majorTickmarkCount ); auto axesGroup = uiOrdering.addNewGroup( "Axes" ); - axesGroup->add( &m_syncSubPlotAxes ); axesGroup->add( &m_axisRangeAggregation ); + axesGroup->add( &m_linkSubPlotAxes ); auto dataSourceGroup = uiOrdering.addNewGroup( "Data Source" ); m_sourceStepping()->uiOrdering( uiConfigName, *dataSourceGroup ); @@ -333,9 +331,8 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi onLoadDataAndUpdate(); updateLayout(); } - else if ( changedField == &m_syncAxisRanges ) + else if ( changedField == &m_linkSubPlotAxes || changedField == &m_axisRangeAggregation ) { - m_syncAxisRanges = false; syncAxisRanges(); } else if ( changedField == &m_createPlotDuplicate ) @@ -343,40 +340,12 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi m_createPlotDuplicate = false; duplicate(); } - else if ( changedField == &m_syncSubPlotAxes && m_syncSubPlotAxes() ) - { - syncAxisRanges(); - } - else if ( changedField == &m_axisRangeAggregation ) - { - if ( m_axisRangeAggregation() != AxisRangeAggregation::NONE ) - computeAggregatedAxisRange(); - else - onLoadDataAndUpdate(); - } else { RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue ); } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::defineEditorAttribute( const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute ) -{ - if ( &m_syncAxisRanges == field ) - { - caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast( attribute ); - if ( attrib ) - { - attrib->m_buttonText = "Sync Axes"; - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -470,7 +439,6 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() std::vector toolBarFields; toolBarFields.push_back( &m_disableWheelZoom ); - toolBarFields.push_back( &m_syncAxisRanges ); toolBarFields.push_back( &m_createPlotDuplicate ); auto& sourceObject = m_sourceStepping(); @@ -552,45 +520,65 @@ void RimSummaryMultiPlot::initAfterRead() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::syncAxisRanges() +void RimSummaryMultiPlot::zoomAll() { - std::map> axisRanges; + syncAxisRanges(); +} +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::syncAxisRanges() +{ // Reset zoom to make sure the complete range for min/max is available - zoomAll(); + RimMultiPlot::zoomAll(); - // gather current min/max values for each category (axis label) - for ( auto plot : summaryPlots() ) + if ( m_axisRangeAggregation() == AxisRangeAggregation::INDIVIDUAL ) { - for ( auto axis : plot->plotAxes() ) - { - double minVal = axis->visibleRangeMin(); - double maxVal = axis->visibleRangeMax(); + return; + } + else if ( m_axisRangeAggregation() == AxisRangeAggregation::SUB_PLOTS ) + { + std::map> axisRanges; - if ( axisRanges.count( axis->name() ) == 0 ) + // gather current min/max values for each category (axis label) + for ( auto plot : summaryPlots() ) + { + for ( auto axis : plot->plotAxes() ) { - axisRanges[axis->name()] = std::make_pair( axis->visibleRangeMin(), axis->visibleRangeMax() ); + double minVal = axis->visibleRangeMin(); + double maxVal = axis->visibleRangeMax(); + + if ( axisRanges.count( axis->name() ) == 0 ) + { + axisRanges[axis->name()] = std::make_pair( axis->visibleRangeMin(), axis->visibleRangeMax() ); + } + else + { + auto& [currentMin, currentMax] = axisRanges[axis->name()]; + axisRanges[axis->name()] = + std::make_pair( std::min( currentMin, minVal ), std::max( currentMax, maxVal ) ); + } } - else + } + + // set all plots to use the global min/max values for each category + for ( auto plot : summaryPlots() ) + { + for ( auto axis : plot->plotAxes() ) { - auto& [currentMin, currentMax] = axisRanges[axis->name()]; - axisRanges[axis->name()] = std::make_pair( std::min( currentMin, minVal ), std::max( currentMax, maxVal ) ); + const auto& [minVal, maxVal] = axisRanges[axis->name()]; + axis->setAutoZoom( false ); + axis->setVisibleRangeMin( minVal ); + axis->setVisibleRangeMax( maxVal ); } + + plot->updateAxes(); } } - - // set all plots to use the global min/max values for each category - for ( auto plot : summaryPlots() ) + else { - for ( auto axis : plot->plotAxes() ) - { - const auto& [minVal, maxVal] = axisRanges[axis->name()]; - axis->setAutoZoom( false ); - axis->setVisibleRangeMin( minVal ); - axis->setVisibleRangeMax( maxVal ); - } - - plot->updateAxes(); + computeAggregatedAxisRange(); } } @@ -674,7 +662,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() if ( axisRangeAggregation == AxisRangeAggregation::WELLS ) { - for ( auto wellName : analyzer.wellNames() ) + for ( const auto& wellName : analyzer.wellNames() ) { addresses.push_back( RifEclipseSummaryAddress::wellAddress( curve->summaryAddressY().quantityName(), wellName ) ); @@ -701,7 +689,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() double maximum = -HUGE_VAL; for ( auto summaryCase : summaryCases ) { - for ( auto addr : addresses ) + for ( const auto& addr : addresses ) { auto [caseMinimum, caseMaximum] = findMinMaxForSummaryCase( summaryCase, addr ); minimum = std::min( minimum, caseMinimum ); @@ -745,12 +733,25 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() // set all plots to use the global min/max values for each category for ( auto axis : plot->plotAxes() ) { + QwtLinearScaleEngine scaleEngine; + const auto& [minVal, maxVal] = axisRanges[axis->plotAxisType()]; if ( axis->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT && minVal <= maxVal ) { axis->setAutoZoom( false ); - axis->setVisibleRangeMin( minVal ); - axis->setVisibleRangeMax( maxVal ); + + auto adjustedMin = minVal; + auto adjustedMax = maxVal; + + if ( !axis->isLogarithmicScaleEnabled() ) + { + int maxMajorTickIntervalCount = 8; + double stepSize = 0.0; + scaleEngine.autoScale( maxMajorTickIntervalCount, adjustedMin, adjustedMax, stepSize ); + } + + axis->setVisibleRangeMin( adjustedMin ); + axis->setVisibleRangeMax( adjustedMax ); } } @@ -800,7 +801,7 @@ void RimSummaryMultiPlot::onSubPlotChanged( const caf::SignalEmitter* emitter ) //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot ) { - if ( !m_syncSubPlotAxes() ) return; + if ( !m_linkSubPlotAxes() ) return; for ( auto plot : summaryPlots() ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 0d09907328..604b9e047f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -50,7 +50,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep public: enum class AxisRangeAggregation { - NONE, + INDIVIDUAL, + SUB_PLOTS, REGIONS, WELLS, REALIZATIONS @@ -89,6 +90,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void makeSureIsVisible( RimSummaryPlot* plot ); + void zoomAll() override; + protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override; @@ -101,9 +104,6 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void populateNameHelper( RimSummaryPlotNameHelper* nameHelper ); - void defineEditorAttribute( const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute ) override; void updatePlotWindowTitle() override; void computeAggregatedAxisRange(); @@ -116,10 +116,9 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep private: caf::PdmField m_autoPlotTitles; caf::PdmField m_autoPlotTitlesOnSubPlots; - caf::PdmField m_syncAxisRanges; caf::PdmField m_disableWheelZoom; caf::PdmField m_createPlotDuplicate; - caf::PdmField m_syncSubPlotAxes; + caf::PdmField m_linkSubPlotAxes; caf::PdmField> m_axisRangeAggregation; From b6f7dd931e45eb363a7f50c2baf2dec138c7ef3f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 21 Apr 2022 11:24:11 +0200 Subject: [PATCH 247/406] Add option to export to pdf without asking user --- .../Application/RiaPreferencesSystem.cpp | 12 ++++++++++++ .../Application/RiaPreferencesSystem.h | 2 ++ .../ExportCommands/RicSnapshotViewToPdfFeature.cpp | 14 ++++++++++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp index 869c532524..d8ec5b48da 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp @@ -81,6 +81,9 @@ RiaPreferencesSystem::RiaPreferencesSystem() CAF_PDM_InitField( &m_showProgressBar, "showProgressBar", true, "Show Progress Bar" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showProgressBar ); + CAF_PDM_InitField( &m_showPdfExportDialog, "showPdfExportDialog", true, "Show PDF Export Dialog" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showPdfExportDialog ); + CAF_PDM_InitField( &m_gtestFilter, "gtestFilter", QString(), "Unit Test Filter (gtest)" ); CAF_PDM_InitField( &m_eclipseReaderMode, @@ -195,6 +198,14 @@ bool RiaPreferencesSystem::showProgressBar() const return m_showProgressBar(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaPreferencesSystem::showPdfExportDialog() const +{ + return m_showPdfExportDialog(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -227,6 +238,7 @@ void RiaPreferencesSystem::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd uiOrdering.add( &m_includeFractureDebugInfoFile ); uiOrdering.add( &m_holoLensExportFolder ); uiOrdering.add( &m_showProgressBar ); + uiOrdering.add( &m_showPdfExportDialog ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferencesSystem.h b/ApplicationLibCode/Application/RiaPreferencesSystem.h index 9e1e421cf6..a0cb1d74bc 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSystem.h +++ b/ApplicationLibCode/Application/RiaPreferencesSystem.h @@ -53,6 +53,7 @@ class RiaPreferencesSystem : public caf::PdmObject bool show3dInformation() const; QString gtestFilter() const; bool showProgressBar() const; + bool showPdfExportDialog() const; EclipseTextFileReaderMode eclipseTextFileReaderMode() const; @@ -77,6 +78,7 @@ class RiaPreferencesSystem : public caf::PdmObject caf::PdmField m_includeFractureDebugInfoFile; caf::PdmField m_holoLensExportFolder; + caf::PdmField m_showPdfExportDialog; caf::PdmField m_showProgressBar; caf::PdmField m_gtestFilter; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp index 38053bbce0..1a369dcbe4 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp @@ -21,6 +21,7 @@ #include "RiaGuiApplication.h" #include "RiaLogging.h" #include "RiaPreferences.h" +#include "RiaPreferencesSystem.h" #include "RicSnapshotFilenameGenerator.h" #include "RicSnapshotViewToFileFeature.h" @@ -58,13 +59,22 @@ void RicSnapshotViewToPdfFeature::onActionTriggered( bool isChecked ) return; } - RimPlotWindow* plotWindow = dynamic_cast( viewWindow ); + auto* plotWindow = dynamic_cast( viewWindow ); if ( plotWindow ) { QString fileExtension = "pdf"; QString defaultFileName = RicSnapshotFilenameGenerator::generateSnapshotFileName( viewWindow ); - QString fileName = RicSnapshotViewToFileFeature::generateSaveFileName( defaultFileName, true, fileExtension ); + QString fileName; + if ( RiaPreferencesSystem::current()->showPdfExportDialog() ) + { + fileName = RicSnapshotViewToFileFeature::generateSaveFileName( defaultFileName, true, fileExtension ); + } + else + { + fileName = defaultFileName + ".pdf"; + } + if ( !fileName.isEmpty() ) { if ( plotWindow && fileName.endsWith( "PDF", Qt::CaseInsensitive ) ) From 853b4a26d5dfd3a51af1b465bc8ce23b8d5d9613 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 22 Apr 2022 09:58:51 +0200 Subject: [PATCH 248/406] #8822 Summary Axis: Add tick mark count to y-axis --- .../Application/RiaPlotDefines.cpp | 20 +++++++ .../Application/RiaPlotDefines.h | 4 ++ .../Application/RiaPreferencesSystem.cpp | 11 ++++ .../Application/RiaPreferencesSystem.h | 5 +- .../RicSnapshotViewToPdfFeature.cpp | 4 +- .../ViewLink/RicLinkVisibleViewsFeatureUi.cpp | 2 +- .../RimPlotAxisProperties.cpp | 19 +++++++ .../ProjectDataModel/RimPlotAxisProperties.h | 4 ++ .../RimPlotAxisPropertiesInterface.cpp | 54 +++++++++++++++++++ .../RimPlotAxisPropertiesInterface.h | 8 +++ .../ProjectDataModel/RimProject.cpp | 5 +- .../RimViewLinkerCollection.cpp | 2 +- .../Summary/RimSummaryMultiPlot.cpp | 9 +++- .../Summary/RimSummaryMultiPlot.h | 2 + .../Summary/RimSummaryPlot.cpp | 26 +++------ .../Summary/RimSummaryTimeAxisProperties.cpp | 3 ++ .../Summary/RimSummaryTimeAxisProperties.h | 4 +- .../UserInterface/RiuMultiPlotBook.cpp | 4 +- .../UserInterface/RiuMultiPlotPage.cpp | 4 +- .../UserInterface/RiuQwtPlotWidget.cpp | 5 +- 20 files changed, 157 insertions(+), 38 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPlotDefines.cpp b/ApplicationLibCode/Application/RiaPlotDefines.cpp index 0a7b4d3a74..6ee4a9f171 100644 --- a/ApplicationLibCode/Application/RiaPlotDefines.cpp +++ b/ApplicationLibCode/Application/RiaPlotDefines.cpp @@ -18,6 +18,9 @@ #include "RiaPlotDefines.h" +#include "RiaGuiApplication.h" +#include "RiaPreferencesSystem.h" + #include "cafAppEnum.h" namespace caf @@ -73,3 +76,20 @@ bool RiaDefines::isVertical( RiaDefines::PlotAxis axis ) { return ( axis == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || axis == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RiaDefines::scalingFactor( QPaintDevice* paintDevice ) +{ + auto scalingFactor = RiaPreferencesSystem::current()->exportPdfScalingFactor(); + + if ( scalingFactor > 0.0 ) return scalingFactor; + + if ( !paintDevice ) return 1.0; + + int resolution = paintDevice->logicalDpiX(); + double scaling = resolution / static_cast( RiaGuiApplication::applicationResolution() ); + + return scaling; +} diff --git a/ApplicationLibCode/Application/RiaPlotDefines.h b/ApplicationLibCode/Application/RiaPlotDefines.h index 5eadaf47de..1bbb56cae2 100644 --- a/ApplicationLibCode/Application/RiaPlotDefines.h +++ b/ApplicationLibCode/Application/RiaPlotDefines.h @@ -18,6 +18,8 @@ #pragma once +class QPaintDevice; + // Defines relate to plotting namespace RiaDefines { @@ -36,4 +38,6 @@ double maximumDefaultValuePlot(); bool isHorizontal( PlotAxis axis ); bool isVertical( PlotAxis axis ); +double scalingFactor( QPaintDevice* paintDevice ); + }; // namespace RiaDefines diff --git a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp index d8ec5b48da..d93a62324e 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp @@ -85,6 +85,7 @@ RiaPreferencesSystem::RiaPreferencesSystem() caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showPdfExportDialog ); CAF_PDM_InitField( &m_gtestFilter, "gtestFilter", QString(), "Unit Test Filter (gtest)" ); + CAF_PDM_InitField( &m_exportScalingFactor, "exportScalingFactor", -1.0, "Export Scaling Factor (<0 disable)" ); CAF_PDM_InitField( &m_eclipseReaderMode, "eclipseReaderMode", @@ -206,6 +207,14 @@ bool RiaPreferencesSystem::showPdfExportDialog() const return m_showPdfExportDialog(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RiaPreferencesSystem::exportPdfScalingFactor() const +{ + return m_exportScalingFactor(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -238,7 +247,9 @@ void RiaPreferencesSystem::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd uiOrdering.add( &m_includeFractureDebugInfoFile ); uiOrdering.add( &m_holoLensExportFolder ); uiOrdering.add( &m_showProgressBar ); + uiOrdering.add( &m_showPdfExportDialog ); + uiOrdering.add( &m_exportScalingFactor ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferencesSystem.h b/ApplicationLibCode/Application/RiaPreferencesSystem.h index a0cb1d74bc..4a7bb19160 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSystem.h +++ b/ApplicationLibCode/Application/RiaPreferencesSystem.h @@ -54,6 +54,7 @@ class RiaPreferencesSystem : public caf::PdmObject QString gtestFilter() const; bool showProgressBar() const; bool showPdfExportDialog() const; + double exportPdfScalingFactor() const; EclipseTextFileReaderMode eclipseTextFileReaderMode() const; @@ -78,7 +79,9 @@ class RiaPreferencesSystem : public caf::PdmObject caf::PdmField m_includeFractureDebugInfoFile; caf::PdmField m_holoLensExportFolder; - caf::PdmField m_showPdfExportDialog; + caf::PdmField m_showPdfExportDialog; + caf::PdmField m_exportScalingFactor; + caf::PdmField m_showProgressBar; caf::PdmField m_gtestFilter; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp index 1a369dcbe4..a7f954a735 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp @@ -72,12 +72,12 @@ void RicSnapshotViewToPdfFeature::onActionTriggered( bool isChecked ) } else { - fileName = defaultFileName + ".pdf"; + fileName = defaultFileName + "." + fileExtension; } if ( !fileName.isEmpty() ) { - if ( plotWindow && fileName.endsWith( "PDF", Qt::CaseInsensitive ) ) + if ( plotWindow && fileName.endsWith( fileExtension, Qt::CaseInsensitive ) ) { RicSnapshotViewToFileFeature::savePlotPdfReportAs( fileName, plotWindow ); diff --git a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp index 21acad64d6..8c70496330 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp +++ b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp @@ -34,7 +34,7 @@ CAF_PDM_SOURCE_INIT( RicLinkVisibleViewsFeatureUi, "RicLinkVisibleViewsFeatureUi //-------------------------------------------------------------------------------------------------- RicLinkVisibleViewsFeatureUi::RicLinkVisibleViewsFeatureUi( void ) { - CAF_PDM_InitObject( "Link Visible Views Feature UI", ":/LinkView16x16.png" ); + CAF_PDM_InitObject( "Link Visible Views Feature UI", ":/LinkView.svg" ); CAF_PDM_InitFieldNoDefault( &m_masterView, "MasterView", "Primary View" ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 243df83250..ca4b81f23e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -96,6 +96,8 @@ RimPlotAxisProperties::RimPlotAxisProperties() CAF_PDM_InitFieldNoDefault( &m_annotations, "Annotations", "" ); m_annotations.uiCapability()->setUiTreeHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_majorTickmarkCount, "MajorTickmarkCount", "Major Tickmark Count" ); + updateOptionSensitivity(); } @@ -231,6 +233,7 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr scaleGroup.add( &m_visibleRangeMax ); } scaleGroup.add( &m_valuesFontSize ); + scaleGroup.add( &m_majorTickmarkCount ); scaleGroup.add( &m_plotAxis ); m_plotAxis.uiCapability()->setUiReadOnly( m_isAlwaysRequired ); @@ -437,6 +440,22 @@ void RimPlotAxisProperties::setVisibleRangeMax( double value ) m_visibleRangeMax = value; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimPlotAxisPropertiesInterface::LegendTickmarkCount RimPlotAxisProperties::majorTickmarkCount() const +{ + return m_majorTickmarkCount(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::setMajorTickmarkCount( LegendTickmarkCount count ) +{ + m_majorTickmarkCount = count; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index 886d4019e7..a96cdfb090 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -103,6 +103,9 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface void setVisibleRangeMin( double value ) override; void setVisibleRangeMax( double value ) override; + LegendTickmarkCount majorTickmarkCount() const override; + void setMajorTickmarkCount( LegendTickmarkCount count ) override; + protected: void initAfterRead() override; caf::PdmFieldHandle* userDescriptionField() override; @@ -134,6 +137,7 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface caf::PdmField m_name; caf::PdmField> m_plotAxis; caf::PdmField m_plotAxisIndex; + caf::PdmField m_majorTickmarkCount; caf::PdmField m_isLogarithmicScaleEnabled; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp index 9189c4a337..20ef8d8628 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp @@ -15,9 +15,13 @@ // for more details. // ///////////////////////////////////////////////////////////////////////////////// + #include "RimPlotAxisPropertiesInterface.h" +#include "RimSummaryMultiPlot.h" + #include "cafAppEnum.h" +#include "cafPdmUiTreeAttributes.h" CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotAxisPropertiesInterface, "PlotAxisPropertiesInterface", @@ -68,3 +72,53 @@ bool RimPlotAxisPropertiesInterface::isLogarithmicScaleEnabled() const { return false; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimPlotAxisPropertiesInterface::tickmarkCountFromEnum( LegendTickmarkCount count ) +{ + int maxTickmarkCount = 8; + + switch ( count ) + { + case LegendTickmarkCount::TICKMARK_VERY_FEW: + maxTickmarkCount = 2; + break; + case LegendTickmarkCount::TICKMARK_FEW: + maxTickmarkCount = 4; + break; + case LegendTickmarkCount::TICKMARK_DEFAULT: + maxTickmarkCount = 8; // Taken from QwtPlot::initAxesData() + break; + case LegendTickmarkCount::TICKMARK_MANY: + maxTickmarkCount = 10; + break; + default: + break; + } + + return maxTickmarkCount; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisPropertiesInterface::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) +{ + RimSummaryMultiPlot* summaryMultiPlot = nullptr; + firstAncestorOfType( summaryMultiPlot ); + + if ( summaryMultiPlot && summaryMultiPlot->isSubPlotAxesLinked() ) + { + auto* treeItemAttribute = dynamic_cast( attribute ); + if ( treeItemAttribute ) + { + treeItemAttribute->tags.clear(); + auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create(); + tag->icon = caf::IconProvider( ":/chain.png" ); + + treeItemAttribute->tags.push_back( std::move( tag ) ); + } + } +} diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h index b88fb58a4b..693efece25 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h @@ -74,8 +74,16 @@ class RimPlotAxisPropertiesInterface : public caf::PdmObject virtual bool isLogarithmicScaleEnabled() const; + virtual LegendTickmarkCount majorTickmarkCount() const = 0; + virtual void setMajorTickmarkCount( LegendTickmarkCount count ) = 0; + + static int tickmarkCountFromEnum( LegendTickmarkCount count ); + public: virtual AxisTitlePositionType titlePosition() const = 0; virtual int titleFontSize() const = 0; virtual int valuesFontSize() const = 0; + +private: + void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 891b4e877e..686580de7c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -157,10 +157,7 @@ RimProject::RimProject( void ) CAF_PDM_InitFieldNoDefault( &mainPlotCollection, "MainPlotCollection", "Plots" ); mainPlotCollection.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitFieldNoDefault( &viewLinkerCollection, - "LinkedViews", - "Linked Views (field in RimProject", - ":/LinkView16x16.png" ); + CAF_PDM_InitFieldNoDefault( &viewLinkerCollection, "LinkedViews", "Linked Views", ":/LinkView.svg" ); viewLinkerCollection.uiCapability()->setUiTreeHidden( true ); viewLinkerCollection = new RimViewLinkerCollection; diff --git a/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp index 138e427be3..fd9f4d2021 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewLinkerCollection.cpp @@ -31,7 +31,7 @@ CAF_PDM_SOURCE_INIT( RimViewLinkerCollection, "RimViewLinkerCollection" ); //-------------------------------------------------------------------------------------------------- RimViewLinkerCollection::RimViewLinkerCollection( void ) { - CAF_PDM_InitObject( "Linked Views", ":/LinkView16x16.png" ); + CAF_PDM_InitObject( "Linked Views", ":/LinkView.svg" ); CAF_PDM_InitField( &isActive, "Active", true, "Active" ); isActive.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 211db93431..4c0251bf51 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -307,7 +307,6 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde auto layoutGroup = uiOrdering.addNewGroup( "Layout" ); layoutGroup->add( &m_columnCount ); layoutGroup->add( &m_rowsPerPage ); - layoutGroup->add( &m_majorTickmarkCount ); auto axesGroup = uiOrdering.addNewGroup( "Axes" ); axesGroup->add( &m_axisRangeAggregation ); @@ -787,6 +786,14 @@ void RimSummaryMultiPlot::makeSureIsVisible( RimSummaryPlot* summaryPlot ) if ( summaryPlot->plotWidget() && !m_viewer.isNull() ) m_viewer->scrollToPlot( summaryPlot->plotWidget() ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryMultiPlot::isSubPlotAxesLinked() const +{ + return m_linkSubPlotAxes(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 604b9e047f..fc7ca8fade 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -90,6 +90,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void makeSureIsVisible( RimSummaryPlot* plot ); + bool isSubPlotAxesLinked() const; + void zoomAll() override; protected: diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 4db4599a0d..553dc6f62f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -849,6 +849,11 @@ void RimSummaryPlot::updateAxis( RiaDefines::PlotAxis plotAxis ) } plotWidget()->enableAxisNumberLabels( riuPlotAxis, axisProperties->showNumbers() ); + + RimSummaryTimeAxisProperties::LegendTickmarkCount tickmarkCountEnum = axisProperties->majorTickmarkCount(); + int maxTickmarkCount = RimPlotAxisPropertiesInterface::tickmarkCountFromEnum( tickmarkCountEnum ); + + plotWidget()->setAutoTickIntervalCounts( riuPlotAxis, maxTickmarkCount, maxTickmarkCount ); } } } @@ -1110,26 +1115,7 @@ void RimSummaryPlot::updateTimeAxis( RimSummaryTimeAxisProperties* timeAxisPrope { RimSummaryTimeAxisProperties::LegendTickmarkCount tickmarkCountEnum = timeAxisProperties->majorTickmarkCount(); - - int maxTickmarkCount = 8; - - switch ( tickmarkCountEnum ) - { - case RimSummaryTimeAxisProperties::LegendTickmarkCount::TICKMARK_VERY_FEW: - maxTickmarkCount = 2; - break; - case RimSummaryTimeAxisProperties::LegendTickmarkCount::TICKMARK_FEW: - maxTickmarkCount = 4; - break; - case RimSummaryTimeAxisProperties::LegendTickmarkCount::TICKMARK_DEFAULT: - maxTickmarkCount = 8; // Taken from QwtPlot::initAxesData() - break; - case RimSummaryTimeAxisProperties::LegendTickmarkCount::TICKMARK_MANY: - maxTickmarkCount = 10; - break; - default: - break; - } + int maxTickmarkCount = RimPlotAxisPropertiesInterface::tickmarkCountFromEnum( tickmarkCountEnum ); plotWidget()->setAxisMaxMajor( RiuPlotAxis::defaultBottom(), maxTickmarkCount ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index 78ad7e23cd..8c6821907f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -573,7 +573,10 @@ void RimSummaryTimeAxisProperties::defineUiOrdering( QString uiConfigName, caf:: timeGroup->add( &m_visibleTimeSinceStartRangeMax ); timeGroup->add( &m_visibleTimeSinceStartRangeMin ); } + timeGroup->add( &m_valuesFontSize ); + timeGroup->add( &m_majorTickmarkCount ); + if ( m_timeMode() == DATE ) { caf::PdmUiGroup* advancedGroup = timeGroup->addNewGroup( "Date/Time Label Format" ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h index 699ef2f1c5..a7849fa5ef 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h @@ -104,8 +104,8 @@ class RimSummaryTimeAxisProperties : public RimPlotAxisPropertiesInterface void setVisibleDateTimeMin( const QDateTime& dateTime ); void setVisibleDateTimeMax( const QDateTime& dateTime ); - LegendTickmarkCount majorTickmarkCount() const; - void setMajorTickmarkCount( LegendTickmarkCount count ); + LegendTickmarkCount majorTickmarkCount() const override; + void setMajorTickmarkCount( LegendTickmarkCount count ) override; const QString& name() const override; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index f8874f35a5..056a38a33d 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -18,6 +18,7 @@ #include "RiuMultiPlotBook.h" #include "RiaGuiApplication.h" +#include "RiaPlotDefines.h" #include "RiaPlotWindowRedrawScheduler.h" #include "RiaPreferences.h" @@ -342,8 +343,7 @@ void RiuMultiPlotBook::scheduleReplotOfAllPlots() //-------------------------------------------------------------------------------------------------- void RiuMultiPlotBook::renderTo( QPaintDevice* paintDevice ) { - int resolution = paintDevice->logicalDpiX(); - double scaling = resolution / static_cast( RiaGuiApplication::applicationResolution() ); + auto scaling = RiaDefines::scalingFactor( paintDevice ); QPainter painter( paintDevice ); diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index f131a28f46..ca6c3d8e61 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -26,6 +26,7 @@ #include "WellLogCommands/RicWellLogPlotTrackFeatureImpl.h" #include "RiaGuiApplication.h" +#include "RiaPlotDefines.h" #include "RimContextCommandBuilder.h" #include "RimMultiPlot.h" @@ -359,8 +360,7 @@ void RiuMultiPlotPage::updateSubTitles() //-------------------------------------------------------------------------------------------------- void RiuMultiPlotPage::renderTo( QPaintDevice* paintDevice ) { - int resolution = paintDevice->logicalDpiX(); - double scaling = resolution / static_cast( RiaGuiApplication::applicationResolution() ); + auto scaling = RiaDefines::scalingFactor( paintDevice ); QPainter painter( paintDevice ); renderTo( &painter, scaling ); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 2853f282f4..2853fc747b 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -24,6 +24,7 @@ #include "RiaGuiApplication.h" #include "RiaPlotDefines.h" #include "RiaPlotWindowRedrawScheduler.h" + #include "RimPlot.h" #include "RiuDraggableOverlayFrame.h" @@ -757,8 +758,8 @@ void RiuQwtPlotWidget::renderTo( QPainter* painter, const QRect& targetRect, dou //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::renderTo( QPaintDevice* paintDevice, const QRect& targetRect ) { - int resolution = paintDevice->logicalDpiX(); - double scaling = resolution / static_cast( RiaGuiApplication::applicationResolution() ); + auto scaling = RiaDefines::scalingFactor( paintDevice ); + QPainter painter( paintDevice ); renderTo( &painter, targetRect, scaling ); } From 571011c2bd443ead16acb32501feec5aaff705ca Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 25 Apr 2022 15:06:16 +0200 Subject: [PATCH 249/406] #8833 Import Of Observed FMU Data: Improve parsing of text files --- .../FileInterface/RifReaderFmuRft.cpp | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp b/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp index 8cbe04d2bd..a1f085cba9 100644 --- a/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp @@ -418,32 +418,32 @@ RifReaderFmuRft::WellObservationMap RifReaderFmuRft::loadWellDates( QDir& dir, Q return WellObservationMap(); } QTextStream fileStream( &wellDateFile ); - while ( true ) + while ( !fileStream.atEnd() ) { QString line = fileStream.readLine(); - if ( line.isNull() ) + + line = line.simplified(); + if ( line.isNull() || line.isEmpty() ) { - break; + continue; } - else + + QTextStream lineStream( &line ); + + QString wellName; + int day, month, year, measurementIndex; + + lineStream >> wellName >> day >> month >> year >> measurementIndex; + if ( lineStream.status() != QTextStream::Ok ) { - QTextStream lineStream( &line ); - - QString wellName; - int day, month, year, measurementIndex; - - lineStream >> wellName >> day >> month >> year >> measurementIndex; - if ( lineStream.status() != QTextStream::Ok ) - { - *errorMsg = QString( "Failed to parse '%1'" ).arg( wellDateFileInfo.absoluteFilePath() ); - return WellObservationMap(); - } - - QDateTime dateTime = RiaQDateTimeTools::createDateTime( QDate( year, month, day ) ); - dateTime.setTimeSpec( Qt::UTC ); - WellObservationSet observationSet( dateTime, measurementIndex ); - validObservations.insert( std::make_pair( wellName, observationSet ) ); + *errorMsg = QString( "Failed to parse '%1'" ).arg( wellDateFileInfo.absoluteFilePath() ); + return WellObservationMap(); } + + QDateTime dateTime = RiaQDateTimeTools::createDateTime( QDate( year, month, day ) ); + dateTime.setTimeSpec( Qt::UTC ); + WellObservationSet observationSet( dateTime, measurementIndex ); + validObservations.insert( std::make_pair( wellName, observationSet ) ); } } From 0f5d949af0af97c8bf126002624c660ed2ee0ff9 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Tue, 26 Apr 2022 12:08:22 +0200 Subject: [PATCH 250/406] Merge pull request #8838 from OPM/datasource_steppingtoolbar Add simplified data source stepping control in toolbar --- .../Summary/RimSummaryPlotControls.cpp | 66 +------ .../Summary/RimSummaryPlotControls.h | 8 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 187 +++++++++--------- .../Summary/RimSummaryPlotSourceStepping.h | 32 ++- .../cafPdmUiToolBarEditor.cpp | 7 +- 5 files changed, 128 insertions(+), 172 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.cpp index 68f736a772..7b5482798b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.cpp @@ -34,39 +34,15 @@ bool RimSummaryPlotControls::handleKeyEvents( RimSummaryPlotSourceStepping* srcS bool bHandled = false; - if ( keyEvent->key() == Qt::Key_Left ) + if ( keyEvent->key() == Qt::Key_Up ) { - srcStepping->applyPrevOtherIdentifier(); - keyEvent->accept(); - bHandled = true; - } - else if ( keyEvent->key() == Qt::Key_Right ) - { - srcStepping->applyNextOtherIdentifier(); - keyEvent->accept(); - bHandled = true; - } - else if ( keyEvent->key() == Qt::Key_PageDown ) - { - srcStepping->applyNextCase(); - keyEvent->accept(); - bHandled = true; - } - else if ( keyEvent->key() == Qt::Key_PageUp ) - { - srcStepping->applyPrevCase(); - keyEvent->accept(); - bHandled = true; - } - else if ( keyEvent->key() == Qt::Key_Up ) - { - srcStepping->applyPrevQuantity(); + srcStepping->applyPrevStep(); keyEvent->accept(); bHandled = true; } else if ( keyEvent->key() == Qt::Key_Down ) { - srcStepping->applyNextQuantity(); + srcStepping->applyNextStep(); keyEvent->accept(); bHandled = true; } @@ -77,7 +53,7 @@ bool RimSummaryPlotControls::handleKeyEvents( RimSummaryPlotSourceStepping* srcS //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimSummaryPlotControls::quantityNextKeyText() +QString RimSummaryPlotControls::nextStepKeyText() { return QString( "Ctrl-Down" ); } @@ -85,39 +61,7 @@ QString RimSummaryPlotControls::quantityNextKeyText() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimSummaryPlotControls::quantityPrevKeyText() +QString RimSummaryPlotControls::prevStepKeyText() { return QString( "Ctrl-Up" ); } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryPlotControls::caseNextKeyText() -{ - return QString( "Ctrl-PgDown" ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryPlotControls::casePrevKeyText() -{ - return QString( "Ctrl-PgUp" ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryPlotControls::otherNextKeyText() -{ - return QString( "Ctrl-Right" ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryPlotControls::otherPrevKeyText() -{ - return QString( "Ctrl-Left" ); -} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.h index 55f5c18962..3d36431cc4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotControls.h @@ -28,12 +28,8 @@ class RimSummaryPlotControls public: static bool handleKeyEvents( RimSummaryPlotSourceStepping* srcStepping, QKeyEvent* keyEvent ); - static QString quantityNextKeyText(); - static QString quantityPrevKeyText(); - static QString caseNextKeyText(); - static QString casePrevKeyText(); - static QString otherNextKeyText(); - static QString otherPrevKeyText(); + static QString nextStepKeyText(); + static QString prevStepKeyText(); private: RimSummaryPlotControls() = default; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 155648d3e5..6926bf5e5d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -42,9 +42,26 @@ #include "cafPdmUiComboBoxEditor.h" #include "cafPdmUiItem.h" +#include "cafPdmUiLabelEditor.h" #include "cafPdmUiListEditor.h" #include "cafPdmUiToolBarEditor.h" +namespace caf +{ +template <> +void AppEnum::setUp() +{ + addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::QUANTITY, "QUANTITY", "Quantity" ); + addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::WELL, "WELL", "Well" ); + addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::SUMMARY_CASE, "SUMMARY_CASE", "Summary Case" ); + addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::ENSEMBLE, "ENSEMBLE", "Ensemble" ); + addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::GROUP, "GROUP", "Group" ); + addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::REGION, "REGION", "Region" ); + addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::BLOCK, "BLOCK", "Block" ); + setDefault( RimSummaryPlotSourceStepping::SourceSteppingDimension::QUANTITY ); +} +} // namespace caf + CAF_PDM_SOURCE_INIT( RimSummaryPlotSourceStepping, "RimSummaryCurveCollectionModifier" ); //-------------------------------------------------------------------------------------------------- @@ -55,6 +72,8 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() { CAF_PDM_InitObject( "Summary Curves Modifier" ); + CAF_PDM_InitFieldNoDefault( &m_stepDimension, "StepDimension", "Step Dimension" ); + CAF_PDM_InitFieldNoDefault( &m_summaryCase, "CurveCase", "Case" ); CAF_PDM_InitField( &m_includeEnsembleCasesForCaseStepping, @@ -78,6 +97,10 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() m_placeholderForLabel = "No common identifiers detected"; m_placeholderForLabel.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_placeholderForLabel.uiCapability()->setUiReadOnly( true ); + + CAF_PDM_InitField( &m_indexLabel, "IndexLabel", QString( "Step By" ), "Step By" ); + m_indexLabel.uiCapability()->setUiEditorTypeName( caf::PdmUiLabelEditor::uiEditorTypeName() ); + m_indexLabel.xmlCapability()->disableIO(); } //-------------------------------------------------------------------------------------------------- @@ -99,45 +122,7 @@ void RimSummaryPlotSourceStepping::setSourceSteppingObject( caf::PdmObject* sour //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlotSourceStepping::applyNextCase() -{ - modifyCurrentIndex( &m_summaryCase, 1 ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryPlotSourceStepping::applyPrevCase() -{ - modifyCurrentIndex( &m_summaryCase, -1 ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryPlotSourceStepping::applyNextQuantity() -{ - if ( !m_quantity.uiCapability()->isUiHidden() ) - { - modifyCurrentIndex( &m_quantity, 1 ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryPlotSourceStepping::applyPrevQuantity() -{ - if ( !m_quantity.uiCapability()->isUiHidden() ) - { - modifyCurrentIndex( &m_quantity, -1 ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryPlotSourceStepping::applyNextOtherIdentifier() +void RimSummaryPlotSourceStepping::applyNextStep() { caf::PdmValueField* valueField = fieldToModify(); if ( !valueField ) return; @@ -148,7 +133,7 @@ void RimSummaryPlotSourceStepping::applyNextOtherIdentifier() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlotSourceStepping::applyPrevOtherIdentifier() +void RimSummaryPlotSourceStepping::applyPrevStep() { caf::PdmValueField* valueField = fieldToModify(); if ( !valueField ) return; @@ -161,8 +146,7 @@ void RimSummaryPlotSourceStepping::applyPrevOtherIdentifier() //-------------------------------------------------------------------------------------------------- std::vector RimSummaryPlotSourceStepping::fieldsToShowInToolbar() { - bool fieldsForToolbar = true; - return activeFieldsForDataSourceStepping( fieldsForToolbar ); + return toolbarFieldsForDataSourceStepping(); } //-------------------------------------------------------------------------------------------------- @@ -170,8 +154,7 @@ std::vector RimSummaryPlotSourceStepping::fieldsToShowInTo //-------------------------------------------------------------------------------------------------- void RimSummaryPlotSourceStepping::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - bool fieldsForToolbar = false; - auto visible = activeFieldsForDataSourceStepping( fieldsForToolbar ); + auto visible = activeFieldsForDataSourceStepping(); if ( visible.empty() ) { uiOrdering.add( &m_placeholderForLabel ); @@ -194,12 +177,12 @@ QList { QList options; - if ( fieldNeedingOptions == &m_includeEnsembleCasesForCaseStepping ) + if ( ( fieldNeedingOptions == &m_includeEnsembleCasesForCaseStepping ) || ( fieldNeedingOptions == &m_stepDimension ) ) { return caf::PdmObject::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); } - if ( fieldNeedingOptions == &m_placeholderForLabel ) + if ( ( fieldNeedingOptions == &m_placeholderForLabel ) || ( fieldNeedingOptions == &m_indexLabel ) ) { return options; } @@ -381,6 +364,13 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* std::vector curves; if ( dataSourceSteppingObject() ) curves = dataSourceSteppingObject()->allCurves( m_sourceSteppingType ); + if ( changedField == &m_stepDimension ) + { + RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); + mainPlotWindow->updateMultiPlotToolBar(); + return; + } + if ( changedField == &m_includeEnsembleCasesForCaseStepping ) { RimSummaryCurveCollection* curveCollection = nullptr; @@ -606,37 +596,41 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* //-------------------------------------------------------------------------------------------------- caf::PdmValueField* RimSummaryPlotSourceStepping::fieldToModify() { - RiaSummaryAddressAnalyzer analyzer; - analyzer.appendAddresses( addressesForCurvesInPlot() ); - - if ( analyzer.wellNames().size() == 1 ) + switch ( m_stepDimension() ) { - return &m_wellName; - } + case SourceSteppingDimension::SUMMARY_CASE: + return &m_summaryCase; + break; - if ( analyzer.groupNames().size() == 1 ) - { - return &m_groupName; - } + case SourceSteppingDimension::ENSEMBLE: + return &m_ensemble; - if ( analyzer.regionNumbers().size() == 1 ) - { - return &m_region; - } + case SourceSteppingDimension::WELL: + return &m_wellName; - if ( analyzer.blocks().size() == 1 ) - { - return &m_cellBlock; - } + case SourceSteppingDimension::GROUP: + return &m_groupName; - if ( analyzer.wellNames().size() == 1 ) - { - auto wellName = *( analyzer.wellNames().begin() ); + case SourceSteppingDimension::REGION: + return &m_region; - if ( analyzer.wellSegmentNumbers( wellName ).size() == 1 ) - { + case SourceSteppingDimension::QUANTITY: + return &m_quantity; + + case SourceSteppingDimension::BLOCK: + return &m_cellBlock; + + case SourceSteppingDimension::SEGMENT: return &m_segment; - } + + case SourceSteppingDimension::COMPLETION: + return &m_completion; + + case SourceSteppingDimension::AQUIFER: + return &m_aquifer; + + default: + break; } return nullptr; @@ -748,13 +742,15 @@ std::set RimSummaryPlotSourceStepping::summaryCasesCurveCollect //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RimSummaryPlotSourceStepping::activeFieldsForDataSourceStepping( bool toolbarFields ) +std::vector RimSummaryPlotSourceStepping::activeFieldsForDataSourceStepping() { RimProject* proj = RimProject::current(); if ( !proj ) return {}; std::vector fields; + fields.push_back( &m_stepDimension ); + auto sumCases = summaryCasesCurveCollection(); if ( sumCases.size() == 1 ) { @@ -763,7 +759,7 @@ std::vector RimSummaryPlotSourceStepping::activeFieldsForD m_summaryCase = *( sumCases.begin() ); fields.push_back( &m_summaryCase ); - if ( !toolbarFields ) fields.push_back( &m_includeEnsembleCasesForCaseStepping ); + fields.push_back( &m_includeEnsembleCasesForCaseStepping ); } } @@ -988,33 +984,21 @@ void RimSummaryPlotSourceStepping::defineEditorAttribute( const caf::PdmFieldHan caf::PdmUiComboBoxEditorAttribute* myAttr = dynamic_cast( attribute ); if ( myAttr ) { - myAttr->showPreviousAndNextButtons = true; - myAttr->nextIcon = QIcon( ":/ComboBoxDown.svg" ); - myAttr->previousIcon = QIcon( ":/ComboBoxUp.svg" ); - - QString nextText; - QString prevText; - - if ( field == &m_summaryCase ) - { - nextText = RimSummaryPlotControls::caseNextKeyText(); - prevText = RimSummaryPlotControls::casePrevKeyText(); - } - else if ( field == &m_wellName || field == &m_groupName || field == &m_region ) - { - nextText = RimSummaryPlotControls::otherNextKeyText(); - prevText = RimSummaryPlotControls::otherPrevKeyText(); - } - else if ( field == &m_quantity ) + if ( field == &m_stepDimension ) { - nextText = RimSummaryPlotControls::quantityNextKeyText(); - prevText = RimSummaryPlotControls::quantityPrevKeyText(); + myAttr->showPreviousAndNextButtons = false; } - - if ( !nextText.isEmpty() ) + else { + QString nextText = RimSummaryPlotControls::nextStepKeyText(); + QString prevText = RimSummaryPlotControls::prevStepKeyText(); myAttr->nextButtonText = "Next (" + nextText + ")"; myAttr->prevButtonText = "Previous (" + prevText + ")"; + + myAttr->nextIcon = QIcon( ":/ComboBoxDown.svg" ); + myAttr->previousIcon = QIcon( ":/ComboBoxUp.svg" ); + + myAttr->showPreviousAndNextButtons = true; } } @@ -1023,3 +1007,18 @@ void RimSummaryPlotSourceStepping::defineEditorAttribute( const caf::PdmFieldHan myAttr->minimumWidth = 120; } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryPlotSourceStepping::toolbarFieldsForDataSourceStepping() +{ + std::vector fields; + fields.push_back( &m_indexLabel ); + fields.push_back( &m_stepDimension ); + + caf::PdmFieldHandle* field = fieldToModify(); + if ( field != nullptr ) fields.push_back( field ); + + return fields; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index 6c54b87510..faab5eb4ff 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -42,20 +42,29 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject { CAF_PDM_HEADER_INIT; +public: + enum class SourceSteppingDimension + { + SUMMARY_CASE, + ENSEMBLE, + WELL, + GROUP, + REGION, + QUANTITY, + BLOCK, + SEGMENT, + COMPLETION, + AQUIFER + }; + public: RimSummaryPlotSourceStepping(); void setSourceSteppingType( RimSummaryDataSourceStepping::Axis sourceSteppingType ); void setSourceSteppingObject( caf::PdmObject* sourceObject ); - void applyNextCase(); - void applyPrevCase(); - - void applyNextQuantity(); - void applyPrevQuantity(); - - void applyNextOtherIdentifier(); - void applyPrevOtherIdentifier(); + void applyNextStep(); + void applyPrevStep(); std::vector fieldsToShowInToolbar(); @@ -78,9 +87,11 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject std::set addressesForCurvesInPlot() const; std::set summaryCasesCurveCollection() const; - std::vector activeFieldsForDataSourceStepping( bool toolbarFields ); std::set ensembleCollection() const; + std::vector activeFieldsForDataSourceStepping(); + std::vector toolbarFieldsForDataSourceStepping(); + bool isXAxisStepping() const; bool isYAxisStepping() const; @@ -93,6 +104,9 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject private: caf::PdmPointer m_objectForSourceStepping; + caf::PdmField m_indexLabel; + caf::PdmField> m_stepDimension; + caf::PdmPtrField m_summaryCase; caf::PdmPtrField m_ensemble; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp index 57314c9426..f61e06c4b6 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiToolBarEditor.cpp @@ -183,8 +183,11 @@ void PdmUiToolBarEditor::configureAndUpdateUi( const QString& uiConfigName ) } } - CAF_ASSERT( m_fields.size() == m_fieldViews.size() ); - CAF_ASSERT( static_cast( m_fields.size() ) == m_actions.size() ); + // CAF_ASSERT( m_fields.size() == m_fieldViews.size() ); + if ( static_cast( m_fields.size() ) != m_actions.size() ) return; + + // CAF_ASSERT( static_cast( m_fields.size() ) == m_actions.size() ); + if ( static_cast( m_fields.size() ) != m_actions.size() ) return; for ( size_t i = 0; i < m_fields.size(); i++ ) { From cb8b18222e8fd025bc3dfa55f28fd7e9ab5bd744 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 26 Apr 2022 10:19:46 +0200 Subject: [PATCH 251/406] #8827 Avoid UI updates during delete of a sub plot --- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 5 +++++ ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 553dc6f62f..58afbe7589 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -98,6 +98,7 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) , m_isCrossPlot( isCrossPlot ) , curvesChanged( this ) , axisChanged( this ) + , m_isValid( true ) { CAF_PDM_InitScriptableObject( "Summary Plot", ":/SummaryPlotLight16x16.png", "", "A Summary Plot" ); @@ -192,6 +193,8 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) //-------------------------------------------------------------------------------------------------- RimSummaryPlot::~RimSummaryPlot() { + m_isValid = false; + removeMdiWindowFromMdiArea(); deletePlotCurvesAndPlotWidget(); @@ -1567,6 +1570,8 @@ QImage RimSummaryPlot::snapshotWindowContent() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) { + if ( !m_isValid ) return; + bool isPlotEditor = ( uiConfigName == RicSummaryPlotEditorUi::CONFIGURATION_NAME ); if ( !isPlotEditor ) uiTreeOrdering.add( &m_axisProperties ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index bbaef975d9..960b9ad32b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -327,4 +327,6 @@ private slots: std::unique_ptr m_nameHelperAllCurves; caf::PdmChildField m_sourceStepping; + + bool m_isValid; }; From 79fdc825cac69799feb2f00eea87e3dcaca01a48 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 26 Apr 2022 10:36:32 +0200 Subject: [PATCH 252/406] #8843 Summary Curve : Set nullptr as curve symbol for None --- ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index 29954f5cc0..26d1eb4e18 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -506,12 +506,8 @@ void RiuQwtPlotCurve::setVisibleInLegend( bool isVisibleInLegend ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotCurve::setSymbol( RiuPlotCurveSymbol* symbol ) { - if ( symbol ) - { - auto qwtSymbol = dynamic_cast( symbol ); - CAF_ASSERT( qwtSymbol ); - QwtPlotCurve::setSymbol( qwtSymbol ); - } + auto qwtSymbol = dynamic_cast( symbol ); + QwtPlotCurve::setSymbol( qwtSymbol ); } //-------------------------------------------------------------------------------------------------- From 8c76921beda73df0a8e2653e08a240a6023b0732 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 26 Apr 2022 10:48:05 +0200 Subject: [PATCH 253/406] Summary Curve: Do not show legend if empty --- ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp index 45f6f3a263..006eec152d 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp @@ -119,7 +119,7 @@ void RiuSummaryMultiPlotPage::reinsertPlotWidgets() if ( legends[visibleIndex] ) { - if ( m_plotDefinition->legendsVisible() ) + if ( m_plotDefinition->legendsVisible() && !legends[visibleIndex]->isEmpty() ) { int legendColumns = 1; if ( m_plotDefinition->legendsHorizontal() ) From 386ba1cbac5f15af8662dc0db670517098041622 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 25 Apr 2022 11:42:03 +0200 Subject: [PATCH 254/406] Use plot axis as key to compute range values from sub plots --- .../ProjectDataModel/Summary/RimSummaryMultiPlot.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 4c0251bf51..a2ef8836fe 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -538,7 +538,7 @@ void RimSummaryMultiPlot::syncAxisRanges() } else if ( m_axisRangeAggregation() == AxisRangeAggregation::SUB_PLOTS ) { - std::map> axisRanges; + std::map> axisRanges; // gather current min/max values for each category (axis label) for ( auto plot : summaryPlots() ) @@ -548,14 +548,14 @@ void RimSummaryMultiPlot::syncAxisRanges() double minVal = axis->visibleRangeMin(); double maxVal = axis->visibleRangeMax(); - if ( axisRanges.count( axis->name() ) == 0 ) + if ( axisRanges.count( axis->plotAxisType() ) == 0 ) { - axisRanges[axis->name()] = std::make_pair( axis->visibleRangeMin(), axis->visibleRangeMax() ); + axisRanges[axis->plotAxisType()] = std::make_pair( axis->visibleRangeMin(), axis->visibleRangeMax() ); } else { - auto& [currentMin, currentMax] = axisRanges[axis->name()]; - axisRanges[axis->name()] = + auto& [currentMin, currentMax] = axisRanges[axis->plotAxisType()]; + axisRanges[axis->plotAxisType()] = std::make_pair( std::min( currentMin, minVal ), std::max( currentMax, maxVal ) ); } } @@ -566,7 +566,7 @@ void RimSummaryMultiPlot::syncAxisRanges() { for ( auto axis : plot->plotAxes() ) { - const auto& [minVal, maxVal] = axisRanges[axis->name()]; + const auto& [minVal, maxVal] = axisRanges[axis->plotAxisType()]; axis->setAutoZoom( false ); axis->setVisibleRangeMin( minVal ); axis->setVisibleRangeMax( maxVal ); From 73d598ee7e4177352c97a86c5fc2b061437f5d27 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 25 Apr 2022 15:34:04 +0200 Subject: [PATCH 255/406] Fix crash during delete of multiplot --- ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp | 11 +++++++++++ ApplicationLibCode/ProjectDataModel/RimMultiPlot.h | 4 ++++ ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp | 2 ++ ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp | 3 +++ 4 files changed, 20 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 121e1d804a..7912416814 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -45,6 +45,7 @@ CAF_PDM_SOURCE_INIT( RimMultiPlot, "MultiPlot" ); /// //-------------------------------------------------------------------------------------------------- RimMultiPlot::RimMultiPlot() + : m_isValid( true ) { CAF_PDM_InitObject( "Multi Plot", ":/MultiPlot16x16.png" ); @@ -84,6 +85,8 @@ RimMultiPlot::RimMultiPlot() //-------------------------------------------------------------------------------------------------- RimMultiPlot::~RimMultiPlot() { + m_isValid = false; + removeMdiWindowFromMdiArea(); m_plots.deleteAllChildObjects(); @@ -897,3 +900,11 @@ std::vector RimMultiPlot::fieldsToShowInToolbar() { return { &m_pagePreviewMode, &m_columnCount, &m_rowsPerPage }; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimMultiPlot::isValid() const +{ + return m_isValid; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index a0af751746..93218b3d41 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -107,6 +107,8 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection fieldsToShowInToolbar(); + bool isValid() const; + protected: QImage snapshotWindowContent() override; @@ -169,4 +171,6 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection m_plots; + + bool m_isValid; }; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 056a38a33d..320ae84e3b 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -492,6 +492,8 @@ bool RiuMultiPlotBook::showYAxis( int row, int column ) const //-------------------------------------------------------------------------------------------------- void RiuMultiPlotBook::performUpdate( bool regeneratePages ) { + if ( !m_plotDefinition || !m_plotDefinition->isValid() ) return; + applyLook(); if ( regeneratePages || m_pages.size() == 0 ) { diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index ca6c3d8e61..3ba10d26a9 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -563,6 +563,9 @@ bool RiuMultiPlotPage::showYAxis( int row, int column ) const //-------------------------------------------------------------------------------------------------- void RiuMultiPlotPage::performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ) { + auto multiPlot = dynamic_cast( m_plotDefinition.p() ); + if ( !multiPlot || !multiPlot->isValid() ) return; + if ( whatToUpdate == RiaDefines::MultiPlotPageUpdateType::ALL ) { applyLook(); From 774538868afb47e587a815e52bf53895023ef5fd Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 26 Apr 2022 15:03:45 +0200 Subject: [PATCH 256/406] #8844 Summary Multi Plot : Optional auto appearance settings --- ...RicAppendSummaryPlotsForObjectsFeature.cpp | 83 +---------- .../RimPlotAxisProperties.cpp | 50 +++++++ .../ProjectDataModel/RimPlotAxisProperties.h | 28 ++-- .../Summary/CMakeLists_files.cmake | 2 + .../Summary/RimSummaryAddressModifier.cpp | 111 +++++++++++++++ .../Summary/RimSummaryAddressModifier.h | 47 +++++++ .../Summary/RimSummaryCurve.cpp | 10 ++ .../Summary/RimSummaryCurve.h | 1 + .../Summary/RimSummaryMultiPlot.cpp | 129 ++++++++++++++++++ .../Summary/RimSummaryMultiPlot.h | 14 ++ .../Summary/RimSummaryPlot.cpp | 19 +-- .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 +- .../Summary/RimSummaryPlotAxisFormatter.cpp | 26 ++-- .../Summary/RimSummaryPlotManager.cpp | 4 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 2 + .../UserInterface/RiuMultiPlotBook.cpp | 4 + .../UserInterface/RiuSummaryMultiPlotBook.cpp | 3 + .../UserInterface/RiuSummaryMultiPlotPage.cpp | 26 ++-- 18 files changed, 429 insertions(+), 132 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.h diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index 48c4e12a8d..cd6aaf9160 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -27,6 +27,7 @@ #include "RimEnsembleCurveSet.h" #include "RimSummaryAddressCollection.h" +#include "RimSummaryAddressModifier.h" #include "RimSummaryCurve.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryMultiPlotCollection.h" @@ -39,80 +40,6 @@ CAF_CMD_SOURCE_INIT( RicAppendSummaryPlotsForObjectsFeature, "RicAppendSummaryPlotsForObjectsFeature" ); -class SummaryAdrModifier -{ -public: - SummaryAdrModifier( RimSummaryCurve* curve ) - : m_curve( curve ) - , m_curveSet( nullptr ) - { - } - - SummaryAdrModifier( RimEnsembleCurveSet* curveSet ) - : m_curve( nullptr ) - , m_curveSet( curveSet ) - { - } - - static std::vector createAddressModifiersForPlot( RimSummaryPlot* summaryPlot ) - { - std::vector mods; - if ( summaryPlot ) - { - auto curveSets = summaryPlot->curveSets(); - for ( auto curveSet : curveSets ) - { - mods.emplace_back( SummaryAdrModifier( curveSet ) ); - } - - auto curves = summaryPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ); - for ( auto c : curves ) - { - mods.emplace_back( SummaryAdrModifier( c ) ); - } - } - - return mods; - } - - static std::vector createEclipseSummaryAddress( RimSummaryPlot* summaryPlot ) - { - auto mods = createAddressModifiersForPlot( summaryPlot ); - return convertToEclipseSummaryAddress( mods ); - } - - RifEclipseSummaryAddress address() const - { - if ( m_curve ) return m_curve->summaryAddressY(); - if ( m_curveSet ) return m_curveSet->summaryAddress(); - - return {}; - } - - void setAddress( const RifEclipseSummaryAddress& address ) - { - if ( m_curve ) m_curve->setSummaryAddressY( address ); - if ( m_curveSet ) m_curveSet->setSummaryAddress( address ); - } - -private: - static std::vector - convertToEclipseSummaryAddress( const std::vector& modifiers ) - { - std::vector tmp; - tmp.reserve( modifiers.size() ); - for ( const auto& m : modifiers ) - { - tmp.emplace_back( m.address() ); - } - return tmp; - } - -private: - RimSummaryCurve* m_curve; - RimEnsembleCurveSet* m_curveSet; -}; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -149,7 +76,7 @@ void RicAppendSummaryPlotsForObjectsFeature::onActionTriggered( bool isChecked ) auto duplicatedPlots = RicSummaryPlotBuilder::duplicateSummaryPlots( plotsForOneInstance ); for ( auto duplicatedPlot : duplicatedPlots ) { - auto adrMods = SummaryAdrModifier::createAddressModifiersForPlot( duplicatedPlot ); + auto adrMods = RimSummaryAddressModifier::createAddressModifiersForPlot( duplicatedPlot ); for ( auto adrMod : adrMods ) { auto sourceAddress = adrMod.address(); @@ -246,7 +173,7 @@ bool RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( for ( auto plot : plotsForObjectType ) { - auto addresses = SummaryAdrModifier::createEclipseSummaryAddress( plot ); + auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( plot ); analyzer.appendAddresses( addresses ); } } @@ -339,7 +266,7 @@ std::vector RicAppendSummaryPlotsForObjectsFeature::plotsForOne RiaSummaryAddressAnalyzer myAnalyser; for ( auto sourcePlot : sourcePlots ) { - auto addresses = SummaryAdrModifier::createEclipseSummaryAddress( sourcePlot ); + auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( sourcePlot ); myAnalyser.appendAddresses( addresses ); } @@ -358,7 +285,7 @@ std::vector RicAppendSummaryPlotsForObjectsFeature::plotsForOne for ( auto sourcePlot : sourcePlots ) { - auto addresses = SummaryAdrModifier::createEclipseSummaryAddress( sourcePlot ); + auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( sourcePlot ); bool isMatching = false; for ( const auto& a : addresses ) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index ca4b81f23e..d3ef5cad76 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -304,6 +304,14 @@ bool RimPlotAxisProperties::useAutoTitle() const return isAutoTitle(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::setShowDescription( bool enable ) +{ + m_displayLongName = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -312,6 +320,14 @@ bool RimPlotAxisProperties::showDescription() const return m_displayLongName(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::setShowAcronym( bool enable ) +{ + m_displayShortName = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -320,6 +336,14 @@ bool RimPlotAxisProperties::showAcronym() const return m_displayShortName(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::setShowUnitText( bool enable ) +{ + m_displayUnitText = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -400,6 +424,32 @@ void RimPlotAxisProperties::setShowNumbers( bool enable ) m_showNumbers = enable; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::setVisible( bool visible ) +{ + m_isActive = visible; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::computeAndSetScaleFactor() +{ + int exponent = std::log10( visibleRangeMax() ); + + while ( exponent > 0 && ( exponent % 3 ) != 0 ) + { + exponent--; + } + + if ( exponent > 0 ) + { + scaleFactor = std::pow( 10, exponent ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index a96cdfb090..b63b4de154 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -70,15 +70,25 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface const QString& name() const override; RiuPlotAxis plotAxisType() const override; bool useAutoTitle() const; - bool showDescription() const; - bool showAcronym() const; - bool showUnitText() const; - bool isAutoZoom() const override; - void setAutoZoom( bool enableAutoZoom ) override; - bool isAxisInverted() const override; - void setAxisInverted( bool inverted ); - bool showNumbers() const; - void setShowNumbers( bool enable ); + + void setShowDescription( bool enable ); + bool showDescription() const; + + void setShowAcronym( bool enable ); + bool showAcronym() const; + + void setShowUnitText( bool enable ); + bool showUnitText() const; + + bool isAutoZoom() const override; + void setAutoZoom( bool enableAutoZoom ) override; + bool isAxisInverted() const override; + void setAxisInverted( bool inverted ); + bool showNumbers() const; + void setShowNumbers( bool enable ); + + void setVisible( bool visible ); + void computeAndSetScaleFactor(); bool isDeletable() const override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake index c5b777c780..01c73aeea1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/Summary/CMakeLists_files.cmake @@ -46,6 +46,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.h ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveInfoTextProvider.h + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressModifier.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -96,6 +97,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSummaryMultiPlotCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryPlotControls.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEnsembleCurveInfoTextProvider.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimSummaryAddressModifier.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.cpp new file mode 100644 index 0000000000..9865bdc4e2 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.cpp @@ -0,0 +1,111 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimSummaryAddressModifier.h" + +#include "RifEclipseSummaryAddress.h" + +#include "RimEnsembleCurveSet.h" +#include "RimSummaryCurve.h" +#include "RimSummaryPlot.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryAddressModifier::RimSummaryAddressModifier( RimSummaryCurve* curve ) + : m_curve( curve ) + , m_curveSet( nullptr ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryAddressModifier::RimSummaryAddressModifier( RimEnsembleCurveSet* curveSet ) + : m_curve( nullptr ) + , m_curveSet( curveSet ) +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryAddressModifier::createAddressModifiersForPlot( RimSummaryPlot* summaryPlot ) +{ + std::vector mods; + if ( summaryPlot ) + { + auto curveSets = summaryPlot->curveSets(); + for ( auto curveSet : curveSets ) + { + mods.emplace_back( RimSummaryAddressModifier( curveSet ) ); + } + + auto curves = summaryPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ); + for ( auto c : curves ) + { + mods.emplace_back( RimSummaryAddressModifier( c ) ); + } + } + + return mods; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryAddressModifier::createEclipseSummaryAddress( RimSummaryPlot* summaryPlot ) +{ + auto mods = createAddressModifiersForPlot( summaryPlot ); + return convertToEclipseSummaryAddress( mods ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifEclipseSummaryAddress RimSummaryAddressModifier::address() const +{ + if ( m_curve ) return m_curve->summaryAddressY(); + if ( m_curveSet ) return m_curveSet->summaryAddress(); + + return {}; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddressModifier::setAddress( const RifEclipseSummaryAddress& address ) +{ + if ( m_curve ) m_curve->setSummaryAddressY( address ); + if ( m_curveSet ) m_curveSet->setSummaryAddress( address ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector + RimSummaryAddressModifier::convertToEclipseSummaryAddress( const std::vector& modifiers ) +{ + std::vector tmp; + tmp.reserve( modifiers.size() ); + for ( const auto& m : modifiers ) + { + tmp.emplace_back( m.address() ); + } + return tmp; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.h new file mode 100644 index 0000000000..4646561929 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressModifier.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +class RimSummaryCurve; +class RimEnsembleCurveSet; +class RimSummaryPlot; +class RifEclipseSummaryAddress; + +#include + +class RimSummaryAddressModifier +{ +public: + RimSummaryAddressModifier( RimSummaryCurve* curve ); + RimSummaryAddressModifier( RimEnsembleCurveSet* curveSet ); + + static std::vector createAddressModifiersForPlot( RimSummaryPlot* summaryPlot ); + static std::vector createEclipseSummaryAddress( RimSummaryPlot* summaryPlot ); + + RifEclipseSummaryAddress address() const; + void setAddress( const RifEclipseSummaryAddress& address ); + +private: + static std::vector + convertToEclipseSummaryAddress( const std::vector& modifiers ); + +private: + RimSummaryCurve* m_curve; + RimEnsembleCurveSet* m_curveSet; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index c94d08c708..bb67b29cc8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -1026,6 +1026,16 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurve::setDefaultCurveAppearance() +{ + RimSummaryPlot* plot = nullptr; + firstAncestorOrThisOfType( plot ); + if ( plot ) plot->applyDefaultCurveAppearances( { this } ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h index 56d869d147..664420f628 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -92,6 +92,7 @@ class RimSummaryCurve : public RimStackablePlotCurve QString curveExportDescription( const RifEclipseSummaryAddress& address = RifEclipseSummaryAddress() ) const override; void setCurveAppearanceFromCaseType(); + void setDefaultCurveAppearance(); void setAsTopZWithinCategory( bool enable ); void setZIndexFromCurveInfo(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index a2ef8836fe..52671af9b2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -31,8 +31,10 @@ #include "RimMainPlotCollection.h" #include "RimMultiPlotCollection.h" #include "RimMultipleSummaryPlotNameHelper.h" +#include "RimPlotAxisProperties.h" #include "RimProject.h" #include "RimSummaryAddress.h" +#include "RimSummaryAddressModifier.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" @@ -40,6 +42,7 @@ #include "RimSummaryPlotControls.h" #include "RimSummaryPlotNameHelper.h" #include "RimSummaryPlotSourceStepping.h" +#include "RimSummaryTimeAxisProperties.h" #include "RiuSummaryMultiPlotBook.h" #include "RiuSummaryVectorSelectionUi.h" @@ -69,6 +72,23 @@ void AppEnum::setUp() } // namespace caf CAF_PDM_SOURCE_INIT( RimSummaryMultiPlot, "MultiSummaryPlot" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::setLayoutInfo( RimSummaryPlot* summaryPlot, int row, int col ) +{ + m_gridLayoutInfo[summaryPlot] = std::make_pair( row, col ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::clearLayoutInfo() +{ + m_gridLayoutInfo.clear(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -92,9 +112,12 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() m_disableWheelZoom.uiCapability()->setUiIconFromResourceString( ":/DisableZoom.png" ); CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" ); + CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", false, "Auto Adjust Appearance" ); + CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Aggregation" ); CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); + m_sourceStepping = new RimSummaryPlotSourceStepping; m_sourceStepping->setSourceSteppingType( RimSummaryDataSourceStepping::Axis::Y_AXIS ); m_sourceStepping->setSourceSteppingObject( this ); @@ -310,7 +333,12 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde auto axesGroup = uiOrdering.addNewGroup( "Axes" ); axesGroup->add( &m_axisRangeAggregation ); + axesGroup->add( &m_linkSubPlotAxes ); + axesGroup->add( &m_autoAdjustAppearance ); + + m_linkSubPlotAxes.uiCapability()->setUiReadOnly( m_autoAdjustAppearance() ); + if ( m_autoAdjustAppearance() ) m_linkSubPlotAxes = false; auto dataSourceGroup = uiOrdering.addNewGroup( "Data Source" ); m_sourceStepping()->uiOrdering( uiConfigName, *dataSourceGroup ); @@ -339,6 +367,10 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi m_createPlotDuplicate = false; duplicate(); } + else if ( changedField == &m_autoAdjustAppearance ) + { + checkAndApplyAutoAppearance(); + } else { RimMultiPlot::fieldChangedByUi( changedField, oldValue, newValue ); @@ -516,6 +548,16 @@ void RimSummaryMultiPlot::initAfterRead() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::onLoadDataAndUpdate() +{ + RimMultiPlot::onLoadDataAndUpdate(); + + checkAndApplyAutoAppearance(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -524,6 +566,18 @@ void RimSummaryMultiPlot::zoomAll() syncAxisRanges(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::checkAndApplyAutoAppearance() +{ + if ( m_autoAdjustAppearance ) + { + analyzePlotsAndAdjustAppearanceSettings(); + syncAxisRanges(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -778,6 +832,62 @@ void RimSummaryMultiPlot::duplicate() duplicatePlot.send( this ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings() +{ + RiaSummaryAddressAnalyzer analyzer; + + for ( auto p : summaryPlots() ) + { + auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( p ); + analyzer.appendAddresses( addresses ); + } + + bool hasOnlyOneQuantity = analyzer.quantities().size() == 1; + + for ( auto p : summaryPlots() ) + { + auto timeAxisProp = p->timeAxisProperties(); + + if ( columnCount() < 3 ) + timeAxisProp->setMajorTickmarkCount( RimPlotAxisProperties::LegendTickmarkCount::TICKMARK_DEFAULT ); + else + timeAxisProp->setMajorTickmarkCount( RimPlotAxisProperties::LegendTickmarkCount::TICKMARK_FEW ); + + for ( RimPlotAxisPropertiesInterface* axisInterface : p->plotAxes() ) + { + auto axisProp = dynamic_cast( axisInterface ); + + if ( !axisProp ) continue; + + if ( rowsPerPage() == 1 ) + axisProp->setMajorTickmarkCount( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_DEFAULT ); + else + axisProp->setMajorTickmarkCount( RimPlotAxisPropertiesInterface::LegendTickmarkCount::TICKMARK_FEW ); + + axisProp->computeAndSetScaleFactor(); + + if ( hasOnlyOneQuantity ) + { + // Disable sub plot linking to be able to configure individually + setSubPlotAxesLinked( false ); + + axisProp->setShowDescription( false ); + + auto [row, col] = gridLayoutInfoForSubPlot( p ); + if ( col == 0 ) + axisProp->setShowUnitText( true ); + else + axisProp->setShowUnitText( false ); + } + } + + p->updateAxes(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -786,6 +896,14 @@ void RimSummaryMultiPlot::makeSureIsVisible( RimSummaryPlot* summaryPlot ) if ( summaryPlot->plotWidget() && !m_viewer.isNull() ) m_viewer->scrollToPlot( summaryPlot->plotWidget() ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::setSubPlotAxesLinked( bool enable ) +{ + m_linkSubPlotAxes = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -794,6 +912,17 @@ bool RimSummaryMultiPlot::isSubPlotAxesLinked() const return m_linkSubPlotAxes(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RimSummaryMultiPlot::gridLayoutInfoForSubPlot( RimSummaryPlot* summaryPlot ) const +{ + auto it = m_gridLayoutInfo.find( summaryPlot ); + if ( it != m_gridLayoutInfo.end() ) return it->second; + + return { -1, -1 }; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index fc7ca8fade..ee63ef4317 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -62,6 +62,9 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep const RimSummaryNameHelper* nameHelper() const; + void setLayoutInfo( RimSummaryPlot* summaryPlot, int row, int col ); + void clearLayoutInfo(); + void setAutoTitlePlot( bool enable ); void setAutoTitleGraphs( bool enable ); @@ -90,15 +93,21 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void makeSureIsVisible( RimSummaryPlot* plot ); + void setSubPlotAxesLinked( bool enable ); bool isSubPlotAxesLinked() const; + std::pair gridLayoutInfoForSubPlot( RimSummaryPlot* summaryPlot ) const; + void zoomAll() override; + void checkAndApplyAutoAppearance(); + protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override; void initAfterRead() override; + void onLoadDataAndUpdate() override; QWidget* createViewWidget( QWidget* mainWindowParent ) override; @@ -112,6 +121,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void duplicate(); + void analyzePlotsAndAdjustAppearanceSettings(); + void onSubPlotChanged( const caf::SignalEmitter* emitter ); void onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot ); @@ -121,10 +132,13 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep caf::PdmField m_disableWheelZoom; caf::PdmField m_createPlotDuplicate; caf::PdmField m_linkSubPlotAxes; + caf::PdmField m_autoAdjustAppearance; caf::PdmField> m_axisRangeAggregation; caf::PdmChildField m_sourceStepping; std::unique_ptr m_nameHelper; + + std::map> m_gridLayoutInfo; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 58afbe7589..eb10d8e681 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -758,16 +758,7 @@ size_t RimSummaryPlot::singleColorCurveCount() const //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::applyDefaultCurveAppearances() { - std::set allCurveDefs = this->summaryAndEnsembleCurveDefinitions(); - - RimSummaryCurveAppearanceCalculator curveLookCalc( allCurveDefs ); - - // Summary curves - for ( auto& curve : this->summaryCurves() ) - { - curve->resetAppearance(); - curveLookCalc.setupCurveLook( curve ); - } + applyDefaultCurveAppearances( summaryCurves() ); // Ensemble curve sets int colorIndex = 0; @@ -783,13 +774,7 @@ void RimSummaryPlot::applyDefaultCurveAppearances() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::applyDefaultCurveAppearances( std::vector curvesToUpdate ) { - std::vector allCurveDefs; - - for ( const auto& curve : this->summaryAndEnsembleCurves() ) - { - allCurveDefs.emplace_back( curve->summaryCaseY(), curve->summaryAddressY(), curve->isEnsembleCurve() ); - } - + std::set allCurveDefs = this->summaryAndEnsembleCurveDefinitions(); RimSummaryCurveAppearanceCalculator curveLookCalc( allCurveDefs ); for ( auto& curve : curvesToUpdate ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 960b9ad32b..314571b538 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -164,6 +164,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping size_t singleColorCurveCount() const; void applyDefaultCurveAppearances(); + void applyDefaultCurveAppearances( std::vector curvesToUpdate ); void setNormalizationEnabled( bool enable ); bool isNormalizationEnabled(); @@ -290,7 +291,6 @@ private slots: std::pair> handleSummaryCaseDrop( RimSummaryCase* summaryCase ); std::pair> handleAddressCollectionDrop( RimSummaryAddressCollection* addrColl ); std::pair> handleSummaryAddressDrop( RimSummaryAddress* summaryAddr ); - void applyDefaultCurveAppearances( std::vector curvesToUpdate ); bool isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index 56ae40ef97..1806c3dc13 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -214,12 +214,12 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const size_t cutPos = sumAddress.quantityName().find( ':' ); if ( cutPos == std::string::npos ) cutPos = -1; - std::string quantityNameForDisplay; + std::string titleText; const std::string& quantityName = sumAddress.quantityName().substr( cutPos + 1 ); if ( sumAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED ) { - quantityNameForDisplay = shortCalculationName( quantityName ); + titleText = shortCalculationName( quantityName ); } else { @@ -229,27 +229,25 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const if ( sumAddress.isHistoryQuantity() ) candidateName = quantityName.substr( 0, quantityName.size() - 1 ); - quantityNameForDisplay = - RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( candidateName ); + titleText = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( candidateName ); } if ( m_axisProperties->showAcronym() ) { - if ( !quantityNameForDisplay.empty() ) + if ( !titleText.empty() ) { - quantityNameForDisplay += " ("; - quantityNameForDisplay += quantityName; - quantityNameForDisplay += ")"; + titleText += " ("; + titleText += quantityName; + titleText += ")"; + } + else + { + titleText += quantityName; } - } - - if ( quantityNameForDisplay.empty() ) - { - quantityNameForDisplay = quantityName; } } - unitToQuantityNameMap[unitText].insert( quantityNameForDisplay ); + unitToQuantityNameMap[unitText].insert( titleText ); }; for ( RimSummaryCurve* rimCurve : m_summaryCurves ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index 9c56539c64..10c4357705 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -110,7 +110,7 @@ RimSummaryPlotManager::RimSummaryPlotManager() m_labelB.uiCapability()->setUiEditorTypeName( caf::PdmUiLabelEditor::uiEditorTypeName() ); m_labelB.xmlCapability()->disableIO(); - CAF_PDM_InitField( &m_individualPlotPerObject, "IndividualPlotPerObject", false, "One plot per Object" ); + CAF_PDM_InitField( &m_individualPlotPerObject, "IndividualPlotPerObject", true, "One plot per Object" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_individualPlotPerObject ); CAF_PDM_InitField( &m_individualPlotPerVector, "IndividualPlotPerVector", false, "One plot per Vector" ); @@ -119,7 +119,7 @@ RimSummaryPlotManager::RimSummaryPlotManager() CAF_PDM_InitField( &m_individualPlotPerDataSource, "IndividualPlotPerDataSource", false, "One plot per Data Source" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_individualPlotPerDataSource ); - CAF_PDM_InitField( &m_createMultiPlot, "CreateMultiPlot", false, "Create Multiple Plots in One Window" ); + CAF_PDM_InitField( &m_createMultiPlot, "CreateMultiPlot", true, "Create Multiple Plots in One Window" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_createMultiPlot ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 6926bf5e5d..699f545788 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -470,6 +470,8 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr ); curve->setSummaryAddressX( adr ); } + + curve->setDefaultCurveAppearance(); } if ( dataSourceSteppingObject() ) diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 320ae84e3b..6d5395ed84 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -501,6 +501,10 @@ void RiuMultiPlotBook::performUpdate( bool regeneratePages ) createPages(); } updateGeometry(); + + RimSummaryMultiPlot* multiPlot = dynamic_cast( m_plotDefinition.p() ); + if ( multiPlot ) multiPlot->checkAndApplyAutoAppearance(); + // use a timer to trigger a viewer page change, if needed if ( m_goToPageAfterUpdate ) { diff --git a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp index db05009753..763290d8c9 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp @@ -56,6 +56,9 @@ void RiuSummaryMultiPlotBook::createPages() int row = 0; int col = 0; + auto summaryMultiPlot = dynamic_cast( m_plotDefinition.p() ); + if ( summaryMultiPlot ) summaryMultiPlot->clearLayoutInfo(); + RiuSummaryMultiPlotPage* page = createSummaryPage(); for ( int visibleIndex = 0; visibleIndex < plotWidgets.size(); ++visibleIndex ) diff --git a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp index 006eec152d..e3be26b1ce 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp @@ -19,6 +19,7 @@ #include "RiuSummaryMultiPlotPage.h" #include "RimSummaryMultiPlot.h" +#include "RimSummaryPlot.h" #include "RiuPlotWidget.h" #include "RiuQwtPlotLegend.h" @@ -89,33 +90,36 @@ void RiuSummaryMultiPlotPage::reinsertPlotWidgets() continue; } - int expectedColSpan = plotWidgets[visibleIndex]->colSpan(); - int colSpan = std::min( expectedColSpan, cols - col ); + auto plotWidget = plotWidgets[visibleIndex]; + int expectedColSpan = plotWidget->colSpan(); + int colSpan = std::min( expectedColSpan, cols - col ); m_gridLayout->addWidget( subTitles[visibleIndex], 3 * row, col, 1, colSpan ); if ( legends[visibleIndex] ) { m_gridLayout->addWidget( legends[visibleIndex], 3 * row + 1, col, 1, colSpan, Qt::AlignHCenter | Qt::AlignBottom ); } - m_gridLayout->addWidget( plotWidgets[visibleIndex], 3 * row + 2, col, 1, colSpan ); + m_gridLayout->addWidget( plotWidget, 3 * row + 2, col, 1, colSpan ); + auto summaryPlot = dynamic_cast( plotWidget->plotDefinition() ); + if ( summaryPlot ) m_summaryMultiPlot->setLayoutInfo( summaryPlot, row, col ); subTitles[visibleIndex]->setVisible( m_showSubTitles ); QFont subTitleFont = subTitles[visibleIndex]->font(); subTitleFont.setPixelSize( m_subTitleFontPixelSize ); subTitles[visibleIndex]->setFont( subTitleFont ); - plotWidgets[visibleIndex]->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultLeft(), - showYAxis( row, col ), - showYAxis( row, col ) ); - plotWidgets[visibleIndex]->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), showYAxis( row, col ) ); - plotWidgets[visibleIndex]->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize ); + plotWidget->setAxisLabelsAndTicksEnabled( RiuPlotAxis::defaultLeft(), + showYAxis( row, col ), + showYAxis( row, col ) ); + plotWidget->setAxisTitleEnabled( RiuPlotAxis::defaultLeft(), showYAxis( row, col ) ); + plotWidget->setAxesFontsAndAlignment( m_axisTitleFontSize, m_axisValueFontSize ); // Adjust the space below a graph to make sure the heading of the row below is closest to the // corresponding graph - auto margins = plotWidgets[visibleIndex]->contentsMargins(); + auto margins = plotWidget->contentsMargins(); margins.setBottom( 40 ); - plotWidgets[visibleIndex]->setContentsMargins( margins ); - plotWidgets[visibleIndex]->show(); + plotWidget->setContentsMargins( margins ); + plotWidget->show(); if ( legends[visibleIndex] ) { From 5d9f7b165c4d99e54c510fb99eb88cde937b9e1d Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Wed, 27 Apr 2022 01:51:55 +0200 Subject: [PATCH 257/406] More summary data types in data source tree (#8840) * Add support for block data in data sources tree * Add option to show summary data sub-tree for single realizations inside an ensemble --- .../Summary/RimSummaryAddressCollection.cpp | 10 ++++++++ .../Summary/RimSummaryAddressCollection.h | 4 ++- .../Summary/RimSummaryCase.cpp | 25 ++++++++++++++++++- .../ProjectDataModel/Summary/RimSummaryCase.h | 3 +++ 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index 4381a1ab55..d699a79e97 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -33,6 +33,7 @@ void caf::AppEnum::setUp() addItem( RimSummaryAddressCollection::CollectionContentType::REGION, "REGION", "Region" ); addItem( RimSummaryAddressCollection::CollectionContentType::MISC, "MISC", "Miscellaneous" ); addItem( RimSummaryAddressCollection::CollectionContentType::FIELD, "FIELD", "Field" ); + addItem( RimSummaryAddressCollection::CollectionContentType::BLOCK, "BLOCK", "Block" ); setDefault( RimSummaryAddressCollection::CollectionContentType::NOT_DEFINED ); } @@ -132,6 +133,7 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::setaddToSubfolder( QString::fromStdString( address.blockAsString() ), + CollectionContentType::BLOCK, + address, + caseId, + ensembleId ); + break; + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL: wells->addToSubfolder( QString::fromStdString( address.wellName() ), CollectionContentType::WELL, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h index b3b741fe94..5a07bcbfb8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -43,7 +43,9 @@ class RimSummaryAddressCollection : public RimNamedObject MISC, WELL_FOLDER, GROUP_FOLDER, - REGION_FOLDER + REGION_FOLDER, + BLOCK, + BLOCK_FOLDER }; public: diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp index a6a73ef4e0..7436f8a121 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp @@ -33,6 +33,7 @@ #include "RimSummaryCaseCollection.h" #include "cafPdmFieldScriptingCapability.h" +#include "cafPdmUiCheckBoxEditor.h" #include "cafPdmUiTreeOrdering.h" #include "cvfAssert.h" @@ -54,6 +55,9 @@ RimSummaryCase::RimSummaryCase() CAF_PDM_InitScriptableFieldNoDefault( &m_displayName, "ShortName", "Display Name" ); CAF_PDM_InitScriptableFieldNoDefault( &m_displayNameOption, "NameSetting", "Name Setting" ); + CAF_PDM_InitScriptableField( &m_showSubNodesInTree, "ShowSubNodesInTree", false, "Show Summary Data Sub-Tree" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showSubNodesInTree ); + CAF_PDM_InitScriptableField( &m_useAutoShortName_OBSOLETE, "AutoShortyName", false, "Use Auto Display Name" ); m_useAutoShortName_OBSOLETE.xmlCapability()->setIOWritable( false ); m_useAutoShortName_OBSOLETE.uiCapability()->setUiHidden( true ); @@ -181,6 +185,10 @@ void RimSummaryCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, updateTreeItemName(); nameChanged.send(); } + else if ( changedField == &m_showSubNodesInTree ) + { + updateConnectedEditors(); + } updateOptionSensitivity(); } @@ -222,12 +230,27 @@ void RimSummaryCase::buildChildNodes() m_dataVectorFolders->updateFolderStructure( reader->allResultAddresses(), m_caseId ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + uiOrdering.add( &m_displayName ); + uiOrdering.add( &m_displayNameOption ); + uiOrdering.add( &m_summaryHeaderFilename ); + uiOrdering.add( &m_caseId ); + + if ( ensemble() ) uiOrdering.add( &m_showSubNodesInTree ); + + uiOrdering.skipRemainingFields( true ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimSummaryCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) { - if ( !ensemble() ) + if ( !ensemble() || m_showSubNodesInTree() ) { if ( m_dataVectorFolders->isEmpty() ) buildChildNodes(); m_dataVectorFolders->updateUiTreeOrdering( uiTreeOrdering ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h index 52545d57d5..dd732f0ced 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h @@ -86,6 +86,7 @@ class RimSummaryCase : public caf::PdmObject bool operator<( const RimSummaryCase& rhs ) const; protected: + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void updateTreeItemName(); @@ -102,6 +103,8 @@ class RimSummaryCase : public caf::PdmObject caf::PdmField m_displayNameOption; caf::PdmField m_summaryHeaderFilename; + caf::PdmField m_showSubNodesInTree; + caf::PdmChildField m_dataVectorFolders; bool m_isObservedData; From b030e617c6227576321e1bedb638fa4f68d82374 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 28 Apr 2022 09:03:40 +0200 Subject: [PATCH 258/406] #8849 Data Sources : Add append curves to plot based on selection --- .../CMakeLists_files.cmake | 2 + ...icAppendSummaryCurvesForObjectsFeature.cpp | 95 +++++++++++++++++++ .../RicAppendSummaryCurvesForObjectsFeature.h | 34 +++++++ ...RicAppendSummaryPlotsForObjectsFeature.cpp | 17 +--- .../RicAppendSummaryPlotsForObjectsFeature.h | 15 +-- .../RimContextCommandBuilder.cpp | 1 + .../Summary/RimSummaryAddressCollection.cpp | 14 +++ .../Summary/RimSummaryAddressCollection.h | 1 + 8 files changed, 157 insertions(+), 22 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.h diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake index 08f232188e..a5de91bceb 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake @@ -6,6 +6,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForObjectsFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForObjectsFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -16,6 +17,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryMultiPlotFromDataVectorFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForObjectsFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForObjectsFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.cpp new file mode 100644 index 0000000000..22101d9aaf --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.cpp @@ -0,0 +1,95 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicAppendSummaryCurvesForObjectsFeature.h" + +#include "RiaGuiApplication.h" +#include "RicAppendSummaryPlotsForObjectsFeature.h" + +#include "RimSummaryMultiPlot.h" +#include "RimSummaryPlot.h" + +#include + +CAF_CMD_SOURCE_INIT( RicAppendSummaryCurvesForObjectsFeature, "RicAppendSummaryCurvesForObjectsFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicAppendSummaryCurvesForObjectsFeature::isCommandEnabled() +{ + return !RicAppendSummaryPlotsForObjectsFeature::selectedCollections().empty(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryCurvesForObjectsFeature::onActionTriggered( bool isChecked ) +{ + // - Select a set of objects in Data Source (wells, groups, regions, ..) + // - Use context menu to activate action + // - For each plots, append curves using handleDroppedObjects() on RimSummaryPlot + + auto sumAddressCollections = RicAppendSummaryPlotsForObjectsFeature::selectedCollections(); + if ( sumAddressCollections.empty() ) return; + + RiaGuiApplication* app = RiaGuiApplication::instance(); + + auto summaryMultiPlot = dynamic_cast( app->activePlotWindow() ); + if ( !summaryMultiPlot ) return; + + RicAppendSummaryPlotsForObjectsFeature::isSelectionCompatibleWithPlot( sumAddressCollections, summaryMultiPlot ); + + auto selectionType = sumAddressCollections.front()->contentType(); + auto sourcePlots = summaryMultiPlot->summaryPlots(); + auto plotsForOneInstance = + RicAppendSummaryPlotsForObjectsFeature::plotsForOneInstanceOfObjectType( sourcePlots, selectionType ); + + std::vector pdmObjects; + for ( auto summaryAdrCollection : sumAddressCollections ) + { + pdmObjects.push_back( summaryAdrCollection ); + } + + for ( auto plot : sourcePlots ) + { + plot->handleDroppedObjects( pdmObjects ); + } + + summaryMultiPlot->loadDataAndUpdate(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryCurvesForObjectsFeature::setupActionLook( QAction* actionToSetup ) +{ + QString objectType = "Objects"; + + auto addresses = RicAppendSummaryPlotsForObjectsFeature::selectedCollections(); + + if ( !addresses.empty() ) + { + auto firstAdr = addresses.front(); + objectType = caf::AppEnum::uiText( firstAdr->contentType() ); + } + + auto text = QString( "Append Curves For " ) + objectType; + actionToSetup->setText( text ); + actionToSetup->setIcon( QIcon( ":/SummaryCurve16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.h new file mode 100644 index 0000000000..a33b3e6e48 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicAppendSummaryCurvesForObjectsFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index cd6aaf9160..3b365ba1d2 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -106,18 +106,7 @@ void RicAppendSummaryPlotsForObjectsFeature::setupActionLook( QAction* actionToS if ( !addresses.empty() ) { auto firstAdr = addresses.front(); - if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) - { - objectType = "Wells"; - } - else if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP ) - { - objectType = "Groups"; - } - else if ( firstAdr->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) - { - objectType = "Regions"; - } + objectType = caf::AppEnum::uiText( firstAdr->contentType() ); } auto text = QString( "Append Plots For " ) + objectType; @@ -136,9 +125,7 @@ std::vector RicAppendSummaryPlotsForObjectsFeature if ( sumAddressCollections.size() == 1 ) { auto coll = sumAddressCollections[0]; - if ( coll->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL_FOLDER || - coll->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP_FOLDER || - coll->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION_FOLDER ) + if ( coll->isFolder() ) { // If a folder is selected, return all sub items in folder auto childObjects = coll->subFolders(); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h index a38764d59b..6d7a764a55 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h @@ -37,21 +37,22 @@ class RicAppendSummaryPlotsForObjectsFeature : public caf::CmdFeature { CAF_CMD_HEADER_INIT; +public: + static std::vector selectedCollections(); + static std::vector + plotsForOneInstanceOfObjectType( const std::vector& sourcePlots, + RimSummaryAddressCollection::CollectionContentType objectType ); + static bool isSelectionCompatibleWithPlot( const std::vector& selection, + RimSummaryMultiPlot* summaryMultiPlot ); + protected: bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; private: - static std::vector selectedCollections(); - - static bool isSelectionCompatibleWithPlot( const std::vector& selection, - RimSummaryMultiPlot* summaryMultiPlot ); RifEclipseSummaryAddress modifyAddress( const RifEclipseSummaryAddress& sourceAddress, RimSummaryAddressCollection* summaryAddressCollection ); - static std::vector - plotsForOneInstanceOfObjectType( const std::vector& sourcePlots, - RimSummaryAddressCollection::CollectionContentType objectType ); }; diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 7380a02051..5dd2bd4d51 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1113,6 +1113,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewMultiPlotFeature"; menuBuilder << "RicAppendSummaryPlotsForObjectsFeature"; + menuBuilder << "RicAppendSummaryCurvesForObjectsFeature"; // Work in progress -- End diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index d699a79e97..f52871587a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -292,6 +292,20 @@ bool RimSummaryAddressCollection::isEnsemble() const return m_ensembleId >= 0; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryAddressCollection::isFolder() const +{ + if ( contentType() == CollectionContentType::WELL_FOLDER || contentType() == CollectionContentType::GROUP_FOLDER || + contentType() == CollectionContentType::REGION_FOLDER || contentType() == CollectionContentType::BLOCK_FOLDER ) + { + return true; + } + + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h index 5a07bcbfb8..4905a61cca 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -58,6 +58,7 @@ class RimSummaryAddressCollection : public RimNamedObject bool isEmpty() const; bool isEnsemble() const; + bool isFolder() const; bool canBeDragged() const; From 172f891be9106976e12ef196eb34f86a7431e255 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 28 Apr 2022 18:28:24 +0200 Subject: [PATCH 259/406] Remove obsolete template commands (#8851) * Remove obsolete template commands Use first object in object list when creating plots for templates and a case is selected. (use first well in well list, first group in group list, ...) * Always create the reference string --- .../CMakeLists_files.cmake | 4 - ...RicCreateMultiPlotFromSelectionFeature.cpp | 76 +------------ .../RicCreatePlotFromSelectionFeature.cpp | 68 ------------ .../RicCreatePlotFromSelectionFeature.h | 36 ------ ...reatePlotFromTemplateByShortcutFeature.cpp | 16 +-- .../RicCreatePlotFromTemplateFeature.cpp | 63 ----------- .../RicCreatePlotFromTemplateFeature.h | 39 ------- .../RicSaveMultiPlotTemplateFeature.cpp | 8 +- ...icSaveMultiPlotTemplateFeatureSettings.cpp | 21 ++-- .../RicSaveMultiPlotTemplateFeatureSettings.h | 7 +- .../RicSummaryPlotTemplateTools.cpp | 104 ++++++++++++++++++ .../RicSummaryPlotTemplateTools.h | 2 + .../RimContextCommandBuilder.cpp | 3 +- 13 files changed, 136 insertions(+), 311 deletions(-) delete mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromSelectionFeature.cpp delete mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromSelectionFeature.h delete mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateFeature.cpp delete mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateFeature.h diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake index b2601bddfb..293cacdbd1 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake @@ -1,10 +1,8 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSavePlotTemplateFeature.h - ${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromSelectionFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSelectPlotTemplateUi.h ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotTemplateTools.h ${CMAKE_CURRENT_LIST_DIR}/RicReloadPlotTemplatesFeature.h - ${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateByShortcutFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeatureSettings.h @@ -13,11 +11,9 @@ set(SOURCE_GROUP_HEADER_FILES set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSavePlotTemplateFeature.cpp - ${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromSelectionFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSelectPlotTemplateUi.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotTemplateTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RicReloadPlotTemplatesFeature.cpp - ${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicCreatePlotFromTemplateByShortcutFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeatureSettings.cpp diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp index 2f0ce69d0c..7ee23337a1 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateMultiPlotFromSelectionFeature.cpp @@ -18,25 +18,11 @@ #include "RicCreateMultiPlotFromSelectionFeature.h" -#include "RiaGuiApplication.h" -#include "RiaSummaryTools.h" - #include "RicSummaryPlotTemplateTools.h" - -#include "PlotTemplates/RimPlotTemplateFileItem.h" -#include "RimMainPlotCollection.h" -#include "RimProject.h" -#include "RimSummaryAddressCollection.h" -#include "RimSummaryCase.h" #include "RimSummaryMultiPlot.h" -#include "RimSummaryMultiPlotCollection.h" -#include "RiuPlotMainWindow.h" #include "RiuPlotMainWindowTools.h" -#include "cafPdmUiPropertyViewDialog.h" -#include "cafSelectionManager.h" - #include CAF_CMD_SOURCE_INIT( RicCreateMultiPlotFromSelectionFeature, "RicCreateMultiPlotFromSelectionFeature" ); @@ -54,67 +40,9 @@ bool RicCreateMultiPlotFromSelectionFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicCreateMultiPlotFromSelectionFeature::onActionTriggered( bool isChecked ) { - QString fileName = RicSummaryPlotTemplateTools::selectPlotTemplatePath(); - auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases(); - auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections(); - - auto summaryAddressCollections = RicSummaryPlotTemplateTools::selectedSummaryAddressCollections(); - - std::vector wellNames; - std::vector groupNames; - std::vector regions; - std::set caseSet; - std::set caseCollectionSet; - - for ( auto a : summaryAddressCollections ) - { - if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) - { - wellNames.push_back( a->name() ); - } - else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP ) - { - groupNames.push_back( a->name() ); - } - else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) - { - regions.push_back( a->name() ); - } - - auto sumCase = RiaSummaryTools::summaryCaseById( a->caseId() ); - if ( sumCase ) caseSet.insert( sumCase ); - - auto ensemble = RiaSummaryTools::ensembleById( a->ensembleId() ); - if ( ensemble ) caseCollectionSet.insert( ensemble ); - } - - for ( auto sumCase : caseSet ) - { - sumCases.push_back( sumCase ); - } - for ( auto sumCaseCollection : caseCollectionSet ) - { - sumCaseCollections.push_back( sumCaseCollection ); - } - - auto proj = RimProject::current(); - auto collections = proj->mainPlotCollection()->summaryMultiPlotCollection(); - - auto newSummaryPlot = RicSummaryPlotTemplateTools::createMultiPlotFromTemplateFile( fileName ); - if ( !newSummaryPlot ) return; - - collections->addSummaryMultiPlot( newSummaryPlot ); - newSummaryPlot->resolveReferencesRecursively(); + QString fileName = RicSummaryPlotTemplateTools::selectPlotTemplatePath(); - RicSummaryPlotTemplateTools::setValuesForPlaceholders( newSummaryPlot, - sumCases, - sumCaseCollections, - wellNames, - groupNames, - regions ); - newSummaryPlot->initAfterReadRecursively(); - newSummaryPlot->loadDataAndUpdate(); - collections->updateConnectedEditors(); + auto newSummaryPlot = RicSummaryPlotTemplateTools::create( fileName ); RiuPlotMainWindowTools::selectAsCurrentItem( newSummaryPlot ); } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromSelectionFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromSelectionFeature.cpp deleted file mode 100644 index e16805e1ee..0000000000 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromSelectionFeature.cpp +++ /dev/null @@ -1,68 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- 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 -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RicCreatePlotFromSelectionFeature.h" - -#include "RiaGuiApplication.h" - -#include "RicSummaryPlotTemplateTools.h" - -#include "PlotTemplates/RimPlotTemplateFileItem.h" -#include "RimSummaryCase.h" - -#include "RiuPlotMainWindow.h" - -#include "cafPdmUiPropertyViewDialog.h" -#include "cafSelectionManager.h" - -#include - -CAF_CMD_SOURCE_INIT( RicCreatePlotFromSelectionFeature, "RicCreatePlotFromSelectionFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicCreatePlotFromSelectionFeature::isCommandEnabled() -{ - bool anySummaryCases = !RicSummaryPlotTemplateTools::selectedSummaryCases().empty(); - bool anySummaryCaseCollections = !RicSummaryPlotTemplateTools::selectedSummaryCaseCollections().empty(); - - return ( anySummaryCases || anySummaryCaseCollections ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicCreatePlotFromSelectionFeature::onActionTriggered( bool isChecked ) -{ - QString fileName = RicSummaryPlotTemplateTools::selectPlotTemplatePath(); - auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases(); - auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections(); - - RimSummaryPlot* newSummaryPlot = RicSummaryPlotTemplateTools::createPlotFromTemplateFile( fileName ); - RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection( newSummaryPlot, sumCases, sumCaseCollections ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicCreatePlotFromSelectionFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Create Plot from Template" ); - actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); -} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromSelectionFeature.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromSelectionFeature.h deleted file mode 100644 index b8e17a84b9..0000000000 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromSelectionFeature.h +++ /dev/null @@ -1,36 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- 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 -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "cafCmdFeature.h" - -class RimSummaryCase; - -//================================================================================================== -/// -//================================================================================================== -class RicCreatePlotFromSelectionFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; -}; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp index 45f23e7789..77a8433b5e 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp @@ -23,11 +23,10 @@ #include "RicSummaryPlotTemplateTools.h" -#include "RimSummaryCase.h" +#include "RimSummaryMultiPlot.h" #include "RiuPlotMainWindow.h" - -#include "cafSelectionManager.h" +#include "RiuPlotMainWindowTools.h" #include #include @@ -40,10 +39,7 @@ CAF_CMD_SOURCE_INIT( RicCreatePlotFromTemplateByShortcutFeature, "RicCreatePlotF //-------------------------------------------------------------------------------------------------- bool RicCreatePlotFromTemplateByShortcutFeature::isCommandEnabled() { - bool anySummaryCases = !RicSummaryPlotTemplateTools::selectedSummaryCases().empty(); - bool anySummaryCaseCollections = !RicSummaryPlotTemplateTools::selectedSummaryCaseCollections().empty(); - - return ( anySummaryCases || anySummaryCaseCollections ); + return true; } //-------------------------------------------------------------------------------------------------- @@ -70,11 +66,9 @@ void RicCreatePlotFromTemplateByShortcutFeature::onActionTriggered( bool isCheck fileName = fileNameSelectedInUi; } - auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases(); - auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections(); + auto newSummaryPlot = RicSummaryPlotTemplateTools::create( fileName ); - RimSummaryPlot* newSummaryPlot = RicSummaryPlotTemplateTools::createPlotFromTemplateFile( fileName ); - RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection( newSummaryPlot, sumCases, sumCaseCollections ); + RiuPlotMainWindowTools::selectAsCurrentItem( newSummaryPlot ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateFeature.cpp deleted file mode 100644 index 0107fa75bc..0000000000 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateFeature.cpp +++ /dev/null @@ -1,63 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- 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 -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RicCreatePlotFromTemplateFeature.h" - -#include "RicSummaryPlotTemplateTools.h" -#include "RimSummaryCase.h" -#include "RimSummaryCaseCollection.h" - -#include "cafSelectionManager.h" - -#include - -CAF_CMD_SOURCE_INIT( RicCreatePlotFromTemplateFeature, "RicCreatePlotFromTemplateFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicCreatePlotFromTemplateFeature::isCommandEnabled() -{ - bool anySummaryCases = !RicSummaryPlotTemplateTools::selectedSummaryCases().empty(); - bool anySummaryCaseCollections = !RicSummaryPlotTemplateTools::selectedSummaryCaseCollections().empty(); - - return ( anySummaryCases || anySummaryCaseCollections ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicCreatePlotFromTemplateFeature::onActionTriggered( bool isChecked ) -{ - QString fileName = userData().toString(); - auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases(); - auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections(); - - RimSummaryPlot* newSummaryPlot = RicSummaryPlotTemplateTools::createPlotFromTemplateFile( fileName ); - - RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection( newSummaryPlot, sumCases, sumCaseCollections ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicCreatePlotFromTemplateFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Create Plot from Template" ); - actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); -} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateFeature.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateFeature.h deleted file mode 100644 index e06ae25ab8..0000000000 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateFeature.h +++ /dev/null @@ -1,39 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- 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 -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "cafCmdFeature.h" - -#include - -class RimSummaryCase; -class RimSummaryCaseCollection; - -//================================================================================================== -/// -//================================================================================================== -class RicCreatePlotFromTemplateFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; -}; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp index 1e685e48d2..28f3078138 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp @@ -163,7 +163,9 @@ QString RicSaveMultiPlotTemplateFeature::createTextFromObject( RimSummaryMultiPl auto fieldHandle = curve->findField( summaryFieldKeyword ); if ( fieldHandle ) { - auto reference = fieldHandle->xmlCapability()->referenceString(); + auto reference = + caf::PdmReferenceHelper::referenceFromFieldToObject( fieldHandle, curve->summaryCaseY() ); + sourceStrings.insert( reference ); } @@ -186,7 +188,9 @@ QString RicSaveMultiPlotTemplateFeature::createTextFromObject( RimSummaryMultiPl auto fieldHandle = curveSet->findField( summaryGroupFieldKeyword ); if ( fieldHandle ) { - auto reference = fieldHandle->xmlCapability()->referenceString(); + auto reference = + caf::PdmReferenceHelper::referenceFromFieldToObject( fieldHandle, + curveSet->summaryCaseCollection() ); ensembleReferenceStrings.insert( reference ); } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp index ef37a2697b..0d9a296faa 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp @@ -29,9 +29,9 @@ RicSaveMultiPlotTemplateFeatureSettings::RicSaveMultiPlotTemplateFeatureSettings CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" ); - CAF_PDM_InitField( &m_replaceWells, "ReplaceWells", true, "Wells" ); - CAF_PDM_InitField( &m_replaceGroups, "ReplaceGroups", true, "Groups" ); - CAF_PDM_InitField( &m_replaceRegions, "ReplaceRegions", true, "Regions" ); + CAF_PDM_InitField( &m_persistObjectNameForWells, "PersistObjectNameWells", false, "Wells" ); + CAF_PDM_InitField( &m_persistObjectNameGroups, "PersistObjectNameGroups", false, "Groups" ); + CAF_PDM_InitField( &m_persistObjectNameRegions, "PersistObjectNameRegions", false, "Regions" ); } //-------------------------------------------------------------------------------------------------- @@ -55,7 +55,7 @@ QString RicSaveMultiPlotTemplateFeatureSettings::filePath() const //-------------------------------------------------------------------------------------------------- bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForWells() const { - return m_replaceWells; + return !m_persistObjectNameForWells; } //-------------------------------------------------------------------------------------------------- @@ -63,7 +63,7 @@ bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForWells() const //-------------------------------------------------------------------------------------------------- bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForGroups() const { - return m_replaceGroups; + return !m_persistObjectNameGroups; } //-------------------------------------------------------------------------------------------------- @@ -71,7 +71,7 @@ bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForGroups() const //-------------------------------------------------------------------------------------------------- bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForRegions() const { - return m_replaceRegions; + return !m_persistObjectNameRegions; } //-------------------------------------------------------------------------------------------------- @@ -82,10 +82,11 @@ void RicSaveMultiPlotTemplateFeatureSettings::defineUiOrdering( QString uiConfig uiOrdering.add( &m_filePath ); { - auto group = uiOrdering.addNewGroup( "Use Placeholders for Objects" ); - group->add( &m_replaceWells ); - group->add( &m_replaceGroups ); - group->add( &m_replaceRegions ); + auto group = uiOrdering.addNewGroup( "Persist Object Names" ); + group->setCollapsedByDefault( true ); + group->add( &m_persistObjectNameForWells ); + group->add( &m_persistObjectNameGroups ); + group->add( &m_persistObjectNameRegions ); } } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h index 371e7466a0..b764caa8e2 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h @@ -47,7 +47,8 @@ class RicSaveMultiPlotTemplateFeatureSettings : public caf::PdmObject private: caf::PdmField m_filePath; - caf::PdmField m_replaceWells; - caf::PdmField m_replaceGroups; - caf::PdmField m_replaceRegions; + + caf::PdmField m_persistObjectNameForWells; + caf::PdmField m_persistObjectNameGroups; + caf::PdmField m_persistObjectNameRegions; }; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index 24adcfb19a..1cdc0ee8bd 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -22,6 +22,7 @@ #include "RiaLogging.h" #include "RiaPreferences.h" #include "RiaSummaryAddressAnalyzer.h" +#include "RiaSummaryTools.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RicSelectPlotTemplateUi.h" @@ -38,6 +39,7 @@ #include "RimSummaryCase.h" #include "RimSummaryCurve.h" #include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" #include "RiuPlotMainWindow.h" @@ -72,6 +74,108 @@ RimSummaryMultiPlot* RicSummaryPlotTemplateTools::createMultiPlotFromTemplateFil return dynamic_cast( obj ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot* RicSummaryPlotTemplateTools::create( const QString& fileName ) +{ + auto sumCases = RicSummaryPlotTemplateTools::selectedSummaryCases(); + auto sumCaseCollections = RicSummaryPlotTemplateTools::selectedSummaryCaseCollections(); + + auto summaryAddressCollections = RicSummaryPlotTemplateTools::selectedSummaryAddressCollections(); + + std::vector wellNames; + std::vector groupNames; + std::vector regions; + std::set caseSet; + std::set caseCollectionSet; + + if ( summaryAddressCollections.empty() ) + { + RiaSummaryAddressAnalyzer analyzer; + + if ( !sumCases.empty() ) + { + auto firstCase = sumCases.front(); + + analyzer.appendAddresses( firstCase->summaryReader()->allResultAddresses() ); + } + else if ( !sumCaseCollections.empty() ) + { + auto caseCollection = sumCaseCollections.front(); + + if ( !caseCollection->allSummaryCases().empty() ) + { + auto firstCase = caseCollection->allSummaryCases().front(); + + analyzer.appendAddresses( firstCase->summaryReader()->allResultAddresses() ); + } + } + + if ( !analyzer.wellNames().empty() ) + wellNames.push_back( QString::fromStdString( *( analyzer.wellNames().begin() ) ) ); + if ( !analyzer.groupNames().empty() ) + groupNames.push_back( QString::fromStdString( *( analyzer.groupNames().begin() ) ) ); + if ( !analyzer.regionNumbers().empty() ) + regions.push_back( QString::number( *( analyzer.regionNumbers().begin() ) ) ); + } + else + { + for ( auto a : summaryAddressCollections ) + { + if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) + { + wellNames.push_back( a->name() ); + } + else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP ) + { + groupNames.push_back( a->name() ); + } + else if ( a->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) + { + regions.push_back( a->name() ); + } + + auto sumCase = RiaSummaryTools::summaryCaseById( a->caseId() ); + if ( sumCase ) caseSet.insert( sumCase ); + + auto ensemble = RiaSummaryTools::ensembleById( a->ensembleId() ); + if ( ensemble ) caseCollectionSet.insert( ensemble ); + } + } + + for ( auto sumCase : caseSet ) + { + sumCases.push_back( sumCase ); + } + + for ( auto sumCaseCollection : caseCollectionSet ) + { + sumCaseCollections.push_back( sumCaseCollection ); + } + + auto proj = RimProject::current(); + auto collections = proj->mainPlotCollection()->summaryMultiPlotCollection(); + + auto newSummaryPlot = RicSummaryPlotTemplateTools::createMultiPlotFromTemplateFile( fileName ); + if ( !newSummaryPlot ) return nullptr; + + collections->addSummaryMultiPlot( newSummaryPlot ); + newSummaryPlot->resolveReferencesRecursively(); + + RicSummaryPlotTemplateTools::setValuesForPlaceholders( newSummaryPlot, + sumCases, + sumCaseCollections, + wellNames, + groupNames, + regions ); + newSummaryPlot->initAfterReadRecursively(); + newSummaryPlot->loadDataAndUpdate(); + collections->updateConnectedEditors(); + + return newSummaryPlot; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h index 8192470f52..8d7a25cac2 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h @@ -43,6 +43,8 @@ class RicSummaryPlotTemplateTools public: static RimSummaryMultiPlot* createMultiPlotFromTemplateFile( const QString& fileName ); + static RimSummaryMultiPlot* create( const QString& fileName ); + static void setValuesForPlaceholders( RimSummaryMultiPlot* summaryMultiPlot, const std::vector& selectedSummaryCases, const std::vector& selectedEnsembles, diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 5dd2bd4d51..7030c133e7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1039,6 +1039,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicCreateMultiPlotFromSelectionFeature"; + menuBuilder << "RicCreatePlotFromTemplateByShortcutFeature"; } if ( dynamic_cast( firstUiItem ) ) @@ -1101,7 +1102,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { - menuBuilder << "RicCreatePlotFromSelectionFeature"; + menuBuilder << "RicCreateMultiPlotFromSelectionFeature"; menuBuilder << "RicCreatePlotFromTemplateByShortcutFeature"; } From f54399960dc2f97adec65bc57ff480448efa6877 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 29 Apr 2022 12:28:09 +0200 Subject: [PATCH 260/406] Improve drag and drop features and right click commands (#8854) --- .../CMakeLists_files.cmake | 8 ++ ...ummaryCurvesForSummaryAddressesFeature.cpp | 89 ++++++++++++++ ...dSummaryCurvesForSummaryAddressesFeature.h | 44 +++++++ ...endSummaryCurvesForSummaryCasesFeature.cpp | 88 ++++++++++++++ ...ppendSummaryCurvesForSummaryCasesFeature.h | 44 +++++++ ...RicAppendSummaryPlotsForObjectsFeature.cpp | 110 +++++++++++++----- .../RicAppendSummaryPlotsForObjectsFeature.h | 13 ++- ...SummaryPlotsForSummaryAddressesFeature.cpp | 101 ++++++++++++++++ ...ndSummaryPlotsForSummaryAddressesFeature.h | 46 ++++++++ ...pendSummaryPlotsForSummaryCasesFeature.cpp | 107 +++++++++++++++++ ...AppendSummaryPlotsForSummaryCasesFeature.h | 45 +++++++ .../RicSummaryPlotBuilder.cpp | 2 +- .../RimContextCommandBuilder.cpp | 6 + .../Summary/RimSummaryAddressCollection.h | 3 +- .../Summary/RimSummaryMultiPlot.cpp | 30 +++-- .../Summary/RimSummaryMultiPlot.h | 2 +- .../UserInterface/RiuMultiPlotBook.cpp | 5 +- 17 files changed, 694 insertions(+), 49 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.h create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryCasesFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryCasesFeature.h create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.h create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.h diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake index a5de91bceb..5e6020849f 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake @@ -7,6 +7,10 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForObjectsFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForObjectsFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForSummaryCasesFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForSummaryCasesFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForSummaryAddressesFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForSummaryAddressesFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -18,6 +22,10 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryPlotFromCurveFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForObjectsFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForObjectsFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForSummaryCasesFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForSummaryCasesFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForSummaryAddressesFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.cpp new file mode 100644 index 0000000000..ed05b092d0 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.cpp @@ -0,0 +1,89 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicAppendSummaryCurvesForSummaryAddressesFeature.h" + +#include "RiaGuiApplication.h" + +#include "RicAppendSummaryPlotsForObjectsFeature.h" + +#include "RimSummaryAddress.h" +#include "RimSummaryAddressCollection.h" +#include "RimSummaryCase.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryPlot.h" + +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT( RicAppendSummaryCurvesForSummaryAddressesFeature, "RicAppendSummaryCurvesForSummaryAddressesFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicAppendSummaryCurvesForSummaryAddressesFeature::isCommandEnabled() +{ + return !selectedAddresses().empty(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryCurvesForSummaryAddressesFeature::onActionTriggered( bool isChecked ) +{ + RiaGuiApplication* app = RiaGuiApplication::instance(); + + auto summaryMultiPlot = dynamic_cast( app->activePlotWindow() ); + if ( !summaryMultiPlot ) return; + + auto addresses = selectedAddresses(); + if ( addresses.empty() ) return; + + for ( auto plot : summaryMultiPlot->summaryPlots() ) + { + plot->handleDroppedObjects( addresses ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryCurvesForSummaryAddressesFeature::setupActionLook( QAction* actionToSetup ) +{ + QString objectType = "Addresses"; + + auto text = QString( "Append Curves For " ) + objectType; + actionToSetup->setText( text ); + actionToSetup->setIcon( QIcon( ":/SummaryCurve16x16.png" ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicAppendSummaryCurvesForSummaryAddressesFeature::selectedAddresses() +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType( &objects ); + + // Make the object type general to match the expected type for handleDroppedObjects(); + std::vector generalObjects; + generalObjects.insert( generalObjects.begin(), objects.begin(), objects.end() ); + + return generalObjects; +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.h new file mode 100644 index 0000000000..68c85cd90a --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +namespace caf +{ +class PdmObjectHandle; +} + +#include + +//================================================================================================== +/// +//================================================================================================== +class RicAppendSummaryCurvesForSummaryAddressesFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + +private: + static std::vector selectedAddresses(); +}; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryCasesFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryCasesFeature.cpp new file mode 100644 index 0000000000..a40c7045a4 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryCasesFeature.cpp @@ -0,0 +1,88 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicAppendSummaryCurvesForSummaryCasesFeature.h" + +#include "RiaGuiApplication.h" + +#include "RicAppendSummaryPlotsForObjectsFeature.h" + +#include "RimSummaryAddressCollection.h" +#include "RimSummaryCase.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryPlot.h" + +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT( RicAppendSummaryCurvesForSummaryCasesFeature, "RicAppendSummaryCurvesForSummaryCasesFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicAppendSummaryCurvesForSummaryCasesFeature::isCommandEnabled() +{ + return !selectedCases().empty(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryCurvesForSummaryCasesFeature::onActionTriggered( bool isChecked ) +{ + RiaGuiApplication* app = RiaGuiApplication::instance(); + + auto summaryMultiPlot = dynamic_cast( app->activePlotWindow() ); + if ( !summaryMultiPlot ) return; + + auto cases = selectedCases(); + if ( cases.empty() ) return; + + for ( auto plot : summaryMultiPlot->summaryPlots() ) + { + plot->handleDroppedObjects( cases ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryCurvesForSummaryCasesFeature::setupActionLook( QAction* actionToSetup ) +{ + QString objectType = "Cases"; + + auto text = QString( "Append Curves For " ) + objectType; + actionToSetup->setText( text ); + actionToSetup->setIcon( QIcon( ":/SummaryCurve16x16.png" ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicAppendSummaryCurvesForSummaryCasesFeature::selectedCases() +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType( &objects ); + + // Make the object type general to match the expected type for handleDroppedObjects(); + std::vector generalObjects; + generalObjects.insert( generalObjects.begin(), objects.begin(), objects.end() ); + + return generalObjects; +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryCasesFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryCasesFeature.h new file mode 100644 index 0000000000..6801526a69 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryCasesFeature.h @@ -0,0 +1,44 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +namespace caf +{ +class PdmObjectHandle; +} + +#include + +//================================================================================================== +/// +//================================================================================================== +class RicAppendSummaryCurvesForSummaryCasesFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + +private: + static std::vector selectedCases(); +}; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index 3b365ba1d2..cd74d642c5 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -22,6 +22,7 @@ #include "RiaLogging.h" #include "RiaStdStringTools.h" #include "RiaSummaryAddressAnalyzer.h" +#include "RiaSummaryTools.h" #include "RicSummaryPlotBuilder.h" @@ -51,49 +52,73 @@ bool RicAppendSummaryPlotsForObjectsFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicAppendSummaryPlotsForObjectsFeature::onActionTriggered( bool isChecked ) +void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* summaryMultiPlot, + const std::vector& sumAddressCollections ) { - // - Select a set of objects in Data Source (wells, groups, regions, ..) - // - Use context menu to activate action - // - For each plot in the current active plot, create a duplicate plot and replace the object name - - auto sumAddressCollections = selectedCollections(); if ( sumAddressCollections.empty() ) return; - RiaGuiApplication* app = RiaGuiApplication::instance(); - - auto summaryMultiPlot = dynamic_cast( app->activePlotWindow() ); - if ( !summaryMultiPlot ) return; - isSelectionCompatibleWithPlot( sumAddressCollections, summaryMultiPlot ); - auto selectionType = sumAddressCollections.front()->contentType(); - auto sourcePlots = summaryMultiPlot->summaryPlots(); - std::vector plotsForOneInstance = plotsForOneInstanceOfObjectType( sourcePlots, selectionType ); + auto selectionType = sumAddressCollections.front()->contentType(); + auto sourcePlots = summaryMultiPlot->summaryPlots(); + auto plotsForOneInstance = plotsForOneInstanceOfObjectType( sourcePlots, selectionType ); for ( auto summaryAdrCollection : sumAddressCollections ) { auto duplicatedPlots = RicSummaryPlotBuilder::duplicateSummaryPlots( plotsForOneInstance ); + for ( auto duplicatedPlot : duplicatedPlots ) { - auto adrMods = RimSummaryAddressModifier::createAddressModifiersForPlot( duplicatedPlot ); - for ( auto adrMod : adrMods ) + if ( summaryAdrCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::SUMMARY_CASE ) { - auto sourceAddress = adrMod.address(); - auto modifiedAdr = modifyAddress( sourceAddress, summaryAdrCollection ); + summaryMultiPlot->addPlot( duplicatedPlot ); - adrMod.setAddress( modifiedAdr ); + auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAdrCollection->caseId() ); + for ( auto c : duplicatedPlot->summaryCurves() ) + { + c->setSummaryCaseY( summaryCase ); + } } + else + { + auto adrMods = RimSummaryAddressModifier::createAddressModifiersForPlot( duplicatedPlot ); + for ( auto adrMod : adrMods ) + { + auto sourceAddress = adrMod.address(); + auto modifiedAdr = modifyAddress( sourceAddress, summaryAdrCollection ); - summaryMultiPlot->addPlot( duplicatedPlot ); + adrMod.setAddress( modifiedAdr ); + } + summaryMultiPlot->addPlot( duplicatedPlot ); - duplicatedPlot->resolveReferencesRecursively(); + duplicatedPlot->resolveReferencesRecursively(); + } } } summaryMultiPlot->loadDataAndUpdate(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryPlotsForObjectsFeature::onActionTriggered( bool isChecked ) +{ + // - Select a set of objects in Data Source (wells, groups, regions, ..) + // - Use context menu to activate action + // - For each plot in the current active plot, create a duplicate plot and replace the object name + + auto sumAddressCollections = selectedCollections(); + if ( sumAddressCollections.empty() ) return; + + RiaGuiApplication* app = RiaGuiApplication::instance(); + + auto summaryMultiPlot = dynamic_cast( app->activePlotWindow() ); + if ( !summaryMultiPlot ) return; + + appendPlots( summaryMultiPlot, sumAddressCollections ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -249,6 +274,7 @@ std::vector RicAppendSummaryPlotsForObjectsFeature::plotsForOne std::string wellNameToMatch; std::string groupNameToMatch; int regionToMatch = -1; + int caseIdToMatch = -1; RiaSummaryAddressAnalyzer myAnalyser; for ( auto sourcePlot : sourcePlots ) @@ -269,25 +295,45 @@ std::vector RicAppendSummaryPlotsForObjectsFeature::plotsForOne { if ( !myAnalyser.regionNumbers().empty() ) regionToMatch = *( myAnalyser.regionNumbers().begin() ); } + else if ( objectType == RimSummaryAddressCollection::CollectionContentType::SUMMARY_CASE ) + { + auto curves = sourcePlots.back()->summaryCurves(); + if ( !curves.empty() ) + { + caseIdToMatch = curves.front()->summaryCaseY()->caseId(); + } + } for ( auto sourcePlot : sourcePlots ) { - auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( sourcePlot ); - bool isMatching = false; - for ( const auto& a : addresses ) + + if ( caseIdToMatch != -1 ) { - if ( !wellNameToMatch.empty() && a.wellName() == wellNameToMatch ) + auto curves = sourcePlot->summaryCurves(); + for ( auto c : curves ) { - isMatching = true; + if ( c->summaryCaseY()->caseId() == caseIdToMatch ) isMatching = true; } - else if ( !groupNameToMatch.empty() && a.groupName() == groupNameToMatch ) - { - isMatching = true; - } - else if ( regionToMatch != -1 && a.regionNumber() == regionToMatch ) + } + else + { + auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( sourcePlot ); + + for ( const auto& a : addresses ) { - isMatching = true; + if ( !wellNameToMatch.empty() && a.wellName() == wellNameToMatch ) + { + isMatching = true; + } + else if ( !groupNameToMatch.empty() && a.groupName() == groupNameToMatch ) + { + isMatching = true; + } + else if ( regionToMatch != -1 && a.regionNumber() == regionToMatch ) + { + isMatching = true; + } } } diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h index 6d7a764a55..6723f922ed 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h @@ -40,19 +40,20 @@ class RicAppendSummaryPlotsForObjectsFeature : public caf::CmdFeature public: static std::vector selectedCollections(); static std::vector - plotsForOneInstanceOfObjectType( const std::vector& sourcePlots, - RimSummaryAddressCollection::CollectionContentType objectType ); + plotsForOneInstanceOfObjectType( const std::vector& sourcePlots, + RimSummaryAddressCollection::CollectionContentType objectType ); static bool isSelectionCompatibleWithPlot( const std::vector& selection, RimSummaryMultiPlot* summaryMultiPlot ); + static void appendPlots( RimSummaryMultiPlot* summaryMultiPlot, + const std::vector& selection ); + protected: bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; private: - - RifEclipseSummaryAddress modifyAddress( const RifEclipseSummaryAddress& sourceAddress, - RimSummaryAddressCollection* summaryAddressCollection ); - + static RifEclipseSummaryAddress modifyAddress( const RifEclipseSummaryAddress& sourceAddress, + RimSummaryAddressCollection* summaryAddressCollection ); }; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp new file mode 100644 index 0000000000..e7f13dac50 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicAppendSummaryPlotsForSummaryAddressesFeature.h" + +#include "RiaGuiApplication.h" + +#include "RicAppendSummaryPlotsForObjectsFeature.h" + +#include "RimSummaryAddress.h" +#include "RimSummaryAddressCollection.h" +#include "RimSummaryCase.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryPlot.h" + +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT( RicAppendSummaryPlotsForSummaryAddressesFeature, "RicAppendSummaryPlotsForSummaryAddressesFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryPlotsForSummaryAddressesFeature::appendPlotsForAddresses( RimSummaryMultiPlot* summaryMultiPlot, + const std::vector& addresses ) +{ + if ( !summaryMultiPlot ) return; + if ( addresses.empty() ) return; + + for ( auto adr : addresses ) + { + auto* plot = new RimSummaryPlot(); + plot->enableAutoPlotTitle( true ); + plot->handleDroppedObjects( { adr } ); + + summaryMultiPlot->addPlot( plot ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicAppendSummaryPlotsForSummaryAddressesFeature::isCommandEnabled() +{ + return !selectedAddresses().empty(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryPlotsForSummaryAddressesFeature::onActionTriggered( bool isChecked ) +{ + RiaGuiApplication* app = RiaGuiApplication::instance(); + + auto summaryMultiPlot = dynamic_cast( app->activePlotWindow() ); + if ( !summaryMultiPlot ) return; + + auto addresses = selectedAddresses(); + if ( addresses.empty() ) return; + + appendPlotsForAddresses( summaryMultiPlot, addresses ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryPlotsForSummaryAddressesFeature::setupActionLook( QAction* actionToSetup ) +{ + QString objectType = "Addresses"; + + auto text = QString( "Append Plots For " ) + objectType; + actionToSetup->setText( text ); + actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicAppendSummaryPlotsForSummaryAddressesFeature::selectedAddresses() +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType( &objects ); + + return objects; +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.h new file mode 100644 index 0000000000..3067e13d86 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +#include + +class RimSummaryAddress; +class RimSummaryMultiPlot; + +//================================================================================================== +/// +//================================================================================================== +class RicAppendSummaryPlotsForSummaryAddressesFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +public: + static void appendPlotsForAddresses( RimSummaryMultiPlot* summaryMultiPlot, + const std::vector& addresses ); + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + +private: + static std::vector selectedAddresses(); +}; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.cpp new file mode 100644 index 0000000000..364dcc799b --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.cpp @@ -0,0 +1,107 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicAppendSummaryPlotsForSummaryCasesFeature.h" + +#include "RiaGuiApplication.h" + +#include "RicAppendSummaryPlotsForObjectsFeature.h" + +#include "RimSummaryAddressCollection.h" +#include "RimSummaryCase.h" +#include "RimSummaryMultiPlot.h" + +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT( RicAppendSummaryPlotsForSummaryCasesFeature, "RicAppendSummaryPlotsForSummaryCasesFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryPlotsForSummaryCasesFeature::appendPlotsForCases( RimSummaryMultiPlot* summaryMultiPlot, + const std::vector& cases ) +{ + if ( !summaryMultiPlot ) return; + if ( cases.empty() ) return; + + std::vector tmp; + + for ( auto c : cases ) + { + auto myColl = new RimSummaryAddressCollection; + myColl->setContentType( RimSummaryAddressCollection::CollectionContentType::SUMMARY_CASE ); + myColl->setCaseId( c->caseId() ); + tmp.push_back( myColl ); + } + + RicAppendSummaryPlotsForObjectsFeature::appendPlots( summaryMultiPlot, tmp ); + + for ( auto obj : tmp ) + { + delete obj; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicAppendSummaryPlotsForSummaryCasesFeature::isCommandEnabled() +{ + return !selectedCases().empty(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryPlotsForSummaryCasesFeature::onActionTriggered( bool isChecked ) +{ + RiaGuiApplication* app = RiaGuiApplication::instance(); + + auto summaryMultiPlot = dynamic_cast( app->activePlotWindow() ); + if ( !summaryMultiPlot ) return; + + auto cases = selectedCases(); + if ( cases.empty() ) return; + + appendPlotsForCases( summaryMultiPlot, cases ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicAppendSummaryPlotsForSummaryCasesFeature::setupActionLook( QAction* actionToSetup ) +{ + QString objectType = "Cases"; + + auto text = QString( "Append Plots For " ) + objectType; + actionToSetup->setText( text ); + actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicAppendSummaryPlotsForSummaryCasesFeature::selectedCases() +{ + std::vector objects; + caf::SelectionManager::instance()->objectsByType( &objects ); + + return objects; +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.h new file mode 100644 index 0000000000..ab1c6acd96 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.h @@ -0,0 +1,45 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +#include + +class RimSummaryCase; +class RimSummaryMultiPlot; + +//================================================================================================== +/// +//================================================================================================== +class RicAppendSummaryPlotsForSummaryCasesFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +public: + static void appendPlotsForCases( RimSummaryMultiPlot* summaryMultiPlot, const std::vector& cases ); + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + +private: + static std::vector selectedCases(); +}; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index d89ef70e77..144f64a4b4 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -362,7 +362,7 @@ RimSummaryMultiPlot* plotWindow->setAsPlotMdiWindow(); plotCollection->addSummaryMultiPlot( plotWindow ); - plotWindow->addPlot( objects ); + plotWindow->handleDroppedObjects( objects ); plotCollection->updateAllRequiredEditors(); plotWindow->loadDataAndUpdate(); diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 7030c133e7..e35e5c92dc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -787,6 +787,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder.addSeparator(); menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; + menuBuilder << "RicAppendSummaryCurvesForSummaryCasesFeature"; + menuBuilder << "RicAppendSummaryPlotsForSummaryCasesFeature"; menuBuilder.addSeparator(); menuBuilder << "RicImportGridModelFromSummaryCaseFeature"; @@ -1102,6 +1104,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { + menuBuilder << "RicAppendSummaryCurvesForSummaryCasesFeature"; + menuBuilder << "RicAppendSummaryPlotsForSummaryCasesFeature"; menuBuilder << "RicCreateMultiPlotFromSelectionFeature"; menuBuilder << "RicCreatePlotFromTemplateByShortcutFeature"; } @@ -1199,6 +1203,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewSummaryMultiPlotFromDataVectorFeature"; + menuBuilder << "RicAppendSummaryCurvesForSummaryAddressesFeature"; + menuBuilder << "RicAppendSummaryPlotsForSummaryAddressesFeature"; } #ifdef USE_ODB_API else if ( dynamic_cast( firstUiItem ) ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h index 4905a61cca..e875e1bb50 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -45,7 +45,8 @@ class RimSummaryAddressCollection : public RimNamedObject GROUP_FOLDER, REGION_FOLDER, BLOCK, - BLOCK_FOLDER + BLOCK_FOLDER, + SUMMARY_CASE }; public: diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 52671af9b2..b784efda33 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -23,6 +23,11 @@ #include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryStringTools.h" +#include "PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.h" +#include "PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.h" +#include "PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" + #include "RifEclEclipseSummary.h" #include "RifEclipseRftAddress.h" #include "RifEclipseSummaryAddress.h" @@ -34,6 +39,7 @@ #include "RimPlotAxisProperties.h" #include "RimProject.h" #include "RimSummaryAddress.h" +#include "RimSummaryAddressCollection.h" #include "RimSummaryAddressModifier.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" @@ -55,6 +61,7 @@ #include "qwt_scale_engine.h" #include + #include namespace caf @@ -166,20 +173,29 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::addPlot( const std::vector& objects ) +void RimSummaryMultiPlot::handleDroppedObjects( const std::vector& objects ) { if ( objects.empty() ) return; - auto* addr = dynamic_cast( objects[0] ); - if ( addr ) + std::vector addresses; + std::vector addressCollections; + std::vector cases; + + for ( auto o : objects ) { - auto* plot = new RimSummaryPlot(); - plot->enableAutoPlotTitle( true ); + auto address = dynamic_cast( o ); + if ( address ) addresses.push_back( address ); - plot->handleDroppedObjects( objects ); + auto adrColl = dynamic_cast( o ); + if ( adrColl ) addressCollections.push_back( adrColl ); - addPlot( plot ); + auto summaryCase = dynamic_cast( o ); + if ( summaryCase ) cases.push_back( summaryCase ); } + + RicAppendSummaryPlotsForSummaryAddressesFeature::appendPlotsForAddresses( this, addresses ); + RicAppendSummaryPlotsForObjectsFeature::appendPlots( this, addressCollections ); + RicAppendSummaryPlotsForSummaryCasesFeature::appendPlotsForCases( this, cases ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index ee63ef4317..fc54b4b3de 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -84,7 +84,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void syncAxisRanges(); - void addPlot( const std::vector& objects ); + void handleDroppedObjects( const std::vector& objects ); void summaryPlotItemInfos( QList* optionInfos ) const; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 6d5395ed84..0c4f3f84b3 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -739,11 +739,14 @@ void RiuMultiPlotBook::dropEvent( QDropEvent* event ) RimSummaryMultiPlot* multiPlot = dynamic_cast( m_plotDefinition.p() ); if ( multiPlot ) { - multiPlot->addPlot( objects ); + multiPlot->handleDroppedObjects( objects ); } } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- bool RiuMultiPlotBook::eventFilter( QObject* obj, QEvent* event ) { if ( event->type() == QEvent::Wheel ) From 64bed1d611133094f2b739caab2b414df92627a3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 29 Apr 2022 15:31:07 +0200 Subject: [PATCH 261/406] Summary Multi Plot: Minor adjustments (#8856) Remove obsolete single summary template code Always use maximized state of the QMdiSubWindow when a plot or view is deleted. Move time axis to top Set correct text for unused axis Avoid assert when layout is requested for non existing legend --- .../CMakeLists_files.cmake | 2 - .../RicSaveMultiPlotTemplateFeature.cpp | 4 +- .../RicSavePlotTemplateFeature.cpp | 230 ------------------ .../RicSavePlotTemplateFeature.h | 42 ---- .../RicSummaryPlotTemplateTools.cpp | 184 -------------- .../RicSummaryPlotTemplateTools.h | 51 ++-- .../RicNewPlotAxisPropertiesFeature.cpp | 12 +- .../RimContextCommandBuilder.cpp | 6 +- .../RimPlotAxisProperties.cpp | 15 ++ .../ProjectDataModel/RimPlotAxisProperties.h | 1 + .../Summary/RimSummaryCurve.cpp | 5 +- .../Summary/RimSummaryPlot.cpp | 54 ++-- .../UserInterface/RiuMainWindowBase.cpp | 3 +- .../UserInterface/RiuQwtPlotWidget.cpp | 94 ++++--- .../UserInterface/RiuSummaryPlot.cpp | 1 - ResInsightVersion.cmake | 2 +- 16 files changed, 137 insertions(+), 569 deletions(-) delete mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicSavePlotTemplateFeature.cpp delete mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicSavePlotTemplateFeature.h diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake index 293cacdbd1..6b7149beaa 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake @@ -1,5 +1,4 @@ set(SOURCE_GROUP_HEADER_FILES - ${CMAKE_CURRENT_LIST_DIR}/RicSavePlotTemplateFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSelectPlotTemplateUi.h ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotTemplateTools.h ${CMAKE_CURRENT_LIST_DIR}/RicReloadPlotTemplatesFeature.h @@ -10,7 +9,6 @@ set(SOURCE_GROUP_HEADER_FILES ) set(SOURCE_GROUP_SOURCE_FILES - ${CMAKE_CURRENT_LIST_DIR}/RicSavePlotTemplateFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSelectPlotTemplateUi.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotTemplateTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RicReloadPlotTemplatesFeature.cpp diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp index 28f3078138..535ec2d959 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp @@ -95,7 +95,9 @@ void RicSaveMultiPlotTemplateFeature::onActionTriggered( bool isChecked ) QFile exportFile( fileName ); if ( !exportFile.open( QIODevice::WriteOnly | QIODevice::Text ) ) { - RiaLogging::error( QString( "Save Plot Template : Could not open the file: %1" ).arg( fileName ) ); + RiaLogging::errorInMessageBox( NULL, + "Save Plot Template", + QString( "Could not save to the file: %1" ).arg( fileName ) ); return; } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSavePlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSavePlotTemplateFeature.cpp deleted file mode 100644 index 78947f3647..0000000000 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSavePlotTemplateFeature.cpp +++ /dev/null @@ -1,230 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- 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 -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RicSavePlotTemplateFeature.h" - -#include "RicReloadPlotTemplatesFeature.h" -#include "RicSummaryPlotTemplateTools.h" - -#include "RiaGuiApplication.h" -#include "RiaLogging.h" -#include "RiaPreferences.h" -#include "RiaSummaryTools.h" - -#include "RimEnsembleCurveSet.h" -#include "RimEnsembleCurveSetCollection.h" -#include "RimProject.h" -#include "RimSummaryCurve.h" -#include "RimSummaryPlot.h" - -#include "RiuFileDialogTools.h" - -#include "cafPdmObject.h" -#include "cafSelectionManager.h" -#include "cafUtils.h" - -#include -#include -#include -#include - -CAF_CMD_SOURCE_INIT( RicSavePlotTemplateFeature, "RicSavePlotTemplateFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicSavePlotTemplateFeature::isCommandEnabled() -{ - if ( selectedSummaryPlot() ) return true; - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicSavePlotTemplateFeature::onActionTriggered( bool isChecked ) -{ - if ( !selectedSummaryPlot() ) return; - - RiaGuiApplication* app = RiaGuiApplication::instance(); - - QString fallbackPath; - auto folders = app->preferences()->plotTemplateFolders(); - if ( !folders.empty() ) - { - // Use the last folder from preferences as the default fall back folder - fallbackPath = folders.back(); - } - - QString startPath = app->lastUsedDialogDirectoryWithFallback( "PLOT_TEMPLATE", fallbackPath ); - - QString templateCandidateName = caf::Utils::makeValidFileBasename( selectedSummaryPlot()->description() ); - - startPath = startPath + "/" + templateCandidateName + ".rpt"; - - QString fileName = RiuFileDialogTools::getSaveFileName( nullptr, - tr( "Save Plot Template To File" ), - startPath, - tr( "Plot Template Files (*.rpt);;All files(*.*)" ) ); - if ( !fileName.isEmpty() ) - { - QFile exportFile( fileName ); - if ( !exportFile.open( QIODevice::WriteOnly | QIODevice::Text ) ) - { - RiaLogging::error( QString( "Save Plot Template : Could not open the file: %1" ).arg( fileName ) ); - return; - } - - QString objectAsText = createTextFromObject( selectedSummaryPlot() ); - - QTextStream stream( &exportFile ); - stream << objectAsText; - - QString absPath = QFileInfo( fileName ).absolutePath(); - bool foundPathInPreferences = false; - for ( const auto& f : folders ) - { - if ( absPath.indexOf( f ) != -1 ) - { - foundPathInPreferences = true; - } - } - - if ( !foundPathInPreferences ) - { - QMessageBox msgBox; - msgBox.setIcon( QMessageBox::Question ); - - QString questionText; - questionText = QString( "The path is not part of the search path for templates.\n\nDo you want to append " - "the destination path to the search path?" ); - - msgBox.setText( questionText ); - msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel ); - - int ret = msgBox.exec(); - if ( ret == QMessageBox::Yes ) - { - app->preferences()->appendPlotTemplateFolders( absPath ); - app->preferences()->writePreferencesToApplicationStore(); - } - } - - app->setLastUsedDialogDirectory( "PLOT_TEMPLATE", absPath ); - - RicReloadPlotTemplatesFeature::rebuildFromDisc(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RicSavePlotTemplateFeature::createTextFromObject( RimSummaryPlot* summaryPlot ) -{ - if ( !summaryPlot ) return QString(); - - QString objectAsText = summaryPlot->writeObjectToXmlString(); - - caf::PdmObjectHandle* obj = - caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText, - caf::PdmDefaultObjectFactory::instance(), - true ); - - RimSummaryPlot* newSummaryPlot = dynamic_cast( obj ); - if ( newSummaryPlot ) - { - { - std::set caseReferenceStrings; - - const QString summaryFieldKeyword = RicSummaryPlotTemplateTools::summaryCaseFieldKeyword(); - for ( const auto& curve : newSummaryPlot->summaryCurves() ) - { - auto fieldHandle = curve->findField( summaryFieldKeyword ); - if ( fieldHandle ) - { - auto reference = fieldHandle->xmlCapability()->referenceString(); - caseReferenceStrings.insert( reference ); - } - } - - size_t index = 0; - for ( const auto& s : caseReferenceStrings ) - { - QString placeholderText = RicSummaryPlotTemplateTools::placeholderTextForSummaryCase(); - QString caseName = QString( "%1 %2" ).arg( placeholderText ).arg( index++ ); - - objectAsText.replace( s, caseName ); - } - } - - { - std::set ensembleReferenceStrings; - - const QString summaryGroupFieldKeyword = RicSummaryPlotTemplateTools::summaryGroupFieldKeyword(); - - for ( const auto& curveSet : newSummaryPlot->ensembleCurveSetCollection()->curveSets() ) - { - auto fieldHandle = curveSet->findField( summaryGroupFieldKeyword ); - if ( fieldHandle ) - { - auto reference = fieldHandle->xmlCapability()->referenceString(); - ensembleReferenceStrings.insert( reference ); - } - } - - size_t index = 0; - for ( const auto& s : ensembleReferenceStrings ) - { - QString placeholderText = RicSummaryPlotTemplateTools::placeholderTextForSummaryGroup(); - QString ensembleName = QString( "%1 %2" ).arg( placeholderText ).arg( index++ ); - - objectAsText.replace( s, ensembleName ); - } - } - } - - delete obj; - - return objectAsText; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicSavePlotTemplateFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Save As Plot Template" ); - actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryPlot* RicSavePlotTemplateFeature::selectedSummaryPlot() const -{ - RimSummaryPlot* sumPlot = nullptr; - - caf::PdmObject* selObj = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); - if ( selObj ) - { - sumPlot = RiaSummaryTools::parentSummaryPlot( selObj ); - } - - return sumPlot; -} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSavePlotTemplateFeature.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSavePlotTemplateFeature.h deleted file mode 100644 index 35839b4b57..0000000000 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSavePlotTemplateFeature.h +++ /dev/null @@ -1,42 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- 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 -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "cafCmdFeature.h" - -class RimSummaryPlot; - -//================================================================================================== -/// -//================================================================================================== -class RicSavePlotTemplateFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; - -private: - static QString createTextFromObject( RimSummaryPlot* summaryPlot ); - -private: - RimSummaryPlot* selectedSummaryPlot() const; -}; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index 1cdc0ee8bd..5c0e4529ee 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -278,190 +278,6 @@ void RicSummaryPlotTemplateTools::setValuesForPlaceholders( RimSummaryPlot* } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryPlot* RicSummaryPlotTemplateTools::createPlotFromTemplateFile( const QString& fileName ) -{ - QFile importFile( fileName ); - if ( !importFile.open( QIODevice::ReadOnly | QIODevice::Text ) ) - { - RiaLogging::error( QString( "Create Plot from Template : Could not open the file: %1" ).arg( fileName ) ); - return nullptr; - } - - QTextStream stream( &importFile ); - - QString objectAsText = stream.readAll(); - - caf::PdmObjectHandle* obj = - caf::PdmXmlObjectHandle::readUnknownObjectFromXmlString( objectAsText, - caf::PdmDefaultObjectFactory::instance(), - true ); - - auto* newSummaryPlot = dynamic_cast( obj ); - if ( newSummaryPlot ) - { - bool isTemplateBefore_2021_06 = !objectAsText.contains( "" ); - if ( isTemplateBefore_2021_06 ) - { - for ( auto c : newSummaryPlot->summaryAndEnsembleCurves() ) - { - // Special handling of appearance settings because we do not have any support for file version of - // plot templates - // https://github.com/OPM/ResInsight/issues/8257 - c->updateCurveAppearanceForFilesOlderThan_2021_06(); - } - } - - return newSummaryPlot; - } - - delete obj; - - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicSummaryPlotTemplateTools::appendSummaryPlotToPlotCollection( - RimSummaryPlot* summaryPlot, - const std::vector& selectedSummaryCases, - const std::vector& selectedEnsembles ) -{ - if ( !summaryPlot ) return; - - if ( selectedSummaryCases.empty() && selectedEnsembles.empty() ) return; - - RimSummaryMultiPlot* multiPlot = RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( summaryPlot ); - summaryPlot->resolveReferencesRecursively(); - summaryPlot->initAfterReadRecursively(); - - { - // Replace single summary curves data sources - - auto summaryCurves = summaryPlot->summaryCurves(); - - const QString summaryFieldKeyword = RicSummaryPlotTemplateTools::summaryCaseFieldKeyword(); - - int maximumIndexValue = -1; - for ( const auto& curve : summaryCurves ) - { - auto fieldHandle = curve->findField( summaryFieldKeyword ); - if ( fieldHandle ) - { - bool conversionOk = false; - const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForSummaryCase(); - - auto referenceString = fieldHandle->xmlCapability()->referenceString(); - int indexValue = - RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, referenceString, &conversionOk ); - - maximumIndexValue = std::max( maximumIndexValue, indexValue ); - - if ( conversionOk && indexValue >= 0 && indexValue < static_cast( selectedSummaryCases.size() ) ) - { - auto summaryCaseY = selectedSummaryCases[static_cast( indexValue )]; - curve->setSummaryCaseY( summaryCaseY ); - - auto currentAddressY = curve->summaryAddressY(); - if ( summaryCaseY->summaryReader() && !summaryCaseY->summaryReader()->hasAddress( currentAddressY ) ) - { - auto allAddresses = summaryCaseY->summaryReader()->allResultAddresses(); - - auto candidate = - RicSummaryPlotTemplateTools::firstAddressByQuantity( currentAddressY, allAddresses ); - if ( candidate.category() != RifEclipseSummaryAddress::SUMMARY_INVALID ) - { - curve->setSummaryAddressY( candidate ); - } - } - } - } - } - - if ( selectedSummaryCases.size() > static_cast( maximumIndexValue + 1 ) ) - { - // Use the curve style of the last curve in template, and duplicate this for remaining data sources - - if ( !summaryCurves.empty() ) - { - auto lastSummaryCurve = summaryCurves.back(); - - for ( size_t i = maximumIndexValue; i < selectedSummaryCases.size(); i++ ) - { - auto newCurve = - dynamic_cast( lastSummaryCurve->xmlCapability()->copyByXmlSerialization( - caf::PdmDefaultObjectFactory::instance() ) ); - - auto summaryCaseY = selectedSummaryCases[i]; - newCurve->setSummaryCaseY( summaryCaseY ); - summaryPlot->addCurveAndUpdate( newCurve ); - } - } - } - } - - { - // Replace ensemble data sources - - auto summaryCurveSets = summaryPlot->ensembleCurveSetCollection()->curveSets(); - - const QString summaryGroupFieldKeyword = RicSummaryPlotTemplateTools::summaryGroupFieldKeyword(); - - int maximumIndexValue = -1; - - for ( const auto& curveSet : summaryCurveSets ) - { - auto fieldHandle = curveSet->findField( summaryGroupFieldKeyword ); - if ( fieldHandle ) - { - bool conversionOk = false; - const QString placeholderString = RicSummaryPlotTemplateTools::placeholderTextForSummaryGroup(); - - auto referenceString = fieldHandle->xmlCapability()->referenceString(); - int indexValue = - RicSummaryPlotTemplateTools::findValueForKeyword( placeholderString, referenceString, &conversionOk ); - - maximumIndexValue = std::max( maximumIndexValue, indexValue ); - - if ( conversionOk && indexValue < static_cast( selectedEnsembles.size() ) ) - { - auto summaryCaseY = selectedEnsembles[indexValue]; - curveSet->setSummaryCaseCollection( summaryCaseY ); - } - } - } - - if ( selectedEnsembles.size() > static_cast( maximumIndexValue + 1 ) ) - { - // Use the curve style of the last curve in template, and duplicate this for remaining data sources - - if ( !summaryCurveSets.empty() ) - { - auto lastSummaryCurveSet = summaryCurveSets.back(); - - for ( size_t i = maximumIndexValue; i < selectedEnsembles.size(); i++ ) - { - auto newCurveSet = - dynamic_cast( lastSummaryCurveSet->xmlCapability()->copyByXmlSerialization( - caf::PdmDefaultObjectFactory::instance() ) ); - - auto ensembleDataSource = selectedEnsembles[i]; - newCurveSet->setSummaryCaseCollection( ensembleDataSource ); - - summaryPlot->ensembleCurveSetCollection()->addCurveSet( newCurveSet ); - } - } - } - } - - multiPlot->updateConnectedEditors(); - - summaryPlot->loadDataAndUpdate(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h index 8d7a25cac2..9212c3feb0 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h @@ -41,9 +41,31 @@ class RimSummaryAddressCollection; class RicSummaryPlotTemplateTools { public: + static RimSummaryMultiPlot* create( const QString& fileName ); + + static QString selectPlotTemplatePath(); + + static QString summaryCaseFieldKeyword(); + static QString summaryGroupFieldKeyword(); + + static QString placeholderTextForSummaryCase(); + static QString placeholderTextForSummaryGroup(); + static QString placeholderTextForWell(); + static QString placeholderTextForGroup(); + +private: static RimSummaryMultiPlot* createMultiPlotFromTemplateFile( const QString& fileName ); - static RimSummaryMultiPlot* create( const QString& fileName ); + static std::vector selectedSummaryCases(); + static std::vector selectedSummaryCaseCollections(); + static std::vector selectedSummaryAddressCollections(); + + static QString htmlTextFromPlotAndSelection( const RimSummaryPlot* templatePlot, + + const std::set& selectedSummaryAddresses, + const std::vector& selectedSources ); + + static QString htmlTextFromCount( const QString& itemText, size_t requiredItemCount, size_t selectionCount ); static void setValuesForPlaceholders( RimSummaryMultiPlot* summaryMultiPlot, const std::vector& selectedSummaryCases, @@ -59,33 +81,6 @@ class RicSummaryPlotTemplateTools const std::vector& groupNames, const std::vector& regions ); - static RimSummaryPlot* createPlotFromTemplateFile( const QString& fileName ); - static void appendSummaryPlotToPlotCollection( RimSummaryPlot* summaryPlot, - const std::vector& selectedSummaryCases, - const std::vector& selectedEnsembles ); - - static QString htmlTextFromPlotAndSelection( const RimSummaryPlot* templatePlot, - const std::set& selectedSummaryAddresses, - const std::vector& selectedSources ); - - static QString htmlTextFromCount( const QString& itemText, size_t requiredItemCount, size_t selectionCount ); - - static QString selectPlotTemplatePath(); - - static std::vector selectedSummaryCases(); - static std::vector selectedSummaryCaseCollections(); - - static std::vector selectedSummaryAddressCollections(); - - static QString summaryCaseFieldKeyword(); - static QString summaryGroupFieldKeyword(); - - static QString placeholderTextForSummaryCase(); - static QString placeholderTextForSummaryGroup(); - static QString placeholderTextForWell(); - static QString placeholderTextForGroup(); - -private: static RifEclipseSummaryAddress firstAddressByQuantity( const RifEclipseSummaryAddress& sourceAddress, const std::set& allAddresses ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp index 09e42f57ac..90356804fe 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewPlotAxisPropertiesFeature.cpp @@ -36,8 +36,8 @@ CAF_CMD_SOURCE_INIT( RicNewPlotAxisPropertiesFeature, "RicNewPlotAxisPropertiesF //-------------------------------------------------------------------------------------------------- bool RicNewPlotAxisPropertiesFeature::isCommandEnabled() { - std::vector summaryPlots = caf::selectedObjectsByTypeStrict(); - return summaryPlots.size() == 1; + auto* summaryPlot = caf::firstAncestorOfTypeFromSelectedObject(); + return ( summaryPlot != nullptr ); } //-------------------------------------------------------------------------------------------------- @@ -45,13 +45,13 @@ bool RicNewPlotAxisPropertiesFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicNewPlotAxisPropertiesFeature::onActionTriggered( bool isChecked ) { - std::vector summaryPlots = caf::selectedObjectsByTypeStrict(); - if ( summaryPlots.size() != 1 ) return; - - RimSummaryPlot* summaryPlot = summaryPlots[0]; + auto* summaryPlot = caf::firstAncestorOfTypeFromSelectedObject(); + if ( !summaryPlot ) return; RimPlotAxisProperties* newPlotAxisProperties = summaryPlot->addNewAxisProperties( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "New Axis" ); + summaryPlot->plotWidget()->ensureAxisIsCreated( newPlotAxisProperties->plotAxisType() ); + newPlotAxisProperties->setNameForUnusedAxis(); summaryPlot->updateConnectedEditors(); RiuPlotMainWindowTools::selectAsCurrentItem( newPlotAxisProperties ); diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index e35e5c92dc..db636871c1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -100,6 +100,7 @@ #include "RimParameterResultCrossPlot.h" #include "RimPerforationCollection.h" #include "RimPerforationInterval.h" +#include "RimPlotAxisPropertiesInterface.h" #include "RimPlotDataFilterCollection.h" #include "RimPlotDataFilterItem.h" #include "RimPltPlotCollection.h" @@ -680,7 +681,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewSummaryCrossPlotCurveFeature"; menuBuilder << "RicNewPlotAxisPropertiesFeature"; menuBuilder << "Separator"; - menuBuilder << "RicSavePlotTemplateFeature"; // Export is not supported for cross plot if ( !summaryCrossPlot ) menuBuilder << "RicAsciiExportSummaryPlotFeature"; @@ -1043,6 +1043,10 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicCreateMultiPlotFromSelectionFeature"; menuBuilder << "RicCreatePlotFromTemplateByShortcutFeature"; } + else if ( dynamic_cast( firstUiItem ) ) + { + menuBuilder << "RicNewPlotAxisPropertiesFeature"; + } if ( dynamic_cast( firstUiItem ) ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index d3ef5cad76..680cc82bb1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -133,6 +133,21 @@ void RimPlotAxisProperties::enableRangeSettings( bool enable ) m_isRangeSettingsEnabled = enable; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::setNameForUnusedAxis() +{ + QString name = "Unused "; + + if ( m_plotAxis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ) + name += "Left"; + else if ( m_plotAxis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) + name += "Right"; + + m_name = name; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index b63b4de154..91551fd06d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -61,6 +61,7 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface void setEnableTitleTextSettings( bool enable ); void enableRangeSettings( bool enable ); + void setNameForUnusedAxis(); void setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis, int axisIndex = 0 ); AxisTitlePositionType titlePosition() const override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index bb67b29cc8..eb18e3573d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -511,7 +511,10 @@ QList RimSummaryCurve::calculateValueOptions( const caf: for ( auto axis : plot->plotAxes() ) { - options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) ); + if ( dynamic_cast( axis ) ) + { + options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) ); + } } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index eb10d8e681..8cf3be5e8e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -127,12 +127,6 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) CAF_PDM_InitFieldNoDefault( &m_axisProperties, "AxisProperties", "Axes", ":/Axes16x16.png" ); - auto leftAxis = addNewAxisProperties( RiuPlotAxis::defaultLeft(), "Left" ); - leftAxis->setAlwaysRequired( true ); - - auto rightAxis = addNewAxisProperties( RiuPlotAxis::defaultRight(), "Right" ); - rightAxis->setAlwaysRequired( true ); - if ( m_isCrossPlot ) { addNewAxisProperties( RiuPlotAxis::defaultBottom(), "Bottom" ); @@ -145,6 +139,12 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) m_axisProperties.push_back( timeAxisProperties ); } + auto leftAxis = addNewAxisProperties( RiuPlotAxis::defaultLeft(), "Left" ); + leftAxis->setAlwaysRequired( true ); + + auto rightAxis = addNewAxisProperties( RiuPlotAxis::defaultRight(), "Right" ); + rightAxis->setAlwaysRequired( true ); + CAF_PDM_InitFieldNoDefault( &m_textCurveSetEditor, "SummaryPlotFilterTextCurveSetEditor", "Text Filter Curve Creator" ); m_textCurveSetEditor.uiCapability()->setUiTreeHidden( true ); m_textCurveSetEditor = new RimSummaryPlotFilterTextCurveSetEditor; @@ -813,27 +813,37 @@ void RimSummaryPlot::updateAxis( RiaDefines::PlotAxis plotAxis ) if ( riuPlotAxis.axis() == plotAxis ) { auto* axisProperties = dynamic_cast( yAxisProperties ); - if ( yAxisProperties->isActive() && hasVisibleCurvesForAxis( riuPlotAxis ) && axisProperties ) + if ( axisProperties ) { - plotWidget()->enableAxis( riuPlotAxis, true ); - - std::set timeHistoryQuantities; + if ( yAxisProperties->isActive() && hasVisibleCurvesForAxis( riuPlotAxis ) ) + { + plotWidget()->enableAxis( riuPlotAxis, true ); + } + else + { + plotWidget()->enableAxis( riuPlotAxis, false ); + } - for ( auto c : visibleTimeHistoryCurvesForAxis( riuPlotAxis ) ) + if ( !hasVisibleCurvesForAxis( riuPlotAxis ) ) { - timeHistoryQuantities.insert( c->quantityName() ); + axisProperties->setNameForUnusedAxis(); } + else + { + std::set timeHistoryQuantities; - RimSummaryPlotAxisFormatter calc( axisProperties, - visibleSummaryCurvesForAxis( riuPlotAxis ), - {}, - visibleAsciiDataCurvesForAxis( riuPlotAxis ), - timeHistoryQuantities ); - calc.applyAxisPropertiesToPlot( plotWidget() ); - } - else - { - plotWidget()->enableAxis( riuPlotAxis, false ); + for ( auto c : visibleTimeHistoryCurvesForAxis( riuPlotAxis ) ) + { + timeHistoryQuantities.insert( c->quantityName() ); + } + + RimSummaryPlotAxisFormatter calc( axisProperties, + visibleSummaryCurvesForAxis( riuPlotAxis ), + {}, + visibleAsciiDataCurvesForAxis( riuPlotAxis ), + timeHistoryQuantities ); + calc.applyAxisPropertiesToPlot( plotWidget() ); + } } plotWidget()->enableAxisNumberLabels( riuPlotAxis, axisProperties->showNumbers() ); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 4b4ba20f98..46dc29bb68 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -346,11 +346,10 @@ bool RiuMainWindowBase::isBlockingViewSelectionOnSubWindowActivated() const //-------------------------------------------------------------------------------------------------- void RiuMainWindowBase::removeViewerFromMdiArea( QMdiArea* mdiArea, QWidget* viewer ) { - bool wasMaximized = viewer && viewer->isMaximized(); - bool removedSubWindowWasActive = false; QMdiSubWindow* subWindowBeingClosed = findMdiSubWindow( viewer ); + bool wasMaximized = subWindowBeingClosed->isMaximized(); if ( subWindowBeingClosed ) { if ( subWindowBeingClosed->isActiveWindow() ) diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 2853fc747b..493c82d7a3 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -80,7 +80,7 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent ) { CAF_ASSERT( m_plotDefinition ); - QVBoxLayout* layout = new QVBoxLayout; + auto* layout = new QVBoxLayout; layout->setContentsMargins( 0, 0, 0, 0 ); setLayout( layout ); @@ -275,7 +275,7 @@ void RiuQwtPlotWidget::setInternalLegendVisible( bool visible ) { if ( visible ) { - QwtLegend* legend = new QwtLegend( this ); + auto* legend = new QwtLegend( this ); m_plot->insertLegend( legend, QwtPlot::BottomLegend ); } else @@ -291,7 +291,7 @@ void RiuQwtPlotWidget::insertLegend( RiuPlotWidget::Legend legendPosition ) { CAF_ASSERT( legendPosition == RiuPlotWidget::Legend::BOTTOM ); - QwtLegend* legend = new QwtLegend( this ); + auto* legend = new QwtLegend( this ); m_plot->insertLegend( legend, QwtPlot::BottomLegend ); } @@ -355,7 +355,7 @@ void RiuQwtPlotWidget::enableGridLines( RiuPlotAxis axis, bool majorGridLines, b auto qwtAxis = toQwtPlotAxis( axis ); for ( QwtPlotItem* plotItem : plotItems ) { - QwtPlotGrid* grid = static_cast( plotItem ); + auto* grid = static_cast( plotItem ); if ( qwtAxis == QwtAxis::XTop || qwtAxis == QwtAxis::XBottom ) { grid->setXAxis( qwtAxis ); @@ -382,8 +382,8 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervals( RiuPlotAxis axis, double minValue, double maxValue ) { - auto qwtAxis = toQwtPlotAxis( axis ); - RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); + auto qwtAxis = toQwtPlotAxis( axis ); + auto* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); if ( scaleEngine ) { QwtScaleDiv scaleDiv = @@ -404,8 +404,8 @@ void RiuQwtPlotWidget::setMajorAndMinorTickIntervalsAndRange( RiuPlotAxis axis, double rangeMin, double rangeMax ) { - auto qwtAxis = toQwtPlotAxis( axis ); - RiuQwtLinearScaleEngine* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); + auto qwtAxis = toQwtPlotAxis( axis ); + auto* scaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); if ( scaleEngine ) { QwtScaleDiv scaleDiv = scaleEngine->divideScaleWithExplicitIntervalsAndRange( minTickValue, @@ -542,7 +542,7 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event ) { if ( RiuPlotWidget::handleDragDropEvent( event ) ) return true; - QWheelEvent* wheelEvent = dynamic_cast( event ); + auto* wheelEvent = dynamic_cast( event ); if ( wheelEvent && watched == m_plot->canvas() ) { event->accept(); @@ -551,7 +551,7 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event ) return true; } - QMouseEvent* mouseEvent = dynamic_cast( event ); + auto* mouseEvent = dynamic_cast( event ); if ( mouseEvent ) { if ( isZoomerActive() ) return false; @@ -571,7 +571,7 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event ) QWidget* childClicked = m_plot->childAt( m_clickPosition ); if ( childClicked ) { - QwtScaleWidget* scaleWidget = qobject_cast( childClicked ); + auto* scaleWidget = qobject_cast( childClicked ); if ( scaleWidget ) { onAxisSelected( scaleWidget, toggleItemInSelection ); @@ -678,7 +678,7 @@ void RiuQwtPlotWidget::applyAxisTitleToQwt( RiuPlotAxis axis ) //-------------------------------------------------------------------------------------------------- QSize RiuQwtPlotWidget::sizeHint() const { - return QSize( 0, 0 ); + return { 0, 0 }; } //-------------------------------------------------------------------------------------------------- @@ -686,7 +686,7 @@ QSize RiuQwtPlotWidget::sizeHint() const //-------------------------------------------------------------------------------------------------- QSize RiuQwtPlotWidget::minimumSizeHint() const { - return QSize( 0, 0 ); + return { 0, 0 }; } //-------------------------------------------------------------------------------------------------- @@ -787,8 +787,8 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS { for ( int i = 0; i < QwtAxis::AxisPositions; ++i ) { - QwtAxis::Position pos = static_cast( i ); - int count = m_plot->axesCount( pos ); + auto pos = static_cast( i ); + int count = m_plot->axesCount( pos ); for ( int id = 0; id < count; id++ ) { QwtAxisId axisId( pos, id ); @@ -844,13 +844,13 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos, *distanceFromClick = std::numeric_limits::infinity(); const QwtPlotItemList& itmList = m_plot->itemList(); - for ( QwtPlotItemIterator it = itmList.begin(); it != itmList.end(); it++ ) + for ( auto it : itmList ) { - if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotCurve ) + if ( it->rtti() == QwtPlotItem::Rtti_PlotCurve ) { - QwtPlotCurve* candidateCurve = static_cast( *it ); - double dist = std::numeric_limits::infinity(); - int curvePoint = candidateCurve->closestPoint( pos, &dist ); + auto* candidateCurve = static_cast( it ); + double dist = std::numeric_limits::infinity(); + int curvePoint = candidateCurve->closestPoint( pos, &dist ); if ( dist < *distanceFromClick ) { *closestItem = candidateCurve; @@ -858,21 +858,21 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos, *closestCurvePoint = curvePoint; } } - else if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotShape ) + else if ( it->rtti() == QwtPlotItem::Rtti_PlotShape ) { - QwtPlotShapeItem* shapeItem = static_cast( *it ); - QPointF scalePos( m_plot->invTransform( QwtAxis::XBottom, pos.x() ), + auto* shapeItem = static_cast( it ); + QPointF scalePos( m_plot->invTransform( QwtAxis::XBottom, pos.x() ), m_plot->invTransform( QwtAxis::YLeft, pos.y() ) ); if ( shapeItem->shape().boundingRect().contains( scalePos ) ) { - *closestItem = *it; + *closestItem = it; *distanceFromClick = 0.0; } } - else if ( ( *it )->rtti() == QwtPlotItem::Rtti_PlotBarChart ) + else if ( it->rtti() == QwtPlotItem::Rtti_PlotBarChart ) { - QwtPlotBarChart* barChart = static_cast( *it ); - QPointF scalePos( m_plot->invTransform( QwtAxis::XBottom, pos.x() ), + auto* barChart = static_cast( it ); + QPointF scalePos( m_plot->invTransform( QwtAxis::XBottom, pos.x() ), m_plot->invTransform( QwtAxis::YLeft, pos.y() ) ); bool horizontal = barChart->orientation() == Qt::Horizontal; @@ -883,7 +883,7 @@ void RiuQwtPlotWidget::findClosestPlotItem( const QPoint& pos, : std::abs( samplePoint.x() - scalePos.x() ); if ( dist < *distanceFromClick ) { - *closestItem = *it; + *closestItem = it; *closestCurvePoint = (int)i; *distanceFromClick = dist; } @@ -964,8 +964,8 @@ void RiuQwtPlotWidget::highlightPlotItems( const std::set& c auto plotItemList = m_plot->itemList(); for ( QwtPlotItem* plotItem : plotItemList ) { - QwtPlotCurve* plotCurve = dynamic_cast( plotItem ); - QwtPlotShapeItem* plotShapeItem = dynamic_cast( plotItem ); + auto* plotCurve = dynamic_cast( plotItem ); + auto* plotShapeItem = dynamic_cast( plotItem ); if ( plotCurve ) { QPen existingPen = plotCurve->pen(); @@ -975,7 +975,7 @@ void RiuQwtPlotWidget::highlightPlotItems( const std::set& c QColor symbolColor; QColor symbolLineColor; - QwtSymbol* symbol = const_cast( plotCurve->symbol() ); + auto* symbol = const_cast( plotCurve->symbol() ); if ( symbol ) { symbolColor = symbol->brush().color(); @@ -1026,8 +1026,8 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting() auto plotItemList = m_plot->itemList(); for ( QwtPlotItem* plotItem : plotItemList ) { - QwtPlotCurve* plotCurve = dynamic_cast( plotItem ); - QwtPlotShapeItem* plotShapeItem = dynamic_cast( plotItem ); + auto* plotCurve = dynamic_cast( plotItem ); + auto* plotShapeItem = dynamic_cast( plotItem ); if ( plotCurve && m_originalCurveColors.count( plotCurve ) ) { const QPen& existingPen = plotCurve->pen(); @@ -1036,7 +1036,7 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting() plotCurve->setPen( colors.lineColor, existingPen.width(), existingPen.style() ); plotCurve->setZ( zValue ); - QwtSymbol* symbol = const_cast( plotCurve->symbol() ); + auto* symbol = const_cast( plotCurve->symbol() ); if ( symbol ) { symbol->setColor( colors.symbolColor ); @@ -1068,7 +1068,7 @@ void RiuQwtPlotWidget::highlightPlotItemsForQwtAxis( QwtAxisId axisId ) auto plotItemList = m_plot->itemList(); for ( QwtPlotItem* plotItem : plotItemList ) { - QwtPlotCurve* plotCurve = dynamic_cast( plotItem ); + auto* plotCurve = dynamic_cast( plotItem ); if ( plotCurve ) { QwtAxisId xAxis = plotCurve->xAxis(); @@ -1143,7 +1143,10 @@ void RiuQwtPlotWidget::enableAxisNumberLabels( RiuPlotAxis axis, bool isEnabled //-------------------------------------------------------------------------------------------------- bool RiuQwtPlotWidget::axisEnabled( RiuPlotAxis axis ) const { - return m_plot->isAxisVisible( toQwtPlotAxis( axis ) ); + auto qwtPlotAxis = toQwtPlotAxis( axis ); + if ( qwtPlotAxis.pos < 0 ) return false; + + return m_plot->isAxisVisible( qwtPlotAxis ); } //-------------------------------------------------------------------------------------------------- @@ -1202,12 +1205,10 @@ RiuQwtPlotWidget::AxisScaleType RiuQwtPlotWidget::axisScaleType( RiuPlotAxis axi { auto qwtAxis = toQwtPlotAxis( axis ); - QwtLogScaleEngine* logScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); - QwtDateScaleEngine* dateScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); - if ( logScaleEngine != nullptr ) - return AxisScaleType::LOGARITHMIC; - else if ( dateScaleEngine != nullptr ) - return AxisScaleType::DATE; + auto* logScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); + auto* dateScaleEngine = dynamic_cast( m_plot->axisScaleEngine( qwtAxis ) ); + if ( logScaleEngine != nullptr ) return AxisScaleType::LOGARITHMIC; + if ( dateScaleEngine != nullptr ) return AxisScaleType::DATE; return AxisScaleType::LINEAR; } @@ -1299,7 +1300,7 @@ void RiuQwtPlotWidget::pruneAxes( const std::set& usedAxes ) } } - for ( auto plotAxis : axesToRemove ) + for ( const auto& plotAxis : axesToRemove ) moveAxis( plotAxis, RiuPlotAxis::defaultLeft() ); } @@ -1388,9 +1389,6 @@ QwtAxisId RiuQwtPlotWidget::toQwtPlotAxis( RiuPlotAxis plotAxis ) const { return it->second; } - else - { - CAF_ASSERT( false ); - return QwtAxisId( 0, 0 ); - } + + return { -1, -1 }; } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp index 58bdd23988..a1f21d2437 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp @@ -60,7 +60,6 @@ void RiuSummaryPlot::showContextMenu( QPoint pos ) caf::CmdFeatureMenuBuilder menuBuilder; menuBuilder << "RicShowPlotDataFeature"; - menuBuilder << "RicSavePlotTemplateFeature"; double distanceFromClick = std::numeric_limits::infinity(); diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index f61e930b04..9ab0682608 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".01") +set(RESINSIGHT_DEV_VERSION ".02") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 19f2ddaaabba8279bd368e357cb351e34793fac3 Mon Sep 17 00:00:00 2001 From: magnesj Date: Sun, 1 May 2022 01:53:18 +0000 Subject: [PATCH 262/406] Fixes by clang-tidy --- .../PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp index 535ec2d959..68a4a04b1c 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp @@ -95,7 +95,7 @@ void RicSaveMultiPlotTemplateFeature::onActionTriggered( bool isChecked ) QFile exportFile( fileName ); if ( !exportFile.open( QIODevice::WriteOnly | QIODevice::Text ) ) { - RiaLogging::errorInMessageBox( NULL, + RiaLogging::errorInMessageBox( nullptr, "Save Plot Template", QString( "Could not save to the file: %1" ).arg( fileName ) ); return; From 46173af8c34ddb24a4c50d4fc93e8ab5a1c8f177 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 3 May 2022 08:51:26 +0200 Subject: [PATCH 263/406] Merge pull request #8865 from OPM/8863-summary-issues --- .../Application/RiaSummaryCurveDefinition.cpp | 7 +- .../RicSummaryPlotEditorUi.cpp | 43 ++--- .../Summary/RimSummaryCurve.cpp | 2 + .../Summary/RimSummaryPlot.cpp | 7 + .../UserInterface/RiuQwtPlotLegend.cpp | 1 + .../RiuSummaryVectorSelectionUi.cpp | 159 +----------------- .../RiuSummaryVectorSelectionUi.h | 4 - 7 files changed, 43 insertions(+), 180 deletions(-) diff --git a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp b/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp index fa6dfa0817..3896529b43 100644 --- a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp +++ b/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp @@ -42,14 +42,9 @@ RiaSummaryCurveDefinition::RiaSummaryCurveDefinition( RimSummaryCase* bool isEnsembleCurve ) : m_summaryCase( summaryCase ) , m_summaryAddress( summaryAddress ) + , m_ensemble( nullptr ) , m_isEnsembleCurve( isEnsembleCurve ) { - if ( summaryCase ) - { - RimSummaryCaseCollection* ensemble = nullptr; - summaryCase->firstAncestorOfType( ensemble ); - m_ensemble = ensemble; - } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index 99a13559fd..b52252d43e 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -94,7 +94,7 @@ RicSummaryPlotEditorUi::RicSummaryPlotEditorUi() CAF_PDM_InitFieldNoDefault( &m_groupAppearanceType, "GroupAppearanceType", "Group" ); CAF_PDM_InitFieldNoDefault( &m_regionAppearanceType, "RegionAppearanceType", "Region" ); - m_previewPlot.reset( new RimSummaryPlot() ); + m_previewPlot = std::make_unique(); CAF_PDM_InitFieldNoDefault( &m_useAutoPlotTitleProxy, "UseAutoPlotTitle", "Auto Plot Title" ); m_useAutoPlotTitleProxy.registerGetMethod( this, &RicSummaryPlotEditorUi::proxyPlotAutoTitle ); @@ -124,7 +124,7 @@ RicSummaryPlotEditorUi::RicSummaryPlotEditorUi() m_curveNameConfig.uiCapability()->setUiTreeHidden( true ); m_curveNameConfig.uiCapability()->setUiTreeChildrenHidden( true ); - m_summaryCurveSelectionEditor.reset( new RiuSummaryVectorSelectionWidgetCreator() ); + m_summaryCurveSelectionEditor = std::make_unique(); m_summaryCurveSelectionEditor->summaryAddressSelection()->setFieldChangedHandler( [this]() { this->selectionEditorFieldChanged(); } ); @@ -338,6 +338,13 @@ void RicSummaryPlotEditorUi::syncPreviewCurvesFromUiSelection() { std::vector allCurveDefinitionsVector = m_summaryCurveSelectionEditor->summaryAddressSelection()->allCurveDefinitionsFromSelection(); + + auto curveSetDefs = m_summaryCurveSelectionEditor->summaryAddressSelection()->allCurveSetDefinitionsFromSelections(); + for ( const auto& curveSet : curveSetDefs ) + { + allCurveDefinitionsVector.emplace_back( curveSet.ensemble(), curveSet.summaryAddress() ); + } + std::set allCurveDefinitions = std::set( allCurveDefinitionsVector.begin(), allCurveDefinitionsVector.end() ); @@ -461,18 +468,7 @@ void RicSummaryPlotEditorUi::updatePreviewCurvesFromCurveDefinitions( std::map> stashedErrorBarsAndLegendVisibility; for ( const auto& curveDef : curveDefsToAdd ) { - RimSummaryCase* currentCase = curveDef.summaryCase(); - RimSummaryCurve* curve = new RimSummaryCurve(); - if ( speedCheatsRequired ) - { - stashedErrorBarsAndLegendVisibility[curve] = std::make_pair( curve->errorBarsVisible(), curve->showInLegend() ); - curve->setErrorBarsVisible( false ); - curve->setShowInLegend( false ); - } - curve->setSummaryCaseY( currentCase ); - curve->setSummaryAddressYAndApplyInterpolation( curveDef.summaryAddress() ); - curve->applyCurveAutoNameSettings( *m_curveNameConfig() ); - if ( currentCase->isObservedData() ) curve->setSymbolSkipDistance( 0 ); + RimSummaryCase* currentCase = curveDef.summaryCase(); if ( curveDef.isEnsembleCurve() ) { @@ -522,10 +518,22 @@ void RicSummaryPlotEditorUi::updatePreviewCurvesFromCurveDefinitions( } } } - curveSet->addCurve( curve ); } else { + RimSummaryCurve* curve = new RimSummaryCurve(); + if ( speedCheatsRequired ) + { + stashedErrorBarsAndLegendVisibility[curve] = + std::make_pair( curve->errorBarsVisible(), curve->showInLegend() ); + curve->setErrorBarsVisible( false ); + curve->setShowInLegend( false ); + } + curve->setSummaryCaseY( currentCase ); + curve->setSummaryAddressYAndApplyInterpolation( curveDef.summaryAddress() ); + curve->applyCurveAutoNameSettings( *m_curveNameConfig() ); + if ( currentCase && currentCase->isObservedData() ) curve->setSymbolSkipDistance( 0 ); + m_previewPlot->addCurveNoUpdate( curve ); curveLookCalc.setupCurveLook( curve ); } @@ -625,10 +633,7 @@ void RicSummaryPlotEditorUi::populateCurveCreator( const RimSummaryPlot& sourceS previewCurveSetColl->addCurveSet( newCurveSet ); RimSummaryCaseCollection* ensemble = curveSet->summaryCaseCollection(); - for ( const auto& curve : curveSet->curves() ) - { - curveDefs.push_back( curve->curveDefinitionY() ); - } + curveDefs.emplace_back( ensemble, curveSet->summaryAddress() ); } m_previewPlot->copyAxisPropertiesFromOther( sourceSummaryPlot ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index eb18e3573d..c032cb215d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -1132,6 +1132,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, candicateAddress = m_xValuesSummaryAddress->address(); } + dlg.hideEnsembles(); dlg.setCaseAndAddress( candidateCase, candicateAddress ); if ( dlg.exec() == QDialog::Accepted ) @@ -1165,6 +1166,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, candicateAddress = m_yValuesSummaryAddress->address(); } + dlg.hideEnsembles(); dlg.setCaseAndAddress( candidateCase, candicateAddress ); if ( dlg.exec() == QDialog::Accepted ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 8cf3be5e8e..918088495f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2453,6 +2453,11 @@ void RimSummaryPlot::updateCurveNames() for ( auto curveSet : m_ensembleCurveSetCollection->curveSets() ) { curveSet->updateEnsembleLegendItem(); + + if ( curveSet->isCurvesVisible() ) + { + shortCurveNames.append( QString::fromStdString( curveSet->summaryAddress().quantityName() ) ); + } } m_alternatePlotName = shortCurveNames.join( "," ); @@ -2504,6 +2509,8 @@ void RimSummaryPlot::onCurveCollectionChanged( const SignalEmitter* emitter ) { updateStackedCurveData(); if ( plotWidget() ) plotWidget()->scheduleReplot(); + + updateAllRequiredEditors(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp index c98fd6caf9..438e8a81e4 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp @@ -108,6 +108,7 @@ QSize RiuQwtPlotLegend::sizeHint() const void RiuQwtPlotLegend::updateLegend( const QVariant& variant, const QList& legendItems ) { QwtLegend::updateLegend( variant, legendItems ); + setVisible( !legendItems.empty() ); emit legendUpdated(); } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp index 2d5d99da76..ed76ae9602 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp @@ -329,28 +329,17 @@ std::vector RiuSummaryVectorSelectionUi::allCurveDefi for ( SummarySource* currSource : selectedSummarySources() ) { - RimSummaryCaseCollection* ensemble = dynamic_cast( currSource ); - RimSummaryCase* sumCase = dynamic_cast( currSource ); + RimSummaryCase* sumCase = dynamic_cast( currSource ); + if ( sumCase == nullptr ) continue; std::set addressesFromSource; std::vector casesFromSource; - // Build case list - if ( ensemble ) + RifSummaryReaderInterface* reader = sumCase ? sumCase->summaryReader() : nullptr; + if ( reader ) { - auto addresses = ensemble->ensembleSummaryAddresses(); - addressesFromSource.insert( addresses.begin(), addresses.end() ); - auto ensembleCases = ensemble->allSummaryCases(); - casesFromSource.insert( casesFromSource.end(), ensembleCases.begin(), ensembleCases.end() ); - } - else - { - RifSummaryReaderInterface* reader = sumCase ? sumCase->summaryReader() : nullptr; - if ( reader ) - { - addressesFromSource.insert( reader->allResultAddresses().begin(), reader->allResultAddresses().end() ); - casesFromSource.push_back( sumCase ); - } + addressesFromSource.insert( reader->allResultAddresses().begin(), reader->allResultAddresses().end() ); + casesFromSource.push_back( sumCase ); } for ( auto caseFromSource : casesFromSource ) @@ -359,8 +348,7 @@ std::vector RiuSummaryVectorSelectionUi::allCurveDefi { if ( selectedAddressesFromUi.count( addressFromSource ) > 0 ) { - curveDefinitions.insert( - RiaSummaryCurveDefinition( caseFromSource, addressFromSource, ensemble != nullptr ) ); + curveDefinitions.insert( RiaSummaryCurveDefinition( caseFromSource, addressFromSource, false ) ); } } } @@ -593,15 +581,6 @@ QList RiuSummaryVectorSelectionUi::optionsForSummaryData optionItem.setLevel( 1 ); options.push_back( optionItem ); } - if ( showIndividualEnsembleCases ) - { - for ( const auto& sumCase : sumCaseColl->allSummaryCases() ) - { - auto optionItem = caf::PdmOptionItemInfo( sumCase->displayCaseName(), sumCase ); - optionItem.setLevel( 2 ); - options.push_back( optionItem ); - } - } } } @@ -610,7 +589,7 @@ QList RiuSummaryVectorSelectionUi::optionsForSummaryData // Grouped cases for ( const auto& sumCaseColl : sumCaseMainColl->summaryCaseCollections() ) { - if ( sumCaseColl->isEnsemble() ) continue; + if ( sumCaseColl->isEnsemble() && !showIndividualEnsembleCases ) continue; options.push_back( caf::PdmOptionItemInfo::createHeader( sumCaseColl->name(), true ) ); @@ -687,7 +666,6 @@ void RiuSummaryVectorSelectionUi::setSelectedCurveDefinitions( const std::vector m_selectedSources.end() ) { m_selectedSources.push_back( curveDef.ensemble() ); - handleAddedSource( curveDef.ensemble() ); } } } @@ -699,7 +677,6 @@ void RiuSummaryVectorSelectionUi::setSelectedCurveDefinitions( const std::vector m_selectedSources.end() ) { m_selectedSources.push_back( curveDef.summaryCase() ); - handleAddedSource( curveDef.summaryCase() ); } } } @@ -742,8 +719,6 @@ void RiuSummaryVectorSelectionUi::setSelectedCurveDefinitions( const std::vector m_currentSummaryCategory.setValue( cat ); } - m_previouslySelectedSources = m_selectedSources.ptrReferencedObjects(); - m_prevCurveCount = allCurveDefinitionsFromSelection().size(); m_prevCurveSetCount = allCurveSetDefinitionsFromSelections().size(); } @@ -776,35 +751,6 @@ void RiuSummaryVectorSelectionUi::fieldChangedByUi( const caf::PdmFieldHandle* c const QVariant& oldValue, const QVariant& newValue ) { - if ( changedField == &m_selectedSources ) - { - caf::PdmObject* objectAdded = nullptr; - for ( caf::PdmObject* selectedObject : m_selectedSources() ) - { - auto it = std::find( m_previouslySelectedSources.begin(), m_previouslySelectedSources.end(), selectedObject ); - if ( it == m_previouslySelectedSources.end() ) - { - objectAdded = selectedObject; - handleAddedSource( objectAdded ); - break; - } - } - if ( !objectAdded ) - { - caf::PdmObject* objectRemoved = nullptr; - for ( caf::PdmObject* previouslySelectedObject : m_previouslySelectedSources ) - { - auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), previouslySelectedObject ); - if ( it == m_selectedSources.end() ) - { - objectRemoved = previouslySelectedObject; - handleRemovedSource( objectRemoved ); - break; - } - } - } - m_previouslySelectedSources = m_selectedSources.ptrReferencedObjects(); - } if ( changedField != &m_selectedSources && changedField != &m_selectedSummaryCategories && changedField != &m_currentSummaryCategory ) { @@ -1391,7 +1337,6 @@ void RiuSummaryVectorSelectionUi::defineEditorAttribute( const caf::PdmFieldHand void RiuSummaryVectorSelectionUi::resetAllFields() { m_selectedSources.clear(); - m_previouslySelectedSources.clear(); m_selectedSummaryCategories = std::vector>(); // clear all state in fields @@ -1627,91 +1572,3 @@ void RiuSummaryVectorSelectionUi::appendOptionItemsForSubCategoriesAndVectors( Q } } } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuSummaryVectorSelectionUi::handleAddedSource( SummarySource* sourceAdded ) -{ - CAF_ASSERT( sourceAdded ); - auto caseCollection = dynamic_cast( sourceAdded ); - if ( caseCollection && m_showIndividualEnsembleCases ) - { - // Select all children - for ( auto summaryCase : caseCollection->allSummaryCases() ) - { - auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), summaryCase ); - if ( it == m_selectedSources.end() ) - { - m_selectedSources.push_back( summaryCase ); - } - } - } - else - { - auto summaryCase = dynamic_cast( sourceAdded ); - if ( summaryCase ) - { - auto caseCollection = summaryCase->ensemble(); - if ( caseCollection ) - { - auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), caseCollection ); - if ( it == m_selectedSources.end() ) - { - // Check if all children have been selected. - bool allChildrenSelected = true; - for ( auto summaryChild : caseCollection->allSummaryCases() ) - { - auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), summaryChild ); - if ( it == m_selectedSources.end() ) - { - allChildrenSelected = false; - break; - } - } - if ( allChildrenSelected ) // Add collection if all children have been selected - { - m_selectedSources.push_back( caseCollection ); - } - } - } - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuSummaryVectorSelectionUi::handleRemovedSource( SummarySource* sourceRemoved ) -{ - CAF_ASSERT( sourceRemoved ); - auto caseCollection = dynamic_cast( sourceRemoved ); - if ( caseCollection ) - { - // Select all children - for ( auto summaryCase : caseCollection->allSummaryCases() ) - { - auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), summaryCase ); - if ( it != m_selectedSources.end() ) - { - m_selectedSources.removePtr( *it ); - } - } - } - else - { - auto summaryCase = dynamic_cast( sourceRemoved ); - if ( summaryCase ) - { - auto caseCollection = summaryCase->ensemble(); - if ( caseCollection ) - { - auto it = std::find( m_selectedSources.begin(), m_selectedSources.end(), caseCollection ); - if ( it != m_selectedSources.end() ) - { - m_selectedSources.removePtr( *it ); - } - } - } - } -} diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h index cbd21afb53..69abdf5665 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h @@ -118,12 +118,8 @@ class RiuSummaryVectorSelectionUi : public caf::PdmObject void appendOptionItemsForSubCategoriesAndVectors( QList& options, SummaryIdentifierAndField* identifierAndField ) const; - void handleAddedSource( SummarySource* sourceAdded ); - void handleRemovedSource( SummarySource* sourceRemoved ); - private: caf::PdmPtrArrayField m_selectedSources; - std::vector m_previouslySelectedSources; caf::PdmField>> m_selectedSummaryCategories; caf::PdmField> m_currentSummaryCategory; From ca9b209e9b3c2e939712f553dc1c6bfba11b4300 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 3 May 2022 08:55:31 +0200 Subject: [PATCH 264/406] #8864 Fix no data issue for Analysis Plot When RifMultipleSummaryReaders was introduced, no summary data was available to Analysis plots. Fix this by always return true in RifSummaryReaderInterface::hasAddress for a default address object --- ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp index e0a6d57a3a..326fbd0917 100644 --- a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp +++ b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp @@ -54,6 +54,9 @@ RifEclipseSummaryAddress RifSummaryReaderInterface::errorAddress( const RifEclip //-------------------------------------------------------------------------------------------------- bool RifSummaryReaderInterface::hasAddress( const RifEclipseSummaryAddress& resultAddress ) const { + static const RifEclipseSummaryAddress defaultAdr = RifEclipseSummaryAddress(); + if ( resultAddress == defaultAdr ) return true; + for ( const RifEclipseSummaryAddress& summaryAddress : m_allResultAddresses ) { if ( summaryAddress == resultAddress ) From 3de8010c2bc111cbefab71a84249f010b45aa20d Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Tue, 3 May 2022 11:30:09 +0200 Subject: [PATCH 265/406] Source stepping and toolbar updates (#8866) * Move layout options to separate toolbar * Enable stepping on quantities, remove special history curve stepping for now * Allow stepping ensembles and cases * Add step next/prev and add new sub plot --- ApplicationExeCode/Resources/AppendNext.png | Bin 0 -> 1004 bytes ApplicationExeCode/Resources/AppendNext.svg | 74 ++++ ApplicationExeCode/Resources/AppendPrev.png | Bin 0 -> 965 bytes ApplicationExeCode/Resources/AppendPrev.svg | 63 +++ ApplicationExeCode/Resources/ResInsight.qrc | 4 + ApplicationLibCode/Application/RiaDefines.h | 9 +- .../Tools/RiaSummaryAddressAnalyzer.cpp | 9 +- .../RimDataSourceSteppingTools.cpp | 22 + .../RimDataSourceSteppingTools.h | 3 + .../ProjectDataModel/RimMultiPlot.cpp | 10 +- .../ProjectDataModel/RimMultiPlot.h | 1 + .../Summary/RimSummaryMultiPlot.cpp | 117 ++++- .../Summary/RimSummaryMultiPlot.h | 8 + .../Summary/RimSummaryNameHelper.cpp | 2 +- .../Summary/RimSummaryPlot.cpp | 8 + .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 + .../Summary/RimSummaryPlotSourceStepping.cpp | 404 +++++++++++++++--- .../Summary/RimSummaryPlotSourceStepping.h | 13 +- .../UserInterface/RiuMultiPlotBook.cpp | 19 + .../UserInterface/RiuMultiPlotBook.h | 3 + .../UserInterface/RiuMultiPlotPage.cpp | 15 +- .../UserInterface/RiuPlotMainWindow.cpp | 25 +- .../UserInterface/RiuPlotMainWindow.h | 1 + .../RiuSummaryQuantityNameInfoProvider.cpp | 7 + 24 files changed, 723 insertions(+), 96 deletions(-) create mode 100644 ApplicationExeCode/Resources/AppendNext.png create mode 100644 ApplicationExeCode/Resources/AppendNext.svg create mode 100644 ApplicationExeCode/Resources/AppendPrev.png create mode 100644 ApplicationExeCode/Resources/AppendPrev.svg diff --git a/ApplicationExeCode/Resources/AppendNext.png b/ApplicationExeCode/Resources/AppendNext.png new file mode 100644 index 0000000000000000000000000000000000000000..1073b89a232da0ed30f7b5e9c6975aedbb54f950 GIT binary patch literal 1004 zcmVOV8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H119?eA zK~z|U)tEhO8)X>Bf6vuw)iQKILV}s0BN7Y@2;>4%DPrjm#K%w&P{9I2TaYM{fieWE z3R2a;!T=K`f`JJIkG4Pwtch5b~ zPuBU~zh5~vuWzE9;J=J;YcVg^ww`u6ZB7E6e?iFzQQnCX2XIaw6c2}|$1P=q;P2VX zt8tedfSbPJEU-E@DN~dqg}cO!yDa^KZbLP@-rfVqdaL( zD;ZJTJr$-#xhGN{U^34v@Iz)RLqg&4!i023xhGa05zU1>mf6aTO16o{7}m#fwUiYF$Z`2iUI6@A-}Dy0;RU)lD#x zKYdUXu4bS{TU#>^{fGSj_w_@AuVqud=|%sqpS7nZMnuUESziuB4q8MQZt(2?=m`!lYKw zu<9;kT9BehEe}wbDsKV_N|LpFKf)B|!! zl~3cYUvK}i=xb-Be@Lc`yhueh*~v3O@6XJ?E4P>1Z+--TUeI1DU!Q#*7~J_19z?k_ zq3!3u_rnTOEmBb&pVK!KUfa?=a$lX-c?ji5QcDU9ecUoXHhtP1-eObcAGWV<3v2QN znLlA)-4@p5;h)T}A#`9eWLX9o|j)cDY5-#DziZ8kG`pDft!8Hd$xe%$=8 a<^KR-KS2{&uxMof0000 + + +First Aid + + + diff --git a/ApplicationExeCode/Resources/AppendPrev.png b/ApplicationExeCode/Resources/AppendPrev.png new file mode 100644 index 0000000000000000000000000000000000000000..33d26afaf1a1415e5e7be29020d021be7b3285f7 GIT binary patch literal 965 zcmV;$13LVPP)drR!C_fRRhs#ih?omBBj+sd+0}E!=GtvEkIDNj;cgln4vR?mQlhO$+m}^Rb&I^>>`- zdH(Nj-^{$TyNXIO$o#Y7E!V0IS`xhn>lGn=lCM7 zJU7g^f-K>k_2OS|v}C)Jzb*f8)3M2>$v3FLNiwXum17Yeos&le1`GBoLa`tCIYQiC zuVOs6gkl<~0x)%Ts>W*B7E7)Jk%iMa*$W)L^IE;Nvt22pEGJN;&`d_O7P4DHb;7Ez z+SwW<+l@%VE4{ob(Bo9ANwl<@y1FV#z7wH^GdZbM!lYYWDXr_0?QLQ6-3TqbEQ||m z_v)!O8@E~J1GQn-a3a*3Y520V8ATR=nme!C_6Cdj>v#2T*!iEnyw-by;)Y<*0gU(< zO;BLbtsLqcHj89slPrMN37TuWHecS8e*W*y>^?QaBpTZ%++cxsWBfjxo|WeWjs=-f zkj;E6TRvbIf(eT#r8!IRTd6Id;&i|nM*<0t&2t=hHq1gcj6d9TF!CF)WZ|JJQZ0%P z!Y-tswrBgP*Tc^LN6Es8Rn7qIQ5H*CEr%_mE)^xCq*G#OPIibQ9c3Yar1_xkYJDwr z_15%Pu1zUcyfR99c+&H7LBY!b{oEH-9R0LUT?{qr*DyLK-6*aS@6V|lYisQO{GeJ7 zI_NL)?=cqlSH(xFk_?6!^xWamob)4n9nQ&@KW#^c98+VE@KvctAwipt6YJl3$pKq-xP?eJJmj)?G0 zd7OOt!?fx6=mqt=SJUks&di8~@Jac-Txl$5-u7#{Eu4RdQv#jkb@Jup@T_<`Xn>*b zq)CMF$~bwFFf>zM4I03(cppmmXR$II8k?0D-HK}LvOF$DegqN~l=9=3l;WvOpDJuF nXesg;_m(Wc6U#QQI2HZ@9XrrwY9e;U00000NkvXXu0mjf9evPu literal 0 HcmV?d00001 diff --git a/ApplicationExeCode/Resources/AppendPrev.svg b/ApplicationExeCode/Resources/AppendPrev.svg new file mode 100644 index 0000000000..2aa05757cd --- /dev/null +++ b/ApplicationExeCode/Resources/AppendPrev.svg @@ -0,0 +1,63 @@ + + + +First Aid + + + diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index 3006ecae82..7f4e7fa6cd 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -259,6 +259,10 @@ well-log-plot.svg window-management.svg DisableZoom.png + AppendNext.svg + AppendPrev.svg + AppendNext.png + AppendPrev.png fs_CellFace.glsl diff --git a/ApplicationLibCode/Application/RiaDefines.h b/ApplicationLibCode/Application/RiaDefines.h index 37333eb608..e52b34965a 100644 --- a/ApplicationLibCode/Application/RiaDefines.h +++ b/ApplicationLibCode/Application/RiaDefines.h @@ -206,10 +206,11 @@ enum class RowCount enum class MultiPlotPageUpdateType : uint32_t { - NONE = 0b0000, - LEGEND = 0b0001, - PLOT = 0b0010, - ALL = 0b0011 + NONE = 0b00000000, + LEGEND = 0b00000001, + PLOT = 0b00000010, + TITLE = 0b00000100, + ALL = 0b00000111 }; constexpr enum MultiPlotPageUpdateType operator|( const enum MultiPlotPageUpdateType selfValue, diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp index ede489109d..0262ccd157 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp @@ -88,14 +88,9 @@ std::set RiaSummaryAddressAnalyzer::quantityNamesNoHistory() const //-------------------------------------------------------------------------------------------------- std::string RiaSummaryAddressAnalyzer::quantityNameForTitle() const { - if ( quantityNamesWithHistory().size() == 1 && quantityNamesNoHistory().empty() ) + if ( quantities().size() == 1 ) { - return *quantityNamesWithHistory().begin(); - } - - if ( quantityNamesNoHistory().size() == 1 && quantityNamesWithHistory().empty() ) - { - return *quantityNamesNoHistory().begin(); + return *quantities().begin(); } return {}; diff --git a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp index dfe9c762e6..73ff2ed466 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp @@ -186,3 +186,25 @@ bool RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( cons return false; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimDataSourceSteppingTools::updateQuantityIfMatching( const QVariant& oldValue, + const QVariant& newValue, + RifEclipseSummaryAddress* adr ) +{ + if ( !adr ) return false; + + std::string oldString = oldValue.toString().toStdString(); + std::string newString = newValue.toString().toStdString(); + + if ( adr->quantityName() == oldString ) + { + adr->setQuantityName( newString ); + + return true; + } + + return false; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h index be18ab2ca9..3bb01edb0b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h +++ b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h @@ -41,4 +41,7 @@ class RimDataSourceSteppingTools static bool updateHistoryAndSummaryQuantityIfMatching( const QVariant& oldValue, const QVariant& newValue, RifEclipseSummaryAddress* adr ); + + static bool + updateQuantityIfMatching( const QVariant& oldValue, const QVariant& newValue, RifEclipseSummaryAddress* adr ); }; diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 7912416814..f86f3dd530 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -898,7 +898,15 @@ bool RimMultiPlot::isMouseCursorInsidePlot() //-------------------------------------------------------------------------------------------------- std::vector RimMultiPlot::fieldsToShowInToolbar() { - return { &m_pagePreviewMode, &m_columnCount, &m_rowsPerPage }; + return {}; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimMultiPlot::fieldsToShowInLayoutToolbar() +{ + return { &m_columnCount, &m_rowsPerPage, &m_pagePreviewMode }; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 93218b3d41..92b77684e1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -106,6 +106,7 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection fieldsToShowInToolbar(); + virtual std::vector fieldsToShowInLayoutToolbar(); bool isValid() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index b784efda33..0c486cfb3a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -28,6 +28,8 @@ #include "PlotBuilderCommands/RicAppendSummaryPlotsForSummaryCasesFeature.h" #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" + #include "RifEclEclipseSummary.h" #include "RifEclipseRftAddress.h" #include "RifEclipseSummaryAddress.h" @@ -50,6 +52,7 @@ #include "RimSummaryPlotSourceStepping.h" #include "RimSummaryTimeAxisProperties.h" +#include "RiuPlotMainWindowTools.h" #include "RiuSummaryMultiPlotBook.h" #include "RiuSummaryVectorSelectionUi.h" @@ -118,6 +121,16 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() m_disableWheelZoom.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_disableWheelZoom.uiCapability()->setUiIconFromResourceString( ":/DisableZoom.png" ); + CAF_PDM_InitField( &m_appendNextPlot, "AppendNextPlot", false, "", "", "Step Next and Add to New Plot" ); + m_appendNextPlot.xmlCapability()->disableIO(); + m_appendNextPlot.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + m_appendNextPlot.uiCapability()->setUiIconFromResourceString( ":/AppendNext.png" ); + + CAF_PDM_InitField( &m_appendPrevPlot, "AppendPrevPlot", false, "", "", "Step Previous and Add to New Plot" ); + m_appendPrevPlot.xmlCapability()->disableIO(); + m_appendPrevPlot.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + m_appendPrevPlot.uiCapability()->setUiIconFromResourceString( ":/AppendPrev.png" ); + CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" ); CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", false, "Auto Adjust Appearance" ); @@ -383,6 +396,18 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi m_createPlotDuplicate = false; duplicate(); } + else if ( changedField == &m_appendNextPlot ) + { + m_appendNextPlot = false; + int stepDirection = 1; + appendSubPlotByStepping( stepDirection ); + } + else if ( changedField == &m_appendPrevPlot ) + { + m_appendPrevPlot = false; + int stepDirection = -1; + appendSubPlotByStepping( stepDirection ); + } else if ( changedField == &m_autoAdjustAppearance ) { checkAndApplyAutoAppearance(); @@ -413,13 +438,16 @@ void RimSummaryMultiPlot::updatePlotWindowTitle() { auto subPlotNameHelper = plot->plotTitleHelper(); - // Disable auto plot, as this is required to be able to include the information in the multi plot title + // Disable auto plot title, as this is required to be able to include the information in the multi plot title plot->enableAutoPlotTitle( false ); auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper ); + plot->setPlotTitleVisible( true ); plot->setDescription( plotName ); plot->updatePlotTitle(); } + + if ( !m_viewer.isNull() ) m_viewer->scheduleTitleUpdate(); } } @@ -495,6 +523,9 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() toolBarFields.insert( std::end( toolBarFields ), std::begin( fields ), std::end( fields ) ); } + toolBarFields.push_back( &m_appendPrevPlot ); + toolBarFields.push_back( &m_appendNextPlot ); + auto multiFields = RimMultiPlot::fieldsToShowInToolbar(); toolBarFields.insert( std::end( toolBarFields ), std::begin( multiFields ), std::end( multiFields ) ); @@ -570,6 +601,7 @@ void RimSummaryMultiPlot::initAfterRead() void RimSummaryMultiPlot::onLoadDataAndUpdate() { RimMultiPlot::onLoadDataAndUpdate(); + updatePlotWindowTitle(); checkAndApplyAutoAppearance(); } @@ -978,3 +1010,86 @@ QWidget* RimSummaryMultiPlot::createViewWidget( QWidget* mainWindowParent ) return m_viewer; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::appendSubPlotByStepping( int direction ) +{ + if ( summaryPlots().empty() ) return; + + auto newPlots = RicSummaryPlotBuilder::duplicatePlots( { summaryPlots().back() } ); + if ( newPlots.empty() ) return; + + RimSummaryPlot* newPlot = dynamic_cast( newPlots[0] ); + if ( newPlot == nullptr ) return; + + if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::SUMMARY_CASE ) + { + newPlot->resolveReferencesRecursively(); + + RimSummaryCase* newCase = m_sourceStepping()->stepCase( direction ); + for ( auto curve : newPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) ) + { + curve->setSummaryCaseX( newCase ); + curve->setSummaryCaseY( newCase ); + } + } + else if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::ENSEMBLE ) + { + newPlot->resolveReferencesRecursively(); + + RimSummaryCaseCollection* newEnsemble = m_sourceStepping()->stepEnsemble( direction ); + for ( auto curveSet : newPlot->curveSets() ) + { + curveSet->setSummaryCaseCollection( newEnsemble ); + } + } + else + { + auto mods = RimSummaryAddressModifier::createAddressModifiersForPlot( newPlot ); + for ( auto& mod : mods ) + { + auto modifiedAdr = m_sourceStepping()->stepAddress( mod.address(), direction ); + mod.setAddress( modifiedAdr ); + } + } + + addPlot( newPlot ); + + newPlot->resolveReferencesRecursively(); + newPlot->loadDataAndUpdate(); + + updatePlotWindowTitle(); + updateConnectedEditors(); + + RiuPlotMainWindowTools::selectAsCurrentItem( newPlot, true ); + + updateSourceStepper(); + RiuPlotMainWindowTools::refreshToolbars(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::updateSourceStepper() +{ + if ( summaryPlots().empty() ) return; + + RimSummaryPlot* plot = summaryPlots().back(); + + auto sourceStepper = plot->sourceStepper(); + if ( sourceStepper == nullptr ) return; + + m_sourceStepping->syncWithStepper( sourceStepper ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::keepVisiblePageAfterUpdate( bool keepPage ) +{ + if ( !m_viewer ) return; + + if ( keepPage ) m_viewer->keepCurrentPageAfterUpdate(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index fc54b4b3de..081ce11015 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -102,6 +102,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void checkAndApplyAutoAppearance(); + void keepVisiblePageAfterUpdate( bool keepPage ); + protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override; @@ -118,9 +120,12 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void updatePlotWindowTitle() override; void computeAggregatedAxisRange(); + void updateSourceStepper(); void duplicate(); + void appendSubPlotByStepping( int direction ); + void analyzePlotsAndAdjustAppearanceSettings(); void onSubPlotChanged( const caf::SignalEmitter* emitter ); @@ -134,6 +139,9 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep caf::PdmField m_linkSubPlotAxes; caf::PdmField m_autoAdjustAppearance; + caf::PdmField m_appendNextPlot; + caf::PdmField m_appendPrevPlot; + caf::PdmField> m_axisRangeAggregation; caf::PdmChildField m_sourceStepping; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp index 949f5ae63f..500fd12187 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp @@ -79,7 +79,7 @@ QString RimSummaryNameHelper::aggregatedPlotTitle( const RimSummaryNameHelper& o } auto quantity = this->titleQuantity(); - if ( !other.isPlotDisplayingSingleQuantity() && !quantity.empty() ) + if ( ( other.titleQuantity() != this->titleQuantity() ) && ( !quantity.empty() ) ) { if ( !title.isEmpty() ) title += ", "; title += QString::fromStdString( diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 918088495f..dffd3f1c9b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2751,3 +2751,11 @@ void RimSummaryPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childAr } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryPlotSourceStepping* RimSummaryPlot::sourceStepper() +{ + return m_sourceStepping(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 314571b538..a3d9b4106c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -204,6 +204,8 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping std::vector visibleCurvesForLegend() override; + RimSummaryPlotSourceStepping* sourceStepper(); + public: // RimViewWindow overrides void deleteViewWidget() override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 699f545788..0688f2d200 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -46,6 +46,11 @@ #include "cafPdmUiListEditor.h" #include "cafPdmUiToolBarEditor.h" +#include + +#include +#include + namespace caf { template <> @@ -58,6 +63,7 @@ void AppEnum::setUp() addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::GROUP, "GROUP", "Group" ); addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::REGION, "REGION", "Region" ); addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::BLOCK, "BLOCK", "Block" ); + addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::AQUIFER, "AQUIFER", "Aquifer" ); setDefault( RimSummaryPlotSourceStepping::SourceSteppingDimension::QUANTITY ); } } // namespace caf @@ -228,58 +234,7 @@ QList { if ( fieldNeedingOptions == &m_quantity ) { - RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_FIELD; - - auto visibleCurveAddresses = addressesForCurvesInPlot(); - if ( !visibleCurveAddresses.empty() ) - { - category = visibleCurveAddresses.begin()->category(); - } - - std::map displayAndValueStrings; - - { - RiaSummaryAddressAnalyzer quantityAnalyzer; - - auto subset = RiaSummaryAddressAnalyzer::addressesForCategory( addresses, category ); - quantityAnalyzer.appendAddresses( subset ); - - RiaSummaryAddressAnalyzer analyzerForVisibleCurves; - analyzerForVisibleCurves.appendAddresses( visibleCurveAddresses ); - - if ( analyzerForVisibleCurves.quantityNamesWithHistory().empty() ) - { - auto quantities = quantityAnalyzer.quantities(); - for ( const auto& s : quantities ) - { - QString valueString = QString::fromStdString( s ); - - displayAndValueStrings[valueString] = valueString; - } - } - else - { - // The plot displays a mix of simulated and observed vectors - // Create a combined item for source stepping - - auto quantitiesWithHistory = quantityAnalyzer.quantityNamesWithHistory(); - for ( const auto& s : quantitiesWithHistory ) - { - QString valueString = QString::fromStdString( s ); - QString displayString = valueString + " (H)"; - - displayAndValueStrings[displayString] = valueString; - } - - auto quantitiesNoHistory = quantityAnalyzer.quantityNamesNoHistory(); - for ( const auto& s : quantitiesNoHistory ) - { - QString valueString = QString::fromStdString( s ); - - displayAndValueStrings[valueString] = valueString; - } - } - } + std::map displayAndValueStrings = optionsForQuantity( addresses ); for ( const auto& displayAndValue : displayAndValueStrings ) { @@ -460,15 +415,15 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* if ( isYAxisStepping() ) { auto adr = curve->summaryAddressY(); - RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr ); - curve->setSummaryAddressY( adr ); + if ( RimDataSourceSteppingTools::updateQuantityIfMatching( oldValue, newValue, &adr ) ) + curve->setSummaryAddressY( adr ); } if ( isXAxisStepping() ) { auto adr = curve->summaryAddressX(); - RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr ); - curve->setSummaryAddressX( adr ); + if ( RimDataSourceSteppingTools::updateQuantityIfMatching( oldValue, newValue, &adr ) ) + curve->setSummaryAddressX( adr ); } curve->setDefaultCurveAppearance(); @@ -479,14 +434,15 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* for ( auto curveSet : dataSourceSteppingObject()->curveSets() ) { auto adr = curveSet->summaryAddress(); - RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( oldValue, newValue, &adr ); - curveSet->setSummaryAddress( adr ); + if ( RimDataSourceSteppingTools::updateQuantityIfMatching( oldValue, newValue, &adr ) ) + curveSet->setSummaryAddress( adr ); } } - + m_quantity.uiCapability()->updateConnectedEditors(); triggerLoadDataAndUpdate = true; } + if ( changedField != &m_quantity ) { RifEclipseSummaryAddress::SummaryVarCategory summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_INVALID; if ( changedField == &m_wellName ) @@ -555,17 +511,21 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* { RimSummaryPlot* summaryPlot = nullptr; this->firstAncestorOrThisOfType( summaryPlot ); - if ( summaryPlot ) - { - summaryPlot->updatePlotTitle(); - summaryPlot->loadDataAndUpdate(); - summaryPlot->updateConnectedEditors(); - } RimSummaryMultiPlot* summaryMultiPlot = dynamic_cast( m_objectForSourceStepping.p() ); if ( summaryMultiPlot ) { + summaryMultiPlot->keepVisiblePageAfterUpdate( true ); summaryMultiPlot->loadDataAndUpdate(); + RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); + mainPlotWindow->updateMultiPlotToolBar(); + } + else + { + summaryPlot->updatePlotTitle(); + summaryPlot->loadDataAndUpdate(); + summaryPlot->updateConnectedEditors(); + summaryPlot->curvesChanged.send(); } RimEnsembleCurveSetCollection* ensembleCurveColl = nullptr; @@ -622,12 +582,6 @@ caf::PdmValueField* RimSummaryPlotSourceStepping::fieldToModify() case SourceSteppingDimension::BLOCK: return &m_cellBlock; - case SourceSteppingDimension::SEGMENT: - return &m_segment; - - case SourceSteppingDimension::COMPLETION: - return &m_completion; - case SourceSteppingDimension::AQUIFER: return &m_aquifer; @@ -1024,3 +978,311 @@ std::vector RimSummaryPlotSourceStepping::toolbarFieldsFor return fields; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSummaryAddress addr, int direction ) +{ + auto addresses = adressesForSourceStepping(); + RiaSummaryAddressAnalyzer analyzer; + analyzer.appendAddresses( addresses ); + + switch ( m_stepDimension() ) + { + case SourceSteppingDimension::WELL: + { + auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_WELL, "" ); + auto& curName = addr.wellName(); + auto found = std::find( ids.begin(), ids.end(), QString::fromStdString( curName ) ); + if ( found != ids.end() ) + { + if ( direction > 0 ) + { + found++; + } + else + { + if ( found != ids.begin() ) found--; + } + if ( found != ids.end() ) addr.setWellName( ( *found ).toStdString() ); + } + } + break; + + case SourceSteppingDimension::GROUP: + { + auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_GROUP, "" ); + auto& curName = addr.groupName(); + auto found = std::find( ids.begin(), ids.end(), QString::fromStdString( curName ) ); + if ( found != ids.end() ) + { + if ( direction > 0 ) + { + found++; + } + else + { + if ( found != ids.begin() ) found--; + } + if ( found != ids.end() ) addr.setGroupName( ( *found ).toStdString() ); + } + } + break; + + case SourceSteppingDimension::REGION: + { + auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_REGION, "" ); + int curRegion = addr.regionNumber(); + auto found = std::find( ids.begin(), ids.end(), curRegion ); + if ( found != ids.end() ) + { + if ( direction > 0 ) + { + found++; + } + else + { + if ( found != ids.begin() ) found--; + } + if ( found != ids.end() ) addr.setRegion( ( *found ).toInt() ); + } + } + break; + + case SourceSteppingDimension::QUANTITY: + { + auto options = optionsForQuantity( addresses ); + + std::vector values; + for ( auto it = options.begin(); it != options.end(); it++ ) + { + values.push_back( it->second ); + } + + QString qName = QString::fromStdString( addr.quantityName() ); + auto found = std::find( values.begin(), values.end(), qName ); + if ( found != values.end() ) + { + if ( direction > 0 ) + { + found++; + } + else + { + if ( found != values.begin() ) found--; + } + if ( found != values.end() ) addr.setQuantityName( ( *found ).toStdString() ); + } + } + break; + + case SourceSteppingDimension::BLOCK: + { + auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_BLOCK, "" ); + auto curName = addr.blockAsString(); + auto found = std::find( ids.begin(), ids.end(), QString::fromStdString( curName ) ); + if ( found != ids.end() ) + { + if ( direction > 0 ) + { + found++; + } + else + { + if ( found != ids.begin() ) found--; + } + if ( found != ids.end() ) + { + addr.setCellIjk( ( *found ).toStdString() ); + } + } + } + break; + + case SourceSteppingDimension::AQUIFER: + { + auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_AQUIFER, "" ); + int curRegion = addr.aquiferNumber(); + auto found = std::find( ids.begin(), ids.end(), curRegion ); + if ( found != ids.end() ) + { + if ( direction > 0 ) + { + found++; + } + else + { + if ( found != ids.begin() ) found--; + } + if ( found != ids.end() ) addr.setAquiferNumber( ( *found ).toInt() ); + } + } + break; + + default: + break; + } + return addr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotSourceStepping::syncWithStepper( RimSummaryPlotSourceStepping* other ) +{ + switch ( m_stepDimension() ) + { + case SourceSteppingDimension::SUMMARY_CASE: + m_summaryCase = other->m_summaryCase(); + break; + + case SourceSteppingDimension::ENSEMBLE: + m_ensemble = other->m_ensemble(); + break; + + case SourceSteppingDimension::WELL: + m_wellName = other->m_wellName(); + break; + + case SourceSteppingDimension::GROUP: + m_groupName = other->m_groupName(); + break; + + case SourceSteppingDimension::REGION: + m_region = other->m_region(); + break; + + case SourceSteppingDimension::QUANTITY: + m_quantity = other->m_quantity(); + break; + + case SourceSteppingDimension::BLOCK: + m_cellBlock = other->m_cellBlock(); + break; + + case SourceSteppingDimension::AQUIFER: + m_aquifer = other->m_aquifer(); + break; + + default: + break; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::map RimSummaryPlotSourceStepping::optionsForQuantity( std::set addresses ) +{ + RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_FIELD; + + auto visibleCurveAddresses = addressesForCurvesInPlot(); + if ( !visibleCurveAddresses.empty() ) + { + category = visibleCurveAddresses.begin()->category(); + } + + std::map displayAndValueStrings; + + { + RiaSummaryAddressAnalyzer quantityAnalyzer; + + auto subset = RiaSummaryAddressAnalyzer::addressesForCategory( addresses, category ); + quantityAnalyzer.appendAddresses( subset ); + + RiaSummaryAddressAnalyzer analyzerForVisibleCurves; + analyzerForVisibleCurves.appendAddresses( visibleCurveAddresses ); + + auto quantities = quantityAnalyzer.quantities(); + for ( const auto& s : quantities ) + { + QString valueString = QString::fromStdString( s ); + + displayAndValueStrings[valueString] = valueString; + } + } + + return displayAndValueStrings; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryPlotSourceStepping::SourceSteppingDimension RimSummaryPlotSourceStepping::stepDimension() const +{ + return m_stepDimension(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCase* RimSummaryPlotSourceStepping::stepCase( int direction ) +{ + std::vector cases; + + auto summaryCases = RimSummaryPlotSourceStepping::summaryCasesForSourceStepping(); + for ( auto sumCase : summaryCases ) + { + if ( sumCase->ensemble() ) + { + if ( m_includeEnsembleCasesForCaseStepping() ) + { + cases.push_back( sumCase ); + } + } + else + { + cases.push_back( sumCase ); + } + } + + auto found = std::find( cases.begin(), cases.end(), m_summaryCase() ); + if ( found != cases.end() ) + { + if ( direction > 0 ) + { + found++; + } + else + { + if ( found != cases.begin() ) found--; + } + if ( found != cases.end() ) return *found; + } + + return m_summaryCase; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCaseCollection* RimSummaryPlotSourceStepping::stepEnsemble( int direction ) +{ + std::vector ensembles; + + RimProject* proj = RimProject::current(); + for ( auto ensemble : proj->summaryGroups() ) + { + if ( ensemble->isEnsemble() ) + { + ensembles.push_back( ensemble ); + } + } + + auto found = std::find( ensembles.begin(), ensembles.end(), m_ensemble() ); + if ( found != ensembles.end() ) + { + if ( direction > 0 ) + { + found++; + } + else + { + if ( found != ensembles.begin() ) found--; + } + if ( found != ensembles.end() ) return *found; + } + + return m_ensemble; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index faab5eb4ff..fdff19ac21 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -27,6 +27,7 @@ #include +#include #include class RimSummaryCase; @@ -52,8 +53,6 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject REGION, QUANTITY, BLOCK, - SEGMENT, - COMPLETION, AQUIFER }; @@ -68,6 +67,14 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject std::vector fieldsToShowInToolbar(); + RifEclipseSummaryAddress stepAddress( RifEclipseSummaryAddress addr, int direction ); + RimSummaryCase* stepCase( int direction ); + RimSummaryCaseCollection* stepEnsemble( int direction ); + + void syncWithStepper( RimSummaryPlotSourceStepping* other ); + + RimSummaryPlotSourceStepping::SourceSteppingDimension stepDimension() const; + private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; @@ -101,6 +108,8 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject RimSummaryDataSourceStepping* dataSourceSteppingObject() const; + std::map optionsForQuantity( std::set addresses ); + private: caf::PdmPointer m_objectForSourceStepping; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 0c4f3f84b3..5890b38e4d 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -257,6 +257,17 @@ void RiuMultiPlotBook::setSubTitlesVisible( bool visible ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::scheduleTitleUpdate() +{ + for ( auto page : m_pages ) + { + page->scheduleUpdate( RiaDefines::MultiPlotPageUpdateType::TITLE ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -719,6 +730,14 @@ void RiuMultiPlotBook::goToLastPage() changeCurrentPage( m_pages.size() - 1 ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::keepCurrentPageAfterUpdate() +{ + m_goToPageAfterUpdate = true; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index 99708e362d..4cbfad4a06 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -69,6 +69,7 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void setTitleVisible( bool visible ); void setSubTitlesVisible( bool visible ); + void scheduleTitleUpdate(); void setTitleFontSizes( int titleFontSize, int subTitleFontSize ); void setLegendFontSize( int legendFontSize ); @@ -90,6 +91,8 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void goToPrevPage(); void goToLastPage(); + void keepCurrentPageAfterUpdate(); + protected: void contextMenuEvent( QContextMenuEvent* ) override; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 3ba10d26a9..162cde5bf4 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -573,14 +573,17 @@ void RiuMultiPlotPage::performUpdate( RiaDefines::MultiPlotPageUpdateType whatTo reinsertPlotWidgets(); alignCanvasTops(); + return; } - else + + if ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::LEGEND ) == RiaDefines::MultiPlotPageUpdateType::LEGEND ) { - if ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::LEGEND ) == RiaDefines::MultiPlotPageUpdateType::LEGEND ) - { - refreshLegends(); - alignCanvasTops(); - } + refreshLegends(); + alignCanvasTops(); + } + if ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::TITLE ) == RiaDefines::MultiPlotPageUpdateType::TITLE ) + { + updateSubTitles(); } } diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 2eed1333db..d7f4361d5e 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -197,6 +197,7 @@ void RiuPlotMainWindow::cleanupGuiBeforeProjectClose() m_wellLogPlotToolBarEditor->clear(); m_multiPlotToolBarEditor->clear(); + m_multiPlotLayoutToolBarEditor->clear(); setWindowTitle( "Plots - ResInsight" ); } @@ -431,6 +432,9 @@ void RiuPlotMainWindow::createToolBars() m_multiPlotToolBarEditor = std::make_unique( "Multi Plot", this ); m_multiPlotToolBarEditor->hide(); + m_multiPlotLayoutToolBarEditor = std::make_unique( "Multi Plot Layout", this ); + m_multiPlotLayoutToolBarEditor->hide(); + if ( RiaPreferences::current()->useUndoRedo() ) { QToolBar* toolbar = addToolBar( tr( "Edit" ) ); @@ -689,14 +693,29 @@ void RiuPlotMainWindow::updateMultiPlotToolBar() { std::vector toolBarFields = plotWindow->fieldsToShowInToolbar(); - m_multiPlotToolBarEditor->setFields( toolBarFields ); - m_multiPlotToolBarEditor->updateUi(); - m_multiPlotToolBarEditor->show(); + if ( toolBarFields.empty() ) + { + m_multiPlotToolBarEditor->clear(); + m_multiPlotToolBarEditor->hide(); + } + else + { + m_multiPlotToolBarEditor->setFields( toolBarFields ); + m_multiPlotToolBarEditor->updateUi(); + m_multiPlotToolBarEditor->show(); + } + + std::vector layoutFields = plotWindow->fieldsToShowInLayoutToolbar(); + m_multiPlotLayoutToolBarEditor->setFields( layoutFields ); + m_multiPlotLayoutToolBarEditor->updateUi(); + m_multiPlotLayoutToolBarEditor->show(); } else { m_multiPlotToolBarEditor->clear(); m_multiPlotToolBarEditor->hide(); + m_multiPlotLayoutToolBarEditor->clear(); + m_multiPlotLayoutToolBarEditor->hide(); } refreshToolbars(); } diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index ce3663a78d..29c94fedbc 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -134,6 +134,7 @@ private slots: std::unique_ptr m_wellLogPlotToolBarEditor; std::unique_ptr m_multiPlotToolBarEditor; + std::unique_ptr m_multiPlotLayoutToolBarEditor; std::unique_ptr m_pdmUiPropertyView; std::unique_ptr m_summaryPlotManagerView; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp index 3e538b392b..bd7b28a09c 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp @@ -67,14 +67,21 @@ RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo { // Check for custom vector naming + std::string postfix = quantity.substr( quantity.size() - 5, 5 ); std::string baseName = quantity.substr( 0, 5 ); while ( baseName.back() == '_' ) baseName.pop_back(); + bool isDifference = ( postfix == "_DIFF" ); + it = m_summaryToDescMap.find( baseName ); if ( it != m_summaryToDescMap.end() ) { + if ( isDifference ) + { + return RiuSummaryQuantityInfo( it->second.category, it->second.longName + " Difference" ); + } return it->second; } } From d3ce7a2096182b564d2948f70640b723b27df0d3 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Tue, 3 May 2022 16:29:55 +0200 Subject: [PATCH 266/406] Add support for all summary data types in data sources tree (#8873) * Add support for all summary data types in data sources tree * Use item icons for folders. --- .../RifEclipseSummaryAddress.cpp | 5 + .../Summary/RimSummaryAddressCollection.cpp | 223 ++++++++++++++++-- .../Summary/RimSummaryAddressCollection.h | 21 +- 3 files changed, 225 insertions(+), 24 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index b9131c52ca..f78ed769f0 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -565,6 +565,11 @@ std::string RifEclipseSummaryAddress::itemUiText() const text += std::to_string( this->id() ); } break; + case SUMMARY_IMPORTED: + { + text += this->quantityName(); + } + break; } return text; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index f52871587a..73160217bf 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -28,12 +28,24 @@ template <> void caf::AppEnum::setUp() { addItem( RimSummaryAddressCollection::CollectionContentType::NOT_DEFINED, "NOT_DEFINED", "Not Defined" ); - addItem( RimSummaryAddressCollection::CollectionContentType::WELL, "WELL", "Well" ); - addItem( RimSummaryAddressCollection::CollectionContentType::GROUP, "GROUP", "Group" ); - addItem( RimSummaryAddressCollection::CollectionContentType::REGION, "REGION", "Region" ); - addItem( RimSummaryAddressCollection::CollectionContentType::MISC, "MISC", "Miscellaneous" ); addItem( RimSummaryAddressCollection::CollectionContentType::FIELD, "FIELD", "Field" ); + addItem( RimSummaryAddressCollection::CollectionContentType::AQUIFER, "AQUIFER", "Aquifer" ); + addItem( RimSummaryAddressCollection::CollectionContentType::NETWORK, "NETWORK", "Network" ); + addItem( RimSummaryAddressCollection::CollectionContentType::MISC, "MISC", "Miscellaneous" ); + addItem( RimSummaryAddressCollection::CollectionContentType::REGION, "REGION", "Region" ); + addItem( RimSummaryAddressCollection::CollectionContentType::REGION_2_REGION, "REGION_2_REGION", "Region-Region" ); + addItem( RimSummaryAddressCollection::CollectionContentType::GROUP, "GROUP", "Group" ); + addItem( RimSummaryAddressCollection::CollectionContentType::WELL, "WELL", "Well" ); + addItem( RimSummaryAddressCollection::CollectionContentType::WELL_COMPLETION, "WELL_COMPLETION", "Completion" ); + addItem( RimSummaryAddressCollection::CollectionContentType::WELL_SEGMENT, "WELL_SEGMENT", "Segment" ); addItem( RimSummaryAddressCollection::CollectionContentType::BLOCK, "BLOCK", "Block" ); + addItem( RimSummaryAddressCollection::CollectionContentType::WELL_LGR, "WELL_LGR", "Lgr-Well" ); + addItem( RimSummaryAddressCollection::CollectionContentType::WELL_COMPLETION_LGR, + "WELL_COMPLETION_LGR", + "Lgr Completion" ); + addItem( RimSummaryAddressCollection::CollectionContentType::BLOCK_LGR, "BLOCK_LGR", "Lgr-Block" ); + addItem( RimSummaryAddressCollection::CollectionContentType::CALCULATED, "CALCULATED", "Calculated" ); + addItem( RimSummaryAddressCollection::CollectionContentType::IMPORTED, "IMPORTED", "Imported" ); setDefault( RimSummaryAddressCollection::CollectionContentType::NOT_DEFINED ); } @@ -64,6 +76,8 @@ RimSummaryAddressCollection::RimSummaryAddressCollection() m_ensembleId.uiCapability()->setUiHidden( true ); nameField()->uiCapability()->setUiHidden( true ); + + setUiIconFromResourceString( iconResourceText() ); } //-------------------------------------------------------------------------------------------------- @@ -119,6 +133,24 @@ void RimSummaryAddressCollection::addToSubfolder( QString folder->addAddress( address, caseId, ensembleId ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryAddressCollection::addToSubfolderTree( std::vector folders, + CollectionContentType folderType, + const RifEclipseSummaryAddress& address, + int caseId, + int ensembleId ) +{ + RimSummaryAddressCollection* thefolder = this; + for ( auto& subfoldername : folders ) + { + thefolder = thefolder->getOrCreateSubfolder( subfoldername, folderType ); + } + thefolder->setContentType( folderType ); + thefolder->addAddress( address, caseId, ensembleId ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -128,25 +160,47 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::setaddAddress( address, caseId, ensembleId ); - break; - case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_FIELD: fields->addAddress( address, caseId, ensembleId ); break; + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_AQUIFER: + aquifer->addToSubfolder( QString::number( address.aquiferNumber() ), + CollectionContentType::AQUIFER, + address, + caseId, + ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_NETWORK: + network->addAddress( address, caseId, ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_MISC: + misc->addAddress( address, caseId, ensembleId ); + break; + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_REGION: regions->addToSubfolder( QString::number( address.regionNumber() ), CollectionContentType::REGION, @@ -155,6 +209,14 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::setaddToSubfolder( QString::fromStdString( address.itemUiText() ), + CollectionContentType::REGION_2_REGION, + address, + caseId, + ensembleId ); + break; + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_GROUP: groups->addToSubfolder( QString::fromStdString( address.groupName() ), CollectionContentType::GROUP, @@ -163,6 +225,32 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::setaddToSubfolder( QString::fromStdString( address.wellName() ), + CollectionContentType::WELL, + address, + caseId, + ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_COMPLETION: + completion->addToSubfolderTree( { QString::fromStdString( address.wellName() ), + QString::fromStdString( address.blockAsString() ) }, + CollectionContentType::WELL_COMPLETION, + address, + caseId, + ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_SEGMENT: + segment->addToSubfolderTree( { QString::fromStdString( address.wellName() ), + QString::number( address.wellSegmentNumber() ) }, + CollectionContentType::WELL_SEGMENT, + address, + caseId, + ensembleId ); + break; + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_BLOCK: blocks->addToSubfolder( QString::fromStdString( address.blockAsString() ), CollectionContentType::BLOCK, @@ -171,12 +259,48 @@ void RimSummaryAddressCollection::updateFolderStructure( const std::setaddToSubfolder( QString::fromStdString( address.wellName() ), - CollectionContentType::WELL, - address, - caseId, - ensembleId ); + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_LGR: + lgrwell->addToSubfolderTree( { QString::fromStdString( address.lgrName() ), + QString::fromStdString( address.wellName() ) }, + CollectionContentType::WELL_LGR, + address, + caseId, + ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_COMPLETION_LGR: + lgrcompletion->addToSubfolderTree( { QString::fromStdString( address.lgrName() ), + QString::fromStdString( address.wellName() ), + QString::fromStdString( address.blockAsString() ) }, + CollectionContentType::WELL_COMPLETION_LGR, + address, + caseId, + ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_BLOCK_LGR: + lgrblock->addToSubfolderTree( { QString::fromStdString( address.lgrName() ), + QString::fromStdString( address.blockAsString() ) }, + CollectionContentType::BLOCK_LGR, + address, + caseId, + ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_IMPORTED: + imported->addToSubfolder( QString::fromStdString( address.itemUiText() ), + CollectionContentType::IMPORTED, + address, + caseId, + ensembleId ); + break; + + case RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_CALCULATED: + calculated->addToSubfolder( QString::fromStdString( address.itemUiText() ), + CollectionContentType::CALCULATED, + address, + caseId, + ensembleId ); break; default: @@ -243,7 +367,7 @@ void RimSummaryAddressCollection::updateUiTreeOrdering( caf::PdmUiTreeOrdering& { for ( auto& folder : m_subfolders() ) { - uiTreeOrdering.add( folder ); + if ( !folder->isEmpty() ) uiTreeOrdering.add( folder ); } for ( auto& address : m_adresses() ) @@ -258,6 +382,7 @@ void RimSummaryAddressCollection::updateUiTreeOrdering( caf::PdmUiTreeOrdering& void RimSummaryAddressCollection::setContentType( CollectionContentType content ) { m_contentType = content; + setUiIconFromResourceString( iconResourceText() ); } //-------------------------------------------------------------------------------------------------- @@ -298,7 +423,7 @@ bool RimSummaryAddressCollection::isEnsemble() const bool RimSummaryAddressCollection::isFolder() const { if ( contentType() == CollectionContentType::WELL_FOLDER || contentType() == CollectionContentType::GROUP_FOLDER || - contentType() == CollectionContentType::REGION_FOLDER || contentType() == CollectionContentType::BLOCK_FOLDER ) + contentType() == CollectionContentType::REGION_FOLDER ) { return true; } @@ -329,3 +454,57 @@ int RimSummaryAddressCollection::caseId() const { return m_caseId; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryAddressCollection::iconResourceText() const +{ + switch ( m_contentType() ) + { + case RimSummaryAddressCollection::CollectionContentType::WELL: + return ":/summary/components/images/well.svg"; + case RimSummaryAddressCollection::CollectionContentType::GROUP: + return ":/summary/components/images/group.svg"; + case RimSummaryAddressCollection::CollectionContentType::REGION: + return ":/summary/components/images/region.svg"; + case RimSummaryAddressCollection::CollectionContentType::FIELD: + return ":/summary/components/images/field.svg"; + case RimSummaryAddressCollection::CollectionContentType::MISC: + return ":/summary/components/images/misc.svg"; + case RimSummaryAddressCollection::CollectionContentType::WELL_FOLDER: + return ":/summary/components/images/well.svg"; + case RimSummaryAddressCollection::CollectionContentType::GROUP_FOLDER: + return ":/summary/components/images/group.svg"; + case RimSummaryAddressCollection::CollectionContentType::REGION_FOLDER: + return ":/summary/components/images/region.svg"; + case RimSummaryAddressCollection::CollectionContentType::BLOCK: + return ":/summary/components/images/block.svg"; + case RimSummaryAddressCollection::CollectionContentType::SUMMARY_CASE: + return ":/SummaryCase.svg"; + case RimSummaryAddressCollection::CollectionContentType::AQUIFER: + return ":/summary/components/images/aquifer.svg"; + case RimSummaryAddressCollection::CollectionContentType::NETWORK: + return ":/summary/components/images/network.svg"; + case RimSummaryAddressCollection::CollectionContentType::REGION_2_REGION: + return ":/summary/components/images/region-region.svg"; + case RimSummaryAddressCollection::CollectionContentType::WELL_COMPLETION: + return ":/summary/components/images/well-completion.svg"; + case RimSummaryAddressCollection::CollectionContentType::WELL_LGR: + return ":/summary/components/images/well.svg"; + case RimSummaryAddressCollection::CollectionContentType::WELL_COMPLETION_LGR: + return ":/summary/components/images/well-completion.svg"; + case RimSummaryAddressCollection::CollectionContentType::WELL_SEGMENT: + return ":/summary/components/images/segment.svg"; + case RimSummaryAddressCollection::CollectionContentType::BLOCK_LGR: + return ":/summary/components/images/block.svg"; + case RimSummaryAddressCollection::CollectionContentType::CALCULATED: + return ":/summary/components/images/calculated.svg"; + case RimSummaryAddressCollection::CollectionContentType::IMPORTED: + return ":/summary/components/images/others.svg"; + case RimSummaryAddressCollection::CollectionContentType::NOT_DEFINED: + default: + break; + } + return ":/Folder.png"; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h index e875e1bb50..29f0b14111 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -45,8 +45,17 @@ class RimSummaryAddressCollection : public RimNamedObject GROUP_FOLDER, REGION_FOLDER, BLOCK, - BLOCK_FOLDER, - SUMMARY_CASE + SUMMARY_CASE, + AQUIFER, + NETWORK, + REGION_2_REGION, + WELL_COMPLETION, + WELL_LGR, + WELL_COMPLETION_LGR, + WELL_SEGMENT, + BLOCK_LGR, + CALCULATED, + IMPORTED }; public: @@ -90,6 +99,14 @@ class RimSummaryAddressCollection : public RimNamedObject int caseId, int ensembleId = -1 ); + void addToSubfolderTree( std::vector folders, + CollectionContentType folderType, + const RifEclipseSummaryAddress& address, + int caseId, + int ensembleId = -1 ); + + QString iconResourceText() const; + private: caf::PdmChildArrayField m_adresses; caf::PdmChildArrayField m_subfolders; From 2c1ef661b0b2d48864d6ffa0d588feb173ff5a45 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 3 May 2022 15:59:38 +0200 Subject: [PATCH 267/406] Avoid regenerating viewer pages when just stepping curves in plots --- ApplicationLibCode/ProjectDataModel/RimMultiPlot.h | 2 +- .../ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 92b77684e1..2cae684794 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -73,6 +73,7 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection( m_objectForSourceStepping.p() ); if ( summaryMultiPlot ) { - summaryMultiPlot->keepVisiblePageAfterUpdate( true ); - summaryMultiPlot->loadDataAndUpdate(); + summaryMultiPlot->updatePlots(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); mainPlotWindow->updateMultiPlotToolBar(); } From 4ef1f73a586a6bc10f86bd15bbeed94edd25aa85 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 3 May 2022 16:45:57 +0200 Subject: [PATCH 268/406] Add delete plot comand to subplot context menu --- ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp index a1f21d2437..ef76f832f3 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp @@ -192,6 +192,9 @@ void RiuSummaryPlot::showContextMenu( QPoint pos ) } } + menuBuilder.addSeparator(); + menuBuilder << "RicDeleteSubPlotFeature"; + menuBuilder.appendToMenu( &menu ); if ( !menu.actions().empty() ) @@ -201,7 +204,7 @@ void RiuSummaryPlot::showContextMenu( QPoint pos ) // Parts of progress dialog GUI can be present after menu has closed related to // RicImportGridModelFromSummaryCurveFeature. Make sure the plot is updated, and call processEvents() to make // sure all GUI events are processed - plotWidget()->update(); + // plotWidget()->update(); QApplication::processEvents(); } } From feb1c417c5dfcbb1c64d584874d8a2efc00f4fab Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sat, 30 Apr 2022 15:18:52 +0200 Subject: [PATCH 269/406] #8859 AppFwk : Enable TableView as optional drop target A TableView can receive drag/drop data. The drop operations finds the PdmObject for a row, and delegates handling of the drop operation to this object. --- .../cafPdmCore/cafPdmObjectHandle.h | 5 ++ .../cafPdmUiTableViewEditor.cpp | 5 ++ .../cafPdmUiTableViewEditor.h | 2 + .../cafPdmUiTableViewQModel.cpp | 66 ++++++++++++++++++- .../cafPdmUiTableViewQModel.h | 11 ++++ 5 files changed, 88 insertions(+), 1 deletion(-) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h index 3811191203..92f76559e6 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h @@ -9,6 +9,8 @@ #include #include +class QMimeData; + namespace caf { class PdmObjectCapability; @@ -106,6 +108,9 @@ class PdmObjectHandle : public SignalObserver, public SignalEmitter virtual void onChildAdded( caf::PdmFieldHandle* containerForNewObject ){}; + virtual void + handleDroppedMimeData( const QMimeData* data, Qt::DropAction action, caf::PdmFieldHandle* destinationField ){}; + protected: void addField( PdmFieldHandle* field, const QString& keyword ); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp index a8135988fa..bd490f6ba1 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.cpp @@ -164,6 +164,11 @@ void PdmUiTableViewEditor::configureAndUpdateUi( const QString& uiConfigName ) QPalette myPalette( m_tableView->palette() ); myPalette.setColor( QPalette::Base, editorAttrib.baseColor ); m_tableView->setPalette( myPalette ); + + // Drop target settings + m_tableView->setAcceptDrops( editorAttrib.enableDropTarget ); + m_tableView->setDropIndicatorShown( editorAttrib.enableDropTarget ); + m_tableModelPdm->enableDropTarget( editorAttrib.enableDropTarget ); } m_tableModelPdm->setArrayFieldAndBuildEditors( childArrayFH, uiConfigName ); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h index 0d1662649a..413938ccdd 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewEditor.h @@ -92,6 +92,7 @@ class PdmUiTableViewEditorAttribute : public PdmUiEditorAttribute , minimumHeight( -1 ) , alwaysEnforceResizePolicy( false ) , resizePolicy( NO_AUTOMATIC_RESIZE ) + , enableDropTarget( false ) { QPalette myPalette; baseColor = myPalette.color( QPalette::Active, QPalette::Base ); @@ -106,6 +107,7 @@ class PdmUiTableViewEditorAttribute : public PdmUiEditorAttribute QColor baseColor; bool alwaysEnforceResizePolicy; ResizePolicy resizePolicy; + bool enableDropTarget; }; //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp index 9079dab4ec..342e7d7001 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp @@ -57,8 +57,9 @@ namespace caf //-------------------------------------------------------------------------------------------------- PdmUiTableViewQModel::PdmUiTableViewQModel( QWidget* parent ) : QAbstractTableModel( parent ) + , m_pdmList( nullptr ) + , m_dropTargetEnabled( false ) { - m_pdmList = nullptr; } //-------------------------------------------------------------------------------------------------- @@ -141,6 +142,12 @@ Qt::ItemFlags PdmUiTableViewQModel::flags( const QModelIndex& index ) const } } } + + if ( m_dropTargetEnabled ) + { + flagMask |= Qt::ItemIsDropEnabled; + } + return flagMask; } @@ -661,6 +668,63 @@ void PdmUiTableViewQModel::createPersistentPushButtonWidgets( QTableView* tableV } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiTableViewQModel::enableDropTarget( bool enable ) +{ + m_dropTargetEnabled = enable; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool PdmUiTableViewQModel::dropMimeData( const QMimeData* data, + Qt::DropAction action, + int row, + int column, + const QModelIndex& parent ) +{ + // The receiving model index is specified by the parent. Find object and field from parent, and send QMimeData to + // this object + + if ( !m_dropTargetEnabled ) return false; + + auto pdmObject = pdmObjectForRow( parent.row() ); + auto field = getField( parent ); + + if ( pdmObject ) + { + pdmObject->handleDroppedMimeData( data, action, field ); + return true; + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +Qt::DropActions PdmUiTableViewQModel::supportedDropActions() const +{ + return Qt::CopyAction | Qt::MoveAction | Qt::LinkAction; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool PdmUiTableViewQModel::canDropMimeData( const QMimeData* data, + Qt::DropAction action, + int row, + int column, + const QModelIndex& parent ) const +{ + // This function can be extended to validate incoming QMimeData and see if this data is matching with the drop + // target. For now, all data is allowed to be dropped when drop target is enabled + + return m_dropTargetEnabled; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.h index d0459eba12..ad933a4dd2 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.h @@ -100,6 +100,16 @@ class PdmUiTableViewQModel : public QAbstractTableModel bool isRepresentingBoolean( const QModelIndex& index ) const; void createPersistentPushButtonWidgets( QTableView* tableView ); + void enableDropTarget( bool enable ); + +protected: + bool dropMimeData( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent ) override; + Qt::DropActions supportedDropActions() const override; + bool canDropMimeData( const QMimeData* data, + Qt::DropAction action, + int row, + int column, + const QModelIndex& parent ) const override; private: int getFieldIndex( PdmFieldHandle* field ) const; @@ -117,6 +127,7 @@ class PdmUiTableViewQModel : public QAbstractTableModel PdmPointer m_ownerObject; PdmChildArrayFieldHandle* m_pdmList; QString m_currentConfigName; + bool m_dropTargetEnabled; std::map m_fieldEditors; std::vector m_modelColumnIndexToFieldIndex; From bb6ca0848d16561d272f424634def1e8777375eb Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sat, 30 Apr 2022 15:19:24 +0200 Subject: [PATCH 270/406] #8859 Add drop target for calculation variables --- .../RimSummaryCalculation.cpp | 9 ++++++ .../RimSummaryCalculationVariable.cpp | 29 +++++++++++++++++++ .../RimSummaryCalculationVariable.h | 4 +++ .../Summary/RimSummaryAddress.cpp | 2 +- .../Summary/RimSummaryAddress.h | 2 +- .../UserInterface/RiuDragDrop.cpp | 24 ++++++++++++--- .../UserInterface/RiuDragDrop.h | 2 ++ 7 files changed, 66 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp index 74fafdcb77..33d380f40f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp @@ -37,6 +37,7 @@ #include "RiuExpressionContextMenuManager.h" #include "cafPdmUiLineEditor.h" +#include "cafPdmUiTableViewEditor.h" #include "cafPdmUiTextEditor.h" #include @@ -465,6 +466,14 @@ void RimSummaryCalculation::defineEditorAttribute( const caf::PdmFieldHandle* fi myAttr->heightHint = -1; } } + else if ( field == &m_variables ) + { + auto* myAttr = dynamic_cast( attribute ); + if ( myAttr ) + { + myAttr->enableDropTarget = true; + } + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp index 559e002b55..9b15ebd7da 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp @@ -20,6 +20,7 @@ #include "RiaApplication.h" #include "RiaSummaryCurveDefinition.h" +#include "RiaSummaryTools.h" #include "RifEclipseSummaryAddressQMetaType.h" @@ -29,6 +30,7 @@ #include "RimSummaryCase.h" #include "RimSummaryCurve.h" +#include "RiuDragDrop.h" #include "RiuSummaryVectorSelectionDialog.h" #include "cafPdmUiPushButtonEditor.h" @@ -153,6 +155,33 @@ RimSummaryAddress* RimSummaryCalculationVariable::summaryAddress() return m_summaryAddress(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCalculationVariable::setSummaryAddress( const RimSummaryAddress& address ) +{ + m_summaryAddress()->setAddress( address.address() ); + + auto summaryCase = RiaSummaryTools::summaryCaseById( address.caseId() ); + + if ( summaryCase ) m_case = summaryCase; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCalculationVariable::handleDroppedMimeData( const QMimeData* data, + Qt::DropAction action, + caf::PdmFieldHandle* destinationField ) +{ + auto objects = RiuDragDrop::convertToObjects( data ); + if ( !objects.empty() ) + { + auto address = dynamic_cast( objects.front() ); + if ( address ) setSummaryAddress( *address ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.h b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.h index 4ab6c8c91d..3ec04bcddb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.h +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.h @@ -49,6 +49,10 @@ class RimSummaryCalculationVariable : public caf::PdmObject RimSummaryCase* summaryCase(); RimSummaryAddress* summaryAddress(); + void setSummaryAddress( const RimSummaryAddress& address ); + + void handleDroppedMimeData( const QMimeData* data, Qt::DropAction action, caf::PdmFieldHandle* destinationField ) override; + private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp index 9003c24ce4..9972780ce1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp @@ -138,7 +138,7 @@ void RimSummaryAddress::setAddress( const RifEclipseSummaryAddress& addr ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RimSummaryAddress::address() +RifEclipseSummaryAddress RimSummaryAddress::address() const { return RifEclipseSummaryAddress( m_category(), m_quantityName().toStdString(), diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h index 50ecbb2653..131225d527 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h @@ -48,7 +48,7 @@ class RimSummaryAddress : public caf::PdmObject wrapFileReaderAddress( const RifEclipseSummaryAddress& addr, int caseId = -1, int ensembleId = -1 ); void setAddress( const RifEclipseSummaryAddress& addr ); - RifEclipseSummaryAddress address(); + RifEclipseSummaryAddress address() const; void setCaseId( int caseId ); int caseId() const; diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index 9db74aaae8..670ad02979 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -808,11 +808,29 @@ bool RiuDragDrop::handleGenericDropEvent( QEvent* event, std::vector RiuDragDrop::convertToObjects( const QMimeData* mimeData ) +{ + std::vector droppedObjects; if ( mimeData ) { QString mimeType = caf::PdmUiDragDropInterface::mimeTypeForObjectReferenceList(); - auto data = mimeData->data( mimeType ); + QByteArray data = mimeData->data( mimeType ); + if ( data.isEmpty() ) return {}; QStringList objectReferences; QDataStream in( &data, QIODevice::ReadOnly ); @@ -824,9 +842,7 @@ bool RiuDragDrop::handleGenericDropEvent( QEvent* event, std::vector& droppedObjects ); + static std::vector convertToObjects( const QMimeData* mimeData ); + protected: Qt::DropActions supportedDropActions() const override; Qt::ItemFlags flags( const QModelIndex& index ) const override; From 296ddbde420216d695bbae6924dc4bc6dd92ed25 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Wed, 4 May 2022 13:11:04 +0200 Subject: [PATCH 271/406] Merge pull request #8882 from OPM/append_curves Summary Multiplot: Source Stepping append curves with performance fixes --- .../Resources/AppendNextCurve.png | Bin 0 -> 1864 bytes .../Resources/AppendNextCurve.svg | 70 ++++++++++++++++++ .../Resources/AppendPrevCurve.png | Bin 0 -> 2073 bytes .../Resources/AppendPrevCurve.svg | 69 +++++++++++++++++ ApplicationExeCode/Resources/ResInsight.qrc | 4 + .../RiaPlotWindowRedrawScheduler.cpp | 34 +++++---- .../RiaPlotWindowRedrawScheduler.h | 8 +- ...icAppendSummaryCurvesForObjectsFeature.cpp | 4 - .../RimDataSourceSteppingTools.cpp | 5 +- .../RimDataSourceSteppingTools.h | 3 +- .../ProjectDataModel/RimMultiPlot.cpp | 1 + .../ProjectDataModel/RimMultiPlot.h | 8 +- .../Summary/RimSummaryMultiPlot.cpp | 63 ++++++++++++++++ .../Summary/RimSummaryMultiPlot.h | 6 +- .../Summary/RimSummaryPlot.cpp | 48 +++++++++++- .../Summary/RimSummaryPlotSourceStepping.cpp | 17 ++++- .../Summary/RimSummaryPlotSourceStepping.h | 4 +- .../UserInterface/RiuMultiPlotBook.cpp | 63 +++++++++------- .../UserInterface/RiuMultiPlotBook.h | 6 +- .../UserInterface/RiuSummaryMultiPlotBook.cpp | 9 +-- 20 files changed, 349 insertions(+), 73 deletions(-) create mode 100644 ApplicationExeCode/Resources/AppendNextCurve.png create mode 100644 ApplicationExeCode/Resources/AppendNextCurve.svg create mode 100644 ApplicationExeCode/Resources/AppendPrevCurve.png create mode 100644 ApplicationExeCode/Resources/AppendPrevCurve.svg diff --git a/ApplicationExeCode/Resources/AppendNextCurve.png b/ApplicationExeCode/Resources/AppendNextCurve.png new file mode 100644 index 0000000000000000000000000000000000000000..46ca68fa252e907d9d32dcf4168cb698f286b5cb GIT binary patch literal 1864 zcmV-O2eg}XaRl=6c-ZTUP$LKtkvLt1(3iv zXhzd#fo}nwK(vrCl$my%fJG8ESWK}P#EkOijHefvJ<~Cu0Km8oApkUNAB@7Us$k4$ zb{NmQ3mKyzKnb%F<#8Nu)IrFo3ZTs58lwOSfUSq+W<~Igd^)atb#K-Dj?<+8?>@L? zXkhWO38duID^FH?&K#Zv;3%(*-}j5>dl4e1m=d<^S}TrQZF-W#c~KVeD3)2treJv$ zQD->-s@+~AfsW$`=x=|IVuwC~OV)i2DMU?%Fjk!@J;B?PjS9dM>%|bTGgr8xaDa;8 zkCLzz)eLl;qVr#`nzqJ!Hqg*~Z>}LhW3$^Ww8>_3nJE?Q2}&LYZci7(7LQVY_9%)RoxM*^1%pFc}VAtoxl-UDIlDJ)B0?9Aa#i;8#!|HuI zX!`dd6Hc?)xwPgX274|L@(%-0R(&f=TQ=nm2T>brPuG}|#kPLso~r)KKX#w}F7S|B$P1L=&F9E=&#+cK8#hktKuRX(X&jr0A1b3|e zHn)_|$%#*cEpC^H&j=7e6!ADP05DpcTzSfjZ1oR#=(}{%U{hG}r600j`RbhDfWy1j zi8pg`Oq*`4_lWVWN2Oax{%HN<3#qTA!&lCmwua_=Gr~>8eMI8sUrp`uy|N28^+sL8 zO>f?S09S|kQ$wZv@w}c3OB1%lY=%aMOuy>-J2Hi#Yvdr^-a`NcqSvntjKBXQOLGKB zyQ*j0%^Y}0sB2zuKRtW!Dgdz(C!_Nl02mug{^*jj+_rpDs_~J~r4Ms*&IM3HvFrKA zYD@hiR{^?KwxB6C)L4Yk>pcM2OB__ptIugLf5g)nS3{AT0w_U*;b95Y3opKXGFVZg zdX}#O!0Wk;)KmcG-1c#VVoMjsl&VES-cb9MeBd$yhT$%t37~wWf2h0pi~FTe7$3UE z>4Q(1esdQu&uO3=;m*ras#A6=GX^Aiu0X)S-cL4fM#|CiuRlvXIsrg=%>o+kTAy{0 zi0be0PxSQV3kR9AxDG&pa0$G#+a=U5yI+3J_fhB10E!%CeCF%h&DR@@4loh-O^qUu z9m6lZ1>8FAC<4I_mgEI!{QrspG>8jO0p4o;?vVv6T;I2sILa5TY)ScQbdDUvy zSmD@EU;o&9)5Gb56{GUobj?{0O;SJd0uTv}*LtshcoCqiYJRq^NGY|UKwEoO#|+Bl zRA=2kDZakWYmtC|*k0^N+aaOxNN;yc8w+K1%%Eujg$@-q%Cn^IXTvy74qZ8WR*0$R z2dgw0i+Dqqy9$9z3mAqqfYWdY3jIpsC%{U8;Elmv=j@u7GX?gAyW3S6&AMC3rYT7h zfTa>1u$T^`uZedXbqVY(sjRyJ+y|6SjuBTwW4>@#+6_QHN}0h3G%4^sj2)kZb0s=p zv&HQN;NtJsi9P{)rVHu~wYQl^yaHv;U<8(_I$Xlm>x6yA>#eo)`5;kn3R;7bO+a1K z+>I=%Y#|m89(nG}r&5n~f(=O0?Z=|P&ocss;IAsb7^f8ugF^p0V6i0X%3apO_rL?G~CQ*b4YG!DBZQ z4nPUQ$1svYfgS+?OS=vDgi#Ix|C}z!6E1N~2wHZ##K=ttw5KM( + + +First Aid + + + diff --git a/ApplicationExeCode/Resources/AppendPrevCurve.png b/ApplicationExeCode/Resources/AppendPrevCurve.png new file mode 100644 index 0000000000000000000000000000000000000000..ebbac2239c20461dafb85ab0bc9d564b26df78f5 GIT binary patch literal 2073 zcmV+!2RP)*-0qz3Y0Fi=yYG_~`g55e+-@wbwWQ`^rXAfWl z>VabnNvCz4vL#Fpa?# zMF@k-52Xn>aS=IO0(=WN0*q^Q z==BPd4_?0NKYNGsxx#Y)c)xb26BMMt@8@{6#{sZN5Dq{`7;cyQWUU`MobeMls3M;W zd<{6E)uI1heh4fa85_Ws;d#(M-v3z&B$HwBWR1$YJWMPBIZd!7AU^>Gp8{$URa%{G zZW7r78Wh=K$(doZc(ROhP7NjiJ6sTONKuBt5r!WH;5LP!U5RC|#@Qw-IBK8C_!tj(2iX*am?dB$Sw6jH23D}gVx0oE6u8g9@C^jvK3uksX zEWw+^CSWtcrW-QZFI1+pfMsgmkl+>MQepx!ZDr+V$ujNPc|t69z;P42qsRh0R(Krv zi1@p|5ts|G{is+2tW7qES+ZEOY%>!>@RXsMNNn;8d|aif_Q`kucfg3k3D{b?XjPst z#U(OLI5G-~t!Afvs)W^$k~IuKwgY~l$Ybz|8#<7aShR$Ac<%9O{;`(7NwQ+MjQ+o#zhT?cw(D>9DVKw5D3`xlg2qmbL zXyFHjGII(%uDp`Up(|ft2ohg$-(aILCv7Ap?@xFiZbCS6DS+OBs@hs4NxF3Y6bOU6 zLy3kQ`)%1q$tEHx`2bu~%T`skt$k#R&E|6F0}OPZ=iGaLF*|9n!TOVOO7 ziKKB}fgc_Lz7F8e&U5{3_x|-Ai|)4r^#1n)&K&r4q$i2{xBU^TJu~GA00_ZDFRqgQ zZpbMD-L0Af4hm=o=)PdSiDNO)-ENqGB=M5BMWmH^b;(O0B>2Z* zX;tA+ZgI6G7+}ts_W-cDJY?mUMQsPV&!@v-womYMI*uuAl3(zO-s2l~E>IR(aYq|c zBs^vpRYdIqL)SFC^&w!__9LRis9#FthnMr@g}OC!6xllJ$9erS0M6_gQM(&`oyKE6 zAc0F**lW~Jm;Ck%!OdhiW7)pv-z{{0cnG5qQ0Kds$5OSQe3m8}iEQn%R0UXn<(<*d09-Rl zS^9(*rzdt4)870B!IAiSK1IB+xk;o{_ar61y;-b6uuhS~=2$Xz4P3$!@W<82uDlW! zt*?*Dp|MehE`LrMD74#|u({EKCV6j*un2frt-GO$=LJ3Otk}PYivPTiB{&+@J9Fbt zM8ct@hh2KuR^KYB^^7#h`{a6NzFOC{U?roD*uKLyGQ|AWH(9ywS&EgSEa4>;>66b8 zA%3Z6G=coqLn0T!Gl}{UmxmJ@cG7eE64WJ;b!3>@cmKq^)&rQWwzzeF@pMzVVG{`+ zsy`;~Geq8!!E->KmT@4{&Dqu8 zkZAO_h@_Qo+(FQeW-(8|AJB9p8=A;UpxN|52PH{^Oft8pexaI>>h`7ZRc6!&o+`j>RE%wizJF zDRR1)GWk(xF~M-8GqZ`%65_v>D?5}y;LKFVQ)9~HbKtsw-y`2y0HpXk{8r?@82Q89 zv|-9Gtb#ts^uRqKs4+v>E+2<0SPCpbJ~}@;U1R + + +First Aid + + + diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index 7f4e7fa6cd..3b07b776da 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -263,6 +263,10 @@ AppendPrev.svg AppendNext.png AppendPrev.png + AppendNextCurve.svg + AppendPrevCurve.svg + AppendNextCurve.png + AppendPrevCurve.png fs_CellFace.glsl diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp index 2054152762..ffb1ea7881 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp @@ -41,9 +41,17 @@ RiaPlotWindowRedrawScheduler* RiaPlotWindowRedrawScheduler::instance() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaPlotWindowRedrawScheduler::scheduleMultiPlotWindowUpdate( RiuMultiPlotBook* plotWindow ) +void RiaPlotWindowRedrawScheduler::scheduleMultiPlotBookUpdate( RiuMultiPlotBook* plotBook, + RiaDefines::MultiPlotPageUpdateType updateType ) { - m_plotWindowsToUpdate.push_back( plotWindow ); + if ( m_plotBooksToUpdate.count( plotBook ) == 0 ) + { + m_plotBooksToUpdate[plotBook] = updateType; + } + else + { + m_plotBooksToUpdate[plotBook] = m_plotBooksToUpdate[plotBook] | updateType; + } startTimer( 0 ); } @@ -90,7 +98,7 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates() } m_plotWidgetsToReplot.clear(); m_plotPagesToUpdate.clear(); - m_plotWindowsToUpdate.clear(); + m_plotBooksToUpdate.clear(); } //-------------------------------------------------------------------------------------------------- @@ -98,30 +106,28 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates() //-------------------------------------------------------------------------------------------------- void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() { - std::vector> plotWindowsToUpdate; + std::map, RiaDefines::MultiPlotPageUpdateType> plotBooksToUpdate; std::vector> plotWidgetsToReplot; std::map, RiaDefines::MultiPlotPageUpdateType> pagesToUpdate; pagesToUpdate.swap( m_plotPagesToUpdate ); - plotWindowsToUpdate.swap( m_plotWindowsToUpdate ); + plotBooksToUpdate.swap( m_plotBooksToUpdate ); plotWidgetsToReplot.swap( m_plotWidgetsToReplot ); - std::set> updatedPlots; - std::set> updatedPlotWindows; + std::set> updatedPlots; - for ( QPointer plotWindow : plotWindowsToUpdate ) + for ( auto& [plotBook, updateType] : plotBooksToUpdate ) { - if ( !plotWindow.isNull() && !updatedPlotWindows.count( plotWindow ) ) + if ( plotBook.isNull() ) continue; + + if ( ( updateType & RiaDefines::MultiPlotPageUpdateType::PLOT ) == RiaDefines::MultiPlotPageUpdateType::PLOT ) { - for ( RiuMultiPlotPage* page : plotWindow->pages() ) + for ( RiuMultiPlotPage* page : plotBook->pages() ) { if ( pagesToUpdate.count( page ) > 0 ) pagesToUpdate.erase( page ); } - - const bool regeneratePages = true; - plotWindow->performUpdate( regeneratePages ); - updatedPlotWindows.insert( plotWindow ); } + plotBook->performUpdate( updateType ); } for ( auto& [page, updateType] : pagesToUpdate ) diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h index c9f5a249f0..9e29d575f9 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h @@ -40,7 +40,9 @@ class RiaPlotWindowRedrawScheduler : public QObject public: static RiaPlotWindowRedrawScheduler* instance(); - void scheduleMultiPlotWindowUpdate( RiuMultiPlotBook* plotWindow ); + void scheduleMultiPlotBookUpdate( + RiuMultiPlotBook* plotWindow, + RiaDefines::MultiPlotPageUpdateType updateType = RiaDefines::MultiPlotPageUpdateType::ALL ); void scheduleMultiPlotPageUpdate( RiuMultiPlotPage* plotWindow, RiaDefines::MultiPlotPageUpdateType updateType = RiaDefines::MultiPlotPageUpdateType::ALL ); @@ -59,9 +61,9 @@ private slots: private: std::map, RiaDefines::MultiPlotPageUpdateType> m_plotPagesToUpdate; + std::map, RiaDefines::MultiPlotPageUpdateType> m_plotBooksToUpdate; - std::vector> m_plotWidgetsToReplot; - std::vector> m_plotWindowsToUpdate; + std::vector> m_plotWidgetsToReplot; QScopedPointer m_plotWindowUpdateTimer; }; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.cpp index 22101d9aaf..d76ed95680 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForObjectsFeature.cpp @@ -57,8 +57,6 @@ void RicAppendSummaryCurvesForObjectsFeature::onActionTriggered( bool isChecked auto selectionType = sumAddressCollections.front()->contentType(); auto sourcePlots = summaryMultiPlot->summaryPlots(); - auto plotsForOneInstance = - RicAppendSummaryPlotsForObjectsFeature::plotsForOneInstanceOfObjectType( sourcePlots, selectionType ); std::vector pdmObjects; for ( auto summaryAdrCollection : sumAddressCollections ) @@ -70,8 +68,6 @@ void RicAppendSummaryCurvesForObjectsFeature::onActionTriggered( bool isChecked { plot->handleDroppedObjects( pdmObjects ); } - - summaryMultiPlot->loadDataAndUpdate(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp index 73ff2ed466..6a8d88a6a7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp @@ -29,7 +29,8 @@ //-------------------------------------------------------------------------------------------------- void RimDataSourceSteppingTools::modifyCurrentIndex( caf::PdmValueField* valueField, const QList& options, - int indexOffset ) + int indexOffset, + bool notifyChange ) { if ( valueField && !options.isEmpty() ) { @@ -65,7 +66,7 @@ void RimDataSourceSteppingTools::modifyCurrentIndex( caf::PdmValueField* { QVariant newValue = options[nextIndex].value(); valueField->setFromQVariant( newValue ); - valueField->uiCapability()->notifyFieldChanged( currentValue, newValue ); + if ( notifyChange ) valueField->uiCapability()->notifyFieldChanged( currentValue, newValue ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h index 3bb01edb0b..cf38740123 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h +++ b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.h @@ -31,7 +31,8 @@ class RimDataSourceSteppingTools public: static void modifyCurrentIndex( caf::PdmValueField* valueField, const QList& options, - int indexOffset ); + int indexOffset, + bool notifyChange = true ); static bool updateAddressIfMatching( const QVariant& oldValue, const QVariant& newValue, diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index f86f3dd530..a9e3b8d3a5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -176,6 +176,7 @@ QString RimMultiPlot::multiPlotTitle() const void RimMultiPlot::setMultiPlotTitle( const QString& title ) { m_plotWindowTitle = title; + if ( !m_viewer.isNull() ) m_viewer->setPlotTitle( title ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 2cae684794..83b02ca3a9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -72,8 +72,9 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollectionsetUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_appendPrevPlot.uiCapability()->setUiIconFromResourceString( ":/AppendPrev.png" ); + CAF_PDM_InitField( &m_appendNextCurve, "AppendNextCurve", false, "", "", "Step Next and Add Curve to Plot" ); + m_appendNextCurve.xmlCapability()->disableIO(); + m_appendNextCurve.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + m_appendNextCurve.uiCapability()->setUiIconFromResourceString( ":/AppendNextCurve.png" ); + + CAF_PDM_InitField( &m_appendPrevCurve, "AppendPrevCurve", false, "", "", "Step Previous and Add Curve to Plot" ); + m_appendPrevCurve.xmlCapability()->disableIO(); + m_appendPrevCurve.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + m_appendPrevCurve.uiCapability()->setUiIconFromResourceString( ":/AppendPrevCurve.png" ); + CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" ); CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", false, "Auto Adjust Appearance" ); @@ -408,6 +418,18 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi int stepDirection = -1; appendSubPlotByStepping( stepDirection ); } + else if ( changedField == &m_appendNextCurve ) + { + m_appendNextCurve = false; + int stepDirection = 1; + appendCurveByStepping( stepDirection ); + } + else if ( changedField == &m_appendPrevCurve ) + { + m_appendPrevCurve = false; + int stepDirection = -1; + appendCurveByStepping( stepDirection ); + } else if ( changedField == &m_autoAdjustAppearance ) { checkAndApplyAutoAppearance(); @@ -526,6 +548,9 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() toolBarFields.push_back( &m_appendPrevPlot ); toolBarFields.push_back( &m_appendNextPlot ); + toolBarFields.push_back( &m_appendPrevCurve ); + toolBarFields.push_back( &m_appendNextCurve ); + auto multiFields = RimMultiPlot::fieldsToShowInToolbar(); toolBarFields.insert( std::end( toolBarFields ), std::begin( multiFields ), std::end( multiFields ) ); @@ -1069,6 +1094,44 @@ void RimSummaryMultiPlot::appendSubPlotByStepping( int direction ) RiuPlotMainWindowTools::refreshToolbars(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::appendCurveByStepping( int direction ) +{ + for ( auto plot : summaryPlots() ) + { + std::vector addresses; + + for ( auto curve : plot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) ) + { + auto address = curve->summaryAddressY(); + auto sumCase = curve->summaryCaseY(); + address = m_sourceStepping->stepAddress( address, direction ); + addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, sumCase->caseId() ) ); + } + + for ( auto curveSet : plot->curveSets() ) + { + auto address = curveSet->summaryAddress(); + auto sumEns = curveSet->summaryCaseCollection(); + address = m_sourceStepping->stepAddress( address, direction ); + addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, -1, sumEns->ensembleId() ) ); + } + + plot->handleDroppedObjects( addresses ); + + for ( auto adr : addresses ) + { + delete adr; + } + } + + m_sourceStepping->updateStepIndex( direction ); + + RiuPlotMainWindowTools::refreshToolbars(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 081ce11015..0ed590c1fb 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -79,6 +79,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void removePlotNoUpdate( RimPlot* plot ) override; void updateAfterPlotRemove() override; + void updatePlotWindowTitle() override; std::vector fieldsToShowInToolbar() override; @@ -118,13 +119,13 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void populateNameHelper( RimSummaryPlotNameHelper* nameHelper ); - void updatePlotWindowTitle() override; void computeAggregatedAxisRange(); void updateSourceStepper(); void duplicate(); void appendSubPlotByStepping( int direction ); + void appendCurveByStepping( int direction ); void analyzePlotsAndAdjustAppearanceSettings(); @@ -142,6 +143,9 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep caf::PdmField m_appendNextPlot; caf::PdmField m_appendPrevPlot; + caf::PdmField m_appendNextCurve; + caf::PdmField m_appendPrevCurve; + caf::PdmField> m_axisRangeAggregation; caf::PdmChildField m_sourceStepping; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index dffd3f1c9b..b1f389637c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2043,20 +2043,60 @@ std::pair> RimSummaryPlot::handleSummaryAddre if ( summaryAddr->isEnsemble() ) { + std::map> dataVectorMap; + + for ( auto& curve : curveSets() ) + { + const auto curveAddress = curve->summaryAddress(); + dataVectorMap[curveAddress].insert( curve->summaryCaseCollection() ); + } + auto ensemble = RiaSummaryTools::ensembleById( summaryAddr->ensembleId() ); if ( ensemble ) { - addNewEnsembleCurveY( summaryAddr->address(), ensemble ); - newCurves++; + RifEclipseSummaryAddress droppedAddress = summaryAddr->address(); + + bool skipAddress = false; + + if ( dataVectorMap.count( droppedAddress ) > 0 ) + { + skipAddress = ( dataVectorMap[droppedAddress].count( ensemble ) > 0 ); + } + + if ( !skipAddress ) + { + addNewEnsembleCurveY( droppedAddress, ensemble ); + newCurves++; + } } } else { + std::map> dataVectorMap; + + for ( auto& curve : summaryCurves() ) + { + const auto curveAddress = curve->summaryAddressY(); + dataVectorMap[curveAddress].insert( curve->summaryCaseY() ); + } + auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAddr->caseId() ); if ( summaryCase ) { - curves.push_back( addNewCurveY( summaryAddr->address(), summaryCase ) ); - newCurves++; + RifEclipseSummaryAddress droppedAddress = summaryAddr->address(); + + bool skipAddress = false; + + if ( dataVectorMap.count( droppedAddress ) > 0 ) + { + skipAddress = ( dataVectorMap[droppedAddress].count( summaryCase ) > 0 ); + } + + if ( !skipAddress ) + { + curves.push_back( addNewCurveY( droppedAddress, summaryCase ) ); + newCurves++; + } } } return { newCurves, curves }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 6cb7cefa58..ae444d369a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -516,6 +516,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* if ( summaryMultiPlot ) { summaryMultiPlot->updatePlots(); + summaryMultiPlot->updatePlotWindowTitle(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); mainPlotWindow->updateMultiPlotToolBar(); } @@ -883,11 +884,11 @@ bool RimSummaryPlotSourceStepping::isYAxisStepping() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlotSourceStepping::modifyCurrentIndex( caf::PdmValueField* valueField, int indexOffset ) +void RimSummaryPlotSourceStepping::modifyCurrentIndex( caf::PdmValueField* valueField, int indexOffset, bool notifyChange ) { bool useOptionsOnly; QList options = calculateValueOptions( valueField, &useOptionsOnly ); - RimDataSourceSteppingTools::modifyCurrentIndex( valueField, options, indexOffset ); + RimDataSourceSteppingTools::modifyCurrentIndex( valueField, options, indexOffset, notifyChange ); } //-------------------------------------------------------------------------------------------------- @@ -1285,3 +1286,15 @@ RimSummaryCaseCollection* RimSummaryPlotSourceStepping::stepEnsemble( int direct return m_ensemble; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotSourceStepping::updateStepIndex( int direction ) +{ + caf::PdmValueField* valueField = fieldToModify(); + if ( !valueField ) return; + + bool notifyChange = false; + modifyCurrentIndex( valueField, direction, notifyChange ); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index fdff19ac21..0df92a707f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -75,6 +75,8 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject RimSummaryPlotSourceStepping::SourceSteppingDimension stepDimension() const; + void updateStepIndex( int direction ); + private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; @@ -102,7 +104,7 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject bool isXAxisStepping() const; bool isYAxisStepping() const; - void modifyCurrentIndex( caf::PdmValueField* valueField, int indexOffset ); + void modifyCurrentIndex( caf::PdmValueField* valueField, int indexOffset, bool notifyChange = true ); std::vector summaryCasesForSourceStepping(); diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 5890b38e4d..62e9c96253 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -218,19 +218,6 @@ void RiuMultiPlotBook::removeAllPlots() void RiuMultiPlotBook::setPlotTitle( const QString& plotTitle ) { m_plotTitle = plotTitle; - for ( int i = 0; i < m_pages.size(); ++i ) - { - int pageIndex = i + 1; - int pageCount = (int)m_pages.size(); - if ( pageCount > pageIndex ) - { - m_pages[i]->setPlotTitle( QString( "%1 %2/%3" ).arg( m_plotTitle ).arg( i + 1 ).arg( m_pages.size() ) ); - } - else - { - m_pages[i]->setPlotTitle( QString( "%1" ).arg( m_plotTitle ) ); - } - } } //-------------------------------------------------------------------------------------------------- @@ -266,6 +253,7 @@ void RiuMultiPlotBook::scheduleTitleUpdate() { page->scheduleUpdate( RiaDefines::MultiPlotPageUpdateType::TITLE ); } + scheduleUpdate( RiaDefines::MultiPlotPageUpdateType::TITLE ); } //-------------------------------------------------------------------------------------------------- @@ -333,9 +321,9 @@ void RiuMultiPlotBook::setPagePreviewModeEnabled( bool previewMode ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotBook::scheduleUpdate() +void RiuMultiPlotBook::scheduleUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ) { - RiaPlotWindowRedrawScheduler::instance()->scheduleMultiPlotWindowUpdate( this ); + RiaPlotWindowRedrawScheduler::instance()->scheduleMultiPlotBookUpdate( this, whatToUpdate ); } //-------------------------------------------------------------------------------------------------- @@ -410,8 +398,8 @@ void RiuMultiPlotBook::showEvent( QShowEvent* event ) { m_goToPageAfterUpdate = true; QWidget::showEvent( event ); - const bool regeneratePages = false; - performUpdate( regeneratePages ); + + performUpdate( RiaDefines::MultiPlotPageUpdateType::ALL ); if ( m_previewMode ) { applyPagePreviewBookSize( width() ); @@ -501,16 +489,22 @@ bool RiuMultiPlotBook::showYAxis( int row, int column ) const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMultiPlotBook::performUpdate( bool regeneratePages ) +void RiuMultiPlotBook::performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ) { if ( !m_plotDefinition || !m_plotDefinition->isValid() ) return; applyLook(); - if ( regeneratePages || m_pages.size() == 0 ) + if ( ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::PLOT ) == RiaDefines::MultiPlotPageUpdateType::PLOT ) || + m_pages.size() == 0 ) { deleteAllPages(); createPages(); } + else if ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::TITLE ) == RiaDefines::MultiPlotPageUpdateType::TITLE ) + { + updatePageTitles(); + } + updateGeometry(); RimSummaryMultiPlot* multiPlot = dynamic_cast( m_plotDefinition.p() ); @@ -524,6 +518,27 @@ void RiuMultiPlotBook::performUpdate( bool regeneratePages ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::updatePageTitles() +{ + if ( m_pages.isEmpty() ) return; + + if ( m_pages.size() > 1 ) + { + for ( int i = 0; i < m_pages.size(); ++i ) + { + int pageNumber = i + 1; + m_pages[i]->setPlotTitle( QString( "%1 %2/%3" ).arg( m_plotTitle ).arg( pageNumber ).arg( m_pages.size() ) ); + } + } + else + { + m_pages[0]->setPlotTitle( QString( "%1" ).arg( m_plotTitle ) ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -603,14 +618,8 @@ void RiuMultiPlotBook::createPages() } // Set page numbers in title when there's more than one page - if ( m_pages.size() > 1 ) - { - for ( int i = 0; i < m_pages.size(); ++i ) - { - int pageNumber = i + 1; - m_pages[i]->setPlotTitle( QString( "%1 %2/%3" ).arg( m_plotTitle ).arg( pageNumber ).arg( m_pages.size() ) ); - } - } + updatePageTitles(); + adjustBookFrame(); } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index 4cbfad4a06..ba7b979eec 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -80,7 +80,7 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow bool pagePreviewModeEnabled() const; void setPagePreviewModeEnabled( bool previewMode ); - void scheduleUpdate(); + void scheduleUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate = RiaDefines::MultiPlotPageUpdateType::ALL ); void scheduleReplotOfAllPlots(); void renderTo( QPaintDevice* painter ); @@ -123,6 +123,8 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow const QList>& pages() const; + void updatePageTitles(); + private: RiuMultiPlotPage* createPage(); void deleteAllPages(); @@ -131,7 +133,7 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow void changeCurrentPage( int pageNumber ); private slots: - virtual void performUpdate( bool regeneratePages ); + virtual void performUpdate( RiaDefines::MultiPlotPageUpdateType updateType ); protected: friend class RiaPlotWindowRedrawScheduler; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp index 763290d8c9..0b945c6b46 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotBook.cpp @@ -84,14 +84,7 @@ void RiuSummaryMultiPlotBook::createPages() } // Set page numbers in title when there's more than one page - if ( m_pages.size() > 1 ) - { - for ( int i = 0; i < m_pages.size(); ++i ) - { - int pageNumber = i + 1; - m_pages[i]->setPlotTitle( QString( "%1 %2/%3" ).arg( m_plotTitle ).arg( pageNumber ).arg( m_pages.size() ) ); - } - } + updatePageTitles(); adjustBookFrame(); } From e426364fd5f50f91967ea93d22f70df895813893 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 5 May 2022 09:26:18 +0200 Subject: [PATCH 272/406] Toggle Action Performance : Send fieldChanged() only once fieldChanged() can potentially do much work. When toggling objects in the project tree, make sure that fieldChanged is called only once for a toggle operation. This will make sure that we have the best possible performance in all use cases. --- .../RicToggleItemsFeatureImpl.cpp | 118 +++++++++++------- .../RicToggleItemsFeatureImpl.h | 9 +- .../RicToggleItemsOnOthersOffFeature.cpp | 4 +- 3 files changed, 81 insertions(+), 50 deletions(-) diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp index 3d19b992a4..a50fedcf78 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp @@ -67,10 +67,9 @@ bool RicToggleItemsFeatureImpl::isToggleCommandsAvailable() } else { - for ( size_t i = 0; i < selectedItems.size(); ++i ) + for ( auto& selectedItem : selectedItems ) { - caf::PdmUiObjectHandle* uiObjectHandle = dynamic_cast( selectedItems[i] ); - + auto* uiObjectHandle = dynamic_cast( selectedItem ); if ( uiObjectHandle && uiObjectHandle->objectToggleField() ) { return true; @@ -100,55 +99,26 @@ bool RicToggleItemsFeatureImpl::isToggleCommandsForSubItems() //-------------------------------------------------------------------------------------------------- void RicToggleItemsFeatureImpl::setObjectToggleStateForSelection( SelectionToggleType state ) { - std::vector selectedItems; - caf::SelectionManager::instance()->selectedItems( selectedItems ); - if ( state != TOGGLE && selectedItems.size() == 1 ) - { - // If only one item is selected, loop over its children, and toggle them instead of the - // selected item directly + auto fields = findToggleFieldsFromSelection( state ); + if ( fields.empty() ) return; - // We need to get the children through the tree view, because that is where the actually shown children is - - caf::PdmUiTreeOrdering* treeItem = findTreeItemFromSelectedUiItem( selectedItems[0] ); + auto lastField = fields.back(); + for ( auto field : fields ) + { + bool value = !( field->v() ); - if ( !treeItem ) return; + if ( state == TOGGLE_ON ) + value = true; + else if ( state == TOGGLE_OFF ) + value = false; - for ( int cIdx = 0; cIdx < treeItem->childCount(); ++cIdx ) + if ( field == lastField ) { - caf::PdmUiTreeOrdering* child = treeItem->child( cIdx ); - if ( !child ) continue; - if ( !child->isRepresentingObject() ) continue; - - caf::PdmObjectHandle* childObj = child->object(); - caf::PdmUiObjectHandle* uiObjectHandleChild = uiObj( childObj ); - - if ( uiObjectHandleChild && uiObjectHandleChild->objectToggleField() ) - { - caf::PdmField* field = dynamic_cast*>( uiObjectHandleChild->objectToggleField() ); - - if ( state == TOGGLE_ON ) field->setValueWithFieldChanged( true ); - if ( state == TOGGLE_OFF ) field->setValueWithFieldChanged( false ); - if ( state == TOGGLE_SUBITEMS ) field->setValueWithFieldChanged( !( field->v() ) ); - } + field->setValueWithFieldChanged( value ); } - } - else - { - for ( size_t i = 0; i < selectedItems.size(); ++i ) + else { - caf::PdmUiObjectHandle* uiObjectHandle = dynamic_cast( selectedItems[i] ); - - if ( uiObjectHandle && uiObjectHandle->objectToggleField() ) - { - caf::PdmField* field = dynamic_cast*>( uiObjectHandle->objectToggleField() ); - - if ( state == TOGGLE_ON ) field->setValueWithFieldChanged( true ); - if ( state == TOGGLE_OFF ) field->setValueWithFieldChanged( false ); - if ( state == TOGGLE_SUBITEMS || state == TOGGLE ) - { - field->setValueWithFieldChanged( !( field->v() ) ); - } - } + field->setValue( value ); } } } @@ -160,7 +130,7 @@ caf::PdmUiTreeView* RicToggleItemsFeatureImpl::findTreeView( const caf::PdmUiIte { RiaFeatureCommandContext* context = RiaFeatureCommandContext::instance(); - caf::PdmUiTreeView* customActiveTreeView = dynamic_cast( context->object() ); + auto* customActiveTreeView = dynamic_cast( context->object() ); if ( customActiveTreeView ) { return customActiveTreeView; @@ -197,3 +167,57 @@ caf::PdmUiTreeOrdering* RicToggleItemsFeatureImpl::findTreeItemFromSelectedUiIte return nullptr; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector*> RicToggleItemsFeatureImpl::findToggleFieldsFromSelection( SelectionToggleType state ) +{ + std::vector*> fields; + + std::vector selectedItems; + caf::SelectionManager::instance()->selectedItems( selectedItems ); + if ( state != TOGGLE && selectedItems.size() == 1 ) + { + // If only one item is selected, loop over its children, and toggle them instead of the + // selected item directly + + // We need to get the children through the tree view, because that is where the actually shown children is + + caf::PdmUiTreeOrdering* treeItem = findTreeItemFromSelectedUiItem( selectedItems[0] ); + + if ( !treeItem ) return {}; + + for ( int cIdx = 0; cIdx < treeItem->childCount(); ++cIdx ) + { + caf::PdmUiTreeOrdering* child = treeItem->child( cIdx ); + if ( !child ) continue; + if ( !child->isRepresentingObject() ) continue; + + caf::PdmObjectHandle* childObj = child->object(); + caf::PdmUiObjectHandle* uiObjectHandleChild = uiObj( childObj ); + + if ( uiObjectHandleChild && uiObjectHandleChild->objectToggleField() ) + { + auto* field = dynamic_cast*>( uiObjectHandleChild->objectToggleField() ); + + fields.emplace_back( field ); + } + } + } + else + { + for ( auto& selectedItem : selectedItems ) + { + auto* uiObjectHandle = dynamic_cast( selectedItem ); + if ( uiObjectHandle && uiObjectHandle->objectToggleField() ) + { + auto* field = dynamic_cast*>( uiObjectHandle->objectToggleField() ); + + fields.emplace_back( field ); + } + } + } + + return fields; +} diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.h b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.h index c1860b8587..1c99af4236 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.h +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.h @@ -19,6 +19,10 @@ #pragma once +#include "cafPdmField.h" + +#include + namespace caf { class PdmUiItem; @@ -46,6 +50,7 @@ class RicToggleItemsFeatureImpl static void setObjectToggleStateForSelection( SelectionToggleType state ); private: - static caf::PdmUiTreeView* findTreeView( const caf::PdmUiItem* uiItem ); - static caf::PdmUiTreeOrdering* findTreeItemFromSelectedUiItem( const caf::PdmUiItem* uiItem ); + static caf::PdmUiTreeView* findTreeView( const caf::PdmUiItem* uiItem ); + static caf::PdmUiTreeOrdering* findTreeItemFromSelectedUiItem( const caf::PdmUiItem* uiItem ); + static std::vector*> findToggleFieldsFromSelection( SelectionToggleType state ); }; diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp index 6358105023..e1e6f06277 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp @@ -62,7 +62,9 @@ void RicToggleItemsOnOthersOffFeature::onActionTriggered( bool isChecked ) if ( field ) { - field->setValueWithFieldChanged( false ); + // Avoid calling setValueWithFieldChanged() here, as this potentially can trigger heavy computations. Assume + // that the update logic is sufficient when setting the selected objects. + field->setValue( false ); } } From 8daf25ffb3bf605f89caa7997fba42df94f3781b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 5 May 2022 13:31:49 +0200 Subject: [PATCH 273/406] Performance : Cache result of some string manipulation functions These functions get called quite often, and popped up based on profiling. --- .../Application/RiaApplication.cpp | 3 ++ .../Application/Tools/RiaWellNameComparer.cpp | 39 ++++++++++++++++++- .../Application/Tools/RiaWellNameComparer.h | 9 ++++- 3 files changed, 48 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 4063921982..576c26efe3 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -31,6 +31,7 @@ #include "RiaTextStringTools.h" #include "RiaVersionInfo.h" #include "RiaViewRedrawScheduler.h" +#include "RiaWellNameComparer.h" #include "ExportCommands/RicSnapshotAllViewsToFileFeature.h" #include "HoloLensCommands/RicHoloLensSessionManager.h" @@ -782,6 +783,8 @@ void RiaApplication::closeProject() m_project->close(); m_commandQueue.clear(); + RiaWellNameComparer::clearCache(); + onProjectClosed(); caf::PdmUiModelChangeDetector::instance()->reset(); diff --git a/ApplicationLibCode/Application/Tools/RiaWellNameComparer.cpp b/ApplicationLibCode/Application/Tools/RiaWellNameComparer.cpp index 9e7ad67150..82270e82c5 100644 --- a/ApplicationLibCode/Application/Tools/RiaWellNameComparer.cpp +++ b/ApplicationLibCode/Application/Tools/RiaWellNameComparer.cpp @@ -23,6 +23,9 @@ #include +std::map RiaWellNameComparer::sm_nameWithoutPrefix; +std::map RiaWellNameComparer::sm_matchedName; + //================================================================================================== // //================================================================================================== @@ -62,19 +65,41 @@ QString RiaWellNameComparer::tryFindMatchingWellPath( QString wellName ) //-------------------------------------------------------------------------------------------------- QString RiaWellNameComparer::tryMatchNameInList( QString searchName, const std::vector& nameList ) { + if ( sm_matchedName.count( searchName ) > 0 ) + { + return sm_matchedName[searchName]; + }; + // Try exact name match QString matchedName = tryMatchName( searchName, nameList ); if ( !matchedName.isEmpty() ) { + sm_matchedName[searchName] = matchedName; return matchedName; } // Try matching ignoring spaces, dashes and underscores - return tryMatchName( searchName, nameList, []( const QString& str ) { + matchedName = tryMatchName( searchName, nameList, []( const QString& str ) { QString s = str; s = removeWellNamePrefix( s ); return s.remove( ' ' ).remove( '-' ).remove( '_' ); } ); + + if ( !matchedName.isEmpty() ) + { + sm_matchedName[searchName] = matchedName; + } + + return matchedName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaWellNameComparer::clearCache() +{ + sm_nameWithoutPrefix.clear(); + sm_matchedName.clear(); } //-------------------------------------------------------------------------------------------------- @@ -111,8 +136,18 @@ QString RiaWellNameComparer::tryMatchName( QString sea //-------------------------------------------------------------------------------------------------- QString RiaWellNameComparer::removeWellNamePrefix( const QString& name ) { + if ( sm_nameWithoutPrefix.count( name ) > 0 ) + { + return sm_nameWithoutPrefix[name]; + }; + // Try to remove prefix on the format 'xx xxxx/xx-' std::regex pattern( "^.*\\d*[/]\\d*[-_]" ); - return QString::fromStdString( std::regex_replace( name.toStdString(), pattern, "" ) ); + auto withoutPrefix = std::regex_replace( name.toStdString(), pattern, "" ); + auto qWithoutPrefix = QString::fromStdString( withoutPrefix ); + + sm_nameWithoutPrefix[name] = qWithoutPrefix; + + return qWithoutPrefix; } diff --git a/ApplicationLibCode/Application/Tools/RiaWellNameComparer.h b/ApplicationLibCode/Application/Tools/RiaWellNameComparer.h index 22702c08b8..0a3c2a85d5 100644 --- a/ApplicationLibCode/Application/Tools/RiaWellNameComparer.h +++ b/ApplicationLibCode/Application/Tools/RiaWellNameComparer.h @@ -19,7 +19,9 @@ #pragma once #include + #include +#include #include //================================================================================================== @@ -32,13 +34,18 @@ class RiaWellNameComparer public: static QString tryFindMatchingSimWellName( QString searchName ); static QString tryFindMatchingWellPath( QString wellName ); - static QString tryMatchNameInList( QString searchName, const std::vector& nameList ); + static void clearCache(); + private: static QString tryMatchName( QString searchName, const std::vector& nameList, std::function stringFormatter = nullptr ); static QString removeWellNamePrefix( const QString& name ); + +private: + static std::map sm_nameWithoutPrefix; + static std::map sm_matchedName; }; From cc397efe3e58babddcce0db12ed4926f0e0ec743 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 5 May 2022 11:29:07 +0200 Subject: [PATCH 274/406] Performance : Simplify use of update schedulers Extract code to RiaScheduler Add PlotCollectionScheduler --- .../Application/CMakeLists_files.cmake | 5 ++ .../RiaCompletionTypeCalculationScheduler.cpp | 65 +++++++-------- .../RiaCompletionTypeCalculationScheduler.h | 16 ++-- .../RiaPlotCollectionScheduler.cpp | 73 ++++++++++++++++ .../Application/RiaPlotCollectionScheduler.h | 42 ++++++++++ .../Application/RiaScheduler.cpp | 83 +++++++++++++++++++ ApplicationLibCode/Application/RiaScheduler.h | 47 +++++++++++ .../Application/RiaViewRedrawScheduler.cpp | 62 ++++---------- .../Application/RiaViewRedrawScheduler.h | 34 +++----- .../RimMainPlotCollection.cpp | 7 +- .../ProjectDataModel/RimMainPlotCollection.h | 2 +- .../ProjectDataModel/RimProject.cpp | 4 +- 12 files changed, 325 insertions(+), 115 deletions(-) create mode 100644 ApplicationLibCode/Application/RiaPlotCollectionScheduler.cpp create mode 100644 ApplicationLibCode/Application/RiaPlotCollectionScheduler.h create mode 100644 ApplicationLibCode/Application/RiaScheduler.cpp create mode 100644 ApplicationLibCode/Application/RiaScheduler.h diff --git a/ApplicationLibCode/Application/CMakeLists_files.cmake b/ApplicationLibCode/Application/CMakeLists_files.cmake index 1a4af7591e..f69791efcb 100644 --- a/ApplicationLibCode/Application/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/CMakeLists_files.cmake @@ -27,6 +27,8 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.h ${CMAKE_CURRENT_LIST_DIR}/RiaRftDefines.h ${CMAKE_CURRENT_LIST_DIR}/RiaDateTimeDefines.h + ${CMAKE_CURRENT_LIST_DIR}/RiaPlotCollectionScheduler.h + ${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -58,6 +60,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiaNumberFormat.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaRftDefines.cpp ${CMAKE_CURRENT_LIST_DIR}/RiaDateTimeDefines.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaPlotCollectionScheduler.cpp + ${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.cpp ) list(APPEND CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) @@ -71,6 +75,7 @@ set(QT_MOC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h ${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h ${CMAKE_CURRENT_LIST_DIR}/RiaPlotWindowRedrawScheduler.h + ${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.h ) source_group( diff --git a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp index 3730f07273..346ea6e38f 100644 --- a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp +++ b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp @@ -78,38 +78,50 @@ void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAnd void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAndRedrawAllViews( const std::vector& eclipseCases ) { + clearCompletionTypeResults( eclipseCases ); + for ( RimEclipseCase* eclipseCase : eclipseCases ) { - CVF_ASSERT( eclipseCase ); - - if ( eclipseCase->eclipseCaseData() ) - { - eclipseCase->eclipseCaseData() - ->results( RiaDefines::PorosityModelType::MATRIX_MODEL ) - ->clearScalarResult( RiaDefines::ResultCatType::DYNAMIC_NATIVE, - RiaResultNames::completionTypeResultName() ); + if ( eclipseCase ) m_eclipseCasesToRecalculate.emplace_back( eclipseCase ); + } - // Delete virtual perforation transmissibilities, as these are the basis for the computation of completion type - eclipseCase->eclipseCaseData()->setVirtualPerforationTransmissibilities( nullptr ); - } + startTimer( 0 ); +} - m_eclipseCasesToRecalculate.push_back( eclipseCase ); - } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaCompletionTypeCalculationScheduler::clearCompletionTypeResultsInAllCases() +{ + std::vector eclipseCases = + RimProject::current()->activeOilField()->analysisModels->cases().childObjects(); - startTimer(); + clearCompletionTypeResults( eclipseCases ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaCompletionTypeCalculationScheduler::slotRecalculateCompletionType() +void RiaCompletionTypeCalculationScheduler::clearCompletionTypeResults( const std::vector& eclipseCases ) { - if ( caf::ProgressState::isActive() ) + for ( RimEclipseCase* eclipseCase : eclipseCases ) { - startTimer(); - return; + if ( !eclipseCase || !eclipseCase->eclipseCaseData() ) continue; + + eclipseCase->eclipseCaseData() + ->results( RiaDefines::PorosityModelType::MATRIX_MODEL ) + ->clearScalarResult( RiaDefines::ResultCatType::DYNAMIC_NATIVE, RiaResultNames::completionTypeResultName() ); + + // Delete virtual perforation transmissibilities, as these are the basis for the computation of completion type + eclipseCase->eclipseCaseData()->setVirtualPerforationTransmissibilities( nullptr ); } +} +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaCompletionTypeCalculationScheduler::performScheduledUpdates() +{ std::set uniqueCases( m_eclipseCasesToRecalculate.begin(), m_eclipseCasesToRecalculate.end() ); Rim3dView* activeView = RiaApplication::instance()->activeReservoirView(); @@ -149,28 +161,11 @@ void RiaCompletionTypeCalculationScheduler::slotRecalculateCompletionType() //-------------------------------------------------------------------------------------------------- RiaCompletionTypeCalculationScheduler::~RiaCompletionTypeCalculationScheduler() { - delete m_recalculateCompletionTypeTimer; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RiaCompletionTypeCalculationScheduler::RiaCompletionTypeCalculationScheduler() - : m_recalculateCompletionTypeTimer( nullptr ) { } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaCompletionTypeCalculationScheduler::startTimer() -{ - if ( !m_recalculateCompletionTypeTimer ) - { - m_recalculateCompletionTypeTimer = new QTimer( this ); - m_recalculateCompletionTypeTimer->setSingleShot( true ); - connect( m_recalculateCompletionTypeTimer, SIGNAL( timeout() ), this, SLOT( slotRecalculateCompletionType() ) ); - } - - m_recalculateCompletionTypeTimer->start( 1500 ); -} diff --git a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.h b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.h index 9ea5fb94c3..1f7ad10416 100644 --- a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.h +++ b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.h @@ -18,29 +18,30 @@ #pragma once -#include "cafPdmPointer.h" +#include "RiaScheduler.h" -#include +#include "cafPdmPointer.h" #include -class QTimer; class RimEclipseCase; //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -class RiaCompletionTypeCalculationScheduler : public QObject +class RiaCompletionTypeCalculationScheduler : public RiaScheduler { Q_OBJECT; public: static RiaCompletionTypeCalculationScheduler* instance(); void scheduleRecalculateCompletionTypeAndRedrawAllViews(); + void clearCompletionTypeResultsInAllCases(); + void scheduleRecalculateCompletionTypeAndRedrawAllViews( RimEclipseCase* eclipseCase ); + void clearCompletionTypeResults( const std::vector& eclipseCases ); -private slots: - void slotRecalculateCompletionType(); + void performScheduledUpdates() override; private: RiaCompletionTypeCalculationScheduler(); @@ -51,9 +52,6 @@ private slots: void scheduleRecalculateCompletionTypeAndRedrawAllViews( const std::vector& eclipseCases ); - void startTimer(); - private: std::vector> m_eclipseCasesToRecalculate; - QTimer* m_recalculateCompletionTypeTimer; }; diff --git a/ApplicationLibCode/Application/RiaPlotCollectionScheduler.cpp b/ApplicationLibCode/Application/RiaPlotCollectionScheduler.cpp new file mode 100644 index 0000000000..25055c0893 --- /dev/null +++ b/ApplicationLibCode/Application/RiaPlotCollectionScheduler.cpp @@ -0,0 +1,73 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiaPlotCollectionScheduler.h" + +#include "RimAbstractPlotCollection.h" +#include "RimViewWindow.h" + +#include "cafProgressState.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaPlotCollectionScheduler::RiaPlotCollectionScheduler() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaPlotCollectionScheduler::~RiaPlotCollectionScheduler() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaPlotCollectionScheduler* RiaPlotCollectionScheduler::instance() +{ + static RiaPlotCollectionScheduler theInstance; + + return &theInstance; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaPlotCollectionScheduler::schedulePlotCollectionUpdate( const std::vector plotCollections ) +{ + m_plotCollectionsToUpdate.insert( m_plotCollectionsToUpdate.end(), plotCollections.begin(), plotCollections.end() ); + + startTimer( 0 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaPlotCollectionScheduler::performScheduledUpdates() +{ + for ( auto p : m_plotCollectionsToUpdate ) + { + if ( p == nullptr ) continue; + + p->loadDataAndUpdateAllPlots(); + } +} diff --git a/ApplicationLibCode/Application/RiaPlotCollectionScheduler.h b/ApplicationLibCode/Application/RiaPlotCollectionScheduler.h new file mode 100644 index 0000000000..aded19656a --- /dev/null +++ b/ApplicationLibCode/Application/RiaPlotCollectionScheduler.h @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiaScheduler.h" + +class RimPlotCollection; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RiaPlotCollectionScheduler : public RiaScheduler +{ +public: + RiaPlotCollectionScheduler(); + ~RiaPlotCollectionScheduler() override; + + static RiaPlotCollectionScheduler* instance(); + + void schedulePlotCollectionUpdate( const std::vector plotCollections ); + + void performScheduledUpdates() override; + +private: + std::vector m_plotCollectionsToUpdate; +}; diff --git a/ApplicationLibCode/Application/RiaScheduler.cpp b/ApplicationLibCode/Application/RiaScheduler.cpp new file mode 100644 index 0000000000..123ef0b5bc --- /dev/null +++ b/ApplicationLibCode/Application/RiaScheduler.cpp @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RiaScheduler.h" + +#include "cafProgressState.h" + +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaScheduler::RiaScheduler() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaScheduler::~RiaScheduler() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaScheduler::slotUpdateScheduledItemsWhenReady() +{ + if ( caf::ProgressState::isActive() ) + { + startTimer( 100 ); + return; + } + + performScheduledUpdates(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaScheduler::startTimer( int msecs ) +{ + if ( !m_updateTimer ) + { + m_updateTimer.reset( new QTimer( this ) ); + connect( m_updateTimer.data(), SIGNAL( timeout() ), this, SLOT( slotUpdateScheduledItemsWhenReady() ) ); + } + + if ( !m_updateTimer->isActive() ) + { + m_updateTimer->setSingleShot( true ); + m_updateTimer->start( msecs ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaScheduler::waitUntilWorkIsDone() +{ + if ( m_updateTimer ) + { + while ( m_updateTimer->isActive() ) + { + QCoreApplication::processEvents(); + } + } +} diff --git a/ApplicationLibCode/Application/RiaScheduler.h b/ApplicationLibCode/Application/RiaScheduler.h new file mode 100644 index 0000000000..d0e1ec1c53 --- /dev/null +++ b/ApplicationLibCode/Application/RiaScheduler.h @@ -0,0 +1,47 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RiaScheduler : public QObject +{ + Q_OBJECT + +public: + RiaScheduler(); + virtual ~RiaScheduler(); + + virtual void performScheduledUpdates() = 0; + +protected: + void startTimer( int msecs ); + void waitUntilWorkIsDone(); + +private slots: + void slotUpdateScheduledItemsWhenReady(); + +private: + QScopedPointer m_updateTimer; +}; diff --git a/ApplicationLibCode/Application/RiaViewRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaViewRedrawScheduler.cpp index 622574db93..67b8d1de9e 100644 --- a/ApplicationLibCode/Application/RiaViewRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaViewRedrawScheduler.cpp @@ -17,14 +17,25 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiaViewRedrawScheduler.h" -#include "Rim3dView.h" -#include -#include +#include "Rim3dView.h" -#include "cafProgressState.h" #include +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaViewRedrawScheduler::RiaViewRedrawScheduler() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaViewRedrawScheduler::~RiaViewRedrawScheduler() +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -51,13 +62,8 @@ void RiaViewRedrawScheduler::scheduleDisplayModelUpdateAndRedraw( Rim3dView* res //-------------------------------------------------------------------------------------------------- void RiaViewRedrawScheduler::clearViewsScheduledForUpdate() { - if ( m_resViewUpdateTimer ) - { - while ( m_resViewUpdateTimer->isActive() ) - { - QCoreApplication::processEvents(); - } - } + waitUntilWorkIsDone(); + m_resViewsToUpdate.clear(); } @@ -105,39 +111,7 @@ void RiaViewRedrawScheduler::updateAndRedrawScheduledViews() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaViewRedrawScheduler::slotUpdateAndRedrawScheduledViewsWhenReady() +void RiaViewRedrawScheduler::performScheduledUpdates() { - if ( caf::ProgressState::isActive() ) - { - startTimer( 100 ); - return; - } - updateAndRedrawScheduledViews(); } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaViewRedrawScheduler::startTimer( int msecs ) -{ - if ( !m_resViewUpdateTimer ) - { - m_resViewUpdateTimer = new QTimer( this ); - connect( m_resViewUpdateTimer, SIGNAL( timeout() ), this, SLOT( slotUpdateAndRedrawScheduledViewsWhenReady() ) ); - } - - if ( !m_resViewUpdateTimer->isActive() ) - { - m_resViewUpdateTimer->setSingleShot( true ); - m_resViewUpdateTimer->start( msecs ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiaViewRedrawScheduler::~RiaViewRedrawScheduler() -{ - delete m_resViewUpdateTimer; -} diff --git a/ApplicationLibCode/Application/RiaViewRedrawScheduler.h b/ApplicationLibCode/Application/RiaViewRedrawScheduler.h index e80f38b801..59f31daae6 100644 --- a/ApplicationLibCode/Application/RiaViewRedrawScheduler.h +++ b/ApplicationLibCode/Application/RiaViewRedrawScheduler.h @@ -18,38 +18,28 @@ #pragma once +#include "RiaScheduler.h" + #include "cafPdmPointer.h" -#include + #include -class QTimer; class Rim3dView; -class RiaViewRedrawScheduler : public QObject +class RiaViewRedrawScheduler : public RiaScheduler { - Q_OBJECT; - public: - static RiaViewRedrawScheduler* instance(); - void scheduleDisplayModelUpdateAndRedraw( Rim3dView* resViewToUpdate ); - void clearViewsScheduledForUpdate(); - void updateAndRedrawScheduledViews(); - -private slots: - void slotUpdateAndRedrawScheduledViewsWhenReady(); + RiaViewRedrawScheduler(); + ~RiaViewRedrawScheduler() override; -private: - void startTimer( int msecs ); + static RiaViewRedrawScheduler* instance(); - RiaViewRedrawScheduler() - : m_resViewUpdateTimer( nullptr ) - { - } - ~RiaViewRedrawScheduler() override; + void scheduleDisplayModelUpdateAndRedraw( Rim3dView* resViewToUpdate ); + void clearViewsScheduledForUpdate(); + void updateAndRedrawScheduledViews(); - RiaViewRedrawScheduler( const RiaViewRedrawScheduler& o ) = delete; - void operator=( const RiaViewRedrawScheduler& o ) = delete; + void performScheduledUpdates() override; +private: std::vector> m_resViewsToUpdate; - QTimer* m_resViewUpdateTimer; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp index fb6180036f..12d4e442c1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp @@ -19,6 +19,8 @@ #include "RimMainPlotCollection.h" +#include "RiaPlotCollectionScheduler.h" + #include "PlotBuilderCommands/RicSummaryPlotBuilder.h" #include "RimAbstractPlotCollection.h" @@ -340,10 +342,11 @@ void RimMainPlotCollection::updatePlotsWithFormations() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimMainPlotCollection::updatePlotsWithCompletions() +void RimMainPlotCollection::scheduleUpdatePlotsWithCompletions() { std::vector plotCollections = plotCollectionsWithCompletions(); - loadDataAndUpdatePlotCollections( plotCollections ); + + RiaPlotCollectionScheduler::instance()->schedulePlotCollectionUpdate( plotCollections ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h index b21e44fa33..9114c8da08 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.h @@ -84,7 +84,7 @@ class RimMainPlotCollection : public caf::PdmObject void deleteAllContainedObjects(); void updateCurrentTimeStepInPlots(); void updatePlotsWithFormations(); - void updatePlotsWithCompletions(); + void scheduleUpdatePlotsWithCompletions(); void deleteAllCachedData(); void ensureDefaultFlowPlotsAreCreated(); void ensureCalculationIdsAreAssigned(); diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 686580de7c..722e8c1756 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -999,10 +999,10 @@ void RimProject::setSubWindowsTiledInPlotWindow( bool tiled ) //-------------------------------------------------------------------------------------------------- void RimProject::reloadCompletionTypeResultsInAllViews() { + RiaCompletionTypeCalculationScheduler::instance()->clearCompletionTypeResultsInAllCases(); scheduleCreateDisplayModelAndRedrawAllViews(); - RiaCompletionTypeCalculationScheduler::instance()->scheduleRecalculateCompletionTypeAndRedrawAllViews(); - this->mainPlotCollection()->updatePlotsWithCompletions(); + mainPlotCollection()->scheduleUpdatePlotsWithCompletions(); } //-------------------------------------------------------------------------------------------------- From 64c4adf5f0a1f004bd1cc02b7f26f38d096234d8 Mon Sep 17 00:00:00 2001 From: magnesj Date: Fri, 6 May 2022 01:47:29 +0000 Subject: [PATCH 275/406] Fixes by clang-tidy --- ApplicationLibCode/Application/RiaScheduler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/Application/RiaScheduler.h b/ApplicationLibCode/Application/RiaScheduler.h index d0e1ec1c53..ad0dbc3c28 100644 --- a/ApplicationLibCode/Application/RiaScheduler.h +++ b/ApplicationLibCode/Application/RiaScheduler.h @@ -31,7 +31,7 @@ class RiaScheduler : public QObject public: RiaScheduler(); - virtual ~RiaScheduler(); + ~RiaScheduler() override; virtual void performScheduledUpdates() = 0; From 74075cc9abb52c09f065c6cc86a923cd2827c036 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 6 May 2022 10:52:08 +0200 Subject: [PATCH 276/406] Merge pull request #8888 from OPM/8887-fix-reorder-capability Fix reorder capability --- .../RicEclipsePropertyFilterInsertExec.cpp | 2 +- .../RicCreateMultipleFracturesUi.cpp | 2 +- .../RicGeoMechPropertyFilterInsertExec.cpp | 2 +- .../RimUserDefinedPolylinesAnnotation.cpp | 2 +- .../CellFilters/RimPolygonFilter.cpp | 2 +- .../Completions/RimFishbones.cpp | 2 +- .../ProjectDataModel/RimDepthTrackPlot.cpp | 2 +- .../ProjectDataModel/RimMultiPlot.cpp | 2 +- .../StimPlanModel/RimPressureTable.cpp | 2 +- .../Surfaces/RimSurfaceCollection.cpp | 2 +- .../WellLog/RimWellLogTrack.cpp | 4 +-- .../RimWellMeasurementCollection.cpp | 2 +- .../RimWellPathAttributeCollection.cpp | 2 +- .../WellPath/RimWellPathGeometryDef.cpp | 2 +- .../cafPdmCore/cafPdmChildArrayField.h | 4 +-- .../cafPdmCore/cafPdmChildArrayField.inl | 34 +++++++++---------- .../cafPdmFieldReorderCapability.cpp | 8 +++++ .../cafPdmCore/cafPdmFieldReorderCapability.h | 2 ++ .../cafPdmCore/cafPdmPtrArrayField.h | 18 +++++----- .../cafPdmCore/cafPdmPtrArrayField.inl | 34 +++++++++---------- .../cafPdmCore/cafPdmPtrArrayFieldHandle.h | 1 + .../cafPdmUiTreeViewEditor.cpp | 6 ++-- .../cafPdmUiTreeViewItemDelegate.cpp | 26 ++++++++++---- 23 files changed, 93 insertions(+), 70 deletions(-) diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.cpp b/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.cpp index 725ad4a72c..d6b5f6ff4f 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.cpp +++ b/ApplicationLibCode/Commands/EclipseCommands/RicEclipsePropertyFilterInsertExec.cpp @@ -59,7 +59,7 @@ void RicEclipsePropertyFilterInsertExec::redo() RimEclipsePropertyFilterCollection* propertyFilterCollection = nullptr; m_propertyFilter->firstAncestorOrThisOfTypeAsserted( propertyFilterCollection ); - size_t index = propertyFilterCollection->propertyFilters.index( m_propertyFilter ); + size_t index = propertyFilterCollection->propertyFilters.indexOf( m_propertyFilter ); CVF_ASSERT( index < propertyFilterCollection->propertyFilters.size() ); RicEclipsePropertyFilterFeatureImpl::insertPropertyFilter( propertyFilterCollection, index ); diff --git a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp index 674b56a1d9..73968e48a1 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp @@ -144,7 +144,7 @@ std::vector RiuCreateMultipleFractionsU void RiuCreateMultipleFractionsUi::insertOptionItem( RicCreateMultipleFracturesOptionItemUi* insertAfterThisObject, RicCreateMultipleFracturesOptionItemUi* objectToInsert ) { - size_t index = m_options.index( insertAfterThisObject ); + size_t index = m_options.indexOf( insertAfterThisObject ); if ( index < m_options.size() - 1 ) { m_options.insert( index + 1, objectToInsert ); diff --git a/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterInsertExec.cpp b/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterInsertExec.cpp index 00157e06cc..6187219de6 100644 --- a/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterInsertExec.cpp +++ b/ApplicationLibCode/Commands/GeoMechCommands/RicGeoMechPropertyFilterInsertExec.cpp @@ -59,7 +59,7 @@ void RicGeoMechPropertyFilterInsertExec::redo() RimGeoMechPropertyFilterCollection* propertyFilterCollection = m_propertyFilter->parentContainer(); CVF_ASSERT( propertyFilterCollection ); - size_t index = propertyFilterCollection->propertyFilters.index( m_propertyFilter ); + size_t index = propertyFilterCollection->propertyFilters.indexOf( m_propertyFilter ); CVF_ASSERT( index < propertyFilterCollection->propertyFilters.size() ); RicGeoMechPropertyFilterFeatureImpl::insertPropertyFilter( propertyFilterCollection, index ); diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp index d2197969b9..956c1ccd14 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp @@ -137,7 +137,7 @@ void RimUserDefinedPolylinesAnnotation::appendTarget( const cvf::Vec3d& defaultP void RimUserDefinedPolylinesAnnotation::insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert ) { - size_t index = m_targets.index( targetToInsertBefore ); + size_t index = m_targets.indexOf( targetToInsertBefore ); if ( index < m_targets.size() ) m_targets.insert( index, targetToInsert ); else diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp index 35a95fb83b..b0a3503b12 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp @@ -263,7 +263,7 @@ std::vector RimPolygonFilter::activeTargets() const //-------------------------------------------------------------------------------------------------- void RimPolygonFilter::insertTarget( const RimPolylineTarget* targetToInsertBefore, RimPolylineTarget* targetToInsert ) { - size_t index = m_targets.index( targetToInsertBefore ); + size_t index = m_targets.indexOf( targetToInsertBefore ); if ( index < m_targets.size() ) m_targets.insert( index, targetToInsert ); else diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp index 01b43f7bbf..ac44a05850 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbones.cpp @@ -160,7 +160,7 @@ QString RimFishbones::generatedName() const dynamic_cast*>( this->parentField() ); CVF_ASSERT( container ); - size_t index = container->index( this ) + 1; + size_t index = container->indexOf( this ) + 1; return QString( "Fishbone %1" ).arg( index ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index 0f1d993e06..f67942f23c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -247,7 +247,7 @@ size_t RimDepthTrackPlot::plotCount() const //-------------------------------------------------------------------------------------------------- size_t RimDepthTrackPlot::plotIndex( const RimWellLogTrack* plot ) const { - return m_plots.index( plot ); + return m_plots.indexOf( plot ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index a9e3b8d3a5..50f32ee20b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -308,7 +308,7 @@ size_t RimMultiPlot::plotCount() const //-------------------------------------------------------------------------------------------------- size_t RimMultiPlot::plotIndex( const RimPlot* plot ) const { - return m_plots.index( plot ); + return m_plots.indexOf( plot ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp index cac250edf3..475987b080 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp @@ -71,7 +71,7 @@ std::vector RimPressureTable::items() const //-------------------------------------------------------------------------------------------------- void RimPressureTable::insertItem( RimPressureTableItem* insertBefore, RimPressureTableItem* item ) { - size_t index = m_pressureTableItems.index( insertBefore ); + size_t index = m_pressureTableItems.indexOf( insertBefore ); item->changed.connect( this, &RimPressureTable::onTableChanged ); if ( index < m_pressureTableItems.size() ) m_pressureTableItems.insert( index, item ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp index c16095c038..252604cc72 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp @@ -513,7 +513,7 @@ void RimSurfaceCollection::deleteSubCollection( const QString& name ) auto coll = getSubCollection( name ); if ( coll ) { - auto index = m_subCollections.index( coll ); + auto index = m_subCollections.indexOf( coll ); m_subCollections.erase( index ); } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index a480312be5..12cdc83c27 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -1176,7 +1176,7 @@ void RimWellLogTrack::insertCurve( RimWellLogCurve* curve, size_t index ) //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::removeCurve( RimWellLogCurve* curve ) { - size_t index = m_curves.index( curve ); + size_t index = m_curves.indexOf( curve ); if ( index < m_curves.size() ) { m_curves[index]->detach(); @@ -2014,7 +2014,7 @@ caf::PdmFieldHandle* RimWellLogTrack::userDescriptionField() //-------------------------------------------------------------------------------------------------- size_t RimWellLogTrack::curveIndex( RimWellLogCurve* curve ) { - return m_curves.index( curve ); + return m_curves.indexOf( curve ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp index 84741e2120..92a0a2e96e 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp @@ -129,7 +129,7 @@ bool RimWellMeasurementCollection::isEmpty() const //-------------------------------------------------------------------------------------------------- void RimWellMeasurementCollection::insertMeasurement( RimWellMeasurement* insertBefore, RimWellMeasurement* measurement ) { - size_t index = m_measurements.index( insertBefore ); + size_t index = m_measurements.indexOf( insertBefore ); if ( index < m_measurements.size() ) m_measurements.insert( index, measurement ); else diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp index 58630e65db..a7aaf5d7bc 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp @@ -82,7 +82,7 @@ std::vector RimWellPathAttributeCollection::attributes() //-------------------------------------------------------------------------------------------------- void RimWellPathAttributeCollection::insertAttribute( RimWellPathAttribute* insertBefore, RimWellPathAttribute* attribute ) { - size_t index = m_attributes.index( insertBefore ); + size_t index = m_attributes.indexOf( insertBefore ); if ( index < m_attributes.size() ) m_attributes.insert( index, attribute ); else diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp index ff745c628d..3550448ab6 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp @@ -375,7 +375,7 @@ std::pair //-------------------------------------------------------------------------------------------------- void RimWellPathGeometryDef::insertTarget( const RimWellPathTarget* targetToInsertBefore, RimWellPathTarget* targetToInsert ) { - size_t index = m_wellTargets.index( targetToInsertBefore ); + size_t index = m_wellTargets.indexOf( targetToInsertBefore ); if ( index < m_wellTargets.size() ) m_wellTargets.insert( index, targetToInsert ); else diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.h index 999d252d9b..5096fbb95c 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.h @@ -69,6 +69,7 @@ class PdmChildArrayField : public PdmChildArrayFieldHandle void insertAt( int indexAfter, std::unique_ptr obj ); PdmObjectHandle* at( size_t index ) override; void setValue( const std::vector& objects ); + size_t indexOf( const PdmObjectHandle* obj ) const override; virtual void deleteAllChildObjectsAsync(); @@ -85,8 +86,7 @@ class PdmChildArrayField : public PdmChildArrayFieldHandle void insert( size_t indexAfter, const std::vector>& objects ); size_t count( const DataType* pointer ) const; - void erase( size_t index ) override; - size_t index( const DataType* pointer ) const; + void erase( size_t index ) override; typename std::vector>::iterator begin() { return m_pointers.begin(); }; typename std::vector>::iterator end() { return m_pointers.end(); }; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.inl index 181b078358..809ec65a20 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.inl @@ -138,6 +138,23 @@ size_t PdmChildArrayField::count( const DataType* pointer ) const return itemCount; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +template +size_t PdmChildArrayField::indexOf( const PdmObjectHandle* obj ) const +{ + for ( size_t i = 0; i < m_pointers.size(); ++i ) + { + if ( obj == m_pointers[i].rawPtr() ) + { + return i; + } + } + + return ( size_t )( -1 ); // Undefined size_t > m_pointers.size(); +} + //-------------------------------------------------------------------------------------------------- /// Empty the container without deleting the objects pointed to. //-------------------------------------------------------------------------------------------------- @@ -196,23 +213,6 @@ void PdmChildArrayField::erase( size_t index ) m_pointers.erase( m_pointers.begin() + index ); } -//-------------------------------------------------------------------------------------------------- -/// Get the index of the given object pointer -//-------------------------------------------------------------------------------------------------- -template -size_t PdmChildArrayField::index( const DataType* pointer ) const -{ - for ( size_t i = 0; i < m_pointers.size(); ++i ) - { - if ( pointer == m_pointers[i].p() ) - { - return i; - } - } - - return ( size_t )( -1 ); // Undefined size_t > m_pointers.size(); -} - //-------------------------------------------------------------------------------------------------- /// Assign objects to the field, replacing the current child objects //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldReorderCapability.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldReorderCapability.cpp index d37dbd832c..4a65433791 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldReorderCapability.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldReorderCapability.cpp @@ -189,3 +189,11 @@ PdmFieldReorderCapability* PdmFieldReorderCapability::reorderCapabilityOfParentC return nullptr; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t PdmFieldReorderCapability::indexOf( PdmObjectHandle* pdmObject ) +{ + return m_field->indexOf( pdmObject ); +} diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldReorderCapability.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldReorderCapability.h index 0b0c40cbdf..5365a513be 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldReorderCapability.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldReorderCapability.h @@ -51,6 +51,8 @@ class PdmFieldReorderCapability : public PdmFieldCapability, public SignalEmitte public: PdmFieldReorderCapability( PdmPtrArrayFieldHandle* field, bool giveOwnership ); + size_t indexOf( PdmObjectHandle* pdmObject ); + bool canItemBeMovedUp( size_t index ) const; bool canItemBeMovedDown( size_t index ) const; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.h index 69348fe8d8..5a49affe77 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.h @@ -50,11 +50,12 @@ class PdmPtrArrayField : public PdmPtrArrayFieldHandle // Reimplementation of PdmPointersFieldHandle methods - virtual size_t size() const { return m_pointers.size(); } - virtual bool empty() const { return m_pointers.empty(); } - virtual void clear(); - virtual void insertAt( int indexAfter, PdmObjectHandle* obj ); - virtual PdmObjectHandle* at( size_t index ); + size_t size() const override { return m_pointers.size(); } + bool empty() const override { return m_pointers.empty(); } + void clear() override; + void insertAt( int indexAfter, PdmObjectHandle* obj ) override; + PdmObjectHandle* at( size_t index ) override; + size_t indexOf( const PdmObjectHandle* obj ) const override; // std::vector-like access @@ -66,9 +67,8 @@ class PdmPtrArrayField : public PdmPtrArrayFieldHandle void insert( size_t indexAfter, const std::vector>& objects ); size_t count( const DataType* pointer ) const; - void erase( size_t index ); - size_t index( DataType* pointer ); - void removePtr( PdmObjectHandle* object ); + void erase( size_t index ) override; + void removePtr( PdmObjectHandle* object ); typename std::vector>::iterator begin() { return m_pointers.begin(); }; typename std::vector>::iterator end() { return m_pointers.end(); }; @@ -79,7 +79,7 @@ class PdmPtrArrayField : public PdmPtrArrayFieldHandle std::vector ptrReferencedObjects() const; // Child objects - virtual void ptrReferencedObjects( std::vector* ); + void ptrReferencedObjects( std::vector* ) override; private: // To be disabled PDM_DISABLE_COPY_AND_ASSIGN( PdmPtrArrayField ); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.inl index 7f4aa36950..c39224f50f 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.inl @@ -140,6 +140,23 @@ size_t PdmPtrArrayField::count( const DataType* pointer ) const return itemCount; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +template +size_t PdmPtrArrayField::indexOf( const PdmObjectHandle* obj ) const +{ + for ( size_t i = 0; i < m_pointers.size(); ++i ) + { + if ( obj == m_pointers[i].rawPtr() ) + { + return i; + } + } + + return ( size_t )( -1 ); // Undefined size_t > m_pointers.size(); +} + //-------------------------------------------------------------------------------------------------- /// Empty the container without deleting the objects pointed to. //-------------------------------------------------------------------------------------------------- @@ -170,23 +187,6 @@ void PdmPtrArrayField::erase( size_t index ) m_pointers.erase( m_pointers.begin() + index ); } -//-------------------------------------------------------------------------------------------------- -/// Get the index of the given object pointer -//-------------------------------------------------------------------------------------------------- -template -size_t PdmPtrArrayField::index( DataType* pointer ) -{ - for ( size_t i = 0; i < m_pointers.size(); ++i ) - { - if ( pointer == m_pointers[i].p() ) - { - return i; - } - } - - return ( size_t )( -1 ); // Undefined size_t > m_pointers.size(); -} - //-------------------------------------------------------------------------------------------------- /// Removes all instances of object pointer from the container without deleting the object. //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayFieldHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayFieldHandle.h index 4d6df4a82e..43d806be20 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayFieldHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayFieldHandle.h @@ -20,6 +20,7 @@ class PdmPtrArrayFieldHandle : public PdmFieldHandle virtual void clear() = 0; virtual void insertAt( int indexAfter, PdmObjectHandle* obj ) = 0; virtual void erase( size_t index ) = 0; + virtual size_t indexOf( const PdmObjectHandle* obj ) const = 0; virtual PdmObjectHandle* at( size_t index ) = 0; }; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp index 02bb00ee44..f9bacb62a0 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp @@ -605,12 +605,12 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& subRo if ( reorderability && filterIndex.row() >= 0 && selection.size() == 1u && selection.front() == uiItem ) { - size_t indexInParent = static_cast( filterIndex.row() ); + size_t indexInParentField = reorderability->indexOf( pdmObject ); { auto tag = PdmUiTreeViewItemAttribute::Tag::create(); tag->icon = caf::IconProvider( ":/caf/Up16x16.png" ); tag->selectedOnly = true; - if ( reorderability->canItemBeMovedUp( indexInParent ) ) + if ( reorderability->canItemBeMovedUp( indexInParentField ) ) { tag->clicked.connect( reorderability, &PdmFieldReorderCapability::onMoveItemUp ); } @@ -625,7 +625,7 @@ void PdmUiTreeViewEditor::updateItemDelegateForSubTree( const QModelIndex& subRo auto tag = PdmUiTreeViewItemAttribute::Tag::create(); tag->icon = IconProvider( ":/caf/Down16x16.png" ); tag->selectedOnly = true; - if ( reorderability->canItemBeMovedDown( indexInParent ) ) + if ( reorderability->canItemBeMovedDown( indexInParentField ) ) { tag->clicked.connect( reorderability, &PdmFieldReorderCapability::onMoveItemDown ); } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp index 1b9c23c29e..e98e8c841f 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp @@ -268,22 +268,34 @@ bool PdmUiTreeViewItemDelegate::editorEvent( QEvent* event, { if ( event->type() == QEvent::MouseButtonPress ) { - QMouseEvent* mouseEvent = static_cast( event ); - + auto* mouseEvent = static_cast( event ); if ( mouseEvent->button() == Qt::LeftButton && mouseEvent->modifiers() == Qt::NoModifier ) { const PdmUiTreeViewItemAttribute::Tag* tag; if ( tagClicked( mouseEvent->pos(), option.rect, itemIndex, &tag ) ) { - QModelIndex parentIndex = itemIndex.parent(); - - auto uiItem = m_treeView->uiItemFromModelIndex( itemIndex ); + auto uiItem = m_treeView->uiItemFromModelIndex( itemIndex ); + + auto* uiObjectHandle = dynamic_cast( uiItem ); + if ( uiObjectHandle ) + { + PdmObjectHandle* pdmObject = uiObjectHandle->objectHandle(); + if ( pdmObject ) + { + PdmFieldReorderCapability* reorderability = + PdmFieldReorderCapability::reorderCapabilityOfParentContainer( pdmObject ); + + size_t indexInParent = reorderability->indexOf( pdmObject ); + tag->clicked.send( indexInParent ); + } + } + + auto parentIndex = itemIndex.parent(); auto parentUiItem = m_treeView->uiItemFromModelIndex( parentIndex ); - tag->clicked.send( (size_t)itemIndex.row() ); - m_treeView->updateSubTree( parentUiItem ); m_treeView->selectAsCurrentItem( uiItem ); + return true; } } From 74ace7ea44b054540ed1de2fb86e4782e98a4871 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 6 May 2022 12:09:55 +0200 Subject: [PATCH 277/406] Summary Multi Plot : Improve default behaviour (#8885) * Summary Multi Plot : Improve default behaviour - Perform zoom when stepping to next item - Set defaults for range aggregation and source stepping dimension based on content when creating a multi summary plot * Plot Axis Appearance : Do not use bold for text configuration * Improve how scale factor for legend values are computed * Improve defaults for range aggregation and step dimension * Reorder Capability : Get UI item before reordering is issued Get UI item before reordering is issued, as this operation will invalidate the tree model --- .../RicSummaryPlotBuilder.cpp | 19 +++--- .../RimPlotAxisProperties.cpp | 20 ++++-- .../Summary/RimSummaryMultiPlot.cpp | 62 +++++++++++++++++++ .../Summary/RimSummaryMultiPlot.h | 1 + .../Summary/RimSummaryPlotAxisFormatter.cpp | 4 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 9 +++ .../Summary/RimSummaryPlotSourceStepping.h | 1 + .../cafPdmUiTreeViewItemDelegate.cpp | 7 +-- 8 files changed, 104 insertions(+), 19 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 144f64a4b4..4c6253cef5 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -453,15 +453,18 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con RimProject* project = RimProject::current(); auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); - auto* plotWindow = new RimSummaryMultiPlot(); - plotWindow->setAsPlotMdiWindow(); - plotCollection->addSummaryMultiPlot( plotWindow ); + auto* summaryMultiPlot = new RimSummaryMultiPlot(); + summaryMultiPlot->setAsPlotMdiWindow(); + plotCollection->addSummaryMultiPlot( summaryMultiPlot ); + + appendPlotsToSummaryMultiPlot( summaryMultiPlot, plots ); - appendPlotsToSummaryMultiPlot( plotWindow, plots ); + summaryMultiPlot->setDefaultRangeAggregationSteppingDimension(); + summaryMultiPlot->zoomAll(); plotCollection->updateAllRequiredEditors(); - plotWindow->loadDataAndUpdate(); - plotWindow->updateAllRequiredEditors(); + summaryMultiPlot->loadDataAndUpdate(); + summaryMultiPlot->updateAllRequiredEditors(); if ( !plots.empty() ) { @@ -469,10 +472,10 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con } else { - RiuPlotMainWindowTools::selectAsCurrentItem( plotWindow ); + RiuPlotMainWindowTools::selectAsCurrentItem( summaryMultiPlot ); } - return plotWindow; + return summaryMultiPlot; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 680cc82bb1..2cc7f863d7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -452,17 +452,25 @@ void RimPlotAxisProperties::setVisible( bool visible ) //-------------------------------------------------------------------------------------------------- void RimPlotAxisProperties::computeAndSetScaleFactor() { - int exponent = std::log10( visibleRangeMax() ); + auto maxAbsValue = std::max( std::fabs( visibleRangeMax() ), std::fabs( visibleRangeMin() ) ); - while ( exponent > 0 && ( exponent % 3 ) != 0 ) + int exponent = std::floor( std::log10( maxAbsValue ) ); + if ( exponent > 0 ) { - exponent--; + while ( exponent > -20 && ( exponent % 3 ) != 0 ) + { + exponent--; + } } - - if ( exponent > 0 ) + else { - scaleFactor = std::pow( 10, exponent ); + while ( exponent < 1 && ( exponent % 3 ) != 0 ) + { + exponent++; + } } + + scaleFactor = std::pow( 10, exponent ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index f2fd55e5ab..5cc888b2d5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -639,6 +639,68 @@ void RimSummaryMultiPlot::zoomAll() syncAxisRanges(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::setDefaultRangeAggregationSteppingDimension() +{ + RiaSummaryAddressAnalyzer analyzer; + + for ( auto p : summaryPlots() ) + { + auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( p ); + analyzer.appendAddresses( addresses ); + } + + auto rangeAggregation = AxisRangeAggregation::SUB_PLOTS; + + if ( !analyzer.wellNames().empty() ) + { + rangeAggregation = AxisRangeAggregation::WELLS; + } + else if ( !analyzer.groupNames().empty() ) + { + rangeAggregation = AxisRangeAggregation::SUB_PLOTS; + } + else if ( !analyzer.regionNumbers().empty() ) + { + rangeAggregation = AxisRangeAggregation::REGIONS; + } + else if ( !analyzer.aquifers().empty() ) + { + rangeAggregation = AxisRangeAggregation::SUB_PLOTS; + } + else if ( !analyzer.blocks().empty() ) + { + rangeAggregation = AxisRangeAggregation::SUB_PLOTS; + } + + auto stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::QUANTITY; + if ( analyzer.wellNames().size() == 1 ) + { + stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::WELL; + } + else if ( analyzer.groupNames().size() == 1 ) + { + stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::GROUP; + } + else if ( analyzer.regionNumbers().size() == 1 ) + { + stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::REGION; + } + else if ( analyzer.aquifers().size() == 1 ) + { + stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::AQUIFER; + } + else if ( analyzer.blocks().size() == 1 ) + { + stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::BLOCK; + } + + m_axisRangeAggregation = rangeAggregation; + m_sourceStepping->setStepDimension( stepDimension ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 0ed590c1fb..8a3c734a1d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -101,6 +101,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void zoomAll() override; + void setDefaultRangeAggregationSteppingDimension(); void checkAndApplyAutoAppearance(); void keepVisiblePageAfterUpdate( bool keepPage ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index 1806c3dc13..ad9eb910dc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -132,10 +132,12 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot m_axisProperties->setNameAndAxis( axisTitle, axis.axis(), axis.index() ); plotWidget->setAxisTitleText( axis, axisTitle ); + + bool titleBold = false; plotWidget->setAxisFontsAndAlignment( axis, m_axisProperties->titleFontSize(), m_axisProperties->valuesFontSize(), - true, + titleBold, titleAlignment ); plotWidget->setAxisTitleEnabled( axis, true ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index ae444d369a..00ebbba2d8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -517,6 +517,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* { summaryMultiPlot->updatePlots(); summaryMultiPlot->updatePlotWindowTitle(); + summaryMultiPlot->zoomAll(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); mainPlotWindow->updateMultiPlotToolBar(); } @@ -1214,6 +1215,14 @@ RimSummaryPlotSourceStepping::SourceSteppingDimension RimSummaryPlotSourceSteppi return m_stepDimension(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlotSourceStepping::setStepDimension( SourceSteppingDimension dimension ) +{ + m_stepDimension = dimension; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index 0df92a707f..26d6d89a04 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -74,6 +74,7 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject void syncWithStepper( RimSummaryPlotSourceStepping* other ); RimSummaryPlotSourceStepping::SourceSteppingDimension stepDimension() const; + void setStepDimension( RimSummaryPlotSourceStepping::SourceSteppingDimension dimension ); void updateStepIndex( int direction ); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp index e98e8c841f..60ac1d5921 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp @@ -274,7 +274,9 @@ bool PdmUiTreeViewItemDelegate::editorEvent( QEvent* event, const PdmUiTreeViewItemAttribute::Tag* tag; if ( tagClicked( mouseEvent->pos(), option.rect, itemIndex, &tag ) ) { - auto uiItem = m_treeView->uiItemFromModelIndex( itemIndex ); + auto uiItem = m_treeView->uiItemFromModelIndex( itemIndex ); + auto parentIndex = itemIndex.parent(); + auto parentUiItem = m_treeView->uiItemFromModelIndex( parentIndex ); auto* uiObjectHandle = dynamic_cast( uiItem ); if ( uiObjectHandle ) @@ -290,9 +292,6 @@ bool PdmUiTreeViewItemDelegate::editorEvent( QEvent* event, } } - auto parentIndex = itemIndex.parent(); - auto parentUiItem = m_treeView->uiItemFromModelIndex( parentIndex ); - m_treeView->updateSubTree( parentUiItem ); m_treeView->selectAsCurrentItem( uiItem ); From 621100f0cfbd8a431ee9104085dad420ce1ca253 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 6 May 2022 16:38:41 +0200 Subject: [PATCH 278/406] Bump version --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 9ab0682608..eb5f48ac56 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".02") +set(RESINSIGHT_DEV_VERSION ".03") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 4304bbbc480c62557ea58afcac18d58e345f23a8 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 22 Apr 2022 12:18:34 +0200 Subject: [PATCH 279/406] Grid Calculator: refactor summary curve calculator and add grid calculator. --- .../Application/Tools/RiaSummaryTools.cpp | 12 +- .../Commands/CMakeLists_files.cmake | 15 + ...tor.cpp => RicCalculatorWidgetCreator.cpp} | 34 +- ...Creator.h => RicCalculatorWidgetCreator.h} | 12 +- .../Commands/RicGridCalculatorDialog.cpp | 83 ++++ .../Commands/RicGridCalculatorDialog.h | 46 +++ .../Commands/RicGridCalculatorUi.cpp | 64 +++ .../Commands/RicGridCalculatorUi.h | 39 ++ .../Commands/RicReplaceSummaryCaseFeature.cpp | 29 +- .../Commands/RicReplaceSummaryCaseFeature.h | 6 +- .../Commands/RicShowGridCalculatorFeature.cpp | 94 +++++ .../Commands/RicShowGridCalculatorFeature.h | 40 ++ .../RicUserDefinedCalculatorDialog.cpp | 131 ++++++ .../Commands/RicUserDefinedCalculatorDialog.h | 49 +++ .../Commands/RicUserDefinedCalculatorUi.cpp | 260 ++++++++++++ .../Commands/RicUserDefinedCalculatorUi.h | 73 ++++ .../CMakeLists_files.cmake | 3 - .../RicEditSummaryCurveCalculationFeature.cpp | 2 +- .../RicShowSummaryCurveCalculatorFeature.cpp | 2 +- .../RicSummaryCurveCalculatorDialog.cpp | 98 +---- .../RicSummaryCurveCalculatorDialog.h | 22 +- .../RicSummaryCurveCalculatorUi.cpp | 246 +---------- .../RicSummaryCurveCalculatorUi.h | 48 +-- .../ProjectDataModel/CMakeLists_files.cmake | 12 + .../RimContextCommandBuilder.cpp | 1 + .../ProjectDataModel/RimGridCalculation.cpp | 177 ++++++++ .../ProjectDataModel/RimGridCalculation.h | 40 ++ .../RimGridCalculationCollection.cpp | 57 +++ .../RimGridCalculationCollection.h | 48 +++ .../RimGridCalculationVariable.cpp | 204 ++++++++++ .../RimGridCalculationVariable.h | 67 +++ .../ProjectDataModel/RimProject.cpp | 23 +- .../ProjectDataModel/RimProject.h | 4 +- .../RimSummaryCalculation.cpp | 341 +--------------- .../ProjectDataModel/RimSummaryCalculation.h | 66 +-- .../RimSummaryCalculationCollection.cpp | 112 +---- .../RimSummaryCalculationCollection.h | 20 +- .../RimSummaryCalculationVariable.cpp | 28 +- .../RimSummaryCalculationVariable.h | 14 +- .../RimUserDefinedCalculation.cpp | 382 ++++++++++++++++++ .../RimUserDefinedCalculation.h | 101 +++++ .../RimUserDefinedCalculationCollection.cpp | 172 ++++++++ .../RimUserDefinedCalculationCollection.h | 56 +++ .../RimUserDefinedCalculationVariable.cpp | 53 +++ .../RimUserDefinedCalculationVariable.h | 46 +++ .../RimCalculatedSummaryCurveReader.cpp | 4 +- .../Summary/RimSummaryAddress.cpp | 2 +- .../Summary/RimSummaryCurveAutoName.cpp | 2 +- .../RiuCalculationsContextMenuManager.cpp | 23 +- .../RiuCalculationsContextMenuManager.h | 9 +- .../UserInterface/RiuMainWindow.cpp | 15 + .../UserInterface/RiuMainWindow.h | 13 +- 52 files changed, 2489 insertions(+), 1011 deletions(-) rename ApplicationLibCode/Commands/{SummaryPlotCommands/RicSummaryCurveCalculatorWidgetCreator.cpp => RicCalculatorWidgetCreator.cpp} (85%) rename ApplicationLibCode/Commands/{SummaryPlotCommands/RicSummaryCurveCalculatorWidgetCreator.h => RicCalculatorWidgetCreator.h} (84%) create mode 100644 ApplicationLibCode/Commands/RicGridCalculatorDialog.cpp create mode 100644 ApplicationLibCode/Commands/RicGridCalculatorDialog.h create mode 100644 ApplicationLibCode/Commands/RicGridCalculatorUi.cpp create mode 100644 ApplicationLibCode/Commands/RicGridCalculatorUi.h create mode 100644 ApplicationLibCode/Commands/RicShowGridCalculatorFeature.cpp create mode 100644 ApplicationLibCode/Commands/RicShowGridCalculatorFeature.h create mode 100644 ApplicationLibCode/Commands/RicUserDefinedCalculatorDialog.cpp create mode 100644 ApplicationLibCode/Commands/RicUserDefinedCalculatorDialog.h create mode 100644 ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp create mode 100644 ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.h create mode 100644 ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimGridCalculation.h create mode 100644 ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.h create mode 100644 ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h create mode 100644 ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h create mode 100644 ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.h create mode 100644 ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationVariable.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationVariable.h diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp index 2c98c62b70..2de0eff873 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp @@ -226,13 +226,17 @@ void RiaSummaryTools::getSummaryCasesAndAddressesForCalculation( int RimSummaryCalculationCollection* calculationColl = proj->calculationCollection(); if ( !calculationColl ) return; - RimSummaryCalculation* calculation = calculationColl->findCalculationById( id ); + RimUserDefinedCalculation* calculation = calculationColl->findCalculationById( id ); if ( !calculation ) return; - for ( RimSummaryCalculationVariable* v : calculation->allVariables() ) + for ( RimUserDefinedCalculationVariable* v : calculation->allVariables() ) { - cases.push_back( v->summaryCase() ); - addresses.push_back( v->summaryAddress()->address() ); + RimSummaryCalculationVariable* scv = dynamic_cast( v ); + if ( scv ) + { + cases.push_back( scv->summaryCase() ); + addresses.push_back( scv->summaryAddress()->address() ); + } } } diff --git a/ApplicationLibCode/Commands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/CMakeLists_files.cmake index deaa0ca249..0ff286f503 100644 --- a/ApplicationLibCode/Commands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/CMakeLists_files.cmake @@ -78,6 +78,12 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicCreateEnsembleWellLogUi.h ${CMAKE_CURRENT_LIST_DIR}/RicCreateSurfaceIntersectionBandFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicCreateSurfaceIntersectionCurveFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicShowGridCalculatorFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorDialog.h + ${CMAKE_CURRENT_LIST_DIR}/RicGridCalculatorDialog.h + ${CMAKE_CURRENT_LIST_DIR}/RicGridCalculatorUi.h + ${CMAKE_CURRENT_LIST_DIR}/RicCalculatorWidgetCreator.h + ${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorUi.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -159,6 +165,12 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicCreateEnsembleWellLogUi.cpp ${CMAKE_CURRENT_LIST_DIR}/RicCreateSurfaceIntersectionBandFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicCreateSurfaceIntersectionCurveFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicShowGridCalculatorFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorDialog.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicGridCalculatorDialog.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicGridCalculatorUi.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicCalculatorWidgetCreator.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorUi.cpp ) if(RESINSIGHT_USE_QT_CHARTS) @@ -185,6 +197,9 @@ list( ${CMAKE_CURRENT_LIST_DIR}/RicRecursiveFileSearchDialog.h ${CMAKE_CURRENT_LIST_DIR}/RicSummaryCaseRestartDialog.h ${CMAKE_CURRENT_LIST_DIR}/RicResampleDialog.h + ${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorDialog.h + ${CMAKE_CURRENT_LIST_DIR}/RicGridCalculatorDialog.h + ${CMAKE_CURRENT_LIST_DIR}/RicCalculatorWidgetCreator.h ) source_group( diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorWidgetCreator.cpp b/ApplicationLibCode/Commands/RicCalculatorWidgetCreator.cpp similarity index 85% rename from ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorWidgetCreator.cpp rename to ApplicationLibCode/Commands/RicCalculatorWidgetCreator.cpp index 97a3bc6b6e..704f63c887 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorWidgetCreator.cpp +++ b/ApplicationLibCode/Commands/RicCalculatorWidgetCreator.cpp @@ -16,10 +16,11 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RicSummaryCurveCalculatorWidgetCreator.h" +#include "RicCalculatorWidgetCreator.h" -#include "RicSummaryCurveCalculatorUi.h" -#include "RimSummaryCalculation.h" +#include "RimUserDefinedCalculation.h" + +#include "RicUserDefinedCalculatorUi.h" #include "cafPdmUiTableView.h" @@ -34,18 +35,17 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RicSummaryCurveCalculatorWidgetCreator::RicSummaryCurveCalculatorWidgetCreator() +RicCalculatorWidgetCreator::RicCalculatorWidgetCreator( std::unique_ptr calculator ) : m_pdmTableView( nullptr ) { - m_calculator = std::unique_ptr( new RicSummaryCurveCalculatorUi ); - + m_calculator = std::move( calculator ); this->setPdmObject( m_calculator.get() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RicSummaryCurveCalculatorWidgetCreator::~RicSummaryCurveCalculatorWidgetCreator() +RicCalculatorWidgetCreator::~RicCalculatorWidgetCreator() { if ( m_pdmTableView ) { @@ -61,9 +61,8 @@ RicSummaryCurveCalculatorWidgetCreator::~RicSummaryCurveCalculatorWidgetCreator( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorWidgetCreator::recursivelyConfigureAndUpdateTopLevelUiOrdering( - const caf::PdmUiOrdering& topLevelUiOrdering, - const QString& uiConfigName ) +void RicCalculatorWidgetCreator::recursivelyConfigureAndUpdateTopLevelUiOrdering( const caf::PdmUiOrdering& topLevelUiOrdering, + const QString& uiConfigName ) { if ( !m_firstRowLeftLayout || !m_firstRowRightLayout ) return; @@ -79,11 +78,11 @@ void RicSummaryCurveCalculatorWidgetCreator::recursivelyConfigureAndUpdateTopLev caf::PdmUiGroup* group = static_cast( topLevelUiItems[i] ); auto groupBox = updateGroupBoxWithContent( group, uiConfigName ); - if ( group->keyword() == RicSummaryCurveCalculatorUi::calculatedSummariesGroupName() ) + if ( group->keyword() == m_calculator->calculationsGroupName() ) { m_firstRowLeftLayout->addWidget( groupBox ); } - else if ( group->keyword() == RicSummaryCurveCalculatorUi::calulationGroupName() ) + else if ( group->keyword() == m_calculator->calulationGroupName() ) { m_firstRowRightLayout->insertWidget( layoutItemIndex++, groupBox ); } @@ -117,7 +116,7 @@ void RicSummaryCurveCalculatorWidgetCreator::recursivelyConfigureAndUpdateTopLev //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QWidget* RicSummaryCurveCalculatorWidgetCreator::createWidget( QWidget* parent ) +QWidget* RicCalculatorWidgetCreator::createWidget( QWidget* parent ) { m_pdmTableView = new caf::PdmUiTableView( parent ); m_pdmTableView->tableView()->setSelectionMode( QAbstractItemView::ExtendedSelection ); @@ -182,8 +181,7 @@ QWidget* RicSummaryCurveCalculatorWidgetCreator::createWidget( QWidget* parent ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QMinimizePanel* RicSummaryCurveCalculatorWidgetCreator::updateGroupBoxWithContent( caf::PdmUiGroup* group, - const QString& uiConfigName ) +QMinimizePanel* RicCalculatorWidgetCreator::updateGroupBoxWithContent( caf::PdmUiGroup* group, const QString& uiConfigName ) { QMinimizePanel* groupBox = findOrCreateGroupBox( this->widget(), group, uiConfigName ); @@ -194,7 +192,7 @@ QMinimizePanel* RicSummaryCurveCalculatorWidgetCreator::updateGroupBoxWithConten //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RicSummaryCurveCalculatorUi* RicSummaryCurveCalculatorWidgetCreator::calculator() const +RicUserDefinedCalculatorUi* RicCalculatorWidgetCreator::calculator() const { return m_calculator.get(); } @@ -202,7 +200,7 @@ RicSummaryCurveCalculatorUi* RicSummaryCurveCalculatorWidgetCreator::calculator( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorWidgetCreator::slotCalculate() +void RicCalculatorWidgetCreator::slotCalculate() { m_calculator->calculate(); @@ -212,7 +210,7 @@ void RicSummaryCurveCalculatorWidgetCreator::slotCalculate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorWidgetCreator::slotParseExpression() +void RicCalculatorWidgetCreator::slotParseExpression() { m_calculator->parseExpression(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorWidgetCreator.h b/ApplicationLibCode/Commands/RicCalculatorWidgetCreator.h similarity index 84% rename from ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorWidgetCreator.h rename to ApplicationLibCode/Commands/RicCalculatorWidgetCreator.h index 6353b41d7d..a13f7676b2 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorWidgetCreator.h +++ b/ApplicationLibCode/Commands/RicCalculatorWidgetCreator.h @@ -23,7 +23,7 @@ #include #include -class RicSummaryCurveCalculatorUi; +class RicUserDefinedCalculatorUi; class QMinimizePanel; class QString; @@ -41,15 +41,15 @@ class PdmUiTableView; /// /// //================================================================================================== -class RicSummaryCurveCalculatorWidgetCreator : public caf::PdmUiFormLayoutObjectEditor +class RicCalculatorWidgetCreator : public caf::PdmUiFormLayoutObjectEditor { Q_OBJECT public: - RicSummaryCurveCalculatorWidgetCreator(); - ~RicSummaryCurveCalculatorWidgetCreator() override; + RicCalculatorWidgetCreator( std::unique_ptr calculator ); + ~RicCalculatorWidgetCreator() override; - RicSummaryCurveCalculatorUi* calculator() const; + RicUserDefinedCalculatorUi* calculator() const; private: void recursivelyConfigureAndUpdateTopLevelUiOrdering( const caf::PdmUiOrdering& topLevelUiItems, @@ -72,5 +72,5 @@ private slots: caf::PdmUiTableView* m_pdmTableView; - std::unique_ptr m_calculator; + std::unique_ptr m_calculator; }; diff --git a/ApplicationLibCode/Commands/RicGridCalculatorDialog.cpp b/ApplicationLibCode/Commands/RicGridCalculatorDialog.cpp new file mode 100644 index 0000000000..674f957ca0 --- /dev/null +++ b/ApplicationLibCode/Commands/RicGridCalculatorDialog.cpp @@ -0,0 +1,83 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicGridCalculatorDialog.h" + +#include "RicCalculatorWidgetCreator.h" +#include "RicGridCalculatorUi.h" + +#include "RimGridCalculation.h" +#include "RimGridCalculationCollection.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicGridCalculatorDialog::RicGridCalculatorDialog( QWidget* parent ) + : RicUserDefinedCalculatorDialog( parent, "Grid Calculator" ) +{ + setUp(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicGridCalculatorDialog::~RicGridCalculatorDialog() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicGridCalculatorDialog::setCalculationAndUpdateUi( RimUserDefinedCalculation* calculation ) +{ + CAF_ASSERT( m_calcEditor ); + m_calcEditor->calculator()->setCurrentCalculation( calculation ); + updateUi(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicGridCalculatorDialog::updateUi() +{ + CAF_ASSERT( m_calcEditor ); + m_calcEditor->updateUi(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimUserDefinedCalculationCollection* RicGridCalculatorDialog::calculationCollection() const +{ + CAF_ASSERT( m_calcEditor ); + return m_calcEditor->calculator()->calculationCollection(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* RicGridCalculatorDialog::getCalculatorWidget() +{ + if ( !m_calcEditor ) + { + m_calcEditor = std::unique_ptr( + new RicCalculatorWidgetCreator( std::make_unique() ) ); + } + + return m_calcEditor->getOrCreateWidget( this ); +} diff --git a/ApplicationLibCode/Commands/RicGridCalculatorDialog.h b/ApplicationLibCode/Commands/RicGridCalculatorDialog.h new file mode 100644 index 0000000000..843b2bf31d --- /dev/null +++ b/ApplicationLibCode/Commands/RicGridCalculatorDialog.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RicUserDefinedCalculatorDialog.h" + +#include + +class RicCalculatorWidgetCreator; + +//================================================================================================== +/// +/// +//================================================================================================== +class RicGridCalculatorDialog : public RicUserDefinedCalculatorDialog +{ + Q_OBJECT + +public: + RicGridCalculatorDialog( QWidget* parent ); + ~RicGridCalculatorDialog() override; + + void setCalculationAndUpdateUi( RimUserDefinedCalculation* calculation ) override; + QWidget* getCalculatorWidget() override; + void updateUi() override; + RimUserDefinedCalculationCollection* calculationCollection() const override; + +private: + std::unique_ptr m_calcEditor; +}; diff --git a/ApplicationLibCode/Commands/RicGridCalculatorUi.cpp b/ApplicationLibCode/Commands/RicGridCalculatorUi.cpp new file mode 100644 index 0000000000..de33f232cc --- /dev/null +++ b/ApplicationLibCode/Commands/RicGridCalculatorUi.cpp @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicGridCalculatorUi.h" + +#include "RimGridCalculationCollection.h" +#include "RimProject.h" +#include "RimUserDefinedCalculationCollection.h" + +CAF_PDM_SOURCE_INIT( RicGridCalculatorUi, "RicGridCalculator" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicGridCalculatorUi::RicGridCalculatorUi() +{ + CAF_PDM_InitObject( "RicGridCalculator" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicGridCalculatorUi::calculationsGroupName() const +{ + return "CalculationsGroupName"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicGridCalculatorUi::calulationGroupName() const +{ + return "CalulationGroupName"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicGridCalculatorUi::notifyCalculatedNameChanged( int id, const QString& newName ) const +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimUserDefinedCalculationCollection* RicGridCalculatorUi::calculationCollection() const +{ + return RimProject::current()->gridCalculationCollection(); +} diff --git a/ApplicationLibCode/Commands/RicGridCalculatorUi.h b/ApplicationLibCode/Commands/RicGridCalculatorUi.h new file mode 100644 index 0000000000..7798a8ee95 --- /dev/null +++ b/ApplicationLibCode/Commands/RicGridCalculatorUi.h @@ -0,0 +1,39 @@ +//////////////////////////// ///////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RicUserDefinedCalculatorUi.h" + +class RimUserDefinedCalculationCollection; + +//================================================================================================== +/// +//================================================================================================== +class RicGridCalculatorUi : public RicUserDefinedCalculatorUi +{ + CAF_PDM_HEADER_INIT; + +public: + RicGridCalculatorUi(); + + QString calculationsGroupName() const override; + QString calulationGroupName() const override; + RimUserDefinedCalculationCollection* calculationCollection() const override; + void notifyCalculatedNameChanged( int id, const QString& newName ) const override; +}; diff --git a/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp index 05608306a3..ccf9682db9 100644 --- a/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.cpp @@ -54,7 +54,7 @@ void RicReplaceSummaryCaseFeature::updateRequredCalculatedCurves( RimSummaryCase { RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection(); - for ( RimSummaryCalculation* summaryCalculation : calcColl->calculations() ) + for ( RimUserDefinedCalculation* summaryCalculation : calcColl->calculations() ) { bool needsUpdate = RicReplaceSummaryCaseFeature::checkIfCalculationNeedsUpdate( summaryCalculation, sourceSummaryCase ); @@ -62,7 +62,7 @@ void RicReplaceSummaryCaseFeature::updateRequredCalculatedCurves( RimSummaryCase { summaryCalculation->parseExpression(); summaryCalculation->calculate(); - summaryCalculation->updateDependentCurvesAndPlots(); + summaryCalculation->updateDependentObjects(); } } } @@ -102,7 +102,7 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked ) // Find and update all changed calculations std::set ids; RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection(); - for ( RimSummaryCalculation* summaryCalculation : calcColl->calculations() ) + for ( RimUserDefinedCalculation* summaryCalculation : calcColl->calculations() ) { bool needsUpdate = checkIfCalculationNeedsUpdate( summaryCalculation, summaryCase ); if ( needsUpdate ) @@ -126,8 +126,8 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked ) { if ( calcColl ) { - RimSummaryCalculation* calculation = calcColl->findCalculationById( summaryAddressY.id() ); - QString description = calculation->description(); + RimUserDefinedCalculation* calculation = calcColl->findCalculationById( summaryAddressY.id() ); + QString description = calculation->description(); RifEclipseSummaryAddress updatedAdr = RifEclipseSummaryAddress::calculatedAddress( description.toStdString(), calculation->id() ); @@ -154,8 +154,8 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked ) { if ( calcColl ) { - RimSummaryCalculation* calculation = calcColl->findCalculationById( summaryAddressX.id() ); - QString description = calculation->description(); + RimUserDefinedCalculation* calculation = calcColl->findCalculationById( summaryAddressX.id() ); + QString description = calculation->description(); RifEclipseSummaryAddress updatedAdr = RifEclipseSummaryAddress::calculatedAddress( description.toStdString(), calculation->id() ); @@ -170,8 +170,8 @@ void RicReplaceSummaryCaseFeature::onActionTriggered( bool isChecked ) { if ( calcColl ) { - RimSummaryCalculation* calculation = calcColl->findCalculationById( summaryAddressX.id() ); - QString description = calculation->description(); + RimUserDefinedCalculation* calculation = calcColl->findCalculationById( summaryAddressX.id() ); + QString description = calculation->description(); RifEclipseSummaryAddress updatedAdr = RifEclipseSummaryAddress::calculatedAddress( description.toStdString(), calculation->id() ); @@ -197,13 +197,14 @@ void RicReplaceSummaryCaseFeature::setupActionLook( QAction* actionToSetup ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RicReplaceSummaryCaseFeature::checkIfCalculationNeedsUpdate( const RimSummaryCalculation* summaryCalculation, - const RimSummaryCase* summaryCase ) +bool RicReplaceSummaryCaseFeature::checkIfCalculationNeedsUpdate( const RimUserDefinedCalculation* summaryCalculation, + const RimSummaryCase* summaryCase ) { - std::vector variables = summaryCalculation->allVariables(); - for ( RimSummaryCalculationVariable* variable : variables ) + std::vector variables = summaryCalculation->allVariables(); + for ( RimUserDefinedCalculationVariable* variable : variables ) { - if ( variable->summaryCase() == summaryCase ) + RimSummaryCalculationVariable* summaryVariable = dynamic_cast( variable ); + if ( summaryVariable->summaryCase() == summaryCase ) { return true; } diff --git a/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.h b/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.h index 5f16574a1e..085e23077f 100644 --- a/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.h +++ b/ApplicationLibCode/Commands/RicReplaceSummaryCaseFeature.h @@ -20,7 +20,7 @@ #include "cafCmdFeature.h" -class RimSummaryCalculation; +class RimUserDefinedCalculation; class RimSummaryCase; class RicReplaceSummaryCaseFeature : public caf::CmdFeature @@ -35,6 +35,6 @@ class RicReplaceSummaryCaseFeature : public caf::CmdFeature void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; - static bool checkIfCalculationNeedsUpdate( const RimSummaryCalculation* summaryCalculation, - const RimSummaryCase* summaryCase ); + static bool checkIfCalculationNeedsUpdate( const RimUserDefinedCalculation* summaryCalculation, + const RimSummaryCase* summaryCase ); }; diff --git a/ApplicationLibCode/Commands/RicShowGridCalculatorFeature.cpp b/ApplicationLibCode/Commands/RicShowGridCalculatorFeature.cpp new file mode 100644 index 0000000000..4201777c4e --- /dev/null +++ b/ApplicationLibCode/Commands/RicShowGridCalculatorFeature.cpp @@ -0,0 +1,94 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicShowGridCalculatorFeature.h" + +#include "RicGridCalculatorDialog.h" + +#include "RiaGuiApplication.h" + +#include "RimGridCalculationCollection.h" +#include "RimProject.h" +#include "RimSummaryCalculationCollection.h" + +#include "RiuMainWindow.h" + +#include + +CAF_CMD_SOURCE_INIT( RicShowGridCalculatorFeature, "RicShowGridCalculatorFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicGridCalculatorDialog* RicShowGridCalculatorFeature::gridCalculatorDialog( bool createIfNotPresent ) +{ + RiuMainWindow* mainWindow = RiaGuiApplication::instance()->mainWindow(); + + if ( mainWindow ) + { + return mainWindow->gridCalculatorDialog( createIfNotPresent ); + } + + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicShowGridCalculatorFeature::hideGridCalculatorDialog() +{ + auto dialog = RicShowGridCalculatorFeature::gridCalculatorDialog( false ); + if ( dialog ) dialog->hide(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicShowGridCalculatorFeature::isCommandEnabled() +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicShowGridCalculatorFeature::onActionTriggered( bool isChecked ) +{ + RicGridCalculatorDialog* dialog = RicShowGridCalculatorFeature::gridCalculatorDialog( true ); + + RimProject* proj = RimProject::current(); + RimGridCalculationCollection* calcColl = proj->gridCalculationCollection(); + if ( calcColl->calculations().empty() ) + { + calcColl->addCalculation(); + } + + dialog->setCalculationAndUpdateUi( calcColl->calculations()[0] ); + + dialog->show(); + dialog->raise(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicShowGridCalculatorFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Grid Calculator" ); + actionToSetup->setIcon( QIcon( ":/Calculator.svg" ) ); +} diff --git a/ApplicationLibCode/Commands/RicShowGridCalculatorFeature.h b/ApplicationLibCode/Commands/RicShowGridCalculatorFeature.h new file mode 100644 index 0000000000..5d0d977cf3 --- /dev/null +++ b/ApplicationLibCode/Commands/RicShowGridCalculatorFeature.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +class RicGridCalculatorDialog; + +//================================================================================================== +/// +//================================================================================================== +class RicShowGridCalculatorFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +public: + static RicGridCalculatorDialog* gridCalculatorDialog( bool createIfNotPresent ); + static void hideGridCalculatorDialog(); + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/RicUserDefinedCalculatorDialog.cpp b/ApplicationLibCode/Commands/RicUserDefinedCalculatorDialog.cpp new file mode 100644 index 0000000000..446030ea67 --- /dev/null +++ b/ApplicationLibCode/Commands/RicUserDefinedCalculatorDialog.cpp @@ -0,0 +1,131 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicUserDefinedCalculatorDialog.h" + +#include "RiuTools.h" + +#include "RimUserDefinedCalculation.h" +#include "RimUserDefinedCalculationCollection.h" + +#include +#include +#include + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicUserDefinedCalculatorDialog::RicUserDefinedCalculatorDialog( QWidget* parent, const QString& title ) + : QDialog( parent, RiuTools::defaultDialogFlags() ) +{ + setWindowTitle( title ); + resize( 1200, 800 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicUserDefinedCalculatorDialog::~RicUserDefinedCalculatorDialog() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicUserDefinedCalculatorDialog::slotTryCloseDialog() +{ + RimUserDefinedCalculationCollection* calcCollection = calculationCollection(); + + if ( dirtyCount() > 0 ) + { + QMessageBox msgBox( this ); + msgBox.setIcon( QMessageBox::Question ); + + QString questionText = QString( "Detected calculation expression text modifications." ); + + msgBox.setText( questionText ); + msgBox.setInformativeText( "Do you want to trigger calculation?" ); + msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No ); + + int ret = msgBox.exec(); + if ( ret == QMessageBox::No ) + { + reject(); + } + else if ( ret == QMessageBox::Yes ) + { + for ( auto c : calcCollection->calculations() ) + { + if ( c->isDirty() ) + { + c->calculate(); + c->updateDependentObjects(); + } + } + + if ( dirtyCount() > 0 ) + { + return; + } + } + else + { + return; + } + } + + accept(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicUserDefinedCalculatorDialog::setUp() +{ + QVBoxLayout* mainLayout = new QVBoxLayout( this ); + mainLayout->setContentsMargins( 0, 0, 0, 0 ); + + QWidget* calcEditorWidget = getCalculatorWidget(); + mainLayout->addWidget( calcEditorWidget ); + + QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close ); + connect( buttonBox, SIGNAL( rejected() ), this, SLOT( slotTryCloseDialog() ) ); + + mainLayout->addWidget( buttonBox ); + + updateUi(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +size_t RicUserDefinedCalculatorDialog::dirtyCount() const +{ + size_t count = 0; + + RimUserDefinedCalculationCollection* calcCollection = calculationCollection(); + for ( auto c : calcCollection->calculations() ) + { + if ( c->isDirty() ) + { + count++; + } + } + + return count; +} diff --git a/ApplicationLibCode/Commands/RicUserDefinedCalculatorDialog.h b/ApplicationLibCode/Commands/RicUserDefinedCalculatorDialog.h new file mode 100644 index 0000000000..47a06795e1 --- /dev/null +++ b/ApplicationLibCode/Commands/RicUserDefinedCalculatorDialog.h @@ -0,0 +1,49 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include + +class RimUserDefinedCalculation; +class RimUserDefinedCalculationCollection; + +//================================================================================================== +/// +/// +//================================================================================================== +class RicUserDefinedCalculatorDialog : public QDialog +{ + Q_OBJECT + +public: + RicUserDefinedCalculatorDialog( QWidget* parent, const QString& title ); + ~RicUserDefinedCalculatorDialog() override; + + virtual void setCalculationAndUpdateUi( RimUserDefinedCalculation* calculation ) = 0; + virtual RimUserDefinedCalculationCollection* calculationCollection() const = 0; + virtual QWidget* getCalculatorWidget() = 0; + virtual void updateUi() = 0; + +private slots: + void slotTryCloseDialog(); + +protected: + void setUp(); + size_t dirtyCount() const; +}; diff --git a/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp new file mode 100644 index 0000000000..4e935a4e27 --- /dev/null +++ b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp @@ -0,0 +1,260 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicUserDefinedCalculatorUi.h" + +#include "RimUserDefinedCalculation.h" +#include "RimUserDefinedCalculationCollection.h" + +#include "cafAssert.h" +#include "cafPdmUiListEditor.h" +#include "cafPdmUiObjectEditorHandle.h" +#include "cafPdmUiPushButtonEditor.h" +#include "cafPdmUiTreeSelectionEditor.h" + +CAF_PDM_ABSTRACT_SOURCE_INIT( RicUserDefinedCalculatorUi, "RicUserDefinedCalculator" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicUserDefinedCalculatorUi::RicUserDefinedCalculatorUi() +{ + CAF_PDM_InitObject( "RicUserDefinedCalculator" ); + + CAF_PDM_InitFieldNoDefault( &m_currentCalculation, "CurrentCalculation", "" ); + m_currentCalculation.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); + // m_currentCalculation.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); + m_currentCalculation.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); + + CAF_PDM_InitFieldNoDefault( &m_newCalculation, "NewCalculation", "New Calculation" ); + RicUserDefinedCalculatorUi::assignPushButtonEditor( &m_newCalculation ); + + CAF_PDM_InitFieldNoDefault( &m_deleteCalculation, "DeleteCalculation", "Delete Calculation" ); + RicUserDefinedCalculatorUi::assignPushButtonEditor( &m_deleteCalculation ); + + m_calcContextMenuMgr = std::unique_ptr( new RiuCalculationsContextMenuManager() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimUserDefinedCalculation* RicUserDefinedCalculatorUi::currentCalculation() const +{ + return m_currentCalculation(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicUserDefinedCalculatorUi::setCurrentCalculation( RimUserDefinedCalculation* calculation ) +{ + m_currentCalculation = calculation; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicUserDefinedCalculatorUi::parseExpression() const +{ + if ( m_currentCalculation() ) + { + QString previousCurveName = m_currentCalculation->description(); + if ( !m_currentCalculation()->parseExpression() ) + { + return false; + } + + QString currentCurveName = m_currentCalculation->description(); + if ( previousCurveName != currentCurveName ) + { + notifyCalculatedNameChanged( m_currentCalculation()->id(), currentCurveName ); + } + + m_currentCalculation()->updateDependentObjects(); + } + + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicUserDefinedCalculatorUi::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) +{ + if ( changedField == &m_newCalculation ) + { + m_newCalculation = false; + + m_currentCalculation = calculationCollection()->addCalculation(); + + this->updateConnectedEditors(); + } + else if ( changedField == &m_deleteCalculation ) + { + m_deleteCalculation = false; + + if ( m_currentCalculation() ) + { + calculationCollection()->deleteCalculation( m_currentCalculation() ); + m_currentCalculation = nullptr; + + this->updateConnectedEditors(); + caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicUserDefinedCalculatorUi::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + if ( !m_currentCalculation() && !calculationCollection()->calculations().empty() ) + { + m_currentCalculation = calculationCollection()->calculations()[0]; + } + + { + caf::PdmUiGroup* group = uiOrdering.addNewGroupWithKeyword( "Calculated Summaries", calculationsGroupName() ); + group->add( &m_currentCalculation ); + group->add( &m_newCalculation ); + group->add( &m_deleteCalculation ); + } + + { + caf::PdmUiGroup* group = uiOrdering.addNewGroupWithKeyword( "Calculation Settings", calulationGroupName() ); + if ( m_currentCalculation() ) + { + m_currentCalculation->uiOrdering( uiConfigName, *group ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList + RicUserDefinedCalculatorUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +{ + QList options; + if ( fieldNeedingOptions == &m_currentCalculation ) + { + for ( auto c : calculationCollection()->calculations() ) + { + options.push_back( caf::PdmOptionItemInfo( c->description(), c ) ); + } + } + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicUserDefinedCalculatorUi::assignPushButtonEditor( caf::PdmFieldHandle* fieldHandle ) +{ + CAF_ASSERT( fieldHandle ); + CAF_ASSERT( fieldHandle->uiCapability() ); + + fieldHandle->uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + fieldHandle->uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicUserDefinedCalculatorUi::assignPushButtonEditorText( caf::PdmUiEditorAttribute* attribute, const QString& text ) +{ + caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast( attribute ); + if ( attrib ) + { + attrib->m_buttonText = text; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicUserDefinedCalculatorUi::calculate() const +{ + if ( m_currentCalculation() ) + { + QString previousCurveName = m_currentCalculation->description(); + if ( !m_currentCalculation()->parseExpression() ) + { + return false; + } + + QString currentCurveName = m_currentCalculation->description(); + if ( previousCurveName != currentCurveName ) + { + notifyCalculatedNameChanged( m_currentCalculation()->id(), currentCurveName ); + } + + if ( !m_currentCalculation()->calculate() ) + { + return false; + } + + m_currentCalculation()->updateDependentObjects(); + caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); + } + + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicUserDefinedCalculatorUi::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + if ( &m_newCalculation == field ) + { + RicUserDefinedCalculatorUi::assignPushButtonEditorText( attribute, "New Calculation" ); + } + else if ( &m_deleteCalculation == field ) + { + RicUserDefinedCalculatorUi::assignPushButtonEditorText( attribute, "Delete Calculation" ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicUserDefinedCalculatorUi::onEditorWidgetsCreated() +{ + if ( m_currentCalculation() != nullptr ) + { + m_currentCalculation->attachToWidget(); + } + + for ( const auto& e : m_currentCalculation.uiCapability()->connectedEditors() ) + { + caf::PdmUiListEditor* listEditor = dynamic_cast( e ); + if ( !listEditor ) continue; + + QWidget* widget = listEditor->editorWidget(); + if ( !widget ) continue; + + m_calcContextMenuMgr->attachWidget( widget, this ); + } +} diff --git a/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.h b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.h new file mode 100644 index 0000000000..70ee7244ef --- /dev/null +++ b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.h @@ -0,0 +1,73 @@ +//////////////////////////// ///////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiuCalculationsContextMenuManager.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPtrField.h" +#include + +class RimUserDefinedCalculationCollection; +class RimUserDefinedCalculation; + +//================================================================================================== +/// +//================================================================================================== +class RicUserDefinedCalculatorUi : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RicUserDefinedCalculatorUi(); + + RimUserDefinedCalculation* currentCalculation() const; + void setCurrentCalculation( RimUserDefinedCalculation* calculation ); + + bool parseExpression() const; + bool calculate() const; + + virtual QString calculationsGroupName() const = 0; + virtual QString calulationGroupName() const = 0; + virtual RimUserDefinedCalculationCollection* calculationCollection() const = 0; + virtual void notifyCalculatedNameChanged( int id, const QString& newName ) const = 0; + +private: + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) override; + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; + void onEditorWidgetsCreated() override; + +private: + // TODO : Move to a common caf helper class + static void assignPushButtonEditor( caf::PdmFieldHandle* fieldHandle ); + static void assignPushButtonEditorText( caf::PdmUiEditorAttribute* attribute, const QString& text ); + +private: + caf::PdmPtrField m_currentCalculation; + + caf::PdmField m_newCalculation; + caf::PdmField m_deleteCalculation; + + std::unique_ptr m_calcContextMenuMgr; +}; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index cc983112a8..1af0802938 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -29,7 +29,6 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryCurveCalculatorFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicEditSummaryCurveCalculationFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorDialog.h - ${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorWidgetCreator.h ${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorUi.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotCurveFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryEnsembleCurveSetFeature.h @@ -76,7 +75,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryCurveCalculatorFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicEditSummaryCurveCalculationFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorDialog.cpp - ${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorWidgetCreator.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorUi.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotCurveFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryEnsembleCurveSetFeature.cpp @@ -101,7 +99,6 @@ list( COMMAND_QT_MOC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotEditorWidgetCreator.h ${CMAKE_CURRENT_LIST_DIR}/RicSummaryPlotEditorDialog.h - ${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorWidgetCreator.h ${CMAKE_CURRENT_LIST_DIR}/RicSummaryCurveCalculatorDialog.h ) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp index 5ab5df3210..8464c548bc 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicEditSummaryCurveCalculationFeature.cpp @@ -55,7 +55,7 @@ bool RicEditSummaryCurveCalculationFeature::isCommandEnabled() void RicEditSummaryCurveCalculationFeature::onActionTriggered( bool isChecked ) { std::vector selectedCurves = caf::selectedObjectsByType(); - RimSummaryCalculation* calculation = nullptr; + RimUserDefinedCalculation* calculation = nullptr; if ( selectedCurves.size() > 0 ) { diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp index 9ddde2e304..4c01449427 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp @@ -77,7 +77,7 @@ void RicShowSummaryCurveCalculatorFeature::onActionTriggered( bool isChecked ) RimProject* proj = RimProject::current(); RimSummaryCalculationCollection* calcColl = proj->calculationCollection(); - if ( calcColl->calculations().size() == 0 ) + if ( calcColl->calculations().empty() ) { calcColl->addCalculation(); } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorDialog.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorDialog.cpp index dd7dae606e..2995fcdccc 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorDialog.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorDialog.cpp @@ -18,27 +18,18 @@ #include "RicSummaryCurveCalculatorDialog.h" +#include "RicCalculatorWidgetCreator.h" #include "RicSummaryCurveCalculatorUi.h" -#include "RicSummaryCurveCalculatorWidgetCreator.h" #include "RimSummaryCalculation.h" #include "RimSummaryCalculationCollection.h" -#include "RiuTools.h" - -#include -#include -#include - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RicSummaryCurveCalculatorDialog::RicSummaryCurveCalculatorDialog( QWidget* parent ) - : QDialog( parent, RiuTools::defaultDialogFlags() ) + : RicUserDefinedCalculatorDialog( parent, "Summary Curve Calculator" ) { - setWindowTitle( "Summary Curve Calculator" ); - resize( 1200, 800 ); - setUp(); } @@ -52,96 +43,41 @@ RicSummaryCurveCalculatorDialog::~RicSummaryCurveCalculatorDialog() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorDialog::setCalculationAndUpdateUi( RimSummaryCalculation* calculation ) +void RicSummaryCurveCalculatorDialog::setCalculationAndUpdateUi( RimUserDefinedCalculation* calculation ) { - m_summaryCalcEditor->calculator()->setCurrentCalculation( calculation ); - - m_summaryCalcEditor->updateUi(); + CAF_ASSERT( m_summaryCalcEditor ); + m_summaryCalcEditor->calculator()->setCurrentCalculation( dynamic_cast( calculation ) ); + updateUi(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorDialog::slotTryCloseDialog() +void RicSummaryCurveCalculatorDialog::updateUi() { - RimSummaryCalculationCollection* calculationCollection = RicSummaryCurveCalculatorUi::calculationCollection(); - - if ( dirtyCount() > 0 ) - { - QMessageBox msgBox( this ); - msgBox.setIcon( QMessageBox::Question ); - - QString questionText = QString( "Detected calculation expression text modifications." ); - - msgBox.setText( questionText ); - msgBox.setInformativeText( "Do you want to trigger calculation?" ); - msgBox.setStandardButtons( QMessageBox::Yes | QMessageBox::No ); - - int ret = msgBox.exec(); - if ( ret == QMessageBox::No ) - { - reject(); - } - else if ( ret == QMessageBox::Yes ) - { - for ( auto c : calculationCollection->calculations() ) - { - if ( c->isDirty() ) - { - c->calculate(); - c->updateDependentCurvesAndPlots(); - } - } - - if ( dirtyCount() > 0 ) - { - return; - } - } - else - { - return; - } - } - - accept(); + CAF_ASSERT( m_summaryCalcEditor ); + m_summaryCalcEditor->updateUi(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorDialog::setUp() +RimUserDefinedCalculationCollection* RicSummaryCurveCalculatorDialog::calculationCollection() const { - QVBoxLayout* mainLayout = new QVBoxLayout( this ); - mainLayout->setContentsMargins( 0, 0, 0, 0 ); - - m_summaryCalcEditor = - std::unique_ptr( new RicSummaryCurveCalculatorWidgetCreator() ); - mainLayout->addWidget( m_summaryCalcEditor->getOrCreateWidget( this ) ); - - QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close ); - connect( buttonBox, SIGNAL( rejected() ), this, SLOT( slotTryCloseDialog() ) ); - - mainLayout->addWidget( buttonBox ); - - m_summaryCalcEditor->updateUi(); + CAF_ASSERT( m_summaryCalcEditor ); + return m_summaryCalcEditor->calculator()->calculationCollection(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -size_t RicSummaryCurveCalculatorDialog::dirtyCount() const +QWidget* RicSummaryCurveCalculatorDialog::getCalculatorWidget() { - size_t count = 0; - - RimSummaryCalculationCollection* calculationCollection = RicSummaryCurveCalculatorUi::calculationCollection(); - for ( auto c : calculationCollection->calculations() ) + if ( !m_summaryCalcEditor ) { - if ( c->isDirty() ) - { - count++; - } + m_summaryCalcEditor = std::unique_ptr( + new RicCalculatorWidgetCreator( std::make_unique() ) ); } - return count; + return m_summaryCalcEditor->getOrCreateWidget( this ); } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorDialog.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorDialog.h index 311ea12402..e8acbd2bd7 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorDialog.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorDialog.h @@ -18,17 +18,17 @@ #pragma once -#include +#include "RicUserDefinedCalculatorDialog.h" + #include -class RicSummaryCurveCalculatorWidgetCreator; -class RimSummaryCalculation; +class RicCalculatorWidgetCreator; //================================================================================================== /// /// //================================================================================================== -class RicSummaryCurveCalculatorDialog : public QDialog +class RicSummaryCurveCalculatorDialog : public RicUserDefinedCalculatorDialog { Q_OBJECT @@ -36,15 +36,11 @@ class RicSummaryCurveCalculatorDialog : public QDialog RicSummaryCurveCalculatorDialog( QWidget* parent ); ~RicSummaryCurveCalculatorDialog() override; - void setCalculationAndUpdateUi( RimSummaryCalculation* calculation ); - -private slots: - void slotTryCloseDialog(); - -private: - void setUp(); - size_t dirtyCount() const; + void setCalculationAndUpdateUi( RimUserDefinedCalculation* calculation ) override; + QWidget* getCalculatorWidget() override; + void updateUi() override; + RimUserDefinedCalculationCollection* calculationCollection() const override; private: - std::unique_ptr m_summaryCalcEditor; + std::unique_ptr m_summaryCalcEditor; }; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp index b7d0427003..acef817ca5 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.cpp @@ -21,13 +21,9 @@ #include "RiaSummaryTools.h" #include "RimProject.h" -#include "RimSummaryCalculation.h" #include "RimSummaryCalculationCollection.h" - -#include "cafPdmUiListEditor.h" -#include "cafPdmUiObjectEditorHandle.h" -#include "cafPdmUiPushButtonEditor.h" -#include "cafPdmUiTreeSelectionEditor.h" +#include "RimUserDefinedCalculation.h" +#include "RimUserDefinedCalculationCollection.h" CAF_PDM_SOURCE_INIT( RicSummaryCurveCalculatorUi, "RicSummaryCurveCalculator" ); @@ -37,25 +33,12 @@ CAF_PDM_SOURCE_INIT( RicSummaryCurveCalculatorUi, "RicSummaryCurveCalculator" ); RicSummaryCurveCalculatorUi::RicSummaryCurveCalculatorUi() { CAF_PDM_InitObject( "RicSummaryCurveCalculator" ); - - CAF_PDM_InitFieldNoDefault( &m_currentCalculation, "CurrentCalculation", "" ); - m_currentCalculation.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - // m_currentCalculation.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); - m_currentCalculation.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); - - CAF_PDM_InitFieldNoDefault( &m_newCalculation, "NewCalculation", "New Calculation" ); - RicSummaryCurveCalculatorUi::assignPushButtonEditor( &m_newCalculation ); - - CAF_PDM_InitFieldNoDefault( &m_deleteCalculation, "DeleteCalculation", "Delete Calculation" ); - RicSummaryCurveCalculatorUi::assignPushButtonEditor( &m_deleteCalculation ); - - m_calcContextMenuMgr = std::unique_ptr( new RiuCalculationsContextMenuManager() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RicSummaryCurveCalculatorUi::calculatedSummariesGroupName() +QString RicSummaryCurveCalculatorUi::calculationsGroupName() const { return "CalculatedSummariesGroupName"; } @@ -63,7 +46,7 @@ QString RicSummaryCurveCalculatorUi::calculatedSummariesGroupName() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RicSummaryCurveCalculatorUi::calulationGroupName() +QString RicSummaryCurveCalculatorUi::calulationGroupName() const { return "CalulationGroupName"; } @@ -71,228 +54,15 @@ QString RicSummaryCurveCalculatorUi::calulationGroupName() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryCalculation* RicSummaryCurveCalculatorUi::currentCalculation() const -{ - return m_currentCalculation(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorUi::setCurrentCalculation( RimSummaryCalculation* calculation ) -{ - m_currentCalculation = calculation; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicSummaryCurveCalculatorUi::parseExpression() const -{ - if ( m_currentCalculation() ) - { - QString previousCurveName = m_currentCalculation->description(); - if ( !m_currentCalculation()->parseExpression() ) - { - return false; - } - - QString currentCurveName = m_currentCalculation->description(); - if ( previousCurveName != currentCurveName ) - { - RiaSummaryTools::notifyCalculatedCurveNameHasChanged( m_currentCalculation()->id(), currentCurveName ); - } - - m_currentCalculation()->updateDependentCurvesAndPlots(); - } - - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorUi::fieldChangedByUi( const caf::PdmFieldHandle* changedField, - const QVariant& oldValue, - const QVariant& newValue ) +void RicSummaryCurveCalculatorUi::notifyCalculatedNameChanged( int id, const QString& newName ) const { - if ( changedField == &m_newCalculation ) - { - m_newCalculation = false; - - m_currentCalculation = calculationCollection()->addCalculation(); - - this->updateConnectedEditors(); - } - else if ( changedField == &m_deleteCalculation ) - { - m_deleteCalculation = false; - - if ( m_currentCalculation() ) - { - calculationCollection()->deleteCalculation( m_currentCalculation() ); - m_currentCalculation = nullptr; - - this->updateConnectedEditors(); - caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); - } - } + RiaSummaryTools::notifyCalculatedCurveNameHasChanged( id, newName ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorUi::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +RimUserDefinedCalculationCollection* RicSummaryCurveCalculatorUi::calculationCollection() const { - if ( !m_currentCalculation() ) - { - if ( calculationCollection()->calculations().size() > 0 ) - { - m_currentCalculation = calculationCollection()->calculations()[0]; - } - } - - { - caf::PdmUiGroup* group = - uiOrdering.addNewGroupWithKeyword( "Calculated Summaries", - RicSummaryCurveCalculatorUi::calculatedSummariesGroupName() ); - group->add( &m_currentCalculation ); - group->add( &m_newCalculation ); - group->add( &m_deleteCalculation ); - } - - { - caf::PdmUiGroup* group = uiOrdering.addNewGroupWithKeyword( "Calculation Settings", - RicSummaryCurveCalculatorUi::calulationGroupName() ); - if ( m_currentCalculation() ) - { - m_currentCalculation->uiOrdering( uiConfigName, *group ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QList - RicSummaryCurveCalculatorUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) -{ - QList options; - if ( fieldNeedingOptions == &m_currentCalculation ) - { - for ( auto c : calculationCollection()->calculations() ) - { - options.push_back( caf::PdmOptionItemInfo( c->description(), c ) ); - } - } - - return options; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryCalculationCollection* RicSummaryCurveCalculatorUi::calculationCollection() -{ - RimProject* proj = RimProject::current(); - if ( proj ) - { - return proj->calculationCollection(); - } - - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorUi::assignPushButtonEditor( caf::PdmFieldHandle* fieldHandle ) -{ - CVF_ASSERT( fieldHandle ); - CVF_ASSERT( fieldHandle->uiCapability() ); - - fieldHandle->uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); - fieldHandle->uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorUi::assignPushButtonEditorText( caf::PdmUiEditorAttribute* attribute, const QString& text ) -{ - caf::PdmUiPushButtonEditorAttribute* attrib = dynamic_cast( attribute ); - if ( attrib ) - { - attrib->m_buttonText = text; - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicSummaryCurveCalculatorUi::calculate() const -{ - if ( m_currentCalculation() ) - { - QString previousCurveName = m_currentCalculation->description(); - if ( !m_currentCalculation()->parseExpression() ) - { - return false; - } - - QString currentCurveName = m_currentCalculation->description(); - if ( previousCurveName != currentCurveName ) - { - RiaSummaryTools::notifyCalculatedCurveNameHasChanged( m_currentCalculation()->id(), currentCurveName ); - } - - if ( !m_currentCalculation()->calculate() ) - { - return false; - } - - m_currentCalculation()->updateDependentCurvesAndPlots(); - caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); - } - - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorUi::defineEditorAttribute( const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute ) -{ - if ( &m_newCalculation == field ) - { - RicSummaryCurveCalculatorUi::assignPushButtonEditorText( attribute, "New Calculation" ); - } - else if ( &m_deleteCalculation == field ) - { - RicSummaryCurveCalculatorUi::assignPushButtonEditorText( attribute, "Delete Calculation" ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// f -//-------------------------------------------------------------------------------------------------- -void RicSummaryCurveCalculatorUi::onEditorWidgetsCreated() -{ - if ( m_currentCalculation() != nullptr ) - { - m_currentCalculation->attachToWidget(); - } - - for ( const auto& e : m_currentCalculation.uiCapability()->connectedEditors() ) - { - caf::PdmUiListEditor* listEditor = dynamic_cast( e ); - if ( !listEditor ) continue; - - QWidget* widget = listEditor->editorWidget(); - if ( !widget ) continue; - - m_calcContextMenuMgr->attachWidget( widget, this ); - } + return RimProject::current()->calculationCollection(); } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.h index 5731243be1..60f3728b24 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryCurveCalculatorUi.h @@ -18,56 +18,22 @@ #pragma once -#include "RiuCalculationsContextMenuManager.h" -#include "cafPdmField.h" -#include "cafPdmObject.h" -#include "cafPdmPtrField.h" -#include +#include "RicUserDefinedCalculatorUi.h" -class RimSummaryCalculationCollection; -class RimSummaryCalculation; +class RimUserDefinedCalculationCollection; //================================================================================================== /// //================================================================================================== -class RicSummaryCurveCalculatorUi : public caf::PdmObject +class RicSummaryCurveCalculatorUi : public RicUserDefinedCalculatorUi { CAF_PDM_HEADER_INIT; public: RicSummaryCurveCalculatorUi(); - static QString calculatedSummariesGroupName(); - static QString calulationGroupName(); - - RimSummaryCalculation* currentCalculation() const; - void setCurrentCalculation( RimSummaryCalculation* calculation ); - - bool parseExpression() const; - bool calculate() const; - - static RimSummaryCalculationCollection* calculationCollection(); - -private: - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; - void defineEditorAttribute( const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute ) override; - void onEditorWidgetsCreated() override; - -private: - // TODO : Move to a common caf helper class - static void assignPushButtonEditor( caf::PdmFieldHandle* fieldHandle ); - static void assignPushButtonEditorText( caf::PdmUiEditorAttribute* attribute, const QString& text ); - -private: - caf::PdmPtrField m_currentCalculation; - - caf::PdmField m_newCalculation; - caf::PdmField m_deleteCalculation; - - std::unique_ptr m_calcContextMenuMgr; + QString calculationsGroupName() const override; + QString calulationGroupName() const override; + RimUserDefinedCalculationCollection* calculationCollection() const override; + void notifyCalculatedNameChanged( int id, const QString& newName ) const override; }; diff --git a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake index d0898303ce..a981b65f31 100644 --- a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake @@ -74,9 +74,15 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimEclipseGeometrySelectionItem.h ${CMAKE_CURRENT_LIST_DIR}/RimDialogData.h ${CMAKE_CURRENT_LIST_DIR}/RimTimeStepFilter.h + ${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedCalculation.h + ${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedCalculationCollection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedCalculationVariable.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCalculation.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCalculationCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCalculationVariable.h + ${CMAKE_CURRENT_LIST_DIR}/RimGridCalculation.h + ${CMAKE_CURRENT_LIST_DIR}/RimGridCalculationCollection.h + ${CMAKE_CURRENT_LIST_DIR}/RimGridCalculationVariable.h ${CMAKE_CURRENT_LIST_DIR}/RimStimPlanLegendConfig.h ${CMAKE_CURRENT_LIST_DIR}/RimStimPlanColors.h ${CMAKE_CURRENT_LIST_DIR}/RimVirtualPerforationResults.h @@ -196,9 +202,15 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimEclipseGeometrySelectionItem.cpp ${CMAKE_CURRENT_LIST_DIR}/RimDialogData.cpp ${CMAKE_CURRENT_LIST_DIR}/RimTimeStepFilter.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedCalculation.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedCalculationCollection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimUserDefinedCalculationVariable.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCalculation.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCalculationCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSummaryCalculationVariable.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimGridCalculation.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimGridCalculationCollection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimGridCalculationVariable.cpp ${CMAKE_CURRENT_LIST_DIR}/RimStimPlanLegendConfig.cpp ${CMAKE_CURRENT_LIST_DIR}/RimStimPlanColors.cpp ${CMAKE_CURRENT_LIST_DIR}/RimVirtualPerforationResults.cpp diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index db636871c1..0bc30a13ac 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -318,6 +318,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicSaveEclipseInputVisibleCellsFeature"; menuBuilder << "RicCreateGridCrossPlotFeature"; menuBuilder << "RicAddEclipseInputPropertyFeature"; + menuBuilder << "RicShowGridCalculatorFeature"; } else if ( dynamic_cast( firstUiItem ) ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp new file mode 100644 index 0000000000..9ea82a6347 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp @@ -0,0 +1,177 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimGridCalculation.h" + +#include "RigCaseCellResultsData.h" +#include "RimEclipseCase.h" +#include "expressionparser/ExpressionParser.h" + +#include "RiaLogging.h" +#include "RiaPorosityModel.h" + +#include "RigEclipseResultAddress.h" + +CAF_PDM_SOURCE_INIT( RimGridCalculation, "RimGridCalculation" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGridCalculation::RimGridCalculation() +{ + CAF_PDM_InitObject( "RimGridCalculation", ":/octave.png", "Calculation", "" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGridCalculationVariable* RimGridCalculation::createVariable() const +{ + return new RimGridCalculationVariable; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimGridCalculation::calculate() +{ + QString leftHandSideVariableName = RimGridCalculation::findLeftHandSide( m_expression ); + + auto porosityModel = RiaDefines::PorosityModelType::MATRIX_MODEL; + + RimEclipseCase* eclipseCase = nullptr; + std::vector> values; + for ( size_t i = 0; i < m_variables.size(); i++ ) + { + RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); + + // Use the first defined eclipse case from for output + if ( !eclipseCase ) eclipseCase = v->eclipseCase(); + + if ( !v->eclipseCase() ) + { + RiaLogging::errorInMessageBox( nullptr, + "Expression Parser", + QString( "No case defined for variable : %1" ).arg( v->name() ) ); + + return false; + } + + if ( v->resultVariable().isEmpty() ) + { + RiaLogging::errorInMessageBox( nullptr, + "Expression Parser", + QString( "No result variable defined for variable : %1" ).arg( v->name() ) ); + + return false; + } + + RigEclipseResultAddress resAddr( v->resultCategoryType(), v->resultVariable() ); + if ( !eclipseCase->results( porosityModel )->ensureKnownResultLoaded( resAddr ) ) + { + RiaLogging::errorInMessageBox( nullptr, + "Expression Parser", + QString( "Unable to load result for variable : %1" ).arg( v->name() ) ); + return false; + } + + std::vector> inputValues = eclipseCase->results( porosityModel )->cellScalarResults( resAddr ); + + values.push_back( inputValues[0] ); + } + + ExpressionParser parser; + for ( size_t i = 0; i < m_variables.size(); i++ ) + { + RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); + + parser.assignVector( v->name(), values[i] ); + } + + std::vector resultValues; + resultValues.resize( values[0].size() ); + parser.assignVector( leftHandSideVariableName, resultValues ); + + QString errorText; + bool evaluatedOk = parser.expandIfStatementsAndEvaluate( m_expression, &errorText ); + + if ( evaluatedOk ) + { + m_timesteps.v().clear(); + m_calculatedValues.v().clear(); + + RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::GENERATED, leftHandSideVariableName ); + + if ( !eclipseCase->results( porosityModel )->ensureKnownResultLoaded( resAddr ) ) + { + eclipseCase->results( porosityModel )->createResultEntry( resAddr, true ); + } + std::vector>* scalarResultFrames = + eclipseCase->results( porosityModel )->modifiableCellScalarResultTimesteps( resAddr ); + size_t timeStepCount = eclipseCase->results( porosityModel )->maxTimeStepCount(); + scalarResultFrames->resize( timeStepCount ); + + size_t tsId = 0; + scalarResultFrames->at( tsId ) = resultValues; + + m_isDirty = false; + } + else + { + QString s = "The following error message was received from the parser library : \n\n"; + s += errorText; + + RiaLogging::errorInMessageBox( nullptr, "Expression Parser", s ); + } + + return evaluatedOk; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculation::updateDependentObjects() +{ + // RimGridCalculationCollection* calcColl = nullptr; + // this->firstAncestorOrThisOfTypeAsserted( calcColl ); + // calcColl->rebuildCaseMetaData(); + + // RimGridMultiPlotCollection* summaryPlotCollection = RiaGridTools::summaryMultiPlotCollection(); + // for ( auto multiPlot : summaryPlotCollection->multiPlots() ) + // { + // for ( RimGridPlot* sumPlot : multiPlot->summaryPlots() ) + // { + // bool plotContainsCalculatedCurves = false; + + // for ( RimGridCurve* sumCurve : sumPlot->summaryCurves() ) + // { + // if ( sumCurve->summaryAddressY().category() == RifEclipseGridAddress::SUMMARY_CALCULATED ) + // { + // sumCurve->updateConnectedEditors(); + + // plotContainsCalculatedCurves = true; + // } + // } + + // if ( plotContainsCalculatedCurves ) + // { + // sumPlot->loadDataAndUpdate(); + // } + // } + // } +} diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h new file mode 100644 index 0000000000..fa8a8d194f --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h @@ -0,0 +1,40 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RimGridCalculationVariable.h" +#include "RimUserDefinedCalculation.h" + +//================================================================================================== +/// +/// +//================================================================================================== +class RimGridCalculation : public RimUserDefinedCalculation +{ + CAF_PDM_HEADER_INIT; + +public: + RimGridCalculation(); + + bool calculate() override; + void updateDependentObjects() override; + +protected: + RimGridCalculationVariable* createVariable() const override; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.cpp new file mode 100644 index 0000000000..f5dda18508 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.cpp @@ -0,0 +1,57 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimGridCalculationCollection.h" + +#include "RimGridCalculation.h" + +#include "cafPdmUiGroup.h" +#include "cafPdmUiTreeSelectionEditor.h" + +CAF_PDM_SOURCE_INIT( RimGridCalculationCollection, "RimGridCalculationCollection" ); +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGridCalculationCollection::RimGridCalculationCollection() +{ + CAF_PDM_InitObject( "Calculation Collection", ":/chain.png" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGridCalculation* RimGridCalculationCollection::createCalculation() const +{ + return new RimGridCalculation; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculationCollection::rebuildCaseMetaData() +{ + ensureCalculationIds(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculationCollection::initAfterRead() +{ + rebuildCaseMetaData(); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.h b/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.h new file mode 100644 index 0000000000..ace28726c4 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.h @@ -0,0 +1,48 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RimGridCalculation.h" +#include "RimUserDefinedCalculationCollection.h" + +#include "cafPdmChildArrayField.h" +#include "cafPdmChildField.h" +#include "cafPdmObject.h" + +class RimGridCase; +class RimCalculatedGridCase; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimGridCalculationCollection : public RimUserDefinedCalculationCollection +{ + CAF_PDM_HEADER_INIT; + +public: + RimGridCalculationCollection(); + + void rebuildCaseMetaData() override; + + RimGridCalculation* createCalculation() const override; + +private: + void initAfterRead() override; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp new file mode 100644 index 0000000000..d815fabcec --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp @@ -0,0 +1,204 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimGridCalculationVariable.h" + +#include "RiaApplication.h" +#include "RiaPorosityModel.h" +#include "RiaResultNames.h" + +#include "RigCaseCellResultsData.h" + +#include "RimEclipseCase.h" +#include "RimTools.h" + +CAF_PDM_SOURCE_INIT( RimGridCalculationVariable, "RimGridCalculationVariable" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGridCalculationVariable::RimGridCalculationVariable() +{ + CAF_PDM_InitObject( "RimGridCalculationVariable", ":/octave.png" ); + + CAF_PDM_InitFieldNoDefault( &m_resultType, "ResultType", "Type" ); + CAF_PDM_InitField( &m_resultVariable, "ResultVariable", RiaResultNames::undefinedResultName(), "Variable" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseGridCase", "Grid Case" ); + CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStep", "Time Step" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculationVariable::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) +{ + // if ( changedField == &m_button ) + // { + // bool updateContainingEditor = false; + + // { + // RiuGridVectorSelectionDialog dlg( nullptr ); + // dlg.hideEnsembles(); + + // readDataFromApplicationStore( &dlg ); + + // if ( dlg.exec() == QDialog::Accepted ) + // { + // std::vector curveSelection = dlg.curveSelection(); + // if ( curveSelection.size() > 0 ) + // { + // m_case = curveSelection[0].summaryCase(); + // m_summaryAddress->setAddress( curveSelection[0].summaryAddress() ); + + // writeDataToApplicationStore(); + + // updateContainingEditor = true; + // } + // } + // } + + // if ( updateContainingEditor ) + // { + // RimGridCalculation* rimCalculation = nullptr; + // this->firstAncestorOrThisOfTypeAsserted( rimCalculation ); + + // // RimCalculation is pointed to by RicGridCurveCalculator in a PtrField + // // Update editors connected to RicGridCurveCalculator + // std::vector referringObjects; + // rimCalculation->objectsWithReferringPtrFields( referringObjects ); + // for ( auto o : referringObjects ) + // { + // o->uiCapability()->updateConnectedEditors(); + // } + // } + // } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimGridCalculationVariable::displayString() const +{ + QStringList nameComponents; + + if ( m_eclipseCase() ) nameComponents.append( m_eclipseCase()->uiName() ); + + nameComponents.append( m_resultVariable() ); + return nameComponents.join( " - " ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculationVariable::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + uiOrdering.add( &m_name ); + uiOrdering.add( &m_eclipseCase ); + uiOrdering.add( &m_resultType ); + uiOrdering.add( &m_resultVariable ); + uiOrdering.add( &m_timeStep ); + + uiOrdering.skipRemainingFields(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList + RimGridCalculationVariable::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +{ + QList options; + + if ( fieldNeedingOptions == &m_resultVariable ) + { + auto results = currentGridCellResults(); + if ( results ) + { + for ( const QString& s : getResultNamesForResultType( m_resultType(), results ) ) + { + options.push_back( caf::PdmOptionItemInfo( s, s ) ); + } + } + } + else if ( fieldNeedingOptions == &m_eclipseCase ) + { + RimTools::eclipseCaseOptionItems( &options ); + } + else if ( fieldNeedingOptions == &m_timeStep ) + { + RimTools::timeStepsForCase( m_eclipseCase(), &options ); + } + + if ( useOptionsOnly ) *useOptionsOnly = true; + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigCaseCellResultsData* RimGridCalculationVariable::currentGridCellResults() const +{ + if ( !m_eclipseCase ) return nullptr; + + return m_eclipseCase->results( RiaDefines::PorosityModelType::MATRIX_MODEL ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QStringList RimGridCalculationVariable::getResultNamesForResultType( RiaDefines::ResultCatType resultCatType, + const RigCaseCellResultsData* results ) +{ + if ( !results ) return QStringList(); + return results->resultNames( resultCatType ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseCase* RimGridCalculationVariable::eclipseCase() const +{ + return m_eclipseCase; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::ResultCatType RimGridCalculationVariable::resultCategoryType() const +{ + return m_resultType(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimGridCalculationVariable::resultVariable() const +{ + return m_resultVariable; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimGridCalculationVariable::timeStep() const +{ + return m_timeStep; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h new file mode 100644 index 0000000000..b9396d048f --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h @@ -0,0 +1,67 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RimUserDefinedCalculationVariable.h" + +#include "RiaDefines.h" + +#include "cafPdmChildField.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmProxyValueField.h" +#include "cafPdmPtrField.h" + +class RimEclipseCase; +class RigCaseCellResultsData; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimGridCalculationVariable : public RimUserDefinedCalculationVariable +{ + CAF_PDM_HEADER_INIT; + +public: + RimGridCalculationVariable(); + + QString displayString() const override; + + RimEclipseCase* eclipseCase() const; + RiaDefines::ResultCatType resultCategoryType() const; + QString resultVariable() const; + int timeStep() const; + +private: + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) override; + RigCaseCellResultsData* currentGridCellResults() const; + QStringList getResultNamesForResultType( RiaDefines::ResultCatType resultCatType, + const RigCaseCellResultsData* results ); + +private: + caf::PdmPtrField m_eclipseCase; + caf::PdmField> m_resultType; + caf::PdmField m_resultVariable; + caf::PdmField m_timeStep; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 722e8c1756..54ce1b2493 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -55,6 +55,7 @@ #include "RimFractureTemplateCollection.h" #include "RimGeoMechCase.h" #include "RimGeoMechModels.h" +#include "RimGridCalculationCollection.h" #include "RimGridCrossPlotCollection.h" #include "RimGridSummaryCase.h" #include "RimGridView.h" @@ -126,7 +127,6 @@ RimProject::RimProject( void ) , m_nextValidCaseGroupId( 0 ) , m_nextValidViewId( 1 ) , m_nextValidPlotId( 1 ) - , m_nextValidCalculationId( 1 ) , m_nextValidSummaryCaseId( 1 ) , m_nextValidEnsembleId( 1 ) { @@ -164,6 +164,9 @@ RimProject::RimProject( void ) CAF_PDM_InitFieldNoDefault( &calculationCollection, "CalculationCollection", "Calculation Collection" ); calculationCollection = new RimSummaryCalculationCollection; + CAF_PDM_InitFieldNoDefault( &gridCalculationCollection, "GridCalculationCollection", "Grid Calculation Collection" ); + gridCalculationCollection = new RimGridCalculationCollection; + CAF_PDM_InitFieldNoDefault( &commandObjects, "CommandObjects", "Command Objects" ); CAF_PDM_InitFieldNoDefault( &multiSnapshotDefinitions, "MultiSnapshotDefinitions", "Multi Snapshot Definitions" ); @@ -261,6 +264,7 @@ void RimProject::close() m_dialogData->clearProjectSpecificData(); calculationCollection->deleteAllContainedObjects(); + gridCalculationCollection->deleteAllContainedObjects(); colorLegendCollection->deleteCustomColorLegends(); delete viewLinkerCollection->viewLinker(); @@ -277,7 +281,6 @@ void RimProject::close() m_nextValidCaseGroupId = 0; m_nextValidViewId = 1; m_nextValidPlotId = 1; - m_nextValidCalculationId = 1; m_nextValidSummaryCaseId = 1; m_nextValidEnsembleId = 1; } @@ -607,22 +610,6 @@ void RimProject::assignPlotIdToPlotWindow( RimPlotWindow* plotWindow ) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimProject::assignCalculationIdToCalculation( RimSummaryCalculation* calculation ) -{ - if ( calculation ) - { - for ( RimSummaryCalculation* existingCalculation : calculationCollection->calculations() ) - { - m_nextValidCalculationId = std::max( m_nextValidCalculationId, existingCalculation->id() + 1 ); - } - - calculation->setId( m_nextValidCalculationId++ ); - } -} - //-------------------------------------------------------------------------------------------------- /// TODO: This function is deprecated, use allGridCases() //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index 8198b062d7..7a89de66a8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -70,6 +70,7 @@ class RimValveTemplateCollection; class RimValveTemplate; class RimCompletionTemplateCollection; class RimPlotTemplateFolderItem; +class RimGridCalculationCollection; namespace caf { @@ -99,6 +100,7 @@ class RimProject : public caf::PdmDocument caf::PdmChildField mainPlotCollection; caf::PdmChildField viewLinkerCollection; caf::PdmChildField calculationCollection; + caf::PdmChildField gridCalculationCollection; caf::PdmChildArrayField commandObjects; caf::PdmChildArrayField multiSnapshotDefinitions; @@ -124,7 +126,6 @@ class RimProject : public caf::PdmDocument void assignIdToCaseGroup( RimIdenticalGridCaseGroup* caseGroup ); void assignViewIdToView( Rim3dView* view ); void assignPlotIdToPlotWindow( RimPlotWindow* plotWindow ); - void assignCalculationIdToCalculation( RimSummaryCalculation* calculation ); void assignCaseIdToSummaryCase( RimSummaryCase* summaryCase ); void assignIdToEnsemble( RimSummaryCaseCollection* summaryCaseCollection ); @@ -223,7 +224,6 @@ class RimProject : public caf::PdmDocument int m_nextValidCaseGroupId; int m_nextValidViewId; int m_nextValidPlotId; - int m_nextValidCalculationId; int m_nextValidSummaryCaseId; int m_nextValidEnsembleId; diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp index 33d380f40f..9ff4db0510 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp @@ -25,7 +25,6 @@ #include "RiaSummaryCurveDefinition.h" #include "RiaSummaryTools.h" -#include "RimProject.h" #include "RimSummaryAddress.h" #include "RimSummaryCalculationCollection.h" #include "RimSummaryCalculationVariable.h" @@ -50,204 +49,14 @@ CAF_PDM_SOURCE_INIT( RimSummaryCalculation, "RimSummaryCalculation" ); RimSummaryCalculation::RimSummaryCalculation() { CAF_PDM_InitObject( "RimSummaryCalculation", ":/octave.png", "Calculation", "" ); - - CAF_PDM_InitFieldNoDefault( &m_description, "Description", "Description" ); - m_description.uiCapability()->setUiReadOnly( true ); - - CAF_PDM_InitField( &m_expression, "Expression", QString( "" ), "Expression" ); - m_expression.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); - - CAF_PDM_InitField( &m_unit, "Unit", QString( "" ), "Unit" ); - m_unit.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); - - CAF_PDM_InitFieldNoDefault( &m_variables, "Variables", "Variables" ); - CAF_PDM_InitFieldNoDefault( &m_calculatedValues, "CalculatedValues", "Calculated Values" ); - - CAF_PDM_InitFieldNoDefault( &m_timesteps, "TimeSteps", "Time Steps" ); - CAF_PDM_InitField( &m_id, "Id", -1, "Id" ); - m_id.uiCapability()->setUiHidden( true ); - - m_exprContextMenuMgr = std::unique_ptr( new RiuExpressionContextMenuManager() ); - - m_isDirty = false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCalculation::setDescription( const QString& description ) -{ - m_description = description; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryCalculation::description() const -{ - return m_description; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCalculation::setId( int id ) -{ - m_id = id; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -int RimSummaryCalculation::id() const -{ - return m_id; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimSummaryCalculation::isDirty() const -{ - return m_isDirty; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmChildArrayFieldHandle* RimSummaryCalculation::variables() -{ - return &m_variables; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryCalculationVariable* RimSummaryCalculation::addVariable( const QString& name ) -{ - RimSummaryCalculationVariable* v = new RimSummaryCalculationVariable; - v->setName( name ); - - m_variables.push_back( v ); - - return v; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCalculation::deleteVariable( RimSummaryCalculationVariable* calcVariable ) -{ - m_variables.removeChildObject( calcVariable ); - - delete calcVariable; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -const std::vector& RimSummaryCalculation::values() const -{ - return m_calculatedValues(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -const std::vector& RimSummaryCalculation::timeSteps() const -{ - return m_timesteps(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCalculation::setExpression( const QString& expr ) -{ - m_expression = expr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryCalculation::expression() const -{ - return m_expression; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimSummaryCalculation::unitName() const +RimSummaryCalculationVariable* RimSummaryCalculation::createVariable() const { - return m_unit; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimSummaryCalculation::userDescriptionField() -{ - return &m_description; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimSummaryCalculation::parseExpression() -{ - QString leftHandSideVariableName = RimSummaryCalculation::findLeftHandSide( m_expression ); - if ( leftHandSideVariableName.isEmpty() ) - { - RiaLogging::errorInMessageBox( nullptr, "Expression Parser", "Failed to detect left hand side of equation" ); - - return false; - } - - std::vector variableNames = ExpressionParser::detectReferencedVariables( m_expression ); - if ( variableNames.size() < 1 ) - { - RiaLogging::errorInMessageBox( nullptr, "Expression Parser", "Failed to detect any variable names" ); - - return false; - } - - // Remove variables not present in expression - { - std::vector toBeDeleted; - for ( RimSummaryCalculationVariable* v : m_variables ) - { - if ( std::find( variableNames.begin(), variableNames.end(), v->name() ) == variableNames.end() ) - { - toBeDeleted.push_back( v ); - } - - if ( leftHandSideVariableName == v->name() ) - { - toBeDeleted.push_back( v ); - } - } - - for ( RimSummaryCalculationVariable* v : toBeDeleted ) - { - deleteVariable( v ); - } - } - - for ( auto variableName : variableNames ) - { - if ( leftHandSideVariableName != variableName ) - { - if ( !findByName( variableName ) ) - { - this->addVariable( variableName ); - } - } - } - - m_description = buildCalculationName(); - - return true; + return new RimSummaryCalculationVariable; } //-------------------------------------------------------------------------------------------------- @@ -261,7 +70,7 @@ bool RimSummaryCalculation::calculate() for ( size_t i = 0; i < m_variables.size(); i++ ) { - RimSummaryCalculationVariable* v = m_variables[i]; + RimSummaryCalculationVariable* v = dynamic_cast( m_variables[i] ); if ( !v->summaryCase() ) { @@ -299,7 +108,7 @@ bool RimSummaryCalculation::calculate() ExpressionParser parser; for ( size_t i = 0; i < m_variables.size(); i++ ) { - RimSummaryCalculationVariable* v = m_variables[i]; + RimSummaryCalculationVariable* v = dynamic_cast( m_variables[i] ); parser.assignVector( v->name(), timeHistoryCurveMerger.interpolatedYValuesForAllXValues( i ) ); } @@ -348,138 +157,10 @@ bool RimSummaryCalculation::calculate() return evaluatedOk; } -//-------------------------------------------------------------------------------------------------- -/// Find the last assignment using := and interpret the text before the := as LHS -//-------------------------------------------------------------------------------------------------- -QString RimSummaryCalculation::findLeftHandSide( const QString& expression ) -{ - int index = expression.lastIndexOf( ":=" ); - if ( index > 0 ) - { - QString s = expression.left( index ).simplified(); - - QStringList words = s.split( " " ); - - if ( words.size() > 0 ) - { - return words.back(); - } - } - - return ""; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCalculation::attachToWidget() -{ - for ( auto e : m_expression.uiCapability()->connectedEditors() ) - { - caf::PdmUiTextEditor* textEditor = dynamic_cast( e ); - if ( !textEditor ) continue; - - QWidget* containerWidget = textEditor->editorWidget(); - if ( !containerWidget ) continue; - - for ( auto qObj : containerWidget->children() ) - { - QTextEdit* textEdit = dynamic_cast( qObj ); - if ( textEdit ) - { - m_exprContextMenuMgr->attachTextEdit( textEdit ); - } - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryCalculation::fieldChangedByUi( const caf::PdmFieldHandle* changedField, - const QVariant& oldValue, - const QVariant& newValue ) -{ - m_isDirty = true; - - PdmObject::fieldChangedByUi( changedField, oldValue, newValue ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryCalculationVariable* RimSummaryCalculation::findByName( const QString& name ) const -{ - for ( RimSummaryCalculationVariable* v : m_variables ) - { - if ( v->name() == name ) - { - return v; - } - } - - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryCalculation::buildCalculationName() const -{ - QString name = "Default Calculation Name"; - - QString lhs = RimSummaryCalculation::findLeftHandSide( m_expression ); - if ( !lhs.isEmpty() ) - { - name = lhs; - - name += " ( "; - - for ( RimSummaryCalculationVariable* v : m_variables ) - { - name += v->summaryAddressDisplayString(); - - if ( v != m_variables[m_variables.size() - 1] ) - { - name += ", "; - } - } - - name += " )"; - } - - return name; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCalculation::defineEditorAttribute( const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute ) -{ - if ( field == &m_expression ) - { - caf::PdmUiTextEditorAttribute* myAttr = dynamic_cast( attribute ); - if ( myAttr ) - { - myAttr->heightHint = -1; - } - } - else if ( field == &m_variables ) - { - auto* myAttr = dynamic_cast( attribute ); - if ( myAttr ) - { - myAttr->enableDropTarget = true; - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCalculation::updateDependentCurvesAndPlots() +void RimSummaryCalculation::updateDependentObjects() { RimSummaryCalculationCollection* calcColl = nullptr; this->firstAncestorOrThisOfTypeAsserted( calcColl ); @@ -509,15 +190,3 @@ void RimSummaryCalculation::updateDependentCurvesAndPlots() } } } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimSummaryCalculation::allVariables() const -{ - std::vector outVariables; - for ( RimSummaryCalculationVariable* v : m_variables ) - outVariables.push_back( v ); - - return outVariables; -} diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h index ee560a3fee..4708be464a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h @@ -18,79 +18,35 @@ #pragma once +#include "RimSummaryCalculationVariable.h" +#include "RimUserDefinedCalculation.h" + #include "RiuExpressionContextMenuManager.h" + #include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" + #include + #include -class RimSummaryCalculationVariable; class QTextEdit; //================================================================================================== /// /// //================================================================================================== -class RimSummaryCalculation : public caf::PdmObject +class RimSummaryCalculation : public RimUserDefinedCalculation { CAF_PDM_HEADER_INIT; public: RimSummaryCalculation(); - void setDescription( const QString& description ); - QString description() const; - - void setId( int id ); - int id() const; - - bool isDirty() const; - - caf::PdmChildArrayFieldHandle* variables(); - - std::vector allVariables() const; - - const std::vector& values() const; - const std::vector& timeSteps() const; - - void setExpression( const QString& expr ); - QString expression() const; - QString unitName() const; - - bool parseExpression(); - bool calculate(); - void updateDependentCurvesAndPlots(); - - caf::PdmFieldHandle* userDescriptionField() override; - - static QString findLeftHandSide( const QString& expression ); - void attachToWidget(); - -private: - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - - void defineEditorAttribute( const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute ) override; - RimSummaryCalculationVariable* findByName( const QString& name ) const; - RimSummaryCalculationVariable* addVariable( const QString& name ); - void deleteVariable( RimSummaryCalculationVariable* calcVariable ); - - QString buildCalculationName() const; - -private: - caf::PdmField m_description; - caf::PdmField m_expression; - caf::PdmField m_unit; - - caf::PdmChildArrayField m_variables; - - caf::PdmField> m_calculatedValues; - caf::PdmField> m_timesteps; - caf::PdmField m_id; - - std::unique_ptr m_exprContextMenuMgr; + bool calculate() override; + void updateDependentObjects() override; - bool m_isDirty; +protected: + RimSummaryCalculationVariable* createVariable() const override; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp index c46e92a38f..54dc647524 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp @@ -33,9 +33,6 @@ RimSummaryCalculationCollection::RimSummaryCalculationCollection() { CAF_PDM_InitObject( "Calculation Collection", ":/chain.png" ); - CAF_PDM_InitFieldNoDefault( &m_calculations, "Calculations", "Calculations" ); - m_calculations.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault( &m_calcuationSummaryCase, "CalculationsSummaryCase", "Calculations Summary Case" ); m_calcuationSummaryCase.xmlCapability()->disableIO(); m_calcuationSummaryCase = new RimCalculatedSummaryCase; @@ -44,95 +41,9 @@ RimSummaryCalculationCollection::RimSummaryCalculationCollection() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryCalculation* RimSummaryCalculationCollection::addCalculation() -{ - RimSummaryCalculation* calculation = new RimSummaryCalculation; - RimProject::current()->assignCalculationIdToCalculation( calculation ); - - QString varName = QString( "Calculation_%1" ).arg( calculation->id() ); - calculation->setDescription( varName ); - calculation->setExpression( varName + " := x + y" ); - calculation->parseExpression(); - - m_calculations.push_back( calculation ); - - rebuildCaseMetaData(); - - return calculation; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryCalculation* RimSummaryCalculationCollection::addCalculationCopy( const RimSummaryCalculation* sourceCalculation ) -{ - RimSummaryCalculation* calcCopy = dynamic_cast( - sourceCalculation->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); - CVF_ASSERT( calcCopy ); - - std::set calcNames; - for ( const auto& calc : m_calculations ) - { - calcNames.insert( calc->findLeftHandSide( calc->expression() ) ); - } - - QString expression = calcCopy->expression(); - QString currVarName = calcCopy->findLeftHandSide( expression ); - - QString newVarName = currVarName; - while ( calcNames.count( newVarName ) > 0 ) - { - newVarName += "_copy"; - } - - expression.replace( currVarName, newVarName ); - calcCopy->setExpression( expression ); - - RimProject::current()->assignCalculationIdToCalculation( calcCopy ); - - m_calculations.push_back( calcCopy ); - - calcCopy->resolveReferencesRecursively(); - rebuildCaseMetaData(); - calcCopy->parseExpression(); - - return calcCopy; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCalculationCollection::deleteCalculation( RimSummaryCalculation* calculation ) -{ - m_calculations.removeChildObject( calculation ); - - rebuildCaseMetaData(); - - delete calculation; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector RimSummaryCalculationCollection::calculations() const -{ - return m_calculations.childObjects(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimSummaryCalculation* RimSummaryCalculationCollection::findCalculationById( int id ) const +RimSummaryCalculation* RimSummaryCalculationCollection::createCalculation() const { - for ( RimSummaryCalculation* calc : m_calculations ) - { - if ( calc->id() == id ) - { - return calc; - } - } - - return nullptr; + return new RimSummaryCalculation; } //-------------------------------------------------------------------------------------------------- @@ -143,29 +54,12 @@ RimSummaryCase* RimSummaryCalculationCollection::calculationSummaryCase() return m_calcuationSummaryCase(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCalculationCollection::deleteAllContainedObjects() -{ - m_calculations.deleteAllChildObjects(); - - rebuildCaseMetaData(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimSummaryCalculationCollection::rebuildCaseMetaData() { - for ( RimSummaryCalculation* calculation : m_calculations ) - { - if ( calculation->id() == -1 ) - { - RimProject::current()->assignCalculationIdToCalculation( calculation ); - } - } - + ensureCalculationIds(); m_calcuationSummaryCase->buildMetaData(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.h b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.h index b6b47baf65..3d245d7ffb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.h @@ -18,11 +18,13 @@ #pragma once +#include "RimSummaryCalculation.h" +#include "RimUserDefinedCalculationCollection.h" + #include "cafPdmChildArrayField.h" #include "cafPdmChildField.h" #include "cafPdmObject.h" -class RimSummaryCalculation; class RimSummaryCase; class RimCalculatedSummaryCase; @@ -30,28 +32,22 @@ class RimCalculatedSummaryCase; /// /// //================================================================================================== -class RimSummaryCalculationCollection : public caf::PdmObject +class RimSummaryCalculationCollection : public RimUserDefinedCalculationCollection { CAF_PDM_HEADER_INIT; public: RimSummaryCalculationCollection(); - RimSummaryCalculation* addCalculation(); - RimSummaryCalculation* addCalculationCopy( const RimSummaryCalculation* sourceCalculation ); - void deleteCalculation( RimSummaryCalculation* calculation ); - std::vector calculations() const; - RimSummaryCalculation* findCalculationById( int id ) const; - RimSummaryCase* calculationSummaryCase(); - void deleteAllContainedObjects(); - void rebuildCaseMetaData(); + void rebuildCaseMetaData() override; + + RimSummaryCalculation* createCalculation() const override; private: void initAfterRead() override; private: - caf::PdmChildArrayField m_calculations; - caf::PdmChildField m_calcuationSummaryCase; + caf::PdmChildField m_calcuationSummaryCase; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp index 9b15ebd7da..94583d8be9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.cpp @@ -45,40 +45,16 @@ RimSummaryCalculationVariable::RimSummaryCalculationVariable() { CAF_PDM_InitObject( "RimSummaryCalculationVariable", ":/octave.png" ); - CAF_PDM_InitFieldNoDefault( &m_name, "VariableName", "Variable Name" ); - m_name.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_button, "PushButton", "" ); m_button.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); m_button.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_summaryAddressUi, "SummaryAddressUi", "Summary Address" ); - m_summaryAddressUi.registerGetMethod( this, &RimSummaryCalculationVariable::summaryAddressDisplayString ); - m_summaryAddressUi.xmlCapability()->disableIO(); - m_summaryAddressUi.uiCapability()->setUiReadOnly( true ); - CAF_PDM_InitFieldNoDefault( &m_case, "SummaryCase", "Summary Case" ); CAF_PDM_InitFieldNoDefault( &m_summaryAddress, "SummaryAddress", "Summary Address" ); m_summaryAddress = new RimSummaryAddress; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryCalculationVariable::name() const -{ - return m_name; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimSummaryCalculationVariable::setName( const QString& name ) -{ - m_name = name; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -131,7 +107,7 @@ void RimSummaryCalculationVariable::fieldChangedByUi( const caf::PdmFieldHandle* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimSummaryCalculationVariable::summaryAddressDisplayString() const +QString RimSummaryCalculationVariable::displayString() const { QString caseName; if ( m_case() ) caseName = m_case()->displayCaseName(); @@ -188,7 +164,7 @@ void RimSummaryCalculationVariable::handleDroppedMimeData( const QMimeData* void RimSummaryCalculationVariable::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { uiOrdering.add( &m_name ); - uiOrdering.add( &m_summaryAddressUi ); + uiOrdering.add( &m_addressUi ); uiOrdering.add( &m_button ); uiOrdering.skipRemainingFields(); diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.h b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.h index 3ec04bcddb..4a72fe8793 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.h +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationVariable.h @@ -18,13 +18,15 @@ #pragma once +#include "RimUserDefinedCalculationVariable.h" + +#include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmProxyValueField.h" #include "cafPdmPtrField.h" #include "RifEclipseSummaryAddressQMetaType.h" -#include "cafPdmChildField.h" class RimSummaryCase; class RimSummaryAddress; @@ -34,17 +36,14 @@ class RiuSummaryVectorSelectionDialog; /// /// //================================================================================================== -class RimSummaryCalculationVariable : public caf::PdmObject +class RimSummaryCalculationVariable : public RimUserDefinedCalculationVariable { CAF_PDM_HEADER_INIT; public: RimSummaryCalculationVariable(); - QString name() const; - void setName( const QString& name ); - - QString summaryAddressDisplayString() const; + QString displayString() const override; RimSummaryCase* summaryCase(); RimSummaryAddress* summaryAddress(); @@ -62,9 +61,6 @@ class RimSummaryCalculationVariable : public caf::PdmObject void writeDataToApplicationStore() const; private: - caf::PdmField m_name; - caf::PdmProxyValueField m_summaryAddressUi; - caf::PdmField m_button; caf::PdmPtrField m_case; diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp new file mode 100644 index 0000000000..a4ed397727 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp @@ -0,0 +1,382 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimUserDefinedCalculation.h" + +#include "expressionparser/ExpressionParser.h" + +#include "RiaLogging.h" + +#include "RimProject.h" +#include "RimUserDefinedCalculationVariable.h" + +#include "RiuExpressionContextMenuManager.h" + +#include "cafPdmUiLineEditor.h" +#include "cafPdmUiTableViewEditor.h" +#include "cafPdmUiTextEditor.h" + +#include + +CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimUserDefinedCalculation, "RimUserDefinedCalculation" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimUserDefinedCalculation::RimUserDefinedCalculation() +{ + CAF_PDM_InitObject( "RimUserDefinedCalculation", ":/octave.png", "Calculation", "" ); + + CAF_PDM_InitFieldNoDefault( &m_description, "Description", "Description" ); + m_description.uiCapability()->setUiReadOnly( true ); + + CAF_PDM_InitField( &m_expression, "Expression", QString( "" ), "Expression" ); + m_expression.uiCapability()->setUiEditorTypeName( caf::PdmUiTextEditor::uiEditorTypeName() ); + + CAF_PDM_InitField( &m_unit, "Unit", QString( "" ), "Unit" ); + m_unit.uiCapability()->setUiEditorTypeName( caf::PdmUiLineEditor::uiEditorTypeName() ); + + CAF_PDM_InitFieldNoDefault( &m_variables, "Variables", "Variables" ); + CAF_PDM_InitFieldNoDefault( &m_calculatedValues, "CalculatedValues", "Calculated Values" ); + + CAF_PDM_InitFieldNoDefault( &m_timesteps, "TimeSteps", "Time Steps" ); + CAF_PDM_InitField( &m_id, "Id", -1, "Id" ); + m_id.uiCapability()->setUiHidden( true ); + + m_exprContextMenuMgr = std::unique_ptr( new RiuExpressionContextMenuManager() ); + + m_isDirty = false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculation::setDescription( const QString& description ) +{ + m_description = description; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimUserDefinedCalculation::description() const +{ + return m_description; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculation::setId( int id ) +{ + m_id = id; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimUserDefinedCalculation::id() const +{ + return m_id; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimUserDefinedCalculation::isDirty() const +{ + return m_isDirty; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmChildArrayFieldHandle* RimUserDefinedCalculation::variables() +{ + return &m_variables; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimUserDefinedCalculationVariable* RimUserDefinedCalculation::addVariable( const QString& name ) +{ + RimUserDefinedCalculationVariable* v = createVariable(); + v->setName( name ); + + m_variables.push_back( v ); + + return v; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculation::deleteVariable( RimUserDefinedCalculationVariable* calcVariable ) +{ + m_variables.removeChildObject( calcVariable ); + + delete calcVariable; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& RimUserDefinedCalculation::values() const +{ + return m_calculatedValues(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::vector& RimUserDefinedCalculation::timeSteps() const +{ + return m_timesteps(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculation::setExpression( const QString& expr ) +{ + m_expression = expr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimUserDefinedCalculation::expression() const +{ + return m_expression; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimUserDefinedCalculation::unitName() const +{ + return m_unit; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +caf::PdmFieldHandle* RimUserDefinedCalculation::userDescriptionField() +{ + return &m_description; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimUserDefinedCalculation::parseExpression() +{ + QString leftHandSideVariableName = RimUserDefinedCalculation::findLeftHandSide( m_expression ); + if ( leftHandSideVariableName.isEmpty() ) + { + RiaLogging::errorInMessageBox( nullptr, "Expression Parser", "Failed to detect left hand side of equation" ); + + return false; + } + + std::vector variableNames = ExpressionParser::detectReferencedVariables( m_expression ); + if ( variableNames.size() < 1 ) + { + RiaLogging::errorInMessageBox( nullptr, "Expression Parser", "Failed to detect any variable names" ); + + return false; + } + + // Remove variables not present in expression + { + std::vector toBeDeleted; + for ( RimUserDefinedCalculationVariable* v : m_variables ) + { + if ( std::find( variableNames.begin(), variableNames.end(), v->name() ) == variableNames.end() ) + { + toBeDeleted.push_back( v ); + } + + if ( leftHandSideVariableName == v->name() ) + { + toBeDeleted.push_back( v ); + } + } + + for ( RimUserDefinedCalculationVariable* v : toBeDeleted ) + { + deleteVariable( v ); + } + } + + for ( auto variableName : variableNames ) + { + if ( leftHandSideVariableName != variableName ) + { + if ( !findByName( variableName ) ) + { + this->addVariable( variableName ); + } + } + } + + m_description = buildCalculationName(); + + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// Find the last assignment using := and interpret the text before the := as LHS +//-------------------------------------------------------------------------------------------------- +QString RimUserDefinedCalculation::findLeftHandSide( const QString& expression ) +{ + int index = expression.lastIndexOf( ":=" ); + if ( index > 0 ) + { + QString s = expression.left( index ).simplified(); + + QStringList words = s.split( " " ); + + if ( words.size() > 0 ) + { + return words.back(); + } + } + + return ""; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculation::attachToWidget() +{ + for ( auto e : m_expression.uiCapability()->connectedEditors() ) + { + caf::PdmUiTextEditor* textEditor = dynamic_cast( e ); + if ( !textEditor ) continue; + + QWidget* containerWidget = textEditor->editorWidget(); + if ( !containerWidget ) continue; + + for ( auto qObj : containerWidget->children() ) + { + QTextEdit* textEdit = dynamic_cast( qObj ); + if ( textEdit ) + { + m_exprContextMenuMgr->attachTextEdit( textEdit ); + } + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculation::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) +{ + m_isDirty = true; + + PdmObject::fieldChangedByUi( changedField, oldValue, newValue ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimUserDefinedCalculationVariable* RimUserDefinedCalculation::findByName( const QString& name ) const +{ + for ( RimUserDefinedCalculationVariable* v : m_variables ) + { + if ( v->name() == name ) + { + return v; + } + } + + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimUserDefinedCalculation::buildCalculationName() const +{ + QString name = "Default Calculation Name"; + + QString lhs = RimUserDefinedCalculation::findLeftHandSide( m_expression ); + if ( !lhs.isEmpty() ) + { + name = lhs; + + name += " ( "; + + for ( RimUserDefinedCalculationVariable* v : m_variables ) + { + name += v->displayString(); + + if ( v != m_variables[m_variables.size() - 1] ) + { + name += ", "; + } + } + + name += " )"; + } + + return name; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculation::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + if ( field == &m_expression ) + { + caf::PdmUiTextEditorAttribute* myAttr = dynamic_cast( attribute ); + if ( myAttr ) + { + myAttr->heightHint = -1; + } + } + else if ( field == &m_variables ) + { + auto* myAttr = dynamic_cast( attribute ); + if ( myAttr ) + { + myAttr->enableDropTarget = true; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimUserDefinedCalculation::allVariables() const +{ + std::vector outVariables; + for ( RimUserDefinedCalculationVariable* v : m_variables ) + outVariables.push_back( v ); + + return outVariables; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h new file mode 100644 index 0000000000..2cac4dc97e --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h @@ -0,0 +1,101 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RiuExpressionContextMenuManager.h" + +#include "cafPdmChildArrayField.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" + +#include + +#include + +class RimUserDefinedCalculationVariable; +class QTextEdit; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimUserDefinedCalculation : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimUserDefinedCalculation(); + + void setDescription( const QString& description ); + QString description() const; + + void setId( int id ); + int id() const; + + bool isDirty() const; + + caf::PdmChildArrayFieldHandle* variables(); + + std::vector allVariables() const; + + const std::vector& values() const; + const std::vector& timeSteps() const; + + void setExpression( const QString& expr ); + QString expression() const; + QString unitName() const; + + bool parseExpression(); + virtual bool calculate() = 0; + virtual void updateDependentObjects() = 0; + + caf::PdmFieldHandle* userDescriptionField() override; + + static QString findLeftHandSide( const QString& expression ); + void attachToWidget(); + +protected: + virtual RimUserDefinedCalculationVariable* createVariable() const = 0; + + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; + RimUserDefinedCalculationVariable* findByName( const QString& name ) const; + RimUserDefinedCalculationVariable* addVariable( const QString& name ); + void deleteVariable( RimUserDefinedCalculationVariable* calcVariable ); + + QString buildCalculationName() const; + +protected: + caf::PdmField m_description; + caf::PdmField m_expression; + caf::PdmField m_unit; + + caf::PdmChildArrayField m_variables; + + caf::PdmField> m_calculatedValues; + caf::PdmField> m_timesteps; + caf::PdmField m_id; + + std::unique_ptr m_exprContextMenuMgr; + + bool m_isDirty; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp new file mode 100644 index 0000000000..17bf421b54 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp @@ -0,0 +1,172 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimUserDefinedCalculationCollection.h" + +#include "RimCalculatedSummaryCase.h" +#include "RimProject.h" +#include "RimUserDefinedCalculation.h" + +#include "cafPdmUiGroup.h" +#include "cafPdmUiTreeSelectionEditor.h" + +CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimUserDefinedCalculationCollection, "RimUserDefinedCalculationCollection" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimUserDefinedCalculationCollection::RimUserDefinedCalculationCollection() +{ + CAF_PDM_InitObject( "Calculation Collection", ":/chain.png" ); + + CAF_PDM_InitFieldNoDefault( &m_calculations, "Calculations", "Calculations" ); + m_calculations.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimUserDefinedCalculation* RimUserDefinedCalculationCollection::addCalculation() +{ + RimUserDefinedCalculation* calculation = createCalculation(); + assignCalculationIdToCalculation( calculation ); + + QString varName = QString( "Calculation_%1" ).arg( calculation->id() ); + calculation->setDescription( varName ); + calculation->setExpression( varName + " := x + y" ); + calculation->parseExpression(); + + m_calculations.push_back( calculation ); + + rebuildCaseMetaData(); + + return calculation; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimUserDefinedCalculation* + RimUserDefinedCalculationCollection::addCalculationCopy( const RimUserDefinedCalculation* sourceCalculation ) +{ + RimUserDefinedCalculation* calcCopy = dynamic_cast( + sourceCalculation->xmlCapability()->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + CVF_ASSERT( calcCopy ); + + std::set calcNames; + for ( const auto& calc : m_calculations ) + { + calcNames.insert( calc->findLeftHandSide( calc->expression() ) ); + } + + QString expression = calcCopy->expression(); + QString currVarName = calcCopy->findLeftHandSide( expression ); + + QString newVarName = currVarName; + while ( calcNames.count( newVarName ) > 0 ) + { + newVarName += "_copy"; + } + + expression.replace( currVarName, newVarName ); + calcCopy->setExpression( expression ); + + assignCalculationIdToCalculation( calcCopy ); + + m_calculations.push_back( calcCopy ); + + calcCopy->resolveReferencesRecursively(); + rebuildCaseMetaData(); + calcCopy->parseExpression(); + + return calcCopy; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculationCollection::deleteCalculation( RimUserDefinedCalculation* calculation ) +{ + m_calculations.removeChildObject( calculation ); + + rebuildCaseMetaData(); + + delete calculation; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimUserDefinedCalculationCollection::calculations() const +{ + return m_calculations.childObjects(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimUserDefinedCalculation* RimUserDefinedCalculationCollection::findCalculationById( int id ) const +{ + for ( RimUserDefinedCalculation* calc : m_calculations ) + { + if ( calc->id() == id ) + { + return calc; + } + } + + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculationCollection::deleteAllContainedObjects() +{ + m_calculations.deleteAllChildObjects(); + + rebuildCaseMetaData(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculationCollection::ensureCalculationIds() +{ + for ( RimUserDefinedCalculation* calculation : m_calculations ) + { + if ( calculation->id() == -1 ) + { + assignCalculationIdToCalculation( calculation ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculationCollection::assignCalculationIdToCalculation( RimUserDefinedCalculation* calculation ) const +{ + int nextValidCalculationId = 1; + for ( RimUserDefinedCalculation* existingCalculation : calculations() ) + { + nextValidCalculationId = std::max( nextValidCalculationId, existingCalculation->id() + 1 ); + } + + calculation->setId( nextValidCalculationId++ ); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.h b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.h new file mode 100644 index 0000000000..8a5b37ce81 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmChildArrayField.h" +#include "cafPdmChildField.h" +#include "cafPdmObject.h" + +class RimUserDefinedCalculation; +class RimUserDefinedCase; +class RimCalculatedSummaryCase; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimUserDefinedCalculationCollection : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimUserDefinedCalculationCollection(); + + RimUserDefinedCalculation* addCalculation(); + RimUserDefinedCalculation* addCalculationCopy( const RimUserDefinedCalculation* sourceCalculation ); + void deleteCalculation( RimUserDefinedCalculation* calculation ); + std::vector calculations() const; + RimUserDefinedCalculation* findCalculationById( int id ) const; + + void deleteAllContainedObjects(); + + virtual RimUserDefinedCalculation* createCalculation() const = 0; + virtual void rebuildCaseMetaData() = 0; + + void ensureCalculationIds(); + void assignCalculationIdToCalculation( RimUserDefinedCalculation* calculation ) const; + +private: + caf::PdmChildArrayField m_calculations; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationVariable.cpp new file mode 100644 index 0000000000..5c0f3ae545 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationVariable.cpp @@ -0,0 +1,53 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimUserDefinedCalculationVariable.h" + +CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimUserDefinedCalculationVariable, "RimUserDefinedCalculationVariable" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimUserDefinedCalculationVariable::RimUserDefinedCalculationVariable() +{ + CAF_PDM_InitObject( "RimUserDefinedCalculationVariable", ":/octave.png" ); + + CAF_PDM_InitFieldNoDefault( &m_name, "VariableName", "Variable Name" ); + m_name.uiCapability()->setUiReadOnly( true ); + + CAF_PDM_InitFieldNoDefault( &m_addressUi, "AddressUi", "Address" ); + m_addressUi.registerGetMethod( this, &RimUserDefinedCalculationVariable::displayString ); + m_addressUi.xmlCapability()->disableIO(); + m_addressUi.uiCapability()->setUiReadOnly( true ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimUserDefinedCalculationVariable::name() const +{ + return m_name; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimUserDefinedCalculationVariable::setName( const QString& name ) +{ + m_name = name; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationVariable.h b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationVariable.h new file mode 100644 index 0000000000..5bd5bf81f2 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationVariable.h @@ -0,0 +1,46 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmProxyValueField.h" + +class RimUserDefinedCase; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimUserDefinedCalculationVariable : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimUserDefinedCalculationVariable(); + + QString name() const; + void setName( const QString& name ); + + virtual QString displayString() const = 0; + +protected: + caf::PdmField m_name; + caf::PdmProxyValueField m_addressUi; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCurveReader.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCurveReader.cpp index d926e8765e..422a20837d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCurveReader.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimCalculatedSummaryCurveReader.cpp @@ -82,7 +82,7 @@ void RifCalculatedSummaryCurveReader::buildMetaData() { m_allResultAddresses.clear(); - for ( RimSummaryCalculation* calc : m_calculationCollection->calculations() ) + for ( RimUserDefinedCalculation* calc : m_calculationCollection->calculations() ) { m_allResultAddresses.insert( RifEclipseSummaryAddress::calculatedAddress( calc->description().toStdString(), calc->id() ) ); @@ -97,7 +97,7 @@ RimSummaryCalculation* { if ( m_calculationCollection && resultAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED ) { - return m_calculationCollection->findCalculationById( resultAddress.id() ); + return dynamic_cast( m_calculationCollection->findCalculationById( resultAddress.id() ) ); } return nullptr; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp index 9972780ce1..9387cbc236 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp @@ -165,7 +165,7 @@ void RimSummaryAddress::ensureCalculationIdIsAssigned() { RimSummaryCalculationCollection* calcColl = RimProject::current()->calculationCollection(); - for ( const RimSummaryCalculation* c : calcColl->calculations() ) + for ( const RimUserDefinedCalculation* c : calcColl->calculations() ) { QString description = c->description(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp index cee5a0f1f4..55504a3772 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp @@ -217,7 +217,7 @@ QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress& RimProject* proj = RimProject::current(); RimSummaryCalculationCollection* calcColl = proj->calculationCollection(); - RimSummaryCalculation* calculation = calcColl->findCalculationById( summaryAddress.id() ); + RimUserDefinedCalculation* calculation = calcColl->findCalculationById( summaryAddress.id() ); if ( calculation ) { text = calculation->description().toStdString(); diff --git a/ApplicationLibCode/UserInterface/RiuCalculationsContextMenuManager.cpp b/ApplicationLibCode/UserInterface/RiuCalculationsContextMenuManager.cpp index 52e807a48a..3fb635e834 100644 --- a/ApplicationLibCode/UserInterface/RiuCalculationsContextMenuManager.cpp +++ b/ApplicationLibCode/UserInterface/RiuCalculationsContextMenuManager.cpp @@ -17,14 +17,17 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RiuCalculationsContextMenuManager.h" + #include "RimSummaryCalculationCollection.h" -#include "SummaryPlotCommands/RicSummaryCurveCalculatorUi.h" + +#include "RicUserDefinedCalculatorUi.h" + #include //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuCalculationsContextMenuManager::attachWidget( QWidget* widget, RicSummaryCurveCalculatorUi* curveCalc ) +void RiuCalculationsContextMenuManager::attachWidget( QWidget* widget, RicUserDefinedCalculatorUi* curveCalc ) { if ( m_widget != widget ) { @@ -63,13 +66,15 @@ void RiuCalculationsContextMenuManager::slotMenuItems( QPoint point ) //-------------------------------------------------------------------------------------------------- void RiuCalculationsContextMenuManager::slotCreateCalculationCopy() { - RimSummaryCalculation* currCalculation = m_curveCalc != nullptr ? m_curveCalc->currentCalculation() : nullptr; - - if ( m_widget != nullptr && currCalculation != nullptr ) + if ( m_widget != nullptr && m_curveCalc != nullptr ) { - RimSummaryCalculationCollection* coll = RicSummaryCurveCalculatorUi::calculationCollection(); - RimSummaryCalculation* calcCopy = coll->addCalculationCopy( currCalculation ); - m_curveCalc->setCurrentCalculation( calcCopy ); - m_curveCalc->updateConnectedEditors(); + RimUserDefinedCalculation* currCalculation = m_curveCalc->currentCalculation(); + if ( currCalculation != nullptr ) + { + RimUserDefinedCalculationCollection* coll = m_curveCalc->calculationCollection(); + RimUserDefinedCalculation* calcCopy = coll->addCalculationCopy( currCalculation ); + m_curveCalc->setCurrentCalculation( calcCopy ); + m_curveCalc->updateConnectedEditors(); + } } } diff --git a/ApplicationLibCode/UserInterface/RiuCalculationsContextMenuManager.h b/ApplicationLibCode/UserInterface/RiuCalculationsContextMenuManager.h index f66649a151..7e7e0d27ee 100644 --- a/ApplicationLibCode/UserInterface/RiuCalculationsContextMenuManager.h +++ b/ApplicationLibCode/UserInterface/RiuCalculationsContextMenuManager.h @@ -21,14 +21,15 @@ #include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" + #include #include #include + #include #include -class RimSummaryCalculationVariable; -class RicSummaryCurveCalculatorUi; +class RicUserDefinedCalculatorUi; //================================================================================================== /// @@ -47,7 +48,7 @@ class RiuCalculationsContextMenuManager : public QObject { } - void attachWidget( QWidget* widget, RicSummaryCurveCalculatorUi* curveCalc ); + void attachWidget( QWidget* widget, RicUserDefinedCalculatorUi* curveCalc ); public slots: void slotMenuItems( QPoint point ); @@ -57,7 +58,7 @@ private slots: private: QPointer m_widget; - RicSummaryCurveCalculatorUi* m_curveCalc; + RicUserDefinedCalculatorUi* m_curveCalc; int m_textPosition; std::map> m_actionCache; }; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index af9e8106eb..be242a7dda 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -27,6 +27,8 @@ #include "RiaRegressionTest.h" #include "RiaRegressionTestRunner.h" +#include "RicGridCalculatorDialog.h" + #include "Rim2dIntersectionView.h" #include "Rim3dView.h" #include "RimCellEdgeColors.h" @@ -2113,3 +2115,16 @@ bool RiuMainWindow::isAnyMdiSubWindowVisible() { return !m_mdiArea->subWindowList().empty(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicGridCalculatorDialog* RiuMainWindow::gridCalculatorDialog( bool createIfNotPresent ) +{ + if ( !m_gridCalculatorDialog && createIfNotPresent ) + { + m_gridCalculatorDialog = std::make_unique( this ); + } + + return m_gridCalculatorDialog.get(); +} diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index a10c332832..0cc96192a9 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -51,6 +51,8 @@ class RiuRelativePermeabilityPlotPanel; class RiuPvtPlotPanel; class RiuMohrsCirclePlot; +class RicGridCalculatorDialog; + struct RimMdiWindowGeometry; namespace caf @@ -126,6 +128,8 @@ class RiuMainWindow : public RiuMainWindowBase void setDefaultToolbarVisibility(); void applyFontSizesToDockedPlots(); + RicGridCalculatorDialog* gridCalculatorDialog( bool createIfNotPresent ); + protected: void closeEvent( QCloseEvent* event ) override; @@ -171,10 +175,11 @@ class RiuMainWindow : public RiuMainWindowBase RiuProcessMonitor* m_processMonitor; QPointer m_messagePanel; - RiuResultQwtPlot* m_resultQwtPlot; - RiuMohrsCirclePlot* m_mohrsCirclePlot; - RiuRelativePermeabilityPlotPanel* m_relPermPlotPanel; - RiuPvtPlotPanel* m_pvtPlotPanel; + RiuResultQwtPlot* m_resultQwtPlot; + RiuMohrsCirclePlot* m_mohrsCirclePlot; + RiuRelativePermeabilityPlotPanel* m_relPermPlotPanel; + RiuPvtPlotPanel* m_pvtPlotPanel; + std::unique_ptr m_gridCalculatorDialog; QMenu* m_windowMenu; QLabel* m_memoryCriticalWarning; From fdefb214d82221d43a671b652fff8f9df83888db Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 2 May 2022 09:18:48 +0200 Subject: [PATCH 280/406] Grid Calculator: Minor tweaks to UI. --- .../ProjectDataModel/RimGridCalculation.cpp | 5 +++-- .../RimGridCalculationVariable.cpp | 20 +++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp index 9ea82a6347..fa65c19b34 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp @@ -18,15 +18,16 @@ #include "RimGridCalculation.h" -#include "RigCaseCellResultsData.h" #include "RimEclipseCase.h" -#include "expressionparser/ExpressionParser.h" #include "RiaLogging.h" #include "RiaPorosityModel.h" +#include "RigCaseCellResultsData.h" #include "RigEclipseResultAddress.h" +#include "expressionparser/ExpressionParser.h" + CAF_PDM_SOURCE_INIT( RimGridCalculation, "RimGridCalculation" ); //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp index d815fabcec..149ecf9c87 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp @@ -19,6 +19,7 @@ #include "RimGridCalculationVariable.h" #include "RiaApplication.h" +#include "RiaDefines.h" #include "RiaPorosityModel.h" #include "RiaResultNames.h" @@ -39,7 +40,7 @@ RimGridCalculationVariable::RimGridCalculationVariable() CAF_PDM_InitFieldNoDefault( &m_resultType, "ResultType", "Type" ); CAF_PDM_InitField( &m_resultVariable, "ResultVariable", RiaResultNames::undefinedResultName(), "Variable" ); CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseGridCase", "Grid Case" ); - CAF_PDM_InitFieldNoDefault( &m_timeStep, "TimeStep", "Time Step" ); + CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step" ); } //-------------------------------------------------------------------------------------------------- @@ -116,6 +117,9 @@ void RimGridCalculationVariable::defineUiOrdering( QString uiConfigName, caf::Pd uiOrdering.add( &m_timeStep ); uiOrdering.skipRemainingFields(); + + m_resultType.uiCapability()->setUiReadOnly( m_eclipseCase == nullptr ); + m_timeStep.uiCapability()->setUiReadOnly( m_resultType == RiaDefines::ResultCatType::STATIC_NATIVE ); } //-------------------------------------------------------------------------------------------------- @@ -126,7 +130,19 @@ QList { QList options; - if ( fieldNeedingOptions == &m_resultVariable ) + if ( fieldNeedingOptions == &m_resultType ) + { + std::vector resultCategories = { RiaDefines::ResultCatType::STATIC_NATIVE, + RiaDefines::ResultCatType::DYNAMIC_NATIVE, + RiaDefines::ResultCatType::INPUT_PROPERTY, + RiaDefines::ResultCatType::GENERATED }; + + for ( auto c : resultCategories ) + { + options.push_back( caf::PdmOptionItemInfo( caf::AppEnum( c ).uiText(), c ) ); + } + } + else if ( fieldNeedingOptions == &m_resultVariable ) { auto results = currentGridCellResults(); if ( results ) From b761bb42afd72cd2ecc53aff32e5f3fe88efdb06 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 2 May 2022 14:25:45 +0200 Subject: [PATCH 281/406] Grid Calculator: Fix view updates when calculation is changed or removed. --- .../Application/RiaApplication.cpp | 6 ++ .../ProjectDataModel/RimGridCalculation.cpp | 86 +++++++++++++------ .../ProjectDataModel/RimGridCalculation.h | 5 ++ .../ProjectDataModel/RimReloadCaseTools.h | 3 +- .../RimSummaryCalculation.cpp | 7 ++ .../ProjectDataModel/RimSummaryCalculation.h | 1 + .../RimUserDefinedCalculation.h | 1 + .../RimUserDefinedCalculationCollection.cpp | 1 + .../RigCaseCellResultsData.cpp | 19 ++++ .../RigCaseCellResultsData.h | 1 + 10 files changed, 102 insertions(+), 28 deletions(-) diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 576c26efe3..c4d53973ec 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -56,6 +56,7 @@ #include "RimGeoMechCellColors.h" #include "RimGeoMechModels.h" #include "RimGeoMechView.h" +#include "RimGridCalculationCollection.h" #include "RimIdenticalGridCaseGroup.h" #include "RimMainPlotCollection.h" #include "RimObservedDataCollection.h" @@ -647,6 +648,11 @@ bool RiaApplication::loadProject( const QString& projectFileName, } } + for ( auto gridCalculation : m_project->gridCalculationCollection()->calculations() ) + { + gridCalculation->calculate(); + } + if ( m_project->viewLinkerCollection() && m_project->viewLinkerCollection()->viewLinker() ) { m_project->viewLinkerCollection()->viewLinker()->updateOverrides(); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp index fa65c19b34..38adecfb53 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp @@ -18,7 +18,11 @@ #include "RimGridCalculation.h" +#include "RiaDefines.h" #include "RimEclipseCase.h" +#include "RimEclipseCellColors.h" +#include "RimEclipseView.h" +#include "RimReloadCaseTools.h" #include "RiaLogging.h" #include "RiaPorosityModel.h" @@ -122,6 +126,9 @@ bool RimGridCalculation::calculate() { eclipseCase->results( porosityModel )->createResultEntry( resAddr, true ); } + + eclipseCase->results( porosityModel )->clearScalarResult( resAddr ); + std::vector>* scalarResultFrames = eclipseCase->results( porosityModel )->modifiableCellScalarResultTimesteps( resAddr ); size_t timeStepCount = eclipseCase->results( porosityModel )->maxTimeStepCount(); @@ -143,36 +150,61 @@ bool RimGridCalculation::calculate() return evaluatedOk; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseCase* RimGridCalculation::findEclipseCaseFromVariables() +{ + RimEclipseCase* eclipseCase = nullptr; + for ( size_t i = 0; i < m_variables.size(); i++ ) + { + RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); + if ( v->eclipseCase() ) eclipseCase = v->eclipseCase(); + } + + return eclipseCase; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimGridCalculation::updateDependentObjects() { - // RimGridCalculationCollection* calcColl = nullptr; - // this->firstAncestorOrThisOfTypeAsserted( calcColl ); - // calcColl->rebuildCaseMetaData(); - - // RimGridMultiPlotCollection* summaryPlotCollection = RiaGridTools::summaryMultiPlotCollection(); - // for ( auto multiPlot : summaryPlotCollection->multiPlots() ) - // { - // for ( RimGridPlot* sumPlot : multiPlot->summaryPlots() ) - // { - // bool plotContainsCalculatedCurves = false; - - // for ( RimGridCurve* sumCurve : sumPlot->summaryCurves() ) - // { - // if ( sumCurve->summaryAddressY().category() == RifEclipseGridAddress::SUMMARY_CALCULATED ) - // { - // sumCurve->updateConnectedEditors(); - - // plotContainsCalculatedCurves = true; - // } - // } - - // if ( plotContainsCalculatedCurves ) - // { - // sumPlot->loadDataAndUpdate(); - // } - // } - // } + RimEclipseCase* eclipseCase = findEclipseCaseFromVariables(); + if ( eclipseCase ) + { + RimReloadCaseTools::updateAll3dViews( eclipseCase ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculation::removeDependentObjects() +{ + QString leftHandSideVariableName = RimGridCalculation::findLeftHandSide( m_expression ); + + auto porosityModel = RiaDefines::PorosityModelType::MATRIX_MODEL; + + RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::GENERATED, leftHandSideVariableName ); + + RimEclipseCase* eclipseCase = findEclipseCaseFromVariables(); + if ( eclipseCase ) + { + // Select default result if + for ( auto v : eclipseCase->reservoirViews() ) + { + if ( v->cellResult()->resultType() == resAddr.resultCatType() && + v->cellResult()->resultVariable() == resAddr.resultName() ) + { + v->cellResult()->setResultType( RiaDefines::ResultCatType::DYNAMIC_NATIVE ); + v->cellResult()->setResultVariable( "SOIL" ); + } + } + + eclipseCase->results( porosityModel )->clearScalarResult( resAddr ); + eclipseCase->results( porosityModel )->eraseGeneratedResult( resAddr ); + + RimReloadCaseTools::updateAll3dViews( eclipseCase ); + } } diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h index fa8a8d194f..8dbfcf6323 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h @@ -21,6 +21,8 @@ #include "RimGridCalculationVariable.h" #include "RimUserDefinedCalculation.h" +class RimEclipseCase; + //================================================================================================== /// /// @@ -34,7 +36,10 @@ class RimGridCalculation : public RimUserDefinedCalculation bool calculate() override; void updateDependentObjects() override; + void removeDependentObjects() override; protected: RimGridCalculationVariable* createVariable() const override; + + RimEclipseCase* findEclipseCaseFromVariables(); }; diff --git a/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.h b/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.h index f0f3b13123..37a2ae81dc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.h +++ b/ApplicationLibCode/ProjectDataModel/RimReloadCaseTools.h @@ -33,9 +33,10 @@ class RimReloadCaseTools // Reload grid data, but not summary static void reloadAllEclipseGridData( RimEclipseCase* eclipseCase ); + static void updateAll3dViews( RimEclipseCase* eclipseCase ); + private: static void reloadAllEclipseData( RimEclipseCase* eclipseCase, bool reloadSummaryData ); static void clearAllGridData( RigEclipseCaseData* eclipseCaseData ); - static void updateAll3dViews( RimEclipseCase* eclipseCase ); static void updateAllPlots(); }; diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp index 9ff4db0510..9893800743 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp @@ -190,3 +190,10 @@ void RimSummaryCalculation::updateDependentObjects() } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCalculation::removeDependentObjects() +{ +} diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h index 4708be464a..3b6594d2c0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h @@ -46,6 +46,7 @@ class RimSummaryCalculation : public RimUserDefinedCalculation bool calculate() override; void updateDependentObjects() override; + void removeDependentObjects() override; protected: RimSummaryCalculationVariable* createVariable() const override; diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h index 2cac4dc97e..6fb6d9ca82 100644 --- a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h @@ -64,6 +64,7 @@ class RimUserDefinedCalculation : public caf::PdmObject bool parseExpression(); virtual bool calculate() = 0; virtual void updateDependentObjects() = 0; + virtual void removeDependentObjects() = 0; caf::PdmFieldHandle* userDescriptionField() override; diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp index 17bf421b54..988c89f167 100644 --- a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp @@ -102,6 +102,7 @@ RimUserDefinedCalculation* //-------------------------------------------------------------------------------------------------- void RimUserDefinedCalculationCollection::deleteCalculation( RimUserDefinedCalculation* calculation ) { + calculation->removeDependentObjects(); m_calculations.removeChildObject( calculation ); rebuildCaseMetaData(); diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp index b83cf0fba2..614fcd9f28 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -21,6 +21,7 @@ #include "RigCaseCellResultsData.h" #include "RiaApplication.h" +#include "RiaDefines.h" #include "RiaEclipseUnitTools.h" #include "RiaLogging.h" @@ -42,6 +43,7 @@ #include "RifReaderEclipseOutput.h" +#include "cafAssert.h" #include "cafProgressInfo.h" #include "cvfGeometryTools.h" @@ -907,6 +909,23 @@ void RigCaseCellResultsData::eraseAllSourSimData() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigCaseCellResultsData::eraseGeneratedResult( const RigEclipseResultAddress& resultAddress ) +{ + CAF_ASSERT( resultAddress.resultCatType() == RiaDefines::ResultCatType::GENERATED ); + + for ( auto& it : m_resultInfos ) + { + if ( it.resultType() == RiaDefines::ResultCatType::GENERATED && it.resultName() == resultAddress.resultName() ) + { + it.setResultType( RiaDefines::ResultCatType::REMOVED ); + return; + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h index 4cb1a3efcb..0848af03a5 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h @@ -120,6 +120,7 @@ class RigCaseCellResultsData : public cvf::Object void clearAllResults(); void freeAllocatedResultsData(); void eraseAllSourSimData(); + void eraseGeneratedResult( const RigEclipseResultAddress& resultAddress ); QStringList resultNames( RiaDefines::ResultCatType type ) const; std::vector existingResults() const; From 144138904d7ff1e58704f37335fffd7bf8b6a4b1 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 2 May 2022 16:04:23 +0200 Subject: [PATCH 282/406] Avoid index-based iterator. --- .../ProjectDataModel/RimGridCalculation.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp index 38adecfb53..4ebda949fd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp @@ -155,14 +155,13 @@ bool RimGridCalculation::calculate() //-------------------------------------------------------------------------------------------------- RimEclipseCase* RimGridCalculation::findEclipseCaseFromVariables() { - RimEclipseCase* eclipseCase = nullptr; - for ( size_t i = 0; i < m_variables.size(); i++ ) + for ( auto variable : m_variables ) { - RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); - if ( v->eclipseCase() ) eclipseCase = v->eclipseCase(); + RimGridCalculationVariable* v = dynamic_cast( variable.p() ); + if ( v->eclipseCase() ) return v->eclipseCase(); } - return eclipseCase; + return nullptr; } //-------------------------------------------------------------------------------------------------- From 8ea4e933aaeed1e3bd6bb323dd7c3c1b34175998 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 4 May 2022 09:13:56 +0200 Subject: [PATCH 283/406] Grid Calculator: compute results for all time steps --- .../ProjectDataModel/RimGridCalculation.cpp | 110 +++++++++++------- .../RimGridCalculationVariable.cpp | 61 ++-------- .../RimGridCalculationVariable.h | 3 +- 3 files changed, 81 insertions(+), 93 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp index 4ebda949fd..ea31f92dd6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp @@ -59,21 +59,27 @@ bool RimGridCalculation::calculate() auto porosityModel = RiaDefines::PorosityModelType::MATRIX_MODEL; - RimEclipseCase* eclipseCase = nullptr; - std::vector> values; + RimEclipseCase* eclipseCase = findEclipseCaseFromVariables(); + if ( !eclipseCase ) + { + RiaLogging::errorInMessageBox( nullptr, + "Expression Parser", + QString( "No case found for calculation : %1" ).arg( leftHandSideVariableName ) ); + return false; + } + + const size_t timeStepCount = eclipseCase->results( porosityModel )->maxTimeStepCount(); + + std::vector>> values; for ( size_t i = 0; i < m_variables.size(); i++ ) { RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); - // Use the first defined eclipse case from for output - if ( !eclipseCase ) eclipseCase = v->eclipseCase(); - if ( !v->eclipseCase() ) { RiaLogging::errorInMessageBox( nullptr, "Expression Parser", QString( "No case defined for variable : %1" ).arg( v->name() ) ); - return false; } @@ -82,11 +88,11 @@ bool RimGridCalculation::calculate() RiaLogging::errorInMessageBox( nullptr, "Expression Parser", QString( "No result variable defined for variable : %1" ).arg( v->name() ) ); - return false; } - RigEclipseResultAddress resAddr( v->resultCategoryType(), v->resultVariable() ); + auto resultCategoryType = v->resultCategoryType(); + RigEclipseResultAddress resAddr( resultCategoryType, v->resultVariable() ); if ( !eclipseCase->results( porosityModel )->ensureKnownResultLoaded( resAddr ) ) { RiaLogging::errorInMessageBox( nullptr, @@ -95,59 +101,79 @@ bool RimGridCalculation::calculate() return false; } + int timeStep = v->timeStep(); + std::vector> inputValues = eclipseCase->results( porosityModel )->cellScalarResults( resAddr ); + if ( resultCategoryType == RiaDefines::ResultCatType::STATIC_NATIVE ) + { + // Use static data for all time steps + inputValues.resize( timeStepCount ); + for ( size_t tsId = 1; tsId < timeStepCount; tsId++ ) + { + inputValues[tsId] = inputValues[0]; + } + } + else if ( timeStep != RimGridCalculationVariable::allTimeStepsValue() ) + { + // Use data from a specific time step for this variable for all result time steps + for ( size_t tsId = 0; tsId < timeStepCount; tsId++ ) + { + if ( static_cast( tsId ) != timeStep ) + { + inputValues[tsId] = inputValues[timeStep]; + } + } + } - values.push_back( inputValues[0] ); + values.push_back( inputValues ); } - ExpressionParser parser; - for ( size_t i = 0; i < m_variables.size(); i++ ) - { - RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); + RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::GENERATED, leftHandSideVariableName ); - parser.assignVector( v->name(), values[i] ); + if ( !eclipseCase->results( porosityModel )->ensureKnownResultLoaded( resAddr ) ) + { + eclipseCase->results( porosityModel )->createResultEntry( resAddr, true ); } - std::vector resultValues; - resultValues.resize( values[0].size() ); - parser.assignVector( leftHandSideVariableName, resultValues ); + eclipseCase->results( porosityModel )->clearScalarResult( resAddr ); - QString errorText; - bool evaluatedOk = parser.expandIfStatementsAndEvaluate( m_expression, &errorText ); + std::vector>* scalarResultFrames = + eclipseCase->results( porosityModel )->modifiableCellScalarResultTimesteps( resAddr ); + scalarResultFrames->resize( timeStepCount ); - if ( evaluatedOk ) + for ( size_t tsId = 0; tsId < timeStepCount; tsId++ ) { - m_timesteps.v().clear(); - m_calculatedValues.v().clear(); - - RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::GENERATED, leftHandSideVariableName ); - - if ( !eclipseCase->results( porosityModel )->ensureKnownResultLoaded( resAddr ) ) + ExpressionParser parser; + for ( size_t i = 0; i < m_variables.size(); i++ ) { - eclipseCase->results( porosityModel )->createResultEntry( resAddr, true ); + RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); + parser.assignVector( v->name(), values[i][tsId] ); } - eclipseCase->results( porosityModel )->clearScalarResult( resAddr ); + std::vector resultValues; + resultValues.resize( values[0][tsId].size() ); + parser.assignVector( leftHandSideVariableName, resultValues ); - std::vector>* scalarResultFrames = - eclipseCase->results( porosityModel )->modifiableCellScalarResultTimesteps( resAddr ); - size_t timeStepCount = eclipseCase->results( porosityModel )->maxTimeStepCount(); - scalarResultFrames->resize( timeStepCount ); + QString errorText; + bool evaluatedOk = parser.expandIfStatementsAndEvaluate( m_expression, &errorText ); - size_t tsId = 0; - scalarResultFrames->at( tsId ) = resultValues; + if ( evaluatedOk ) + { + scalarResultFrames->at( tsId ) = resultValues; - m_isDirty = false; - } - else - { - QString s = "The following error message was received from the parser library : \n\n"; - s += errorText; + m_isDirty = false; + } + else + { + QString s = "The following error message was received from the parser library : \n\n"; + s += errorText; - RiaLogging::errorInMessageBox( nullptr, "Expression Parser", s ); + RiaLogging::errorInMessageBox( nullptr, "Expression Parser", s ); + return false; + } } - return evaluatedOk; + return true; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp index 149ecf9c87..6a85dfa2e9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp @@ -40,56 +40,7 @@ RimGridCalculationVariable::RimGridCalculationVariable() CAF_PDM_InitFieldNoDefault( &m_resultType, "ResultType", "Type" ); CAF_PDM_InitField( &m_resultVariable, "ResultVariable", RiaResultNames::undefinedResultName(), "Variable" ); CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseGridCase", "Grid Case" ); - CAF_PDM_InitField( &m_timeStep, "TimeStep", 0, "Time Step" ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimGridCalculationVariable::fieldChangedByUi( const caf::PdmFieldHandle* changedField, - const QVariant& oldValue, - const QVariant& newValue ) -{ - // if ( changedField == &m_button ) - // { - // bool updateContainingEditor = false; - - // { - // RiuGridVectorSelectionDialog dlg( nullptr ); - // dlg.hideEnsembles(); - - // readDataFromApplicationStore( &dlg ); - - // if ( dlg.exec() == QDialog::Accepted ) - // { - // std::vector curveSelection = dlg.curveSelection(); - // if ( curveSelection.size() > 0 ) - // { - // m_case = curveSelection[0].summaryCase(); - // m_summaryAddress->setAddress( curveSelection[0].summaryAddress() ); - - // writeDataToApplicationStore(); - - // updateContainingEditor = true; - // } - // } - // } - - // if ( updateContainingEditor ) - // { - // RimGridCalculation* rimCalculation = nullptr; - // this->firstAncestorOrThisOfTypeAsserted( rimCalculation ); - - // // RimCalculation is pointed to by RicGridCurveCalculator in a PtrField - // // Update editors connected to RicGridCurveCalculator - // std::vector referringObjects; - // rimCalculation->objectsWithReferringPtrFields( referringObjects ); - // for ( auto o : referringObjects ) - // { - // o->uiCapability()->updateConnectedEditors(); - // } - // } - // } + CAF_PDM_InitField( &m_timeStep, "TimeStep", allTimeStepsValue(), "Time Step" ); } //-------------------------------------------------------------------------------------------------- @@ -159,6 +110,8 @@ QList } else if ( fieldNeedingOptions == &m_timeStep ) { + options.push_back( caf::PdmOptionItemInfo( "All timesteps", allTimeStepsValue() ) ); + RimTools::timeStepsForCase( m_eclipseCase(), &options ); } @@ -218,3 +171,11 @@ int RimGridCalculationVariable::timeStep() const { return m_timeStep; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimGridCalculationVariable::allTimeStepsValue() +{ + return -1; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h index b9396d048f..7f388cafda 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h @@ -49,8 +49,9 @@ class RimGridCalculationVariable : public RimUserDefinedCalculationVariable QString resultVariable() const; int timeStep() const; + static int allTimeStepsValue(); + private: - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, From 85cd07c3733068d3add74e2ae2bd8ab008073353 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 9 May 2022 09:32:09 +0200 Subject: [PATCH 284/406] Grid Calculator: Improvements after review. --- .../ProjectDataModel/RimGridCalculation.cpp | 12 ++++++++---- .../RimGridCalculationCollection.cpp | 2 +- .../ProjectDataModel/RimGridCalculationCollection.h | 7 ------- .../ProjectDataModel/RimSummaryCalculation.cpp | 2 ++ .../ProjectDataModel/RimSummaryCalculation.h | 12 ------------ .../RimSummaryCalculationCollection.cpp | 2 +- .../ProjectDataModel/RimUserDefinedCalculation.cpp | 10 +++------- .../ProjectDataModel/RimUserDefinedCalculation.h | 5 +---- .../RimUserDefinedCalculationCollection.cpp | 4 ++-- .../RimUserDefinedCalculationCollection.h | 4 ++-- .../ReservoirDataModel/RigCaseCellResultsData.cpp | 2 +- .../ReservoirDataModel/RigCaseCellResultsData.h | 2 +- 12 files changed, 22 insertions(+), 42 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp index ea31f92dd6..7456d07b24 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp @@ -74,6 +74,7 @@ bool RimGridCalculation::calculate() for ( size_t i = 0; i < m_variables.size(); i++ ) { RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); + CAF_ASSERT( v != nullptr ); if ( !v->eclipseCase() ) { @@ -147,6 +148,7 @@ bool RimGridCalculation::calculate() for ( size_t i = 0; i < m_variables.size(); i++ ) { RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); + CAF_ASSERT( v != nullptr ); parser.assignVector( v->name(), values[i][tsId] ); } @@ -184,6 +186,8 @@ RimEclipseCase* RimGridCalculation::findEclipseCaseFromVariables() for ( auto variable : m_variables ) { RimGridCalculationVariable* v = dynamic_cast( variable.p() ); + CAF_ASSERT( v != nullptr ); + if ( v->eclipseCase() ) return v->eclipseCase(); } @@ -216,19 +220,19 @@ void RimGridCalculation::removeDependentObjects() RimEclipseCase* eclipseCase = findEclipseCaseFromVariables(); if ( eclipseCase ) { - // Select default result if + // Select "None" result if the result that is being removed were displayed in a view. for ( auto v : eclipseCase->reservoirViews() ) { if ( v->cellResult()->resultType() == resAddr.resultCatType() && v->cellResult()->resultVariable() == resAddr.resultName() ) { - v->cellResult()->setResultType( RiaDefines::ResultCatType::DYNAMIC_NATIVE ); - v->cellResult()->setResultVariable( "SOIL" ); + v->cellResult()->setResultType( RiaDefines::ResultCatType::GENERATED ); + v->cellResult()->setResultVariable( "None" ); } } eclipseCase->results( porosityModel )->clearScalarResult( resAddr ); - eclipseCase->results( porosityModel )->eraseGeneratedResult( resAddr ); + eclipseCase->results( porosityModel )->setRemovedTagOnGeneratedResult( resAddr ); RimReloadCaseTools::updateAll3dViews( eclipseCase ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.cpp index f5dda18508..4dd394ad60 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.cpp @@ -45,7 +45,7 @@ RimGridCalculation* RimGridCalculationCollection::createCalculation() const //-------------------------------------------------------------------------------------------------- void RimGridCalculationCollection::rebuildCaseMetaData() { - ensureCalculationIds(); + ensureValidCalculationIds(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.h b/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.h index ace28726c4..e5bc424e37 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationCollection.h @@ -21,13 +21,6 @@ #include "RimGridCalculation.h" #include "RimUserDefinedCalculationCollection.h" -#include "cafPdmChildArrayField.h" -#include "cafPdmChildField.h" -#include "cafPdmObject.h" - -class RimGridCase; -class RimCalculatedGridCase; - //================================================================================================== /// /// diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp index 9893800743..255312d0a9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.cpp @@ -71,6 +71,7 @@ bool RimSummaryCalculation::calculate() for ( size_t i = 0; i < m_variables.size(); i++ ) { RimSummaryCalculationVariable* v = dynamic_cast( m_variables[i] ); + CAF_ASSERT( v != nullptr ); if ( !v->summaryCase() ) { @@ -109,6 +110,7 @@ bool RimSummaryCalculation::calculate() for ( size_t i = 0; i < m_variables.size(); i++ ) { RimSummaryCalculationVariable* v = dynamic_cast( m_variables[i] ); + CAF_ASSERT( v != nullptr ); parser.assignVector( v->name(), timeHistoryCurveMerger.interpolatedYValuesForAllXValues( i ) ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h index 3b6594d2c0..5869fc5087 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculation.h @@ -21,18 +21,6 @@ #include "RimSummaryCalculationVariable.h" #include "RimUserDefinedCalculation.h" -#include "RiuExpressionContextMenuManager.h" - -#include "cafPdmChildArrayField.h" -#include "cafPdmField.h" -#include "cafPdmObject.h" - -#include - -#include - -class QTextEdit; - //================================================================================================== /// /// diff --git a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp index 54dc647524..d1e87b98a5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSummaryCalculationCollection.cpp @@ -59,7 +59,7 @@ RimSummaryCase* RimSummaryCalculationCollection::calculationSummaryCase() //-------------------------------------------------------------------------------------------------- void RimSummaryCalculationCollection::rebuildCaseMetaData() { - ensureCalculationIds(); + ensureValidCalculationIds(); m_calcuationSummaryCase->buildMetaData(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp index a4ed397727..ef54a26a9d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2017 Statoil ASA +// Copyright (C) 2022 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 @@ -353,7 +353,7 @@ void RimUserDefinedCalculation::defineEditorAttribute( const caf::PdmFieldHandle { if ( field == &m_expression ) { - caf::PdmUiTextEditorAttribute* myAttr = dynamic_cast( attribute ); + auto* myAttr = dynamic_cast( attribute ); if ( myAttr ) { myAttr->heightHint = -1; @@ -374,9 +374,5 @@ void RimUserDefinedCalculation::defineEditorAttribute( const caf::PdmFieldHandle //-------------------------------------------------------------------------------------------------- std::vector RimUserDefinedCalculation::allVariables() const { - std::vector outVariables; - for ( RimUserDefinedCalculationVariable* v : m_variables ) - outVariables.push_back( v ); - - return outVariables; + return m_variables.childObjects(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h index 6fb6d9ca82..6fdfc0b864 100644 --- a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2017 Statoil ASA +// Copyright (C) 2022 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 @@ -24,12 +24,9 @@ #include "cafPdmField.h" #include "cafPdmObject.h" -#include - #include class RimUserDefinedCalculationVariable; -class QTextEdit; //================================================================================================== /// diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp index 988c89f167..13a6c5a189 100644 --- a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2017 Statoil ASA +// Copyright (C) 2022 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 @@ -147,7 +147,7 @@ void RimUserDefinedCalculationCollection::deleteAllContainedObjects() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimUserDefinedCalculationCollection::ensureCalculationIds() +void RimUserDefinedCalculationCollection::ensureValidCalculationIds() { for ( RimUserDefinedCalculation* calculation : m_calculations ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.h b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.h index 8a5b37ce81..66698e9f24 100644 --- a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.h @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////////// // -// Copyright (C) 2017 Statoil ASA +// Copyright (C) 2022 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 @@ -48,7 +48,7 @@ class RimUserDefinedCalculationCollection : public caf::PdmObject virtual RimUserDefinedCalculation* createCalculation() const = 0; virtual void rebuildCaseMetaData() = 0; - void ensureCalculationIds(); + void ensureValidCalculationIds(); void assignCalculationIdToCalculation( RimUserDefinedCalculation* calculation ) const; private: diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 614fcd9f28..99c5d87e96 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -912,7 +912,7 @@ void RigCaseCellResultsData::eraseAllSourSimData() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RigCaseCellResultsData::eraseGeneratedResult( const RigEclipseResultAddress& resultAddress ) +void RigCaseCellResultsData::setRemovedTagOnGeneratedResult( const RigEclipseResultAddress& resultAddress ) { CAF_ASSERT( resultAddress.resultCatType() == RiaDefines::ResultCatType::GENERATED ); diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h index 0848af03a5..0f48ff3d83 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultsData.h @@ -120,7 +120,7 @@ class RigCaseCellResultsData : public cvf::Object void clearAllResults(); void freeAllocatedResultsData(); void eraseAllSourSimData(); - void eraseGeneratedResult( const RigEclipseResultAddress& resultAddress ); + void setRemovedTagOnGeneratedResult( const RigEclipseResultAddress& resultAddress ); QStringList resultNames( RiaDefines::ResultCatType type ) const; std::vector existingResults() const; From df1bb06f0946b4f125627d82724c5d8f003a249a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 6 May 2022 12:38:38 +0200 Subject: [PATCH 285/406] Support delete of multiple sub plots in one operation --- .../Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp | 2 ++ .../ProjectDataModel/RimContextCommandBuilder.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp index 72050a6372..e34960e0bc 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp @@ -48,6 +48,8 @@ bool RicDeleteSubPlotFeature::isCommandEnabled() if ( selection.size() > 0 ) { + if ( dynamic_cast( selection.front() ) ) return false; + size_t plotsSelected = 0; for ( caf::PdmObject* object : selection ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 0bc30a13ac..f8872c3b33 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1120,6 +1120,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicCloseSummaryCaseInCollectionFeature"; menuBuilder << "RicDeleteSummaryCaseCollectionFeature"; menuBuilder << "RicCloseObservedDataFeature"; + menuBuilder << "RicDeleteSubPlotFeature"; menuBuilder << "RicNewMultiPlotFeature"; menuBuilder << "RicAppendSummaryPlotsForObjectsFeature"; From 6f1819ba9676e1ed60cdd08c7c93e6678e04c7f2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 6 May 2022 16:09:12 +0200 Subject: [PATCH 286/406] MultiPlot: Reorder top level UI Set Auto Adjust Appearance to default value true --- .../Summary/RimSummaryMultiPlot.cpp | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 5cc888b2d5..a41c4472cc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -142,7 +142,7 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() m_appendPrevCurve.uiCapability()->setUiIconFromResourceString( ":/AppendPrevCurve.png" ); CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" ); - CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", false, "Auto Adjust Appearance" ); + CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", true, "Auto Adjust Appearance" ); CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Aggregation" ); @@ -350,38 +350,36 @@ void RimSummaryMultiPlot::populateNameHelper( RimSummaryPlotNameHelper* nameHelp //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { + auto axesGroup = uiOrdering.addNewGroup( "Axes" ); + axesGroup->add( &m_axisRangeAggregation ); + axesGroup->add( &m_linkSubPlotAxes ); + axesGroup->add( &m_autoAdjustAppearance ); + + m_linkSubPlotAxes.uiCapability()->setUiReadOnly( m_autoAdjustAppearance() ); + if ( m_autoAdjustAppearance() ) m_linkSubPlotAxes = false; + + auto dataSourceGroup = uiOrdering.addNewGroup( "Data Source" ); + m_sourceStepping()->uiOrdering( uiConfigName, *dataSourceGroup ); + auto titlesGroup = uiOrdering.addNewGroup( "Main Plot Settings" ); + titlesGroup->setCollapsedByDefault( true ); titlesGroup->add( &m_autoPlotTitles ); titlesGroup->add( &m_showPlotWindowTitle ); titlesGroup->add( &m_plotWindowTitle ); titlesGroup->add( &m_titleFontSize ); auto subPlotSettingsGroup = uiOrdering.addNewGroup( "Sub Plot Settings" ); + subPlotSettingsGroup->setCollapsedByDefault( true ); subPlotSettingsGroup->add( &m_autoPlotTitlesOnSubPlots ); subPlotSettingsGroup->add( &m_showIndividualPlotTitles ); subPlotSettingsGroup->add( &m_subTitleFontSize ); auto legendsGroup = uiOrdering.addNewGroup( "Legends" ); + legendsGroup->setCollapsedByDefault( true ); legendsGroup->add( &m_showPlotLegends ); legendsGroup->add( &m_plotLegendsHorizontal ); legendsGroup->add( &m_legendFontSize ); - auto layoutGroup = uiOrdering.addNewGroup( "Layout" ); - layoutGroup->add( &m_columnCount ); - layoutGroup->add( &m_rowsPerPage ); - - auto axesGroup = uiOrdering.addNewGroup( "Axes" ); - axesGroup->add( &m_axisRangeAggregation ); - - axesGroup->add( &m_linkSubPlotAxes ); - axesGroup->add( &m_autoAdjustAppearance ); - - m_linkSubPlotAxes.uiCapability()->setUiReadOnly( m_autoAdjustAppearance() ); - if ( m_autoAdjustAppearance() ) m_linkSubPlotAxes = false; - - auto dataSourceGroup = uiOrdering.addNewGroup( "Data Source" ); - m_sourceStepping()->uiOrdering( uiConfigName, *dataSourceGroup ); - uiOrdering.skipRemainingFields( true ); } From f52acd9a649a9b23ccf178ebc421418c7b711358 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 6 May 2022 16:34:37 +0200 Subject: [PATCH 287/406] #8893 Rename quantity name -> vector name --- .../Application/RiaSummaryCurveDefinition.cpp | 4 +- .../Application/RiaSummaryCurveDefinition.h | 2 +- .../Tools/RiaSummaryAddressAnalyzer.cpp | 4 +- .../Tools/RiaSummaryStringTools.cpp | 2 +- .../RicSummaryPlotTemplateTools.cpp | 2 +- .../RicNewEnsembleCurveFilterFeature.cpp | 4 +- .../RicSummaryPlotFeatureImpl.cpp | 4 +- .../FileInterface/RifColumnBasedUserData.cpp | 8 +- .../RifColumnBasedUserDataParser.cpp | 2 +- .../FileInterface/RifCsvUserDataParser.cpp | 2 +- .../RifEclipseSummaryAddress.cpp | 145 +++++++++--------- .../FileInterface/RifEclipseSummaryAddress.h | 54 +++---- .../FileInterface/RifEclipseSummaryTools.cpp | 2 +- .../RifEclipseUserDataKeywordTools.cpp | 2 +- .../RifEclipseUserDataParserTools.cpp | 28 ++-- .../RifEclipseUserDataParserTools.h | 2 +- .../RifEnsembleStatisticsReader.cpp | 9 +- .../FileInterface/RifOpmHdf5Summary.cpp | 2 +- .../FileInterface/RifReaderEclipseSummary.cpp | 18 +-- .../FileInterface/RifReaderObservedData.cpp | 6 +- .../FileInterface/RifReaderObservedData.h | 2 +- .../AnalysisPlots/RimAnalysisPlot.cpp | 38 ++--- .../AnalysisPlots/RimAnalysisPlot.h | 4 +- .../RimAnalysisPlotCollection.cpp | 2 +- .../AnalysisPlots/RimPlotDataFilterItem.cpp | 2 +- .../AnalysisPlots/RimPlotDataFilterItem.h | 6 +- .../RimAbstractCorrelationPlot.cpp | 6 +- .../RimAbstractCorrelationPlot.h | 2 +- .../RimCorrelationMatrixPlot.cpp | 2 +- .../CorrelationPlots/RimCorrelationPlot.cpp | 2 +- .../RimParameterResultCrossPlot.cpp | 2 +- .../RimDataSourceSteppingTools.cpp | 12 +- .../RimSimWellInViewCollection.cpp | 4 +- .../Summary/RimEnsembleCurveFilter.cpp | 4 +- .../Summary/RimEnsembleCurveSet.cpp | 12 +- .../Summary/RimEnsembleCurveSetCollection.cpp | 10 +- .../RimMultipleSummaryPlotNameHelper.cpp | 8 +- .../RimMultipleSummaryPlotNameHelper.h | 4 +- .../Summary/RimObjectiveFunction.cpp | 14 +- .../Summary/RimObjectiveFunctionTools.cpp | 4 +- .../Summary/RimSummaryAddress.cpp | 18 +-- .../Summary/RimSummaryAddress.h | 2 +- .../Summary/RimSummaryAddressCollection.cpp | 2 +- .../Summary/RimSummaryCurve.cpp | 2 +- .../RimSummaryCurveAppearanceCalculator.cpp | 12 +- .../Summary/RimSummaryCurveAutoName.cpp | 12 +- .../Summary/RimSummaryCurveCollection.cpp | 16 +- .../Summary/RimSummaryMultiPlot.cpp | 11 +- .../Summary/RimSummaryNameHelper.cpp | 6 +- .../Summary/RimSummaryNameHelper.h | 18 +-- .../Summary/RimSummaryPlot.cpp | 6 +- .../Summary/RimSummaryPlotAxisFormatter.cpp | 9 +- ...RimSummaryPlotFilterTextCurveSetEditor.cpp | 2 +- .../Summary/RimSummaryPlotNameHelper.cpp | 4 +- .../Summary/RimSummaryPlotNameHelper.h | 4 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 38 ++--- .../Summary/RimSummaryPlotSourceStepping.h | 4 +- .../UnitTests/ObservedDataParser-Test.cpp | 4 +- .../RifEclipseSummaryAddress-Test.cpp | 50 +++--- .../RifReaderEclipseSummary-Test.cpp | 2 +- .../RiuSummaryVectorDescriptionMap-Test.cpp | 26 ++-- .../RiuSummaryQuantityNameInfoProvider.cpp | 20 +-- .../RiuSummaryQuantityNameInfoProvider.h | 6 +- .../RiuSummaryVectorSelectionUi.cpp | 10 +- 64 files changed, 359 insertions(+), 367 deletions(-) diff --git a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp b/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp index 3896529b43..4aaa94c576 100644 --- a/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp +++ b/ApplicationLibCode/Application/RiaSummaryCurveDefinition.cpp @@ -229,7 +229,7 @@ void RiaSummaryCurveDefinitionAnalyser::setCurveDefinitions( const std::vector m_ensembles; // All the ensembles referenced by the summary cases std::set m_summaryAdresses; - std::set m_quantityNames; // Quantity names from the addresses + std::set m_vectorNames; }; diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp index 0262ccd157..259254a39b 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp @@ -383,9 +383,9 @@ void RiaSummaryAddressAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAdd m_wellNames.insert( { wellName, address } ); } - if ( !address.quantityName().empty() ) + if ( !address.vectorName().empty() ) { - m_quantities.insert( address.quantityName() ); + m_quantities.insert( address.vectorName() ); } if ( !address.groupName().empty() ) diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp index 522a9490d3..9e9875c7b7 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp @@ -261,7 +261,7 @@ std::set std::set addressesWithoutDiffVectors; for ( const auto& adr : addresses ) { - if ( RiaStdStringTools::endsWith( adr.quantityName(), diffText ) ) continue; + if ( RiaStdStringTools::endsWith( adr.vectorName(), diffText ) ) continue; addressesWithoutDiffVectors.insert( adr ); } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index 5c0e4529ee..9f4095376c 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -490,7 +490,7 @@ RifEclipseSummaryAddress { for ( const auto& a : allAddresses ) { - if ( sourceAddress.quantityName() == a.quantityName() ) + if ( sourceAddress.vectorName() == a.vectorName() ) { return a; } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.cpp index c922fccd22..bef34d598c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewEnsembleCurveFilterFeature.cpp @@ -70,8 +70,8 @@ void RicNewEnsembleCurveFilterFeature::onActionTriggered( bool isChecked ) std::vector addresses; auto candidateAdr = newFilter->parentCurveSet()->summaryAddress(); - auto nativeQuantityName = RimObjectiveFunctionTools::nativeQuantityName( candidateAdr.quantityName() ); - candidateAdr.setQuantityName( nativeQuantityName ); + auto nativeQuantityName = RimObjectiveFunctionTools::nativeQuantityName( candidateAdr.vectorName() ); + candidateAdr.setVectorName( nativeQuantityName ); addresses.push_back( candidateAdr ); newFilter->setSummaryAddresses( addresses ); } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index f2bb9e18db..6dbf126feb 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -86,7 +86,7 @@ RimSummaryCurve* RicSummaryPlotFeatureImpl::createHistoryCurve( const RifEclipse RimSummaryCase* summaryCasesToUse ) { RifEclipseSummaryAddress historyAddr = addr; - historyAddr.setQuantityName( historyAddr.quantityName() + "H" ); + historyAddr.setVectorName( historyAddr.vectorName() + "H" ); if ( summaryCasesToUse->summaryReader()->allResultAddresses().count( historyAddr ) ) { return createCurve( summaryCasesToUse, historyAddr ); @@ -730,7 +730,7 @@ std::vector RicSummaryPlotFeatureImpl::addCurvesFromAddressFil std::vector historyAddressesToUse; for ( RifEclipseSummaryAddress historyAddr : curveAddressesToUse ) { - historyAddr.setQuantityName( historyAddr.quantityName() + "H" ); + historyAddr.setVectorName( historyAddr.vectorName() + "H" ); if ( addrs.count( historyAddr ) ) { historyAddressesToUse.push_back( historyAddr ); diff --git a/ApplicationLibCode/FileInterface/RifColumnBasedUserData.cpp b/ApplicationLibCode/FileInterface/RifColumnBasedUserData.cpp index b52d3108fc..470931ff42 100644 --- a/ApplicationLibCode/FileInterface/RifColumnBasedUserData.cpp +++ b/ApplicationLibCode/FileInterface/RifColumnBasedUserData.cpp @@ -196,27 +196,27 @@ std::vector RifColumnBasedUserData::createTimeSteps( const TableData& ta const Column& ci = tableData.columnInfos()[columIndex]; if ( dateColumnIndex == tableData.columnInfos().size() && - RifEclipseUserDataKeywordTools::isDate( ci.summaryAddress.quantityName() ) ) + RifEclipseUserDataKeywordTools::isDate( ci.summaryAddress.vectorName() ) ) { dateColumnIndex = columIndex; } if ( daysColumnIndex == tableData.columnInfos().size() && - RifEclipseUserDataKeywordTools::isTime( ci.summaryAddress.quantityName() ) && + RifEclipseUserDataKeywordTools::isTime( ci.summaryAddress.vectorName() ) && RifEclipseUserDataKeywordTools::isDays( ci.unitName ) ) { daysColumnIndex = columIndex; } if ( yearsColumnIndex == tableData.columnInfos().size() && - RifEclipseUserDataKeywordTools::isYears( ci.summaryAddress.quantityName() ) && + RifEclipseUserDataKeywordTools::isYears( ci.summaryAddress.vectorName() ) && RifEclipseUserDataKeywordTools::isYears( ci.unitName ) ) { yearsColumnIndex = columIndex; } if ( yearXColumnIndex == tableData.columnInfos().size() && - RifEclipseUserDataKeywordTools::isYearX( ci.summaryAddress.quantityName() ) && + RifEclipseUserDataKeywordTools::isYearX( ci.summaryAddress.vectorName() ) && RifEclipseUserDataKeywordTools::isYears( ci.unitName ) ) { yearXColumnIndex = columIndex; diff --git a/ApplicationLibCode/FileInterface/RifColumnBasedUserDataParser.cpp b/ApplicationLibCode/FileInterface/RifColumnBasedUserDataParser.cpp index ab9cdf70b0..7b3e6de120 100644 --- a/ApplicationLibCode/FileInterface/RifColumnBasedUserDataParser.cpp +++ b/ApplicationLibCode/FileInterface/RifColumnBasedUserDataParser.cpp @@ -105,7 +105,7 @@ void RifColumnBasedUserDataParser::parseTableData( const QString& data ) int stepTypeIndex = -1; for ( size_t i = 0; i < columnInfos.size(); i++ ) { - if ( RifEclipseUserDataKeywordTools::isStepType( columnInfos[i].summaryAddress.quantityName() ) ) + if ( RifEclipseUserDataKeywordTools::isStepType( columnInfos[i].summaryAddress.vectorName() ) ) { stepTypeIndex = static_cast( i ); } diff --git a/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp b/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp index cf491a8b75..175c1c2ef2 100644 --- a/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp +++ b/ApplicationLibCode/FileInterface/RifCsvUserDataParser.cpp @@ -379,7 +379,7 @@ bool RifCsvUserDataParser::parseColumnBasedData( const AsciiDataParseOptions& pa // Determine column data type if ( col.dataType == Column::NONE ) { - if ( QString::fromStdString( col.summaryAddress.quantityName() ) == parseOptions.timeSeriesColumnName ) + if ( QString::fromStdString( col.summaryAddress.vectorName() ) == parseOptions.timeSeriesColumnName ) { col.dataType = Column::DATETIME; } diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index f78ed769f0..02a15de185 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -105,8 +105,7 @@ RifEclipseSummaryAddress::RifEclipseSummaryAddress( SummaryVarCategory break; } - // Set quantity for all categories - m_quantityName = identifiers[INPUT_VECTOR_NAME]; + m_vectorName = identifiers[INPUT_VECTOR_NAME]; } //-------------------------------------------------------------------------------------------------- @@ -134,7 +133,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromEclipseTextAddressParseEr if ( address.category() == SUMMARY_INVALID || address.category() == SUMMARY_IMPORTED ) { - // Address category not recognized, use incoming text string without error prefix as quantity name + // Address category not recognized, use incoming text string without error prefix as vector name auto text = RiaStdStringTools::joinStrings( tokens, ':' ); address = importedAddress( text ); } @@ -156,14 +155,14 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromEclipseTextAddress( const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress::SummaryVarCategory RifEclipseSummaryAddress::identifyCategory( const std::string& quantityName ) +RifEclipseSummaryAddress::SummaryVarCategory RifEclipseSummaryAddress::identifyCategory( const std::string& vectorName ) { - if ( quantityName.size() < 3 || quantityName.size() > 8 ) return SUMMARY_INVALID; + if ( vectorName.size() < 3 || vectorName.size() > 8 ) return SUMMARY_INVALID; - auto strippedQuantityName = baseQuantityName( quantityName ); + auto strippedQuantityName = baseVectorName( vectorName ); // First, try to lookup vector in vector table - auto category = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( strippedQuantityName ); + auto category = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( strippedQuantityName ); if ( category != SUMMARY_INVALID ) return category; // Then check LGR categories @@ -180,22 +179,22 @@ RifEclipseSummaryAddress::SummaryVarCategory RifEclipseSummaryAddress::identifyC //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::fieldAddress( const std::string& quantityName ) +RifEclipseSummaryAddress RifEclipseSummaryAddress::fieldAddress( const std::string& vectorName ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_FIELD; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; return addr; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::aquiferAddress( const std::string& quantityName, int aquiferNumber ) +RifEclipseSummaryAddress RifEclipseSummaryAddress::aquiferAddress( const std::string& vectorName, int aquiferNumber ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_AQUIFER; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_aquiferNumber = aquiferNumber; return addr; } @@ -203,33 +202,33 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::aquiferAddress( const std::st //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::networkAddress( const std::string& quantityName ) +RifEclipseSummaryAddress RifEclipseSummaryAddress::networkAddress( const std::string& vectorName ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_NETWORK; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; return addr; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::miscAddress( const std::string& quantityName ) +RifEclipseSummaryAddress RifEclipseSummaryAddress::miscAddress( const std::string& vectorName ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_MISC; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; return addr; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::regionAddress( const std::string& quantityName, int regionNumber ) +RifEclipseSummaryAddress RifEclipseSummaryAddress::regionAddress( const std::string& vectorName, int regionNumber ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_REGION; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_regionNumber = regionNumber; return addr; } @@ -238,11 +237,11 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::regionAddress( const std::str /// //-------------------------------------------------------------------------------------------------- RifEclipseSummaryAddress - RifEclipseSummaryAddress::regionToRegionAddress( const std::string& quantityName, int regionNumber, int region2Number ) + RifEclipseSummaryAddress::regionToRegionAddress( const std::string& vectorName, int regionNumber, int region2Number ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_REGION_2_REGION; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_regionNumber = regionNumber; addr.m_regionNumber2 = region2Number; return addr; @@ -251,12 +250,11 @@ RifEclipseSummaryAddress //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::groupAddress( const std::string& quantityName, - const std::string& groupName ) +RifEclipseSummaryAddress RifEclipseSummaryAddress::groupAddress( const std::string& vectorName, const std::string& groupName ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_GROUP; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_groupName = groupName; return addr; } @@ -264,11 +262,11 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::groupAddress( const std::stri //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::wellAddress( const std::string& quantityName, const std::string& wellName ) +RifEclipseSummaryAddress RifEclipseSummaryAddress::wellAddress( const std::string& vectorName, const std::string& wellName ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_WELL; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_wellName = wellName; return addr; } @@ -276,7 +274,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::wellAddress( const std::strin //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::wellCompletionAddress( const std::string& quantityName, +RifEclipseSummaryAddress RifEclipseSummaryAddress::wellCompletionAddress( const std::string& vectorName, const std::string& wellName, int i, int j, @@ -284,7 +282,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::wellCompletionAddress( const { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_WELL_COMPLETION; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_wellName = wellName; addr.m_cellI = i; addr.m_cellJ = j; @@ -295,13 +293,13 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::wellCompletionAddress( const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::wellLgrAddress( const std::string& quantityName, +RifEclipseSummaryAddress RifEclipseSummaryAddress::wellLgrAddress( const std::string& vectorName, const std::string& lgrName, const std::string& wellName ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_WELL_LGR; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_lgrName = lgrName; addr.m_wellName = wellName; return addr; @@ -310,7 +308,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::wellLgrAddress( const std::st //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::wellCompletionLgrAddress( const std::string& quantityName, +RifEclipseSummaryAddress RifEclipseSummaryAddress::wellCompletionLgrAddress( const std::string& vectorName, const std::string& lgrName, const std::string& wellName, int i, @@ -319,7 +317,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::wellCompletionLgrAddress( con { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_WELL_COMPLETION_LGR; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_lgrName = lgrName; addr.m_wellName = wellName; addr.m_cellI = i; @@ -331,13 +329,13 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::wellCompletionLgrAddress( con //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::wellSegmentAddress( const std::string& quantityName, +RifEclipseSummaryAddress RifEclipseSummaryAddress::wellSegmentAddress( const std::string& vectorName, const std::string& wellName, int segmentNumber ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_WELL_SEGMENT; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_wellName = wellName; addr.m_wellSegmentNumber = segmentNumber; return addr; @@ -346,11 +344,11 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::wellSegmentAddress( const std //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::blockAddress( const std::string& quantityName, int i, int j, int k ) +RifEclipseSummaryAddress RifEclipseSummaryAddress::blockAddress( const std::string& vectorName, int i, int j, int k ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_BLOCK; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_cellI = i; addr.m_cellJ = j; addr.m_cellK = k; @@ -361,11 +359,11 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::blockAddress( const std::stri /// //-------------------------------------------------------------------------------------------------- RifEclipseSummaryAddress - RifEclipseSummaryAddress::blockLgrAddress( const std::string& quantityName, const std::string& lgrName, int i, int j, int k ) + RifEclipseSummaryAddress::blockLgrAddress( const std::string& vectorName, const std::string& lgrName, int i, int j, int k ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_BLOCK_LGR; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_lgrName = lgrName; addr.m_cellI = i; addr.m_cellJ = j; @@ -376,11 +374,11 @@ RifEclipseSummaryAddress //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::calculatedAddress( const std::string& quantityName, int id ) +RifEclipseSummaryAddress RifEclipseSummaryAddress::calculatedAddress( const std::string& vectorName, int id ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_CALCULATED; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; addr.m_id = id; return addr; } @@ -388,23 +386,23 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::calculatedAddress( const std: //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::importedAddress( const std::string& quantityName ) +RifEclipseSummaryAddress RifEclipseSummaryAddress::importedAddress( const std::string& vectorName ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_IMPORTED; - addr.m_quantityName = quantityName; + addr.m_vectorName = vectorName; return addr; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifEclipseSummaryAddress::ensembleStatisticsAddress( const std::string& quantityName, +RifEclipseSummaryAddress RifEclipseSummaryAddress::ensembleStatisticsAddress( const std::string& vectorName, const std::string& dataQuantityName ) { RifEclipseSummaryAddress addr; addr.m_variableCategory = SUMMARY_ENSEMBLE_STATISTICS; - addr.m_quantityName = quantityName + ":" + dataQuantityName; + addr.m_vectorName = vectorName + ":" + dataQuantityName; return addr; } @@ -454,19 +452,19 @@ bool RifEclipseSummaryAddress::isDependentOnWellName( SummaryVarCategory categor //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RifEclipseSummaryAddress::isHistoryQuantity() const +bool RifEclipseSummaryAddress::isHistoryVector() const { const std::string historyIdentifier = "H"; - return RiaStdStringTools::endsWith( m_quantityName, historyIdentifier ); + return RiaStdStringTools::endsWith( m_vectorName, historyIdentifier ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const std::string RifEclipseSummaryAddress::ensembleStatisticsQuantityName() const +const std::string RifEclipseSummaryAddress::ensembleStatisticsVectorName() const { - QString qName = QString::fromStdString( m_quantityName ); + QString qName = QString::fromStdString( m_vectorName ); return qName.split( ":" )[0].toStdString(); } @@ -479,7 +477,7 @@ std::string RifEclipseSummaryAddress::uiText() const if ( m_isErrorResult ) text += "ERR:"; - text += m_quantityName; + text += m_vectorName; std::string itemText = itemUiText(); if ( !itemText.empty() ) @@ -567,7 +565,7 @@ std::string RifEclipseSummaryAddress::itemUiText() const break; case SUMMARY_IMPORTED: { - text += this->quantityName(); + text += this->vectorName(); } break; } @@ -600,7 +598,7 @@ std::string case INPUT_AQUIFER_NUMBER: return std::to_string( aquiferNumber() ); case INPUT_VECTOR_NAME: - return quantityName(); + return vectorName(); case INPUT_ID: return std::to_string( id() ); } @@ -632,7 +630,7 @@ bool RifEclipseSummaryAddress::isUiTextMatchingFilterText( const QString& filter //-------------------------------------------------------------------------------------------------- bool RifEclipseSummaryAddress::isValid() const { - if ( m_quantityName.empty() ) return false; + if ( m_vectorName.empty() ) return false; switch ( category() ) { @@ -721,14 +719,14 @@ bool RifEclipseSummaryAddress::hasAccumulatedData() const { if ( !isValidEclipseCategory() ) return false; - QString quantityForInspection = QString::fromStdString( quantityName() ); + QString quantityForInspection = QString::fromStdString( vectorName() ); if ( category() == SUMMARY_ENSEMBLE_STATISTICS ) { // Remove statistics text prefix quantityForInspection = quantityForInspection.mid( quantityForInspection.indexOf( ":" ) + 1 ); } - QString qBaseName = QString::fromStdString( baseQuantityName( quantityForInspection.toStdString() ) ); + QString qBaseName = QString::fromStdString( baseVectorName( quantityForInspection.toStdString() ) ); if ( qBaseName.endsWith( "WCT" ) || qBaseName.endsWith( "WCTH" ) ) { @@ -749,36 +747,36 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector return RifEclipseSummaryAddress(); } - std::string quantityName; + std::string vectorName; std::string token1; std::string token2; - quantityName = tokens[0]; + vectorName = tokens[0]; if ( tokens.size() > 1 ) token1 = tokens[1]; if ( tokens.size() > 2 ) token2 = tokens[2]; - SummaryVarCategory category = identifyCategory( quantityName ); + SummaryVarCategory category = identifyCategory( vectorName ); switch ( category ) { case SUMMARY_FIELD: - return fieldAddress( quantityName ); + return fieldAddress( vectorName ); case SUMMARY_AQUIFER: - if ( !token1.empty() ) return aquiferAddress( quantityName, RiaStdStringTools::toInt( token1 ) ); + if ( !token1.empty() ) return aquiferAddress( vectorName, RiaStdStringTools::toInt( token1 ) ); break; case SUMMARY_NETWORK: - return networkAddress( quantityName ); + return networkAddress( vectorName ); break; case SUMMARY_MISC: - return miscAddress( quantityName ); + return miscAddress( vectorName ); break; case SUMMARY_REGION: - if ( !token1.empty() ) return regionAddress( quantityName, RiaStdStringTools::toInt( token1 ) ); + if ( !token1.empty() ) return regionAddress( vectorName, RiaStdStringTools::toInt( token1 ) ); break; case SUMMARY_REGION_2_REGION: @@ -787,7 +785,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector auto regions = RiaStdStringTools::splitString( token1, '-' ); if ( regions.size() == 2 ) { - return regionToRegionAddress( quantityName, + return regionToRegionAddress( vectorName, RiaStdStringTools::toInt( regions[0] ), RiaStdStringTools::toInt( regions[1] ) ); } @@ -795,11 +793,11 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector break; case SUMMARY_GROUP: - if ( !token1.empty() ) return groupAddress( quantityName, token1 ); + if ( !token1.empty() ) return groupAddress( vectorName, token1 ); break; case SUMMARY_WELL: - if ( !token1.empty() ) return wellAddress( quantityName, token1 ); + if ( !token1.empty() ) return wellAddress( vectorName, token1 ); break; case SUMMARY_WELL_COMPLETION: @@ -808,7 +806,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector auto ijk = RiaStdStringTools::splitString( token2, ',' ); if ( ijk.size() == 3 ) { - return wellCompletionAddress( quantityName, + return wellCompletionAddress( vectorName, token1, RiaStdStringTools::toInt( ijk[0] ), RiaStdStringTools::toInt( ijk[1] ), @@ -818,7 +816,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector break; case SUMMARY_WELL_LGR: - if ( !token1.empty() && !token2.empty() ) return wellLgrAddress( quantityName, token1, token2 ); + if ( !token1.empty() && !token2.empty() ) return wellLgrAddress( vectorName, token1, token2 ); break; case SUMMARY_WELL_COMPLETION_LGR: @@ -828,7 +826,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector auto ijk = RiaStdStringTools::splitString( token3, ',' ); if ( ijk.size() == 3 ) { - return wellCompletionLgrAddress( quantityName, + return wellCompletionLgrAddress( vectorName, token1, token2, RiaStdStringTools::toInt( ijk[0] ), @@ -839,8 +837,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector break; case SUMMARY_WELL_SEGMENT: - if ( !token2.empty() ) - return wellSegmentAddress( quantityName, token1, RiaStdStringTools::toInt( token2 ) ); + if ( !token2.empty() ) return wellSegmentAddress( vectorName, token1, RiaStdStringTools::toInt( token2 ) ); break; case SUMMARY_BLOCK: @@ -849,7 +846,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector auto ijk = RiaStdStringTools::splitString( token1, ',' ); if ( ijk.size() == 3 ) { - return blockAddress( quantityName, + return blockAddress( vectorName, RiaStdStringTools::toInt( ijk[0] ), RiaStdStringTools::toInt( ijk[1] ), RiaStdStringTools::toInt( ijk[2] ) ); @@ -863,7 +860,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector auto ijk = RiaStdStringTools::splitString( token2, ',' ); if ( ijk.size() == 3 ) { - return blockLgrAddress( quantityName, + return blockLgrAddress( vectorName, token1, RiaStdStringTools::toInt( ijk[0] ), RiaStdStringTools::toInt( ijk[1] ), @@ -911,9 +908,9 @@ bool RifEclipseSummaryAddress::isValidEclipseCategory() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::string RifEclipseSummaryAddress::baseQuantityName( const std::string& quantityName ) +std::string RifEclipseSummaryAddress::baseVectorName( const std::string& vectorName ) { - auto tmpString = quantityName; + auto tmpString = vectorName; if ( tmpString.size() == 8 ) tmpString = tmpString.substr( 0, 5 ); @@ -976,7 +973,7 @@ std::pair RifEclipseSummaryAddress::regionToRegionPairFromUiTe bool operator==( const RifEclipseSummaryAddress& first, const RifEclipseSummaryAddress& second ) { if ( first.category() != second.category() ) return false; - if ( first.quantityName() != second.quantityName() ) return false; + if ( first.vectorName() != second.vectorName() ) return false; switch ( first.category() ) { case RifEclipseSummaryAddress::SUMMARY_REGION: @@ -1072,7 +1069,7 @@ bool operator!=( const RifEclipseSummaryAddress& first, const RifEclipseSummaryA //-------------------------------------------------------------------------------------------------- bool operator<( const RifEclipseSummaryAddress& first, const RifEclipseSummaryAddress& second ) { - if ( first.quantityName() != second.quantityName() ) return first.quantityName() < second.quantityName(); + if ( first.vectorName() != second.vectorName() ) return first.vectorName() < second.vectorName(); switch ( first.category() ) { diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h index f807c1fc5f..718447567e 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h @@ -90,7 +90,7 @@ class RifEclipseSummaryAddress } RifEclipseSummaryAddress( SummaryVarCategory category, - const std::string& quantityName, + const std::string& vectorName, int16_t regionNumber, int16_t regionNumber2, const std::string& groupName, @@ -104,7 +104,7 @@ class RifEclipseSummaryAddress bool isErrorResult, int32_t id ) : m_variableCategory( category ) - , m_quantityName( quantityName ) + , m_vectorName( vectorName ) , m_regionNumber( regionNumber ) , m_regionNumber2( regionNumber2 ) , m_groupName( groupName ) @@ -127,36 +127,36 @@ class RifEclipseSummaryAddress static RifEclipseSummaryAddress fromEclipseTextAddress( const std::string& textAddress ); static RifEclipseSummaryAddress fromEclipseTextAddressParseErrorTokens( const std::string& textAddress ); - static SummaryVarCategory identifyCategory( const std::string& quantityName ); + static SummaryVarCategory identifyCategory( const std::string& vectorName ); - static RifEclipseSummaryAddress fieldAddress( const std::string& quantityName ); - static RifEclipseSummaryAddress aquiferAddress( const std::string& quantityName, int aquiferNumber ); - static RifEclipseSummaryAddress networkAddress( const std::string& quantityName ); - static RifEclipseSummaryAddress miscAddress( const std::string& quantityName ); - static RifEclipseSummaryAddress regionAddress( const std::string& quantityName, int regionNumber ); + static RifEclipseSummaryAddress fieldAddress( const std::string& vectorName ); + static RifEclipseSummaryAddress aquiferAddress( const std::string& vectorName, int aquiferNumber ); + static RifEclipseSummaryAddress networkAddress( const std::string& vectorName ); + static RifEclipseSummaryAddress miscAddress( const std::string& vectorName ); + static RifEclipseSummaryAddress regionAddress( const std::string& vectorName, int regionNumber ); static RifEclipseSummaryAddress - regionToRegionAddress( const std::string& quantityName, int regionNumber, int region2Number ); - static RifEclipseSummaryAddress groupAddress( const std::string& quantityName, const std::string& groupName ); - static RifEclipseSummaryAddress wellAddress( const std::string& quantityName, const std::string& wellName ); + regionToRegionAddress( const std::string& vectorName, int regionNumber, int region2Number ); + static RifEclipseSummaryAddress groupAddress( const std::string& vectorName, const std::string& groupName ); + static RifEclipseSummaryAddress wellAddress( const std::string& vectorName, const std::string& wellName ); static RifEclipseSummaryAddress - wellCompletionAddress( const std::string& quantityName, const std::string& wellName, int i, int j, int k ); + wellCompletionAddress( const std::string& vectorName, const std::string& wellName, int i, int j, int k ); static RifEclipseSummaryAddress - wellLgrAddress( const std::string& quantityName, const std::string& lgrName, const std::string& wellName ); - static RifEclipseSummaryAddress wellCompletionLgrAddress( const std::string& quantityName, + wellLgrAddress( const std::string& vectorName, const std::string& lgrName, const std::string& wellName ); + static RifEclipseSummaryAddress wellCompletionLgrAddress( const std::string& vectorName, const std::string& lgrName, const std::string& wellName, int i, int j, int k ); static RifEclipseSummaryAddress - wellSegmentAddress( const std::string& quantityName, const std::string& wellName, int segmentNumber ); - static RifEclipseSummaryAddress blockAddress( const std::string& quantityName, int i, int j, int k ); + wellSegmentAddress( const std::string& vectorName, const std::string& wellName, int segmentNumber ); + static RifEclipseSummaryAddress blockAddress( const std::string& vectorName, int i, int j, int k ); static RifEclipseSummaryAddress - blockLgrAddress( const std::string& quantityName, const std::string& lgrName, int i, int j, int k ); - static RifEclipseSummaryAddress calculatedAddress( const std::string& quantityName, int id ); - static RifEclipseSummaryAddress importedAddress( const std::string& quantityName ); - static RifEclipseSummaryAddress ensembleStatisticsAddress( const std::string& quantityName, - const std::string& dataQuantityName ); + blockLgrAddress( const std::string& vectorName, const std::string& lgrName, int i, int j, int k ); + static RifEclipseSummaryAddress calculatedAddress( const std::string& vectorName, int id ); + static RifEclipseSummaryAddress importedAddress( const std::string& vectorName ); + static RifEclipseSummaryAddress ensembleStatisticsAddress( const std::string& vectorName, + const std::string& datavectorName ); static std::string generateStringFromAddresses( const std::vector& addressVector, const std::string jointString = "; " ); @@ -166,8 +166,8 @@ class RifEclipseSummaryAddress // Access methods SummaryVarCategory category() const { return m_variableCategory; } - const std::string& quantityName() const { return m_quantityName; } - bool isHistoryQuantity() const; + const std::string& vectorName() const { return m_vectorName; } + bool isHistoryVector() const; int regionNumber() const { return m_regionNumber; } int regionNumber2() const { return m_regionNumber2; } @@ -183,7 +183,7 @@ class RifEclipseSummaryAddress int id() const { return m_id; } std::string blockAsString() const; - const std::string ensembleStatisticsQuantityName() const; + const std::string ensembleStatisticsVectorName() const; // Derived properties @@ -193,7 +193,7 @@ class RifEclipseSummaryAddress bool isUiTextMatchingFilterText( const QString& filterString ) const; bool isValid() const; - void setQuantityName( const std::string& quantity ) { m_quantityName = quantity; } + void setVectorName( const std::string& vectorName ) { m_vectorName = vectorName; } void setWellName( const std::string& wellName ) { m_wellName = wellName; } void setGroupName( const std::string& groupName ) { m_groupName = groupName; } void setRegion( int region ) { m_regionNumber = (int16_t)region; } @@ -208,7 +208,7 @@ class RifEclipseSummaryAddress bool hasAccumulatedData() const; - static std::string baseQuantityName( const std::string& quantityName ); + static std::string baseVectorName( const std::string& vectorName ); private: static RifEclipseSummaryAddress fromTokens( const std::vector& tokens ); @@ -218,7 +218,7 @@ class RifEclipseSummaryAddress std::string formatUiTextRegionToRegion() const; std::pair regionToRegionPairFromUiText( const std::string& s ); - std::string m_quantityName; + std::string m_vectorName; std::string m_groupName; std::string m_wellName; std::string m_lgrName; diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp index 61b3d059de..d414f37d10 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryTools.cpp @@ -151,7 +151,7 @@ void RifEclipseSummaryTools::dumpMetaData( RifSummaryReaderInterface* readerEcli for ( const auto& catAddresse : catAddresses ) { - std::cout << catAddresse.quantityName() << " " << catAddresse.regionNumber() << " " + std::cout << catAddresse.vectorName() << " " << catAddresse.regionNumber() << " " << catAddresse.regionNumber2() << " " << catAddresse.groupName() << " " << catAddresse.wellName() << " " << catAddresse.wellSegmentNumber() << " " << catAddresse.lgrName() << " " << catAddresse.cellI() << " " << catAddresse.cellJ() << " " diff --git a/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp index 600848236d..61bcdefbfb 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp @@ -322,7 +322,7 @@ size_t RifEclipseUserDataKeywordTools::computeRequiredHeaderLineCount( const std } } - // Quantity and unit, scaling is optional + // Vector name and unit, scaling is optional return 1 + maxHeaderLinesFromKeywords; } diff --git a/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp index 5b76161106..9e7eae7e5e 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.cpp @@ -430,17 +430,17 @@ TableData RifEclipseUserDataParserTools::tableDataFromText( std::stringstream& continue; } - std::string quantity = columnText[0]; - std::string unit = unitNames[i]; + std::string vectorName = columnText[0]; + std::string unit = unitNames[i]; std::vector columnHeader; if ( columnText.size() > 1 ) columnHeader.insert( columnHeader.begin(), columnText.begin() + 1, columnText.end() ); - RifEclipseSummaryAddress adr = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, columnHeader ); + RifEclipseSummaryAddress adr = RifEclipseUserDataKeywordTools::makeAndFillAddress( vectorName, columnHeader ); - Column ci = Column::createColumnInfoFromRsmData( quantity, unit, adr ); + Column ci = Column::createColumnInfoFromRsmData( vectorName, unit, adr ); columnInfos.push_back( ci ); } @@ -667,7 +667,7 @@ std::vector { if ( columnLines.size() == 0 ) continue; - std::string quantity = columnLines[0]; + std::string vectorName = columnLines[0]; std::string unit; size_t startIndex = 1; @@ -692,9 +692,9 @@ std::vector restOfHeader.push_back( columnLines[i] ); } - RifEclipseSummaryAddress adr = RifEclipseUserDataKeywordTools::makeAndFillAddress( quantity, restOfHeader ); + RifEclipseSummaryAddress adr = RifEclipseUserDataKeywordTools::makeAndFillAddress( vectorName, restOfHeader ); - Column ci = Column::createColumnInfoFromRsmData( quantity, unit, adr ); + Column ci = Column::createColumnInfoFromRsmData( vectorName, unit, adr ); table.push_back( ci ); } @@ -736,7 +736,7 @@ std::vector RifEclipseUserDataParserTools::mergeEqualTimeSteps( const QDateTime firstTableStartTime; for ( auto c : tables[0].columnInfos() ) { - if ( c.summaryAddress.quantityName() == "DATE" ) + if ( c.summaryAddress.vectorName() == "DATE" ) { if ( c.itemCount() > 0 ) { @@ -766,7 +766,7 @@ std::vector RifEclipseUserDataParserTools::mergeEqualTimeSteps( const QDateTime tableFirstTime; for ( auto& c : tables[i].columnInfos() ) { - if ( c.summaryAddress.quantityName() == "DATE" ) + if ( c.summaryAddress.vectorName() == "DATE" ) { if ( c.itemCount() > 0 ) { @@ -786,7 +786,7 @@ std::vector RifEclipseUserDataParserTools::mergeEqualTimeSteps( const { for ( auto& c : tables[i].columnInfos() ) { - if ( c.summaryAddress.quantityName() != "DATE" ) + if ( c.summaryAddress.vectorName() != "DATE" ) { firstTable.columnInfos().push_back( c ); } @@ -866,17 +866,17 @@ size_t Column::itemCount() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -Column Column::createColumnInfoFromRsmData( const std::string& quantity, +Column Column::createColumnInfoFromRsmData( const std::string& vectorName, const std::string& unit, const RifEclipseSummaryAddress& addr ) { Column ci( addr, unit ); - if ( RifEclipseUserDataKeywordTools::isDate( quantity ) ) + if ( RifEclipseUserDataKeywordTools::isDate( vectorName ) ) { ci.dataType = TEXT; } - else if ( RifEclipseUserDataKeywordTools::isStepType( quantity ) ) + else if ( RifEclipseUserDataKeywordTools::isStepType( vectorName ) ) { ci.dataType = TEXT; } @@ -924,7 +924,7 @@ QDateTime TableData::findFirstDate() const for ( auto ci : m_columnInfos ) { - if ( RifEclipseUserDataKeywordTools::isDate( ci.summaryAddress.quantityName() ) ) + if ( RifEclipseUserDataKeywordTools::isDate( ci.summaryAddress.vectorName() ) ) { if ( ci.itemCount() > 0 ) { diff --git a/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.h b/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.h index cf0d52bda5..8f1685b256 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.h +++ b/ApplicationLibCode/FileInterface/RifEclipseUserDataParserTools.h @@ -60,7 +60,7 @@ class Column size_t itemCount() const; public: - static Column createColumnInfoFromRsmData( const std::string& quantity, + static Column createColumnInfoFromRsmData( const std::string& vectorName, const std::string& unit, const RifEclipseSummaryAddress& addr ); static Column createColumnInfoFromCsvData( const RifEclipseSummaryAddress& addr, const std::string& unit ); diff --git a/ApplicationLibCode/FileInterface/RifEnsembleStatisticsReader.cpp b/ApplicationLibCode/FileInterface/RifEnsembleStatisticsReader.cpp index f3a88870a7..e70c9fe7ff 100644 --- a/ApplicationLibCode/FileInterface/RifEnsembleStatisticsReader.cpp +++ b/ApplicationLibCode/FileInterface/RifEnsembleStatisticsReader.cpp @@ -57,7 +57,7 @@ bool RifEnsembleStatisticsReader::values( const RifEclipseSummaryAddress& result if ( !validateAddress( resultAddress ) ) return false; const std::vector* sourceData = nullptr; - auto quantityName = resultAddress.ensembleStatisticsQuantityName(); + auto quantityName = resultAddress.ensembleStatisticsVectorName(); if ( quantityName == ENSEMBLE_STAT_P10_QUANTITY_NAME ) sourceData = &m_ensembleStatCase->p10(); @@ -88,12 +88,11 @@ std::string RifEnsembleStatisticsReader::unitName( const RifEclipseSummaryAddres auto cases = m_ensembleStatCase->curveSet()->summaryCaseCollection()->allSummaryCases(); if ( cases.size() > 0 ) { - // get rid of the stats part of the quantity name - QString qName = QString::fromStdString( resultAddress.quantityName() ); + QString qName = QString::fromStdString( resultAddress.vectorName() ); std::string orgQName = qName.split( ":" )[1].toStdString(); RifEclipseSummaryAddress address = RifEclipseSummaryAddress( resultAddress ); - address.setQuantityName( orgQName ); + address.setVectorName( orgQName ); retval = cases[0]->summaryReader()->unitName( address ); } @@ -114,5 +113,5 @@ RiaDefines::EclipseUnitSystem RifEnsembleStatisticsReader::unitSystem() const //-------------------------------------------------------------------------------------------------- bool RifEnsembleStatisticsReader::validateAddress( const RifEclipseSummaryAddress& address ) const { - return address.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS && !address.quantityName().empty(); + return address.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS && !address.vectorName().empty(); } diff --git a/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp b/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp index 5c9dd1b905..216e6291c4 100644 --- a/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp +++ b/ApplicationLibCode/FileInterface/RifOpmHdf5Summary.cpp @@ -102,7 +102,7 @@ bool RifOpmHdf5Summary::values( const RifEclipseSummaryAddress& resultAddress, s auto node = m_eSmry->summaryNodeList()[index]; int smspecIndex = static_cast( node.smspecKeywordIndex ); - const auto& vectorName = resultAddress.quantityName(); + const auto& vectorName = resultAddress.vectorName(); *values = m_hdf5Reader->values( vectorName, smspecIndex ); diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp index f6029a96de..42af9effd9 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseSummary.cpp @@ -180,16 +180,16 @@ bool RifReaderEclipseSummary::values( const RifEclipseSummaryAddress& resultAddr if ( m_differenceAddresses.count( resultAddress ) ) { - const std::string& quantityName = resultAddress.quantityName(); + const std::string& quantityName = resultAddress.vectorName(); auto historyQuantity = quantityName.substr( 0, quantityName.size() - differenceIdentifier().size() ) + historyIdentifier(); RifEclipseSummaryAddress nativeAdrNoHistory = resultAddress; - nativeAdrNoHistory.setQuantityName( historyQuantity ); + nativeAdrNoHistory.setVectorName( historyQuantity ); auto quantityNoHistory = quantityName.substr( 0, historyQuantity.size() - 1 ); RifEclipseSummaryAddress nativeAdrHistory = resultAddress; - nativeAdrHistory.setQuantityName( quantityNoHistory ); + nativeAdrHistory.setVectorName( quantityNoHistory ); std::vector nativeValues; std::vector historyValues; @@ -259,11 +259,11 @@ void RifReaderEclipseSummary::buildMetaData() RifEclipseSummaryAddress adrWithoutHistory; { - const std::string& s = adr.quantityName(); + const std::string& s = adr.vectorName(); if ( !RiaStdStringTools::endsWith( s, historyIdentifier() ) ) { RifEclipseSummaryAddress candidate = adr; - candidate.setQuantityName( s + historyIdentifier() ); + candidate.setVectorName( s + historyIdentifier() ); if ( m_allResultAddresses.count( candidate ) ) { adrWithHistory = candidate; @@ -276,8 +276,8 @@ void RifReaderEclipseSummary::buildMetaData() { RifEclipseSummaryAddress candidate = adr; - std::string s = candidate.quantityName() + differenceIdentifier(); - candidate.setQuantityName( s ); + std::string s = candidate.vectorName() + differenceIdentifier(); + candidate.setVectorName( s ); m_allResultAddresses.insert( candidate ); m_differenceAddresses.insert( candidate ); @@ -304,7 +304,7 @@ std::string RifReaderEclipseSummary::unitName( const RifEclipseSummaryAddress& r auto reader = currentSummaryReader(); if ( reader ) { - auto nativeName = resultAddress.quantityName(); + auto nativeName = resultAddress.vectorName(); auto stringToRemove = RifReaderEclipseSummary::differenceIdentifier(); if ( RiaStdStringTools::endsWith( nativeName, stringToRemove ) ) { @@ -312,7 +312,7 @@ std::string RifReaderEclipseSummary::unitName( const RifEclipseSummaryAddress& r } RifEclipseSummaryAddress adr( resultAddress ); - adr.setQuantityName( nativeName ); + adr.setVectorName( nativeName ); return reader->unitName( adr ); } diff --git a/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp b/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp index e834f6ff2d..b790f31e36 100644 --- a/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderObservedData.cpp @@ -154,11 +154,11 @@ const std::vector& RifReaderObservedData::timeSteps( const RifEclipseSum //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress RifReaderObservedData::address( const QString& quantity, +RifEclipseSummaryAddress RifReaderObservedData::address( const QString& vectorName, const QString& identifierName, RifEclipseSummaryAddress::SummaryVarCategory summaryCategory ) { - std::string quantityName = quantity.toStdString(); + std::string stdVectorName = vectorName.toStdString(); int regionNumber( -1 ); int regionNumber2( -1 ); std::string groupName; @@ -188,7 +188,7 @@ RifEclipseSummaryAddress RifReaderObservedData::address( const QString& } return RifEclipseSummaryAddress( summaryCategory, - quantityName, + stdVectorName, regionNumber, regionNumber2, groupName, diff --git a/ApplicationLibCode/FileInterface/RifReaderObservedData.h b/ApplicationLibCode/FileInterface/RifReaderObservedData.h index 3385bf057f..c45545ab05 100644 --- a/ApplicationLibCode/FileInterface/RifReaderObservedData.h +++ b/ApplicationLibCode/FileInterface/RifReaderObservedData.h @@ -54,7 +54,7 @@ class RifReaderObservedData : public RifSummaryReaderInterface RiaDefines::EclipseUnitSystem unitSystem() const override; private: - RifEclipseSummaryAddress address( const QString& quantity, + RifEclipseSummaryAddress address( const QString& vectorName, const QString& identifierName, RifEclipseSummaryAddress::SummaryVarCategory summaryCategory ); diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index ed4ea897ae..1f85a50d38 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -68,7 +68,7 @@ void caf::AppEnum::setUp() { addItem( RimAnalysisPlot::NONE, "NONE", "None" ); addItem( RimAnalysisPlot::SUMMARY_ITEM, "SUMMARY_ITEM", "Summary Item" ); - addItem( RimAnalysisPlot::QUANTITY, "QUANTITY", "Quantity" ); + addItem( RimAnalysisPlot::VECTOR, "VECTOR", "Vector" ); addItem( RimAnalysisPlot::CASE, "CASE", "Case" ); addItem( RimAnalysisPlot::ENSEMBLE, "ENSEMBLE", "Ensemble" ); addItem( RimAnalysisPlot::VALUE, "VALUE", "Value" ); @@ -157,7 +157,7 @@ RimAnalysisPlot::RimAnalysisPlot() CAF_PDM_InitField( &m_useEnsembleInBarText, "UseEnsembleInBarText", false, "Ensemble" ); CAF_PDM_InitField( &m_useSummaryItemInBarText, "UseSummaryItemInBarText", false, "Summary Item" ); CAF_PDM_InitField( &m_useTimeStepInBarText, "UseTimeStepInBarText", false, "Time Step" ); - CAF_PDM_InitField( &m_useQuantityInBarText, "UseQuantityInBarText", false, "Quantity" ); + CAF_PDM_InitField( &m_useVectorNameInBarText, "UseQuantityInBarText", false, "Vector" ); CAF_PDM_InitFieldNoDefault( &m_barTextFontSize, "BarTextFontSize", "Font Size" ); @@ -391,7 +391,7 @@ void RimAnalysisPlot::maxMinValueFromAddress( const RifEclipseSummaryAddress& { RifEclipseSummaryAddress historyAddr = address; - if ( !historyAddr.isHistoryQuantity() ) historyAddr.setQuantityName( address.quantityName() + "H" ); + if ( !historyAddr.isHistoryVector() ) historyAddr.setVectorName( address.vectorName() + "H" ); const std::vector& historyTimesteps = reader->timeSteps( historyAddr ); if ( historyTimesteps.size() ) @@ -498,9 +498,9 @@ void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering QString vectorNames; if ( getOrCreateSelectedCurveDefAnalyser() ) { - for ( const std::string& quantityName : getOrCreateSelectedCurveDefAnalyser()->m_quantityNames ) + for ( const std::string& vectorName : getOrCreateSelectedCurveDefAnalyser()->m_vectorNames ) { - vectorNames += QString::fromStdString( quantityName ) + ", "; + vectorNames += QString::fromStdString( vectorName ) + ", "; } if ( !vectorNames.isEmpty() ) @@ -546,14 +546,14 @@ void RimAnalysisPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering caf::PdmUiGroup* barLabelGrp = uiOrdering.addNewGroup( "Bar Labels" ); barLabelGrp->add( &m_useBarText ); barLabelGrp->add( &m_barTextFontSize ); - barLabelGrp->add( &m_useQuantityInBarText ); + barLabelGrp->add( &m_useVectorNameInBarText ); barLabelGrp->add( &m_useSummaryItemInBarText ); barLabelGrp->add( &m_useCaseInBarText ); barLabelGrp->add( &m_useEnsembleInBarText ); barLabelGrp->add( &m_useTimeStepInBarText ); m_barTextFontSize.uiCapability()->setUiReadOnly( !m_useBarText ); - m_useQuantityInBarText.uiCapability()->setUiReadOnly( !m_useBarText ); + m_useVectorNameInBarText.uiCapability()->setUiReadOnly( !m_useBarText ); m_useSummaryItemInBarText.uiCapability()->setUiReadOnly( !m_useBarText ); m_useCaseInBarText.uiCapability()->setUiReadOnly( !m_useBarText ); m_useEnsembleInBarText.uiCapability()->setUiReadOnly( !m_useBarText ); @@ -671,7 +671,7 @@ QList RimAnalysisPlot::calculateValueOptions( const caf: QString( "%1 (%2)" ).arg( SortGroupAppEnum::uiText( SUMMARY_ITEM ) ).arg( exampleString ); options.push_back( caf::PdmOptionItemInfo( summaryItemText, SUMMARY_ITEM ) ); } - options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( QUANTITY ), QUANTITY ) ); + options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( VECTOR ), VECTOR ) ); options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( CASE ), CASE ) ); options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( ENSEMBLE ), ENSEMBLE ) ); options.push_back( caf::PdmOptionItemInfo( SortGroupAppEnum::uiText( TIME_STEP ), TIME_STEP ) ); @@ -991,11 +991,11 @@ QString RimAnalysisPlot::assignGroupingText( RimAnalysisPlot::SortGroupType sor } } break; - case RimAnalysisPlot::QUANTITY: + case RimAnalysisPlot::VECTOR: { RifEclipseSummaryAddress addr = dataEntry.summaryAddress(); - groupingText = QString::fromStdString( addr.quantityName() ); + groupingText = QString::fromStdString( addr.vectorName() ); } break; case RimAnalysisPlot::TIME_STEP: @@ -1056,7 +1056,7 @@ std::vector RimAnalysisPlot::filteredCurveDefs() RifEclipseSummaryAddress address = curveDef.summaryAddress(); - address.setQuantityName( "" ); // Quantity name set to "" in order to store only unique summary items + address.setVectorName( "" ); // Vector name set to "" in order to store only unique summary items filteredSummaryItems.insert( address ); } } @@ -1076,7 +1076,7 @@ std::vector RimAnalysisPlot::filteredCurveDefs() { RimSummaryCase* sumCase = curveDefCandidate.summaryCase(); RifEclipseSummaryAddress addr = curveDefCandidate.summaryAddress(); - addr.setQuantityName( "" ); + addr.setVectorName( "" ); if ( filteredSumCases.count( sumCase ) && filteredSummaryItems.count( addr ) ) { @@ -1230,8 +1230,8 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter, { RifEclipseSummaryAddress historyAddr = addrToFilterValue; - if ( !historyAddr.isHistoryQuantity() ) - historyAddr.setQuantityName( addrToFilterValue.quantityName() + "H" ); + if ( !historyAddr.isHistoryVector() ) + historyAddr.setVectorName( addrToFilterValue.vectorName() + "H" ); const std::vector& historyTimesteps = reader->timeSteps( historyAddr ); if ( historyTimesteps.size() ) @@ -1314,13 +1314,13 @@ void RimAnalysisPlot::applyFilter( const RimPlotDataFilterItem* filter, { RifEclipseSummaryAddress addrToFilterValue = filter->summaryAddress(); - quantityName = addrToFilterValue.quantityName(); + quantityName = addrToFilterValue.vectorName(); } for ( auto sumItem : *filteredSummaryItems ) { RifEclipseSummaryAddress addrToFilterValue = sumItem; - addrToFilterValue.setQuantityName( quantityName ); + addrToFilterValue.setVectorName( quantityName ); if ( filter->filterOperation() == RimPlotDataFilterItem::RANGE ) { @@ -1541,9 +1541,9 @@ void RimAnalysisPlot::addDataToChartBuilder( RiuGroupedBarChartBuilder& chartBui if ( m_useBarText() ) { QStringList barTextComponents; - if ( m_useQuantityInBarText ) + if ( m_useVectorNameInBarText ) { - barTextComponents += QString::fromStdString( curveDef.summaryAddress().quantityName() ); + barTextComponents += QString::fromStdString( curveDef.summaryAddress().vectorName() ); } if ( m_useSummaryItemInBarText ) @@ -1625,7 +1625,7 @@ void RimAnalysisPlot::updatePlotTitle() QString::fromStdString( getOrCreateSelectedCurveDefAnalyser()->m_summaryAdresses.begin()->itemUiText() ); } - for ( std::string quantName : getOrCreateSelectedCurveDefAnalyser()->m_quantityNames ) + for ( std::string quantName : getOrCreateSelectedCurveDefAnalyser()->m_vectorNames ) { if ( !autoTitle.isEmpty() ) autoTitle += separator; autoTitle += QString::fromStdString( quantName ); diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h index a844881374..33483563a5 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h @@ -58,7 +58,7 @@ class RimAnalysisPlot : public RimPlot { NONE, SUMMARY_ITEM, - QUANTITY, + VECTOR, CASE, ENSEMBLE, VALUE, @@ -214,7 +214,7 @@ class RimAnalysisPlot : public RimPlot caf::PdmField m_useEnsembleInBarText; caf::PdmField m_useSummaryItemInBarText; caf::PdmField m_useTimeStepInBarText; - caf::PdmField m_useQuantityInBarText; + caf::PdmField m_useVectorNameInBarText; caf::PdmField m_barTextFontSize; caf::PdmChildField m_valueAxisProperties; diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp index 820142afc2..41c562d0f4 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp @@ -209,7 +209,7 @@ void RimAnalysisPlotCollection::applySummaryCaseCollectionAndFieldAddressToPlot( { if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD ) { - if ( quantityName.empty() || quantityName == address.quantityName() ) + if ( quantityName.empty() || quantityName == address.vectorName() ) { for ( auto summaryCase : summaryCaseCollection->allSummaryCases() ) { diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp index b0963b31e1..e7270a7a7f 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp @@ -365,7 +365,7 @@ void RimPlotDataFilterItem::defineUiOrdering( QString uiConfigName, caf::PdmUiOr eParm = selectedEnsembleParameter(); } - if ( m_filterTarget() == ENSEMBLE_CASE && eParm.isText() ) // Ensemble Quantity is a category value + if ( m_filterTarget() == ENSEMBLE_CASE && eParm.isText() ) // Ensemble vector is a category value { uiOrdering.add( &m_ensembleParameterValueCategories ); } diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.h b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.h index a145ebf03a..e87cdac147 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.h +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.h @@ -41,7 +41,7 @@ class RimPlotAxisProperties; class RimSummaryAddress; // Filter of type : -// Only [Cases/SummaryItem/Case by ensemble param] where the [Quantity] +// Only [Cases/SummaryItem/Case by ensemble param] where the [Vector] // is [within range/top N/min N] // considering the [Plot Source/Last/First/Last with History/all] timestep(s) [range/1,2..] @@ -122,9 +122,7 @@ class RimPlotDataFilterItem : public caf::PdmObject caf::PdmField> m_filterTarget; - // Quantity - - // Complete address or quantity name only + // Complete address or vector name only caf::PdmChildField m_filterAddress; caf::PdmField m_filterEnsembleParameter; caf::PdmField m_filterQuantityUiField; diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp index 8aeeb188d8..0e5afc82c5 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp @@ -707,10 +707,10 @@ time_t RimAbstractCorrelationPlot::timeDiff( time_t lhs, time_t rhs ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimAbstractCorrelationPlot::selectedQuantitiesText() +QString RimAbstractCorrelationPlot::selectedVectorNamesText() { QString vectorNames; - for ( const std::string& quantityName : getOrCreateSelectedCurveDefAnalyser()->m_quantityNames ) + for ( const std::string& quantityName : getOrCreateSelectedCurveDefAnalyser()->m_vectorNames ) { vectorNames += QString::fromStdString( quantityName ) + ", "; } @@ -758,7 +758,7 @@ void RimAbstractCorrelationPlot::appendDataSourceFields( QString uiConfigName, c { caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector" ); - m_selectedVarsUiField = selectedQuantitiesText(); + m_selectedVarsUiField = selectedVectorNamesText(); curveDataGroup->add( &m_selectedVarsUiField ); curveDataGroup->add( &m_pushButtonSelectSummaryAddress, { false, 1, 0 } ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h index f134284d07..dcc10f9d4d 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h @@ -118,7 +118,7 @@ class RimAbstractCorrelationPlot : public RimPlot static time_t timeDiff( time_t lhs, time_t rhs ); - QString selectedQuantitiesText(); + QString selectedVectorNamesText(); QString completeAddressText(); void initAfterRead() final; diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index ccfc228fdd..989ffa58b3 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -366,7 +366,7 @@ void RimCorrelationMatrixPlot::onLoadDataAndUpdate() { updateMdiWindowVisibility(); - m_selectedVarsUiField = selectedQuantitiesText(); + m_selectedVarsUiField = selectedVectorNamesText(); if ( m_plotWidget ) { diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp index 67be2cb914..aaa71f0ccc 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp @@ -175,7 +175,7 @@ void RimCorrelationPlot::onLoadDataAndUpdate() { updateMdiWindowVisibility(); - m_selectedVarsUiField = selectedQuantitiesText(); + m_selectedVarsUiField = selectedVectorNamesText(); if ( m_plotWidget && m_analyserOfSelectedCurveDefs ) { diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp index 0f9c6abc51..19fcefc4cc 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp @@ -162,7 +162,7 @@ void RimParameterResultCrossPlot::onLoadDataAndUpdate() { updateMdiWindowVisibility(); - m_selectedVarsUiField = selectedQuantitiesText(); + m_selectedVarsUiField = selectedVectorNamesText(); if ( m_plotWidget && m_analyserOfSelectedCurveDefs ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp index 6a8d88a6a7..28952e4db9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDataSourceSteppingTools.cpp @@ -168,9 +168,9 @@ bool RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( cons std::string oldString = oldValue.toString().toStdString(); std::string newString = newValue.toString().toStdString(); - if ( adr->quantityName() == oldString ) + if ( adr->vectorName() == oldString ) { - adr->setQuantityName( newString ); + adr->setVectorName( newString ); return true; } @@ -178,9 +178,9 @@ bool RimDataSourceSteppingTools::updateHistoryAndSummaryQuantityIfMatching( cons std::string correspondingOldString = RiaSummaryAddressAnalyzer::correspondingHistorySummaryCurveName( oldString ); std::string correspondingNewString = RiaSummaryAddressAnalyzer::correspondingHistorySummaryCurveName( newString ); - if ( adr->quantityName() == correspondingOldString ) + if ( adr->vectorName() == correspondingOldString ) { - adr->setQuantityName( correspondingNewString ); + adr->setVectorName( correspondingNewString ); return true; } @@ -200,9 +200,9 @@ bool RimDataSourceSteppingTools::updateQuantityIfMatching( const QVariant& std::string oldString = oldValue.toString().toStdString(); std::string newString = newValue.toString().toStdString(); - if ( adr->quantityName() == oldString ) + if ( adr->vectorName() == oldString ) { - adr->setQuantityName( newString ); + adr->setVectorName( newString ); return true; } diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp index e7cef28043..c37965fe65 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -533,7 +533,7 @@ QList { if ( addr.category() == RifEclipseSummaryAddress::SUMMARY_WELL ) { - summaries.insert( addr.quantityName() ); + summaries.insert( addr.vectorName() ); } } } @@ -543,7 +543,7 @@ QList QString displayName; std::string longVectorName = - RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( itemName ); + RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( itemName ); if ( longVectorName.empty() ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp index 58f5d543b5..8b5b11297c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp @@ -361,8 +361,8 @@ void RimEnsembleCurveFilter::fieldChangedByUi( const caf::PdmFieldHandle* change RifEclipseSummaryAddress candidateAdr = parentCurveSet()->summaryAddress(); - auto nativeQuantityName = RimObjectiveFunctionTools::nativeQuantityName( candidateAdr.quantityName() ); - candidateAdr.setQuantityName( nativeQuantityName ); + auto nativeQuantityName = RimObjectiveFunctionTools::nativeQuantityName( candidateAdr.vectorName() ); + candidateAdr.setVectorName( nativeQuantityName ); summaryAddress->setAddress( candidateAdr ); m_objectiveValuesSummaryAddresses.push_back( summaryAddress ); updateAddressesUiField(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 80ecaaadeb..0836771299 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -1777,16 +1777,16 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vectorshowP10Curve() && m_ensembleStatCase->hasP10Data() ) addresses.push_back( - SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_P10_QUANTITY_NAME, dataAddress.quantityName() ) ); + SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_P10_QUANTITY_NAME, dataAddress.vectorName() ) ); if ( m_statistics->showP50Curve() && m_ensembleStatCase->hasP50Data() ) addresses.push_back( - SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_P50_QUANTITY_NAME, dataAddress.quantityName() ) ); + SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_P50_QUANTITY_NAME, dataAddress.vectorName() ) ); if ( m_statistics->showP90Curve() && m_ensembleStatCase->hasP90Data() ) addresses.push_back( - SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_P90_QUANTITY_NAME, dataAddress.quantityName() ) ); + SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_P90_QUANTITY_NAME, dataAddress.vectorName() ) ); if ( m_statistics->showMeanCurve() && m_ensembleStatCase->hasMeanData() ) addresses.push_back( - SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_MEAN_QUANTITY_NAME, dataAddress.quantityName() ) ); + SAddr::ensembleStatisticsAddress( ENSEMBLE_STAT_MEAN_QUANTITY_NAME, dataAddress.vectorName() ) ); } deleteStatisticsCurves(); @@ -1807,7 +1807,7 @@ void RimEnsembleCurveSet::updateStatisticsCurves( const std::vectorsetSymbolSkipDistance( 150 ); if ( m_statistics->showCurveLabels() ) { - curve->setSymbolLabel( QString::fromStdString( address.ensembleStatisticsQuantityName() ) ); + curve->setSymbolLabel( QString::fromStdString( address.ensembleStatisticsVectorName() ) ); } curve->setLineStyle( RiuQwtPlotCurveDefines::LineStyleEnum::STYLE_SOLID ); curve->setSummaryCaseY( m_ensembleStatCase.get() ); @@ -2066,7 +2066,7 @@ void RimEnsembleCurveSet::updateLegendMappingMode() //-------------------------------------------------------------------------------------------------- RiuPlotCurveSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseSummaryAddress& address ) { - auto qName = QString::fromStdString( address.quantityName() ); + auto qName = QString::fromStdString( address.vectorName() ); if ( qName.contains( ENSEMBLE_STAT_P10_QUANTITY_NAME ) ) return RiuPlotCurveSymbol::SYMBOL_TRIANGLE; if ( qName.contains( ENSEMBLE_STAT_P90_QUANTITY_NAME ) ) return RiuPlotCurveSymbol::SYMBOL_DOWN_TRIANGLE; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp index f9dc17d1d2..3e57f0fbae 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp @@ -260,21 +260,21 @@ std::vector RimEnsembleCurveSetCollection::curveSetsForSou { // Add corresponding history/summary curve with or without H - std::string quantity = m_curveSetForSourceStepping->summaryAddress().quantityName(); + std::string vectorName = m_curveSetForSourceStepping->summaryAddress().vectorName(); std::string candidateName; - if ( m_curveSetForSourceStepping->summaryAddress().isHistoryQuantity() ) + if ( m_curveSetForSourceStepping->summaryAddress().isHistoryVector() ) { - candidateName = quantity.substr( 0, quantity.size() - 1 ); + candidateName = vectorName.substr( 0, vectorName.size() - 1 ); } else { - candidateName = quantity + "H"; + candidateName = vectorName + "H"; } for ( const auto& c : curveSets() ) { - if ( c->summaryAddress().quantityName() == candidateName ) + if ( c->summaryAddress().vectorName() == candidateName ) { steppingCurveSets.push_back( c ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp index bd2563aaa5..854d107a74 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.cpp @@ -49,12 +49,12 @@ QString RimMultiSummaryPlotNameHelper::plotTitle() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimMultiSummaryPlotNameHelper::isPlotDisplayingSingleQuantity() const +bool RimMultiSummaryPlotNameHelper::isPlotDisplayingSingleVectorName() const { int plotCountWithSingleQuantity = 0; for ( auto nameHelper : m_nameHelpers ) { - if ( nameHelper->isPlotDisplayingSingleQuantity() ) plotCountWithSingleQuantity++; + if ( nameHelper->isPlotDisplayingSingleVectorName() ) plotCountWithSingleQuantity++; } if ( plotCountWithSingleQuantity == 1 ) return true; @@ -148,11 +148,11 @@ QString RimMultiSummaryPlotNameHelper::caseName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::string RimMultiSummaryPlotNameHelper::titleQuantity() const +std::string RimMultiSummaryPlotNameHelper::titleVectorName() const { for ( auto nameHelper : m_nameHelpers ) { - if ( nameHelper->isPlotDisplayingSingleQuantity() ) return nameHelper->titleQuantity(); + if ( nameHelper->isPlotDisplayingSingleVectorName() ) return nameHelper->titleVectorName(); } return ""; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h index 89fca2321a..1ac675e2b8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimMultipleSummaryPlotNameHelper.h @@ -30,7 +30,7 @@ class RimMultiSummaryPlotNameHelper : public RimSummaryNameHelper QString plotTitle() const override; - bool isPlotDisplayingSingleQuantity() const override; + bool isPlotDisplayingSingleVectorName() const override; bool isWellNameInTitle() const override; bool isGroupNameInTitle() const override; bool isRegionInTitle() const override; @@ -41,7 +41,7 @@ class RimMultiSummaryPlotNameHelper : public RimSummaryNameHelper QString caseName() const override; - std::string titleQuantity() const override; + std::string titleVectorName() const override; std::string titleWellName() const override; std::string titleGroupName() const override; std::string titleRegion() const override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp index a3310fd99f..41d567e544 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunction.cpp @@ -108,20 +108,20 @@ double RimObjectiveFunction::value( RimSummaryCase* for ( auto vectorSummaryAddress : vectorSummaryAddresses ) { - std::string s = vectorSummaryAddress.quantityName() + RifReaderEclipseSummary::differenceIdentifier(); - if ( !vectorSummaryAddress.quantityName().empty() ) + std::string s = vectorSummaryAddress.vectorName() + RifReaderEclipseSummary::differenceIdentifier(); + if ( !vectorSummaryAddress.vectorName().empty() ) { - if ( vectorSummaryAddress.quantityName().find( RifReaderEclipseSummary::differenceIdentifier() ) != + if ( vectorSummaryAddress.vectorName().find( RifReaderEclipseSummary::differenceIdentifier() ) != std::string::npos ) { - s = vectorSummaryAddress.quantityName(); + s = vectorSummaryAddress.vectorName(); } RifEclipseSummaryAddress vectorSummaryAddressDiff = vectorSummaryAddress; - vectorSummaryAddressDiff.setQuantityName( s ); + vectorSummaryAddressDiff.setVectorName( s ); RifEclipseSummaryAddress vectorSummaryAddressHistory = vectorSummaryAddress; - vectorSummaryAddressHistory.setQuantityName( vectorSummaryAddress.quantityName() + - RifReaderEclipseSummary::historyIdentifier() ); + vectorSummaryAddressHistory.setVectorName( vectorSummaryAddress.vectorName() + + RifReaderEclipseSummary::historyIdentifier() ); if ( readerInterface->allResultAddresses().count( vectorSummaryAddressDiff ) ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunctionTools.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunctionTools.cpp index 8f462fd6b1..477b966af1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunctionTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObjectiveFunctionTools.cpp @@ -46,9 +46,9 @@ RimCustomObjectiveFunctionWeight* RimObjectiveFunctionTools::addWeight( RimCusto candidateAdr = newWeight->parentCurveSet()->summaryAddress(); } - auto nativeQuantityName = RimObjectiveFunctionTools::nativeQuantityName( candidateAdr.quantityName() ); + auto nativeQuantityName = RimObjectiveFunctionTools::nativeQuantityName( candidateAdr.vectorName() ); - candidateAdr.setQuantityName( nativeQuantityName ); + candidateAdr.setVectorName( nativeQuantityName ); newWeight->setSummaryAddress( candidateAdr ); return newWeight; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp index 9387cbc236..49146f452c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.cpp @@ -61,7 +61,7 @@ RimSummaryAddress::RimSummaryAddress() CAF_PDM_InitObject( "SummaryAddress", ":/DataVector.png", "", "" ); CAF_PDM_InitFieldNoDefault( &m_category, "SummaryVarType", "Type" ); - CAF_PDM_InitFieldNoDefault( &m_quantityName, "SummaryQuantityName", "Quantity" ); + CAF_PDM_InitFieldNoDefault( &m_vectorName, "SummaryQuantityName", "Vector" ); CAF_PDM_InitFieldNoDefault( &m_regionNumber, "SummaryRegion", "Region" ); CAF_PDM_InitFieldNoDefault( &m_regionNumber2, "SummaryRegion2", "Region2" ); CAF_PDM_InitFieldNoDefault( &m_groupName, "SummaryWellGroup", "Group" ); @@ -117,7 +117,7 @@ RimSummaryAddress* RimSummaryAddress::wrapFileReaderAddress( const RifEclipseSum void RimSummaryAddress::setAddress( const RifEclipseSummaryAddress& addr ) { m_category = addr.category(); - m_quantityName = addr.quantityName().c_str(); + m_vectorName = addr.vectorName().c_str(); m_regionNumber = addr.regionNumber(); m_regionNumber2 = addr.regionNumber2(); m_groupName = addr.groupName().c_str(); @@ -132,7 +132,7 @@ void RimSummaryAddress::setAddress( const RifEclipseSummaryAddress& addr ) m_cellK = addr.cellK(); m_calculationId = addr.id(); - setUiName( m_quantityName ); + setUiName( m_vectorName ); } //-------------------------------------------------------------------------------------------------- @@ -141,7 +141,7 @@ void RimSummaryAddress::setAddress( const RifEclipseSummaryAddress& addr ) RifEclipseSummaryAddress RimSummaryAddress::address() const { return RifEclipseSummaryAddress( m_category(), - m_quantityName().toStdString(), + m_vectorName().toStdString(), m_regionNumber(), m_regionNumber2(), m_groupName().toStdString(), @@ -169,7 +169,7 @@ void RimSummaryAddress::ensureCalculationIdIsAssigned() { QString description = c->description(); - if ( description == m_quantityName ) + if ( description == m_vectorName ) { m_calculationId = c->id(); } @@ -183,15 +183,15 @@ void RimSummaryAddress::ensureCalculationIdIsAssigned() //-------------------------------------------------------------------------------------------------- RiaDefines::PhaseType RimSummaryAddress::addressPhaseType() const { - if ( QRegularExpression( "^.OP" ).match( m_quantityName ).hasMatch() ) + if ( QRegularExpression( "^.OP" ).match( m_vectorName ).hasMatch() ) { return RiaDefines::PhaseType::OIL_PHASE; } - else if ( QRegularExpression( "^.GP" ).match( m_quantityName ).hasMatch() ) + else if ( QRegularExpression( "^.GP" ).match( m_vectorName ).hasMatch() ) { return RiaDefines::PhaseType::GAS_PHASE; } - else if ( QRegularExpression( "^.WP" ).match( m_quantityName ).hasMatch() ) + else if ( QRegularExpression( "^.WP" ).match( m_vectorName ).hasMatch() ) { return RiaDefines::PhaseType::WATER_PHASE; } @@ -241,7 +241,7 @@ int RimSummaryAddress::caseId() const //-------------------------------------------------------------------------------------------------- QString RimSummaryAddress::quantityName() const { - return m_quantityName; + return m_vectorName; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h index 131225d527..b6a2f735a8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddress.h @@ -71,7 +71,7 @@ class RimSummaryAddress : public caf::PdmObject private: caf::PdmField> m_category; - caf::PdmField m_quantityName; + caf::PdmField m_vectorName; caf::PdmField m_regionNumber; caf::PdmField m_regionNumber2; caf::PdmField m_groupName; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index 73160217bf..560a4a3f6a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -112,7 +112,7 @@ bool RimSummaryAddressCollection::hasDataVector( const std::string quantityName //-------------------------------------------------------------------------------------------------- void RimSummaryAddressCollection::addAddress( const RifEclipseSummaryAddress& address, int caseId, int ensembleId ) { - if ( !hasDataVector( address.quantityName() ) ) + if ( !hasDataVector( address.vectorName() ) ) { m_adresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, caseId, ensembleId ) ); if ( m_caseId == -1 ) m_caseId = caseId; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index c032cb215d..82e948f6f6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -1000,7 +1000,7 @@ void RimSummaryCurve::setCurveAppearanceFromCaseType() } } - if ( m_yValuesSummaryAddress && m_yValuesSummaryAddress->address().isHistoryQuantity() ) + if ( m_yValuesSummaryAddress && m_yValuesSummaryAddress->address().isHistoryVector() ) { RiaPreferencesSummary* prefs = RiaPreferencesSummary::current(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp index 4b1482f057..07762d8f55 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp @@ -277,8 +277,8 @@ void RimSummaryCurveAppearanceCalculator::setupCurveLook( RimSummaryCurve* curve m_currentCurveBaseColor = cvf::Color3f( 0.5f, 0.5f, 0.5f ); m_currentCurveGradient = 0.0f; - std::string quantityName = curve->summaryAddressY().quantityName(); - if ( curve->summaryAddressY().isHistoryQuantity() ) + std::string quantityName = curve->summaryAddressY().vectorName(); + if ( curve->summaryAddressY().isHistoryVector() ) { quantityName = quantityName.substr( 0, quantityName.size() - 1 ); } @@ -325,7 +325,7 @@ void RimSummaryCurveAppearanceCalculator::setupCurveLook( RimSummaryCurve* curve void RimSummaryCurveAppearanceCalculator::assignColorByPhase( RimSummaryCurve* curve, int colorIndex ) { char secondChar = 0; - std::string varname = curve->summaryAddressY().quantityName(); + std::string varname = curve->summaryAddressY().vectorName(); if ( varname.size() > 1 ) { @@ -380,11 +380,11 @@ void RimSummaryCurveAppearanceCalculator::init( const std::vectorisPlotDisplayingSingleQuantity(); + bool skipSubString = nameHelper && nameHelper->isPlotDisplayingSingleVectorName(); if ( !skipSubString ) { if ( m_longVectorName() ) { - auto quantityName = summaryAddress.quantityName(); - if ( summaryAddress.isHistoryQuantity() ) + auto quantityName = summaryAddress.vectorName(); + if ( summaryAddress.isHistoryVector() ) quantityName = quantityName.substr( 0, quantityName.size() - 1 ); - text = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( quantityName ); + text = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( quantityName ); } else { - text = summaryAddress.quantityName(); + text = summaryAddress.vectorName(); } } if ( summaryAddress.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS ) { - text = summaryAddress.quantityName(); + text = summaryAddress.vectorName(); } else if ( summaryAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index d88968c35a..def9939982 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -254,25 +254,25 @@ std::vector const std::string historyIdentifier = "H"; - std::string quantity; + std::string vectorName; if ( steppingType == RimSummaryDataSourceStepping::Axis::X_AXIS ) { - quantity = m_curveForSourceStepping->summaryAddressX().quantityName(); + vectorName = m_curveForSourceStepping->summaryAddressX().vectorName(); } else if ( steppingType == RimSummaryDataSourceStepping::Axis::Y_AXIS ) { - quantity = m_curveForSourceStepping->summaryAddressY().quantityName(); + vectorName = m_curveForSourceStepping->summaryAddressY().vectorName(); } std::string candidateName; - if ( RiaStdStringTools::endsWith( quantity, historyIdentifier ) ) + if ( RiaStdStringTools::endsWith( vectorName, historyIdentifier ) ) { - candidateName = quantity.substr( 0, quantity.size() - 1 ); + candidateName = vectorName.substr( 0, vectorName.size() - 1 ); } else { - candidateName = quantity + historyIdentifier; + candidateName = vectorName + historyIdentifier; } for ( const auto& c : curves() ) @@ -280,7 +280,7 @@ std::vector if ( steppingType == RimSummaryDataSourceStepping::Axis::X_AXIS ) { if ( c->summaryCaseX() == m_curveForSourceStepping->summaryCaseX() && - c->summaryAddressX().quantityName() == candidateName ) + c->summaryAddressX().vectorName() == candidateName ) { stepCurves.push_back( c ); } @@ -288,7 +288,7 @@ std::vector else if ( steppingType == RimSummaryDataSourceStepping::Axis::Y_AXIS ) { if ( c->summaryCaseY() == m_curveForSourceStepping->summaryCaseY() && - c->summaryAddressY().quantityName() == candidateName ) + c->summaryAddressY().vectorName() == candidateName ) { stepCurves.push_back( c ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index a41c4472cc..2ab32c21bb 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -673,7 +673,7 @@ void RimSummaryMultiPlot::setDefaultRangeAggregationSteppingDimension() rangeAggregation = AxisRangeAggregation::SUB_PLOTS; } - auto stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::QUANTITY; + auto stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::VECTOR; if ( analyzer.wellNames().size() == 1 ) { stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::WELL; @@ -828,9 +828,8 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() if ( axisRangeAggregation == AxisRangeAggregation::REALIZATIONS ) { - RifEclipseSummaryAddress addr = - RifEclipseSummaryAddress::fieldAddress( curve->summaryAddressY().quantityName() ); - addresses = { addr }; + RifEclipseSummaryAddress addr = RifEclipseSummaryAddress::fieldAddress( curve->summaryAddressY().vectorName() ); + addresses = { addr }; } else if ( axisRangeAggregation == AxisRangeAggregation::WELLS || axisRangeAggregation == AxisRangeAggregation::REGIONS ) @@ -851,7 +850,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() for ( const auto& wellName : analyzer.wellNames() ) { addresses.push_back( - RifEclipseSummaryAddress::wellAddress( curve->summaryAddressY().quantityName(), wellName ) ); + RifEclipseSummaryAddress::wellAddress( curve->summaryAddressY().vectorName(), wellName ) ); } } @@ -859,7 +858,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() { for ( auto regionNumber : analyzer.regionNumbers() ) { - addresses.push_back( RifEclipseSummaryAddress::regionAddress( curve->summaryAddressY().quantityName(), + addresses.push_back( RifEclipseSummaryAddress::regionAddress( curve->summaryAddressY().vectorName(), regionNumber ) ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp index 500fd12187..9a68079002 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.cpp @@ -78,12 +78,12 @@ QString RimSummaryNameHelper::aggregatedPlotTitle( const RimSummaryNameHelper& o title += "Completion : " + QString::fromStdString( completion ); } - auto quantity = this->titleQuantity(); - if ( ( other.titleQuantity() != this->titleQuantity() ) && ( !quantity.empty() ) ) + auto vectorName = this->titleVectorName(); + if ( ( other.titleVectorName() != this->titleVectorName() ) && ( !vectorName.empty() ) ) { if ( !title.isEmpty() ) title += ", "; title += QString::fromStdString( - RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( quantity, true ) ); + RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( vectorName, true ) ); } return title; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h index 215f9abbff..9343c23ba2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryNameHelper.h @@ -37,18 +37,18 @@ class RimSummaryNameHelper QString aggregatedPlotTitle( const RimSummaryNameHelper& summaryMultiPlotNameHelper ) const; - virtual bool isPlotDisplayingSingleQuantity() const = 0; - virtual bool isWellNameInTitle() const = 0; - virtual bool isGroupNameInTitle() const = 0; - virtual bool isRegionInTitle() const = 0; - virtual bool isCaseInTitle() const = 0; - virtual bool isBlockInTitle() const = 0; - virtual bool isSegmentInTitle() const = 0; - virtual bool isCompletionInTitle() const = 0; + virtual bool isPlotDisplayingSingleVectorName() const = 0; + virtual bool isWellNameInTitle() const = 0; + virtual bool isGroupNameInTitle() const = 0; + virtual bool isRegionInTitle() const = 0; + virtual bool isCaseInTitle() const = 0; + virtual bool isBlockInTitle() const = 0; + virtual bool isSegmentInTitle() const = 0; + virtual bool isCompletionInTitle() const = 0; virtual QString caseName() const = 0; - virtual std::string titleQuantity() const = 0; + virtual std::string titleVectorName() const = 0; virtual std::string titleWellName() const = 0; virtual std::string titleGroupName() const = 0; virtual std::string titleRegion() const = 0; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index b1f389637c..2da3e80f19 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -928,7 +928,7 @@ bool RimSummaryPlot::isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis ) auto curves = visibleSummaryCurvesForAxis( plotAxis ); for ( auto c : curves ) { - auto quantityName = c->summaryAddressY().quantityName(); + auto quantityName = c->summaryAddressY().vectorName(); if ( RiaStdStringTools::endsWith( quantityName, "WCT" ) ) waterCutCurveCount++; } @@ -2485,7 +2485,7 @@ void RimSummaryPlot::updateCurveNames() if ( c->isCurveVisible() ) { c->updateCurveNameNoLegendUpdate(); - shortCurveNames.append( QString::fromStdString( c->summaryAddressY().quantityName() ) ); + shortCurveNames.append( QString::fromStdString( c->summaryAddressY().vectorName() ) ); } } } @@ -2496,7 +2496,7 @@ void RimSummaryPlot::updateCurveNames() if ( curveSet->isCurvesVisible() ) { - shortCurveNames.append( QString::fromStdString( curveSet->summaryAddress().quantityName() ) ); + shortCurveNames.append( QString::fromStdString( curveSet->summaryAddress().vectorName() ) ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index ad9eb910dc..cdf5a8c6f4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -212,12 +212,11 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const std::map> unitToQuantityNameMap; auto addToUnitToQuantityMap = [&]( const std::string& unitText, const RifEclipseSummaryAddress& sumAddress ) { - // remove any stats prefix from the quantity name - size_t cutPos = sumAddress.quantityName().find( ':' ); + size_t cutPos = sumAddress.vectorName().find( ':' ); if ( cutPos == std::string::npos ) cutPos = -1; std::string titleText; - const std::string& quantityName = sumAddress.quantityName().substr( cutPos + 1 ); + const std::string& quantityName = sumAddress.vectorName().substr( cutPos + 1 ); if ( sumAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED ) { @@ -229,9 +228,9 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const { auto candidateName = quantityName; - if ( sumAddress.isHistoryQuantity() ) candidateName = quantityName.substr( 0, quantityName.size() - 1 ); + if ( sumAddress.isHistoryVector() ) candidateName = quantityName.substr( 0, quantityName.size() - 1 ); - titleText = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( candidateName ); + titleText = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( candidateName ); } if ( m_axisProperties->showAcronym() ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp index 62e75f7f39..4ca7dab83e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp @@ -635,7 +635,7 @@ void RimSummaryPlotFilterTextCurveSetEditor::insertFilteredAddressesInSet( for ( const auto& adr : candidateAddresses ) { - if ( RiaStdStringTools::endsWith( adr.quantityName(), diffText ) ) continue; + if ( RiaStdStringTools::endsWith( adr.vectorName(), diffText ) ) continue; tmp.insert( adr ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp index 6d4325385f..1e4fe2fe24 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.cpp @@ -102,7 +102,7 @@ QString RimSummaryPlotNameHelper::plotTitle() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimSummaryPlotNameHelper::isPlotDisplayingSingleQuantity() const +bool RimSummaryPlotNameHelper::isPlotDisplayingSingleVectorName() const { if ( m_analyzer->quantities().size() == 2 ) { @@ -186,7 +186,7 @@ QString RimSummaryPlotNameHelper::caseName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::string RimSummaryPlotNameHelper::titleQuantity() const +std::string RimSummaryPlotNameHelper::titleVectorName() const { return m_titleQuantity; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h index cb6c3b95a6..514b127398 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotNameHelper.h @@ -51,7 +51,7 @@ class RimSummaryPlotNameHelper : public RimSummaryNameHelper QString plotTitle() const override; - bool isPlotDisplayingSingleQuantity() const override; + bool isPlotDisplayingSingleVectorName() const override; bool isWellNameInTitle() const override; bool isGroupNameInTitle() const override; bool isRegionInTitle() const override; @@ -62,7 +62,7 @@ class RimSummaryPlotNameHelper : public RimSummaryNameHelper QString caseName() const override; - std::string titleQuantity() const override; + std::string titleVectorName() const override; std::string titleWellName() const override; std::string titleGroupName() const override; std::string titleRegion() const override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 00ebbba2d8..a5e2fd9e1f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -56,7 +56,7 @@ namespace caf template <> void AppEnum::setUp() { - addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::QUANTITY, "QUANTITY", "Quantity" ); + addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::VECTOR, "VECTOR", "Vector" ); addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::WELL, "WELL", "Well" ); addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::SUMMARY_CASE, "SUMMARY_CASE", "Summary Case" ); addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::ENSEMBLE, "ENSEMBLE", "Ensemble" ); @@ -64,7 +64,7 @@ void AppEnum::setUp() addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::REGION, "REGION", "Region" ); addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::BLOCK, "BLOCK", "Block" ); addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::AQUIFER, "AQUIFER", "Aquifer" ); - setDefault( RimSummaryPlotSourceStepping::SourceSteppingDimension::QUANTITY ); + setDefault( RimSummaryPlotSourceStepping::SourceSteppingDimension::VECTOR ); } } // namespace caf @@ -90,7 +90,7 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "Well Name" ); CAF_PDM_InitFieldNoDefault( &m_groupName, "GroupName", "Group Name" ); CAF_PDM_InitFieldNoDefault( &m_region, "Region", "Region" ); - CAF_PDM_InitFieldNoDefault( &m_quantity, "Quantities", "Quantity" ); + CAF_PDM_InitFieldNoDefault( &m_vectorName, "VectorName", "Vector" ); CAF_PDM_InitFieldNoDefault( &m_cellBlock, "CellBlock", "Block" ); CAF_PDM_InitFieldNoDefault( &m_segment, "Segment", "Segment" ); @@ -232,7 +232,7 @@ QList auto addresses = adressesForSourceStepping(); if ( !addresses.empty() ) { - if ( fieldNeedingOptions == &m_quantity ) + if ( fieldNeedingOptions == &m_vectorName ) { std::map displayAndValueStrings = optionsForQuantity( addresses ); @@ -383,7 +383,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* m_wellName.uiCapability()->updateConnectedEditors(); m_groupName.uiCapability()->updateConnectedEditors(); m_region.uiCapability()->updateConnectedEditors(); - m_quantity.uiCapability()->updateConnectedEditors(); + m_vectorName.uiCapability()->updateConnectedEditors(); } else if ( changedField == &m_ensemble ) { @@ -406,9 +406,9 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* m_wellName.uiCapability()->updateConnectedEditors(); m_groupName.uiCapability()->updateConnectedEditors(); m_region.uiCapability()->updateConnectedEditors(); - m_quantity.uiCapability()->updateConnectedEditors(); + m_vectorName.uiCapability()->updateConnectedEditors(); } - else if ( changedField == &m_quantity ) + else if ( changedField == &m_vectorName ) { for ( auto curve : curves ) { @@ -438,11 +438,11 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* curveSet->setSummaryAddress( adr ); } } - m_quantity.uiCapability()->updateConnectedEditors(); + m_vectorName.uiCapability()->updateConnectedEditors(); triggerLoadDataAndUpdate = true; } - if ( changedField != &m_quantity ) + if ( changedField != &m_vectorName ) { RifEclipseSummaryAddress::SummaryVarCategory summaryCategoryToModify = RifEclipseSummaryAddress::SUMMARY_INVALID; if ( changedField == &m_wellName ) @@ -577,8 +577,8 @@ caf::PdmValueField* RimSummaryPlotSourceStepping::fieldToModify() case SourceSteppingDimension::REGION: return &m_region; - case SourceSteppingDimension::QUANTITY: - return &m_quantity; + case SourceSteppingDimension::VECTOR: + return &m_vectorName; case SourceSteppingDimension::BLOCK: return &m_cellBlock; @@ -821,10 +821,10 @@ std::vector RimSummaryPlotSourceStepping::activeFieldsForD if ( !analyzer.quantityNameForTitle().empty() ) { - QString txt = QString::fromStdString( analyzer.quantityNameForTitle() ); - m_quantity = txt; + QString txt = QString::fromStdString( analyzer.quantityNameForTitle() ); + m_vectorName = txt; - fieldsCommonForAllCurves.push_back( &m_quantity ); + fieldsCommonForAllCurves.push_back( &m_vectorName ); } } } @@ -1051,7 +1051,7 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu } break; - case SourceSteppingDimension::QUANTITY: + case SourceSteppingDimension::VECTOR: { auto options = optionsForQuantity( addresses ); @@ -1061,7 +1061,7 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu values.push_back( it->second ); } - QString qName = QString::fromStdString( addr.quantityName() ); + QString qName = QString::fromStdString( addr.vectorName() ); auto found = std::find( values.begin(), values.end(), qName ); if ( found != values.end() ) { @@ -1073,7 +1073,7 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu { if ( found != values.begin() ) found--; } - if ( found != values.end() ) addr.setQuantityName( ( *found ).toStdString() ); + if ( found != values.end() ) addr.setVectorName( ( *found ).toStdString() ); } } break; @@ -1154,8 +1154,8 @@ void RimSummaryPlotSourceStepping::syncWithStepper( RimSummaryPlotSourceStepping m_region = other->m_region(); break; - case SourceSteppingDimension::QUANTITY: - m_quantity = other->m_quantity(); + case SourceSteppingDimension::VECTOR: + m_vectorName = other->m_vectorName(); break; case SourceSteppingDimension::BLOCK: diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index 26d6d89a04..6cba730f02 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -51,7 +51,7 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject WELL, GROUP, REGION, - QUANTITY, + VECTOR, BLOCK, AQUIFER }; @@ -125,7 +125,7 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject caf::PdmField m_wellName; caf::PdmField m_groupName; caf::PdmField m_region; - caf::PdmField m_quantity; + caf::PdmField m_vectorName; caf::PdmField m_placeholderForLabel; caf::PdmField m_cellBlock; diff --git a/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp b/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp index 2d6890c44c..245948da06 100644 --- a/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp +++ b/ApplicationLibCode/UnitTests/ObservedDataParser-Test.cpp @@ -563,7 +563,7 @@ TEST( RifColumnBasedRsmspecParserTest, TestTableValues ) EXPECT_EQ( 3.0, tables.at( 1 ).columnInfos().at( 0 ).values.at( 2 ) ); EXPECT_EQ( 370.0, tables.at( 1 ).columnInfos().at( 3 ).values.at( 3 ) ); - EXPECT_EQ( "WOPR", tables.at( 0 ).columnInfos().at( 1 ).summaryAddress.quantityName() ); + EXPECT_EQ( "WOPR", tables.at( 0 ).columnInfos().at( 1 ).summaryAddress.vectorName() ); EXPECT_EQ( "P-15P", tables.at( 0 ).columnInfos().at( 5 ).summaryAddress.wellName() ); EXPECT_EQ( "P-9P", tables.at( 1 ).columnInfos().at( 1 ).summaryAddress.wellName() ); EXPECT_NE( "P-9P", tables.at( 1 ).columnInfos().at( 0 ).summaryAddress.wellName() ); @@ -875,7 +875,7 @@ TEST( RifKeywordBasedRsmspecParserTest, TestShutins ) EXPECT_EQ( 2014.39, tables.at( 0 ).columnInfos().at( 1 ).values[2] ); - EXPECT_EQ( "WOPR", tables.at( 0 ).columnInfos().at( 2 ).summaryAddress.quantityName() ); + EXPECT_EQ( "WOPR", tables.at( 0 ).columnInfos().at( 2 ).summaryAddress.vectorName() ); EXPECT_EQ( "OP-1", tables.at( 0 ).columnInfos().at( 2 ).summaryAddress.wellName() ); EXPECT_NE( "OP-1", tables.at( 0 ).columnInfos().at( 1 ).summaryAddress.wellName() ); diff --git a/ApplicationLibCode/UnitTests/RifEclipseSummaryAddress-Test.cpp b/ApplicationLibCode/UnitTests/RifEclipseSummaryAddress-Test.cpp index 9c45b6b2cc..9d6f67a931 100644 --- a/ApplicationLibCode/UnitTests/RifEclipseSummaryAddress-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifEclipseSummaryAddress-Test.cpp @@ -16,7 +16,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Field ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_FIELD, addr.category() ); - EXPECT_EQ( "FOPT", addr.quantityName() ); + EXPECT_EQ( "FOPT", addr.vectorName() ); EXPECT_FALSE( addr.isErrorResult() ); } @@ -28,7 +28,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Aquifer ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_AQUIFER, addr.category() ); - EXPECT_EQ( "AAQR", addr.quantityName() ); + EXPECT_EQ( "AAQR", addr.vectorName() ); EXPECT_EQ( 456, addr.aquiferNumber() ); EXPECT_FALSE( addr.isErrorResult() ); } @@ -41,7 +41,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Network ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_NETWORK, addr.category() ); - EXPECT_EQ( "NETW", addr.quantityName() ); + EXPECT_EQ( "NETW", addr.vectorName() ); EXPECT_FALSE( addr.isErrorResult() ); } @@ -53,7 +53,7 @@ TEST( RifEclipseSummaryAddressTest, DISABLED_TestEclipseAddressParsing_Misc ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_MISC, addr.category() ); - EXPECT_EQ( "CPU", addr.quantityName() ); + EXPECT_EQ( "CPU", addr.vectorName() ); EXPECT_FALSE( addr.isErrorResult() ); } @@ -65,7 +65,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Region ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_REGION, addr.category() ); - EXPECT_EQ( "RPR", addr.quantityName() ); + EXPECT_EQ( "RPR", addr.vectorName() ); EXPECT_EQ( 7081, addr.regionNumber() ); EXPECT_FALSE( addr.isErrorResult() ); } @@ -78,7 +78,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_RegionToRegion ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION, addr.category() ); - EXPECT_EQ( "ROFR", addr.quantityName() ); + EXPECT_EQ( "ROFR", addr.vectorName() ); EXPECT_EQ( 7081, addr.regionNumber() ); EXPECT_EQ( 8001, addr.regionNumber2() ); EXPECT_FALSE( addr.isErrorResult() ); @@ -92,7 +92,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellGroup ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_GROUP, addr.category() ); - EXPECT_EQ( "GOPR", addr.quantityName() ); + EXPECT_EQ( "GOPR", addr.vectorName() ); EXPECT_EQ( "WELLS1", addr.groupName() ); EXPECT_FALSE( addr.isErrorResult() ); } @@ -105,7 +105,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Well ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL, addr.category() ); - EXPECT_EQ( "WOPR", addr.quantityName() ); + EXPECT_EQ( "WOPR", addr.vectorName() ); EXPECT_EQ( "B-2H", addr.wellName() ); EXPECT_FALSE( addr.isErrorResult() ); } @@ -118,7 +118,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellCompletion ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION, addr.category() ); - EXPECT_EQ( "COFRL", addr.quantityName() ); + EXPECT_EQ( "COFRL", addr.vectorName() ); EXPECT_EQ( "B-1H", addr.wellName() ); EXPECT_EQ( 15, addr.cellI() ); EXPECT_EQ( 13, addr.cellJ() ); @@ -134,7 +134,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellLgr ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_LGR, addr.category() ); - EXPECT_EQ( "LWABC", addr.quantityName() ); + EXPECT_EQ( "LWABC", addr.vectorName() ); EXPECT_EQ( "LGRNA", addr.lgrName() ); EXPECT_EQ( "B-10H", addr.wellName() ); EXPECT_FALSE( addr.isErrorResult() ); @@ -148,7 +148,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellCompletionLgr EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR, addr.category() ); - EXPECT_EQ( "LCGAS", addr.quantityName() ); + EXPECT_EQ( "LCGAS", addr.vectorName() ); EXPECT_EQ( "LGR1", addr.lgrName() ); EXPECT_EQ( "B-1H", addr.wellName() ); EXPECT_EQ( 11, addr.cellI() ); @@ -165,7 +165,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_WellSegment ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT, addr.category() ); - EXPECT_EQ( "SOFR", addr.quantityName() ); + EXPECT_EQ( "SOFR", addr.vectorName() ); EXPECT_EQ( "B-5H", addr.wellName() ); EXPECT_EQ( 32, addr.wellSegmentNumber() ); EXPECT_FALSE( addr.isErrorResult() ); @@ -179,7 +179,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Block ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_BLOCK, addr.category() ); - EXPECT_EQ( "BPR", addr.quantityName() ); + EXPECT_EQ( "BPR", addr.vectorName() ); EXPECT_EQ( 123, addr.cellI() ); EXPECT_EQ( 122, addr.cellJ() ); EXPECT_EQ( 121, addr.cellK() ); @@ -194,7 +194,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_BlockLgr ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_BLOCK_LGR, addr.category() ); - EXPECT_EQ( "LBABC", addr.quantityName() ); + EXPECT_EQ( "LBABC", addr.vectorName() ); EXPECT_EQ( "LGRN", addr.lgrName() ); EXPECT_EQ( 45, addr.cellI() ); EXPECT_EQ( 47, addr.cellJ() ); @@ -210,7 +210,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_Imported ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_IMPORTED, addr.category() ); - EXPECT_EQ( "FAULT (Imp)", addr.quantityName() ); + EXPECT_EQ( "FAULT (Imp)", addr.vectorName() ); EXPECT_FALSE( addr.isErrorResult() ); } @@ -222,7 +222,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_ErrorResult1 ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_AQUIFER, addr.category() ); - EXPECT_EQ( "AAQR", addr.quantityName() ); + EXPECT_EQ( "AAQR", addr.vectorName() ); EXPECT_EQ( 456, addr.aquiferNumber() ); EXPECT_TRUE( addr.isErrorResult() ); } @@ -235,7 +235,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_ErrorResult2 ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION_LGR, addr.category() ); - EXPECT_EQ( "LCGAS", addr.quantityName() ); + EXPECT_EQ( "LCGAS", addr.vectorName() ); EXPECT_EQ( "LGR1", addr.lgrName() ); EXPECT_EQ( "B-1H", addr.wellName() ); EXPECT_EQ( 11, addr.cellI() ); @@ -252,7 +252,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressParsing_ErrorResult3 ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_IMPORTED, addr.category() ); - EXPECT_EQ( "FAULT (Imp)", addr.quantityName() ); + EXPECT_EQ( "FAULT (Imp)", addr.vectorName() ); EXPECT_TRUE( addr.isErrorResult() ); } @@ -269,7 +269,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressIjkParsing ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_WELL_COMPLETION, addr.category() ); - EXPECT_EQ( "WOPR", addr.quantityName() ); + EXPECT_EQ( "WOPR", addr.vectorName() ); EXPECT_EQ( "1-BH", addr.wellName() ); EXPECT_EQ( 6, addr.cellI() ); EXPECT_EQ( 7, addr.cellJ() ); @@ -289,7 +289,7 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressRegToRegParsing ) EXPECT_TRUE( addr.isValid() ); EXPECT_EQ( RifEclipseSummaryAddress::SUMMARY_REGION_2_REGION, addr.category() ); - EXPECT_EQ( "ROFR", addr.quantityName() ); + EXPECT_EQ( "ROFR", addr.vectorName() ); EXPECT_EQ( 123, addr.regionNumber() ); EXPECT_EQ( 456, addr.regionNumber2() ); EXPECT_TRUE( !addr.isErrorResult() ); @@ -298,28 +298,28 @@ TEST( RifEclipseSummaryAddressTest, TestEclipseAddressRegToRegParsing ) TEST( RifEclipseSummaryAddressTest, TestQuantityNameManipulations ) { { - auto s = RifEclipseSummaryAddress::baseQuantityName( "FOPT" ); + auto s = RifEclipseSummaryAddress::baseVectorName( "FOPT" ); EXPECT_EQ( "FOPT", s ); } { - auto s = RifEclipseSummaryAddress::baseQuantityName( "FOPT_1" ); + auto s = RifEclipseSummaryAddress::baseVectorName( "FOPT_1" ); EXPECT_EQ( "FOPT", s ); } { - auto s = RifEclipseSummaryAddress::baseQuantityName( "FOPR" ); + auto s = RifEclipseSummaryAddress::baseVectorName( "FOPR" ); EXPECT_EQ( "FOPR", s ); } { - auto s = RifEclipseSummaryAddress::baseQuantityName( "FOPR_1" ); + auto s = RifEclipseSummaryAddress::baseVectorName( "FOPR_1" ); EXPECT_EQ( "FOPR", s ); } { // https://github.com/OPM/ResInsight/issues/6481 - auto s = RifEclipseSummaryAddress::baseQuantityName( "FCMIT_1" ); + auto s = RifEclipseSummaryAddress::baseVectorName( "FCMIT_1" ); EXPECT_EQ( "FCMIT", s ); } } diff --git a/ApplicationLibCode/UnitTests/RifReaderEclipseSummary-Test.cpp b/ApplicationLibCode/UnitTests/RifReaderEclipseSummary-Test.cpp index e13a7730de..8a7932d707 100644 --- a/ApplicationLibCode/UnitTests/RifReaderEclipseSummary-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifReaderEclipseSummary-Test.cpp @@ -133,7 +133,7 @@ resulting for (size_t i = 0; i < addresses.size(); i++) { RifEclipseSummaryAddress adr(addresses[i].category(), addresses[i].simulationItemName(), -addresses[i].quantityName()); myAddresses.push_back(adr); +addresses[i].vectorName()); myAddresses.push_back(adr); } for (size_t i = 0; i < addresses.size(); i++) diff --git a/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp b/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp index c6c93efa1d..ed1437e5cf 100644 --- a/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp @@ -10,40 +10,40 @@ TEST( RiuSummaryQuantityNameInfoProvider, TestInit ) { { std::string s( "SRSFC" ); - auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s ); + auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT ); - auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s ); + auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s ); EXPECT_TRUE( longName == "Reach brine concentration" ); } { std::string s( "SRSFC" ); - auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s ); + auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s ); EXPECT_TRUE( test == "Reach brine concentration" ); } { std::string s( "does not exist" ); - auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s ); + auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_INVALID ); - auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s ); + auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s ); EXPECT_TRUE( longName == "" ); } { std::string s( "does not exist" ); - auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s ); + auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s ); EXPECT_TRUE( test == "" ); } { std::string s( "does not exist" ); - auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s, true ); + auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s, true ); EXPECT_TRUE( test == s ); } @@ -56,16 +56,16 @@ TEST( RiuSummaryQuantityNameInfoProvider, TestCustomNaming ) { { std::string s( "SRSFCABC" ); - auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s ); + auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT ); - auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s ); + auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s ); EXPECT_TRUE( longName == "Reach brine concentration" ); } { std::string s( "BHD__ABC" ); - auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( s ); + auto test = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s ); EXPECT_TRUE( test == "Hydraulic head" ); } @@ -78,13 +78,13 @@ TEST( RiuSummaryQuantityNameInfoProvider, Test6x ) { { std::string s( "GLIT" ); - auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s ); + auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_GROUP ); } { std::string s( "WSBVPROP" ); - auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s ); + auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL ); } } @@ -108,7 +108,7 @@ TEST( DISABLED_RiuSummaryQuantityNameInfoProvider, PerformanceLookup ) { for ( const auto& s : values ) { - RiuSummaryQuantityNameInfoProvider::instance()->categoryFromQuantityName( s ); + RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); } } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp index bd7b28a09c..618c6d6fa9 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp @@ -33,9 +33,9 @@ RiuSummaryQuantityNameInfoProvider* RiuSummaryQuantityNameInfoProvider::instance /// //-------------------------------------------------------------------------------------------------- RifEclipseSummaryAddress::SummaryVarCategory - RiuSummaryQuantityNameInfoProvider::categoryFromQuantityName( const std::string& quantity ) const + RiuSummaryQuantityNameInfoProvider::categoryFromVectorName( const std::string& vectorName ) const { - auto info = quantityInfo( quantity ); + auto info = quantityInfo( vectorName ); return info.category; } @@ -44,16 +44,16 @@ RifEclipseSummaryAddress::SummaryVarCategory /// //-------------------------------------------------------------------------------------------------- RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo - RiuSummaryQuantityNameInfoProvider::quantityInfo( const std::string& quantity ) const + RiuSummaryQuantityNameInfoProvider::quantityInfo( const std::string& vectorName ) const { - auto it = m_summaryToDescMap.find( quantity ); + auto it = m_summaryToDescMap.find( vectorName ); if ( it != m_summaryToDescMap.end() ) { return it->second; } - if ( quantity.size() > 1 && quantity[1] == 'U' ) + if ( vectorName.size() > 1 && vectorName[1] == 'U' ) { // User defined vector name // The summary type is given by the first letter, and U defines user-defined @@ -63,12 +63,12 @@ RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo return RiuSummaryQuantityInfo(); } - if ( quantity.size() > 5 ) + if ( vectorName.size() > 5 ) { // Check for custom vector naming - std::string postfix = quantity.substr( quantity.size() - 5, 5 ); - std::string baseName = quantity.substr( 0, 5 ); + std::string postfix = vectorName.substr( vectorName.size() - 5, 5 ); + std::string baseName = vectorName.substr( 0, 5 ); while ( baseName.back() == '_' ) baseName.pop_back(); @@ -92,8 +92,8 @@ RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::string RiuSummaryQuantityNameInfoProvider::longNameFromQuantityName( const std::string& vectorName, - bool returnVectorNameIfNotFound ) const +std::string RiuSummaryQuantityNameInfoProvider::longNameFromVectorName( const std::string& vectorName, + bool returnVectorNameIfNotFound ) const { auto info = quantityInfo( vectorName ); return info.category != RifEclipseSummaryAddress::SUMMARY_INVALID || !returnVectorNameIfNotFound ? info.longName diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h index bec9031bf0..b23f320dba 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h @@ -31,8 +31,8 @@ class RiuSummaryQuantityNameInfoProvider public: static RiuSummaryQuantityNameInfoProvider* instance(); - RifEclipseSummaryAddress::SummaryVarCategory categoryFromQuantityName( const std::string& quantity ) const; - std::string longNameFromQuantityName( const std::string& quantity, bool returnVectorNameIfNotFound = false ) const; + RifEclipseSummaryAddress::SummaryVarCategory categoryFromVectorName( const std::string& vectorName ) const; + std::string longNameFromVectorName( const std::string& vectorName, bool returnVectorNameIfNotFound = false ) const; private: class RiuSummaryQuantityInfo @@ -55,7 +55,7 @@ class RiuSummaryQuantityNameInfoProvider private: RiuSummaryQuantityNameInfoProvider(); - RiuSummaryQuantityInfo quantityInfo( const std::string& quantity ) const; + RiuSummaryQuantityInfo quantityInfo( const std::string& vectorName ) const; static std::unordered_map createInfoForEclipseKeywords(); static std::unordered_map createInfoFor6xKeywords(); diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp index ed76ae9602..a60b25f53a 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp @@ -1115,22 +1115,22 @@ std::set for ( const auto& adr : addrUnion ) { - if ( m_hideHistoryVectors && adr.isHistoryQuantity() ) continue; + if ( m_hideHistoryVectors && adr.isHistoryVector() ) continue; if ( m_hideDifferenceVectors ) { const auto diffText = RifReaderEclipseSummary::differenceIdentifier(); - if ( RiaStdStringTools::endsWith( adr.quantityName(), diffText ) ) continue; + if ( RiaStdStringTools::endsWith( adr.vectorName(), diffText ) ) continue; } if ( m_hideVectorsWithoutHistory ) { - auto candidateName = adr.quantityName() + RifReaderEclipseSummary::historyIdentifier(); + auto candidateName = adr.vectorName() + RifReaderEclipseSummary::historyIdentifier(); bool found = false; for ( const auto& ad : addrUnion ) { - if ( ad.quantityName() == candidateName ) found = true; + if ( ad.vectorName() == candidateName ) found = true; } if ( !found ) continue; @@ -1549,7 +1549,7 @@ void RiuSummaryVectorSelectionUi::appendOptionItemsForSubCategoriesAndVectors( Q if ( isVectorField ) { std::string longVectorName = - RiuSummaryQuantityNameInfoProvider::instance()->longNameFromQuantityName( itemName ); + RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( itemName ); if ( longVectorName.empty() ) { From 7d440a9c2f445ed44d07f5d074b96e7527e3a1f4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 10 May 2022 10:24:52 +0200 Subject: [PATCH 288/406] Performance: Avoid calling allSummaryCases allSummaryCases() is potentially a heavy CPU call for large ensembles. Always show the curve calculator button. --- .../RicShowSummaryCurveCalculatorFeature.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp index 4c01449427..375c222b73 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicShowSummaryCurveCalculatorFeature.cpp @@ -60,12 +60,7 @@ void RicShowSummaryCurveCalculatorFeature::hideCurveCalculatorDialog() //-------------------------------------------------------------------------------------------------- bool RicShowSummaryCurveCalculatorFeature::isCommandEnabled() { - RimProject* proj = RimProject::current(); - if ( !proj ) return false; - - const auto& allSumCases = proj->allSummaryCases(); - - return !allSumCases.empty(); + return true; } //-------------------------------------------------------------------------------------------------- From 65827f9c1c4388b8a15836290e8700f4fe184d74 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Wed, 11 May 2022 10:47:12 +0200 Subject: [PATCH 289/406] Improve summary case import performance (#8897) * Improve summary case import performance --- .../RicSummaryPlotTemplateTools.cpp | 5 +- .../ProjectDataModel/RimProject.cpp | 7 ++- .../Summary/RimSummaryCaseCollection.cpp | 46 +++++++++++++------ .../Summary/RimSummaryCaseCollection.h | 27 ++++++----- .../Summary/RimSummaryCaseMainCollection.cpp | 14 +++++- 5 files changed, 66 insertions(+), 33 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index 9f4095376c..665b69c4dd 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -104,10 +104,9 @@ RimSummaryMultiPlot* RicSummaryPlotTemplateTools::create( const QString& fileNam { auto caseCollection = sumCaseCollections.front(); - if ( !caseCollection->allSummaryCases().empty() ) + auto firstCase = caseCollection->firstSummaryCase(); + if ( firstCase != nullptr ) { - auto firstCase = caseCollection->allSummaryCases().front(); - analyzer.appendAddresses( firstCase->summaryReader()->allResultAddresses() ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 54ce1b2493..906d2ebc2b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -675,10 +675,13 @@ std::vector RimProject::allSummaryCases() const if ( sumCaseMainColl ) { std::vector allSummaryCases = sumCaseMainColl->allSummaryCases(); - sumCases.insert( sumCases.end(), allSummaryCases.begin(), allSummaryCases.end() ); + if ( !allSummaryCases.empty() ) + { + sumCases.insert( sumCases.end(), allSummaryCases.begin(), allSummaryCases.end() ); + } } - auto observedDataColl = oilField->observedDataCollection(); + auto& observedDataColl = oilField->observedDataCollection(); if ( observedDataColl != nullptr && observedDataColl->allObservedSummaryData().size() > 0 ) { auto observedData = observedDataColl->allObservedSummaryData(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index 15e140f7e8..008ab4f459 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -169,7 +169,7 @@ void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase ) calculateEnsembleParametersIntersectionHash(); } - buildChildNodes(); + clearChildNodes(); } //-------------------------------------------------------------------------------------------------- @@ -201,7 +201,7 @@ void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase ) updateReferringCurveSets(); - buildChildNodes(); + clearChildNodes(); } //-------------------------------------------------------------------------------------------------- @@ -212,6 +212,16 @@ std::vector RimSummaryCaseCollection::allSummaryCases() const return m_cases.childObjects(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCase* RimSummaryCaseCollection::firstSummaryCase() const +{ + if ( !m_cases.empty() ) return m_cases[0]; + + return nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -891,7 +901,7 @@ void RimSummaryCaseCollection::onLoadDataAndUpdate() if ( m_isEnsemble ) { calculateEnsembleParametersIntersectionHash(); - buildChildNodes(); + clearChildNodes(); } } @@ -953,8 +963,6 @@ void RimSummaryCaseCollection::initAfterRead() } updateIcon(); - - buildChildNodes(); } //-------------------------------------------------------------------------------------------------- @@ -999,10 +1007,8 @@ void RimSummaryCaseCollection::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiT { if ( m_isEnsemble() ) { - if ( m_dataVectorFolders->isEmpty() ) - { - buildChildNodes(); - } + buildChildNodes(); + m_dataVectorFolders->updateUiTreeOrdering( uiTreeOrdering ); if ( !m_cases.empty() ) @@ -1063,13 +1069,14 @@ bool RimSummaryCaseCollection::hasEnsembleParameters() const //-------------------------------------------------------------------------------------------------- void RimSummaryCaseCollection::buildChildNodes() { - m_dataVectorFolders->clear(); - - for ( auto& smcase : m_cases ) + if ( m_dataVectorFolders->isEmpty() ) { - m_dataVectorFolders->updateFolderStructure( smcase->summaryReader()->allResultAddresses(), - smcase->caseId(), - m_ensembleId ); + for ( auto& smcase : m_cases ) + { + m_dataVectorFolders->updateFolderStructure( smcase->summaryReader()->allResultAddresses(), + smcase->caseId(), + m_ensembleId ); + } } } @@ -1078,6 +1085,15 @@ void RimSummaryCaseCollection::buildChildNodes() //-------------------------------------------------------------------------------------------------- void RimSummaryCaseCollection::refreshMetaData() { + clearChildNodes(); buildChildNodes(); updateConnectedEditors(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCaseCollection::clearChildNodes() +{ + m_dataVectorFolders->clear(); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h index 461e997560..8346c0f44c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h @@ -58,21 +58,25 @@ class RimSummaryCaseCollection : public caf::PdmObject RimSummaryCaseCollection(); ~RimSummaryCaseCollection() override; - void removeCase( RimSummaryCase* summaryCase ); - void addCase( RimSummaryCase* summaryCase ); - virtual std::vector allSummaryCases() const; - void setName( const QString& name ); - QString name() const; + void removeCase( RimSummaryCase* summaryCase ); + void addCase( RimSummaryCase* summaryCase ); + virtual std::vector allSummaryCases() const; + RimSummaryCase* firstSummaryCase() const; + + void setName( const QString& name ); + QString name() const; + bool isEnsemble() const; void setAsEnsemble( bool isEnsemble ); virtual std::set ensembleSummaryAddresses() const; virtual std::set ensembleTimeSteps() const; - std::set wellsWithRftData() const; - std::set rftTimeStepsForWell( const QString& wellName ) const; - RifReaderRftInterface* rftStatisticsReader(); - void setEnsembleId( int ensembleId ); - int ensembleId() const; - bool hasEnsembleParameters() const; + + std::set wellsWithRftData() const; + std::set rftTimeStepsForWell( const QString& wellName ) const; + RifReaderRftInterface* rftStatisticsReader(); + void setEnsembleId( int ensembleId ); + int ensembleId() const; + bool hasEnsembleParameters() const; std::vector variationSortedEnsembleParameters( bool excludeNoVariation = false ) const; std::vector> @@ -119,6 +123,7 @@ class RimSummaryCaseCollection : public caf::PdmObject void onCaseNameChanged( const SignalEmitter* emitter ); void buildChildNodes(); + void clearChildNodes(); protected: virtual void onLoadDataAndUpdate(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index 49e098f158..3aef13f82b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -223,8 +223,10 @@ void RimSummaryCaseMainCollection::addCases( const std::vector { for ( RimSummaryCase* sumCase : cases ) { - addCase( sumCase ); + m_cases.push_back( sumCase ); + sumCase->nameChanged.connect( this, &RimSummaryCaseMainCollection::onCaseNameChanged ); } + dataSourceHasChanged.send(); } //-------------------------------------------------------------------------------------------------- @@ -355,7 +357,15 @@ size_t RimSummaryCaseMainCollection::summaryCaseCount() const std::vector RimSummaryCaseMainCollection::allSummaryCases() const { std::vector cases; - this->descendantsIncludingThisOfType( cases ); + + if ( !m_cases.empty() ) cases.insert( cases.end(), m_cases.begin(), m_cases.end() ); + + for ( auto& coll : m_caseCollections ) + { + auto collCases = coll->allSummaryCases(); + if ( collCases.empty() ) continue; + cases.insert( cases.end(), collCases.begin(), collCases.end() ); + } return cases; } From daf02571c2407c80aeb5059103b16ac369bebdd5 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 11 May 2022 19:17:46 +0200 Subject: [PATCH 290/406] Mainwindow datasources (#8883) * Main Window: add three dock widgets for splitting project tree * Main Window: move scripts to separate tree widget * Add eclipse result addresses to data source project tree. * Grid Calculator: drag-and-drop for calculation variables. * Grid Calculator: rename to 'Grid Property Calculator'. --- .../Commands/RicGridCalculatorDialog.cpp | 2 +- .../Commands/RicShowGridCalculatorFeature.cpp | 2 +- .../Commands/RicUserDefinedCalculatorUi.cpp | 2 +- .../ProjectDataModel/CMakeLists_files.cmake | 4 + .../ProjectDataModel/RimEclipseCase.cpp | 66 +++++++++++--- .../ProjectDataModel/RimEclipseCase.h | 4 + .../RimEclipseResultAddress.cpp | 90 +++++++++++++++++++ .../RimEclipseResultAddress.h | 50 +++++++++++ .../RimEclipseResultAddressCollection.cpp | 87 ++++++++++++++++++ .../RimEclipseResultAddressCollection.h | 51 +++++++++++ .../RimGridCalculationVariable.cpp | 29 ++++++ .../RimGridCalculationVariable.h | 7 +- .../ProjectDataModel/RimProject.cpp | 11 ++- .../UserInterface/RiuDockWidgetTools.cpp | 24 +++++ .../UserInterface/RiuDockWidgetTools.h | 4 + .../UserInterface/RiuDragDrop.cpp | 7 ++ .../UserInterface/RiuMainWindow.cpp | 30 ++++++- 17 files changed, 448 insertions(+), 22 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h create mode 100644 ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.h diff --git a/ApplicationLibCode/Commands/RicGridCalculatorDialog.cpp b/ApplicationLibCode/Commands/RicGridCalculatorDialog.cpp index 674f957ca0..5713ce7f21 100644 --- a/ApplicationLibCode/Commands/RicGridCalculatorDialog.cpp +++ b/ApplicationLibCode/Commands/RicGridCalculatorDialog.cpp @@ -28,7 +28,7 @@ /// //-------------------------------------------------------------------------------------------------- RicGridCalculatorDialog::RicGridCalculatorDialog( QWidget* parent ) - : RicUserDefinedCalculatorDialog( parent, "Grid Calculator" ) + : RicUserDefinedCalculatorDialog( parent, "Grid Property Calculator" ) { setUp(); } diff --git a/ApplicationLibCode/Commands/RicShowGridCalculatorFeature.cpp b/ApplicationLibCode/Commands/RicShowGridCalculatorFeature.cpp index 4201777c4e..bdfb86c8c6 100644 --- a/ApplicationLibCode/Commands/RicShowGridCalculatorFeature.cpp +++ b/ApplicationLibCode/Commands/RicShowGridCalculatorFeature.cpp @@ -89,6 +89,6 @@ void RicShowGridCalculatorFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicShowGridCalculatorFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText( "Grid Calculator" ); + actionToSetup->setText( "Grid Property Calculator" ); actionToSetup->setIcon( QIcon( ":/Calculator.svg" ) ); } diff --git a/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp index 4e935a4e27..0c5c476091 100644 --- a/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp +++ b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp @@ -132,7 +132,7 @@ void RicUserDefinedCalculatorUi::defineUiOrdering( QString uiConfigName, caf::Pd } { - caf::PdmUiGroup* group = uiOrdering.addNewGroupWithKeyword( "Calculated Summaries", calculationsGroupName() ); + caf::PdmUiGroup* group = uiOrdering.addNewGroupWithKeyword( "Calculations", calculationsGroupName() ); group->add( &m_currentCalculation ); group->add( &m_newCalculation ); group->add( &m_deleteCalculation ); diff --git a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake index a981b65f31..9232af4f86 100644 --- a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake @@ -124,6 +124,8 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionBand.h ${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCurve.h ${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCollection.h + ${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddress.h + ${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddressCollection.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -247,6 +249,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionBand.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCollection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddress.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddressCollection.cpp ) if(RESINSIGHT_USE_QT_CHARTS) diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index 0a243ab610..0ac10d0370 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -21,7 +21,9 @@ #include "RimEclipseCase.h" #include "RiaColorTables.h" +#include "RiaDefines.h" #include "RiaFieldHandleTools.h" +#include "RiaLogging.h" #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" @@ -50,6 +52,8 @@ #include "RimEclipseInputPropertyCollection.h" #include "RimEclipsePropertyFilter.h" #include "RimEclipsePropertyFilterCollection.h" +#include "RimEclipseResultAddress.h" +#include "RimEclipseResultAddressCollection.h" #include "RimEclipseStatisticsCase.h" #include "RimEclipseView.h" #include "RimFaultInViewCollection.h" @@ -119,6 +123,10 @@ RimEclipseCase::RimEclipseCase() m_inputPropertyCollection = new RimEclipseInputPropertyCollection; m_inputPropertyCollection->parentField()->uiCapability()->setUiTreeHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_resultAddressCollections, "ResultAddressCollections", "Result Addresses" ); + m_resultAddressCollections.uiCapability()->setUiHidden( true ); + m_resultAddressCollections.xmlCapability()->disableIO(); + // Init m_matrixModelResults = new RimReservoirCellResultsStorage; @@ -559,27 +567,63 @@ void RimEclipseCase::updateFormationNamesData() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEclipseCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) +void RimEclipseCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) { - std::vector children; - reservoirViews.childObjects( &children ); + if ( uiConfigName == "MainWindow.ProjectTree" ) + { + std::vector children; + reservoirViews.childObjects( &children ); - for ( auto child : children ) - uiTreeOrdering.add( child ); + for ( auto child : children ) + uiTreeOrdering.add( child ); - if ( !m_2dIntersectionViewCollection->views().empty() ) - { - uiTreeOrdering.add( &m_2dIntersectionViewCollection ); - } + if ( !m_2dIntersectionViewCollection->views().empty() ) + { + uiTreeOrdering.add( &m_2dIntersectionViewCollection ); + } - if ( !m_contourMapCollection->views().empty() ) + if ( !m_contourMapCollection->views().empty() ) + { + uiTreeOrdering.add( &m_contourMapCollection ); + } + } + else if ( uiConfigName == "MainWindow.DataSources" ) { - uiTreeOrdering.add( &m_contourMapCollection ); + if ( m_resultAddressCollections.empty() ) buildChildNodes(); + uiTreeOrdering.add( &m_resultAddressCollections ); } uiTreeOrdering.skipRemainingChildren( true ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseCase::buildChildNodes() +{ + m_resultAddressCollections.clear(); + + std::vector resultTypes = { RiaDefines::ResultCatType::STATIC_NATIVE, + RiaDefines::ResultCatType::DYNAMIC_NATIVE, + RiaDefines::ResultCatType::INPUT_PROPERTY, + RiaDefines::ResultCatType::GENERATED }; + for ( auto resultType : resultTypes ) + { + auto resultAddressCollection = new RimEclipseResultAddressCollection; + resultAddressCollection->setResultType( resultType ); + QString name = caf::AppEnum::uiText( resultType ); + resultAddressCollection->setName( name ); + + QStringList resultNames = results( RiaDefines::PorosityModelType::MATRIX_MODEL )->resultNames( resultType ); + for ( auto resultName : resultNames ) + { + resultAddressCollection->addAddress( resultName, resultType, this ); + } + + m_resultAddressCollections.push_back( resultAddressCollection ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.h b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.h index 1d9846e148..d7b08daa5e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.h @@ -50,6 +50,7 @@ class RimEclipseInputPropertyCollection; class RimEclipseView; class RimIdenticalGridCaseGroup; class RimReservoirCellResultsStorage; +class RimEclipseResultAddressCollection; class RifReaderSettings; //================================================================================================== @@ -139,6 +140,7 @@ class RimEclipseCase : public RimCase private: void createTimeStepFormatString(); std::vector allSpecialViews() const override; + void buildChildNodes(); protected: caf::PdmField m_flipXAxis; @@ -156,6 +158,8 @@ class RimEclipseCase : public RimCase QString m_timeStepFormatString; std::map m_wellToColorMap; + caf::PdmChildArrayField m_resultAddressCollections; + caf::PdmChildField m_matrixModelResults; caf::PdmChildField m_fractureModelResults; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp new file mode 100644 index 0000000000..7594499336 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp @@ -0,0 +1,90 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimEclipseResultAddress.h" + +#include "RimEclipseCase.h" + +CAF_PDM_SOURCE_INIT( RimEclipseResultAddress, "EclipseResultAddress" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseResultAddress::RimEclipseResultAddress() +{ + CAF_PDM_InitObject( "EclipseResultAddress", ":/DataVector.png", "", "" ); + + CAF_PDM_InitFieldNoDefault( &m_resultName, "ResultName", "Result Name" ); + CAF_PDM_InitFieldNoDefault( &m_resultType, "ResultType", "Type" ); + CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseResultAddress::~RimEclipseResultAddress() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimEclipseResultAddress::resultName() const +{ + return m_resultName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultAddress::setResultName( const QString& resultName ) +{ + m_resultName = resultName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultAddress::setResultType( RiaDefines::ResultCatType val ) +{ + m_resultType = val; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaDefines::ResultCatType RimEclipseResultAddress::resultType() const +{ + return m_resultType(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultAddress::setEclipseCase( RimEclipseCase* eclipseCase ) +{ + m_eclipseCase = eclipseCase; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseCase* RimEclipseResultAddress::eclipseCase() const +{ + return m_eclipseCase; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h new file mode 100644 index 0000000000..5529429aed --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h @@ -0,0 +1,50 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmField.h" +#include "cafPdmObject.h" +#include "cafPdmPtrField.h" + +#include "RiaDefines.h" + +class RimEclipseCase; + +class RimEclipseResultAddress : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimEclipseResultAddress(); + ~RimEclipseResultAddress() override; + + void setResultName( const QString& resultName ); + QString resultName() const; + + void setResultType( RiaDefines::ResultCatType val ); + RiaDefines::ResultCatType resultType() const; + + void setEclipseCase( RimEclipseCase* eclipseCase ); + RimEclipseCase* eclipseCase() const; + +private: + caf::PdmField m_resultName; + caf::PdmField> m_resultType; + caf::PdmPtrField m_eclipseCase; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.cpp new file mode 100644 index 0000000000..744ff4e274 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.cpp @@ -0,0 +1,87 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimEclipseResultAddressCollection.h" + +#include "RimEclipseResultAddress.h" + +#include "cafPdmUiTreeOrdering.h" + +CAF_PDM_SOURCE_INIT( RimEclipseResultAddressCollection, "RimEclipseResultAddressCollection" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseResultAddressCollection::RimEclipseResultAddressCollection() +{ + CAF_PDM_InitObject( "Folder", ":/Folder.png", "", "" ); + + CAF_PDM_InitFieldNoDefault( &m_adresses, "Addresses", "Addresses" ); + m_adresses.uiCapability()->setUiTreeHidden( true ); + + CAF_PDM_InitFieldNoDefault( &m_resultType, "ResultType", "Type" ); + m_resultType.uiCapability()->setUiHidden( true ); + + nameField()->uiCapability()->setUiHidden( true ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimEclipseResultAddressCollection::~RimEclipseResultAddressCollection() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultAddressCollection::setResultType( RiaDefines::ResultCatType val ) +{ + m_resultType = val; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultAddressCollection::addAddress( const QString& resultName, + RiaDefines::ResultCatType resultType, + RimEclipseCase* eclipseCase ) +{ + auto addr = new RimEclipseResultAddress; + addr->setUiName( resultName ); + addr->setResultName( resultName ); + addr->setResultType( resultType ); + addr->setEclipseCase( eclipseCase ); + m_adresses.push_back( addr ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEclipseResultAddressCollection::clear() +{ + m_adresses.clear(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimEclipseResultAddressCollection::isEmpty() const +{ + return m_adresses.empty(); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.h b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.h new file mode 100644 index 0000000000..1744c6d953 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.h @@ -0,0 +1,51 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#pragma once + +#include "RiaDefines.h" +#include "RimNamedObject.h" + +#include "cafPdmChildArrayField.h" +#include "cafPdmPtrField.h" + +#include + +class RimEclipseResultAddress; +class RimEclipseCase; + +class RimEclipseResultAddressCollection : public RimNamedObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimEclipseResultAddressCollection(); + ~RimEclipseResultAddressCollection() override; + + void setResultType( RiaDefines::ResultCatType val ); + + void addAddress( const QString& resultName, RiaDefines::ResultCatType resultType, RimEclipseCase* eclipseCase ); + + bool isEmpty() const; + + void clear(); + +private: + caf::PdmChildArrayField m_adresses; + caf::PdmField> m_resultType; + caf::PdmPtrField m_eclipseCase; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp index 6a85dfa2e9..709f3ed5d9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp @@ -23,9 +23,12 @@ #include "RiaPorosityModel.h" #include "RiaResultNames.h" +#include "RiuDragDrop.h" + #include "RigCaseCellResultsData.h" #include "RimEclipseCase.h" +#include "RimEclipseResultAddress.h" #include "RimTools.h" CAF_PDM_SOURCE_INIT( RimGridCalculationVariable, "RimGridCalculationVariable" ); @@ -179,3 +182,29 @@ int RimGridCalculationVariable::allTimeStepsValue() { return -1; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculationVariable::handleDroppedMimeData( const QMimeData* data, + Qt::DropAction action, + caf::PdmFieldHandle* destinationField ) +{ + auto objects = RiuDragDrop::convertToObjects( data ); + if ( !objects.empty() ) + { + auto address = dynamic_cast( objects.front() ); + if ( address ) setEclipseResultAddress( *address ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculationVariable::setEclipseResultAddress( const RimEclipseResultAddress& address ) +{ + m_resultVariable = address.resultName(); + m_resultType = address.resultType(); + m_eclipseCase = address.eclipseCase(); + updateConnectedEditors(); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h index 7f388cafda..6e51b739de 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h @@ -22,13 +22,12 @@ #include "RiaDefines.h" -#include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" -#include "cafPdmProxyValueField.h" #include "cafPdmPtrField.h" class RimEclipseCase; +class RimEclipseResultAddress; class RigCaseCellResultsData; //================================================================================================== @@ -51,6 +50,10 @@ class RimGridCalculationVariable : public RimUserDefinedCalculationVariable static int allTimeStepsValue(); + void handleDroppedMimeData( const QMimeData* data, Qt::DropAction action, caf::PdmFieldHandle* destinationField ) override; + + void setEclipseResultAddress( const RimEclipseResultAddress& address ); + private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 906d2ebc2b..ebd9780d3d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -1457,10 +1457,18 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q } } } - else if ( uiConfigName == "PlotWindow.Scripts" ) + else if ( uiConfigName == "PlotWindow.Scripts" || uiConfigName == "MainWindow.Scripts" ) { uiTreeOrdering.add( scriptCollection() ); } + else if ( uiConfigName == "MainWindow.DataSources" ) + { + RimOilField* oilField = activeOilField(); + if ( oilField ) + { + if ( oilField->analysisModels() ) uiTreeOrdering.add( oilField->analysisModels() ); + } + } else { if ( viewLinkerCollection()->viewLinker() ) @@ -1483,7 +1491,6 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q } uiTreeOrdering.add( colorLegendCollection() ); - uiTreeOrdering.add( scriptCollection() ); } uiTreeOrdering.skipRemainingChildren( true ); diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index bc8eb32451..b57bb66482 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -108,6 +108,30 @@ QString RiuDockWidgetTools::summaryPlotManagerName() return "dockSummaryPlotManager"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::mainWindowProjectTreeName() +{ + return "mainWindow_dockProjectTree"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::mainWindowDataSourceTreeName() +{ + return "mainWindow_dockDataSourceTree"; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::mainWindowScriptsTreeName() +{ + return "mainWindow_dockScriptsTree"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index 196014e0ab..30b40243d3 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -48,6 +48,10 @@ class RiuDockWidgetTools static QString undoStackName(); static QString summaryPlotManagerName(); + static QString mainWindowProjectTreeName(); + static QString mainWindowDataSourceTreeName(); + static QString mainWindowScriptsTreeName(); + static QString plotMainWindowDataSourceTreeName(); static QString plotMainWindowPlotsTreeName(); static QString plotMainWindowScriptsTreeName(); diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index 670ad02979..fefbed0217 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -28,6 +28,7 @@ #include "RimCaseCollection.h" #include "RimEclipseCase.h" +#include "RimEclipseResultAddress.h" #include "RimEclipseResultCase.h" #include "RimIdenticalGridCaseGroup.h" #include "RimMimeData.h" @@ -49,6 +50,7 @@ #include "RimWellLogFileChannel.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" + #include "RiuMainWindow.h" #include "RicWellLogTools.h" @@ -271,6 +273,11 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const { itemflags |= Qt::ItemIsDragEnabled; } + auto eclipseResultAdr = dynamic_cast( uiItem ); + if ( eclipseResultAdr ) + { + itemflags |= Qt::ItemIsDragEnabled; + } } if ( m_dragItems.empty() ) return itemflags; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index be242a7dda..23d1410098 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -710,16 +710,24 @@ void RiuMainWindow::createToolBars() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::createDockPanels() { - const int nTreeViews = 1; + const int nTreeViews = 3; + const std::vector treeViewTitles = { "Project Tree", "Data Sources", "Scripts" }; + const std::vector treeViewConfigs = { "MainWindow.ProjectTree", "MainWindow.DataSources", "MainWindow.Scripts" }; + const std::vector treeViewDockNames = { RiuDockWidgetTools::mainWindowProjectTreeName(), + RiuDockWidgetTools::mainWindowDataSourceTreeName(), + RiuDockWidgetTools::mainWindowScriptsTreeName() }; createTreeViews( nTreeViews ); + QDockWidget* dockOntopOfWidget = nullptr; + + for ( int i = 0; i < nTreeViews; i++ ) { - QDockWidget* dockWidget = new QDockWidget( "Project Tree", this ); - dockWidget->setObjectName( RiuDockWidgetTools::projectTreeName() ); + QDockWidget* dockWidget = new QDockWidget( treeViewTitles[i], this ); + dockWidget->setObjectName( treeViewDockNames[i] ); dockWidget->setAllowedAreas( Qt::AllDockWidgetAreas ); - caf::PdmUiTreeView* projectTree = projectTreeView( 0 ); + caf::PdmUiTreeView* projectTree = projectTreeView( i ); projectTree->enableSelectionManagerUpdating( true ); projectTree->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); @@ -741,11 +749,25 @@ void RiuMainWindow::createDockPanels() addDockWidget( Qt::LeftDockWidgetArea, dockWidget ); + if ( dockOntopOfWidget ) + { + tabifyDockWidget( dockOntopOfWidget, dockWidget ); + } + else + { + dockOntopOfWidget = dockWidget; + } + + connect( dockWidget, SIGNAL( visibilityChanged( bool ) ), projectTree, SLOT( treeVisibilityChanged( bool ) ) ); + connect( projectTree, SIGNAL( selectionChanged() ), this, SLOT( selectedObjectsChanged() ) ); + projectTree->treeView()->setContextMenuPolicy( Qt::CustomContextMenu ); connect( projectTree->treeView(), SIGNAL( customContextMenuRequested( const QPoint& ) ), SLOT( customMenuRequested( const QPoint& ) ) ); + + projectTree->setUiConfigurationName( treeViewConfigs[i] ); } QDockWidget* resultPlotDock = nullptr; From 828e8ec4406dd24e89dbbf3df1e76b566a21e3e8 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Wed, 11 May 2022 19:46:17 +0200 Subject: [PATCH 291/406] Show templates as separate project explorer tab. (#8902) Add templates as separate project explorer tab. Add support for renaming and editing templates --- .../Application/CMakeLists_files.cmake | 1 - ...ummaryCurvesForSummaryAddressesFeature.cpp | 4 +- ...SummaryPlotsForSummaryAddressesFeature.cpp | 4 +- .../CMakeLists_files.cmake | 4 + .../RicEditPlotTemplateFeature.cpp | 92 +++++++++++++++++ .../RicEditPlotTemplateFeature.h | 34 +++++++ .../RicReloadPlotTemplatesFeature.h | 2 - .../RicRenamePlotTemplateFeature.cpp | 99 +++++++++++++++++++ .../RicRenamePlotTemplateFeature.h | 34 +++++++ .../RimPlotTemplateFolderItem.cpp | 2 +- .../RimContextCommandBuilder.cpp | 2 + .../ProjectDataModel/RimProject.cpp | 18 ++-- .../ProjectDataModel/RimProject.h | 2 +- .../UserInterface/RiuDockWidgetTools.cpp | 8 ++ .../UserInterface/RiuDockWidgetTools.h | 1 + .../UserInterface/RiuPlotMainWindow.cpp | 22 ++++- .../UserInterface/RiuPlotMainWindow.h | 2 + 17 files changed, 310 insertions(+), 21 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.h create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.h diff --git a/ApplicationLibCode/Application/CMakeLists_files.cmake b/ApplicationLibCode/Application/CMakeLists_files.cmake index f69791efcb..6a3a6e2c22 100644 --- a/ApplicationLibCode/Application/CMakeLists_files.cmake +++ b/ApplicationLibCode/Application/CMakeLists_files.cmake @@ -73,7 +73,6 @@ set(QT_MOC_HEADERS ${CMAKE_CURRENT_LIST_DIR}/RiaConsoleApplication.h ${CMAKE_CURRENT_LIST_DIR}/RiaGuiApplication.h ${CMAKE_CURRENT_LIST_DIR}/RiaCompletionTypeCalculationScheduler.h - ${CMAKE_CURRENT_LIST_DIR}/RiaViewRedrawScheduler.h ${CMAKE_CURRENT_LIST_DIR}/RiaPlotWindowRedrawScheduler.h ${CMAKE_CURRENT_LIST_DIR}/RiaScheduler.h ) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.cpp index ed05b092d0..b0009c0677 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryCurvesForSummaryAddressesFeature.cpp @@ -66,9 +66,7 @@ void RicAppendSummaryCurvesForSummaryAddressesFeature::onActionTriggered( bool i //-------------------------------------------------------------------------------------------------- void RicAppendSummaryCurvesForSummaryAddressesFeature::setupActionLook( QAction* actionToSetup ) { - QString objectType = "Addresses"; - - auto text = QString( "Append Curves For " ) + objectType; + auto text = QString( "Append Curves For Vector" ); actionToSetup->setText( text ); actionToSetup->setIcon( QIcon( ":/SummaryCurve16x16.png" ) ); } diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp index e7f13dac50..76f5cce569 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp @@ -82,9 +82,7 @@ void RicAppendSummaryPlotsForSummaryAddressesFeature::onActionTriggered( bool is //-------------------------------------------------------------------------------------------------- void RicAppendSummaryPlotsForSummaryAddressesFeature::setupActionLook( QAction* actionToSetup ) { - QString objectType = "Addresses"; - - auto text = QString( "Append Plots For " ) + objectType; + auto text = QString( "Append Plots For Vector" ); actionToSetup->setText( text ); actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake index 6b7149beaa..40a576e918 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake @@ -6,6 +6,8 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeatureSettings.h ${CMAKE_CURRENT_LIST_DIR}/RicCreateMultiPlotFromSelectionFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicRenamePlotTemplateFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicEditPlotTemplateFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -16,6 +18,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSaveMultiPlotTemplateFeatureSettings.cpp ${CMAKE_CURRENT_LIST_DIR}/RicCreateMultiPlotFromSelectionFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicRenamePlotTemplateFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicEditPlotTemplateFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.cpp new file mode 100644 index 0000000000..7af55df646 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.cpp @@ -0,0 +1,92 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicEditPlotTemplateFeature.h" + +#include "RiaApplication.h" +#include "RiaLogging.h" + +#include "PlotTemplates/RimPlotTemplateFileItem.h" +#include "RimProject.h" + +#include "RiuPlotMainWindow.h" + +#include "cafSelectionManager.h" + +#include +#include +#include +#include +#include +#include + +CAF_CMD_SOURCE_INIT( RicEditPlotTemplateFeature, "RicEditPlotTemplateFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicEditPlotTemplateFeature::isCommandEnabled() +{ + std::vector uiItems; + caf::SelectionManager::instance()->selectedItems( uiItems ); + if ( uiItems.size() != 1 ) return false; + + RimPlotTemplateFileItem* file = dynamic_cast( uiItems[0] ); + return ( file != nullptr ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEditPlotTemplateFeature::onActionTriggered( bool isChecked ) +{ + std::vector uiItems; + caf::SelectionManager::instance()->selectedItems( uiItems ); + + if ( uiItems.size() != 1 ) return; + + RimPlotTemplateFileItem* file = dynamic_cast( uiItems[0] ); + if ( file == nullptr ) return; + + RiaApplication* app = RiaApplication::instance(); + QString scriptEditor = app->scriptEditorPath(); + if ( !scriptEditor.isEmpty() ) + { + QStringList arguments; + arguments << file->absoluteFilePath(); + + QProcess* myProcess = new QProcess( this ); + myProcess->start( scriptEditor, arguments ); + + if ( !myProcess->waitForStarted( 1000 ) ) + { + RiaLogging::errorInMessageBox( RiuPlotMainWindow::instance(), + "Text editor", + "Failed to start text editor executable\n" + scriptEditor ); + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicEditPlotTemplateFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Edit" ); + actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.h new file mode 100644 index 0000000000..e348d29a27 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.h @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicEditPlotTemplateFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.h index c5c298de2d..4bb9f0c9e2 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.h +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.h @@ -20,8 +20,6 @@ #include "cafCmdFeature.h" -class RimSummaryPlot; - //================================================================================================== /// //================================================================================================== diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.cpp new file mode 100644 index 0000000000..78672c3a31 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.cpp @@ -0,0 +1,99 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicRenamePlotTemplateFeature.h" + +#include "PlotTemplates/RimPlotTemplateFileItem.h" + +#include "RiuPlotMainWindow.h" + +#include "cafSelectionManager.h" + +#include +#include +#include +#include +#include +#include + +CAF_CMD_SOURCE_INIT( RicRenamePlotTemplateFeature, "RicRenamePlotTemplateFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicRenamePlotTemplateFeature::isCommandEnabled() +{ + std::vector uiItems; + caf::SelectionManager::instance()->selectedItems( uiItems ); + if ( uiItems.size() != 1 ) return false; + + RimPlotTemplateFileItem* file = dynamic_cast( uiItems[0] ); + return ( file != nullptr ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicRenamePlotTemplateFeature::onActionTriggered( bool isChecked ) +{ + std::vector uiItems; + caf::SelectionManager::instance()->selectedItems( uiItems ); + + if ( uiItems.size() != 1 ) return; + + RimPlotTemplateFileItem* file = dynamic_cast( uiItems[0] ); + if ( file == nullptr ) return; + + QFileInfo fi( file->absoluteFilePath() ); + + QWidget* parent = RiuPlotMainWindow::instance(); + + bool ok; + QString newname = + QInputDialog::getText( parent, "Rename Plot Template", "Enter new name:", QLineEdit::Normal, fi.baseName(), &ok ); + + if ( !ok ) return; + + newname = newname.trimmed(); + + if ( newname.isEmpty() || newname.contains( "/" ) || newname.contains( "\\" ) ) + { + QMessageBox::critical( parent, "Rename failed", "Invalid name given.", QMessageBox::Ok ); + return; + } + + QString newPath = fi.absolutePath() + "/" + newname + "." + fi.completeSuffix(); + + if ( !QFile::rename( file->absoluteFilePath(), newPath ) ) + { + QMessageBox::critical( parent, "Rename failed", "Unable to rename the selected plot template.", QMessageBox::Ok ); + return; + } + + file->setFilePath( newPath ); + file->updateConnectedEditors(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicRenamePlotTemplateFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Rename" ); + actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.h new file mode 100644 index 0000000000..ff978988ec --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.h @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicRenamePlotTemplateFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp index 1d964db4e6..89138401af 100644 --- a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp @@ -35,7 +35,7 @@ CAF_PDM_SOURCE_INIT( RimPlotTemplateFolderItem, "PlotTemplateCollection" ); //-------------------------------------------------------------------------------------------------- RimPlotTemplateFolderItem::RimPlotTemplateFolderItem() { - CAF_PDM_InitObject( "PlotTemplateCollection", ":/Folder.png" ); + CAF_PDM_InitObject( "Plot Templates", ":/Folder.png" ); CAF_PDM_InitFieldNoDefault( &m_folderName, "FolderName", "Folder" ); CAF_PDM_InitFieldNoDefault( &m_fileNames, "FileNames", "" ); diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index f8872c3b33..e24f84367c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1022,6 +1022,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { + menuBuilder << "RicRenamePlotTemplateFeature"; + menuBuilder << "RicEditPlotTemplateFeature"; menuBuilder << "RicReloadPlotTemplatesFeature"; } else if ( dynamic_cast( firstUiItem ) ) diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index ebd9780d3d..0934a8534f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -214,9 +214,9 @@ RimProject::RimProject( void ) mainPlotCollection = new RimMainPlotCollection(); - CAF_PDM_InitFieldNoDefault( &m_plotTemplateFolderItem, "PlotTemplateCollection", "Plot Templates" ); - m_plotTemplateFolderItem = new RimPlotTemplateFolderItem(); - m_plotTemplateFolderItem.xmlCapability()->disableIO(); + CAF_PDM_InitFieldNoDefault( &m_plotTemplateTopFolder, "PlotTemplateCollection", "Plot Templates" ); + m_plotTemplateTopFolder = new RimPlotTemplateFolderItem(); + m_plotTemplateTopFolder.xmlCapability()->disableIO(); // For now, create a default first oilfield that contains the rest of the project oilFields.push_back( new RimOilField ); @@ -403,12 +403,12 @@ void RimProject::setScriptDirectories( const QString& scriptDirectories ) //-------------------------------------------------------------------------------------------------- void RimProject::setPlotTemplateFolders( const QStringList& plotTemplateFolders ) { - if ( !m_plotTemplateFolderItem() ) + if ( !m_plotTemplateTopFolder() ) { - m_plotTemplateFolderItem = new RimPlotTemplateFolderItem(); + m_plotTemplateTopFolder = new RimPlotTemplateFolderItem(); } - m_plotTemplateFolderItem->createRootFolderItemsFromFolderPaths( plotTemplateFolders ); + m_plotTemplateTopFolder->createRootFolderItemsFromFolderPaths( plotTemplateFolders ); } //-------------------------------------------------------------------------------------------------- @@ -1322,7 +1322,7 @@ RimMeasurement* RimProject::measurement() const //-------------------------------------------------------------------------------------------------- RimPlotTemplateFolderItem* RimProject::rootPlotTemlateItem() const { - return m_plotTemplateFolderItem; + return m_plotTemplateTopFolder; } //-------------------------------------------------------------------------------------------------- @@ -1461,6 +1461,10 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q { uiTreeOrdering.add( scriptCollection() ); } + else if ( uiConfigName == "PlotWindow.Templates" ) + { + uiTreeOrdering.add( m_plotTemplateTopFolder ); + } else if ( uiConfigName == "MainWindow.DataSources" ) { RimOilField* oilField = activeOilField(); diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index 7a89de66a8..3e844e7c89 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -212,7 +212,7 @@ class RimProject : public caf::PdmDocument caf::PdmField m_projectFileVersionString; caf::PdmChildField m_dialogData; - caf::PdmChildField m_plotTemplateFolderItem; + caf::PdmChildField m_plotTemplateTopFolder; caf::PdmField m_show3DWindow; caf::PdmField m_showPlotWindow; diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index b57bb66482..24f21e308d 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -148,6 +148,14 @@ QString RiuDockWidgetTools::plotMainWindowPlotsTreeName() return "plotMainWindow_dockPlotsTree"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::plotMainWindowTemplateTreeName() +{ + return "plotMainWindow_dockTemplatesTree"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index 30b40243d3..dc96e9114b 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -54,6 +54,7 @@ class RiuDockWidgetTools static QString plotMainWindowDataSourceTreeName(); static QString plotMainWindowPlotsTreeName(); + static QString plotMainWindowTemplateTreeName(); static QString plotMainWindowScriptsTreeName(); static QString plotMainWindowPropertyEditorName(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index d7f4361d5e..8ada2ed27a 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -121,6 +121,18 @@ QString RiuPlotMainWindow::mainWindowName() return "RiuPlotMainWindow"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuPlotMainWindow* RiuPlotMainWindow::instance() +{ + if ( RiaGuiApplication::isRunning() ) + { + return RiaGuiApplication::instance()->mainPlotWindow(); + } + return nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -460,11 +472,15 @@ void RiuPlotMainWindow::refreshToolbars() //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::createDockPanels() { - const int nTreeViews = 3; - const std::vector treeViewTitles = { "Plots", "Data Sources", "Scripts" }; - const std::vector treeViewConfigs = { "PlotWindow.Plots", "PlotWindow.DataSources", "PlotWindow.Scripts" }; + const int nTreeViews = 4; + const std::vector treeViewTitles = { "Plots", "Data Sources", "Templates", "Scripts" }; + const std::vector treeViewConfigs = { "PlotWindow.Plots", + "PlotWindow.DataSources", + "PlotWindow.Templates", + "PlotWindow.Scripts" }; const std::vector treeViewDockNames = { RiuDockWidgetTools::plotMainWindowPlotsTreeName(), RiuDockWidgetTools::plotMainWindowDataSourceTreeName(), + RiuDockWidgetTools::plotMainWindowTemplateTreeName(), RiuDockWidgetTools::plotMainWindowScriptsTreeName() }; createTreeViews( nTreeViews ); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 29c94fedbc..53759b548e 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -58,6 +58,8 @@ class RiuPlotMainWindow : public RiuMainWindowBase RiuPlotMainWindow(); ~RiuPlotMainWindow() override; + static RiuPlotMainWindow* instance(); + QString mainWindowName() override; void initializeGuiNewProjectLoaded(); From b27f59cecb6e7ff05b249311c8c538435abf37b4 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 11 May 2022 10:07:11 +0200 Subject: [PATCH 292/406] #8274 Python: assign default values Fixes #8274. --- ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp index 677c549d97..45b41a8439 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPart.cpp @@ -32,7 +32,7 @@ RimGeoMechPart::RimGeoMechPart() { CAF_PDM_InitScriptableObject( "GeoMechPart", ":/GeoMechCase24x24.png" ); - CAF_PDM_InitScriptableFieldNoDefault( &m_partId, "PartId", "Part Id" ); + CAF_PDM_InitScriptableField( &m_partId, "PartId", -1, "Part Id" ); m_partId.uiCapability()->setUiReadOnly( true ); nameField()->uiCapability()->setUiReadOnly( true ); From 35d91130d3238bc23b7e6c30c8b3794e6e5b4690 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 11 May 2022 10:26:02 +0200 Subject: [PATCH 293/406] #8571 Python: generate proper method docs for boolean parameters. Fixes #8571. --- Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp b/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp index e6fc0518b6..e541ac96a2 100644 --- a/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp +++ b/Fwk/AppFwk/cafPdmScripting/cafPdmPythonGenerator.cpp @@ -486,6 +486,7 @@ QString PdmPythonGenerator::dataTypeString( const PdmFieldHandle* field, bool us std::map builtins = { { QString::fromStdString( typeid( double ).name() ), "float" }, { QString::fromStdString( typeid( float ).name() ), "float" }, { QString::fromStdString( typeid( int ).name() ), "int" }, + { QString::fromStdString( typeid( bool ).name() ), "bool" }, { QString::fromStdString( typeid( time_t ).name() ), "time" }, { QString::fromStdString( typeid( QString ).name() ), "str" } }; From 4f31f5c76e571ffbf87381ef7f4c786496e99c82 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 12 May 2022 21:46:35 +0200 Subject: [PATCH 294/406] Add support for deleting plot templates (#8908) --- .../CMakeLists_files.cmake | 2 + .../RicDeletePlotTemplateFeature.cpp | 86 +++++++++++++++++++ .../RicDeletePlotTemplateFeature.h | 34 ++++++++ .../RimContextCommandBuilder.cpp | 2 + 4 files changed, 124 insertions(+) create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicDeletePlotTemplateFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicDeletePlotTemplateFeature.h diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake index 40a576e918..dcd6e38c2e 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake @@ -8,6 +8,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicCreateMultiPlotFromSelectionFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicRenamePlotTemplateFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicEditPlotTemplateFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicDeletePlotTemplateFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -20,6 +21,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicCreateMultiPlotFromSelectionFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicRenamePlotTemplateFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicEditPlotTemplateFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicDeletePlotTemplateFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicDeletePlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicDeletePlotTemplateFeature.cpp new file mode 100644 index 0000000000..b825ab508f --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicDeletePlotTemplateFeature.cpp @@ -0,0 +1,86 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicDeletePlotTemplateFeature.h" + +#include "PlotTemplates/RimPlotTemplateFileItem.h" + +#include "RicReloadPlotTemplatesFeature.h" + +#include "RiuPlotMainWindow.h" + +#include "cafSelectionManager.h" + +#include +#include +#include +#include +#include +#include + +CAF_CMD_SOURCE_INIT( RicDeletePlotTemplateFeature, "RicDeletePlotTemplateFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicDeletePlotTemplateFeature::isCommandEnabled() +{ + std::vector uiItems; + caf::SelectionManager::instance()->selectedItems( uiItems ); + if ( uiItems.size() != 1 ) return false; + + RimPlotTemplateFileItem* file = dynamic_cast( uiItems[0] ); + return ( file != nullptr ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeletePlotTemplateFeature::onActionTriggered( bool isChecked ) +{ + std::vector uiItems; + caf::SelectionManager::instance()->selectedItems( uiItems ); + + if ( uiItems.size() != 1 ) return; + + RimPlotTemplateFileItem* file = dynamic_cast( uiItems[0] ); + if ( file == nullptr ) return; + + QWidget* parent = RiuPlotMainWindow::instance(); + + QString question = "Do you want to delete the plot template file\n\n" + file->absoluteFilePath(); + + if ( QMessageBox::question( parent, "Delete Template File?", question ) == QMessageBox::No ) return; + + if ( !QFile::remove( file->absoluteFilePath() ) ) + { + QMessageBox::critical( parent, "Delete failed", "Unable to remove the selected plot template.", QMessageBox::Ok ); + return; + } + + RicReloadPlotTemplatesFeature::rebuildFromDisc(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeletePlotTemplateFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Delete" ); + actionToSetup->setIcon( QIcon( ":/Erase.png" ) ); +} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicDeletePlotTemplateFeature.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicDeletePlotTemplateFeature.h new file mode 100644 index 0000000000..4a87f98d55 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicDeletePlotTemplateFeature.h @@ -0,0 +1,34 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicDeletePlotTemplateFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index e24f84367c..7b0276833f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1023,7 +1023,9 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() dynamic_cast( firstUiItem ) ) { menuBuilder << "RicRenamePlotTemplateFeature"; + menuBuilder << "RicDeletePlotTemplateFeature"; menuBuilder << "RicEditPlotTemplateFeature"; + menuBuilder << "Separator"; menuBuilder << "RicReloadPlotTemplatesFeature"; } else if ( dynamic_cast( firstUiItem ) ) From 6f26f8e462000a2280efb3e3e81882f38f932208 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 12 May 2022 22:51:15 +0200 Subject: [PATCH 295/406] Speed up summary case close/delete for ensembles (#8907) * Speed up summary case close/delete for ensembles --- .../Commands/RicCloseSummaryCaseFeature.cpp | 11 ++++++++-- .../Summary/RimSummaryCaseCollection.cpp | 7 ++++-- .../Summary/RimSummaryCaseCollection.h | 5 +++-- .../Summary/RimSummaryCaseMainCollection.cpp | 22 +++++++++++++++++-- .../Summary/RimSummaryCaseMainCollection.h | 3 ++- 5 files changed, 39 insertions(+), 9 deletions(-) diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp index f55126f8cb..69a8f0dd1f 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp @@ -58,6 +58,8 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vector plotsToUpdate; + for ( RimSummaryCase* summaryCase : cases ) { for ( RimSummaryMultiPlot* multiPlot : summaryPlotColl->multiPlots() ) @@ -66,10 +68,15 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vectordeleteCurvesAssosiatedWithCase( summaryCase ); } - multiPlot->updateConnectedEditors(); + plotsToUpdate.insert( multiPlot ); } + } - summaryCaseMainCollection->removeCase( summaryCase ); + summaryCaseMainCollection->removeCases( cases ); + + for ( auto plot : plotsToUpdate ) + { + plot->updateConnectedEditors(); } summaryCaseMainCollection->updateAllRequiredEditors(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index 008ab4f459..3a883c7816 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -151,7 +151,7 @@ RimSummaryCaseCollection::~RimSummaryCaseCollection() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase ) +void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase, bool notifyChange ) { size_t caseCountBeforeRemove = m_cases.size(); @@ -161,7 +161,10 @@ void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase ) caseRemoved.send( summaryCase ); - updateReferringCurveSets(); + if ( notifyChange ) + { + updateReferringCurveSets(); + } if ( m_isEnsemble && m_cases.size() != caseCountBeforeRemove ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h index 8346c0f44c..394fc7b6a0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h @@ -58,7 +58,7 @@ class RimSummaryCaseCollection : public caf::PdmObject RimSummaryCaseCollection(); ~RimSummaryCaseCollection() override; - void removeCase( RimSummaryCase* summaryCase ); + void removeCase( RimSummaryCase* summaryCase, bool notifyChange = true ); void addCase( RimSummaryCase* summaryCase ); virtual std::vector allSummaryCases() const; RimSummaryCase* firstSummaryCase() const; @@ -108,6 +108,8 @@ class RimSummaryCaseCollection : public caf::PdmObject void refreshMetaData(); + void updateReferringCurveSets(); + private: RigEnsembleParameter createEnsembleParameter( const QString& paramName ) const; static void sortByBinnedVariation( std::vector& parameterVector ); @@ -127,7 +129,6 @@ class RimSummaryCaseCollection : public caf::PdmObject protected: virtual void onLoadDataAndUpdate(); - void updateReferringCurveSets(); void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void setNameAsReadOnly(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index 3aef13f82b..48d71dfffc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -243,7 +243,7 @@ void RimSummaryCaseMainCollection::addCase( RimSummaryCase* summaryCase ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryCaseMainCollection::removeCase( RimSummaryCase* summaryCase ) +void RimSummaryCaseMainCollection::removeCase( RimSummaryCase* summaryCase, bool notifyChange ) { std::vector derivedEnsembles; @@ -264,7 +264,7 @@ void RimSummaryCaseMainCollection::removeCase( RimSummaryCase* summaryCase ) for ( RimSummaryCaseCollection* summaryCaseCollection : m_caseCollections ) { - summaryCaseCollection->removeCase( summaryCase ); + summaryCaseCollection->removeCase( summaryCase, notifyChange ); } // Update derived ensemble cases (if any) @@ -273,6 +273,24 @@ void RimSummaryCaseMainCollection::removeCase( RimSummaryCase* summaryCase ) derEnsemble->createDerivedEnsembleCases(); } + if ( notifyChange ) dataSourceHasChanged.send(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCaseMainCollection::removeCases( std::vector& cases ) +{ + for ( auto sumCase : cases ) + { + removeCase( sumCase, false ); + } + + for ( RimSummaryCaseCollection* summaryCaseCollection : m_caseCollections ) + { + summaryCaseCollection->updateReferringCurveSets(); + } + dataSourceHasChanged.send(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h index 9e7030c58b..74d76a2465 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.h @@ -62,7 +62,8 @@ class RimSummaryCaseMainCollection : public caf::PdmObject void addCases( const std::vector cases ); void addCase( RimSummaryCase* summaryCase ); - void removeCase( RimSummaryCase* summaryCase ); + void removeCase( RimSummaryCase* summaryCase, bool notifyChange = true ); + void removeCases( std::vector& cases ); RimSummaryCaseCollection* addCaseCollection( std::vector summaryCases, const QString& coolectionName, From 3b927e1c096e67390d8b7bf7265b8d8f4a8c1ab9 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Fri, 13 May 2022 16:36:30 +0200 Subject: [PATCH 296/406] Split summary plot into multiple plots (#8910) * Support splitting a summary plot with multiple curves into a new multiplot with one plot per curve * Make sure the correct plot is deleted if using the plot context menu. --- .../CMakeLists_files.cmake | 2 + .../RicSplitMultiPlotFeature.cpp | 117 ++++++++++++++++++ .../RicSplitMultiPlotFeature.h | 39 ++++++ .../RicDeleteSubPlotFeature.cpp | 33 ++++- .../WellLogCommands/RicDeleteSubPlotFeature.h | 7 ++ .../RimContextCommandBuilder.cpp | 1 + .../Summary/RimEnsembleCurveSet.cpp | 10 ++ .../Summary/RimEnsembleCurveSet.h | 2 + .../UserInterface/RiuSummaryPlot.cpp | 9 +- 9 files changed, 214 insertions(+), 6 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.h diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake index 5e6020849f..e4a4ec7794 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/CMakeLists_files.cmake @@ -11,6 +11,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForSummaryCasesFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForSummaryAddressesFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForSummaryAddressesFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicSplitMultiPlotFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -26,6 +27,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForSummaryCasesFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicAppendSummaryCurvesForSummaryAddressesFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicSplitMultiPlotFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.cpp new file mode 100644 index 0000000000..4929374d23 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.cpp @@ -0,0 +1,117 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicSplitMultiPlotFeature.h" + +#include "RicSummaryPlotBuilder.h" + +#include "RimEnsembleCurveSet.h" +#include "RimSummaryAddress.h" +#include "RimSummaryCase.h" +#include "RimSummaryCurve.h" +#include "RimSummaryPlot.h" + +#include "RicSummaryPlotBuilder.h" + +#include "cafSelectionManager.h" +#include "cvfAssert.h" + +#include + +CAF_CMD_SOURCE_INIT( RicSplitMultiPlotFeature, "RicSplitMultiPlotFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSplitMultiPlotFeature::isCommandEnabled() +{ + RimSummaryPlot* plot = getSelectedPlot(); + if ( plot ) + { + return ( ( plot->summaryCurves().size() > 1 ) || ( plot->curveSets().size() > 1 ) ); + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSplitMultiPlotFeature::onActionTriggered( bool isChecked ) +{ + RimSummaryPlot* plot = getSelectedPlot(); + if ( plot == nullptr ) return; + + std::vector objects = {}; + + for ( auto curve : plot->summaryCurves() ) + { + RimSummaryAddress* addr = RimSummaryAddress::wrapFileReaderAddress( curve->summaryAddressY() ); + addr->setCaseId( curve->summaryCaseY()->caseId() ); + objects.push_back( addr ); + } + + for ( auto curveSet : plot->curveSets() ) + { + RimSummaryAddress* addr = RimSummaryAddress::wrapFileReaderAddress( curveSet->summaryAddress() ); + addr->setEnsembleId( curveSet->ensembleId() ); + objects.push_back( addr ); + } + + RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( objects ); + + for ( auto object : objects ) + delete object; + + return; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSplitMultiPlotFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Split" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryPlot* RicSplitMultiPlotFeature::getSelectedPlot() +{ + RimSummaryPlot* plot = nullptr; + + if ( sender() ) + { + QVariant userData = this->userData(); + if ( !userData.isNull() && userData.canConvert() ) + { + plot = static_cast( userData.value() ); + } + } + + if ( plot == nullptr ) + { + std::vector selectedUiItems; + caf::SelectionManager::instance()->selectedItems( selectedUiItems ); + + if ( !selectedUiItems.empty() ) plot = dynamic_cast( selectedUiItems[0] ); + } + + return plot; +} diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.h new file mode 100644 index 0000000000..76a73aa853 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +class RimSummaryPlot; + +//================================================================================================== +/// +//================================================================================================== +class RicSplitMultiPlotFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + +private: + RimSummaryPlot* getSelectedPlot(); +}; diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp index e34960e0bc..571c5c92c5 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.cpp @@ -26,6 +26,7 @@ #include "RiuQwtPlotWidget.h" #include "RimMultiPlot.h" +#include "RimPlot.h" #include "RimPlotWindow.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" @@ -76,7 +77,8 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked ) if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return; std::vector selection; - caf::SelectionManager::instance()->objectsByType( &selection ); + getSelection( selection ); + std::set alteredPlotWindows; for ( RimPlot* plot : selection ) @@ -119,12 +121,12 @@ void RicDeleteSubPlotFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicDeleteSubPlotFeature::setupActionLook( QAction* actionToSetup ) { - QString actionText; - std::vector selection; - caf::SelectionManager::instance()->objectsByType( &selection ); + QString actionText; + std::vector selection; + getSelection( selection ); size_t tracksSelected = 0u; - for ( caf::PdmObject* object : selection ) + for ( RimPlot* object : selection ) { if ( dynamic_cast( object ) ) { @@ -148,3 +150,24 @@ void RicDeleteSubPlotFeature::setupActionLook( QAction* actionToSetup ) actionToSetup->setIcon( QIcon( ":/Erase.svg" ) ); applyShortcutWithHintToAction( actionToSetup, QKeySequence::Delete ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteSubPlotFeature::getSelection( std::vector& selection ) +{ + if ( sender() ) + { + QVariant userData = this->userData(); + if ( !userData.isNull() && userData.canConvert() ) + { + RimPlot* plot = static_cast( userData.value() ); + if ( plot ) selection.push_back( plot ); + } + } + + if ( selection.empty() ) + { + caf::SelectionManager::instance()->objectsByType( &selection ); + } +} diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.h b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.h index 6549a2c9c6..67f050d60d 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.h +++ b/ApplicationLibCode/Commands/WellLogCommands/RicDeleteSubPlotFeature.h @@ -21,6 +21,10 @@ #include "cafCmdFeature.h" +class RimPlot; + +#include + //================================================================================================== /// //================================================================================================== @@ -32,4 +36,7 @@ class RicDeleteSubPlotFeature : public caf::CmdFeature bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; + +private: + void getSelection( std::vector& selection ); }; diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 7b0276833f..2d0501bdc1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -677,6 +677,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "Separator"; menuBuilder << "RicEditSummaryPlotFeature"; menuBuilder << "RicDuplicateSummaryPlotFeature"; + menuBuilder << "RicSplitMultiPlotFeature"; menuBuilder << "RicNewSummaryEnsembleCurveSetFeature"; menuBuilder << "RicDuplicateSummaryCrossPlotFeature"; menuBuilder << "RicNewSummaryCrossPlotCurveFeature"; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 0836771299..5f19bc464c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -2001,6 +2001,16 @@ void RimEnsembleCurveSet::updateEnsembleLegendItem() m_plotCurveForLegendText->setVisibleInLegend( showLegendItem ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimEnsembleCurveSet::ensembleId() const +{ + if ( m_yValuesSummaryCaseCollection() != nullptr ) return m_yValuesSummaryCaseCollection()->ensembleId(); + + return -1; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index 4694a23533..a7ca82c4b5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -108,6 +108,8 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt RifEclipseSummaryAddress summaryAddress() const; std::vector curves() const; + int ensembleId() const; + RimCustomObjectiveFunctionCollection* customObjectiveFunctionCollection(); void deleteEnsembleCurves(); diff --git a/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp index ef76f832f3..d6db4b0782 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryPlot.cpp @@ -193,7 +193,14 @@ void RiuSummaryPlot::showContextMenu( QPoint pos ) } menuBuilder.addSeparator(); - menuBuilder << "RicDeleteSubPlotFeature"; + + RimSummaryPlot* plot = dynamic_cast( plotWidget()->plotDefinition() ); + if ( plot ) + { + QVariant plotVariant( QVariant::fromValue( static_cast( plot ) ) ); + menuBuilder.addCmdFeatureWithUserData( "RicSplitMultiPlotFeature", "Split into Multiple Plots", plotVariant ); + menuBuilder.addCmdFeatureWithUserData( "RicDeleteSubPlotFeature", "Delete Plot", plotVariant ); + } menuBuilder.appendToMenu( &menu ); From 558d675d448d46351589c445cbc4a6779eb902d5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 19 May 2022 11:47:41 +0200 Subject: [PATCH 297/406] Merge pull request #8920 remove mac build --- .github/workflows/ResInsightWithCache.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/ResInsightWithCache.yml b/.github/workflows/ResInsightWithCache.yml index 63e4c4586c..6c7baa128e 100644 --- a/.github/workflows/ResInsightWithCache.yml +++ b/.github/workflows/ResInsightWithCache.yml @@ -50,16 +50,6 @@ jobs: build-python-module: true, execute-unit-tests: true, } - - { - name: "Mac OS", - os: macos-latest, - cc: "clang", - cxx: "clang++", - vcpkg-response-file: vcpkg_x64-osx.txt, - vcpkg-triplet: x64-osx, - build-python-module: false, - execute-unit-tests: false, - } steps: - name: Checkout uses: actions/checkout@v2 From 119367783ba5ed0e5b59fbe841ed8bb28d6f8488 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 19 May 2022 11:51:22 +0200 Subject: [PATCH 298/406] Fix memory leak for data source ensemble summary (#8919) * Do not create summary case group twice * Fix memory leak of objects contained in childArrayFields Use deleteAllChildObjects to delete objects instead of clear() Rename collection function clear() -> deleteAllChildObjects * Early exit for empty path * Reduce redundant calls to refreshMetaData --- ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp | 1 - .../ProjectDataModel/Summary/RimFileSummaryCase.cpp | 1 + .../Summary/RimSummaryAddressCollection.cpp | 6 +++--- .../ProjectDataModel/Summary/RimSummaryAddressCollection.h | 2 +- .../ProjectDataModel/Summary/RimSummaryCase.cpp | 4 +--- .../ProjectDataModel/Summary/RimSummaryCaseCollection.cpp | 2 +- .../Summary/RimSummaryCaseMainCollection.cpp | 2 -- 7 files changed, 7 insertions(+), 11 deletions(-) diff --git a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp index 820bfc4d4b..a1fb19c641 100644 --- a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp @@ -112,7 +112,6 @@ void RicImportEnsembleFeature::importSingleEnsemble( const QStringList& if ( cases.empty() ) return; - RicImportSummaryCasesFeature::addSummaryCases( cases ); RimSummaryCaseCollection* ensemble = RicCreateSummaryCaseCollectionFeature::groupSummaryCases( cases, ensembleName, true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp index 97299d57fe..db06b19659 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp @@ -225,6 +225,7 @@ void RimFileSummaryCase::defineEditorAttribute( const caf::PdmFieldHandle* field void RimFileSummaryCase::openAndAttachAdditionalReader() { QString additionalSummaryFilePath = m_additionalSummaryFilePath().path(); + if ( additionalSummaryFilePath.isEmpty() ) return; cvf::ref opmCommonReader = new RifOpmCommonEclipseSummary; opmCommonReader->useEnhancedSummaryFiles( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index 560a4a3f6a..e4c22ff70e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -333,10 +333,10 @@ RimSummaryAddressCollection* RimSummaryAddressCollection::getOrCreateSubfolder( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryAddressCollection::clear() +void RimSummaryAddressCollection::deleteAllChildObjects() { - m_adresses.clear(); - m_subfolders.clear(); + m_adresses.deleteAllChildObjects(); + m_subfolders.deleteAllChildObjects(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h index 29f0b14111..62f4f107bd 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -64,7 +64,7 @@ class RimSummaryAddressCollection : public RimNamedObject void updateFolderStructure( const std::set& addresses, int caseId, int ensembleId = -1 ); - void clear(); + void deleteAllChildObjects(); bool isEmpty() const; bool isEnsemble() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp index 7436f8a121..23456b0108 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp @@ -222,7 +222,7 @@ QString RimSummaryCase::errorMessagesFromReader() //-------------------------------------------------------------------------------------------------- void RimSummaryCase::buildChildNodes() { - m_dataVectorFolders->clear(); + m_dataVectorFolders->deleteAllChildObjects(); RifSummaryReaderInterface* reader = summaryReader(); if ( !reader ) return; @@ -322,8 +322,6 @@ void RimSummaryCase::initAfterRead() } updateOptionSensitivity(); - - refreshMetaData(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index 3a883c7816..f72529846c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -1098,5 +1098,5 @@ void RimSummaryCaseCollection::refreshMetaData() //-------------------------------------------------------------------------------------------------- void RimSummaryCaseCollection::clearChildNodes() { - m_dataVectorFolders->clear(); + m_dataVectorFolders->deleteAllChildObjects(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index 48d71dfffc..76b561e14e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -656,7 +656,6 @@ std::vector RimSummaryCaseMainCollection::createSummaryCasesFro newSumCase->setAssociatedEclipseCase( eclCase ); newSumCase->updateOptionSensitivity(); project->assignCaseIdToSummaryCase( newSumCase ); - newSumCase->refreshMetaData(); sumCases.push_back( newSumCase ); } else @@ -671,7 +670,6 @@ std::vector RimSummaryCaseMainCollection::createSummaryCasesFro newSumCase->setSummaryHeaderFileName( smspecFileName ); newSumCase->updateOptionSensitivity(); project->assignCaseIdToSummaryCase( newSumCase ); - newSumCase->refreshMetaData(); sumCases.push_back( newSumCase ); } From 89d42fec88e4431be0263c564f249d27ebeb0e8e Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 19 May 2022 11:51:52 +0200 Subject: [PATCH 299/406] Regression Test: Fix null pointer access (#8922) * #8921 : Guard null pointer access * #8921 Fix memory leak Fix similar memory leak as reported in #8918 --- .../ProjectDataModel/RimEclipseCase.cpp | 12 ++++++++---- .../RimEclipseResultAddressCollection.cpp | 8 -------- .../RimEclipseResultAddressCollection.h | 2 -- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index 0ac10d0370..cedc51137f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -601,7 +601,7 @@ void RimEclipseCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin //-------------------------------------------------------------------------------------------------- void RimEclipseCase::buildChildNodes() { - m_resultAddressCollections.clear(); + m_resultAddressCollections.deleteAllChildObjects(); std::vector resultTypes = { RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::ResultCatType::DYNAMIC_NATIVE, @@ -614,10 +614,14 @@ void RimEclipseCase::buildChildNodes() QString name = caf::AppEnum::uiText( resultType ); resultAddressCollection->setName( name ); - QStringList resultNames = results( RiaDefines::PorosityModelType::MATRIX_MODEL )->resultNames( resultType ); - for ( auto resultName : resultNames ) + auto cellResultData = results( RiaDefines::PorosityModelType::MATRIX_MODEL ); + if ( cellResultData ) { - resultAddressCollection->addAddress( resultName, resultType, this ); + QStringList resultNames = cellResultData->resultNames( resultType ); + for ( auto resultName : resultNames ) + { + resultAddressCollection->addAddress( resultName, resultType, this ); + } } m_resultAddressCollections.push_back( resultAddressCollection ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.cpp index 744ff4e274..eb9015c25b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.cpp @@ -70,14 +70,6 @@ void RimEclipseResultAddressCollection::addAddress( const QString& re m_adresses.push_back( addr ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimEclipseResultAddressCollection::clear() -{ - m_adresses.clear(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.h b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.h index 1744c6d953..feaacd5b49 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddressCollection.h @@ -42,8 +42,6 @@ class RimEclipseResultAddressCollection : public RimNamedObject bool isEmpty() const; - void clear(); - private: caf::PdmChildArrayField m_adresses; caf::PdmField> m_resultType; From fa8ad539814b0a6b8ee48ec721de7c981ffb32f6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 19 May 2022 11:45:16 +0200 Subject: [PATCH 300/406] Regression Test : Add memory usage to regression test logging --- .../Tools/RiaRegressionTestRunner.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp index 8c6c2a214b..f5285f52f4 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp @@ -43,6 +43,7 @@ #include "ExportCommands/RicSnapshotAllPlotsToFileFeature.h" #include "ExportCommands/RicSnapshotAllViewsToFileFeature.h" +#include "cafMemoryInspector.h" #include "cafUtils.h" #include @@ -82,6 +83,7 @@ void logInfoTextWithTimeInSeconds( const QElapsedTimer& time, const QString& msg QString timeText = QString( "(%1 s) " ).arg( timeRunning, 0, 'f', 1 ); RiaLogging::info( timeText + msg ); + QApplication::processEvents(); } //-------------------------------------------------------------------------------------------------- @@ -128,6 +130,8 @@ void RiaRegressionTestRunner::runRegressionTest() QString currentApplicationPath = QDir::currentPath(); + std::vector> memoryUsagePerTest; + RiaRegressionTest regressionTestConfig; regressionTestConfig.readSettingsFromApplicationStore(); if ( !regressionTestConfig.folderContainingCompareTool().isEmpty() ) @@ -215,6 +219,9 @@ void RiaRegressionTestRunner::runRegressionTest() if ( !projectFileName.isEmpty() ) { + QElapsedTimer timerForOneTest; + timerForOneTest.start(); + cvf::ref projectModifier; if ( regressionTestConfig.invalidateExternalFilePaths ) { @@ -240,7 +247,18 @@ void RiaRegressionTestRunner::runRegressionTest() RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( fullPathGeneratedFolder ); + uint64_t usedMemoryBeforeClose = caf::MemoryInspector::getApplicationPhysicalMemoryUsageMiB(); + app->closeProject(); + + QApplication::processEvents(); + + auto testDuration = timerForOneTest.elapsed() / 1000.0; + + uint64_t usedMemoryAfterClose = caf::MemoryInspector::getApplicationPhysicalMemoryUsageMiB(); + + auto folderName = folderFileInfo.baseName(); + memoryUsagePerTest.push_back( { folderName, testDuration, usedMemoryBeforeClose, usedMemoryAfterClose } ); } else { @@ -275,6 +293,15 @@ void RiaRegressionTestRunner::runRegressionTest() logInfoTextWithTimeInSeconds( timeStamp, "Completed test :" + testCaseFolder.absolutePath() ); } + // Profiling logging + RiaLogging::info( "| Duration [sec] | Before Close [MB] | After Close [MB] | Name " ); + for ( const auto& [name, testDuration, beforeMemory, afterMemory] : memoryUsagePerTest ) + { + auto timeText = QString( "(%1 s) " ).arg( testDuration, 5, 'f', 1 ); + auto logInfo = QString( "%1 %2 %3 %4" ).arg( timeText ).arg( beforeMemory ).arg( afterMemory ).arg( name ); + RiaLogging::info( logInfo ); + } + // Invoke git diff { From f3cfa0ab94b6af6ddc6f225de6597122026cf5ae Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 19 May 2022 12:50:47 +0200 Subject: [PATCH 301/406] Bump version number --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index eb5f48ac56..bb9fad6d8c 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".03") +set(RESINSIGHT_DEV_VERSION ".04") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 402f738abdc4a2c008791a55f1702c250b2533d3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 19 May 2022 13:58:01 +0200 Subject: [PATCH 302/406] Regression Test: Make sure all text is redirected to standard out Call RiaApplication::initialize() to recreate project and preferences. Do not call virtual method initialize(), as RiaGuiApplication::initialize() creates a new logger causing console text to disappear. --- ApplicationLibCode/Application/RiaApplication.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index c4d53973ec..0c34e9c0b9 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -1534,7 +1534,9 @@ void RiaApplication::resetProject() m_project.reset(); m_preferences.reset(); - initialize(); + // Call RiaApplication::initialize() to recreate project and preferences. Do not call virtual method initialize(), + // as RiaGuiApplication::initialize() creates a new logger causing console text to disappear. + RiaApplication::initialize(); } //-------------------------------------------------------------------------------------------------- From 837a0f208ce72ade4250768742ec1d54fa1facbc Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 13 May 2022 11:26:05 +0200 Subject: [PATCH 303/406] #8846 StimPlan model plot: Correct perforation interval for longitudinal fracture Fixes #8846. --- .../StimPlanModel/RimStimPlanModel.cpp | 14 +++++++- .../RigStimPlanModelTools.cpp | 32 +++++++++++++++++++ .../RigStimPlanModelTools.h | 2 ++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp index aadbdfa90f..80200c99c1 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp @@ -795,8 +795,20 @@ void RimStimPlanModel::updatePerforationInterval() m_thicknessDirectionWellPath->perforationIntervalCollection()->appendPerforation( m_perforationInterval ); } + double halfPerforationLength = m_perforationLength() * 0.5; + if ( m_fractureOrientation == FractureOrientation::ALONG_WELL_PATH ) + { + // Adjust perforation interval for longitudinal fractures to correct TVD depth + CAF_ASSERT( wellPath() ); + CAF_ASSERT( wellPath()->wellPathGeometry() ); + + cvf::Vec3d wellPathTangent = wellPath()->wellPathGeometry()->tangentAlongWellPath( m_MD() ); + halfPerforationLength = + RigStimPlanModelTools::calculatePerforationLength( wellPathTangent, m_perforationLength() ) * 0.5; + } + double closestMd = m_thicknessDirectionWellPath->wellPathGeometry()->closestMeasuredDepth( m_anchorPosition ); - m_perforationInterval->setStartAndEndMD( closestMd - perforationLength(), closestMd + perforationLength() ); + m_perforationInterval->setStartAndEndMD( closestMd - halfPerforationLength, closestMd + halfPerforationLength ); m_perforationInterval->updateConnectedEditors(); updateViewsAndPlots(); } diff --git a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp index 9e20662f97..3e4f3fc077 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp @@ -261,3 +261,35 @@ QString RigStimPlanModelTools::vecToString( const cvf::Vec3d& vec ) { return QString( "[%1, %2, %3]" ).arg( vec.x() ).arg( vec.y() ).arg( vec.z() ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RigStimPlanModelTools::calculatePerforationLength( const cvf::Vec3d& direction, double perforationLength ) +{ + // Deviation from vertical. Since well path is tending downwards we compare with negative z. + double inclination = cvf::GeometryTools::getAngle( direction, -cvf::Vec3d::Z_AXIS ); + + // Keep inclination in 0-90 degrees range + if ( inclination > cvf::PI_D / 2.0 ) + { + inclination = cvf::PI_D - inclination; + } + + double correctedPerforationLength = perforationLength * std::cos( inclination ); + + RiaLogging::info( + QString( "Perforation length correction: original length: %1 inclination: %2 corrected length: %3" ) + .arg( perforationLength ) + .arg( cvf::Math::toDegrees( inclination ) ) + .arg( correctedPerforationLength ) ); + + // Handle well inclination close to 90 dgr to ensure visual perforation interval in StimPlan model plot + if ( std::fabs( cvf::Math::toDegrees( inclination ) - 90.0 ) < 0.1 ) + { + double minimumPerforationInterval = 0.5; + return std::max( minimumPerforationInterval, correctedPerforationLength ); + } + + return correctedPerforationLength; +} diff --git a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.h b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.h index 7181631f73..e6b31a349b 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.h +++ b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.h @@ -67,4 +67,6 @@ class RigStimPlanModelTools generateBarrierIntersectionsBetweenPoints( RigEclipseCaseData* eclipseCaseData, const cvf::Vec3d& startPosition, const cvf::Vec3d& endPosition ); + + static double calculatePerforationLength( const cvf::Vec3d& wellPathDirection, double perforationLength ); }; From 9678b80feb0dc9569b741b27c5c2e1192058c55b Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 18 May 2022 14:35:24 +0200 Subject: [PATCH 304/406] #7778 MainWindow: fix crash when reopening grid case --- .../Application/RiaGuiApplication.cpp | 11 ++++---- .../Application/RiaGuiApplication.h | 2 +- .../RicShowMainWindowFeature.cpp | 26 +++++++++++++------ .../UserInterface/RiuMainWindow.cpp | 7 +++++ .../UserInterface/RiuMdiSubWindow.cpp | 1 - 5 files changed, 32 insertions(+), 15 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 3e373fa651..b7a01cc1ff 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -189,6 +189,7 @@ RiaGuiApplication::RiaGuiApplication( int& argc, char** argv ) //-------------------------------------------------------------------------------------------------- RiaGuiApplication::~RiaGuiApplication() { + m_mainWindow.clear(); } //-------------------------------------------------------------------------------------------------- @@ -923,7 +924,7 @@ RiuMainWindow* RiaGuiApplication::getOrCreateAndShowMainWindow() m_mainWindow->loadWinGeoAndDockToolBarLayout(); } - return m_mainWindow.get(); + return m_mainWindow; } //-------------------------------------------------------------------------------------------------- @@ -931,7 +932,7 @@ RiuMainWindow* RiaGuiApplication::getOrCreateAndShowMainWindow() //-------------------------------------------------------------------------------------------------- RiuMainWindow* RiaGuiApplication::mainWindow() { - return m_mainWindow.get(); + return m_mainWindow; } //-------------------------------------------------------------------------------------------------- @@ -960,7 +961,7 @@ void RiaGuiApplication::createMainWindow() caf::CmdExecCommandManager::instance()->enableUndoCommandSystem( true ); } - m_mainWindow = std::make_unique(); + m_mainWindow = new RiuMainWindow; QString platform = cvf::System::is64Bit() ? "(64bit)" : "(32bit)"; m_mainWindow->setWindowTitle( "ResInsight " + platform ); m_mainWindow->setDefaultWindowSize(); @@ -1042,7 +1043,7 @@ RiuPlotMainWindow* RiaGuiApplication::mainPlotWindow() RiuMainWindowBase* RiaGuiApplication::mainWindowByID( int mainWindowID ) { if ( mainWindowID == 0 ) - return m_mainWindow.get(); + return m_mainWindow; else if ( mainWindowID == 1 ) return m_mainPlotWindow.get(); else @@ -1451,7 +1452,7 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* } QMessageBox::StandardButton reply; - reply = QMessageBox::question( m_mainWindow.get(), + reply = QMessageBox::question( m_mainWindow, QString( "Apply %1 to Existing Views or Plots?" ).arg( listString ), QString( "You have changed default %1 and have existing views or plots with " "different settings.\n" ) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.h b/ApplicationLibCode/Application/RiaGuiApplication.h index f01573a85a..8e2fbcb10f 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.h +++ b/ApplicationLibCode/Application/RiaGuiApplication.h @@ -166,7 +166,7 @@ private slots: void onLastWindowClosed(); private: - std::unique_ptr m_mainWindow; + QPointer m_mainWindow; std::unique_ptr m_mainPlotWindow; std::unique_ptr m_recentFileActionProvider; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicShowMainWindowFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicShowMainWindowFeature.cpp index e152f37ebd..5defd8c9ac 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicShowMainWindowFeature.cpp +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicShowMainWindowFeature.cpp @@ -18,6 +18,8 @@ #include "RicShowMainWindowFeature.h" +#include "RiaGuiApplication.h" + #include "RiuMainWindow.h" #include @@ -31,19 +33,27 @@ void RicShowMainWindowFeature::showMainWindow() { RiuMainWindow* mainWnd = RiuMainWindow::instance(); - if ( mainWnd->isMinimized() ) + if ( mainWnd ) { - mainWnd->showNormal(); - mainWnd->update(); + if ( mainWnd->isMinimized() ) + { + mainWnd->showNormal(); + mainWnd->update(); + } + else + { + mainWnd->show(); + } + + mainWnd->raise(); + + mainWnd->restoreDockWidgetVisibilities(); } else { - mainWnd->show(); + RiaGuiApplication* app = RiaGuiApplication::instance(); + app->getOrCreateAndShowMainWindow(); } - - mainWnd->raise(); - - mainWnd->restoreDockWidgetVisibilities(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 23d1410098..fe74e363a8 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -121,6 +121,8 @@ RiuMainWindow::RiuMainWindow() , m_windowMenu( nullptr ) , m_holoLensToolBar( nullptr ) { + setAttribute( Qt::WA_DeleteOnClose ); + m_mdiArea = new RiuMdiArea( this ); connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) ); setCentralWidget( m_mdiArea ); @@ -171,6 +173,11 @@ RiuMainWindow::RiuMainWindow() RiuMainWindow::~RiuMainWindow() { setPdmRoot( nullptr ); + + if ( m_pdmUiPropertyView ) + { + m_pdmUiPropertyView->showProperties( nullptr ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMdiSubWindow.cpp b/ApplicationLibCode/UserInterface/RiuMdiSubWindow.cpp index 058a480b4b..b7c7d9a616 100644 --- a/ApplicationLibCode/UserInterface/RiuMdiSubWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMdiSubWindow.cpp @@ -48,7 +48,6 @@ RiuMdiSubWindow::RiuMdiSubWindow( QWidget* parent /*= 0*/, Qt::WindowFlags flags //-------------------------------------------------------------------------------------------------- RiuMdiSubWindow::~RiuMdiSubWindow() { - RiuMainWindow::instance()->slotRefreshViewActions(); } //-------------------------------------------------------------------------------------------------- From e80343b4db46896ba9b578d8ced3cc9f289c9a7b Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 13 May 2022 19:05:10 +0200 Subject: [PATCH 305/406] #8877 StimPlan model: Fix formation dip in export of Asymmetric.FRK Fixes #8877. --- .../StimPlanModel/RimStimPlanModel.cpp | 152 +++++++++++------- .../StimPlanModel/RimStimPlanModel.h | 6 + .../RigStimPlanModelTools.cpp | 7 +- 3 files changed, 105 insertions(+), 60 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp index 80200c99c1..b2307a0ea3 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp @@ -190,6 +190,12 @@ RimStimPlanModel::RimStimPlanModel() m_thicknessDirection.uiCapability()->setUiReadOnly( true ); m_thicknessDirection.xmlCapability()->disableIO(); + CAF_PDM_InitScriptableFieldNoDefault( &m_originalThicknessDirection, + "OriginalThicknessDirection", + "Original Thickness Direction" ); + m_originalThicknessDirection.uiCapability()->setUiReadOnly( true ); + m_originalThicknessDirection.xmlCapability()->disableIO(); + CAF_PDM_InitScriptableFieldNoDefault( &m_thicknessDirectionWellPath, "ThicknessDirectionWellPath", "Thickness Direction Well Path" ); @@ -537,18 +543,26 @@ void RimStimPlanModel::updatePositionFromMeasuredDepth() //-------------------------------------------------------------------------------------------------- void RimStimPlanModel::updateThicknessDirection() { - // True vertical thickness: just point straight up - cvf::Vec3d direction( 0.0, 0.0, -1.0 ); + cvf::Vec3d defaultDirection( 0.0, 0.0, -1.0 ); if ( m_extractionType() == ExtractionType::TRUE_STRATIGRAPHIC_THICKNESS ) { - direction = RigStimPlanModelTools::calculateTSTDirection( getEclipseCaseData(), - m_anchorPosition(), - m_boundingBoxHorizontal, - m_boundingBoxVertical ); - } + cvf::Vec3d direction = RigStimPlanModelTools::calculateTSTDirection( getEclipseCaseData(), + m_anchorPosition(), + m_boundingBoxHorizontal, + m_boundingBoxVertical ); - m_thicknessDirection = direction; + // Calculate an adjusted TST direction to improve the zone thickness in the well log plot. + // Using average of TST and TVD (default direction) in 3D. + m_thicknessDirection = ( direction + defaultDirection ) / 2.0; + m_originalThicknessDirection = direction; + } + else + { + // True vertical thickness: just point straight up + m_thicknessDirection = defaultDirection; + m_originalThicknessDirection = defaultDirection; + } if ( m_thicknessDirectionWellPath ) { @@ -642,7 +656,62 @@ void RimStimPlanModel::updateDistanceToBarrierAndDip() RiaLogging::info( "Computing distance to barrier." ); RiaLogging::info( QString( "Anchor position: %1" ).arg( RigStimPlanModelTools::vecToString( position ) ) ); - RigWellPath* wellPathGeometry = wellPath()->wellPathGeometry(); + cvf::Vec3d fractureDirectionNormal = computeFractureDirectionNormal( wellPath(), position ); + + // Update formation dip. The direction for the barrier search follows the + // inclination of the formation, and is in effect the formation dip in the + // fracture plane. -90 to convert from horizontal to vertical. + cvf::Vec3d formationDirection = + projectVectorIntoFracturePlane( position, fractureDirectionNormal, m_originalThicknessDirection ); + if ( formationDirection.isUndefined() ) return; + m_formationDip = std::abs( RigStimPlanModelTools::calculateFormationDip( formationDirection ) - 90.0 ); + + cvf::Vec3d directionToBarrier = + projectVectorIntoFracturePlane( position, fractureDirectionNormal, m_thicknessDirection ); + if ( directionToBarrier.isUndefined() ) return; + + RiaLogging::info( + QString( "Direction to barrier: %1" ).arg( RigStimPlanModelTools::vecToString( directionToBarrier ) ) ); + + auto [foundFault, shortestDistance, barrierPosition, barrierDip] = + RigStimPlanModelTools::findClosestFaultBarrier( eclipseCaseData, position, directionToBarrier ); + + if ( foundFault ) + { + RiaLogging::info( QString( "Found barrier distance: %1. Dip: %2. Fault: %3" ) + .arg( shortestDistance ) + .arg( barrierDip ) + .arg( foundFault->name() ) ); + QString barrierText = + QString( "Barrier Fault for %1\nFault: %2\nDistance: %3m" ).arg( name() ).arg( foundFault->name() ).arg( shortestDistance ); + + clearBarrierAnnotation(); + addBarrierAnnotation( position, barrierPosition, barrierText ); + + m_hasBarrier = true; + m_barrierDip = barrierDip; + m_distanceToBarrier = shortestDistance; + m_barrierFaultName = foundFault->name(); + } + else + { + RiaLogging::info( "No barrier found." ); + clearBarrierAnnotation(); + m_hasBarrier = false; + m_barrierDip = 0.0; + m_distanceToBarrier = 0.0; + m_barrierFaultName = ""; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec3d RimStimPlanModel::computeFractureDirectionNormal( RimWellPath* wellPath, const cvf::Vec3d& position ) const +{ + CAF_ASSERT( wellPath ); + RigWellPath* wellPathGeometry = wellPath->wellPathGeometry(); + CAF_ASSERT( wellPathGeometry ); // Find the well path points closest to the anchor position cvf::Vec3d p1; @@ -671,66 +740,35 @@ void RimStimPlanModel::updateDistanceToBarrierAndDip() fractureDirectionNormal.transformVector( azimuthRotation ); } + return fractureDirectionNormal; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec3d RimStimPlanModel::projectVectorIntoFracturePlane( const cvf::Vec3d& position, + const cvf::Vec3d& fractureDirectionNormal, + const cvf::Vec3d& direction ) const +{ // Create a fracture plane cvf::Plane fracturePlane; if ( !fracturePlane.setFromPointAndNormal( position, fractureDirectionNormal ) ) { RiaLogging::error( "Unable to create fracture plane" ); - return; + return cvf::Vec3d::UNDEFINED; } - // The direction to the barrier must be in the fracture plane. - // Project the TST onto the fracture plane. + // Project the direction onto the fracture plane. cvf::Vec3d tstInPlane; - if ( !fracturePlane.projectVector( thicknessDirection(), &tstInPlane ) ) + if ( !fracturePlane.projectVector( direction, &tstInPlane ) ) { RiaLogging::error( "Unable to project thickess vector into fracture plane" ); - return; + return cvf::Vec3d::UNDEFINED; } - RiaLogging::info( - QString( "Thickness direction: %1" ).arg( RigStimPlanModelTools::vecToString( thicknessDirection() ) ) ); - RiaLogging::info( - QString( "Thickness direction in fracture plane: %1" ).arg( RigStimPlanModelTools::vecToString( tstInPlane ) ) ); // The direction to the barrier is normal to the TST project into the fracture plane - cvf::Vec3d directionToBarrier = ( tstInPlane ^ fractureDirectionNormal ).getNormalized(); - RiaLogging::info( - QString( "Direction to barrier: %1" ).arg( RigStimPlanModelTools::vecToString( directionToBarrier ) ) ); - - // Update formation dip. The direction for the barrier search follows the - // inclination of the formation, and is in effect the formation dip in the - // fracture plane. -90 to convert from horizontal to vertical. - m_formationDip = std::abs( RigStimPlanModelTools::calculateFormationDip( directionToBarrier ) - 90.0 ); - - auto [foundFault, shortestDistance, barrierPosition, barrierDip] = - RigStimPlanModelTools::findClosestFaultBarrier( eclipseCaseData, position, directionToBarrier ); - - if ( foundFault ) - { - RiaLogging::info( QString( "Found barrier distance: %1. Dip: %2. Fault: %3" ) - .arg( shortestDistance ) - .arg( barrierDip ) - .arg( foundFault->name() ) ); - QString barrierText = - QString( "Barrier Fault for %1\nFault: %2\nDistance: %3m" ).arg( name() ).arg( foundFault->name() ).arg( shortestDistance ); - - clearBarrierAnnotation(); - addBarrierAnnotation( position, barrierPosition, barrierText ); - - m_hasBarrier = true; - m_barrierDip = barrierDip; - m_distanceToBarrier = shortestDistance; - m_barrierFaultName = foundFault->name(); - } - else - { - RiaLogging::info( "No barrier found." ); - clearBarrierAnnotation(); - m_hasBarrier = false; - m_barrierDip = 0.0; - m_distanceToBarrier = 0.0; - m_barrierFaultName = ""; - } + cvf::Vec3d directionInPlane = ( tstInPlane ^ fractureDirectionNormal ).getNormalized(); + return directionInPlane; } //-------------------------------------------------------------------------------------------------- @@ -873,6 +911,8 @@ void RimStimPlanModel::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin asymmetricGroup->add( &m_showAllFaults, { false, 1, 0 } ); asymmetricGroup->add( &m_wellPenetrationLayer ); + + uiOrdering.skipRemainingFields(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h index b894418b40..5b5dd1c890 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h @@ -208,6 +208,11 @@ class RimStimPlanModel : public RimCheckableNamedObject, public RimWellPathCompo void updateThicknessDirectionWellPathName(); void updatePerforationInterval(); + cvf::Vec3d computeFractureDirectionNormal( RimWellPath* wellPath, const cvf::Vec3d& position ) const; + cvf::Vec3d projectVectorIntoFracturePlane( const cvf::Vec3d& position, + const cvf::Vec3d& fractureDirectionNormal, + const cvf::Vec3d& direction ) const; + RigEclipseCaseData* getEclipseCaseData() const; void updateBarrierProperties(); @@ -242,6 +247,7 @@ class RimStimPlanModel : public RimCheckableNamedObject, public RimWellPathCompo caf::PdmField m_anchorPosition; caf::PdmProxyValueField m_anchorPositionForUi; caf::PdmField m_thicknessDirection; + caf::PdmField m_originalThicknessDirection; caf::PdmField m_boundingBoxVertical; caf::PdmField m_boundingBoxHorizontal; caf::PdmPtrField m_thicknessDirectionWellPath; diff --git a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp index 3e4f3fc077..b344d91885 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigStimPlanModelTools.cpp @@ -88,10 +88,6 @@ cvf::Vec3d RigStimPlanModelTools::calculateTSTDirection( RigEclipseCaseData* ecl direction *= -1.0; } - // Calculate an adjusted TST direction to improve the zone thickness in the well log plot. - // Using average of TST and TVD (default direction) in 3D. - direction = ( direction + defaultDirection ) / 2.0; - return direction; } @@ -104,6 +100,9 @@ double RigStimPlanModelTools::calculateFormationDip( const cvf::Vec3d& direction return cvf::Math::toDegrees( cvf::GeometryTools::getAngle( direction, -cvf::Vec3d::Z_AXIS ) ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- std::tuple RigStimPlanModelTools::findClosestFaultBarrier( RigEclipseCaseData* eclipseCaseData, const cvf::Vec3d& position, From c3dfd9ed26872322d135ed257774ebf341ce16f0 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 13 May 2022 19:21:49 +0200 Subject: [PATCH 306/406] Summary tools: fix crash in when destructing RimStimPlanModel --- ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp index 9e9875c7b7..b9ef6a9632 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryStringTools.cpp @@ -147,6 +147,7 @@ std::pair, std::vector> RiaSummaryStringTools::allDataSourcesInProject() { auto sumCaseMainColl = RiaSummaryTools::summaryCaseMainCollection(); + if ( !sumCaseMainColl ) return { {}, {} }; auto summaryCases = sumCaseMainColl->topLevelSummaryCases(); auto ensembles = sumCaseMainColl->summaryCaseCollections(); From 954b697e6b35c8e729584a05f312546203fb1023 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 20 May 2022 13:04:06 +0200 Subject: [PATCH 307/406] #8817 Summary Multiplot: Add filter to control plot visibility --- .../Summary/RimSummaryMultiPlot.cpp | 59 +++++++++++++++++++ .../Summary/RimSummaryMultiPlot.h | 9 +++ 2 files changed, 68 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 2ab32c21bb..01919f0185 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -146,6 +146,12 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Aggregation" ); + CAF_PDM_InitField( &m_hidePlotsWithValuesBelow, "HidePlotsWithValuesBelow", false, "Hide Plots With Values Below" ); + m_hidePlotsWithValuesBelow.xmlCapability()->disableIO(); + m_hidePlotsWithValuesBelow.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + + CAF_PDM_InitField( &m_plotFilterYAxisThreshold, "PlotFilterYAxisThreshold", 0.0, "Y-Axis Threshold" ); + CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); m_sourceStepping = new RimSummaryPlotSourceStepping; @@ -358,7 +364,12 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde m_linkSubPlotAxes.uiCapability()->setUiReadOnly( m_autoAdjustAppearance() ); if ( m_autoAdjustAppearance() ) m_linkSubPlotAxes = false; + auto plotVisibilityFilterGroup = uiOrdering.addNewGroup( "Plot Visibility Filter" ); + plotVisibilityFilterGroup->add( &m_hidePlotsWithValuesBelow ); + plotVisibilityFilterGroup->add( &m_plotFilterYAxisThreshold ); + auto dataSourceGroup = uiOrdering.addNewGroup( "Data Source" ); + dataSourceGroup->setCollapsedByDefault( true ); m_sourceStepping()->uiOrdering( uiConfigName, *dataSourceGroup ); auto titlesGroup = uiOrdering.addNewGroup( "Main Plot Settings" ); @@ -399,6 +410,11 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi { syncAxisRanges(); } + else if ( changedField == &m_hidePlotsWithValuesBelow ) + { + m_hidePlotsWithValuesBelow = false; + updatePlotVisibility(); + } else if ( changedField == &m_createPlotDuplicate ) { m_createPlotDuplicate = false; @@ -438,6 +454,23 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) +{ + if ( &m_hidePlotsWithValuesBelow == field ) + { + auto attrib = dynamic_cast( attribute ); + if ( attrib ) + { + attrib->m_buttonText = "Apply Filter"; + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -944,6 +977,32 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::updatePlotVisibility() +{ + auto hasValuesAboveLimit = []( RimSummaryPlot* plot, double limit ) { + for ( auto curve : plot->summaryAndEnsembleCurves() ) + { + auto address = curve->valuesY(); + auto maxValue = std::max_element( address.begin(), address.end() ); + + if ( *maxValue > limit ) return true; + } + + return false; + }; + + for ( auto plot : summaryPlots() ) + { + bool hasValueAboveLimit = hasValuesAboveLimit( plot, m_plotFilterYAxisThreshold ); + plot->setShowWindow( hasValueAboveLimit ); + } + + if ( !m_viewer.isNull() ) m_viewer->scheduleUpdate(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 8a3c734a1d..859d3c9eb0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -117,12 +117,18 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void populateNameHelper( RimSummaryPlotNameHelper* nameHelper ); void computeAggregatedAxisRange(); void updateSourceStepper(); + void updatePlotVisibility(); + void duplicate(); void appendSubPlotByStepping( int direction ); @@ -141,6 +147,9 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep caf::PdmField m_linkSubPlotAxes; caf::PdmField m_autoAdjustAppearance; + caf::PdmField m_hidePlotsWithValuesBelow; + caf::PdmField m_plotFilterYAxisThreshold; + caf::PdmField m_appendNextPlot; caf::PdmField m_appendPrevPlot; From 7c25677d1832f2e2051cc42615824e048013bc2d Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 20 May 2022 15:32:39 +0200 Subject: [PATCH 308/406] Add support for appending curves for summary case and ensemble by stepping --- .../Summary/RimSummaryMultiPlot.cpp | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 01919f0185..19004b588e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -1223,18 +1223,36 @@ void RimSummaryMultiPlot::appendCurveByStepping( int direction ) for ( auto curve : plot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) ) { - auto address = curve->summaryAddressY(); - auto sumCase = curve->summaryCaseY(); - address = m_sourceStepping->stepAddress( address, direction ); - addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, sumCase->caseId() ) ); + auto address = curve->summaryAddressY(); + auto sumCase = curve->summaryCaseY(); + int sumCaseId = sumCase->caseId(); + if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::SUMMARY_CASE ) + { + auto nextSumCase = m_sourceStepping->stepCase( direction ); + if ( nextSumCase ) sumCaseId = nextSumCase->caseId(); + } + else + { + address = m_sourceStepping->stepAddress( address, direction ); + } + addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, sumCaseId ) ); } for ( auto curveSet : plot->curveSets() ) { - auto address = curveSet->summaryAddress(); - auto sumEns = curveSet->summaryCaseCollection(); - address = m_sourceStepping->stepAddress( address, direction ); - addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, -1, sumEns->ensembleId() ) ); + auto address = curveSet->summaryAddress(); + auto sumEns = curveSet->summaryCaseCollection(); + int sumEnsId = sumEns->ensembleId(); + if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::ENSEMBLE ) + { + auto nextEns = m_sourceStepping->stepEnsemble( direction ); + if ( nextEns ) sumEnsId = nextEns->ensembleId(); + } + else + { + address = m_sourceStepping->stepAddress( address, direction ); + } + addresses.push_back( RimSummaryAddress::wrapFileReaderAddress( address, -1, sumEnsId ) ); } plot->handleDroppedObjects( addresses ); From 886f5e329593f7544fcbb9860a6e78b866954fdd Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 20 May 2022 16:42:15 +0200 Subject: [PATCH 309/406] Move duplicate button to the right of the multiplot toolbar --- .../ProjectDataModel/Summary/RimSummaryMultiPlot.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 19004b588e..9f373ccb24 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -567,7 +567,6 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() std::vector toolBarFields; toolBarFields.push_back( &m_disableWheelZoom ); - toolBarFields.push_back( &m_createPlotDuplicate ); auto& sourceObject = m_sourceStepping(); if ( sourceObject ) @@ -582,6 +581,8 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() toolBarFields.push_back( &m_appendPrevCurve ); toolBarFields.push_back( &m_appendNextCurve ); + toolBarFields.push_back( &m_createPlotDuplicate ); + auto multiFields = RimMultiPlot::fieldsToShowInToolbar(); toolBarFields.insert( std::end( toolBarFields ), std::begin( multiFields ), std::end( multiFields ) ); From ccfc0e25bc6f345fe1d43b22f9d5a3516f4e469b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sat, 21 May 2022 16:11:55 +0200 Subject: [PATCH 310/406] #7778 Check for valid pointer to main window before use --- .../Application/RiaGuiApplication.cpp | 36 ++++++++----------- .../RicExitApplicationFeature.cpp | 5 ++- .../RicToggleItemsFeatureImpl.cpp | 12 ++++--- .../ProjectDataModel/RimProject.cpp | 4 +-- 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index b7a01cc1ff..cb3d38cade 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -299,7 +299,7 @@ void RiaGuiApplication::storeTreeViewState() QStringList treeStates; QStringList treeIndexes; - for ( auto& tv : mainWindow()->projectTreeViews() ) + for ( auto& tv : m_mainWindow->projectTreeViews() ) { QString treeViewState; tv->storeTreeViewStateToString( treeViewState ); @@ -1291,12 +1291,8 @@ void RiaGuiApplication::onProjectBeingClosed() RiaGuiApplication::clearAllSelections(); - m_mainWindow->cleanupGuiBeforeProjectClose(); - - if ( m_mainPlotWindow ) - { - m_mainPlotWindow->cleanupGuiBeforeProjectClose(); - } + if ( m_mainWindow ) m_mainWindow->cleanupGuiBeforeProjectClose(); + if ( m_mainPlotWindow ) m_mainPlotWindow->cleanupGuiBeforeProjectClose(); caf::EffectGenerator::clearEffectCache(); } @@ -1306,14 +1302,8 @@ void RiaGuiApplication::onProjectBeingClosed() //-------------------------------------------------------------------------------------------------- void RiaGuiApplication::onProjectClosed() { - if ( m_mainWindow ) - { - m_mainWindow->initializeGuiNewProjectLoaded(); - } - if ( m_mainPlotWindow ) - { - m_mainPlotWindow->initializeGuiNewProjectLoaded(); - } + if ( m_mainWindow ) m_mainWindow->initializeGuiNewProjectLoaded(); + if ( m_mainPlotWindow ) m_mainPlotWindow->initializeGuiNewProjectLoaded(); setWindowCaptionFromAppState(); @@ -1364,16 +1354,16 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* if ( m_mainWindow ) { - for ( auto& tv : mainWindow()->projectTreeViews() ) + for ( auto& tv : m_mainWindow->projectTreeViews() ) { tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); } - if ( mainPlotWindow() ) + } + if ( mainPlotWindow() ) + { + for ( auto& tv : mainPlotWindow()->projectTreeViews() ) { - for ( auto& tv : mainPlotWindow()->projectTreeViews() ) - { - tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); - } + tv->enableAppendOfClassNameToUiItemText( RiaPreferencesSystem::current()->appendClassNameToUiText() ); } } @@ -1561,6 +1551,7 @@ int RiaGuiApplication::applicationResolution() //-------------------------------------------------------------------------------------------------- void RiaGuiApplication::startMonitoringWorkProgress( caf::UiProcess* uiProcess ) { + CAF_ASSERT( m_mainWindow ); m_mainWindow->processMonitor()->startMonitorWorkProcess( uiProcess ); } @@ -1569,6 +1560,7 @@ void RiaGuiApplication::startMonitoringWorkProgress( caf::UiProcess* uiProcess ) //-------------------------------------------------------------------------------------------------- void RiaGuiApplication::stopMonitoringWorkProgress() { + CAF_ASSERT( m_mainWindow ); m_mainWindow->processMonitor()->stopMonitorWorkProcess(); } @@ -1577,6 +1569,8 @@ void RiaGuiApplication::stopMonitoringWorkProgress() //-------------------------------------------------------------------------------------------------- void RiaGuiApplication::slotWorkerProcessFinished( int exitCode, QProcess::ExitStatus exitStatus ) { + CAF_ASSERT( m_mainWindow ); + m_mainWindow->processMonitor()->stopMonitorWorkProcess(); QProcessEnvironment processEnvironment = m_workerProcess->processEnvironment(); diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp index f9a3ab0796..571aa4be0e 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp @@ -61,7 +61,10 @@ void RicExitApplicationFeature::onActionTriggered( bool isChecked ) topLevelWidget->hide(); } // Close just the main window, it'll take care of closing the plot window - app->mainWindow()->close(); + if ( app->mainWindow() ) + { + app->mainWindow()->close(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp index a50fedcf78..b4f3c85e67 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp @@ -136,13 +136,17 @@ caf::PdmUiTreeView* RicToggleItemsFeatureImpl::findTreeView( const caf::PdmUiIte return customActiveTreeView; } - caf::PdmUiTreeView* activeTree = RiuMainWindow::instance()->getTreeViewWithItem( uiItem ); - if ( activeTree ) return activeTree; + auto* main3dWindow = RiaGuiApplication::instance()->mainWindow(); + if ( main3dWindow ) + { + auto activeTree = main3dWindow->getTreeViewWithItem( uiItem ); + if ( activeTree ) return activeTree; + } - RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); + auto* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); if ( mainPlotWindow ) { - activeTree = mainPlotWindow->getTreeViewWithItem( uiItem ); + auto activeTree = mainPlotWindow->getTreeViewWithItem( uiItem ); if ( activeTree ) { return activeTree; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 0934a8534f..393319a60b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -353,8 +353,8 @@ void RimProject::setupBeforeSave() if ( guiApp ) { - m_show3DWindow = guiApp->mainWindow()->isVisible(); - m_showPlotWindow = guiApp->mainPlotWindow() && guiApp->mainPlotWindow()->isVisible(); + m_show3DWindow = guiApp->isMain3dWindowVisible(); + m_showPlotWindow = guiApp->isMainPlotWindowVisible(); } } From 26f1387bc6fe4bb9bd78507b5df7ea9ddedea406 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 22 May 2022 11:27:51 +0200 Subject: [PATCH 311/406] Improve plot manager behavior Create plots for vectors with no grouping identifier Do not invalidate GUI on selection changed Use same name as in project tree --- .../Application/Tools/RiaSummaryAddressAnalyzer.cpp | 7 +++++++ .../Application/Tools/RiaSummaryAddressAnalyzer.h | 1 + .../Summary/RimSummaryMultiPlotCollection.cpp | 2 +- .../ProjectDataModel/Summary/RimSummaryPlot.h | 11 ++++++----- .../Summary/RimSummaryPlotManager.cpp | 11 +++-------- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp index 259254a39b..15cf0d8568 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp @@ -198,6 +198,8 @@ std::vector> RiaSummaryAddressAnalyzer::ad groupedByObject.insert( groupedByObject.end(), blockAdr.begin(), blockAdr.end() ); groupedByObject.insert( groupedByObject.end(), aquiferAdr.begin(), aquiferAdr.end() ); + groupedByObject.push_back( m_otherCategory ); + return groupedByObject; } @@ -418,6 +420,11 @@ void RiaSummaryAddressAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAdd { m_aquifers.insert( { address.aquiferNumber(), address } ); } + else if ( address.category() == RifEclipseSummaryAddress::SUMMARY_FIELD || + address.category() == RifEclipseSummaryAddress::SUMMARY_MISC ) + { + m_otherCategory.push_back( address ); + } if ( address.category() != RifEclipseSummaryAddress::SUMMARY_INVALID ) { diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h index dc97e366b1..6a73167784 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h +++ b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h @@ -89,6 +89,7 @@ class RiaSummaryAddressAnalyzer mutable std::set m_quantitiesWithMatchingHistory; mutable std::set m_quantitiesNoMatchingHistory; + std::vector m_otherCategory; std::multimap m_wellNames; std::multimap m_groupNames; std::multimap m_regionNumbers; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp index 09112872b0..8ee772f702 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -153,7 +153,7 @@ void RimSummaryMultiPlotCollection::summaryPlotItemInfos( QListsummaryPlots() ) { - QString displayName = plot->description(); + QString displayName = plot->userDescriptionField()->uiCapability()->uiValue().toString(); optionInfos->push_back( caf::PdmOptionItemInfo( displayName, plot, false, plot->uiCapability()->uiIconProvider() ) ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index a3d9b4106c..f9a98f7ca0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -215,6 +215,8 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void handleDroppedObjects( const std::vector& objects ) override; + caf::PdmFieldHandle* userDescriptionField() override; + private: RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; @@ -232,11 +234,10 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping RimPlotAxisProperties* addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name ); protected: - caf::PdmFieldHandle* userDescriptionField() override; - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override; - void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, - std::vector& referringObjects ) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override; + void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, + std::vector& referringObjects ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index 10c4357705..70c9a72f2d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -50,6 +50,7 @@ #include "cafPdmUiLabelEditor.h" #include "cafPdmUiLineEditor.h" #include "cafPdmUiPushButtonEditor.h" +#include "cafPdmUiTextEditor.h" #include "cafPdmUiTreeSelectionEditor.h" #include "cafSelectionManager.h" @@ -76,6 +77,8 @@ RimSummaryPlotManager::RimSummaryPlotManager() CAF_PDM_InitFieldNoDefault( &m_addressCandidates, "AddressCandidates", "Vectors" ); m_addressCandidates.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); + m_addressCandidates.uiCapability()->setUiReadOnly( true ); + CAF_PDM_InitFieldNoDefault( &m_selectedDataSources, "SelectedDataSources", "Data Sources" ); m_selectedDataSources.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); m_selectedDataSources.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); @@ -472,14 +475,6 @@ void RimSummaryPlotManager::updateUiFromSelection() updateCurveCandidates(); } - if ( !summaryPlot ) - { - m_summaryPlot = nullptr; - - std::vector tmp; - m_addressCandidates = tmp; - } - updateConnectedEditors(); } From 05ce13b53333955a8ccb14e035ecc9e6dd3917b3 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Mon, 23 May 2022 10:54:09 +0200 Subject: [PATCH 312/406] Fix crash if 3d window is not there when importing summary data --- ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp | 2 +- .../Commands/RicImportSummaryCasesFeature.cpp | 4 ++-- .../Commands/RicImportSummaryGroupFeature.cpp | 2 +- .../SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp | 2 +- ApplicationLibCode/UserInterface/RiuMainWindow.cpp | 8 ++++++++ ApplicationLibCode/UserInterface/RiuMainWindow.h | 1 + 6 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp index a1fb19c641..c83f80d4cb 100644 --- a/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportEnsembleFeature.cpp @@ -130,7 +130,7 @@ void RicImportEnsembleFeature::importSingleEnsemble( const QStringList& if ( allCases.size() == 0 ) { - RiuMainWindow::instance()->close(); + RiuMainWindow::closeIfOpen(); } } diff --git a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp index ac34166353..34d173bf71 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp @@ -106,7 +106,7 @@ void RicImportSummaryCasesFeature::onActionTriggered( bool isChecked ) if ( allCases.size() == 0 ) { - RiuMainWindow::instance()->close(); + RiuMainWindow::closeIfOpen(); } } @@ -155,7 +155,7 @@ bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles( const QStr if ( allCases.size() == 0 ) { - RiuMainWindow::instance()->close(); + RiuMainWindow::closeIfOpen(); } } return true; diff --git a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp index 6a7bdd22b8..b3842c5ebf 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp @@ -79,7 +79,7 @@ void RicImportSummaryGroupFeature::onActionTriggered( bool isChecked ) if ( allCases.size() == 0 ) { - RiuMainWindow::instance()->close(); + RiuMainWindow::closeIfOpen(); } } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp index 6dbf126feb..37b4fcbda3 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotFeatureImpl.cpp @@ -500,7 +500,7 @@ void RicSummaryPlotFeatureImpl::createSummaryPlotsFromArgumentLine( const QStrin RiuPlotMainWindowTools::setExpanded( lastPlotCreated ); RiuPlotMainWindowTools::selectAsCurrentItem( lastPlotCreated ); - RiuMainWindow::instance()->close(); + RiuMainWindow::closeIfOpen(); } } else diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index fe74e363a8..4b97d29dc8 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -192,6 +192,14 @@ RiuMainWindow* RiuMainWindow::instance() return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindow::closeIfOpen() +{ + if ( instance() != nullptr ) instance()->close(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 0cc96192a9..fcf01b2b40 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -83,6 +83,7 @@ class RiuMainWindow : public RiuMainWindowBase ~RiuMainWindow() override; static RiuMainWindow* instance(); + static void closeIfOpen(); QString mainWindowName() override; From 039ec05ab82c8a378b4bd240a6fda03b43b6ddba Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 23 May 2022 10:10:54 +0200 Subject: [PATCH 313/406] #8794 Multi Axes: Highlight relevant axes --- .../UserInterface/RiuQwtPlotWidget.cpp | 59 +++++++++++++++++++ .../UserInterface/RiuQwtPlotWidget.h | 2 + 2 files changed, 61 insertions(+) diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 493c82d7a3..6df75ae3fb 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -41,6 +41,7 @@ #include "cafAssert.h" +#include "qwt_axis.h" #include "qwt_date_scale_engine.h" #include "qwt_legend.h" #include "qwt_legend_label.h" @@ -986,6 +987,7 @@ void RiuQwtPlotWidget::highlightPlotItems( const std::set& c if ( closestItems.count( plotCurve ) > 0 ) { plotCurve->setZ( zValue + 100.0 ); + highlightPlotAxes( plotCurve->xAxis(), plotCurve->yAxis() ); } else { @@ -1057,6 +1059,36 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting() } m_originalCurveColors.clear(); m_originalZValues.clear(); + + resetPlotAxisHighlighting(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::resetPlotAxisHighlighting() +{ + // Reset axis widgets highlighting + std::vector axisPositions = { QwtAxis::Position::YLeft, + QwtAxis::Position::YRight, + QwtAxis::Position::XTop, + QwtAxis::Position::XBottom }; + + // Use text color from theme + QColor textColor = RiuGuiTheme::getColorByVariableName( "text-color" ); + QString style = + QString( "color: rgb(%1, %2, %3);" ).arg( textColor.red() ).arg( textColor.green() ).arg( textColor.blue() ); + + for ( auto pos : axisPositions ) + { + int count = m_plot->axesCount( pos ); + for ( int i = 0; i < count; i++ ) + { + QwtAxisId axisId( pos, i ); + auto axisWidget = m_plot->axisWidget( axisId ); + axisWidget->setStyleSheet( style ); + } + } } //-------------------------------------------------------------------------------------------------- @@ -1083,6 +1115,33 @@ void RiuQwtPlotWidget::highlightPlotItemsForQwtAxis( QwtAxisId axisId ) highlightPlotItems( plotItems ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotWidget::highlightPlotAxes( QwtAxisId axisIdX, QwtAxisId axisIdY ) +{ + std::vector axisPositions = { QwtAxis::Position::YLeft, + QwtAxis::Position::YRight, + QwtAxis::Position::XTop, + QwtAxis::Position::XBottom }; + + // Highlight selected axis by toning down the others in same dimension + for ( auto pos : axisPositions ) + { + int count = m_plot->axesCount( pos ); + for ( int i = 0; i < count; i++ ) + { + QwtAxisId axisId( pos, i ); + + if ( axisId != axisIdX && axisId != axisIdY ) + { + auto axisWidget = m_plot->axisWidget( axisId ); + axisWidget->setStyleSheet( "color: gray" ); + } + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index 2a2cbefeef..85534b68c6 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -208,9 +208,11 @@ class RiuQwtPlotWidget : public RiuPlotWidget static int defaultMinimumWidth(); void replot() override; + void highlightPlotAxes( QwtAxisId axisIdX, QwtAxisId axisIdY ); void highlightPlotItemsForQwtAxis( QwtAxisId axisId ); void highlightPlotItems( const std::set& closestItems ); void resetPlotItemHighlighting(); + void resetPlotAxisHighlighting(); void onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection ); void recalculateAxisExtents( RiuPlotAxis axis ); From 329e1e8b697135e9ffe3d3444cc63427efc85cba Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Mon, 23 May 2022 11:58:22 +0200 Subject: [PATCH 314/406] Fix crash in ensemble plot duplicate --- .../Summary/RimSummaryMultiPlot.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 9f373ccb24..c785cc9668 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -869,14 +869,17 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() axisRangeAggregation == AxisRangeAggregation::REGIONS ) { RiaSummaryAddressAnalyzer analyzer; - auto ensemble = curve->summaryCaseY()->ensemble(); - if ( ensemble ) - { - analyzer.appendAddresses( ensemble->ensembleSummaryAddresses() ); - } - else + if ( curve->summaryCaseY() ) { - analyzer.appendAddresses( curve->summaryCaseY()->summaryReader()->allResultAddresses() ); + auto ensemble = curve->summaryCaseY()->ensemble(); + if ( ensemble ) + { + analyzer.appendAddresses( ensemble->ensembleSummaryAddresses() ); + } + else + { + analyzer.appendAddresses( curve->summaryCaseY()->summaryReader()->allResultAddresses() ); + } } if ( axisRangeAggregation == AxisRangeAggregation::WELLS ) From 01e670a3d86eefa8b653b054f82182c9553606c5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 23 May 2022 14:25:53 +0200 Subject: [PATCH 315/406] Add copy/paste of Summary Multi Plot (#8942) * Guard use of back() on empty vector * Add "Show Data Sources" to ensemble realizations * Update summary plot as summary curve collection is not visible in tree view * Set selection manager root in RiaApplication * Always close both main windows if present * Add copy/paste of summary multi plot * Add test for RiuMainWindow::instance() before use * Remove duplicated code * Multiple Tree Views : Use getTreeViewWithItem() to find correct tree view * Minor UI adjustments --- .../Application/RiaApplication.cpp | 5 ++ .../Application/RiaGuiApplication.cpp | 6 +- .../Tools/RiaImportEclipseCaseTools.cpp | 5 +- .../RicfSetMainWindowSize.cpp | 2 +- .../RicExitApplicationFeature.cpp | 7 +- .../Commands/CMakeLists_files.cmake | 2 + .../RicExecuteScriptForCasesFeature.cpp | 3 +- .../RicCopyReferencesToClipboardFeature.cpp | 61 ++++--------- ...RicAppendSummaryPlotsForObjectsFeature.cpp | 9 +- .../Commands/RicCloseCaseFeature.cpp | 4 +- .../RicShowDataSourcesForRealization.cpp | 89 +++++++++++++++++++ .../RicShowDataSourcesForRealization.h | 35 ++++++++ .../CMakeLists_files.cmake | 2 + .../RicPasteSummaryCurveFeature.cpp | 2 +- .../RicPasteSummaryMultiPlotFeature.cpp | 82 +++++++++++++++++ .../RicPasteSummaryMultiPlotFeature.h | 42 +++++++++ .../Measurement/RimMeasurement.cpp | 2 +- .../Rim2dIntersectionView.cpp | 2 +- .../RimContextCommandBuilder.cpp | 3 + .../ProjectDataModel/RimEclipseCase.cpp | 1 + .../RimEclipseResultAddress.cpp | 32 +++++++ .../RimEclipseResultAddress.h | 4 + .../Summary/RimSummaryCase.cpp | 17 ++++ .../ProjectDataModel/Summary/RimSummaryCase.h | 3 + .../Summary/RimSummaryMultiPlotCollection.cpp | 38 ++++---- .../Summary/RimSummaryMultiPlotCollection.h | 2 +- .../UserInterface/Riu3DMainWindowTools.cpp | 15 +--- .../UserInterface/RiuDockWidgetTools.cpp | 6 ++ .../UserInterface/RiuMainWindow.cpp | 30 ++++--- .../RiuSelectionChangedHandler.cpp | 6 ++ 30 files changed, 417 insertions(+), 100 deletions(-) create mode 100644 ApplicationLibCode/Commands/RicShowDataSourcesForRealization.cpp create mode 100644 ApplicationLibCode/Commands/RicShowDataSourcesForRealization.h create mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.cpp create mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.h diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 0c34e9c0b9..0f84a80d94 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -96,6 +96,7 @@ #include "cafPdmSettings.h" #include "cafPdmUiModelChangeDetector.h" #include "cafProgressInfo.h" +#include "cafSelectionManager.h" #include "cafUiProcess.h" #include "cafUtils.h" @@ -163,6 +164,8 @@ RiaApplication::RiaApplication() RiaApplication::~RiaApplication() { RiaFontCache::clear(); + + caf::SelectionManager::instance()->setPdmRootObject( nullptr ); } //-------------------------------------------------------------------------------------------------- @@ -1505,6 +1508,8 @@ void RiaApplication::initialize() m_project = std::make_unique(); m_project->setScriptDirectories( m_preferences->scriptDirectories() ); m_project->setPlotTemplateFolders( m_preferences->plotTemplateFolders() ); + + caf::SelectionManager::instance()->setPdmRootObject( project() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index cb3d38cade..79e0963cec 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -788,7 +788,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n mainPlotWnd->loadWinGeoAndDockToolBarLayout(); } - RiuMainWindow::instance()->loadWinGeoAndDockToolBarLayout(); + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->loadWinGeoAndDockToolBarLayout(); return ApplicationStatus::EXIT_COMPLETED; } @@ -1140,7 +1140,7 @@ void RiaGuiApplication::clearAllSelections() void RiaGuiApplication::showFormattedTextInMessageBoxOrConsole( const QString& text ) { // Create a message dialog with cut/paste friendly text - QDialog dlg( RiuMainWindow::instance() ); + QDialog dlg; dlg.setModal( true ); QGridLayout* layout = new QGridLayout; @@ -1478,7 +1478,7 @@ void RiaGuiApplication::applyGuiPreferences( const RiaPreferences* rim3dView->updateScaling(); if ( rim3dView == activeViewWindow() ) { - RiuMainWindow::instance()->updateScaleValue(); + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->updateScaleValue(); } } diff --git a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp index 92ecd9b282..211199f370 100644 --- a/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaImportEclipseCaseTools.cpp @@ -367,7 +367,7 @@ int RiaImportEclipseCaseTools::openEclipseCaseShowTimeStepFilterImpl( const QStr if ( RiaGuiApplication::isRunning() ) { - RiuMainWindow::instance()->selectAsCurrentItem( riv->cellResult() ); + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->selectAsCurrentItem( riv->cellResult() ); } } else @@ -479,7 +479,8 @@ bool RiaImportEclipseCaseTools::addEclipseCases( const QStringList& fil if ( RiaGuiApplication::isRunning() && gridCaseGroup && !gridCaseGroup->statisticsCaseCollection()->reservoirs.empty() ) { - RiuMainWindow::instance()->selectAsCurrentItem( gridCaseGroup->statisticsCaseCollection()->reservoirs[0] ); + if ( RiuMainWindow::instance() ) + RiuMainWindow::instance()->selectAsCurrentItem( gridCaseGroup->statisticsCaseCollection()->reservoirs[0] ); } return true; diff --git a/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp b/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp index 041d1b8190..c7247f672d 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp @@ -39,6 +39,6 @@ RicfSetMainWindowSize::RicfSetMainWindowSize() //-------------------------------------------------------------------------------------------------- caf::PdmScriptResponse RicfSetMainWindowSize::execute() { - RiuMainWindow::instance()->resize( m_width, m_height ); + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->resize( m_width, m_height ); return caf::PdmScriptResponse(); } diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp index 571aa4be0e..88ae58e11c 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicExitApplicationFeature.cpp @@ -60,11 +60,16 @@ void RicExitApplicationFeature::onActionTriggered( bool isChecked ) { topLevelWidget->hide(); } - // Close just the main window, it'll take care of closing the plot window + if ( app->mainWindow() ) { app->mainWindow()->close(); } + + if ( app->mainPlotWindow() ) + { + app->mainPlotWindow()->close(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/CMakeLists_files.cmake index 0ff286f503..1c69971c48 100644 --- a/ApplicationLibCode/Commands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/CMakeLists_files.cmake @@ -84,6 +84,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicGridCalculatorUi.h ${CMAKE_CURRENT_LIST_DIR}/RicCalculatorWidgetCreator.h ${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorUi.h + ${CMAKE_CURRENT_LIST_DIR}/RicShowDataSourcesForRealization.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -171,6 +172,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicGridCalculatorUi.cpp ${CMAKE_CURRENT_LIST_DIR}/RicCalculatorWidgetCreator.cpp ${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorUi.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicShowDataSourcesForRealization.cpp ) if(RESINSIGHT_USE_QT_CHARTS) diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.cpp b/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.cpp index b0ba4b71d1..a69854611c 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.cpp +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicExecuteScriptForCasesFeature.cpp @@ -59,8 +59,7 @@ void RicExecuteScriptForCasesFeature::onActionTriggered( bool isChecked ) { QString scriptAbsolutePath = userData().toString(); - RiuMainWindow* mainWindow = RiuMainWindow::instance(); - mainWindow->showProcessMonitorDockPanel(); + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->showProcessMonitorDockPanel(); RiaApplication* app = RiaApplication::instance(); diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp index 0813a8acbc..b4f01600b6 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicCopyReferencesToClipboardFeature.cpp @@ -30,6 +30,7 @@ #include "RimGridCrossPlotDataSet.h" #include "RimMimeData.h" #include "RimModeledWellPath.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "RimWellAllocationPlot.h" #include "RimWellLogPlot.h" @@ -124,63 +125,37 @@ bool RicCopyReferencesToClipboardFeature::isAnyCopyableObjectSelected() //-------------------------------------------------------------------------------------------------- bool RicCopyReferencesToClipboardFeature::isCopyOfObjectSupported( caf::PdmObject* pdmObject ) { + // Copy support based on direct dynamic cast + if ( dynamic_cast( pdmObject ) ) return true; + if ( dynamic_cast( pdmObject ) ) return true; + if ( dynamic_cast( pdmObject ) ) return true; + if ( dynamic_cast( pdmObject ) ) return true; + if ( dynamic_cast( pdmObject ) ) return true; + if ( dynamic_cast( pdmObject ) ) return true; + if ( dynamic_cast( pdmObject ) ) return true; + if ( dynamic_cast( pdmObject ) ) return true; + if ( dynamic_cast( pdmObject ) ) return true; + if ( dynamic_cast( pdmObject ) ) return true; + if ( dynamic_cast( pdmObject ) ) return true; + + // Copy support based combined logic RimWellAllocationPlot* wellAllocPlot = nullptr; RimWellRftPlot* rftPlot = nullptr; pdmObject->firstAncestorOrThisOfType( wellAllocPlot ); pdmObject->firstAncestorOrThisOfType( rftPlot ); - if ( dynamic_cast( pdmObject ) ) - { - return true; - } - else if ( dynamic_cast( pdmObject ) ) - { - return true; - } - else if ( dynamic_cast( pdmObject ) ) - { - return true; - } - else if ( dynamic_cast( pdmObject ) ) - { - return true; - } - else if ( dynamic_cast( pdmObject ) ) - { - return true; - } - else if ( dynamic_cast( pdmObject ) ) - { - return true; - } - else if ( dynamic_cast( pdmObject ) && !dynamic_cast( pdmObject ) ) + if ( dynamic_cast( pdmObject ) && !dynamic_cast( pdmObject ) ) { if ( !rftPlot ) return true; } - else if ( dynamic_cast( pdmObject ) ) + if ( dynamic_cast( pdmObject ) ) { if ( !wellAllocPlot && !rftPlot ) return true; } - else if ( dynamic_cast( pdmObject ) ) + if ( dynamic_cast( pdmObject ) ) { if ( !wellAllocPlot && !rftPlot ) return true; } - else if ( dynamic_cast( pdmObject ) ) - { - return true; - } - else if ( dynamic_cast( pdmObject ) ) - { - return true; - } - else if ( dynamic_cast( pdmObject ) ) - { - return true; - } - else if ( dynamic_cast( pdmObject ) ) - { - return true; - } return false; } diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index cd74d642c5..e2aa633582 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -297,10 +297,13 @@ std::vector RicAppendSummaryPlotsForObjectsFeature::plotsForOne } else if ( objectType == RimSummaryAddressCollection::CollectionContentType::SUMMARY_CASE ) { - auto curves = sourcePlots.back()->summaryCurves(); - if ( !curves.empty() ) + if ( !sourcePlots.empty() ) { - caseIdToMatch = curves.front()->summaryCaseY()->caseId(); + auto curves = sourcePlots.back()->summaryCurves(); + if ( !curves.empty() ) + { + caseIdToMatch = curves.front()->summaryCaseY()->caseId(); + } } } diff --git a/ApplicationLibCode/Commands/RicCloseCaseFeature.cpp b/ApplicationLibCode/Commands/RicCloseCaseFeature.cpp index 2fd9ee292b..70f1badf31 100644 --- a/ApplicationLibCode/Commands/RicCloseCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseCaseFeature.cpp @@ -86,7 +86,7 @@ void RicCloseCaseFeature::onActionTriggered( bool isChecked ) { deleteEclipseCase( eclipseCase ); } - RiuMainWindow::instance()->cleanupGuiCaseClose(); + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->cleanupGuiCaseClose(); } } @@ -96,7 +96,7 @@ void RicCloseCaseFeature::onActionTriggered( bool isChecked ) { deleteGeoMechCase( geoMechCase ); } - RiuMainWindow::instance()->cleanupGuiCaseClose(); + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->cleanupGuiCaseClose(); } } diff --git a/ApplicationLibCode/Commands/RicShowDataSourcesForRealization.cpp b/ApplicationLibCode/Commands/RicShowDataSourcesForRealization.cpp new file mode 100644 index 0000000000..1aec5c9fa0 --- /dev/null +++ b/ApplicationLibCode/Commands/RicShowDataSourcesForRealization.cpp @@ -0,0 +1,89 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicShowDataSourcesForRealization.h" + +#include "RimSummaryCase.h" + +#include "cafSelectionManager.h" +#include + +CAF_CMD_SOURCE_INIT( RicShowDataSourcesForRealization, "RicShowDataSourcesForRealization" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicShowDataSourcesForRealization::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Show Data Sources" ); + + actionToSetup->setCheckable( true ); + actionToSetup->setChecked( isCommandChecked() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicShowDataSourcesForRealization::isCommandChecked() +{ + std::vector selection; + caf::SelectionManager::instance()->objectsByType( &selection ); + + if ( !selection.empty() ) + { + return selection.front()->showRealizationDataSources(); + } + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicShowDataSourcesForRealization::isCommandEnabled() +{ + std::vector selection; + caf::SelectionManager::instance()->objectsByType( &selection ); + + for ( RimSummaryCase* summaryCase : selection ) + { + if ( summaryCase->ensemble() ) + { + return true; + } + } + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicShowDataSourcesForRealization::onActionTriggered( bool isChecked ) +{ + std::vector selection; + caf::SelectionManager::instance()->objectsByType( &selection ); + + if ( selection.empty() ) return; + + bool enableDataSources = !selection.front()->showRealizationDataSources(); + + for ( auto summaryCase : selection ) + { + summaryCase->setShowRealizationDataSource( enableDataSources ); + } +} diff --git a/ApplicationLibCode/Commands/RicShowDataSourcesForRealization.h b/ApplicationLibCode/Commands/RicShowDataSourcesForRealization.h new file mode 100644 index 0000000000..87f425d58c --- /dev/null +++ b/ApplicationLibCode/Commands/RicShowDataSourcesForRealization.h @@ -0,0 +1,35 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicShowDataSourcesForRealization : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + bool isCommandChecked() override; +}; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index 1af0802938..2daeb86cd4 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -42,6 +42,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewPlotAxisPropertiesFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicPasteSummaryMultiPlotFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -88,6 +89,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewPlotAxisPropertiesFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicPasteSummaryMultiPlotFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp index 7b55d07c38..3084586d44 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp @@ -63,7 +63,7 @@ RimSummaryCurve* RicPasteSummaryCurveFeature::copyCurveAndAddToPlot( RimSummaryC newCurve->loadDataAndUpdate( true ); newCurve->updateConnectedEditors(); - summaryPlot->summaryCurveCollection()->updateAllRequiredEditors(); + summaryPlot->updateAllRequiredEditors(); return newCurve; } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.cpp new file mode 100644 index 0000000000..0a899a86c5 --- /dev/null +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.cpp @@ -0,0 +1,82 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicPasteSummaryMultiPlotFeature.h" + +#include "OperationsUsingObjReferences/RicPasteFeatureImpl.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" + +#include "RiaSummaryTools.h" +#include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" + +#include "cafPdmDefaultObjectFactory.h" +#include "cafPdmObjectGroup.h" +#include "cafSelectionManagerTools.h" + +#include "cvfAssert.h" + +#include + +CAF_CMD_SOURCE_INIT( RicPasteSummaryMultiPlotFeature, "RicPasteSummaryMultiPlotFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicPasteSummaryMultiPlotFeature::isCommandEnabled() +{ + auto multiPlots = caf::selectedObjectsByTypeStrict(); + return !multiPlots.empty(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicPasteSummaryMultiPlotFeature::onActionTriggered( bool isChecked ) +{ + auto sourceObjects = RicPasteSummaryMultiPlotFeature::summaryMultiPlots(); + + for ( const auto& sourceObject : sourceObjects ) + { + RiaSummaryTools::summaryMultiPlotCollection()->duplicatePlot( sourceObject ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicPasteSummaryMultiPlotFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Paste Summary Plot" ); + + RicPasteFeatureImpl::setIconAndShortcuts( actionToSetup ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector> RicPasteSummaryMultiPlotFeature::summaryMultiPlots() +{ + caf::PdmObjectGroup objectGroup; + RicPasteFeatureImpl::findObjectsFromClipboardRefs( &objectGroup ); + + std::vector> typedObjects; + objectGroup.objectsByType( &typedObjects ); + + return typedObjects; +} diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.h new file mode 100644 index 0000000000..092d8046c1 --- /dev/null +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryMultiPlotFeature.h @@ -0,0 +1,42 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022- 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" +#include "cafPdmPointer.h" + +#include + +class RimSummaryMultiPlot; + +//================================================================================================== +/// +//================================================================================================== +class RicPasteSummaryMultiPlotFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + +private: + static std::vector> summaryMultiPlots(); +}; diff --git a/ApplicationLibCode/ProjectDataModel/Measurement/RimMeasurement.cpp b/ApplicationLibCode/ProjectDataModel/Measurement/RimMeasurement.cpp index a1c82d5f61..00bf13dca7 100644 --- a/ApplicationLibCode/ProjectDataModel/Measurement/RimMeasurement.cpp +++ b/ApplicationLibCode/ProjectDataModel/Measurement/RimMeasurement.cpp @@ -76,7 +76,7 @@ void RimMeasurement::setMeasurementMode( MeasurementMode measurementMode ) } } - RiuMainWindow::instance()->refreshViewActions(); + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->refreshViewActions(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp index 1dc1deae75..71d713897b 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp @@ -419,7 +419,7 @@ bool Rim2dIntersectionView::handleOverlayItemPicked( const cvf::OverlayItem* pic { if ( m_legendObjectToSelect ) { - RiuMainWindow::instance()->selectAsCurrentItem( m_legendObjectToSelect ); + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->selectAsCurrentItem( m_legendObjectToSelect ); return true; } diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 2d0501bdc1..9cf745d131 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -564,6 +564,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "Separator"; menuBuilder << "RicPasteSummaryPlotFeature"; menuBuilder << "RicPasteAsciiDataToSummaryPlotFeature"; + menuBuilder << "RicPasteSummaryMultiPlotFeature"; menuBuilder << "Separator"; menuBuilder << "RicShowSummaryCurveCalculatorFeature"; } @@ -1035,6 +1036,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "Separator"; menuBuilder << "RicSnapshotViewToPdfFeature"; menuBuilder << "RicSaveMultiPlotTemplateFeature"; + menuBuilder << "RicPasteSummaryMultiPlotFeature"; } else if ( dynamic_cast( firstUiItem ) ) { @@ -1104,6 +1106,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicReloadSummaryCaseFeature"; menuBuilder << "RicReplaceSummaryCaseFeature"; menuBuilder << "RicCreateSummaryCaseCollectionFeature"; + menuBuilder << "RicShowDataSourcesForRealization"; menuBuilder << "Separator"; menuBuilder << "RicCutReferencesToClipboardFeature"; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index cedc51137f..0b82ab025f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -125,6 +125,7 @@ RimEclipseCase::RimEclipseCase() CAF_PDM_InitFieldNoDefault( &m_resultAddressCollections, "ResultAddressCollections", "Result Addresses" ); m_resultAddressCollections.uiCapability()->setUiHidden( true ); + m_resultAddressCollections.uiCapability()->setUiTreeHidden( true ); m_resultAddressCollections.xmlCapability()->disableIO(); // Init diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp index 7594499336..415caa8b2e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp @@ -19,6 +19,7 @@ #include "RimEclipseResultAddress.h" #include "RimEclipseCase.h" +#include "RimProject.h" CAF_PDM_SOURCE_INIT( RimEclipseResultAddress, "EclipseResultAddress" ); @@ -30,8 +31,13 @@ RimEclipseResultAddress::RimEclipseResultAddress() CAF_PDM_InitObject( "EclipseResultAddress", ":/DataVector.png", "", "" ); CAF_PDM_InitFieldNoDefault( &m_resultName, "ResultName", "Result Name" ); + m_resultName.uiCapability()->setUiReadOnly( true ); + CAF_PDM_InitFieldNoDefault( &m_resultType, "ResultType", "Type" ); + m_resultType.uiCapability()->setUiReadOnly( true ); + CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseCase", "Eclipse Case" ); + m_eclipseCase.uiCapability()->setUiReadOnly( true ); } //-------------------------------------------------------------------------------------------------- @@ -88,3 +94,29 @@ RimEclipseCase* RimEclipseResultAddress::eclipseCase() const { return m_eclipseCase; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList + RimEclipseResultAddress::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +{ + QList options; + + if ( fieldNeedingOptions == &m_eclipseCase ) + { + RimProject* proj = nullptr; + this->firstAncestorOrThisOfType( proj ); + if ( proj ) + { + std::vector cases; + proj->descendantsIncludingThisOfType( cases ); + for ( auto* c : cases ) + { + options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) ); + } + } + } + + return options; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h index 5529429aed..a53f0ef761 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h @@ -43,6 +43,10 @@ class RimEclipseResultAddress : public caf::PdmObject void setEclipseCase( RimEclipseCase* eclipseCase ); RimEclipseCase* eclipseCase() const; +private: + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) override; + private: caf::PdmField m_resultName; caf::PdmField> m_resultType; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp index 23456b0108..d6d284206a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp @@ -112,6 +112,23 @@ bool RimSummaryCase::isObservedData() const return m_isObservedData; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryCase::showRealizationDataSources() const +{ + return m_showSubNodesInTree(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCase::setShowRealizationDataSource( bool enable ) +{ + m_showSubNodesInTree = enable; + updateConnectedEditors(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h index dd732f0ced..8728d2dea8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.h @@ -78,6 +78,9 @@ class RimSummaryCase : public caf::PdmObject bool isObservedData() const; + bool showRealizationDataSources() const; + void setShowRealizationDataSource( bool enable ); + void setCaseRealizationParameters( const std::shared_ptr& crlParameters ); std::shared_ptr caseRealizationParameters() const; bool hasCaseRealizationParameters() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp index 8ee772f702..e84f5582de 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -105,21 +105,7 @@ size_t RimSummaryMultiPlotCollection::plotCount() const //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlotCollection::onDuplicatePlot( const caf::SignalEmitter* emitter, RimSummaryMultiPlot* plotToDuplicate ) { - if ( !plotToDuplicate ) return; - - auto plotCopy = dynamic_cast( - plotToDuplicate->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); - - addSummaryMultiPlot( plotCopy ); - - plotCopy->resolveReferencesRecursively(); - plotCopy->initAfterReadRecursively(); - plotCopy->updateAllRequiredEditors(); - plotCopy->loadDataAndUpdate(); - - updateConnectedEditors(); - - RiuPlotMainWindowTools::selectAsCurrentItem( plotCopy, true ); + duplicatePlot( plotToDuplicate ); } //-------------------------------------------------------------------------------------------------- @@ -160,6 +146,28 @@ void RimSummaryMultiPlotCollection::summaryPlotItemInfos( QList( + plotToDuplicate->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + + addSummaryMultiPlot( plotCopy ); + + plotCopy->resolveReferencesRecursively(); + plotCopy->initAfterReadRecursively(); + plotCopy->updateAllRequiredEditors(); + plotCopy->loadDataAndUpdate(); + + updateConnectedEditors(); + + RiuPlotMainWindowTools::selectAsCurrentItem( plotCopy, true ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h index d615a79c69..aab20f1ff5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h @@ -46,8 +46,8 @@ class RimSummaryMultiPlotCollection : public caf::PdmObject, public RimPlotColle std::vector multiPlots() const; void addSummaryMultiPlot( RimSummaryMultiPlot* plot ); - void summaryPlotItemInfos( QList* optionInfos ) const; + void duplicatePlot( RimSummaryMultiPlot* plotToDuplicate ); void updateSummaryNameHasChanged(); diff --git a/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.cpp b/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.cpp index f251c98b27..d56a827740 100644 --- a/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.cpp +++ b/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.cpp @@ -38,10 +38,7 @@ QWidget* Riu3DMainWindowTools::mainWindowWidget() //-------------------------------------------------------------------------------------------------- void Riu3DMainWindowTools::setActiveViewer( QWidget* subWindow ) { - if ( RiuMainWindow::instance() ) - { - RiuMainWindow::instance()->setActiveViewer( subWindow ); - } + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->setActiveViewer( subWindow ); } //-------------------------------------------------------------------------------------------------- @@ -49,10 +46,7 @@ void Riu3DMainWindowTools::setActiveViewer( QWidget* subWindow ) //-------------------------------------------------------------------------------------------------- void Riu3DMainWindowTools::setExpanded( const caf::PdmUiItem* uiItem, bool expanded /*= true*/ ) { - if ( RiuMainWindow::instance() ) - { - RiuMainWindow::instance()->setExpanded( uiItem, expanded ); - } + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->setExpanded( uiItem, expanded ); } //-------------------------------------------------------------------------------------------------- @@ -60,10 +54,7 @@ void Riu3DMainWindowTools::setExpanded( const caf::PdmUiItem* uiItem, bool expan //-------------------------------------------------------------------------------------------------- void Riu3DMainWindowTools::selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange /*= true*/ ) { - if ( RiuMainWindow::instance() ) - { - RiuMainWindow::instance()->selectAsCurrentItem( object, allowActiveViewChange ); - } + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->selectAsCurrentItem( object, allowActiveViewChange ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index 24f21e308d..2b759b319e 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -277,6 +277,8 @@ QAction* RiuDockWidgetTools::toggleActionForWidget( const QObject* parent, const //-------------------------------------------------------------------------------------------------- void RiuDockWidgetTools::setVisibleDockingWindowsForEclipse() { + if ( !RiuMainWindow::instance() ) return; + RiuMainWindow* mainWindow = RiuMainWindow::instance(); auto widgetVisibilities = widgetVisibilitiesForEclipse(); @@ -288,6 +290,8 @@ void RiuDockWidgetTools::setVisibleDockingWindowsForEclipse() //-------------------------------------------------------------------------------------------------- void RiuDockWidgetTools::setVisibleDockingWindowsForGeoMech() { + if ( !RiuMainWindow::instance() ) return; + RiuMainWindow* mainWindow = RiuMainWindow::instance(); auto widgetVisibilities = widgetVisibilitiesForGeoMech(); @@ -348,6 +352,8 @@ QVariant RiuDockWidgetTools::defaultDockWidgetVisibilities() //-------------------------------------------------------------------------------------------------- void RiuDockWidgetTools::workaroundForQwtDockWidgets() { + if ( !RiuMainWindow::instance() ) return; + RiuMainWindow* mainWindow = RiuMainWindow::instance(); QList dockWidgets = mainWindow->findChildren(); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 4b97d29dc8..a32d7acc07 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1230,8 +1230,6 @@ void RiuMainWindow::setPdmRoot( caf::PdmObject* pdmRoot ) projPropView->setPdmItem( pdmRoot ); } } - - caf::SelectionManager::instance()->setPdmRootObject( pdmRoot ); } //-------------------------------------------------------------------------------------------------- @@ -1343,7 +1341,10 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim if ( is3dViewCurrentlySelected && ( previousActiveReservoirView != activatedView ) ) { - QModelIndex newViewModelIndex = projectTreeView( 0 )->findModelIndex( activatedView ); + auto tv = getTreeViewWithItem( activatedView ); + if ( !tv ) return; + + QModelIndex newViewModelIndex = tv->findModelIndex( activatedView ); if ( !newViewModelIndex.isValid() ) return; QModelIndex newSelectionIndex = newViewModelIndex; @@ -1352,8 +1353,8 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim { // Try to select the same entry in the new View, as was selected in the previous - QModelIndex previousViewModelIndex = projectTreeView( 0 )->findModelIndex( previousActiveReservoirView ); - QModelIndex currentSelectionIndex = projectTreeView( 0 )->treeView()->selectionModel()->currentIndex(); + QModelIndex previousViewModelIndex = tv->findModelIndex( previousActiveReservoirView ); + QModelIndex currentSelectionIndex = tv->treeView()->selectionModel()->currentIndex(); if ( currentSelectionIndex != newViewModelIndex && currentSelectionIndex.isValid() ) { @@ -1376,8 +1377,7 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim QModelIndex tmp = route[i]; if ( newSelectionIndex.isValid() ) { - newSelectionIndex = - projectTreeView( 0 )->treeView()->model()->index( tmp.row(), tmp.column(), newSelectionIndex ); + newSelectionIndex = tv->treeView()->model()->index( tmp.row(), tmp.column(), newSelectionIndex ); } } @@ -1389,10 +1389,10 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim } } - projectTreeView( 0 )->treeView()->setCurrentIndex( newSelectionIndex ); + tv->treeView()->setCurrentIndex( newSelectionIndex ); if ( newSelectionIndex != newViewModelIndex ) { - projectTreeView( 0 )->treeView()->setExpanded( newViewModelIndex, true ); + tv->treeView()->setExpanded( newViewModelIndex, true ); } } } @@ -1484,8 +1484,11 @@ void RiuMainWindow::slotBuildWindowActions() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::selectedObjectsChanged() { + caf::PdmUiTreeView* projectTree = dynamic_cast( sender() ); + if ( !projectTree ) return; + std::vector uiItems; - projectTreeView( 0 )->selectedUiItems( uiItems ); + projectTree->selectedUiItems( uiItems ); caf::PdmObjectHandle* firstSelectedObject = nullptr; if ( !uiItems.empty() ) @@ -1543,7 +1546,7 @@ void RiuMainWindow::selectedObjectsChanged() // The only way to get to this code is by selection change initiated from the project tree view // As we are activating an MDI-window, the focus is given to this MDI-window // Set focus back to the tree view to be able to continue keyboard tree view navigation - projectTreeView( 0 )->treeView()->setFocus(); + projectTree->treeView()->setFocus(); } } } @@ -1906,8 +1909,11 @@ void RiuMainWindow::slotCreateCommandObject() RiaApplication* app = RiaApplication::instance(); if ( !app->project() ) return; + caf::PdmUiTreeView* projectTree = dynamic_cast( sender() ); + if ( !projectTree ) return; + std::vector selectedUiItems; - projectTreeView( 0 )->selectedUiItems( selectedUiItems ); + projectTree->selectedUiItems( selectedUiItems ); caf::PdmObjectGroup selectedObjects; for ( auto* selectedUiItem : selectedUiItems ) diff --git a/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp b/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp index 01990bd050..5e99329fd4 100644 --- a/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp +++ b/ApplicationLibCode/UserInterface/RiuSelectionChangedHandler.cpp @@ -79,6 +79,8 @@ RiuSelectionChangedHandler::~RiuSelectionChangedHandler() //-------------------------------------------------------------------------------------------------- void RiuSelectionChangedHandler::handleSelectionDeleted() const { + if ( !RiuMainWindow::instance() ) return; + RiuMainWindow::instance()->resultPlot()->deleteAllCurves(); RiuRelativePermeabilityPlotUpdater* relPermPlotUpdater = @@ -101,6 +103,8 @@ void RiuSelectionChangedHandler::handleSelectionDeleted() const //-------------------------------------------------------------------------------------------------- void RiuSelectionChangedHandler::handleItemAppended( const RiuSelectionItem* item ) const { + if ( !RiuMainWindow::instance() ) return; + addCurveFromSelectionItem( item ); RiuRelativePermeabilityPlotUpdater* relPermUpdater = @@ -123,6 +127,8 @@ void RiuSelectionChangedHandler::handleItemAppended( const RiuSelectionItem* ite //-------------------------------------------------------------------------------------------------- void RiuSelectionChangedHandler::handleSetSelectedItem( const RiuSelectionItem* item ) const { + if ( !RiuMainWindow::instance() ) return; + RiuMainWindow::instance()->resultPlot()->deleteAllCurves(); RiuMohrsCirclePlot* mohrsCirclePlot = RiuMainWindow::instance()->mohrsCirclePlot(); From 1aa41968a5aa604a40a17043f2e48dd09f4d4bb3 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 23 May 2022 15:48:20 +0200 Subject: [PATCH 316/406] #8787 Summary Multiplot: Fix inversion of axis with axis aggregation. --- .../Summary/RimSummaryMultiPlot.cpp | 34 +++++++++++-------- .../Summary/RimSummaryPlot.cpp | 9 +++-- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index c785cc9668..7dc0f3665c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -768,10 +768,11 @@ void RimSummaryMultiPlot::syncAxisRanges() { double minVal = axis->visibleRangeMin(); double maxVal = axis->visibleRangeMax(); + if ( axis->isAxisInverted() ) std::swap( minVal, maxVal ); if ( axisRanges.count( axis->plotAxisType() ) == 0 ) { - axisRanges[axis->plotAxisType()] = std::make_pair( axis->visibleRangeMin(), axis->visibleRangeMax() ); + axisRanges[axis->plotAxisType()] = std::make_pair( minVal, maxVal ); } else { @@ -787,7 +788,8 @@ void RimSummaryMultiPlot::syncAxisRanges() { for ( auto axis : plot->plotAxes() ) { - const auto& [minVal, maxVal] = axisRanges[axis->plotAxisType()]; + auto [minVal, maxVal] = axisRanges[axis->plotAxisType()]; + if ( axis->isAxisInverted() ) std::swap( minVal, maxVal ); axis->setAutoZoom( false ); axis->setVisibleRangeMin( minVal ); axis->setVisibleRangeMax( maxVal ); @@ -955,25 +957,23 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() // set all plots to use the global min/max values for each category for ( auto axis : plot->plotAxes() ) { - QwtLinearScaleEngine scaleEngine; - - const auto& [minVal, maxVal] = axisRanges[axis->plotAxisType()]; - if ( axis->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT && minVal <= maxVal ) + auto [minVal, maxVal] = axisRanges[axis->plotAxisType()]; + if ( RiaDefines::isVertical( axis->plotAxisType().axis() ) && !std::isinf( minVal ) && !std::isinf( maxVal ) ) { axis->setAutoZoom( false ); - auto adjustedMin = minVal; - auto adjustedMax = maxVal; + if ( axis->isAxisInverted() ) std::swap( minVal, maxVal ); if ( !axis->isLogarithmicScaleEnabled() ) { - int maxMajorTickIntervalCount = 8; - double stepSize = 0.0; - scaleEngine.autoScale( maxMajorTickIntervalCount, adjustedMin, adjustedMax, stepSize ); + int maxMajorTickIntervalCount = 8; + double stepSize = 0.0; + QwtLinearScaleEngine scaleEngine; + scaleEngine.autoScale( maxMajorTickIntervalCount, minVal, maxVal, stepSize ); } - axis->setVisibleRangeMin( adjustedMin ); - axis->setVisibleRangeMax( adjustedMax ); + axis->setVisibleRangeMin( minVal ); + axis->setVisibleRangeMax( maxVal ); } } @@ -1132,7 +1132,11 @@ void RimSummaryMultiPlot::onSubPlotChanged( const caf::SignalEmitter* emitter ) //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot ) { - if ( !m_linkSubPlotAxes() ) return; + if ( !m_linkSubPlotAxes() ) + { + syncAxisRanges(); + return; + } for ( auto plot : summaryPlots() ) { @@ -1142,6 +1146,8 @@ void RimSummaryMultiPlot::onSubPlotAxisChanged( const caf::SignalEmitter* emitte plot->updateAll(); } } + + syncAxisRanges(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 2da3e80f19..b538b2725c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -911,9 +911,10 @@ void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis ) } else { - plotWidget()->setAxisScale( yAxisProps->plotAxisType(), - yAxisProps->visibleRangeMin(), - yAxisProps->visibleRangeMax() ); + double min = yAxisProps->visibleRangeMin(); + double max = yAxisProps->visibleRangeMax(); + if ( yAxisProps->isAxisInverted() ) std::swap( min, max ); + plotWidget()->setAxisScale( yAxisProps->plotAxisType(), min, max ); } plotWidget()->setAxisInverted( yAxisProps->plotAxisType(), yAxisProps->isAxisInverted() ); @@ -1662,6 +1663,8 @@ void RimSummaryPlot::updateZoomFromParentPlot() for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisProperties ) { auto [axisMin, axisMax] = plotWidget()->axisRange( axisProperties->plotAxisType() ); + if ( axisProperties->isAxisInverted() ) std::swap( axisMin, axisMax ); + axisProperties->setVisibleRangeMax( axisMax ); axisProperties->setVisibleRangeMin( axisMin ); axisProperties->updateConnectedEditors(); From f91fe41f1d58a024369767a1493d639c4d23f0c2 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 24 May 2022 15:24:38 +0200 Subject: [PATCH 317/406] Several minor issues (#8948) * #8947 Plot Template : Split export dialog into file path and name * #8946 Update multi plot title when curve is appended by copy/paste * #8946 Separate axis object name and axis title text * If multi plot auto name is empty, use plot title "Plot N" * QwtPlotWidget: Double click activates Zoom All * More testing on valid main window before use * Return false if event is not handeled * Improve fallback plot name * Tree View Editor: Early exit if selected object is unchanged Resetting selection causes flickering * Summary Plot : Select curve object in project tree when clicking on curve --- .../Application/RiaGuiApplication.cpp | 8 +- .../RicSaveMultiPlotTemplateFeature.cpp | 8 +- ...icSaveMultiPlotTemplateFeatureSettings.cpp | 21 ++++- .../RicSaveMultiPlotTemplateFeatureSettings.h | 4 + .../RicPasteSummaryCurveFeature.cpp | 12 +++ .../AnalysisPlots/RimAnalysisPlot.cpp | 13 +-- .../GridCrossPlots/RimGridCrossPlot.cpp | 24 ++--- .../ProjectDataModel/RimPlot.cpp | 9 +- .../RimPlotAxisProperties.cpp | 31 +++++-- .../ProjectDataModel/RimPlotAxisProperties.h | 14 ++- .../RimPlotAxisPropertiesInterface.h | 3 +- .../Summary/RimEnsembleCurveSet.cpp | 2 +- .../Summary/RimSummaryCurve.cpp | 2 +- .../Summary/RimSummaryMultiPlot.cpp | 24 ++++- .../Summary/RimSummaryPlot.cpp | 78 ++++++++-------- .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 +- .../Summary/RimSummaryPlotAxisFormatter.cpp | 91 ++++++++++++++++++- .../Summary/RimSummaryPlotAxisFormatter.h | 1 + .../Summary/RimSummaryTimeAxisProperties.cpp | 24 +++-- .../Summary/RimSummaryTimeAxisProperties.h | 3 +- .../WellLog/RimWellLogTrack.cpp | 9 +- .../UserInterface/RiuPlotMainWindowTools.cpp | 15 +++ .../UserInterface/RiuPlotMainWindowTools.h | 1 + .../UserInterface/RiuQwtPlotWidget.cpp | 13 ++- .../cafPdmUiTreeViewEditor.cpp | 9 +- 25 files changed, 294 insertions(+), 129 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 79e0963cec..84e2f3dc28 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -571,7 +571,7 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n if ( cvf::Option o = progOpt->option( "openplotwindow" ) ) { - m_mainWindow->hide(); + if ( m_mainWindow ) m_mainWindow->hide(); getOrCreateAndShowMainPlotWindow(); } @@ -1223,7 +1223,7 @@ void RiaGuiApplication::onProjectBeingOpened() void RiaGuiApplication::onProjectOpeningError( const QString& errMsg ) { RiaLogging::errorInMessageBox( nullptr, "Error when opening project file", errMsg ); - m_mainWindow->setPdmRoot( nullptr ); + if ( m_mainWindow ) m_mainWindow->setPdmRoot( nullptr ); } //-------------------------------------------------------------------------------------------------- @@ -1233,11 +1233,11 @@ void RiaGuiApplication::onProjectOpened() { if ( m_project->show3DWindow() ) { - m_mainWindow->show(); + getOrCreateAndShowMainWindow(); } else { - m_mainWindow->hide(); + if ( m_mainWindow ) m_mainWindow->hide(); } if ( m_project->showPlotWindow() ) diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp index 68a4a04b1c..36f1a81781 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp @@ -37,6 +37,7 @@ #include "RimSummaryPlot.h" #include "RiuFileDialogTools.h" +#include "RiuPlotMainWindow.h" #include "cafPdmObject.h" #include "cafPdmUiPropertyViewDialog.h" @@ -81,15 +82,14 @@ void RicSaveMultiPlotTemplateFeature::onActionTriggered( bool isChecked ) QString templateCandidateName = caf::Utils::makeValidFileBasename( selectedSummaryPlot()->description() ); - startPath = startPath + "/" + templateCandidateName + ".rpt"; - RicSaveMultiPlotTemplateFeatureSettings settings; settings.setFilePath( startPath ); + settings.setName( templateCandidateName ); - caf::PdmUiPropertyViewDialog propertyDialog( nullptr, &settings, "Export Plot Template", "" ); + caf::PdmUiPropertyViewDialog propertyDialog( RiuPlotMainWindow::instance(), &settings, "Export Plot Template", "" ); if ( propertyDialog.exec() != QDialog::Accepted ) return; - QString fileName = settings.filePath(); + QString fileName = settings.filePath() + "/" + settings.name() + ".rpt"; if ( !fileName.isEmpty() ) { QFile exportFile( fileName ); diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp index 0d9a296faa..a0ce185a79 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.cpp @@ -28,6 +28,7 @@ RicSaveMultiPlotTemplateFeatureSettings::RicSaveMultiPlotTemplateFeatureSettings CAF_PDM_InitObject( "Save Summary Plot", ":/CrossSection16x16.png" ); CAF_PDM_InitFieldNoDefault( &m_filePath, "FilePath", "File Path" ); + CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name" ); CAF_PDM_InitField( &m_persistObjectNameForWells, "PersistObjectNameWells", false, "Wells" ); CAF_PDM_InitField( &m_persistObjectNameGroups, "PersistObjectNameGroups", false, "Groups" ); @@ -50,6 +51,22 @@ QString RicSaveMultiPlotTemplateFeatureSettings::filePath() const return m_filePath().path(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSaveMultiPlotTemplateFeatureSettings::setName( const QString& name ) +{ + m_name = name; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RicSaveMultiPlotTemplateFeatureSettings::name() const +{ + return m_name(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -80,6 +97,7 @@ bool RicSaveMultiPlotTemplateFeatureSettings::usePlacholderForRegions() const void RicSaveMultiPlotTemplateFeatureSettings::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { uiOrdering.add( &m_filePath ); + uiOrdering.add( &m_name ); { auto group = uiOrdering.addNewGroup( "Persist Object Names" ); @@ -102,8 +120,7 @@ void RicSaveMultiPlotTemplateFeatureSettings::defineEditorAttribute( const caf:: auto attr = dynamic_cast( attribute ); if ( attr ) { - attr->m_selectSaveFileName = true; - attr->m_fileSelectionFilter = "Plot Template Files(*.rpt);; All files(*.*)"; + attr->m_selectDirectory = true; } } } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h index b764caa8e2..546a81fdb5 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeatureSettings.h @@ -35,6 +35,9 @@ class RicSaveMultiPlotTemplateFeatureSettings : public caf::PdmObject void setFilePath( const QString& filePath ); QString filePath() const; + void setName( const QString& name ); + QString name() const; + bool usePlacholderForWells() const; bool usePlacholderForGroups() const; bool usePlacholderForRegions() const; @@ -47,6 +50,7 @@ class RicSaveMultiPlotTemplateFeatureSettings : public caf::PdmObject private: caf::PdmField m_filePath; + caf::PdmField m_name; caf::PdmField m_persistObjectNameForWells; caf::PdmField m_persistObjectNameGroups; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp index 3084586d44..ec9177fa2c 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteSummaryCurveFeature.cpp @@ -25,6 +25,7 @@ #include "RimSummaryCrossPlot.h" #include "RimSummaryCurve.h" #include "RimSummaryCurveCollection.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "cafPdmDefaultObjectFactory.h" @@ -63,6 +64,17 @@ RimSummaryCurve* RicPasteSummaryCurveFeature::copyCurveAndAddToPlot( RimSummaryC newCurve->loadDataAndUpdate( true ); newCurve->updateConnectedEditors(); + RimSummaryMultiPlot* summaryMultiPlot = nullptr; + summaryPlot->firstAncestorOrThisOfType( summaryMultiPlot ); + if ( summaryMultiPlot ) + { + summaryMultiPlot->updatePlotWindowTitle(); + } + else + { + summaryPlot->updatePlotTitle(); + } + summaryPlot->updateAllRequiredEditors(); return newCurve; diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index 1f85a50d38..e71556f96c 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -164,7 +164,7 @@ RimAnalysisPlot::RimAnalysisPlot() CAF_PDM_InitFieldNoDefault( &m_valueAxisProperties, "ValueAxisProperties", "ValueAxisProperties" ); m_valueAxisProperties.uiCapability()->setUiTreeHidden( true ); m_valueAxisProperties = new RimPlotAxisProperties; - m_valueAxisProperties->setNameAndAxis( "Value-Axis", RiuQwtPlotTools::fromQwtPlotAxis( QwtAxis::YLeft ) ); + m_valueAxisProperties->setNameAndAxis( "Value-Axis", "Value-Axis", RiuQwtPlotTools::fromQwtPlotAxis( QwtAxis::YLeft ) ); m_valueAxisProperties->enableRangeSettings( false ); CAF_PDM_InitFieldNoDefault( &m_plotDataFilterCollection, "PlotDataFilterCollection", "PlotDataFilterCollection" ); @@ -891,7 +891,7 @@ void RimAnalysisPlot::updateAxes() if ( valAxisProperties->isActive() ) { m_plotWidget->enableAxis( axis, true ); - m_valueAxisProperties->setNameAndAxis( "Value-Axis", axis.axis() ); + m_valueAxisProperties->setNameAndAxis( "Value-Axis", "Value-Axis", axis.axis() ); RimSummaryPlotAxisFormatter calc( valAxisProperties, {}, curveDefinitions(), {}, {} ); calc.applyAxisPropertiesToPlot( m_plotWidget ); @@ -933,14 +933,7 @@ void RimAnalysisPlot::onAxisSelected( RiuPlotAxis axis, bool toggle ) } } - if ( toggle ) - { - RiuPlotMainWindowTools::toggleItemInSelection( itemToSelect ); - } - else - { - RiuPlotMainWindowTools::selectAsCurrentItem( itemToSelect ); - } + RiuPlotMainWindowTools::selectOrToggleObject( itemToSelect, toggle ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index 52b7f95e77..8b5581ec14 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -65,13 +65,13 @@ RimGridCrossPlot::RimGridCrossPlot() CAF_PDM_InitFieldNoDefault( &m_xAxisProperties, "xAxisProperties", "X Axis" ); m_xAxisProperties.uiCapability()->setUiTreeHidden( true ); m_xAxisProperties = new RimPlotAxisProperties; - m_xAxisProperties->setNameAndAxis( "X-Axis", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); + m_xAxisProperties->setNameAndAxis( "X-Axis", "X-Axis", RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); m_xAxisProperties->setEnableTitleTextSettings( false ); CAF_PDM_InitFieldNoDefault( &m_yAxisProperties, "yAxisProperties", "Y Axis" ); m_yAxisProperties.uiCapability()->setUiTreeHidden( true ); m_yAxisProperties = new RimPlotAxisProperties; - m_yAxisProperties->setNameAndAxis( "Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); + m_yAxisProperties->setNameAndAxis( "Y-Axis", "Y-Axis", RiaDefines::PlotAxis::PLOT_AXIS_LEFT ); m_yAxisProperties->setEnableTitleTextSettings( false ); connectAxisSignals( m_xAxisProperties() ); @@ -385,14 +385,7 @@ void RimGridCrossPlot::onAxisSelected( RiuPlotAxis axis, bool toggle ) properties = m_xAxisProperties; } - if ( toggle ) - { - RiuPlotMainWindowTools::toggleItemInSelection( properties ); - } - else - { - RiuPlotMainWindowTools::selectAsCurrentItem( properties ); - } + RiuPlotMainWindowTools::selectOrToggleObject( properties, toggle ); } //-------------------------------------------------------------------------------------------------- @@ -641,10 +634,13 @@ void RimGridCrossPlot::swapAxes() RimPlotAxisProperties* xAxisProperties = m_xAxisProperties(); RimPlotAxisProperties* yAxisProperties = m_yAxisProperties(); - QString tmpName = xAxisProperties->name(); - RiuPlotAxis tmpAxis = xAxisProperties->plotAxisType(); - xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->plotAxisType().axis() ); - yAxisProperties->setNameAndAxis( tmpName, tmpAxis.axis() ); + QString tmpName = xAxisProperties->objectName(); + QString tmpTitle = xAxisProperties->axisTitleText(); + RiuPlotAxis tmpAxis = xAxisProperties->plotAxisType(); + xAxisProperties->setNameAndAxis( yAxisProperties->objectName(), + yAxisProperties->axisTitleText(), + yAxisProperties->plotAxisType().axis() ); + yAxisProperties->setNameAndAxis( tmpName, tmpTitle, tmpAxis.axis() ); m_xAxisProperties.removeChildObject( xAxisProperties ); m_yAxisProperties.removeChildObject( yAxisProperties ); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index aabcfb98fd..8960498f63 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -206,14 +206,7 @@ void RimPlot::doRenderWindowContent( QPaintDevice* paintDevice ) //-------------------------------------------------------------------------------------------------- void RimPlot::onPlotSelected( bool toggle ) { - if ( toggle ) - { - RiuPlotMainWindowTools::toggleItemInSelection( this ); - } - else - { - RiuPlotMainWindowTools::selectAsCurrentItem( this ); - } + RiuPlotMainWindowTools::selectOrToggleObject( this, toggle ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 2cc7f863d7..c7bfaea631 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -61,8 +61,11 @@ RimPlotAxisProperties::RimPlotAxisProperties() CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_name, "Name", "Name" ); - m_name.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_objectName, "Name", "Name" ); + m_objectName.uiCapability()->setUiHidden( true ); + + CAF_PDM_InitFieldNoDefault( &m_axisTitle, "AxisTitle", "Axis Title" ); + m_objectName.uiCapability()->setUiReadOnly( true ); CAF_PDM_InitField( &isAutoTitle, "AutoTitle", true, "Auto Title" ); @@ -145,7 +148,7 @@ void RimPlotAxisProperties::setNameForUnusedAxis() else if ( m_plotAxis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) name += "Right"; - m_name = name; + m_objectName = name; } //-------------------------------------------------------------------------------------------------- @@ -153,7 +156,7 @@ void RimPlotAxisProperties::setNameForUnusedAxis() //-------------------------------------------------------------------------------------------------- caf::PdmFieldHandle* RimPlotAxisProperties::userDescriptionField() { - return &m_name; + return &m_objectName; } //-------------------------------------------------------------------------------------------------- @@ -259,9 +262,13 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotAxisProperties::setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis, int axisIndex ) +void RimPlotAxisProperties::setNameAndAxis( const QString& objectName, + const QString& axistTitle, + RiaDefines::PlotAxis axis, + int axisIndex ) { - m_name = name; + m_objectName = objectName; + m_axisTitle = axistTitle; m_plotAxis = axis; m_plotAxisIndex = axisIndex; @@ -298,9 +305,17 @@ int RimPlotAxisProperties::valuesFontSize() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -const QString& RimPlotAxisProperties::name() const +const QString RimPlotAxisProperties::objectName() const +{ + return m_objectName; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QString RimPlotAxisProperties::axisTitleText() const { - return m_name(); + return m_axisTitle; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index 91551fd06d..d6ed2c1231 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -62,15 +62,17 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface void setEnableTitleTextSettings( bool enable ); void enableRangeSettings( bool enable ); void setNameForUnusedAxis(); - void setNameAndAxis( const QString& name, RiaDefines::PlotAxis axis, int axisIndex = 0 ); + void setNameAndAxis( const QString& objectName, const QString& axistTitle, RiaDefines::PlotAxis axis, int axisIndex = 0 ); AxisTitlePositionType titlePosition() const override; int titleFontSize() const override; int valuesFontSize() const override; - const QString& name() const override; - RiuPlotAxis plotAxisType() const override; - bool useAutoTitle() const; + const QString objectName() const override; + const QString axisTitleText() const override; + + RiuPlotAxis plotAxisType() const override; + bool useAutoTitle() const; void setShowDescription( bool enable ); bool showDescription() const; @@ -145,7 +147,9 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface caf::PdmField m_visibleRangeMin; caf::PdmField m_visibleRangeMax; - caf::PdmField m_name; + caf::PdmField m_objectName; + caf::PdmField m_axisTitle; + caf::PdmField> m_plotAxis; caf::PdmField m_plotAxisIndex; caf::PdmField m_majorTickmarkCount; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h index 693efece25..c43351e47d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h @@ -68,7 +68,8 @@ class RimPlotAxisPropertiesInterface : public caf::PdmObject virtual bool isActive() const = 0; - virtual const QString& name() const = 0; + virtual const QString objectName() const = 0; + virtual const QString axisTitleText() const = 0; virtual bool isAxisInverted() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 5f19bc464c..0084c64bc1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -1222,7 +1222,7 @@ QList RimEnsembleCurveSet::calculateValueOptions( const for ( auto axis : plot->plotAxes() ) { - options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) ); + options.push_back( caf::PdmOptionItemInfo( axis->objectName(), axis ) ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 82e948f6f6..353a8b38d9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -513,7 +513,7 @@ QList RimSummaryCurve::calculateValueOptions( const caf: { if ( dynamic_cast( axis ) ) { - options.push_back( caf::PdmOptionItemInfo( axis->name(), axis ) ); + options.push_back( caf::PdmOptionItemInfo( axis->objectName(), axis ) ); } } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 7dc0f3665c..a97caa2a1c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -46,6 +46,7 @@ #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryCurve.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" #include "RimSummaryPlotControls.h" #include "RimSummaryPlotNameHelper.h" @@ -481,7 +482,22 @@ void RimSummaryMultiPlot::updatePlotWindowTitle() populateNameHelper( m_nameHelper.get() ); auto title = m_nameHelper->plotTitle(); - if ( title.isEmpty() ) title = "Empty Plot"; + + if ( title.isEmpty() ) + { + auto proj = RimProject::current(); + auto collections = proj->mainPlotCollection()->summaryMultiPlotCollection(); + + size_t index = 0; + for ( auto p : collections->multiPlots() ) + { + index++; + if ( p == this ) break; + } + + title = QString( "Plot %1" ).arg( index ); + } + setMultiPlotTitle( title ); } @@ -491,7 +507,8 @@ void RimSummaryMultiPlot::updatePlotWindowTitle() { auto subPlotNameHelper = plot->plotTitleHelper(); - // Disable auto plot title, as this is required to be able to include the information in the multi plot title + // Disable auto plot title, as this is required to be able to include the information in the multi plot + // title plot->enableAutoPlotTitle( false ); auto plotName = subPlotNameHelper->aggregatedPlotTitle( *m_nameHelper ); @@ -609,9 +626,8 @@ bool RimSummaryMultiPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent ) return true; } } - return false; } - return true; + return false; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index b538b2725c..bc1fc7b833 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -58,6 +58,8 @@ #include "RiuPlotAxis.h" #include "RiuPlotMainWindowTools.h" +#include "RiuQwtPlotCurve.h" +#include "RiuQwtPlotItem.h" #include "RiuSummaryQwtPlot.h" #include "RiuTreeViewEventFilter.h" @@ -159,10 +161,10 @@ RimSummaryPlot::RimSummaryPlot( bool isCrossPlot ) m_sourceStepping.uiCapability()->setUiTreeChildrenHidden( true ); m_sourceStepping.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault( &m_alternatePlotName, "AlternateName", "AlternateName" ); - m_alternatePlotName.uiCapability()->setUiReadOnly( true ); - m_alternatePlotName.uiCapability()->setUiHidden( true ); - m_alternatePlotName.xmlCapability()->disableIO(); + CAF_PDM_InitFieldNoDefault( &m_fallbackPlotName, "AlternateName", "AlternateName" ); + m_fallbackPlotName.uiCapability()->setUiReadOnly( true ); + m_fallbackPlotName.uiCapability()->setUiHidden( true ); + m_fallbackPlotName.xmlCapability()->disableIO(); setPlotInfoLabel( "Filters Active" ); @@ -389,14 +391,7 @@ void RimSummaryPlot::onAxisSelected( RiuPlotAxis axis, bool toggle ) caf::PdmObject* itemToSelect = axisPropertiesForPlotAxis( axis ); - if ( toggle ) - { - RiuPlotMainWindowTools::toggleItemInSelection( itemToSelect ); - } - else - { - RiuPlotMainWindowTools::selectAsCurrentItem( itemToSelect ); - } + RiuPlotMainWindowTools::selectOrToggleObject( itemToSelect, toggle ); } //-------------------------------------------------------------------------------------------------- @@ -599,16 +594,6 @@ const RimSummaryNameHelper* RimSummaryPlot::plotTitleHelper() const return m_nameHelperAllCurves.get(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RimSummaryPlot::generatedPlotTitleFromAllCurves() const -{ - RimSummaryPlotNameHelper nameHelper; - updateNameHelperWithCurveData( &nameHelper ); - return nameHelper.plotTitle(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -632,7 +617,7 @@ void RimSummaryPlot::copyMatchingAxisPropertiesFromOther( const RimSummaryPlot& { for ( auto ap : plotAxes() ) { - if ( ap->name().compare( apToCopy->name() ) == 0 ) + if ( ap->objectName().compare( apToCopy->objectName() ) == 0 ) { QString data = apToCopy->writeObjectToXmlString(); ap->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() ); @@ -1383,7 +1368,7 @@ caf::PdmFieldHandle* RimSummaryPlot::userDescriptionField() { if ( m_description().isEmpty() ) { - return &m_alternatePlotName; + return &m_fallbackPlotName; } return &m_description; } @@ -1804,7 +1789,7 @@ RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiaDefines::PlotAxi RimPlotAxisProperties* RimSummaryPlot::addNewAxisProperties( RiuPlotAxis plotAxis, const QString& name ) { auto* axisProperties = new RimPlotAxisProperties; - axisProperties->setNameAndAxis( name, plotAxis.axis(), plotAxis.index() ); + axisProperties->setNameAndAxis( name, name, plotAxis.axis(), plotAxis.index() ); m_axisProperties.push_back( axisProperties ); connectAxisSignals( axisProperties ); @@ -1854,7 +1839,10 @@ void RimSummaryPlot::axisPositionChanged( const caf::SignalEmitter* emitter, // Make sure the new axis on the correct side exists. RiuPlotAxis fixedUpPlotAxis = plotWidget()->createNextPlotAxis( newPlotAxis.axis() ); // The index can change so need to update. - axisProperties->setNameAndAxis( axisProperties->name(), fixedUpPlotAxis.axis(), fixedUpPlotAxis.index() ); + axisProperties->setNameAndAxis( axisProperties->objectName(), + axisProperties->axisTitleText(), + fixedUpPlotAxis.axis(), + fixedUpPlotAxis.index() ); // Move all attached curves for ( auto curve : summaryCurves() ) @@ -2335,7 +2323,10 @@ void RimSummaryPlot::initAfterRead() if ( plotAxisProperties ) { // Reset the plot axis for the axis property - plotAxisProperties->setNameAndAxis( axisProperties->name(), axis.axis(), 0 ); + plotAxisProperties->setNameAndAxis( axisProperties->objectName(), + axisProperties->axisTitleText(), + axis.axis(), + 0 ); } } }; @@ -2477,10 +2468,6 @@ void RimSummaryPlot::deleteAllPlotCurves() //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::updateCurveNames() { - m_alternatePlotName = ""; - - QStringList shortCurveNames; - if ( m_summaryCurveCollection->isCurvesVisible() ) { for ( auto c : summaryCurves() ) @@ -2488,7 +2475,6 @@ void RimSummaryPlot::updateCurveNames() if ( c->isCurveVisible() ) { c->updateCurveNameNoLegendUpdate(); - shortCurveNames.append( QString::fromStdString( c->summaryAddressY().vectorName() ) ); } } } @@ -2496,14 +2482,11 @@ void RimSummaryPlot::updateCurveNames() for ( auto curveSet : m_ensembleCurveSetCollection->curveSets() ) { curveSet->updateEnsembleLegendItem(); - - if ( curveSet->isCurvesVisible() ) - { - shortCurveNames.append( QString::fromStdString( curveSet->summaryAddress().vectorName() ) ); - } } - m_alternatePlotName = shortCurveNames.join( "," ); + RimSummaryPlotNameHelper nameHelper; + updateNameHelperWithCurveData( &nameHelper ); + m_fallbackPlotName = nameHelper.plotTitle(); } //-------------------------------------------------------------------------------------------------- @@ -2556,6 +2539,25 @@ void RimSummaryPlot::onCurveCollectionChanged( const SignalEmitter* emitter ) updateAllRequiredEditors(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::onPlotItemSelected( std::shared_ptr plotItem, bool toggle, int sampleIndex ) +{ + auto wrapper = dynamic_cast( plotItem.get() ); + if ( !wrapper ) return; + + auto qwtPlotItem = wrapper->qwtPlotItem(); + if ( !qwtPlotItem ) return; + + auto riuPlotCurve = dynamic_cast( qwtPlotItem ); + if ( !riuPlotCurve ) return; + + auto rimPlotCurve = riuPlotCurve->ownerRimCurve(); + + RiuPlotMainWindowTools::selectOrToggleObject( rimPlotCurve, toggle ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index f9a98f7ca0..76f573603e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -148,7 +148,6 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping const RimSummaryNameHelper* activePlotTitleHelperAllCurves() const; const RimSummaryNameHelper* plotTitleHelper() const; void updateCurveNames(); - QString generatedPlotTitleFromAllCurves() const; void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot ); void copyMatchingAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot ); @@ -228,6 +227,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void deleteAllPlotCurves(); void onCurveCollectionChanged( const SignalEmitter* emitter ); + void onPlotItemSelected( std::shared_ptr plotItem, bool toggle, int sampleIndex ) override; void connectCurveToPlot( RimSummaryCurve* curve, bool update, bool autoAssignPlotAxis ); @@ -305,7 +305,7 @@ private slots: caf::PdmField m_useAutoPlotTitle; caf::PdmField m_description; - caf::PdmField m_alternatePlotName; + caf::PdmField m_fallbackPlotName; caf::PdmChildArrayField m_gridTimeHistoryCurves; caf::PdmChildField m_summaryCurveCollection; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index cdf5a8c6f4..5b3b019bbc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -130,7 +130,8 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot titleAlignment = Qt::AlignRight; } - m_axisProperties->setNameAndAxis( axisTitle, axis.axis(), axis.index() ); + QString objectName = createAxisObjectName(); + m_axisProperties->setNameAndAxis( objectName, axisTitle, axis.axis(), axis.index() ); plotWidget->setAxisTitleText( axis, axisTitle ); bool titleBold = false; @@ -276,8 +277,8 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const for ( const RiaSummaryCurveDefinition& curveDef : m_curveDefinitions ) { - RifEclipseSummaryAddress sumAddress = curveDef.summaryAddress(); - std::string unitText; + const RifEclipseSummaryAddress& sumAddress = curveDef.summaryAddress(); + std::string unitText; if ( curveDef.summaryCase() && curveDef.summaryCase()->summaryReader() ) { unitText = curveDef.summaryCase()->summaryReader()->unitName( sumAddress ); @@ -285,7 +286,7 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const else if ( curveDef.ensemble() ) { std::vector sumCases = curveDef.ensemble()->allSummaryCases(); - if ( sumCases.size() && sumCases[0] && sumCases[0]->summaryReader() ) + if ( !sumCases.empty() && sumCases[0] && sumCases[0]->summaryReader() ) { unitText = sumCases[0]->summaryReader()->unitName( sumAddress ); } @@ -303,7 +304,7 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const scaleFactorText = QString( " x 10%1 " ).arg( QString::number( exponent ) ); } - for ( auto unitIt : unitToQuantityNameMap ) + for ( const auto& unitIt : unitToQuantityNameMap ) { for ( const auto& quantIt : unitIt.second ) { @@ -337,6 +338,86 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const return assembledYAxisText; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimSummaryPlotAxisFormatter::createAxisObjectName() const +{ + std::set vectorNames; + + auto addVectorNames = [&]( const RifEclipseSummaryAddress& sumAddress ) { + size_t cutPos = sumAddress.vectorName().find( ':' ); + if ( cutPos == std::string::npos ) cutPos = -1; + + std::string name; + const std::string& quantityName = sumAddress.vectorName().substr( cutPos + 1 ); + + if ( sumAddress.category() == RifEclipseSummaryAddress::SUMMARY_CALCULATED ) + { + name = shortCalculationName( quantityName ); + } + else + { + name = quantityName; + } + vectorNames.insert( name ); + }; + + for ( RimSummaryCurve* rimCurve : m_summaryCurves ) + { + RifEclipseSummaryAddress sumAddress; + + if ( m_axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ) + { + sumAddress = rimCurve->summaryAddressX(); + } + else if ( rimCurve->axisY() == this->m_axisProperties->plotAxisType() ) + { + sumAddress = rimCurve->summaryAddressY(); + } + else + { + continue; + } + + addVectorNames( sumAddress ); + } + + for ( const RiaSummaryCurveDefinition& curveDef : m_curveDefinitions ) + { + const RifEclipseSummaryAddress& sumAddress = curveDef.summaryAddress(); + + addVectorNames( sumAddress ); + } + + QString assembledAxisObjectName; + + for ( const auto& vectorName : vectorNames ) + { + assembledAxisObjectName += QString::fromStdString( vectorName ) + " "; + } + + if ( !m_timeHistoryCurveQuantities.empty() ) + { + if ( !assembledAxisObjectName.isEmpty() ) + { + assembledAxisObjectName += " : "; + } + + for ( const auto& timeQuantity : m_timeHistoryCurveQuantities ) + { + assembledAxisObjectName += timeQuantity + " "; + } + } + + const int maxChars = 100; + QFont font; + QFontMetrics fm( font ); + assembledAxisObjectName = fm.elidedText( assembledAxisObjectName, Qt::ElideRight, maxChars ); + + return assembledAxisObjectName; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.h index 8e91d61e39..32d452e074 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.h @@ -42,6 +42,7 @@ class RimSummaryPlotAxisFormatter private: QString autoAxisTitle() const; + QString createAxisObjectName() const; static std::string shortCalculationName( const std::string& calculationName ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index 8c6821907f..affd7ce431 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -348,6 +348,22 @@ void RimSummaryTimeAxisProperties::setMajorTickmarkCount( LegendTickmarkCount co m_majorTickmarkCount = count; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QString RimSummaryTimeAxisProperties::objectName() const +{ + return title(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const QString RimSummaryTimeAxisProperties::axisTitleText() const +{ + return title(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -704,11 +720,3 @@ void RimSummaryTimeAxisProperties::defineEditorAttribute( const caf::PdmFieldHan } } } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -const QString& RimSummaryTimeAxisProperties::name() const -{ - return title(); -} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h index a7849fa5ef..c19059b8b9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h @@ -107,7 +107,8 @@ class RimSummaryTimeAxisProperties : public RimPlotAxisPropertiesInterface LegendTickmarkCount majorTickmarkCount() const override; void setMajorTickmarkCount( LegendTickmarkCount count ) override; - const QString& name() const override; + const QString objectName() const override; + const QString axisTitleText() const override; protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 12cdc83c27..6fbf676bef 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -1045,14 +1045,7 @@ void RimWellLogTrack::updateZoomFromParentPlot() //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::onAxisSelected( RiuPlotAxis axis, bool toggle ) { - if ( toggle ) - { - RiuPlotMainWindowTools::toggleItemInSelection( this ); - } - else - { - RiuPlotMainWindowTools::selectAsCurrentItem( this ); - } + RiuPlotMainWindowTools::selectOrToggleObject( this, toggle ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp index c6b4069b40..262ed61c9d 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp @@ -83,6 +83,21 @@ void RiuPlotMainWindowTools::toggleItemInSelection( const caf::PdmObject* object } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindowTools::selectOrToggleObject( const caf::PdmObject* object, bool toggle ) +{ + if ( toggle ) + { + RiuPlotMainWindowTools::toggleItemInSelection( object ); + } + else + { + RiuPlotMainWindowTools::selectAsCurrentItem( object ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.h index 0cd9aa5f4c..38da6f5cb6 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.h @@ -34,5 +34,6 @@ class RiuPlotMainWindowTools static void setExpanded( const caf::PdmUiItem* uiItem, bool expanded = true ); static void selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange = true ); static void toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange = true ); + static void selectOrToggleObject( const caf::PdmObject* object, bool toggle ); static void refreshToolbars(); }; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 6df75ae3fb..49576546bd 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -557,6 +557,12 @@ bool RiuQwtPlotWidget::eventFilter( QObject* watched, QEvent* event ) { if ( isZoomerActive() ) return false; + if ( mouseEvent->type() == QMouseEvent::MouseButtonDblClick ) + { + if ( m_plotDefinition ) m_plotDefinition->zoomAll(); + return true; + } + bool toggleItemInSelection = ( mouseEvent->modifiers() & Qt::ControlModifier ) != 0; if ( mouseEvent->type() == QMouseEvent::MouseButtonPress && mouseEvent->button() == Qt::LeftButton ) @@ -930,13 +936,14 @@ void RiuQwtPlotWidget::selectClosestPlotItem( const QPoint& pos, bool toggleItem highlightPlotItems( plotItems ); auto plotItem = std::make_shared( closestItem ); emit plotItemSelected( plotItem, toggleItemInSelection, distanceFromClick < 10 ? closestCurvePoint : -1 ); - - scheduleReplot(); } else { emit plotSelected( toggleItemInSelection ); } + + // Always do a replot, as the reset operation also requires replot + replot(); } //-------------------------------------------------------------------------------------------------- @@ -1136,7 +1143,7 @@ void RiuQwtPlotWidget::highlightPlotAxes( QwtAxisId axisIdX, QwtAxisId axisIdY ) if ( axisId != axisIdX && axisId != axisIdY ) { auto axisWidget = m_plot->axisWidget( axisId ); - axisWidget->setStyleSheet( "color: gray" ); + axisWidget->setStyleSheet( "color: #D9D9D9" ); } } } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp index f9bacb62a0..d8e8d08f8a 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp @@ -429,11 +429,16 @@ PdmChildArrayFieldHandle* PdmUiTreeViewEditor::currentChildArrayFieldHandle() void PdmUiTreeViewEditor::selectAsCurrentItem( const PdmUiItem* uiItem ) { QModelIndex index = m_treeViewModel->findModelIndex( uiItem ); - QModelIndex currentIndex = m_filterModel->mapFromSource( index ); + QModelIndex indexForItem = m_filterModel->mapFromSource( index ); + + auto currentSelected = treeView()->currentIndex(); + + // Return if index is the same, as resetting the selection causes flickering + if ( indexForItem == currentSelected ) return; m_treeView->clearSelection(); - m_treeView->setCurrentIndex( currentIndex ); + m_treeView->setCurrentIndex( indexForItem ); } //-------------------------------------------------------------------------------------------------- From 8e3289a432326114b7ec03848398d80a881cb267 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Wed, 25 May 2022 11:01:45 +0200 Subject: [PATCH 318/406] Default summaryplot improvements (#8950) * Add summary default plot type selection in preferences * Create plots as set in preferences when loading summary cases. Allow selecting default plot templates from templates explorer tree * Do not create plot if data vector setting is empty --- .../Application/RiaPreferences.cpp | 70 +++++---- .../Application/RiaPreferences.h | 7 +- .../Application/RiaPreferencesSummary.cpp | 135 +++++++++++++++++- .../Application/RiaPreferencesSummary.h | 23 +++ .../RicSummaryPlotBuilder.cpp | 18 +++ .../CMakeLists_files.cmake | 2 + .../RicReloadPlotTemplatesFeature.cpp | 2 +- .../RicSelectPlotTemplateUi.cpp | 20 ++- .../RicSelectPlotTemplateUi.h | 7 + .../RicSetAsDefaultTemplateFeature.cpp | 86 +++++++++++ .../RicSetAsDefaultTemplateFeature.h | 39 +++++ .../RicSummaryPlotTemplateTools.cpp | 80 +++++++++++ .../RicSummaryPlotTemplateTools.h | 8 +- .../RimContextCommandBuilder.cpp | 2 + .../ProjectDataModel/RimProject.cpp | 2 +- .../ProjectDataModel/RimProject.h | 2 +- 16 files changed, 456 insertions(+), 47 deletions(-) create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.h diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index fdc86e2425..b2d723acd1 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -357,7 +357,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& otherGroup->add( &holoLensDisableCertificateVerification ); otherGroup->add( &m_useUndoRedo ); } - else if ( uiConfigName == RiaPreferences::tabNameEclipseGrid() ) + else if ( uiConfigName == RiaPreferences::tabNameGrid() ) { caf::PdmUiGroup* newCaseBehaviourGroup = uiOrdering.addNewGroup( "Behavior When Loading Data" ); newCaseBehaviourGroup->add( &autocomputeDepthRelatedProperties ); @@ -365,7 +365,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& m_readerSettings->uiOrdering( uiConfigName, *newCaseBehaviourGroup ); } - else if ( uiConfigName == RiaPreferences::tabNameEclipseSummary() ) + else if ( uiConfigName == RiaPreferences::tabNameSummary() ) { m_summaryPreferences->appendRestartFileGroup( uiOrdering ); @@ -377,16 +377,20 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& } else if ( uiConfigName == RiaPreferences::tabNamePlotting() ) { - uiOrdering.add( &m_dateFormat ); - uiOrdering.add( &m_timeFormat ); + caf::PdmUiGroup* summaryGrp = uiOrdering.addNewGroup( "Summary Plots" ); - summaryPreferences()->appendItemsToPlottingGroup( uiOrdering ); + summaryPreferences()->appendItemsToPlottingGroup( *summaryGrp ); - caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Plot Templates" ); + caf::PdmUiGroup* group = summaryGrp->addNewGroup( "Plot Templates" ); group->add( &m_plotTemplateFolders ); group->add( &m_searchPlotTemplateFoldersRecursively ); - caf::PdmUiGroup* pageSetup = uiOrdering.addNewGroup( "Page Setup" ); + caf::PdmUiGroup* generalGrp = uiOrdering.addNewGroup( "General" ); + + generalGrp->add( &m_dateFormat ); + generalGrp->add( &m_timeFormat ); + + caf::PdmUiGroup* pageSetup = generalGrp->addNewGroup( "Page Setup" ); pageSetup->add( &m_pageSize ); pageSetup->add( &m_pageOrientation, false ); pageSetup->add( &m_pageLeftMargin ); @@ -394,7 +398,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& pageSetup->add( &m_pageTopMargin ); pageSetup->add( &m_pageBottomMargin, false ); - uiOrdering.add( &m_useQtChartsPlotByDefault ); + generalGrp->add( &m_useQtChartsPlotByDefault ); m_useQtChartsPlotByDefault.uiCapability()->setUiHidden( true ); QString unitLabel = " [mm]"; @@ -431,15 +435,15 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& m_geoMechPreferences()->appendItems( uiOrdering ); } #endif - else if ( uiConfigName == RiaPreferences::tabNameExport() ) - { - uiOrdering.add( &csvTextExportFieldSeparator ); - uiOrdering.add( &m_openExportedPdfInViewer ); - } - else if ( uiConfigName == RiaPreferences::tabNameImport() ) + else if ( uiConfigName == RiaPreferences::tabNameImportExport() ) { - uiOrdering.add( &m_surfaceImportResamplingDistance ); - uiOrdering.add( &m_multiLateralWellPattern ); + caf::PdmUiGroup* importGroup = uiOrdering.addNewGroup( "Import" ); + importGroup->add( &m_surfaceImportResamplingDistance ); + importGroup->add( &m_multiLateralWellPattern ); + + caf::PdmUiGroup* exportGroup = uiOrdering.addNewGroup( "Export" ); + exportGroup->add( &csvTextExportFieldSeparator ); + exportGroup->add( &m_openExportedPdfInViewer ); } else if ( RiaApplication::enableDevelopmentFeatures() && uiConfigName == RiaPreferences::tabNameSystem() ) { @@ -509,11 +513,14 @@ void RiaPreferences::fieldChangedByUi( const caf::PdmFieldHandle* changedField, m_pageTopMargin = defaultMarginSize( m_pageSize() ); m_pageBottomMargin = defaultMarginSize( m_pageSize() ); } - - if ( changedField == &m_guiTheme ) + else if ( changedField == &m_guiTheme ) { RiuGuiTheme::updateGuiTheme( m_guiTheme() ); } + else + { + m_summaryPreferences->fieldChangedByUi( changedField, oldValue, newValue ); + } } //-------------------------------------------------------------------------------------------------- /// @@ -526,17 +533,17 @@ QString RiaPreferences::tabNameGeneral() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiaPreferences::tabNameEclipseGrid() +QString RiaPreferences::tabNameGrid() { - return "Eclipse Grid"; + return "Grid"; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiaPreferences::tabNameEclipseSummary() +QString RiaPreferences::tabNameSummary() { - return "Eclipse Summary"; + return "Summary"; } //-------------------------------------------------------------------------------------------------- @@ -563,14 +570,6 @@ QString RiaPreferences::tabNameScripting() return "Scripting"; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RiaPreferences::tabNameExport() -{ - return "Export"; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -582,9 +581,9 @@ QString RiaPreferences::tabNameSystem() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiaPreferences::tabNameImport() +QString RiaPreferences::tabNameImportExport() { - return "Import"; + return "Import/Export"; } //-------------------------------------------------------------------------------------------------- @@ -611,15 +610,14 @@ QStringList RiaPreferences::tabNames() QStringList names; names << tabNameGeneral(); - names << tabNameEclipseGrid(); - names << tabNameEclipseSummary(); + names << tabNameGrid(); + names << tabNameSummary(); names << tabNamePlotting(); names << tabNameScripting(); #ifdef USE_ODB_API names << tabNameGeomech(); #endif - names << tabNameExport(); - names << tabNameImport(); + names << tabNameImportExport(); if ( RiaApplication::enableDevelopmentFeatures() ) { diff --git a/ApplicationLibCode/Application/RiaPreferences.h b/ApplicationLibCode/Application/RiaPreferences.h index 9f112e8eba..f1a1403ff0 100644 --- a/ApplicationLibCode/Application/RiaPreferences.h +++ b/ApplicationLibCode/Application/RiaPreferences.h @@ -154,14 +154,13 @@ class RiaPreferences : public caf::PdmObject private: static QString tabNameGeneral(); - static QString tabNameEclipseGrid(); - static QString tabNameEclipseSummary(); + static QString tabNameGrid(); + static QString tabNameSummary(); static QString tabNameGeomech(); static QString tabNamePlotting(); static QString tabNameScripting(); - static QString tabNameExport(); static QString tabNameSystem(); - static QString tabNameImport(); + static QString tabNameImportExport(); static double defaultMarginSize( QPageSize::PageSizeId pageSizeId ); diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp index a08f4fc2a9..77f907829f 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp @@ -18,11 +18,17 @@ #include "RiaPreferencesSummary.h" +#include "PlotTemplateCommands/RicSummaryPlotTemplateTools.h" + #include "RiaApplication.h" #include "RiaPreferences.h" +#include "PlotTemplates/RimPlotTemplateFileItem.h" + #include "cafPdmUiCheckBoxEditor.h" #include "cafPdmUiComboBoxEditor.h" +#include "cafPdmUiListEditor.h" +#include "cafPdmUiPushButtonEditor.h" #include @@ -57,6 +63,15 @@ void RiaPreferencesSummary::SummaryReaderModeType::setUp() setDefault( RiaPreferencesSummary::SummaryReaderMode::HDF5_OPM_COMMON ); } +template <> +void RiaPreferencesSummary::DefaultSummaryPlotEnum::setUp() +{ + addItem( RiaPreferencesSummary::DefaultSummaryPlotType::NONE, "NONE", "No Plots" ); + addItem( RiaPreferencesSummary::DefaultSummaryPlotType::DATA_VECTORS, "DATA_VECTORS", "Use Data Vector Names" ); + addItem( RiaPreferencesSummary::DefaultSummaryPlotType::PLOT_TEMPLATES, "PLOT_TEMPLATES", "Use Plot Templates" ); + setDefault( RiaPreferencesSummary::DefaultSummaryPlotType::DATA_VECTORS ); +} + } // namespace caf CAF_PDM_SOURCE_INIT( RiaPreferencesSummary, "RiaPreferencesSummary" ); @@ -96,6 +111,16 @@ RiaPreferencesSummary::RiaPreferencesSummary() "", "Semicolon separated list of filters used to create curves in new summary plots", "" ); + CAF_PDM_InitFieldNoDefault( &m_defaultSummaryPlot, "defaultSummaryPlot", "Create Plot On Summary Data Import" ); + + CAF_PDM_InitField( &m_selectDefaultTemplates, "selectDefaultTemplate", false, "", "", "Select Default Templates" ); + m_selectDefaultTemplates.xmlCapability()->disableIO(); + m_selectDefaultTemplates.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); + + CAF_PDM_InitFieldNoDefault( &m_selectedDefaultTemplates, "defaultSummaryTemplates", "Select Summary Plot Templates" ); + m_selectedDefaultTemplates.uiCapability()->setUiReadOnly( true ); + m_selectedDefaultTemplates.uiCapability()->setUiEditorTypeName( caf::PdmUiListEditor::uiEditorTypeName() ); + m_selectedDefaultTemplates.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); CAF_PDM_InitField( &m_createEnhancedSummaryDataFile, "createEnhancedSummaryDataFile_v01", @@ -228,7 +253,23 @@ void RiaPreferencesSummary::appendRestartFileGroup( caf::PdmUiOrdering& uiOrderi //-------------------------------------------------------------------------------------------------- void RiaPreferencesSummary::appendItemsToPlottingGroup( caf::PdmUiOrdering& uiOrdering ) const { - uiOrdering.add( &m_defaultSummaryCurvesTextFilter ); + uiOrdering.add( &m_defaultSummaryPlot ); + + switch ( m_defaultSummaryPlot() ) + { + case RiaPreferencesSummary::DefaultSummaryPlotType::DATA_VECTORS: + uiOrdering.add( &m_defaultSummaryCurvesTextFilter ); + break; + + case RiaPreferencesSummary::DefaultSummaryPlotType::PLOT_TEMPLATES: + uiOrdering.add( &m_selectedDefaultTemplates ); + uiOrdering.add( &m_selectDefaultTemplates ); + break; + + default: + break; + } + uiOrdering.add( &m_defaultSummaryHistoryCurveStyle ); uiOrdering.add( &m_curveColorByPhase ); @@ -356,6 +397,22 @@ void RiaPreferencesSummary::defineEditorAttribute( const caf::PdmFieldHandle* fi myattr->iconSize = QSize( 24, 16 ); } } + else if ( field == &m_selectDefaultTemplates ) + { + auto attrib = dynamic_cast( attribute ); + if ( attrib ) + { + attrib->m_buttonText = "Select Default Templates"; + } + } + else if ( field == &m_selectedDefaultTemplates ) + { + auto attrib = dynamic_cast( attribute ); + if ( attrib ) + { + attrib->m_heightHint = 30; + } + } } //-------------------------------------------------------------------------------------------------- @@ -450,3 +507,79 @@ RiaDefines::RowCount RiaPreferencesSummary::defaultMultiPlotRowCount() const { return m_defaultRowsPerPage(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaPreferencesSummary::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) +{ + if ( changedField == &m_selectDefaultTemplates ) + { + m_selectDefaultTemplates = false; + + auto selection = RicSummaryPlotTemplateTools::selectDefaultPlotTemplates( m_selectedDefaultTemplates() ); + if ( selection.empty() ) return; + + m_selectedDefaultTemplates = selection; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaPreferencesSummary::DefaultSummaryPlotType RiaPreferencesSummary::defaultSummaryPlotType() const +{ + return m_defaultSummaryPlot(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiaPreferencesSummary::defaultSummaryPlotTemplates() const +{ + return m_selectedDefaultTemplates(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaPreferencesSummary::isDefaultSummaryPlotTemplate( QString filename ) const +{ + int count = std::count( m_selectedDefaultTemplates().begin(), m_selectedDefaultTemplates().end(), filename ); + return ( count > 0 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaPreferencesSummary::addToDefaultPlotTemplates( QString filename ) +{ + if ( isDefaultSummaryPlotTemplate( filename ) ) return; + + std::vector newlist; + newlist.insert( newlist.end(), m_selectedDefaultTemplates().begin(), m_selectedDefaultTemplates().end() ); + newlist.push_back( filename ); + m_selectedDefaultTemplates = newlist; + + RiaPreferences::current()->writePreferencesToApplicationStore(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaPreferencesSummary::removeFromDefaultPlotTemplates( QString filename ) +{ + if ( !isDefaultSummaryPlotTemplate( filename ) ) return; + + std::vector newlist; + + for ( auto& item : m_selectedDefaultTemplates() ) + { + if ( item != filename ) newlist.push_back( item ); + } + m_selectedDefaultTemplates = newlist; + + RiaPreferences::current()->writePreferencesToApplicationStore(); +} diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.h b/ApplicationLibCode/Application/RiaPreferencesSummary.h index 7e980f5a9e..01e866ad70 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.h +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.h @@ -19,11 +19,15 @@ #pragma once #include "cafAppEnum.h" +#include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "RiaDefines.h" +#include +#include + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -56,6 +60,14 @@ class RiaPreferencesSummary : public caf::PdmObject }; using SummaryHistoryCurveStyleModeType = caf::AppEnum; + enum class DefaultSummaryPlotType + { + NONE, + DATA_VECTORS, + PLOT_TEMPLATES + }; + using DefaultSummaryPlotEnum = caf::AppEnum; + using ColumnCountEnum = caf::AppEnum; using RowCountEnum = caf::AppEnum; @@ -71,6 +83,12 @@ class RiaPreferencesSummary : public caf::PdmObject bool createH5SummaryDataFiles() const; int createH5SummaryDataThreadCount() const; + DefaultSummaryPlotType defaultSummaryPlotType() const; + std::vector defaultSummaryPlotTemplates() const; + bool isDefaultSummaryPlotTemplate( QString filename ) const; + void addToDefaultPlotTemplates( QString filename ); + void removeFromDefaultPlotTemplates( QString filename ); + void appendRestartFileGroup( caf::PdmUiOrdering& uiOrdering ) const; void appendItemsToPlottingGroup( caf::PdmUiOrdering& uiOrdering ) const; @@ -92,6 +110,7 @@ class RiaPreferencesSummary : public caf::PdmObject void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; @@ -99,6 +118,10 @@ class RiaPreferencesSummary : public caf::PdmObject bool* useOptionsOnly ) override; private: + caf::PdmField m_defaultSummaryPlot; + caf::PdmField m_selectDefaultTemplates; + caf::PdmField> m_selectedDefaultTemplates; + caf::PdmField m_summaryRestartFilesShowImportDialog; caf::PdmField m_summaryImportMode; caf::PdmField m_gridImportMode; diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 4c6253cef5..9c6e6c465f 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -18,6 +18,7 @@ #include "RicSummaryPlotBuilder.h" +#include "PlotTemplateCommands/RicSummaryPlotTemplateTools.h" #include "SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.h" #include "SummaryPlotCommands/RicSummaryPlotFeatureImpl.h" @@ -28,6 +29,7 @@ #include "RifReaderEclipseSummary.h" #include "RifSummaryReaderInterface.h" +#include "RiaPreferencesSummary.h" #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" #include "RimMainPlotCollection.h" @@ -408,6 +410,22 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( const std::vector& cases, const std::vector& ensembles ) { + RiaPreferencesSummary* prefs = RiaPreferencesSummary::current(); + + if ( prefs->defaultSummaryPlotType() == RiaPreferencesSummary::DefaultSummaryPlotType::NONE ) return nullptr; + + if ( prefs->defaultSummaryPlotType() == RiaPreferencesSummary::DefaultSummaryPlotType::PLOT_TEMPLATES ) + { + RimSummaryMultiPlot* plotToSelect = nullptr; + for ( auto& filename : prefs->defaultSummaryPlotTemplates() ) + { + plotToSelect = RicSummaryPlotTemplateTools::create( filename, cases, ensembles ); + } + return plotToSelect; + } + + if ( prefs->defaultSummaryCurvesTextFilter().trimmed().isEmpty() ) return nullptr; + RimProject* project = RimProject::current(); auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake index dcd6e38c2e..226231216b 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake @@ -9,6 +9,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicRenamePlotTemplateFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicEditPlotTemplateFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicDeletePlotTemplateFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicSetAsDefaultTemplateFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -22,6 +23,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicRenamePlotTemplateFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicEditPlotTemplateFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicDeletePlotTemplateFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicSetAsDefaultTemplateFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.cpp index 00fe5f571f..edcf4bf9ce 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.cpp @@ -36,7 +36,7 @@ void RicReloadPlotTemplatesFeature::rebuildFromDisc() RiaPreferences* prefs = RiaPreferences::current(); proj->setPlotTemplateFolders( prefs->plotTemplateFolders() ); - proj->rootPlotTemlateItem()->updateConnectedEditors(); + proj->rootPlotTemplateItem()->updateConnectedEditors(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp index 5168a47983..af4bb71568 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp @@ -36,6 +36,7 @@ CAF_PDM_SOURCE_INIT( RicSelectPlotTemplateUi, "RicSelectPlotTemplateUi" ); /// //-------------------------------------------------------------------------------------------------- RicSelectPlotTemplateUi::RicSelectPlotTemplateUi() + : m_useMultiSelect( false ) { CAF_PDM_InitObject( "RicSelectPlotTemplateUi" ); @@ -44,6 +45,21 @@ RicSelectPlotTemplateUi::RicSelectPlotTemplateUi() m_selectedPlotTemplates.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSelectPlotTemplateUi::setMultiSelectMode( bool multiSelect ) +{ + m_useMultiSelect = multiSelect; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSelectPlotTemplateUi::setInitialSelection( std::vector selectedTemplates ) +{ +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -72,7 +88,7 @@ QList if ( fieldNeedingOptions == &m_selectedPlotTemplates ) { - auto plotTemplateRoot = RimProject::current()->rootPlotTemlateItem(); + auto plotTemplateRoot = RimProject::current()->rootPlotTemplateItem(); RimPlotTemplateFolderItem::appendOptionItemsForPlotTemplates( options, plotTemplateRoot ); } @@ -92,7 +108,7 @@ void RicSelectPlotTemplateUi::defineEditorAttribute( const caf::PdmFieldHandle* auto a = dynamic_cast( attribute ); if ( a ) { - a->singleSelectionMode = true; + a->singleSelectionMode = !m_useMultiSelect; } } } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.h index c8ae4a1663..5bc78eec00 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.h +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.h @@ -22,6 +22,9 @@ #include "cafPdmObject.h" #include "cafPdmPtrArrayField.h" +#include +#include + class RimPlotTemplateFileItem; class RimPlotTemplateFolderItem; @@ -35,6 +38,9 @@ class RicSelectPlotTemplateUi : public caf::PdmObject public: RicSelectPlotTemplateUi(); + void setMultiSelectMode( bool multiSelect ); + void setInitialSelection( std::vector selectedTemplates ); + std::vector selectedPlotTemplates(); private: @@ -47,4 +53,5 @@ class RicSelectPlotTemplateUi : public caf::PdmObject private: caf::PdmPtrArrayField m_selectedPlotTemplates; + bool m_useMultiSelect; }; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.cpp new file mode 100644 index 0000000000..088e03a826 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.cpp @@ -0,0 +1,86 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicSetAsDefaultTemplateFeature.h" + +#include "PlotTemplates/RimPlotTemplateFileItem.h" + +#include "RiaPreferencesSummary.h" + +#include "cafSelectionManager.h" + +#include +#include +#include +#include +#include +#include + +CAF_CMD_SOURCE_INIT( RicSetAsDefaultTemplateFeature, "RicSetAsDefaultTemplateFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicSetAsDefaultTemplateFeature::isCommandEnabled() +{ + return selectedTemplate() != nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSetAsDefaultTemplateFeature::onActionTriggered( bool isChecked ) +{ + RimPlotTemplateFileItem* file = selectedTemplate(); + if ( file == nullptr ) return; + + if ( isChecked ) + RiaPreferencesSummary::current()->addToDefaultPlotTemplates( file->absoluteFilePath() ); + else + RiaPreferencesSummary::current()->removeFromDefaultPlotTemplates( file->absoluteFilePath() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSetAsDefaultTemplateFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Default Template" ); + // actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); + + RimPlotTemplateFileItem* file = selectedTemplate(); + if ( file != nullptr ) + { + actionToSetup->setCheckable( true ); + actionToSetup->setChecked( + RiaPreferencesSummary::current()->isDefaultSummaryPlotTemplate( file->absoluteFilePath() ) ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimPlotTemplateFileItem* RicSetAsDefaultTemplateFeature::selectedTemplate() +{ + std::vector uiItems; + caf::SelectionManager::instance()->selectedItems( uiItems ); + if ( uiItems.size() != 1 ) return nullptr; + + RimPlotTemplateFileItem* file = dynamic_cast( uiItems[0] ); + return file; +} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.h new file mode 100644 index 0000000000..2aa56e6f33 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.h @@ -0,0 +1,39 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +class RimPlotTemplateFileItem; + +//================================================================================================== +/// +//================================================================================================== +class RicSetAsDefaultTemplateFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + +private: + RimPlotTemplateFileItem* selectedTemplate(); +}; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index 665b69c4dd..c0f0a94685 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -175,6 +175,60 @@ RimSummaryMultiPlot* RicSummaryPlotTemplateTools::create( const QString& fileNam return newSummaryPlot; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot* RicSummaryPlotTemplateTools::create( const QString& fileName, + const std::vector& sumCases, + const std::vector& ensembles ) +{ + std::vector wellNames; + std::vector groupNames; + std::vector regions; + + RiaSummaryAddressAnalyzer analyzer; + + if ( !sumCases.empty() ) + { + auto firstCase = sumCases.front(); + + analyzer.appendAddresses( firstCase->summaryReader()->allResultAddresses() ); + } + else if ( !ensembles.empty() ) + { + auto caseCollection = ensembles.front(); + + auto firstCase = caseCollection->firstSummaryCase(); + if ( firstCase != nullptr ) + { + analyzer.appendAddresses( firstCase->summaryReader()->allResultAddresses() ); + } + } + + if ( !analyzer.wellNames().empty() ) + wellNames.push_back( QString::fromStdString( *( analyzer.wellNames().begin() ) ) ); + if ( !analyzer.groupNames().empty() ) + groupNames.push_back( QString::fromStdString( *( analyzer.groupNames().begin() ) ) ); + if ( !analyzer.regionNumbers().empty() ) + regions.push_back( QString::number( *( analyzer.regionNumbers().begin() ) ) ); + + auto proj = RimProject::current(); + auto collections = proj->mainPlotCollection()->summaryMultiPlotCollection(); + + auto newSummaryPlot = RicSummaryPlotTemplateTools::createMultiPlotFromTemplateFile( fileName ); + if ( !newSummaryPlot ) return nullptr; + + collections->addSummaryMultiPlot( newSummaryPlot ); + newSummaryPlot->resolveReferencesRecursively(); + + RicSummaryPlotTemplateTools::setValuesForPlaceholders( newSummaryPlot, sumCases, ensembles, wellNames, groupNames, regions ); + newSummaryPlot->initAfterReadRecursively(); + newSummaryPlot->loadDataAndUpdate(); + collections->updateConnectedEditors(); + + return newSummaryPlot; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -399,6 +453,32 @@ QString RicSummaryPlotTemplateTools::selectPlotTemplatePath() return {}; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RicSummaryPlotTemplateTools::selectDefaultPlotTemplates( std::vector currentSelection ) +{ + RiuPlotMainWindow* plotwindow = RiaGuiApplication::instance()->mainPlotWindow(); + RicSelectPlotTemplateUi ui; + ui.setMultiSelectMode( true ); + ui.setInitialSelection( currentSelection ); + + caf::PdmUiPropertyViewDialog propertyDialog( plotwindow, &ui, "Select Default Plot Templates", "" ); + propertyDialog.resize( QSize( 500, 600 ) ); + + std::vector selection; + + if ( propertyDialog.exec() == QDialog::Accepted && !ui.selectedPlotTemplates().empty() ) + { + for ( auto item : ui.selectedPlotTemplates() ) + { + selection.push_back( item->absoluteFilePath() ); + } + } + + return selection; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h index 9212c3feb0..b6038dbcf2 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.h @@ -34,6 +34,7 @@ class RimSummaryCaseCollection; class RifEclipseSummaryAddress; class RimSummaryMultiPlot; class RimSummaryAddressCollection; +class RimPlotTemplateFileItem; //================================================================================================== /// @@ -43,7 +44,12 @@ class RicSummaryPlotTemplateTools public: static RimSummaryMultiPlot* create( const QString& fileName ); - static QString selectPlotTemplatePath(); + static RimSummaryMultiPlot* create( const QString& fileName, + const std::vector& cases, + const std::vector& ensembles ); + + static QString selectPlotTemplatePath(); + static std::vector selectDefaultPlotTemplates( std::vector currentSelection ); static QString summaryCaseFieldKeyword(); static QString summaryGroupFieldKeyword(); diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 9cf745d131..c7773f1b0d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1028,6 +1028,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicDeletePlotTemplateFeature"; menuBuilder << "RicEditPlotTemplateFeature"; menuBuilder << "Separator"; + menuBuilder << "RicSetAsDefaultTemplateFeature"; + menuBuilder << "Separator"; menuBuilder << "RicReloadPlotTemplatesFeature"; } else if ( dynamic_cast( firstUiItem ) ) diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 393319a60b..af1c343b94 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -1320,7 +1320,7 @@ RimMeasurement* RimProject::measurement() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimPlotTemplateFolderItem* RimProject::rootPlotTemlateItem() const +RimPlotTemplateFolderItem* RimProject::rootPlotTemplateItem() const { return m_plotTemplateTopFolder; } diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index 3e844e7c89..aab3fc169c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -189,7 +189,7 @@ class RimProject : public caf::PdmDocument caf::AppEnum commonUnitSystemForAllCases() const; RimMeasurement* measurement() const; - RimPlotTemplateFolderItem* rootPlotTemlateItem() const; + RimPlotTemplateFolderItem* rootPlotTemplateItem() const; std::vector allFilePaths() const; From 29fdc29eb0d318234b8703fb13a7c5eb11cffffb Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 25 May 2022 10:54:41 +0200 Subject: [PATCH 319/406] #8696 Cell filter: fix for IJ Index polygon for non-intersecting filter points Now the minimum K-layer directly below any of the filter points are used when the filter points does not intersect with the cells. Fixes #8696. --- .../CellFilters/RimPolygonFilter.cpp | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp index b0a3503b12..7fb3d7649b 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp @@ -54,6 +54,8 @@ #include +#include + namespace caf { template <> @@ -902,6 +904,45 @@ int RimPolygonFilter::findEclipseKLayer( const std::vector& points, } } + auto findKLayerBelowPoint = []( const cvf::Vec3d& point, RigMainGrid* mainGrid ) { + // Create a bounding box (ie a ray) from the point down to minimum of grid + cvf::Vec3d lowestPoint( point.x(), point.y(), mainGrid->boundingBox().min().z() ); + + cvf::BoundingBox rayBBox; + rayBBox.add( point ); + rayBBox.add( lowestPoint ); + + // Find the cells intersecting the ray + std::vector allCellIndices; + mainGrid->findIntersectingCells( rayBBox, &allCellIndices ); + + // Get the minimum K layer index + int minK = std::numeric_limits::max(); + bool anyHits = false; + for ( size_t cIdx : allCellIndices ) + { + if ( cIdx != cvf::UNDEFINED_SIZE_T ) + { + size_t ni, nj, nk; + mainGrid->ijkFromCellIndexUnguarded( cIdx, &ni, &nj, &nk ); + if ( mainGrid->isCellValid( ni, nj, nk ) ) + { + anyHits = true; + minK = std::min( minK, static_cast( nk ) ); + } + } + } + + return anyHits ? minK : -1; + }; + + // shoot a ray down from each point to try to find a valid hit there + for ( size_t p = 0; p < points.size() - 1; p++ ) + { + int k = findKLayerBelowPoint( points[p], data->mainGrid() ); + if ( k != -1 ) return k; + } + // loop over all sub-grids to find one with a cell hit in case main grid search failed for ( size_t gridIndex = 1; gridIndex < data->gridCount(); gridIndex++ ) { From a47edd4fa6718081a5472b22c0ef22f2f2707fb1 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 25 May 2022 09:37:34 +0200 Subject: [PATCH 320/406] #8195 Fracture: Show containment also when mesh is off. --- .../RivWellFracturePartMgr.cpp | 34 +++++++++++++++++-- .../RivWellFracturePartMgr.h | 3 ++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp index bbc73d17ee..6727c7b6db 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.cpp @@ -99,6 +99,8 @@ void RivWellFracturePartMgr::appendGeometryPartsToModel( cvf::ModelBasicList* mo if ( stimPlanFracTemplate ) { + createVisibleFracturePolygons( stimPlanFracTemplate, eclView ); + if ( eclView.fractureColors()->stimPlanResultColorType() == RimStimPlanColors::SINGLE_ELEMENT_COLOR ) { auto part = createStimPlanElementColorSurfacePart( eclView ); @@ -1025,6 +1027,36 @@ cvf::ref RivWellFracturePartMgr::createStimPlanMeshPart( const RimEcl return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RivWellFracturePartMgr::createVisibleFracturePolygons( RimStimPlanFractureTemplate* stimPlanFracTemplate, + const RimEclipseView& activeView ) +{ + if ( !m_rimFracture->fractureGrid() ) return; + + std::vector stimPlanCells = m_rimFracture->fractureGrid()->fractureCells(); + + QString resultNameFromColors = activeView.fractureColors()->uiResultName(); + QString resultUnitFromColors = activeView.fractureColors()->unit(); + + std::vector prCellResults = + stimPlanFracTemplate->fractureGridResults( resultNameFromColors, + resultUnitFromColors, + stimPlanFracTemplate->activeTimeStepIndex() ); + + m_visibleFracturePolygons.clear(); + for ( size_t cIdx = 0; cIdx < stimPlanCells.size(); ++cIdx ) + { + if ( prCellResults[cIdx] > 1e-7 ) + { + const RigFractureCell& stimPlanCell = stimPlanCells[cIdx]; + std::vector stimPlanCellPolygon = stimPlanCell.getPolygon(); + m_visibleFracturePolygons.push_back( stimPlanCellPolygon ); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1048,7 +1080,6 @@ cvf::ref resultUnitFromColors, stimPlanFracTemplate->activeTimeStepIndex() ); - m_visibleFracturePolygons.clear(); for ( size_t cIdx = 0; cIdx < stimPlanCells.size(); ++cIdx ) { if ( prCellResults[cIdx] > 1e-7 ) @@ -1059,7 +1090,6 @@ cvf::ref { stimPlanMeshVertices.push_back( static_cast( cellCorner ) ); } - m_visibleFracturePolygons.push_back( stimPlanCellPolygon ); } } diff --git a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.h b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.h index 410368c945..ac9206c4ce 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.h +++ b/ApplicationLibCode/ModelVisualization/RivWellFracturePartMgr.h @@ -82,6 +82,9 @@ class RivWellFracturePartMgr : public cvf::Object cvf::ref createStimPlanMeshDrawable( RimStimPlanFractureTemplate* stimPlanFracTemplate, const RimEclipseView& activeView ); + void createVisibleFracturePolygons( RimStimPlanFractureTemplate* stimPlanFracTemplate, + const RimEclipseView& activeView ); + std::vector fractureBorderPolygon(); static cvf::ref createScalarMapperPart( cvf::DrawableGeo* drawableGeo, From 53af120f397c4d8eadddcd2d2957e567b7da96bc Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 25 May 2022 13:55:13 +0200 Subject: [PATCH 321/406] #2434 Eclipse input property: fix import for keywords without data Keywords without data does not have a trailing '/'. --- .../RifEclipseTextFileReader.cpp | 7 +++++ .../RifEclipseTextFileReader-Test.cpp | 30 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/ApplicationLibCode/FileInterface/RifEclipseTextFileReader.cpp b/ApplicationLibCode/FileInterface/RifEclipseTextFileReader.cpp index d42d186349..a9e3ce0525 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseTextFileReader.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseTextFileReader.cpp @@ -88,6 +88,11 @@ std::pair> { std::vector values; + auto isKeywordWithoutData = []( const std::string& keyword ) { + std::vector keywords = { "ECHO", "NOECHO" }; + return std::find( keywords.begin(), keywords.end(), keyword ) != keywords.end(); + }; + const auto commentChar = '-'; const auto commentString = "--"; @@ -133,7 +138,9 @@ std::pair> { keywordName = line; if ( keywordName == "FAULTS" ) isFaultKeyword = true; + if ( isKeywordWithoutData( keywordName ) ) isEndTokenKeywordRead = true; } + continue; } diff --git a/ApplicationLibCode/UnitTests/RifEclipseTextFileReader-Test.cpp b/ApplicationLibCode/UnitTests/RifEclipseTextFileReader-Test.cpp index dde1ee92c8..f7a56132e6 100644 --- a/ApplicationLibCode/UnitTests/RifEclipseTextFileReader-Test.cpp +++ b/ApplicationLibCode/UnitTests/RifEclipseTextFileReader-Test.cpp @@ -204,3 +204,33 @@ TEST( RifEclipseTextFileReader, ValueMultiplier ) EXPECT_FLOAT_EQ( 0.5f, firstKeyword.values[2] ); EXPECT_FLOAT_EQ( 12345.12f, firstKeyword.values[3] ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( RifEclipseTextFileReader, KeywordsWithoutValue ) +{ + std::string fileContent = "NOECHO\n" + "SWAT\n" + "1.0 2.0 3.0\n" + "/\n" + "SOIL\n" + "6.0 7.0 8.0 9.0\n" + "/\n"; + + auto keywordDataItems = RifEclipseTextFileReader::parseStringData( fileContent ); + + EXPECT_EQ( 3u, keywordDataItems.size() ); + + auto noEchoKeyword = keywordDataItems[0]; + EXPECT_EQ( 0u, noEchoKeyword.values.size() ); + + auto swatKeyword = keywordDataItems[1]; + EXPECT_EQ( 3u, swatKeyword.values.size() ); + + auto soilKeyword = keywordDataItems[2]; + EXPECT_EQ( 4u, soilKeyword.values.size() ); + + EXPECT_FLOAT_EQ( 1.0f, swatKeyword.values[0] ); + EXPECT_FLOAT_EQ( 6.0f, soilKeyword.values[0] ); +} From ff572528127880d542f54c551d0fd94e1132a09c Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Wed, 25 May 2022 21:48:01 +0200 Subject: [PATCH 322/406] Add support for dropping folders in summary plots and multi summary plots --- .../Summary/RimSummaryAddressCollection.cpp | 2 +- .../Summary/RimSummaryMultiPlot.cpp | 15 ++++++++++++- .../Summary/RimSummaryPlot.cpp | 21 +++++++++++++++---- 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index e4c22ff70e..b57801156b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -357,7 +357,7 @@ bool RimSummaryAddressCollection::canBeDragged() const ok = ok && ( m_contentType == CollectionContentType::WELL || m_contentType == CollectionContentType::GROUP || m_contentType == CollectionContentType::REGION ); - return ok; + return ok || isFolder(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index a97caa2a1c..d4b3337c42 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -217,7 +217,20 @@ void RimSummaryMultiPlot::handleDroppedObjects( const std::vector( o ); - if ( adrColl ) addressCollections.push_back( adrColl ); + if ( adrColl ) + { + if ( objects.size() == 1 ) + { + if ( adrColl->isFolder() ) + { + // If a folder is selected, return all sub items in folder + auto childObjects = adrColl->subFolders(); + addressCollections.insert( addressCollections.end(), childObjects.begin(), childObjects.end() ); + } + } + else + addressCollections.push_back( adrColl ); + } auto summaryCase = dynamic_cast( o ); if ( summaryCase ) cases.push_back( summaryCase ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index bc1fc7b833..adb0313a95 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2124,10 +2124,23 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector( obj ); if ( addressCollection ) { - auto [curveCount, curvesCreated] = handleAddressCollectionDrop( addressCollection ); - accumulatedCurveCount += curveCount; - curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() ); - continue; + if ( addressCollection->isFolder() ) + { + for ( auto coll : addressCollection->subFolders() ) + { + auto [curveCount, curvesCreated] = handleAddressCollectionDrop( coll ); + accumulatedCurveCount += curveCount; + curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() ); + } + continue; + } + else + { + auto [curveCount, curvesCreated] = handleAddressCollectionDrop( addressCollection ); + accumulatedCurveCount += curveCount; + curvesToUpdate.insert( curvesToUpdate.end(), curvesCreated.begin(), curvesCreated.end() ); + continue; + } } } From 4a1a2fe2bed5352eb0769aa87b8d74a810d379ad Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 20 May 2022 15:07:48 +0200 Subject: [PATCH 323/406] #8634 Improve performance when deleting multiple wells Disable general framework delete function, and use special well path delete function --- .../WellPathCommands/RicDeleteWellPathFeature.cpp | 1 + .../ProjectDataModel/WellPath/RimWellPath.cpp | 9 +++++++++ .../ProjectDataModel/WellPath/RimWellPath.h | 1 + 3 files changed, 11 insertions(+) diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathFeature.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathFeature.cpp index 8adc133bd0..dce970d968 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathFeature.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicDeleteWellPathFeature.cpp @@ -72,4 +72,5 @@ void RicDeleteWellPathFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setText( "Delete Well Path" ); actionToSetup->setIcon( QIcon( ":/Erase.svg" ) ); + actionToSetup->setShortcut( Qt::Key_Delete ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp index b6844825ca..5bf5f44f50 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp @@ -76,6 +76,15 @@ CAF_PDM_SOURCE_INIT( RimWellPath, "WellPathBase" ); //-------------------------------------------------------------------------------------------------- const char RimWellPath::SIM_WELL_NONE_UI_TEXT[] = "None"; +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimWellPath::isDeletable() const +{ + // Avoid framework functions, as delete is implemented in RicDeleteWellPathFeature + return false; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h index 0cd051badd..07e7ee2c45 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h @@ -175,6 +175,7 @@ class RimWellPath : public caf::PdmObject, public RimWellPathComponentInterface caf::PdmFieldHandle* userDescriptionField() override; caf::PdmFieldHandle* objectToggleField() override; + bool isDeletable() const override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, From 3545d16fbb3387172612b14a53d8b2ee57f0e50d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 25 May 2022 21:40:52 +0200 Subject: [PATCH 324/406] Use set to get unique plots for update --- .../Application/RiaPlotWindowRedrawScheduler.cpp | 11 ++++------- .../Application/RiaPlotWindowRedrawScheduler.h | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp index ffb1ea7881..a26d6080cc 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp @@ -79,7 +79,7 @@ void RiaPlotWindowRedrawScheduler::scheduleMultiPlotPageUpdate( RiuMultiPlotPage //-------------------------------------------------------------------------------------------------- void RiaPlotWindowRedrawScheduler::schedulePlotWidgetReplot( RiuPlotWidget* plotWidget ) { - m_plotWidgetsToReplot.push_back( plotWidget ); + m_plotWidgetsToReplot.insert( plotWidget ); startTimer( 0 ); } @@ -107,15 +107,13 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates() void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() { std::map, RiaDefines::MultiPlotPageUpdateType> plotBooksToUpdate; - std::vector> plotWidgetsToReplot; + std::set> plotWidgetsToReplot; std::map, RiaDefines::MultiPlotPageUpdateType> pagesToUpdate; pagesToUpdate.swap( m_plotPagesToUpdate ); plotBooksToUpdate.swap( m_plotBooksToUpdate ); plotWidgetsToReplot.swap( m_plotWidgetsToReplot ); - std::set> updatedPlots; - for ( auto& [plotBook, updateType] : plotBooksToUpdate ) { if ( plotBook.isNull() ) continue; @@ -137,12 +135,11 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() page->performUpdate( updateType ); } - for ( QPointer plot : plotWidgetsToReplot ) + for ( const QPointer& plot : plotWidgetsToReplot ) { - if ( !plot.isNull() && !updatedPlots.count( plot ) ) + if ( !plot.isNull() ) { plot->replot(); - updatedPlots.insert( plot ); } } } diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h index 9e29d575f9..a3a196d39a 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.h @@ -63,7 +63,7 @@ private slots: std::map, RiaDefines::MultiPlotPageUpdateType> m_plotPagesToUpdate; std::map, RiaDefines::MultiPlotPageUpdateType> m_plotBooksToUpdate; - std::vector> m_plotWidgetsToReplot; + std::set> m_plotWidgetsToReplot; QScopedPointer m_plotWindowUpdateTimer; }; From b17e3813df5bb26857b7a1df7447faf8277e41e4 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 26 May 2022 17:25:17 +0200 Subject: [PATCH 325/406] #8966 Improve performance when changing multiple field values --- .../Summary/RimSummaryCurveCollection.cpp | 19 ++ .../Summary/RimSummaryCurveCollection.h | 3 + .../cafCommand/cafCmdFieldChangeExec.cpp | 165 ++++++++++-------- Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.h | 27 ++- .../cafCommand/cafCmdUiCommandSystemImpl.cpp | 75 +++++--- .../cafPdmCore/cafPdmObjectHandle.h | 2 + .../cafInternalPdmUiFieldCapability.h | 6 +- .../cafInternalPdmUiFieldCapability.inl | 4 +- .../cafPdmUiCommandSystemProxy.cpp | 2 +- .../cafPdmUiCore/cafPdmUiFieldHandle.cpp | 2 +- .../cafPdmUiCore/cafPdmUiFieldHandle.h | 2 +- 11 files changed, 185 insertions(+), 122 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index def9939982..0d81461539 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -121,6 +121,25 @@ void RimSummaryCurveCollection::loadDataAndUpdate( bool updateParentPlot ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCurveCollection::onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, + std::vector& updatedObjects ) +{ + if ( childArray == &m_curves ) + { + for ( RimSummaryCurve* curve : m_curves ) + { + curve->updateCurveAppearance(); + } + + RimSummaryPlot* parentPlot; + firstAncestorOrThisOfTypeAsserted( parentPlot ); + parentPlot->plotWidget()->scheduleReplot(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h index ba1a55eeff..988aea3e02 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.h @@ -99,6 +99,9 @@ class RimSummaryCurveCollection : public caf::PdmObject void onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector& referringObjects ) override; + void onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, + std::vector& updatedObjects ) override; + private: friend class RimSummaryCrossPlot; friend class RimSummaryPlot; diff --git a/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.cpp b/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.cpp index d356a565d3..a11c584b6a 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.cpp +++ b/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.cpp @@ -41,39 +41,38 @@ namespace caf { -CAF_PDM_SOURCE_INIT( CmdFieldChangeExecData, "CmdFieldChangeExecData" ); - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- QString CmdFieldChangeExec::name() { - PdmFieldHandle* field = - PdmReferenceHelper::fieldFromReference( m_commandData->m_rootObject, m_commandData->m_pathToField ); - if ( field ) + if ( !m_commandData->m_pathToFields.empty() ) { - QString fieldText; - - PdmUiFieldHandle* uiFieldHandle = field->uiCapability(); - if ( uiFieldHandle ) + PdmFieldHandle* field = + PdmReferenceHelper::fieldFromReference( m_commandData->m_rootObject, m_commandData->m_pathToFields.front() ); + if ( field ) { - fieldText = QString( "Change field '%1'" ).arg( uiFieldHandle->uiName() ); - } + QString fieldText; - if ( field->ownerObject() ) - { - PdmUiObjectHandle* uiObjHandle = uiObj( field->ownerObject() ); - if ( uiObjHandle ) + PdmUiFieldHandle* uiFieldHandle = field->uiCapability(); + if ( uiFieldHandle ) + { + fieldText = QString( "Change field '%1'" ).arg( uiFieldHandle->uiName() ); + } + + if ( field->ownerObject() ) { - fieldText += QString( " in '%1'" ).arg( uiObjHandle->uiName() ); + PdmUiObjectHandle* uiObjHandle = uiObj( field->ownerObject() ); + if ( uiObjHandle ) + { + fieldText += QString( " in '%1'" ).arg( uiObjHandle->uiName() ); + } } + return fieldText; } - return fieldText; - } - else - { - return m_commandData->classKeyword(); } + + return "Field Changed"; } //-------------------------------------------------------------------------------------------------- @@ -81,53 +80,67 @@ QString CmdFieldChangeExec::name() //-------------------------------------------------------------------------------------------------- void CmdFieldChangeExec::redo() { - PdmFieldHandle* field = - PdmReferenceHelper::fieldFromReference( m_commandData->m_rootObject, m_commandData->m_pathToField ); - if ( !field ) - { - CAF_ASSERT( false ); - return; - } + m_commandData->m_undoFieldValueSerialized.resize( m_commandData->m_pathToFields.size() ); - PdmUiFieldHandle* uiFieldHandle = field->uiCapability(); - PdmXmlFieldHandle* xmlFieldHandle = field->xmlCapability(); - if ( uiFieldHandle && xmlFieldHandle ) + for ( size_t i = 0; i < m_commandData->m_pathToFields.size(); i++ ) { - if ( m_commandData->m_redoFieldValueSerialized.isEmpty() ) - { - // We end up here only when the user actually has done something in the actual living Gui editor. - { - QXmlStreamWriter xmlStream( &m_commandData->m_undoFieldValueSerialized ); - writeFieldDataToValidXmlDocument( xmlStream, xmlFieldHandle ); - } + auto fieldTextPath = m_commandData->m_pathToFields[i]; - // This function will notify field change, no need to explicitly call notification - // The ui value might be an index into the option entry cache, so we need to set the value - // and be aware of the option entries, and then serialize the actual field value we ended up with. + PdmFieldHandle* field = PdmReferenceHelper::fieldFromReference( m_commandData->m_rootObject, fieldTextPath ); + if ( !field ) continue; - uiFieldHandle->setValueFromUiEditor( m_commandData->m_newUiValue ); + PdmUiFieldHandle* uiFieldHandle = field->uiCapability(); + PdmXmlFieldHandle* xmlFieldHandle = field->xmlCapability(); + if ( uiFieldHandle && xmlFieldHandle ) + { + bool isLastField = ( i == m_commandData->m_pathToFields.size() - 1 ); + if ( m_commandData->m_undoFieldValueSerialized[i].isEmpty() ) { - QXmlStreamWriter xmlStream( &m_commandData->m_redoFieldValueSerialized ); - writeFieldDataToValidXmlDocument( xmlStream, xmlFieldHandle ); + // We end up here only when the user actually has done something in the actual living Gui editor. + { + QXmlStreamWriter xmlStream( &m_commandData->m_undoFieldValueSerialized[i] ); + writeFieldDataToValidXmlDocument( xmlStream, xmlFieldHandle ); + } + + // This function will notify field change, no need to explicitly call notification + // The ui value might be an index into the option entry cache, so we need to set the value + // and be aware of the option entries, and then serialize the actual field value we ended up with. + + uiFieldHandle->setValueFromUiEditor( m_commandData->m_newUiValue, isLastField ); + + if ( m_commandData->m_redoFieldValueSerialized.isEmpty() ) + { + QXmlStreamWriter xmlStream( &m_commandData->m_redoFieldValueSerialized ); + writeFieldDataToValidXmlDocument( xmlStream, xmlFieldHandle ); + } } - } - else - { - QVariant oldFieldData = uiFieldHandle->toUiBasedQVariant(); + else + { + QVariant oldFieldData = uiFieldHandle->toUiBasedQVariant(); - QXmlStreamReader xmlStream( m_commandData->m_redoFieldValueSerialized ); + QXmlStreamReader xmlStream( m_commandData->m_redoFieldValueSerialized ); - readFieldValueFromValidXmlDocument( xmlStream, xmlFieldHandle ); + readFieldValueFromValidXmlDocument( xmlStream, xmlFieldHandle ); - QVariant newFieldData = uiFieldHandle->toUiBasedQVariant(); + QVariant newFieldData = uiFieldHandle->toUiBasedQVariant(); - // New data is present in field, notify data changed - uiFieldHandle->notifyFieldChanged( oldFieldData, newFieldData ); + // New data is present in field, notify data changed + if ( isLastField ) + { + uiFieldHandle->notifyFieldChanged( oldFieldData, newFieldData ); + if ( m_notificationCenter ) + m_notificationCenter->notifyObserversOfDataChange( field->ownerObject() ); + } + } } } - if ( m_notificationCenter ) m_notificationCenter->notifyObserversOfDataChange( field->ownerObject() ); + if ( m_commandData->m_ownerOfChildArrayField && m_commandData->m_childArrayFieldHandle ) + { + std::vector objs; + m_commandData->m_ownerOfChildArrayField->onChildrenUpdated( m_commandData->m_childArrayFieldHandle, objs ); + } } //-------------------------------------------------------------------------------------------------- @@ -135,30 +148,40 @@ void CmdFieldChangeExec::redo() //-------------------------------------------------------------------------------------------------- void CmdFieldChangeExec::undo() { - PdmFieldHandle* field = - PdmReferenceHelper::fieldFromReference( m_commandData->m_rootObject, m_commandData->m_pathToField ); - if ( !field ) + for ( size_t i = 0; i < m_commandData->m_pathToFields.size(); i++ ) { - CAF_ASSERT( false ); - return; - } + auto fieldTextPath = m_commandData->m_pathToFields[i]; - PdmUiFieldHandle* uiFieldHandle = field->uiCapability(); - PdmXmlFieldHandle* xmlFieldHandle = field->xmlCapability(); - if ( uiFieldHandle && xmlFieldHandle ) - { - QXmlStreamReader xmlStream( m_commandData->m_undoFieldValueSerialized ); - QVariant oldFieldData = uiFieldHandle->toUiBasedQVariant(); + PdmFieldHandle* field = PdmReferenceHelper::fieldFromReference( m_commandData->m_rootObject, fieldTextPath ); + if ( !field ) continue; - readFieldValueFromValidXmlDocument( xmlStream, xmlFieldHandle ); + PdmUiFieldHandle* uiFieldHandle = field->uiCapability(); + PdmXmlFieldHandle* xmlFieldHandle = field->xmlCapability(); + if ( uiFieldHandle && xmlFieldHandle ) + { + bool isLastField = ( i == m_commandData->m_pathToFields.size() - 1 ); - QVariant newFieldData = uiFieldHandle->toUiBasedQVariant(); + QXmlStreamReader xmlStream( m_commandData->m_undoFieldValueSerialized[i] ); + QVariant oldFieldData = uiFieldHandle->toUiBasedQVariant(); - // New data is present in field, notify data changed - uiFieldHandle->notifyFieldChanged( oldFieldData, newFieldData ); + readFieldValueFromValidXmlDocument( xmlStream, xmlFieldHandle ); + + QVariant newFieldData = uiFieldHandle->toUiBasedQVariant(); + + // New data is present in field, notify data changed + if ( isLastField ) + { + uiFieldHandle->notifyFieldChanged( oldFieldData, newFieldData ); + if ( m_notificationCenter ) m_notificationCenter->notifyObserversOfDataChange( field->ownerObject() ); + } + } } - if ( m_notificationCenter ) m_notificationCenter->notifyObserversOfDataChange( field->ownerObject() ); + if ( m_commandData->m_ownerOfChildArrayField && m_commandData->m_childArrayFieldHandle ) + { + std::vector objs; + m_commandData->m_ownerOfChildArrayField->onChildrenUpdated( m_commandData->m_childArrayFieldHandle, objs ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.h b/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.h index e21c07ebee..3c4014aed2 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.h +++ b/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.h @@ -40,35 +40,32 @@ #include "cafPdmField.h" #include "cafPdmObject.h" +#include + namespace caf { -class PdmChildArrayFieldHandle; - //================================================================================================== /// //================================================================================================== -class CmdFieldChangeExecData : public PdmObject +class CmdFieldChangeExecData { - CAF_PDM_HEADER_INIT; - public: CmdFieldChangeExecData() + : m_rootObject( nullptr ) + , m_childArrayFieldHandle( nullptr ) + , m_ownerOfChildArrayField( nullptr ) { - CAF_PDM_InitObject( "CmdFieldChangeExecData uiName", - "", - "CmdFieldChangeExecData tooltip", - "CmdFieldChangeExecData whatsthis" ); - - CAF_PDM_InitField( &m_pathToField, "PathToField", QString(), "PathToField", "", "PathToField tooltip", "PathToField whatsthis" ); } caf::PdmPointer m_rootObject; + PdmChildArrayFieldHandle* m_childArrayFieldHandle; + PdmObjectHandle* m_ownerOfChildArrayField; - PdmField m_pathToField; - QVariant m_newUiValue; // QVariant coming from the UI + std::vector m_pathToFields; + std::vector m_undoFieldValueSerialized; - QString m_undoFieldValueSerialized; - QString m_redoFieldValueSerialized; + QVariant m_newUiValue; + QString m_redoFieldValueSerialized; }; //================================================================================================== diff --git a/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.cpp b/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.cpp index 34fd552843..6019d1c3c2 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.cpp +++ b/Fwk/AppFwk/cafCommand/cafCmdUiCommandSystemImpl.cpp @@ -40,10 +40,10 @@ #include "cafCmdExecuteCommand.h" #include "cafCmdFeatureManager.h" #include "cafCmdFieldChangeExec.h" - +#include "cafPdmChildArrayField.h" #include "cafPdmFieldHandle.h" +#include "cafPdmObjectHandle.h" #include "cafPdmUiObjectHandle.h" - #include "cafSelectionManager.h" #include @@ -71,45 +71,64 @@ void CmdUiCommandSystemImpl::fieldChangedCommand( const std::vector commands; - for ( size_t i = 0; i < fieldsToUpdate.size(); i++ ) + PdmChildArrayFieldHandle* childArrayFieldHandle = nullptr; + PdmObjectHandle* ownerOfChildArrayField = nullptr; + PdmObjectHandle* rootObjHandle = nullptr; + + auto firstField = fieldsToUpdate.front(); + if ( firstField ) + { + // Find the first childArrayField by traversing parent field and objects. Usually, the childArrayField is + // the parent, but in some cases when we change fields in a sub-object of the object we need to traverse + // more levels + + ownerOfChildArrayField = firstField->ownerObject(); + while ( ownerOfChildArrayField ) + { + if ( ownerOfChildArrayField->parentField() ) + { + childArrayFieldHandle = + dynamic_cast( ownerOfChildArrayField->parentField() ); + ownerOfChildArrayField = ownerOfChildArrayField->parentField()->ownerObject(); + + if ( childArrayFieldHandle && ownerOfChildArrayField ) break; + } + else + { + ownerOfChildArrayField = nullptr; + } + } + + rootObjHandle = PdmReferenceHelper::findRoot( firstField ); + } + + std::vector pathsToFields; + for ( caf::PdmFieldHandle* field : fieldsToUpdate ) { - PdmFieldHandle* field = fieldsToUpdate[i]; PdmUiFieldHandle* uiFieldHandle = field->uiCapability(); if ( uiFieldHandle ) { QVariant fieldCurrentUiValue = uiFieldHandle->uiValue(); - if ( fieldCurrentUiValue != newUiValue ) { - PdmObjectHandle* rootObjHandle = PdmReferenceHelper::findRoot( field ); - - QString reference = PdmReferenceHelper::referenceFromRootToField( rootObjHandle, field ); - if ( reference.isEmpty() ) + QString pathToField = PdmReferenceHelper::referenceFromRootToField( rootObjHandle, field ); + if ( !pathToField.isEmpty() ) { - CAF_ASSERT( false ); - return; + pathsToFields.push_back( pathToField ); } - - CmdFieldChangeExec* fieldChangeExec = - new CmdFieldChangeExec( SelectionManager::instance()->notificationCenter() ); - - fieldChangeExec->commandData()->m_newUiValue = newUiValue; - fieldChangeExec->commandData()->m_pathToField = reference; - fieldChangeExec->commandData()->m_rootObject = rootObjHandle; - - commands.push_back( fieldChangeExec ); } } } - if ( commands.size() == 1 ) - { - CmdExecCommandManager::instance()->processExecuteCommand( commands[0] ); - } - else - { - CmdExecCommandManager::instance()->processExecuteCommandsAsMacro( commands ); - } + auto* fieldChangeExec = new CmdFieldChangeExec( SelectionManager::instance()->notificationCenter() ); + + fieldChangeExec->commandData()->m_newUiValue = newUiValue; + fieldChangeExec->commandData()->m_pathToFields = pathsToFields; + fieldChangeExec->commandData()->m_rootObject = rootObjHandle; + fieldChangeExec->commandData()->m_ownerOfChildArrayField = ownerOfChildArrayField; + fieldChangeExec->commandData()->m_childArrayFieldHandle = childArrayFieldHandle; + + CmdExecCommandManager::instance()->processExecuteCommand( fieldChangeExec ); } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h index 92f76559e6..ca91c5ffb9 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h @@ -107,6 +107,8 @@ class PdmObjectHandle : public SignalObserver, public SignalEmitter std::vector& referringObjects ); virtual void onChildAdded( caf::PdmFieldHandle* containerForNewObject ){}; + virtual void onChildrenUpdated( PdmChildArrayFieldHandle* childArray, + std::vector& updatedObjects ){}; virtual void handleDroppedMimeData( const QMimeData* data, Qt::DropAction action, caf::PdmFieldHandle* destinationField ){}; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.h index 9a056a283c..9f9550805a 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.h @@ -17,7 +17,7 @@ class PdmFieldUiCap : public PdmUiFieldHandle // Gui generalized interface public: QVariant uiValue() const override; - void setValueFromUiEditor( const QVariant& uiValue ) override; + void setValueFromUiEditor( const QVariant& uiValue, bool notifyFieldChanged ) override; QList valueOptions( bool* useOptionsOnly ) const override; QVariant toUiBasedQVariant() const override; @@ -48,7 +48,7 @@ class PdmFieldUiCap> : public PdmUiFieldHandle // Gui generalized interface public: QVariant uiValue() const override { return QVariant(); } - void setValueFromUiEditor( const QVariant& uiValue ) override {} + void setValueFromUiEditor( const QVariant& uiValue, bool notifyFieldChanged ) override {} QList valueOptions( bool* useOptionsOnly ) const override { return QList(); } QVariant toUiBasedQVariant() const override { return QVariant(); } @@ -71,7 +71,7 @@ class PdmFieldUiCap> : public PdmUiFieldHandle // Gui generalized interface public: QVariant uiValue() const override { return QVariant(); } - void setValueFromUiEditor( const QVariant& uiValue ) override {} + void setValueFromUiEditor( const QVariant& uiValue, bool notifyFieldChanged ) override {} QList valueOptions( bool* useOptionsOnly ) const override { return QList(); } QVariant toUiBasedQVariant() const override { return QVariant(); } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl index 7226659747..b34ee15a6f 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl @@ -14,7 +14,7 @@ namespace caf //-------------------------------------------------------------------------------------------------- template -void PdmFieldUiCap::setValueFromUiEditor( const QVariant& uiValue ) +void PdmFieldUiCap::setValueFromUiEditor( const QVariant& uiValue, bool notifyFieldChanged ) { QVariant oldUiBasedQVariant = toUiBasedQVariant(); @@ -100,7 +100,7 @@ void PdmFieldUiCap::setValueFromUiEditor( const QVariant& uiValue ) QVariant newUiBasedQVariant = toUiBasedQVariant(); - this->notifyFieldChanged( oldUiBasedQVariant, newUiBasedQVariant ); + if ( notifyFieldChanged ) this->notifyFieldChanged( oldUiBasedQVariant, newUiBasedQVariant ); } //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp index 0fd4b8feb4..eb692471c4 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp @@ -114,7 +114,7 @@ void PdmUiCommandSystemProxy::setUiValueToField( PdmUiFieldHandle* uiFieldHandle for ( auto fieldHandle : fieldsToUpdate ) { - fieldHandle->uiCapability()->setValueFromUiEditor( newUiValue ); + fieldHandle->uiCapability()->setValueFromUiEditor( newUiValue, true ); } } } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp index c6593b2e0f..b620d72080 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp @@ -124,7 +124,7 @@ void PdmUiFieldHandle::setAutoAddingOptionFromValue( bool isAddingValue ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void PdmUiFieldHandle::setValueFromUiEditor( const QVariant& uiValue ) +void PdmUiFieldHandle::setValueFromUiEditor( const QVariant& uiValue, bool notifyFieldChanged ) { } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.h index c5707f65e4..ee6466a6d8 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.h @@ -30,7 +30,7 @@ class PdmUiFieldHandle : public PdmUiItem, public PdmFieldCapability, public Pdm private: friend class PdmUiCommandSystemProxy; friend class CmdFieldChangeExec; - virtual void setValueFromUiEditor( const QVariant& uiValue ); + virtual void setValueFromUiEditor( const QVariant& uiValue, bool notifyFieldChanged ); // This is needed to handle custom types in QVariants since operator == between QVariant does not work when they use // custom types. virtual bool isQVariantDataEqual( const QVariant& oldUiBasedQVariant, const QVariant& newUiBasedQVariant ) const; From a511bfd72240902f9612c7b1828bb9199fadb9f5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 26 May 2022 17:44:07 +0200 Subject: [PATCH 326/406] #8952 Only include fields to be modified for sub items on/off Only one fieldChanged is issued, and make sure that all fields in the selection will change state. If state is not changed for the last field, no notification will happen. --- .../Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp index b4f3c85e67..878191d89d 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsFeatureImpl.cpp @@ -204,6 +204,10 @@ std::vector*> RicToggleItemsFeatureImpl::findToggleFieldsFro if ( uiObjectHandleChild && uiObjectHandleChild->objectToggleField() ) { auto* field = dynamic_cast*>( uiObjectHandleChild->objectToggleField() ); + if ( !field ) continue; + + if ( state == SelectionToggleType::TOGGLE_ON && field->value() ) continue; + if ( state == SelectionToggleType::TOGGLE_OFF && !field->value() ) continue; fields.emplace_back( field ); } From ab2a7254f8cfbe2ef044d735c439e18c88997d29 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 26 May 2022 17:47:09 +0200 Subject: [PATCH 327/406] #8964 Avoid message box for PVT and Rel Perm issues Log warning message to log window instead of a dialog Improve text --- .../Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.cpp | 2 +- .../ReservoirDataModel/RigFlowDiagSolverInterface.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.cpp index 4929374d23..6bfa01c2d6 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSplitMultiPlotFeature.cpp @@ -86,7 +86,7 @@ void RicSplitMultiPlotFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicSplitMultiPlotFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText( "Split" ); + actionToSetup->setText( "Split Into Single Curve Plots" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp index 685f689128..8cd3b4590c 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigFlowDiagSolverInterface.cpp @@ -607,7 +607,7 @@ void RigFlowDiagSolverInterface::reportRelPermCurveError( const QString& message { if ( m_relpermCurveErrorCount == 0 ) { - RiaLogging::errorInMessageBox( nullptr, "ResInsight", "RelPerm curve problems: \n" + message ); + RiaLogging::warning( "RelPerm curve problems: \n" + message ); } m_relpermCurveErrorCount++; } @@ -619,7 +619,7 @@ void RigFlowDiagSolverInterface::reportPvtCurveError( const QString& message ) { if ( m_pvtCurveErrorCount == 0 ) { - RiaLogging::errorInMessageBox( nullptr, "ResInsight", "PVT curve problems: \n" + message ); + RiaLogging::warning( "PVT curve problems: \n" + message ); } m_pvtCurveErrorCount++; } From 247d1bb338bd2b0181521d307b5639ccedc0b621 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 26 May 2022 21:17:21 +0200 Subject: [PATCH 328/406] Allow PropertyView panels to be resized horizontally --- Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp index 5d24a80e8e..598e750fd8 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp @@ -53,7 +53,7 @@ QVerticalScrollArea::QVerticalScrollArea( QWidget* parent ) : QScrollArea( parent ) { setWidgetResizable( true ); - setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); + setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded ); setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded ); } @@ -65,6 +65,7 @@ QSize QVerticalScrollArea::sizeHint() const QSize widgetSize = widget()->sizeHint(); QSize scrollSize = QScrollArea::sizeHint(); scrollSize.setWidth( widgetSize.width() + verticalScrollBar()->width() ); + return scrollSize; } @@ -73,9 +74,9 @@ QSize QVerticalScrollArea::sizeHint() const //-------------------------------------------------------------------------------------------------- QSize QVerticalScrollArea::minimumSizeHint() const { - QSize widgetSize = widget()->minimumSizeHint(); QSize scrollSize = QScrollArea::minimumSizeHint(); - scrollSize.setWidth( widgetSize.width() + verticalScrollBar()->width() ); + scrollSize.setWidth( 10 ); + return scrollSize; } From ad66b4674a64dfe12edc4b64d8913448c37bfad3 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 26 May 2022 21:24:03 +0200 Subject: [PATCH 329/406] Bump version to 2021.10.3-dev.05 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index bb9fad6d8c..7d98a7e1eb 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".04") +set(RESINSIGHT_DEV_VERSION ".05") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From a48ad22d0aac30630e8f2396ed673de7febaf938 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 27 May 2022 07:53:51 +0200 Subject: [PATCH 330/406] Preferences: Avoid calling update on top level RimProject on close --- ApplicationLibCode/Application/RiaApplication.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 0f84a80d94..8b6a5b3e39 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -40,6 +40,7 @@ #include "RicfCommandObject.h" #include "CommandRouter/RimCommandRouter.h" +#include "PlotTemplates/RimPlotTemplateFolderItem.h" #include "Rim2dIntersectionViewCollection.h" #include "RimAnnotationCollection.h" #include "RimAnnotationInViewCollection.h" @@ -65,6 +66,7 @@ #include "RimOilField.h" #include "RimPlotWindow.h" #include "RimProject.h" +#include "RimScriptCollection.h" #include "RimSimWellInViewCollection.h" #include "RimStimPlanColors.h" #include "RimStimPlanModel.h" @@ -1223,7 +1225,9 @@ void RiaApplication::applyPreferences() { this->project()->setScriptDirectories( m_preferences->scriptDirectories() ); this->project()->setPlotTemplateFolders( m_preferences->plotTemplateFolders() ); - this->project()->updateConnectedEditors(); + + project()->scriptCollection()->updateConnectedEditors(); + project()->rootPlotTemplateItem()->updateConnectedEditors(); } caf::ProgressInfoStatic::setEnabled( RiaPreferencesSystem::current()->showProgressBar() ); From 5c224241e12b67f87d51fc5044579483b1d99eda Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 27 May 2022 11:22:18 +0200 Subject: [PATCH 331/406] #8892 Allan Diagram: Show formation data for all time steps --- .../ReservoirDataModel/RigResultAccessorFactory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigResultAccessorFactory.cpp b/ApplicationLibCode/ReservoirDataModel/RigResultAccessorFactory.cpp index 1957a8d0cc..c510fba1ab 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigResultAccessorFactory.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigResultAccessorFactory.cpp @@ -96,7 +96,8 @@ cvf::ref RigResultAccessorFactory::createFromResultAddress( c size_t adjustedTimeStepIndex = timeStepIndex; if ( resVarAddr.resultCatType() == RiaDefines::ResultCatType::STATIC_NATIVE || - resVarAddr.resultCatType() == RiaDefines::ResultCatType::FORMATION_NAMES ) + resVarAddr.resultCatType() == RiaDefines::ResultCatType::FORMATION_NAMES || + resVarAddr.resultCatType() == RiaDefines::ResultCatType::ALLAN_DIAGRAMS ) { adjustedTimeStepIndex = 0; } From c9aa9285d2aa2128268492e7e8099109f1da02c9 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 27 May 2022 10:20:09 +0200 Subject: [PATCH 332/406] #8900 Summary Data: fix error in h5-data for time scale above 250 years The usual implementation of chrono::system_clock::to_time_t() uses nanoseconds which will overflow on data with long time spans. Fixed by lowering resolution to seconds, and adding custom conversion method. Fixes #8900. --- .../FileInterface/RifHdf5SummaryReader.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifHdf5SummaryReader.cpp b/ApplicationLibCode/FileInterface/RifHdf5SummaryReader.cpp index 42ecef91ac..d7f558f089 100644 --- a/ApplicationLibCode/FileInterface/RifHdf5SummaryReader.cpp +++ b/ApplicationLibCode/FileInterface/RifHdf5SummaryReader.cpp @@ -90,24 +90,24 @@ std::vector RifHdf5SummaryReader::timeSteps() const double time_unit = 24 * 3600; using namespace std::chrono; - using TP = time_point; using DoubSec = duration; + using TP = time_point; auto timeDeltasInDays = values( "TIME" ); - std::vector timePoints; + // Add custom method to convert from time_point to time_t. The usual implementation of + // chrono::system_clock::to_time_t() uses nanoseconds which will overflow on data with + // long time spans. + auto convertTimePointToTimeT = []( const TP& value ) { + return std::chrono::duration_cast( value.time_since_epoch() ).count(); + }; - TP startDat = std::chrono::system_clock::from_time_t( startDate() ); + auto startDat = std::chrono::system_clock::from_time_t( startDate() ); - timePoints.reserve( timeDeltasInDays.size() ); for ( const auto& t : timeDeltasInDays ) { - timePoints.push_back( startDat + duration_cast( DoubSec( t * time_unit ) ) ); - } - - for ( const auto& d : timePoints ) - { - auto timeAsTimeT = std::chrono::system_clock::to_time_t( d ); + TP timePoint = startDat + duration_cast( DoubSec( t * time_unit ) ); + std::time_t timeAsTimeT = convertTimePointToTimeT( timePoint ); times.push_back( timeAsTimeT ); } From 2a57adf222ec69ee647e3f9e177a534f66be86f3 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 27 May 2022 12:08:39 +0200 Subject: [PATCH 333/406] Make sure we create multiple plots if we import multiple summary cases at once. --- .../Commands/RicImportSummaryCasesFeature.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp index 34d173bf71..50e834532f 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp @@ -135,12 +135,16 @@ bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles( const QStr addSummaryCases( *cases ); if ( !cases->empty() && doCreateDefaultPlot ) { - auto objectToSelect = RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( { cases->back() }, {} ); + RimSummaryMultiPlot* plotToSelect = nullptr; + for ( auto sumCase : *cases ) + { + plotToSelect = RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( { sumCase }, {} ); + } - if ( objectToSelect ) + if ( plotToSelect ) { - RiuPlotMainWindowTools::setExpanded( objectToSelect ); - RiuPlotMainWindowTools::selectAsCurrentItem( objectToSelect ); + RiuPlotMainWindowTools::setExpanded( plotToSelect ); + RiuPlotMainWindowTools::selectAsCurrentItem( plotToSelect ); } } From f0ce04597d94bc5f7b30aac732cdce5adac4fdbb Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 29 May 2022 13:01:27 +0200 Subject: [PATCH 334/406] Merge pull request #8985 from OPM/8926-remove-useoptionsonly AppFwk : Remove obsolete useOptionsOnly --- .../Application/RiaMemoryCleanup.cpp | 3 +-- .../Application/RiaMemoryCleanup.h | 5 ++-- .../Application/RiaPreferences.cpp | 4 +--- .../Application/RiaPreferences.h | 3 +-- .../Application/RiaPreferencesSummary.cpp | 4 +--- .../Application/RiaPreferencesSummary.h | 3 +-- .../Application/RiaPreferencesSystem.cpp | 4 +--- .../Application/RiaPreferencesSystem.h | 3 +-- .../RicCaseAndFileExportSettingsUi.cpp | 3 +-- .../RicCaseAndFileExportSettingsUi.h | 3 +-- .../RicExportCompletionDataSettingsUi.cpp | 5 ++-- .../RicExportCompletionDataSettingsUi.h | 3 +-- .../ExportCommands/RicCellRangeUi.cpp | 5 +--- .../Commands/ExportCommands/RicCellRangeUi.h | 3 +-- .../ExportCommands/RicExportCarfinUi.cpp | 3 +-- .../ExportCommands/RicExportCarfinUi.h | 3 +-- .../RicExportEclipseSectorModelUi.cpp | 3 +-- .../RicExportEclipseSectorModelUi.h | 3 +-- .../ExportCommands/RicExportLgrUi.cpp | 3 +-- .../Commands/ExportCommands/RicExportLgrUi.h | 3 +-- .../Commands/FlowCommands/RicSelectViewUI.cpp | 3 +-- .../Commands/FlowCommands/RicSelectViewUI.h | 3 +-- ...RicCreateMultipleFracturesOptionItemUi.cpp | 3 +-- .../RicCreateMultipleFracturesOptionItemUi.h | 3 +-- .../RicCreateMultipleFracturesUi.cpp | 3 +-- .../RicCreateMultipleFracturesUi.h | 3 +-- .../RicSaturationPressureUi.cpp | 3 +-- .../RicSaturationPressureUi.h | 3 +-- .../RicHoloLensExportToFolderUi.cpp | 2 +- .../RicHoloLensExportToFolderUi.h | 3 +-- .../RicSelectPlotTemplateUi.cpp | 3 +-- .../RicSelectPlotTemplateUi.h | 3 +-- .../Commands/RicCreateEnsembleSurfaceUi.cpp | 2 +- .../Commands/RicCreateEnsembleSurfaceUi.h | 3 +-- .../Commands/RicCreateEnsembleWellLogUi.cpp | 2 +- .../Commands/RicCreateEnsembleWellLogUi.h | 3 +-- .../Commands/RicUserDefinedCalculatorUi.cpp | 2 +- .../Commands/RicUserDefinedCalculatorUi.h | 3 +-- ...icPasteAsciiDataToSummaryPlotFeatureUi.cpp | 3 +-- .../RicPasteAsciiDataToSummaryPlotFeatureUi.h | 3 +-- .../RicSelectSummaryPlotUI.cpp | 3 +-- .../RicSelectSummaryPlotUI.h | 3 +-- .../RicSummaryPlotEditorUi.cpp | 3 +-- .../RicSummaryPlotEditorUi.h | 3 +-- .../ViewLink/RicLinkVisibleViewsFeatureUi.cpp | 3 +-- .../ViewLink/RicLinkVisibleViewsFeatureUi.h | 3 +-- .../RicCreateMultipleWellPathLateralsUi.cpp | 3 +-- .../RicCreateMultipleWellPathLateralsUi.h | 3 +-- .../RicWellPathsUnitSystemSettingsUi.cpp | 3 +-- .../RicWellPathsUnitSystemSettingsUi.h | 3 +-- .../AnalysisPlots/RimAnalysisPlot.cpp | 5 ++-- .../AnalysisPlots/RimAnalysisPlot.h | 3 +-- .../AnalysisPlots/RimPlotDataFilterItem.cpp | 3 +-- .../AnalysisPlots/RimPlotDataFilterItem.h | 3 +-- .../Annotations/RimPolylineTarget.cpp | 3 +-- .../Annotations/RimPolylineTarget.h | 3 +-- .../CellFilters/RimCellFilter.cpp | 5 +--- .../CellFilters/RimCellFilter.h | 3 +-- .../CellFilters/RimPropertyFilter.cpp | 5 +--- .../CellFilters/RimPropertyFilter.h | 3 +-- .../RimEllipseFractureTemplate.cpp | 2 +- .../Completions/RimEllipseFractureTemplate.h | 3 +-- .../RimEnsembleFractureStatistics.cpp | 3 +-- .../RimEnsembleFractureStatistics.h | 3 +-- .../Completions/RimFracture.cpp | 3 +-- .../Completions/RimFracture.h | 3 +-- .../Completions/RimFractureExportSettings.cpp | 2 +- .../Completions/RimFractureExportSettings.h | 3 +-- .../Completions/RimSimWellFracture.cpp | 5 ++-- .../Completions/RimSimWellFracture.h | 3 +-- .../RimStimPlanFractureTemplate.cpp | 2 +- .../Completions/RimStimPlanFractureTemplate.h | 3 +-- .../Completions/RimValveTemplate.cpp | 3 +-- .../Completions/RimValveTemplate.h | 3 +-- .../Completions/RimWellPathValve.cpp | 3 +-- .../Completions/RimWellPathValve.h | 3 +-- .../RimAbstractCorrelationPlot.cpp | 4 ++-- .../RimAbstractCorrelationPlot.h | 3 +-- .../RimCorrelationMatrixPlot.cpp | 6 ++--- .../RimCorrelationMatrixPlot.h | 3 +-- .../CorrelationPlots/RimCorrelationPlot.cpp | 6 ++--- .../CorrelationPlots/RimCorrelationPlot.h | 3 +-- .../RimCorrelationReportPlot.cpp | 5 ++-- .../RimCorrelationReportPlot.h | 5 ++-- .../RimParameterResultCrossPlot.cpp | 5 ++-- .../RimParameterResultCrossPlot.h | 3 +-- .../Faults/RimFaultRAPreprocSettings.cpp | 2 +- .../Faults/RimFaultRAPreprocSettings.h | 3 +-- .../Faults/RimFaultRASettings.cpp | 3 +-- .../Faults/RimFaultRASettings.h | 3 +-- .../Flow/RimFlowCharacteristicsPlot.cpp | 2 +- .../Flow/RimFlowCharacteristicsPlot.h | 3 +-- .../Flow/RimWellAllocationPlot.cpp | 3 +-- .../Flow/RimWellAllocationPlot.h | 3 +-- .../Flow/RimWellDistributionPlot.cpp | 5 ++-- .../Flow/RimWellDistributionPlot.h | 3 +-- .../RimWellDistributionPlotCollection.cpp | 5 ++-- .../Flow/RimWellDistributionPlotCollection.h | 3 +-- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 5 ++-- .../ProjectDataModel/Flow/RimWellPltPlot.h | 3 +-- .../Flow/RimWellRftEnsembleCurveSet.cpp | 2 +- .../Flow/RimWellRftEnsembleCurveSet.h | 3 +-- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 10 ++++---- .../ProjectDataModel/Flow/RimWellRftPlot.h | 3 +-- .../GeoMech/RimGeoMechCase.cpp | 5 ++-- .../ProjectDataModel/GeoMech/RimGeoMechCase.h | 3 +-- .../RimGeoMechContourMapProjection.cpp | 3 +-- .../GeoMech/RimGeoMechContourMapProjection.h | 3 +-- .../GeoMech/RimGeoMechResultDefinition.cpp | 3 +-- .../GeoMech/RimGeoMechResultDefinition.h | 3 +-- .../RimGridCrossPlotDataSet.cpp | 3 +-- .../GridCrossPlots/RimGridCrossPlotDataSet.h | 3 +-- .../RimExtrudedCurveIntersection.cpp | 5 ++-- .../RimExtrudedCurveIntersection.h | 3 +-- .../Intersections/RimIntersection.cpp | 3 +-- .../Intersections/RimIntersection.h | 3 +-- .../RimIntersectionResultDefinition.cpp | 3 +-- .../RimIntersectionResultDefinition.h | 3 +-- .../Rim2dIntersectionView.cpp | 3 +-- .../ProjectDataModel/Rim2dIntersectionView.h | 3 +-- .../ProjectDataModel/Rim3dView.cpp | 3 +-- .../ProjectDataModel/Rim3dView.h | 3 +-- .../RimAdvancedSnapshotExportDefinition.cpp | 5 +--- .../RimAdvancedSnapshotExportDefinition.h | 3 +-- .../ProjectDataModel/RimCase.cpp | 3 +-- ApplicationLibCode/ProjectDataModel/RimCase.h | 3 +-- .../ProjectDataModel/RimCellEdgeColors.cpp | 5 +--- .../ProjectDataModel/RimCellEdgeColors.h | 3 +-- .../RimCustomObjectiveFunctionWeight.cpp | 3 +-- .../RimCustomObjectiveFunctionWeight.h | 3 +-- .../ProjectDataModel/RimDepthTrackPlot.cpp | 6 ++--- .../ProjectDataModel/RimDepthTrackPlot.h | 3 +-- .../RimEclipseResultAddress.cpp | 3 +-- .../RimEclipseResultAddress.h | 3 +-- .../RimEclipseResultDefinition.cpp | 4 +--- .../RimEclipseResultDefinition.h | 3 +-- .../RimEclipseStatisticsCase.cpp | 6 ++--- .../RimEclipseStatisticsCase.h | 3 +-- .../RimEnsembleFractureStatisticsPlot.cpp | 5 ++-- .../RimEnsembleFractureStatisticsPlot.h | 3 +-- .../RimEquilibriumAxisAnnotation.cpp | 3 +-- .../RimEquilibriumAxisAnnotation.h | 3 +-- .../RimGridCalculationVariable.cpp | 4 +--- .../RimGridCalculationVariable.h | 3 +-- .../RimGridStatisticsPlot.cpp | 6 ++--- .../ProjectDataModel/RimGridStatisticsPlot.h | 3 +-- .../RimMudWeightWindowParameters.cpp | 3 +-- .../RimMudWeightWindowParameters.h | 3 +-- .../ProjectDataModel/RimMultiPlot.cpp | 5 ++-- .../ProjectDataModel/RimMultiPlot.h | 3 +-- .../RimPlotAxisProperties.cpp | 4 +--- .../ProjectDataModel/RimPlotAxisProperties.h | 11 ++++----- .../RimPlotCurveAppearance.cpp | 3 +-- .../ProjectDataModel/RimPlotCurveAppearance.h | 3 +-- .../ProjectDataModel/RimPlotWindow.cpp | 3 +-- .../ProjectDataModel/RimPlotWindow.h | 3 +-- .../RimRegularLegendConfig.cpp | 3 +-- .../ProjectDataModel/RimRegularLegendConfig.h | 3 +-- .../RimSimWellInViewCollection.cpp | 4 +--- .../RimSimWellInViewCollection.h | 3 +-- .../ProjectDataModel/RimStimPlanColors.cpp | 3 +-- .../ProjectDataModel/RimStimPlanColors.h | 3 +-- .../RimSurfaceIntersectionBand.cpp | 2 +- .../RimSurfaceIntersectionBand.h | 3 +-- .../RimSurfaceIntersectionCurve.cpp | 2 +- .../RimSurfaceIntersectionCurve.h | 3 +-- .../ProjectDataModel/RimTensorResults.cpp | 4 +--- .../ProjectDataModel/RimTensorResults.h | 3 +-- .../ProjectDataModel/RimTimeStepFilter.cpp | 3 +-- .../ProjectDataModel/RimTimeStepFilter.h | 3 +-- .../ProjectDataModel/RimVfpPlot.cpp | 5 ++-- .../ProjectDataModel/RimVfpPlot.h | 3 +-- .../ProjectDataModel/RimViewController.cpp | 3 +-- .../ProjectDataModel/RimViewController.h | 3 +-- .../ProjectDataModel/RimViewLinker.cpp | 3 +-- .../ProjectDataModel/RimViewLinker.h | 3 +-- .../ProjectDataModel/RimWbsParameters.cpp | 3 +-- .../ProjectDataModel/RimWbsParameters.h | 3 +-- .../RimElasticPropertyScaling.cpp | 4 +--- .../StimPlanModel/RimElasticPropertyScaling.h | 3 +-- .../StimPlanModel/RimFaciesProperties.cpp | 3 +-- .../StimPlanModel/RimFaciesProperties.h | 3 +-- .../StimPlanModel/RimNonNetLayers.cpp | 3 +-- .../StimPlanModel/RimNonNetLayers.h | 3 +-- .../StimPlanModel/RimStimPlanModel.cpp | 3 +-- .../StimPlanModel/RimStimPlanModel.h | 3 +-- .../StimPlanModel/RimStimPlanModelPlot.cpp | 3 +-- .../StimPlanModel/RimStimPlanModelPlot.h | 3 +-- .../RimStimPlanModelTemplate.cpp | 3 +-- .../StimPlanModel/RimStimPlanModelTemplate.h | 3 +-- .../RimDerivedEnsembleCaseCollection.cpp | 3 +-- .../RimDerivedEnsembleCaseCollection.h | 3 +-- .../Summary/RimDerivedSummaryCase.cpp | 3 +-- .../Summary/RimDerivedSummaryCase.h | 3 +-- .../Summary/RimEnsembleCurveFilter.cpp | 3 +-- .../Summary/RimEnsembleCurveFilter.h | 3 +-- .../RimEnsembleCurveFilterCollection.cpp | 3 +-- .../RimEnsembleCurveFilterCollection.h | 3 +-- .../Summary/RimEnsembleCurveSet.cpp | 3 +-- .../Summary/RimEnsembleCurveSet.h | 9 ++++--- .../Summary/RimObservedSummaryData.cpp | 5 ++-- .../Summary/RimObservedSummaryData.h | 3 +-- .../Summary/RimSummaryCurve.cpp | 6 ++--- .../Summary/RimSummaryCurve.h | 3 +-- ...RimSummaryPlotFilterTextCurveSetEditor.cpp | 3 +-- .../RimSummaryPlotFilterTextCurveSetEditor.h | 3 +-- .../Summary/RimSummaryPlotManager.cpp | 3 +-- .../Summary/RimSummaryPlotManager.h | 3 +-- .../Summary/RimSummaryPlotSourceStepping.cpp | 8 +++---- .../Summary/RimSummaryPlotSourceStepping.h | 3 +-- .../Summary/RimSummaryTimeAxisProperties.cpp | 4 +--- .../Summary/RimSummaryTimeAxisProperties.h | 3 +-- .../Surfaces/RimEnsembleSurface.cpp | 3 +-- .../Surfaces/RimEnsembleSurface.h | 3 +-- .../Surfaces/RimGridCaseSurface.cpp | 3 +-- .../Surfaces/RimGridCaseSurface.h | 3 +-- .../Surfaces/RimSurfaceResultDefinition.cpp | 2 +- .../Surfaces/RimSurfaceResultDefinition.h | 7 +++--- .../WellLog/Rim3dWellLogExtractionCurve.cpp | 4 ++-- .../WellLog/Rim3dWellLogExtractionCurve.h | 3 +-- .../WellLog/Rim3dWellLogFileCurve.cpp | 5 ++-- .../WellLog/Rim3dWellLogFileCurve.h | 3 +-- .../WellLog/Rim3dWellLogRftCurve.cpp | 3 +-- .../WellLog/Rim3dWellLogRftCurve.h | 3 +-- .../WellLog/RimEnsembleWellLogCurveSet.cpp | 2 +- .../WellLog/RimEnsembleWellLogCurveSet.h | 3 +-- .../RimWellLogCurveCommonDataSource.cpp | 6 ++--- .../WellLog/RimWellLogCurveCommonDataSource.h | 3 +-- .../WellLog/RimWellLogExtractionCurve.cpp | 4 ++-- .../WellLog/RimWellLogExtractionCurve.h | 3 +-- .../WellLog/RimWellLogFileCurve.cpp | 5 ++-- .../WellLog/RimWellLogFileCurve.h | 3 +-- .../WellLog/RimWellLogRftCurve.cpp | 5 ++-- .../WellLog/RimWellLogRftCurve.h | 3 +-- .../WellLog/RimWellLogTrack.cpp | 3 +-- .../WellLog/RimWellLogTrack.h | 3 +-- .../RimWellMeasurementCurve.cpp | 5 ++-- .../WellMeasurement/RimWellMeasurementCurve.h | 3 +-- .../RimWellMeasurementInView.cpp | 3 +-- .../RimWellMeasurementInView.h | 3 +-- .../WellPath/RimModeledWellPath.cpp | 3 +-- .../WellPath/RimModeledWellPath.h | 3 +-- .../WellPath/RimWellIASettings.cpp | 3 +-- .../WellPath/RimWellIASettings.h | 3 +-- .../ProjectDataModel/WellPath/RimWellPath.cpp | 3 +-- .../ProjectDataModel/WellPath/RimWellPath.h | 3 +-- .../WellPath/RimWellPathAttribute.cpp | 3 +-- .../WellPath/RimWellPathAttribute.h | 3 +-- .../WellPath/RimWellPathGeometryDef.cpp | 3 +-- .../WellPath/RimWellPathGeometryDef.h | 3 +-- .../WellPath/RimWellPathTieIn.cpp | 3 +-- .../WellPath/RimWellPathTieIn.h | 3 +-- .../RiuSummaryVectorSelectionUi.cpp | 2 +- .../RiuSummaryVectorSelectionUi.h | 3 +-- .../cafPdmCvf/cafPdmMat3d/cafPdmUiCoreMat3d.h | 5 +--- Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreColor3f.h | 5 +--- Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreMat4d.h | 5 +--- Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreVec3d.h | 5 +--- .../cafInternalPdmFieldTypeSpecializations.h | 24 ++++--------------- .../cafInternalPdmUiFieldCapability.h | 6 ++--- .../cafInternalPdmUiFieldCapability.inl | 7 +++--- .../cafPdmUiCore/cafPdmUiFieldHandle.cpp | 2 +- .../cafPdmUiCore/cafPdmUiFieldHandle.h | 2 +- .../cafPdmUiFieldSpecialization.h | 5 +--- .../cafPdmUiCore/cafPdmUiObjectHandle.h | 3 +-- .../cafTestApplication/MainWindow.cpp | 13 +++------- .../cafTestApplication/ManyGroups.cpp | 3 +-- .../cafTests/cafTestApplication/ManyGroups.h | 3 +-- .../cafTestApplication/TamComboBox.cpp | 3 +-- .../cafTests/cafTestApplication/TamComboBox.h | 3 +-- .../cafPdmUiComboBoxEditor.cpp | 4 +--- .../cafPdmUiFieldEditorHelper.cpp | 5 +--- .../cafUserInterface/cafPdmUiLineEditor.cpp | 7 ++---- .../cafUserInterface/cafPdmUiListEditor.cpp | 7 ++---- .../cafPdmUiTableViewQModel.cpp | 9 ++----- .../cafPdmUiTreeSelectionEditor.cpp | 3 +-- 276 files changed, 333 insertions(+), 657 deletions(-) diff --git a/ApplicationLibCode/Application/RiaMemoryCleanup.cpp b/ApplicationLibCode/Application/RiaMemoryCleanup.cpp index ae4da45bb3..52fa4158b8 100644 --- a/ApplicationLibCode/Application/RiaMemoryCleanup.cpp +++ b/ApplicationLibCode/Application/RiaMemoryCleanup.cpp @@ -215,8 +215,7 @@ void RiaMemoryCleanup::fieldChangedByUi( const caf::PdmFieldHandle* changedField //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RiaMemoryCleanup::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RiaMemoryCleanup::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_case ) diff --git a/ApplicationLibCode/Application/RiaMemoryCleanup.h b/ApplicationLibCode/Application/RiaMemoryCleanup.h index c15087e52c..99f9190944 100644 --- a/ApplicationLibCode/Application/RiaMemoryCleanup.h +++ b/ApplicationLibCode/Application/RiaMemoryCleanup.h @@ -48,8 +48,7 @@ class RiaMemoryCleanup : public caf::PdmObject std::set findGeoMechCaseResultsInUse() const; std::set findEclipseResultsInUse() const; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, @@ -61,4 +60,4 @@ class RiaMemoryCleanup : public caf::PdmObject std::vector m_geomResultAddresses; std::vector m_eclipseResultAddresses; caf::PdmField m_performDelete; -}; \ No newline at end of file +}; diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index b2d723acd1..f2e2594507 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -456,11 +456,9 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RiaPreferences::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RiaPreferences::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - *useOptionsOnly = true; if ( fieldNeedingOptions == &m_dateFormat ) { diff --git a/ApplicationLibCode/Application/RiaPreferences.h b/ApplicationLibCode/Application/RiaPreferences.h index f1a1403ff0..7e5ad4d062 100644 --- a/ApplicationLibCode/Application/RiaPreferences.h +++ b/ApplicationLibCode/Application/RiaPreferences.h @@ -147,8 +147,7 @@ class RiaPreferences : public caf::PdmObject QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void initAfterRead() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp index 77f907829f..e555f89bac 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp @@ -418,11 +418,9 @@ void RiaPreferencesSummary::defineEditorAttribute( const caf::PdmFieldHandle* fi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RiaPreferencesSummary::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RiaPreferencesSummary::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - *useOptionsOnly = true; if ( fieldNeedingOptions == &m_summaryReader ) { diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.h b/ApplicationLibCode/Application/RiaPreferencesSummary.h index 01e866ad70..18f3035876 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.h +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.h @@ -114,8 +114,7 @@ class RiaPreferencesSummary : public caf::PdmObject protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: caf::PdmField m_defaultSummaryPlot; diff --git a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp index d93a62324e..1565dc7967 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp @@ -255,11 +255,9 @@ void RiaPreferencesSystem::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RiaPreferencesSystem::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RiaPreferencesSystem::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - *useOptionsOnly = true; return options; } diff --git a/ApplicationLibCode/Application/RiaPreferencesSystem.h b/ApplicationLibCode/Application/RiaPreferencesSystem.h index 4a7bb19160..6f1c3da0ef 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSystem.h +++ b/ApplicationLibCode/Application/RiaPreferencesSystem.h @@ -60,8 +60,7 @@ class RiaPreferencesSystem : public caf::PdmObject protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.cpp index d2a2b1a7e2..526187b76b 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.cpp @@ -41,8 +41,7 @@ RicCaseAndFileExportSettingsUi::RicCaseAndFileExportSettingsUi() /// //-------------------------------------------------------------------------------------------------- QList - RicCaseAndFileExportSettingsUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RicCaseAndFileExportSettingsUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.h b/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.h index ab1984ba7e..ba9591f7d9 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.h +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicCaseAndFileExportSettingsUi.h @@ -38,8 +38,7 @@ class RicCaseAndFileExportSettingsUi : public caf::PdmObject caf::PdmField folder; caf::PdmPtrField caseToApply; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; protected: void defineEditorAttribute( const caf::PdmFieldHandle* field, diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp index b9d71f5ab8..a4314d6567 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.cpp @@ -276,8 +276,7 @@ void RicExportCompletionDataSettingsUi::fieldChangedByUi( const caf::PdmFieldHan /// //-------------------------------------------------------------------------------------------------- QList - RicExportCompletionDataSettingsUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RicExportCompletionDataSettingsUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &timeStep ) @@ -349,7 +348,7 @@ QList else { - options = RicCaseAndFileExportSettingsUi::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + options = RicCaseAndFileExportSettingsUi::calculateValueOptions( fieldNeedingOptions ); } return options; } diff --git a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.h b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.h index 0bfade5059..bed9f47ee6 100644 --- a/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.h +++ b/ApplicationLibCode/Commands/CompletionExportCommands/RicExportCompletionDataSettingsUi.h @@ -107,8 +107,7 @@ class RicExportCompletionDataSettingsUi : public RicCaseAndFileExportSettingsUi void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; std::map>> generateWellProductionStartStrings(); diff --git a/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.cpp index 8d2037ea9d..e90a971b36 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.cpp @@ -139,13 +139,10 @@ void RicCellRangeUi::defineEditorAttribute( const caf::PdmFieldHandle* field, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RicCellRangeUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RicCellRangeUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - if ( useOptionsOnly ) ( *useOptionsOnly ) = true; - if ( &m_gridIndex == fieldNeedingOptions ) { for ( int gIdx = 0; gIdx < RigReservoirGridTools::gridCount( m_case ); ++gIdx ) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.h b/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.h index ac2fcc3167..7ea3a2f6ad 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicCellRangeUi.h @@ -46,8 +46,7 @@ class RicCellRangeUi : public caf::PdmObject void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.cpp index 59ba9f82dc..394d8aa57a 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.cpp @@ -141,8 +141,7 @@ void RicExportCarfinUi::setDefaultValuesFromCase() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RicExportCarfinUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RicExportCarfinUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.h b/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.h index e0851bc063..8e2aceaeeb 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportCarfinUi.h @@ -54,8 +54,7 @@ class RicExportCarfinUi : public caf::PdmObject void setCasePointers( RimEclipseCase* rimCase ); void setDefaultValuesFromCase(); - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp index 170c61529e..11ab64cfa8 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.cpp @@ -436,8 +436,7 @@ void RicExportEclipseSectorModelUi::fieldChangedByUi( const caf::PdmFieldHandle* /// //-------------------------------------------------------------------------------------------------- QList - RicExportEclipseSectorModelUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RicExportEclipseSectorModelUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &selectedKeywords ) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.h b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.h index 49c077fea8..5661b43171 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportEclipseSectorModelUi.h @@ -106,8 +106,7 @@ class RicExportEclipseSectorModelUi : public caf::PdmObject caf::PdmUiEditorAttribute* attribute ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; static std::set mainKeywords(); QString defaultFolder() const; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.cpp index 3f6e93530f..9abd37c15e 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.cpp @@ -188,8 +188,7 @@ void RicExportLgrUi::setDefaultValuesFromCase() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RicExportLgrUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RicExportLgrUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.h b/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.h index 7ce9b59dfe..db93180ef7 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportLgrUi.h @@ -66,8 +66,7 @@ class RicExportLgrUi : public caf::PdmObject private: void setDefaultValuesFromCase(); - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, diff --git a/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp b/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp index 54b0156cda..6636b97e3c 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.cpp @@ -93,8 +93,7 @@ QString RicSelectViewUI::newViewName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RicSelectViewUI::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RicSelectViewUI::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.h b/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.h index ad1d3570e9..bdafa28675 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.h +++ b/ApplicationLibCode/Commands/FlowCommands/RicSelectViewUI.h @@ -43,8 +43,7 @@ class RicSelectViewUI : public caf::PdmObject bool createNewView() const; QString newViewName() const; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.cpp b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.cpp index 9d70eb697a..861d1775c7 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.cpp @@ -125,8 +125,7 @@ void RicCreateMultipleFracturesOptionItemUi::fieldChangedByUi( const caf::PdmFie /// //-------------------------------------------------------------------------------------------------- QList - RicCreateMultipleFracturesOptionItemUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RicCreateMultipleFracturesOptionItemUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.h b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.h index 1b30c54f8f..a84de6247d 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.h +++ b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesOptionItemUi.h @@ -46,8 +46,7 @@ class RicCreateMultipleFracturesOptionItemUi : public caf::PdmObject private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: caf::PdmField m_topKOneBased; // Eclipse uses 1-based indexing diff --git a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp index 73968e48a1..94f7871476 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp @@ -192,8 +192,7 @@ void RiuCreateMultipleFractionsUi::clearWellPaths() /// //-------------------------------------------------------------------------------------------------- QList - RiuCreateMultipleFractionsUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RiuCreateMultipleFractionsUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.h b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.h index d15790faf6..31b0d84a87 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.h +++ b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.h @@ -91,8 +91,7 @@ class RiuCreateMultipleFractionsUi : public caf::PdmObject void updateButtonsEnableState(); private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineCustomContextMenu( const caf::PdmFieldHandle* fieldNeedingMenu, QMenu* menu, QWidget* fieldEditorWidget ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.cpp b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.cpp index 944f8748d6..f1fddc2af3 100644 --- a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.cpp +++ b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.cpp @@ -62,8 +62,7 @@ int RicSaturationPressureUi::selectedTimeStep() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RicSaturationPressureUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RicSaturationPressureUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.h b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.h index 9b287f39a3..107f717a53 100644 --- a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.h +++ b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicSaturationPressureUi.h @@ -40,8 +40,7 @@ class RicSaturationPressureUi : public caf::PdmObject int selectedTimeStep() const; protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: caf::PdmPtrField m_caseToApply; diff --git a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp index 567cf9a42c..30d511fd7c 100644 --- a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp +++ b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.cpp @@ -70,7 +70,7 @@ RimGridView* RicHoloLensExportToFolderUi::viewForExport() const /// //-------------------------------------------------------------------------------------------------- QList - RicHoloLensExportToFolderUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RicHoloLensExportToFolderUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.h b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.h index bb97f0b500..98dba9eb0b 100644 --- a/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.h +++ b/ApplicationLibCode/Commands/HoloLensCommands/RicHoloLensExportToFolderUi.h @@ -40,8 +40,7 @@ class RicHoloLensExportToFolderUi : public caf::PdmObject RimGridView* viewForExport() const; private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp index af4bb71568..c471fdf4dd 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.cpp @@ -81,8 +81,7 @@ std::vector RicSelectPlotTemplateUi::selectedPlotTempl //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RicSelectPlotTemplateUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RicSelectPlotTemplateUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.h index 5bc78eec00..9b584027da 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.h +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectPlotTemplateUi.h @@ -44,8 +44,7 @@ class RicSelectPlotTemplateUi : public caf::PdmObject std::vector selectedPlotTemplates(); private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp index 6b5e5e2bf3..558ed1f3ae 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.cpp @@ -105,7 +105,7 @@ void RicCreateEnsembleSurfaceUi::defineUiOrdering( QString uiConfigName, caf::Pd /// //-------------------------------------------------------------------------------------------------- QList - RicCreateEnsembleSurfaceUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RicCreateEnsembleSurfaceUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_layers ) diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.h b/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.h index 95bc6dd1ee..471ac9a7d9 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.h +++ b/ApplicationLibCode/Commands/RicCreateEnsembleSurfaceUi.h @@ -50,8 +50,7 @@ class RicCreateEnsembleSurfaceUi : public caf::PdmObject caf::PdmUiEditorAttribute* attribute ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; caf::PdmField> m_layers; caf::PdmField m_autoCreateEnsembleSurfaces; diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp index 7132a8f0ad..5c0686474b 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp +++ b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.cpp @@ -117,7 +117,7 @@ void RicCreateEnsembleWellLogUi::defineUiOrdering( QString uiConfigName, caf::Pd /// //-------------------------------------------------------------------------------------------------- QList - RicCreateEnsembleWellLogUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RicCreateEnsembleWellLogUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.h b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.h index 3fa77a06ec..518aeb63a4 100644 --- a/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.h +++ b/ApplicationLibCode/Commands/RicCreateEnsembleWellLogUi.h @@ -66,8 +66,7 @@ class RicCreateEnsembleWellLogUi : public caf::PdmObject protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; diff --git a/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp index 0c5c476091..fe38b4b4f1 100644 --- a/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp +++ b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.cpp @@ -151,7 +151,7 @@ void RicUserDefinedCalculatorUi::defineUiOrdering( QString uiConfigName, caf::Pd /// //-------------------------------------------------------------------------------------------------- QList - RicUserDefinedCalculatorUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RicUserDefinedCalculatorUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_currentCalculation ) diff --git a/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.h b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.h index 70ee7244ef..cae090f4ba 100644 --- a/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.h +++ b/ApplicationLibCode/Commands/RicUserDefinedCalculatorUi.h @@ -51,8 +51,7 @@ class RicUserDefinedCalculatorUi : public caf::PdmObject private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp index a3754cce45..885433a0c3 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.cpp @@ -452,8 +452,7 @@ void RicPasteAsciiDataToSummaryPlotFeatureUi::defineUiOrdering( QString uiConfig /// //-------------------------------------------------------------------------------------------------- QList - RicPasteAsciiDataToSummaryPlotFeatureUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RicPasteAsciiDataToSummaryPlotFeatureUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { CVF_ASSERT( m_uiMode != UI_MODE_NONE ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h index ebdcbff9e7..a3fb14df93 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicPasteAsciiDataToSummaryPlotFeatureUi.h @@ -137,8 +137,7 @@ class RicPasteAsciiDataToSummaryPlotFeatureUi : public caf::PdmObject protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp index cfbf69aa39..fc4d75445f 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.cpp @@ -84,8 +84,7 @@ QString RicSelectSummaryPlotUI::newPlotName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RicSelectSummaryPlotUI::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RicSelectSummaryPlotUI::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.h index 441b983c11..305e4daed1 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSelectSummaryPlotUI.h @@ -41,8 +41,7 @@ class RicSelectSummaryPlotUI : public caf::PdmObject bool isCreateNewPlotChecked() const; QString newPlotName() const; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index b52252d43e..ab9f714668 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -259,8 +259,7 @@ void RicSummaryPlotEditorUi::fieldChangedByUi( const caf::PdmFieldHandle* change //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RicSummaryPlotEditorUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RicSummaryPlotEditorUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h index 668015bc94..f88b4df977 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.h @@ -77,8 +77,7 @@ class RicSummaryPlotEditorUi : public caf::PdmObject private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp index 8c70496330..d95b6fd42f 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp +++ b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.cpp @@ -96,8 +96,7 @@ std::vector RicLinkVisibleViewsFeatureUi::masterViewCandidates() c /// //-------------------------------------------------------------------------------------------------- QList - RicLinkVisibleViewsFeatureUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RicLinkVisibleViewsFeatureUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.h b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.h index 3fd24df8c3..ab65235bf3 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.h +++ b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeatureUi.h @@ -42,8 +42,7 @@ class RicLinkVisibleViewsFeatureUi : public caf::PdmObject std::vector masterViewCandidates() const; protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: caf::PdmPtrField m_masterView; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp index 42284e5051..3bf37dc222 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.cpp @@ -108,8 +108,7 @@ void RicCreateMultipleWellPathLateralsUi::defineUiOrdering( QString uiConfigName /// //-------------------------------------------------------------------------------------------------- QList - RicCreateMultipleWellPathLateralsUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RicCreateMultipleWellPathLateralsUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.h b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.h index 9378a756ca..d10eaf2b65 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicCreateMultipleWellPathLateralsUi.h @@ -56,8 +56,7 @@ class RicCreateMultipleWellPathLateralsUi : public caf::PdmObject private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: caf::PdmPtrField m_sourceLateral; diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.cpp b/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.cpp index 56237f6399..e108c8eb33 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.cpp +++ b/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.cpp @@ -34,8 +34,7 @@ RicWellPathsUnitSystemSettingsUi::RicWellPathsUnitSystemSettingsUi() /// //-------------------------------------------------------------------------------------------------- QList - RicWellPathsUnitSystemSettingsUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RicWellPathsUnitSystemSettingsUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &unitSystem ) diff --git a/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.h b/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.h index 8082511889..a90d6039c8 100644 --- a/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.h +++ b/ApplicationLibCode/Commands/WellPathCommands/RicWellPathsUnitSystemSettingsUi.h @@ -37,6 +37,5 @@ class RicWellPathsUnitSystemSettingsUi : public caf::PdmObject caf::PdmField> unitSystem; protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; }; diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index e71556f96c..7417aefd2b 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -573,10 +573,9 @@ caf::PdmFieldHandle* RimAnalysisPlot::userDescriptionField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimAnalysisPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimAnalysisPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimPlot::calculateValueOptions( fieldNeedingOptions ); if ( !options.isEmpty() ) return options; diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h index 33483563a5..e113fc0538 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.h @@ -102,8 +102,7 @@ class RimAnalysisPlot : public RimPlot void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; caf::PdmFieldHandle* userDescriptionField() override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; std::set allAvailableTimeSteps(); diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp index e7270a7a7f..c0528617cd 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.cpp @@ -269,8 +269,7 @@ void RimPlotDataFilterItem::fieldChangedByUi( const caf::PdmFieldHandle* changed //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimPlotDataFilterItem::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimPlotDataFilterItem::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; RimAnalysisPlot* parentPlot; diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.h b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.h index e87cdac147..d80c4c8bdd 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.h +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterItem.h @@ -113,8 +113,7 @@ class RimPlotDataFilterItem : public caf::PdmObject caf::PdmUiEditorAttribute* attribute ) override; caf::PdmFieldHandle* objectToggleField() override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; RigEnsembleParameter selectedEnsembleParameter() const; diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.cpp index 113e6b9853..2fd27bce05 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.cpp @@ -95,8 +95,7 @@ void RimPolylineTarget::enableFullUpdate( bool enable ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimPolylineTarget::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimPolylineTarget::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; return options; diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.h b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.h index a094c6e9ba..91b22baed8 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.h +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimPolylineTarget.h @@ -50,8 +50,7 @@ class RimPolylineTarget : public caf::PdmObject void triggerVisualizationUpdate() const; private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; private: diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.cpp index 6233f1fe2b..d79ca6f840 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.cpp @@ -250,13 +250,10 @@ const cvf::StructGridInterface* RimCellFilter::selectedGrid() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimCellFilter::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimCellFilter::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - if ( useOptionsOnly ) ( *useOptionsOnly ) = true; - if ( &m_gridIndex == fieldNeedingOptions ) { RimCase* rimCase = nullptr; diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.h b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.h index 3760c30ad0..f03b83ccc2 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.h +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilter.h @@ -80,8 +80,7 @@ class RimCellFilter : public caf::PdmObject const cvf::StructGridInterface* selectedGrid() const; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; caf::PdmField m_name; caf::PdmProxyValueField m_nameProxy; diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.cpp index 57301f0d93..63d33c1834 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.cpp @@ -52,15 +52,12 @@ std::vector RimPropertyFilter::selectedCategoryValues() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimPropertyFilter::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimPropertyFilter::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( &m_selectedCategoryValues == fieldNeedingOptions ) { - if ( useOptionsOnly ) *useOptionsOnly = true; - if ( m_categoryValues.size() == m_categoryNames.size() ) { for ( size_t i = 0; i < m_categoryValues.size(); i++ ) diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.h b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.h index 4210a2eba0..0776f56127 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.h +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPropertyFilter.h @@ -42,8 +42,7 @@ class RimPropertyFilter : public RimCellFilter void setCategoryNamesAndValues( const std::vector>& categoryNamesAndValues ); void clearCategories(); - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; protected: caf::PdmField> m_selectedCategoryValues; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp index ed844111b1..dd96d7ae5e 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.cpp @@ -260,7 +260,7 @@ WellFractureIntersectionData /// //-------------------------------------------------------------------------------------------------- QList - RimEllipseFractureTemplate::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimEllipseFractureTemplate::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.h b/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.h index 94cbadfe95..0bb762581a 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEllipseFractureTemplate.h @@ -76,8 +76,7 @@ class RimEllipseFractureTemplate : public RimFractureTemplate private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void initAfterRead() override; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp index 0410147eae..5ba3812704 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.cpp @@ -198,8 +198,7 @@ QString RimEnsembleFractureStatistics::generateFilePathsTable() /// //-------------------------------------------------------------------------------------------------- QList - RimEnsembleFractureStatistics::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimEnsembleFractureStatistics::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_selectedStatisticsType ) diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.h b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.h index 82974a5ced..c1208587df 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatistics.h @@ -114,8 +114,7 @@ class RimEnsembleFractureStatistics : public RimNamedObject void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; QString generateFilePathsTable(); diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp index 6fe92e727f..2967edc7f2 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp @@ -619,8 +619,7 @@ cvf::Vec3d RimFracture::fracturePositionForUi() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimFracture::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimFracture::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.h b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.h index 77778cf545..56507fbb91 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.h @@ -137,8 +137,7 @@ class RimFracture : public RimCheckableNamedObject, public Rim3dPropertiesInterf double endMD() const override; protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.cpp index 58f7b45627..b58eefcd26 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.cpp @@ -42,7 +42,7 @@ RimFractureExportSettings::RimFractureExportSettings() /// //-------------------------------------------------------------------------------------------------- QList - RimFractureExportSettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimFractureExportSettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.h b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.h index b421ab49d8..230b2d2e2a 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureExportSettings.h @@ -39,8 +39,7 @@ class RimFractureExportSettings : public caf::PdmObject caf::PdmField fileName; caf::PdmPtrField caseToApply; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; protected: void defineEditorAttribute( const caf::PdmFieldHandle* field, diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp index 2ebda0f76f..32a1e98e96 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.cpp @@ -286,10 +286,9 @@ void RimSimWellFracture::defineEditorAttribute( const caf::PdmFieldHandle* field //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimSimWellFracture::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimSimWellFracture::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimFracture::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimFracture::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_branchIndex ) { diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.h b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.h index 194cc07500..39dabcf450 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFracture.h @@ -60,8 +60,7 @@ class RimSimWellFracture : public RimFracture void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: RigMainGrid* ownerCaseMainGrid() const; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index c3c0d21103..b4e09a4505 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -334,7 +334,7 @@ void RimStimPlanFractureTemplate::loadDataAndUpdate() /// //-------------------------------------------------------------------------------------------------- QList - RimStimPlanFractureTemplate::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimStimPlanFractureTemplate::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h index 65ba2bc874..de63748684 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h @@ -110,8 +110,7 @@ class RimStimPlanFractureTemplate : public RimFractureTemplate private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp index 68c433b36d..f456aca62a 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.cpp @@ -169,8 +169,7 @@ void RimValveTemplate::setUserLabel( const QString& userLabel ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimValveTemplate::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimValveTemplate::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.h b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.h index a1713e4e0f..23d530cede 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplate.h @@ -49,8 +49,7 @@ class RimValveTemplate : public RimNamedObject void setUserLabel( const QString& userLabel ); protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp index aac818612a..350abf8678 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.cpp @@ -461,8 +461,7 @@ void RimWellPathValve::templateUpdated() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWellPathValve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimWellPathValve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.h b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.h index 3b8dc9cc62..bbb7f5f7e4 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathValve.h @@ -80,8 +80,7 @@ class RimWellPathValve : public RimCheckableNamedObject, public RimWellPathCompo void templateUpdated(); private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp index 0e5afc82c5..a43636a55d 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp @@ -253,9 +253,9 @@ caf::PdmFieldHandle* RimAbstractCorrelationPlot::userDescriptionField() /// //-------------------------------------------------------------------------------------------------- QList - RimAbstractCorrelationPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimAbstractCorrelationPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimPlot::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_timeStep ) { diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h index dcc10f9d4d..98b18f687a 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.h @@ -85,8 +85,7 @@ class RimAbstractCorrelationPlot : public RimPlot caf::PdmUiEditorAttribute* attribute ) override; caf::PdmFieldHandle* userDescriptionField() override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; std::set addresses(); std::set ensembleParameters(); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index 989ffa58b3..f0782faaaf 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -339,11 +339,9 @@ void RimCorrelationMatrixPlot::defineUiOrdering( QString uiConfigName, caf::PdmU //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimCorrelationMatrixPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimCorrelationMatrixPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = - RimAbstractCorrelationPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimAbstractCorrelationPlot::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_selectedParametersList ) { diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h index 3c3110efcd..1ea5bbd69c 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.h @@ -66,8 +66,7 @@ class RimCorrelationMatrixPlot : public RimAbstractCorrelationPlot void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void onLoadDataAndUpdate() override; diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp index aaa71f0ccc..d6c97737a8 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp @@ -147,11 +147,9 @@ void RimCorrelationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimCorrelationPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimCorrelationPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = - RimAbstractCorrelationPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimAbstractCorrelationPlot::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_selectedParametersList ) { diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h index 1013a2408c..e7eacfc2a9 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.h @@ -61,8 +61,7 @@ class RimCorrelationPlot : public RimAbstractCorrelationPlot void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void onLoadDataAndUpdate() override; diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp index 4fea83af1d..8ca5fdd027 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp @@ -396,10 +396,9 @@ void RimCorrelationReportPlot::doUpdateLayout() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimCorrelationReportPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimCorrelationReportPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_subTitleFontSize || fieldNeedingOptions == &m_labelFontSize || fieldNeedingOptions == &m_axisTitleFontSize || fieldNeedingOptions == &m_axisValueFontSize ) diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.h index 18bace8c09..d5b4642567 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.h @@ -32,7 +32,7 @@ class RimCorrelationMatrixPlot; class RimParameterResultCrossPlot; class RimSummaryCaseCollection; class RimCorrelationPlot; -class RiaSummaryCurveDefinition; +class RiaSummaryCurveDefinition; class RiuMultiPlotPage; @@ -74,8 +74,7 @@ class RimCorrelationReportPlot : public QObject, public RimPlotWindow void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override; void doUpdateLayout() override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void onDataSelection( const caf::SignalEmitter* emitter, std::pair parameterAndCurveDef ); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp index 19fcefc4cc..2edd1f9be0 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp @@ -141,10 +141,9 @@ void RimParameterResultCrossPlot::defineUiOrdering( QString uiConfigName, caf::P /// //-------------------------------------------------------------------------------------------------- QList - RimParameterResultCrossPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimParameterResultCrossPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = - RimAbstractCorrelationPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimAbstractCorrelationPlot::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_ensembleParameter ) { for ( const auto& param : ensembleParameters() ) diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.h index 46faac5f0b..291256497c 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.h @@ -39,8 +39,7 @@ class RimParameterResultCrossPlot : public RimAbstractCorrelationPlot void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void onLoadDataAndUpdate() override; diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp index 7678f73031..c3bc65f25a 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.cpp @@ -131,7 +131,7 @@ void RimFaultRAPreprocSettings::defineUiOrdering( QString uiConfigName, caf::Pdm /// //-------------------------------------------------------------------------------------------------- QList - RimFaultRAPreprocSettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimFaultRAPreprocSettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.h b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.h index e54147c015..743575dca7 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.h +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRAPreprocSettings.h @@ -79,8 +79,7 @@ class RimFaultRAPreprocSettings : public caf::PdmObject QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; RimCase* startCase() const; diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp index 637e0510cd..bd5a791e5e 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp @@ -102,8 +102,7 @@ RimFaultRASettings::~RimFaultRASettings() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimFaultRASettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimFaultRASettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.h b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.h index d05ecffb03..0dd279581f 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.h +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.h @@ -93,8 +93,7 @@ class RimFaultRASettings : public caf::PdmObject void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: void setupResInsightParameters(); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp index 42648cc6ad..dc548b18ad 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp @@ -262,7 +262,7 @@ void RimFlowCharacteristicsPlot::updateFonts() /// //-------------------------------------------------------------------------------------------------- QList - RimFlowCharacteristicsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimFlowCharacteristicsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.h index e296c80c29..4443a70859 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.h @@ -92,8 +92,7 @@ class RimFlowCharacteristicsPlot : public RimViewWindow // Overridden PDM methods void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 39164c138e..363532cd7b 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -702,8 +702,7 @@ RimWellAllocationPlot::FlowType RimWellAllocationPlot::flowType() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimWellAllocationPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimWellAllocationPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.h index 8b3f02bd43..3b5f3cd2d5 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.h @@ -99,8 +99,7 @@ class RimWellAllocationPlot : public RimViewWindow std::set findSortedWellNames(); - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; QImage snapshotWindowContent() override; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp index 0f17609e86..880487cdd1 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp @@ -474,10 +474,9 @@ void RimWellDistributionPlot::defineUiOrdering( QString uiConfigName, caf::PdmUi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimWellDistributionPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimWellDistributionPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimPlot::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_case ) { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h index 26f60d80e4..5637b1410b 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.h @@ -87,8 +87,7 @@ class RimWellDistributionPlot : public RimPlot void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: caf::PdmPtrField m_case; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp index 7231a3ada7..7bda3287c9 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp @@ -252,10 +252,9 @@ void RimWellDistributionPlotCollection::defineUiOrdering( QString uiConfigName, /// //-------------------------------------------------------------------------------------------------- QList - RimWellDistributionPlotCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimWellDistributionPlotCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_case ) { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.h index d3184e5f06..840addfaee 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.h @@ -62,8 +62,7 @@ class RimWellDistributionPlotCollection : public RimPlotWindow private: // RimPlotWindow overrides - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void onLoadDataAndUpdate() override; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index bedeef7dc9..84918bbc94 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -761,10 +761,9 @@ const char* RimWellPltPlot::plotNameFormatString() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWellPltPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimWellPltPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimWellLogPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimWellLogPlot::calculateValueOptions( fieldNeedingOptions ); const QString simWellName = RimWellPlotTools::simWellName( m_wellPathName ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.h index e8ec7c4b74..3f8d3f07f3 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.h @@ -78,8 +78,7 @@ class RimWellPltPlot : public RimWellLogPlot 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 ) override; void calculateValueOptionsForWells( QList& options ); void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp index 969d960179..e43294fbbb 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.cpp @@ -195,7 +195,7 @@ void RimWellRftEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* ch /// //-------------------------------------------------------------------------------------------------- QList - RimWellRftEnsembleCurveSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimWellRftEnsembleCurveSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_ensembleParameter ) diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.h index b50f2a7136..51d2ac6647 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftEnsembleCurveSet.h @@ -60,8 +60,7 @@ class RimWellRftEnsembleCurveSet : public caf::PdmObject protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index 613f7bba63..911e0b5f3d 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -327,8 +327,7 @@ void RimWellRftPlot::updateEditorsFromPreviousSelection() m_selectedSources.v().clear(); m_selectedTimeSteps.v().clear(); - bool dummy = false; - auto dataSourceOptions = calculateValueOptions( &m_selectedSources, &dummy ); + auto dataSourceOptions = calculateValueOptions( &m_selectedSources ); for ( const auto& dataSourceOption : dataSourceOptions ) { if ( dataSourceOption.level() == 1 ) @@ -343,7 +342,7 @@ void RimWellRftPlot::updateEditorsFromPreviousSelection() // This has to happen after the m_selectedSources is filled // because the available time steps is dependent on the selected sources. - auto timeStepOptions = calculateValueOptions( &m_selectedTimeSteps, &dummy ); + auto timeStepOptions = calculateValueOptions( &m_selectedTimeSteps ); for ( const auto& timeStepOption : timeStepOptions ) { QDateTime timeStep = timeStepOption.value().toDateTime(); @@ -743,10 +742,9 @@ void RimWellRftPlot::deleteCurvesAssosicatedWithObservedData( const RimObservedF //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWellRftPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimWellRftPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimWellLogPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimWellLogPlot::calculateValueOptions( fieldNeedingOptions ); const QString simWellName = associatedSimWellName(); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h index 565d8a33bf..21d206fa16 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.h @@ -96,8 +96,7 @@ class RimWellRftPlot : public RimWellLogPlot 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 ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void onLoadDataAndUpdate() override; diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp index 6d6b96186c..6faf651946 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp @@ -1178,12 +1178,11 @@ void RimGeoMechCase::defineEditorAttribute( const caf::PdmFieldHandle* field, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimGeoMechCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimGeoMechCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - options = RimCase::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + options = RimCase::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_elementPropertyFileNameIndexUiSelection ) { diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.h b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.h index 8a5cb73cc6..2e9f6d496b 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.h +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.h @@ -131,8 +131,7 @@ class RimGeoMechCase : public RimCase void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void updateFormationNamesData() override; diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp index 00d991b36f..9fc50d7566 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.cpp @@ -615,8 +615,7 @@ void RimGeoMechContourMapProjection::fieldChangedByUi( const caf::PdmFieldHandle /// //-------------------------------------------------------------------------------------------------- QList - RimGeoMechContourMapProjection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimGeoMechContourMapProjection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h index 706d0200ad..c20c60eb62 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapProjection.h @@ -90,8 +90,7 @@ class RimGeoMechContourMapProjection : public RimContourMapProjection protected: // Framework overrides void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp index 0d37e84d2a..cab5b4be93 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.cpp @@ -205,10 +205,9 @@ void RimGeoMechResultDefinition::defineUiOrdering( QString uiConfigName, caf::Pd /// //-------------------------------------------------------------------------------------------------- QList - RimGeoMechResultDefinition::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimGeoMechResultDefinition::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - *useOptionsOnly = true; if ( m_geomCase ) { diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.h b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.h index aa3a1dd3dd..ad794dc2f2 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.h +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechResultDefinition.h @@ -94,8 +94,7 @@ class RimGeoMechResultDefinition : public RimFemResultObserver, public RimChecka private: // Overridden PDM methods - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void calculateNormalizationAirGapDefault(); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp index 999ffa4618..3eae5418bb 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp @@ -946,8 +946,7 @@ void RimGridCrossPlotDataSet::childFieldChangedByUi( const caf::PdmFieldHandle* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimGridCrossPlotDataSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimGridCrossPlotDataSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h index 8bc6a389ab..6483a33806 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h @@ -158,8 +158,7 @@ class RimGridCrossPlotDataSet : public RimCheckableNamedObject, public RimNameCo 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; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void triggerPlotNameUpdateAndReplot(); void updateDataSetName(); void performAutoNameUpdate() override; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp index bcbd45105e..fc9fc36464 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp @@ -592,8 +592,7 @@ void RimExtrudedCurveIntersection::defineUiOrdering( QString uiConfigName, caf:: /// //-------------------------------------------------------------------------------------------------- QList - RimExtrudedCurveIntersection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimExtrudedCurveIntersection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; @@ -640,7 +639,7 @@ QList } else { - options = RimIntersection::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + options = RimIntersection::calculateValueOptions( fieldNeedingOptions ); } return options; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h index 7369089e52..c58febbef6 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h @@ -135,8 +135,7 @@ class RimExtrudedCurveIntersection : public RimIntersection void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp index 099ec20ab7..6cc38af465 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.cpp @@ -106,8 +106,7 @@ RimIntersectionResultDefinition* RimIntersection::activeSeparateResultDefinition //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimIntersection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimIntersection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.h index bb8258f08a..e94d2ff776 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersection.h @@ -52,8 +52,7 @@ class RimIntersection : public caf::PdmObject virtual RimIntersectionResultsDefinitionCollection* findSeparateResultsCollection(); caf::PdmFieldHandle* objectToggleField() final; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineSeparateDataSourceUi( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ); void updateDefaultSeparateDataSource(); diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp index f9c4716407..8ca4308f28 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.cpp @@ -409,8 +409,7 @@ void RimIntersectionResultDefinition::setDefaultEclipseLegendConfig() /// //-------------------------------------------------------------------------------------------------- QList - RimIntersectionResultDefinition::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimIntersectionResultDefinition::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.h index c23a3fdd5b..bf5c55df21 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultDefinition.h @@ -67,8 +67,7 @@ class RimIntersectionResultDefinition : public caf::PdmObject void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void initAfterRead() override; diff --git a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp index 71d713897b..cd904fcbc3 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp @@ -430,8 +430,7 @@ bool Rim2dIntersectionView::handleOverlayItemPicked( const cvf::OverlayItem* pic //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - Rim2dIntersectionView::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList Rim2dIntersectionView::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.h b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.h index 839111a482..8270fdd021 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.h +++ b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.h @@ -94,8 +94,7 @@ class Rim2dIntersectionView : public Rim3dView void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; bool hasResults(); diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index b444f33dc8..1281451d58 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -1386,8 +1386,7 @@ cvf::ref Rim3dView::displayCoordTransform() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList Rim3dView::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList Rim3dView::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.h b/ApplicationLibCode/ProjectDataModel/Rim3dView.h index c0e3b3fee3..99c59c7d19 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.h +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.h @@ -236,8 +236,7 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void setupBeforeSave() override; diff --git a/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp b/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp index 1105f321ed..661aedb642 100644 --- a/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.cpp @@ -75,8 +75,7 @@ RimAdvancedSnapshotExportDefinition::~RimAdvancedSnapshotExportDefinition() /// //-------------------------------------------------------------------------------------------------- QList - RimAdvancedSnapshotExportDefinition::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimAdvancedSnapshotExportDefinition::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; @@ -136,8 +135,6 @@ QList RimTools::caseOptionItems( &options ); } - if ( useOptionsOnly ) *useOptionsOnly = true; - return options; } diff --git a/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.h b/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.h index 189f6b3c4c..666b61cff5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.h +++ b/ApplicationLibCode/ProjectDataModel/RimAdvancedSnapshotExportDefinition.h @@ -61,8 +61,7 @@ class RimAdvancedSnapshotExportDefinition : public caf::PdmObject void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void getTimeStepStrings( QList& options ); diff --git a/ApplicationLibCode/ProjectDataModel/RimCase.cpp b/ApplicationLibCode/ProjectDataModel/RimCase.cpp index 5ccb277205..47662a94f7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCase.cpp @@ -206,8 +206,7 @@ void RimCase::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const Q //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimCase.h b/ApplicationLibCode/ProjectDataModel/RimCase.h index 58dc1df104..7cc4675de7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCase.h +++ b/ApplicationLibCode/ProjectDataModel/RimCase.h @@ -90,8 +90,7 @@ class RimCase : public caf::PdmObject caf::Signal<> settingsChanged; protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; virtual std::vector allSpecialViews() const = 0; diff --git a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp index 6c8d20b4e2..1aceb4f3d4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.cpp @@ -190,8 +190,7 @@ void RimCellEdgeColors::EdgeFaceEnum::setUp() /// //-------------------------------------------------------------------------------------------------- -QList RimCellEdgeColors::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimCellEdgeColors::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { if ( fieldNeedingOptions == &m_resultVariable ) { @@ -255,8 +254,6 @@ QList RimCellEdgeColors::calculateValueOptions( const ca options.push_front( caf::PdmOptionItemInfo( RiaResultNames::undefinedResultName(), "" ) ); - if ( useOptionsOnly ) *useOptionsOnly = true; - return options; } } diff --git a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.h b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.h index 75ec0f0c6b..e58adccb6d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.h +++ b/ApplicationLibCode/ProjectDataModel/RimCellEdgeColors.h @@ -104,8 +104,7 @@ class RimCellEdgeColors : public caf::PdmObject protected: void initAfterRead() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp index 6611839472..103e56379c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp @@ -130,8 +130,7 @@ double RimCustomObjectiveFunctionWeight::weightValue() const /// //-------------------------------------------------------------------------------------------------- QList - RimCustomObjectiveFunctionWeight::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimCustomObjectiveFunctionWeight::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.h b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.h index b69b14e016..e64e698821 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.h +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.h @@ -58,8 +58,7 @@ class RimCustomObjectiveFunctionWeight : public caf::PdmObject private: caf::PdmFieldHandle* userDescriptionField() override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index f67942f23c..46f79d0976 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -940,10 +940,9 @@ void RimDepthTrackPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimDepthTrackPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimDepthTrackPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_depthType ) { @@ -976,7 +975,6 @@ QList RimDepthTrackPlot::calculateValueOptions( const ca RiaOptionItemFactory::appendOptionItemsForEnsembleCurveSets( &options ); } - ( *useOptionsOnly ) = true; return options; } diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h index dd83cd65aa..2c86032c84 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.h @@ -157,8 +157,7 @@ class RimDepthTrackPlot : public RimTypedPlotCollection, public RimPlot // Overridden PDM methods void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void initAfterRead() override; void defineEditorAttribute( const caf::PdmFieldHandle* field, diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp index 415caa8b2e..20264bdb64 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp @@ -98,8 +98,7 @@ RimEclipseCase* RimEclipseResultAddress::eclipseCase() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimEclipseResultAddress::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimEclipseResultAddress::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h index a53f0ef761..30a2e8c1c7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.h @@ -44,8 +44,7 @@ class RimEclipseResultAddress : public caf::PdmObject RimEclipseCase* eclipseCase() const; private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: caf::PdmField m_resultName; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp index de74d7cf52..32a6ee546e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.cpp @@ -654,7 +654,7 @@ void RimEclipseResultDefinition::loadDataAndUpdate() /// //-------------------------------------------------------------------------------------------------- QList - RimEclipseResultDefinition::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimEclipseResultDefinition::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; @@ -860,8 +860,6 @@ QList } } - ( *useOptionsOnly ) = true; - return options; } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.h b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.h index ab31a9b1b1..296cda0784 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultDefinition.h @@ -144,8 +144,7 @@ class RimEclipseResultDefinition : public RimCheckableObject protected: virtual void updateLegendCategorySettings(){}; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void initAfterRead() override; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index 56e9bd8a3c..14d03c2fa4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -439,11 +439,9 @@ QList toOptionList( const QStringList& varList ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimEclipseStatisticsCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimEclipseStatisticsCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - if ( useOptionsOnly ) *useOptionsOnly = true; RimIdenticalGridCaseGroup* idgcg = caseGroup(); if ( !( caseGroup() && caseGroup()->mainCase() && caseGroup()->mainCase()->eclipseCaseData() ) ) @@ -515,7 +513,7 @@ QList return toOptionList( sourceCaseNames ); } - if ( !options.size() ) options = RimEclipseCase::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + if ( !options.size() ) options = RimEclipseCase::calculateValueOptions( fieldNeedingOptions ); return options; } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h index 6731fbbe73..97e55e6fbd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.h @@ -87,8 +87,7 @@ class RimEclipseStatisticsCase : public RimEclipseCase void updatePercentileUiVisibility(); void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void loadSimulationWellDataFromSourceCase(); diff --git a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp index 8e3417b78c..5071a6bbd3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.cpp @@ -104,10 +104,9 @@ void RimEnsembleFractureStatisticsPlot::defineUiOrdering( QString uiConfigName, /// //-------------------------------------------------------------------------------------------------- QList - RimEnsembleFractureStatisticsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimEnsembleFractureStatisticsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimStatisticsPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimStatisticsPlot::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_ensembleFractureStatistics ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h index 4a04d912fb..06634561ad 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlot.h @@ -47,8 +47,7 @@ class RimEnsembleFractureStatisticsPlot : public RimStatisticsPlot // Overridden PDM methods void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; QString createAutoName() const override; QString createXAxisTitle() const override; diff --git a/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp index c19453131f..12845cfc4f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.cpp @@ -112,8 +112,7 @@ QColor RimEquilibriumAxisAnnotation::color() const /// //-------------------------------------------------------------------------------------------------- QList - RimEquilibriumAxisAnnotation::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimEquilibriumAxisAnnotation::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.h b/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.h index 5f09f7d24d..e1b354c386 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.h +++ b/ApplicationLibCode/ProjectDataModel/RimEquilibriumAxisAnnotation.h @@ -56,8 +56,7 @@ class RimEquilibriumAxisAnnotation : public RimPlotAxisAnnotation double value() const override; QColor color() const override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp index 709f3ed5d9..ecef70c5e9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp @@ -80,7 +80,7 @@ void RimGridCalculationVariable::defineUiOrdering( QString uiConfigName, caf::Pd /// //-------------------------------------------------------------------------------------------------- QList - RimGridCalculationVariable::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimGridCalculationVariable::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; @@ -118,8 +118,6 @@ QList RimTools::timeStepsForCase( m_eclipseCase(), &options ); } - if ( useOptionsOnly ) *useOptionsOnly = true; - return options; } diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h index 6e51b739de..a3f52f254e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h @@ -57,8 +57,7 @@ class RimGridCalculationVariable : public RimUserDefinedCalculationVariable private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; RigCaseCellResultsData* currentGridCellResults() const; QStringList getResultNamesForResultType( RiaDefines::ResultCatType resultCatType, const RigCaseCellResultsData* results ); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp index 7195f826ba..6ee0ebd10e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp @@ -169,10 +169,9 @@ void RimGridStatisticsPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimGridStatisticsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimGridStatisticsPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimStatisticsPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimStatisticsPlot::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_case ) { @@ -202,7 +201,6 @@ QList } } - ( *useOptionsOnly ) = true; return options; } diff --git a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.h b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.h index 0e60a92a32..d2c6ed1334 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.h @@ -54,8 +54,7 @@ class RimGridStatisticsPlot : public RimStatisticsPlot // Overridden PDM methods void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void initAfterRead() override; diff --git a/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp b/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp index df65dd58a0..6edae132a8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.cpp @@ -564,8 +564,7 @@ void RimMudWeightWindowParameters::defineEditorAttribute( const caf::PdmFieldHan /// //-------------------------------------------------------------------------------------------------- QList - RimMudWeightWindowParameters::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimMudWeightWindowParameters::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.h b/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.h index 496cab3f5e..64135fd99c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.h +++ b/ApplicationLibCode/ProjectDataModel/RimMudWeightWindowParameters.h @@ -109,8 +109,7 @@ class RimMudWeightWindowParameters : public caf::PdmObject QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineGroup( caf::PdmUiOrdering& uiOrdering, const QString& title, diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 50f32ee20b..4e28c76f25 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -740,10 +740,9 @@ void RimMultiPlot::uiOrderingForMultiPlotLayout( QString uiConfigName, caf::PdmU //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimMultiPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimMultiPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimPlotWindow::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_columnCount ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 83b02ca3a9..2aa63fd90a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -127,8 +127,7 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void onLoadDataAndUpdate() override; void initAfterRead() override; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index c7bfaea631..26334541fc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -162,11 +162,9 @@ caf::PdmFieldHandle* RimPlotAxisProperties::userDescriptionField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimPlotAxisProperties::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimPlotAxisProperties::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - *useOptionsOnly = true; if ( fieldNeedingOptions == &scaleFactor ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index d6ed2c1231..ba60fc813a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -59,10 +59,10 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface void setAlwaysRequired( bool enable ); - void setEnableTitleTextSettings( bool enable ); - void enableRangeSettings( bool enable ); - void setNameForUnusedAxis(); - void setNameAndAxis( const QString& objectName, const QString& axistTitle, RiaDefines::PlotAxis axis, int axisIndex = 0 ); + void setEnableTitleTextSettings( bool enable ); + void enableRangeSettings( bool enable ); + void setNameForUnusedAxis(); + void setNameAndAxis( const QString& objectName, const QString& axistTitle, RiaDefines::PlotAxis axis, int axisIndex = 0 ); AxisTitlePositionType titlePosition() const override; int titleFontSize() const override; @@ -126,8 +126,7 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; private: void updateOptionSensitivity(); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp index 08e96ad8fe..760199cc86 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.cpp @@ -219,8 +219,7 @@ void RimPlotCurveAppearance::defineUiOrdering( QString uiConfigName, caf::PdmUiO //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimPlotCurveAppearance::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimPlotCurveAppearance::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h index f251c52c92..445dac52b8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurveAppearance.h @@ -98,8 +98,7 @@ class RimPlotCurveAppearance : public caf::PdmObject protected: // Overridden PDM methods void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void initAfterRead() override; protected: diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp index a6bc804aa8..17b33e746b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp @@ -265,8 +265,7 @@ void RimPlotWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimPlotWindow::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimPlotWindow::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_plotLegendsHorizontal ) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h index 2cc623b7d6..304c0e8bfa 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h @@ -82,8 +82,7 @@ class RimPlotWindow : public RimViewWindow protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void uiOrderingForPlotLayout( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ); diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp index 1e6ebf5531..7dd2f753eb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.cpp @@ -1327,8 +1327,7 @@ void RimRegularLegendConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiO //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimRegularLegendConfig::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimRegularLegendConfig::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { bool hasStimPlanParent = false; bool hasEnsembleCurveSetParent = false; diff --git a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h index 71775bde93..19cbb1fbcc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h +++ b/ApplicationLibCode/ProjectDataModel/RimRegularLegendConfig.h @@ -182,8 +182,7 @@ class RimRegularLegendConfig : public RimLegendConfig caf::PdmUiEditorAttribute* attribute ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void updateLegend(); void updateFieldVisibility(); diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp index c37965fe65..7a092a03a5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -516,7 +516,7 @@ void RimSimWellInViewCollection::fieldChangedByUi( const caf::PdmFieldHandle* ch /// //-------------------------------------------------------------------------------------------------- QList - RimSimWellInViewCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimSimWellInViewCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; @@ -559,8 +559,6 @@ QList options.push_back( optionItem ); } } - - if ( useOptionsOnly ) *useOptionsOnly = true; } else if ( fieldNeedingOptions == &m_wellDiskSummaryCase ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.h b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.h index 44eb6ead02..5028af65a7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.h @@ -168,8 +168,7 @@ class RimSimWellInViewCollection : public caf::PdmObject void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp index 1b75ec9a9c..ef5c266400 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp @@ -163,8 +163,7 @@ void RimStimPlanColors::loadDataAndUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimStimPlanColors::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimStimPlanColors::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.h b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.h index 0b488eab60..94c288b1ce 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.h +++ b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.h @@ -72,8 +72,7 @@ class RimStimPlanColors : public RimCheckableObject void updateConductivityResultName(); protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp index 0bca5931e1..e0bc93d4cb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp @@ -197,7 +197,7 @@ void RimSurfaceIntersectionBand::fieldChangedByUi( const caf::PdmFieldHandle* ch /// //-------------------------------------------------------------------------------------------------- QList - RimSurfaceIntersectionBand::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimSurfaceIntersectionBand::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.h b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.h index ebebb43695..76415e12ef 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.h +++ b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.h @@ -61,8 +61,7 @@ class RimSurfaceIntersectionBand : public RimCheckableObject caf::PdmFieldHandle* userDescriptionField() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp index 650d4fe235..826f39d9ca 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.cpp @@ -90,7 +90,7 @@ void RimSurfaceIntersectionCurve::fieldChangedByUi( const caf::PdmFieldHandle* c /// //-------------------------------------------------------------------------------------------------- QList - RimSurfaceIntersectionCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimSurfaceIntersectionCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.h b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.h index a111217845..d8bbbcaabd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.h +++ b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCurve.h @@ -54,8 +54,7 @@ class RimSurfaceIntersectionCurve : public RimCheckableObject caf::PdmFieldHandle* userDescriptionField() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp b/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp index 0dbb989ac6..088f09b077 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTensorResults.cpp @@ -290,11 +290,9 @@ caf::PdmFieldHandle* RimTensorResults::objectToggleField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimTensorResults::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimTensorResults::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - *useOptionsOnly = true; if ( fieldNeedingOptions == &m_resultFieldNameUiField ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimTensorResults.h b/ApplicationLibCode/ProjectDataModel/RimTensorResults.h index 321c084c64..ba414b3896 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTensorResults.h +++ b/ApplicationLibCode/ProjectDataModel/RimTensorResults.h @@ -85,8 +85,7 @@ class RimTensorResults : public RimFemResultObserver, public caf::PdmObject std::vector getResultMetaDataForUIFieldSetting(); void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; caf::PdmFieldHandle* objectToggleField() override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void initAfterRead() override; void defineEditorAttribute( const caf::PdmFieldHandle* field, diff --git a/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.cpp b/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.cpp index 43cb02e531..a667d6fa1f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.cpp @@ -306,8 +306,7 @@ void RimTimeStepFilter::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimTimeStepFilter::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimTimeStepFilter::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList optionItems; diff --git a/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.h b/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.h index 2beb8dcc87..a5612c91a5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.h +++ b/ApplicationLibCode/ProjectDataModel/RimTimeStepFilter.h @@ -73,8 +73,7 @@ class RimTimeStepFilter : public caf::PdmObject // PDM overrides void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp index 9c92736097..ccf8afe931 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.cpp @@ -844,10 +844,9 @@ void RimVfpPlot::setFixedVariableUiEditability( caf::PdmField& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimVfpPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimVfpPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = RimPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = RimPlot::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_liquidFlowRateIdx ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h index ca832c04b7..981623ac0c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlot.h @@ -95,8 +95,7 @@ class RimVfpPlot : public RimPlot void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void calculateTableValueOptions( RimVfpDefines::ProductionVariableType variableType, QList& options ); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewController.cpp b/ApplicationLibCode/ProjectDataModel/RimViewController.cpp index ad9e5255c3..f9ee4ccda0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewController.cpp @@ -107,8 +107,7 @@ RimViewController::~RimViewController() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimViewController::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimViewController::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimViewController.h b/ApplicationLibCode/ProjectDataModel/RimViewController.h index 2008459091..5e65cf8e0f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewController.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewController.h @@ -82,8 +82,7 @@ class RimViewController : public caf::PdmObject protected: // Pdm overridden methods void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp index 0e60366614..f53b725bc4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp @@ -514,8 +514,7 @@ void RimViewLinker::notifyManagedViewChange( RimGridView* oldManagedView, RimGri //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimViewLinker::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimViewLinker::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimViewLinker.h b/ApplicationLibCode/ProjectDataModel/RimViewLinker.h index bd03e069c5..dacd1fc0e8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewLinker.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewLinker.h @@ -100,8 +100,7 @@ class RimViewLinker : public caf::PdmObject void initAfterRead() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp b/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp index e8fccb3530..843ad0a902 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimWbsParameters.cpp @@ -311,8 +311,7 @@ caf::PdmField* RimWbsParameters::sourceFi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWbsParameters::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimWbsParameters::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/RimWbsParameters.h b/ApplicationLibCode/ProjectDataModel/RimWbsParameters.h index 08e2e612a0..d3df743bf2 100644 --- a/ApplicationLibCode/ProjectDataModel/RimWbsParameters.h +++ b/ApplicationLibCode/ProjectDataModel/RimWbsParameters.h @@ -58,8 +58,7 @@ class RimWbsParameters : public caf::PdmObject caf::PdmField* sourceField( const RigWbsParameter& parameter ) const; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void loadDataAndUpdate(); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.cpp index 3559a49c40..d24692fc93 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.cpp @@ -65,7 +65,7 @@ RimElasticPropertyScaling::~RimElasticPropertyScaling() /// //-------------------------------------------------------------------------------------------------- QList - RimElasticPropertyScaling::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimElasticPropertyScaling::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_formation ) @@ -96,8 +96,6 @@ QList } } - if ( useOptionsOnly ) *useOptionsOnly = true; - return options; } diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.h index 2d6c5a4a1f..bce621a588 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScaling.h @@ -56,8 +56,7 @@ class RimElasticPropertyScaling : public RimCheckableNamedObject caf::Signal<> changed; protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; static RimEclipseCase* getEclipseCase(); diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.cpp index c0b6c79107..a21cb9e707 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.cpp @@ -108,8 +108,7 @@ void RimFaciesProperties::clearFaciesCodeNames() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimFaciesProperties::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimFaciesProperties::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_colorLegend ) diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.h index 75a29ff728..d92f878664 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimFaciesProperties.h @@ -63,8 +63,7 @@ class RimFaciesProperties : public caf::PdmObject QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; private: diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.cpp index 206a266e1a..b36de9ac50 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.cpp @@ -70,8 +70,7 @@ RimNonNetLayers::~RimNonNetLayers() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimNonNetLayers::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimNonNetLayers::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_facies ) diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.h index 76f0ed2110..d89e7f9842 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimNonNetLayers.h @@ -54,8 +54,7 @@ class RimNonNetLayers : public RimCheckableObject protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp index b2307a0ea3..97a39a68fe 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp @@ -399,8 +399,7 @@ void RimStimPlanModel::fieldChangedByUi( const caf::PdmFieldHandle* changedField //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimStimPlanModel::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimStimPlanModel::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h index 5b5dd1c890..a313f440fe 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h @@ -194,8 +194,7 @@ class RimStimPlanModel : public RimCheckableNamedObject, public RimWellPathCompo protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp index f1e809631f..f493ff0bcb 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.cpp @@ -104,8 +104,7 @@ void RimStimPlanModelPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrd //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimStimPlanModelPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimStimPlanModelPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.h index 30180f013a..a2b20374ea 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlot.h @@ -41,8 +41,7 @@ class RimStimPlanModelPlot : public RimDepthTrackPlot RimWellLogExtractionCurve* findCurveByProperty( RiaDefines::CurveProperty curveProperty ) const; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void onLoadDataAndUpdate() override; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp index 2df5c98179..291caf0a6e 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp @@ -200,8 +200,7 @@ void RimStimPlanModelTemplate::fieldChangedByUi( const caf::PdmFieldHandle* chan //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimStimPlanModelTemplate::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimStimPlanModelTemplate::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.h index 250947215a..964ccbe80b 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.h @@ -125,8 +125,7 @@ class RimStimPlanModelTemplate : public RimNamedObject void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void initAfterRead() override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp index b126b847f3..e04384781b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.cpp @@ -240,8 +240,7 @@ void RimDerivedEnsembleCaseCollection::onLoadDataAndUpdate() /// //-------------------------------------------------------------------------------------------------- QList - RimDerivedEnsembleCaseCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimDerivedEnsembleCaseCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.h index 26b5dfec29..abfe910270 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedEnsembleCaseCollection.h @@ -70,8 +70,7 @@ class RimDerivedEnsembleCaseCollection : public RimSummaryCaseCollection void onLoadDataAndUpdate() override; private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp index b6874171ca..abd637bf21 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.cpp @@ -468,8 +468,7 @@ void RimDerivedSummaryCase::defineUiOrdering( QString uiConfigName, caf::PdmUiOr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimDerivedSummaryCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimDerivedSummaryCase::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.h index 81c31360a6..0b06112ad9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimDerivedSummaryCase.h @@ -90,8 +90,7 @@ class RimDerivedSummaryCase : public RimSummaryCase private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp index 8b5b11297c..7d778e8433 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp @@ -250,8 +250,7 @@ void RimEnsembleCurveFilter::setSummaryAddresses( std::vector - RimEnsembleCurveFilter::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimEnsembleCurveFilter::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.h index 7ef9186092..95e6ae074b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.h @@ -67,8 +67,7 @@ class RimEnsembleCurveFilter : public caf::PdmObject std::vector summaryAddresses() const; void setSummaryAddresses( std::vector addresses ); - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void updateAddressesUiField(); void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; caf::PdmFieldHandle* userDescriptionField() override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp index 2ffc05d66e..9c5feb6a22 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp @@ -98,8 +98,7 @@ int RimEnsembleCurveFilterCollection::countActiveFilters() const /// //-------------------------------------------------------------------------------------------------- QList - RimEnsembleCurveFilterCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimEnsembleCurveFilterCollection::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.h index 82a189b1ea..d072dbd191 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.h @@ -48,8 +48,7 @@ class RimEnsembleCurveFilterCollection : public caf::PdmObject RiuTextContentFrame* makeFilterDescriptionFrame() const; private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /* = "" */ ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 0084c64bc1..9db5ad7871 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -1093,8 +1093,7 @@ void RimEnsembleCurveSet::defineEditorAttribute( const caf::PdmFieldHandle* fiel //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimEnsembleCurveSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimEnsembleCurveSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index a7ca82c4b5..2aa535d10f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -185,11 +185,10 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; - std::set allAvailableTimeSteps(); - std::set timestepDefiningSourceCases(); - RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser(); + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; + std::set allAvailableTimeSteps(); + std::set timestepDefiningSourceCases(); + RiaSummaryCurveDefinitionAnalyser* getOrCreateSelectedCurveDefAnalyser(); std::vector curveDefinitions() const; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp index b2499ad11a..2751593b50 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.cpp @@ -112,8 +112,7 @@ QString RimObservedSummaryData::customWellName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimObservedSummaryData::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimObservedSummaryData::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { if ( fieldNeedingOptions == &m_summaryCategory ) { @@ -128,7 +127,7 @@ QList return options; } - return RimSummaryCase::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + return RimSummaryCase::calculateValueOptions( fieldNeedingOptions ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h index 30343a37df..c01bac46c3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimObservedSummaryData.h @@ -47,8 +47,7 @@ class RimObservedSummaryData : public RimSummaryCase QString customWellName() const; private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; private: diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 353a8b38d9..232da869da 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -471,11 +471,9 @@ void RimSummaryCurve::setIsEnsembleCurve( bool isEnsembleCurve ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimSummaryCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimSummaryCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { - QList options = - this->RimPlotCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + QList options = this->RimPlotCurve::calculateValueOptions( fieldNeedingOptions ); if ( !options.isEmpty() ) return options; if ( fieldNeedingOptions == &m_yValuesSummaryCase || fieldNeedingOptions == &m_xValuesSummaryCase ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h index 664420f628..d32b975176 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -119,8 +119,7 @@ class RimSummaryCurve : public RimStackablePlotCurve // Overridden PDM methods void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp index 4ca7dab83e..0b5b99c420 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp @@ -297,8 +297,7 @@ void RimSummaryPlotFilterTextCurveSetEditor::defineEditorAttribute( const caf::P /// //-------------------------------------------------------------------------------------------------- QList - RimSummaryPlotFilterTextCurveSetEditor::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimSummaryPlotFilterTextCurveSetEditor::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_selectedSources ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.h index 5835f6cacf..2a0f6f7850 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.h @@ -37,8 +37,7 @@ class RimSummaryPlotFilterTextCurveSetEditor : public caf::PdmObject void updateTextFilter(); protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index 70c9a72f2d..d5bf73b064 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -186,8 +186,7 @@ void RimSummaryPlotManager::fieldChangedByUi( const caf::PdmFieldHandle* changed //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimSummaryPlotManager::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimSummaryPlotManager::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_summaryPlot ) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h index 70e2a5d336..913f3d7dda 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.h @@ -53,8 +53,7 @@ class RimSummaryPlotManager : public QObject, public caf::PdmObject, public caf: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index a5e2fd9e1f..f22445124e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -178,14 +178,13 @@ void RimSummaryPlotSourceStepping::defineUiOrdering( QString uiConfigName, caf:: /// //-------------------------------------------------------------------------------------------------- QList - RimSummaryPlotSourceStepping::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimSummaryPlotSourceStepping::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( ( fieldNeedingOptions == &m_includeEnsembleCasesForCaseStepping ) || ( fieldNeedingOptions == &m_stepDimension ) ) { - return caf::PdmObject::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + return caf::PdmObject::calculateValueOptions( fieldNeedingOptions ); } if ( ( fieldNeedingOptions == &m_placeholderForLabel ) || ( fieldNeedingOptions == &m_indexLabel ) ) @@ -887,8 +886,7 @@ bool RimSummaryPlotSourceStepping::isYAxisStepping() const //-------------------------------------------------------------------------------------------------- void RimSummaryPlotSourceStepping::modifyCurrentIndex( caf::PdmValueField* valueField, int indexOffset, bool notifyChange ) { - bool useOptionsOnly; - QList options = calculateValueOptions( valueField, &useOptionsOnly ); + QList options = calculateValueOptions( valueField ); RimDataSourceSteppingTools::modifyCurrentIndex( valueField, options, indexOffset, notifyChange ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index 6cba730f02..4b206c557e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -81,8 +81,7 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index affd7ce431..8b9cda5a31 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -368,11 +368,9 @@ const QString RimSummaryTimeAxisProperties::axisTitleText() const /// //-------------------------------------------------------------------------------------------------- QList - RimSummaryTimeAxisProperties::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimSummaryTimeAxisProperties::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - *useOptionsOnly = true; if ( fieldNeedingOptions == &m_dateFormat ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h index c19059b8b9..a7c38f65d5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h @@ -112,8 +112,7 @@ class RimSummaryTimeAxisProperties : public RimPlotAxisPropertiesInterface protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; caf::PdmFieldHandle* objectToggleField() override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp index f12db41728..0f3e974448 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.cpp @@ -229,8 +229,7 @@ const RigSurface* RimEnsembleSurface::statisticsSurface() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimEnsembleSurface::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimEnsembleSurface::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.h b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.h index 495474920c..493f78b7f4 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.h +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimEnsembleSurface.h @@ -55,8 +55,7 @@ class RimEnsembleSurface : public RimSurfaceCollection RimSurface* findStatisticsSurface( RigSurfaceStatisticsCalculator::StatisticsType statisticsType ); protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void initAfterRead() override; diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp index 71a4f691ce..2fab377fce 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.cpp @@ -102,8 +102,7 @@ RimSurface* RimGridCaseSurface::createCopy() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimGridCaseSurface::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimGridCaseSurface::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.h b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.h index 22980b6e28..3626e1894d 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.h +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimGridCaseSurface.h @@ -48,8 +48,7 @@ class RimGridCaseSurface : public RimSurface std::vector>* structGridVertexIndices ); protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp index 1a06b295e7..55f00712f7 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.cpp @@ -171,7 +171,7 @@ void RimSurfaceResultDefinition::defineUiOrdering( QString uiConfigName, caf::Pd /// //-------------------------------------------------------------------------------------------------- QList - RimSurfaceResultDefinition::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimSurfaceResultDefinition::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.h b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.h index 0dbaff678e..c572cbd6f2 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.h +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceResultDefinition.h @@ -50,10 +50,9 @@ class RimSurfaceResultDefinition : public RimCheckableNamedObject void assignDefaultProperty(); private: - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; RigSurface* surfaceData(); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp index 9a7abe0e19..d703adc36c 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.cpp @@ -457,11 +457,11 @@ void Rim3dWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* c /// //-------------------------------------------------------------------------------------------------- QList - Rim3dWellLogExtractionCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + Rim3dWellLogExtractionCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - options = Rim3dWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + options = Rim3dWellLogCurve::calculateValueOptions( fieldNeedingOptions ); if ( fieldNeedingOptions == &m_case ) { diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.h index f6511d0af5..00a710e36a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogExtractionCurve.h @@ -65,8 +65,7 @@ class Rim3dWellLogExtractionCurve : public Rim3dWellLogCurve void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void initAfterRead() override; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp index 82219e3d23..fa524bab52 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.cpp @@ -195,12 +195,11 @@ void Rim3dWellLogFileCurve::fieldChangedByUi( const caf::PdmFieldHandle* changed //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - Rim3dWellLogFileCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList Rim3dWellLogFileCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - options = Rim3dWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + options = Rim3dWellLogCurve::calculateValueOptions( fieldNeedingOptions ); if ( !options.empty() ) return options; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.h index 08e4dbd669..9e356e59f0 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogFileCurve.h @@ -50,8 +50,7 @@ class Rim3dWellLogFileCurve : public Rim3dWellLogCurve void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp index 9fa5771eaf..fe2dabd084 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.cpp @@ -159,8 +159,7 @@ void Rim3dWellLogRftCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedF //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - Rim3dWellLogRftCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList Rim3dWellLogRftCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.h index 6272a7db55..6083f57458 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/Rim3dWellLogRftCurve.h @@ -55,8 +55,7 @@ class Rim3dWellLogRftCurve : public Rim3dWellLogCurve void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; private: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp index 5a0a6cb269..758d7e30ba 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.cpp @@ -561,7 +561,7 @@ caf::PdmFieldHandle* RimEnsembleWellLogCurveSet::objectToggleField() /// //-------------------------------------------------------------------------------------------------- QList - RimEnsembleWellLogCurveSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimEnsembleWellLogCurveSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.h index 4bf575491a..f86181f02b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogCurveSet.h @@ -138,8 +138,7 @@ class RimEnsembleWellLogCurveSet : public caf::PdmObject, public RimEnsembleCurv caf::PdmFieldHandle* objectToggleField() override; void initAfterRead() override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp index 2510035299..c44703ed2b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp @@ -791,8 +791,7 @@ void RimWellLogCurveCommonDataSource::fieldChangedByUi( const caf::PdmFieldHandl /// //-------------------------------------------------------------------------------------------------- QList - RimWellLogCurveCommonDataSource::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + RimWellLogCurveCommonDataSource::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; @@ -1075,7 +1074,6 @@ void RimWellLogCurveCommonDataSource::defineEditorAttribute( const caf::PdmField //-------------------------------------------------------------------------------------------------- void RimWellLogCurveCommonDataSource::modifyCurrentIndex( caf::PdmValueField* field, int indexOffset ) { - bool useOptionsOnly; - QList options = calculateValueOptions( field, &useOptionsOnly ); + QList options = calculateValueOptions( field ); RimDataSourceSteppingTools::modifyCurrentIndex( field, options, indexOffset ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h index 67d9b74ea5..6f0b3ce44f 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h @@ -95,8 +95,7 @@ class RimWellLogCurveCommonDataSource : public caf::PdmObject protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp index 35dfb407fc..307999ac3d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.cpp @@ -718,11 +718,11 @@ void RimWellLogExtractionCurve::clearGeneratedSimWellPaths() /// //-------------------------------------------------------------------------------------------------- QList - RimWellLogExtractionCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RimWellLogExtractionCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions ); if ( options.size() > 0 ) return options; if ( fieldNeedingOptions == &m_wellPath ) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.h index 42129a11a1..fd96d8af1f 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogExtractionCurve.h @@ -108,8 +108,7 @@ class RimWellLogExtractionCurve : public RimWellLogCurve void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void initAfterRead() override; static QString dataSourceGroupKeyword(); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp index 80cc39f649..133d580578 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.cpp @@ -359,12 +359,11 @@ void RimWellLogFileCurve::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWellLogFileCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimWellLogFileCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions ); if ( options.size() > 0 ) return options; if ( fieldNeedingOptions == &m_wellPath ) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.h index 302e4d4496..73416cd47a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileCurve.h @@ -65,8 +65,7 @@ class RimWellLogFileCurve : public RimWellLogCurve void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void initAfterRead() override; bool isRftPlotChild() const; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index 7490134a10..f5441f089f 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -697,12 +697,11 @@ void RimWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWellLogRftCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimWellLogRftCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions ); if ( !options.empty() ) return options; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h index 9cd38fb196..64fe815ac6 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h @@ -105,8 +105,7 @@ class RimWellLogRftCurve : public RimWellLogCurve // Pdm overrrides void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; std::vector perPointLabels() const; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 6fbf676bef..897e12f0d2 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -1059,8 +1059,7 @@ void RimWellLogTrack::updateAxes() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWellLogTrack::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimWellLogTrack::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index 59e2357cb5..56ef8fdd38 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -264,8 +264,7 @@ class RimWellLogTrack : public RimPlot void curveAppearanceChanged( const caf::SignalEmitter* emitter ); void curveStackingChanged( const caf::SignalEmitter* emitter, bool stacked ); - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void initAfterRead() override; diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp index 20107e572c..1f969e59fe 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.cpp @@ -245,12 +245,11 @@ void RimWellMeasurementCurve::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTr //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimWellMeasurementCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimWellMeasurementCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; - options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); + options = RimWellLogCurve::calculateValueOptions( fieldNeedingOptions ); if ( options.size() > 0 ) return options; if ( fieldNeedingOptions == &m_wellPath ) diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.h b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.h index 3f5c8a6271..82c76270d6 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCurve.h @@ -60,8 +60,7 @@ class RimWellMeasurementCurve : public RimWellLogCurve void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; RiuPlotCurveSymbol::PointSymbolEnum getSymbolForMeasurementKind( const QString& measurementKind ); cvf::Color3f getColorForMeasurementKind( const QString& measurementKind ); diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp index 4070c5d51a..f0410796f6 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.cpp @@ -321,8 +321,7 @@ bool RimWellMeasurementInView::hasMeasurementKindForWell( const RimWellPath* //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimWellMeasurementInView::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimWellMeasurementInView::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_wells ) diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.h b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.h index 0a11e0d46a..ddf78a21b7 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.h +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementInView.h @@ -66,8 +66,7 @@ class RimWellMeasurementInView : public RimCheckableNamedObject void initAfterRead() override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; bool updateLegendData(); static bool hasMeasurementKindForWell( const RimWellPath* wellPath, diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp index 328d4d0236..472d8955ed 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.cpp @@ -219,8 +219,7 @@ void RimModeledWellPath::fieldChangedByUi( const caf::PdmFieldHandle* changedFie //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimModeledWellPath::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimModeledWellPath::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.h index 39ae1e880f..0833836feb 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimModeledWellPath.h @@ -49,8 +49,7 @@ class RimModeledWellPath : public RimWellPath void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void updateGeometry( bool fullUpdate ); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp index 7c7ae03ee2..694983c012 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp @@ -153,8 +153,7 @@ void RimWellIASettings::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWellIASettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimWellIASettings::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.h index 1ce2f839d1..a51b53e5d5 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.h @@ -90,8 +90,7 @@ class RimWellIASettings : public RimCheckableNamedObject void updateVisualization(); protected: - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp index 5bf5f44f50..43675e0d5e 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp @@ -495,8 +495,7 @@ void RimWellPath::fieldChangedByUi( const caf::PdmFieldHandle* changedField, con //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWellPath::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimWellPath::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h index 07e7ee2c45..ca007ddf82 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.h @@ -178,8 +178,7 @@ class RimWellPath : public caf::PdmObject, public RimWellPathComponentInterface bool isDeletable() const override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void initAfterRead() override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp index 93f480b9a7..5d84d1d02d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.cpp @@ -202,8 +202,7 @@ bool RimWellPathAttribute::isDiameterSupported() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimWellPathAttribute::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimWellPathAttribute::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; if ( fieldNeedingOptions == &m_type ) diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.h index 31128a6bb5..f682505d1a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttribute.h @@ -60,8 +60,7 @@ class RimWellPathAttribute : public caf::PdmObject, public RimWellPathComponentI static std::set supportedDiameters( RiaDefines::WellPathComponentType type ); bool isDiameterSupported() const; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; static QString generateInchesLabel( double diameter ); void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp index 3550448ab6..00e6442c52 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp @@ -479,8 +479,7 @@ void RimWellPathGeometryDef::updateWellPathVisualization( bool fullUpdate ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList - RimWellPathGeometryDef::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) +QList RimWellPathGeometryDef::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.h index 50b2a66802..772e7f44e1 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.h @@ -111,8 +111,7 @@ class RimWellPathGeometryDef : public caf::PdmObject void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override; void initAfterRead() override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; RiaLineArcWellPathCalculator lineArcWellPathCalculator() const; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp index 1dde40d4af..d581b2d3de 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.cpp @@ -213,8 +213,7 @@ void RimWellPathTieIn::fieldChangedByUi( const caf::PdmFieldHandle* changedField //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWellPathTieIn::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) +QList RimWellPathTieIn::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.h b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.h index 77ddbf05f1..549bc04499 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.h +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathTieIn.h @@ -50,8 +50,7 @@ class RimWellPathTieIn : public caf::PdmObject void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp index a60b25f53a..4b23e8d81c 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp @@ -823,7 +823,7 @@ void RiuSummaryVectorSelectionUi::fieldChangedByUi( const caf::PdmFieldHandle* c /// //-------------------------------------------------------------------------------------------------- QList - RiuSummaryVectorSelectionUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) + RiuSummaryVectorSelectionUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { QList options; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h index 69abdf5665..fa07030d20 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.h @@ -76,8 +76,7 @@ class RiuSummaryVectorSelectionUi : public caf::PdmObject private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, diff --git a/Fwk/AppFwk/cafPdmCvf/cafPdmMat3d/cafPdmUiCoreMat3d.h b/Fwk/AppFwk/cafPdmCvf/cafPdmMat3d/cafPdmUiCoreMat3d.h index 6fee9bd031..f5ea85d59f 100644 --- a/Fwk/AppFwk/cafPdmCvf/cafPdmMat3d/cafPdmUiCoreMat3d.h +++ b/Fwk/AppFwk/cafPdmCvf/cafPdmMat3d/cafPdmUiCoreMat3d.h @@ -69,10 +69,7 @@ class PdmUiFieldSpecialization } /// Methods to get a list of options for a field, specialized for AppEnum - static QList valueOptions( bool* useOptionsOnly, const cvf::Mat3d& ) - { - return QList(); - } + static QList valueOptions( const cvf::Mat3d& ) { return QList(); } /// Methods to retrieve the possible PdmObject pointed to by a field static void childObjects( const PdmDataValueField&, std::vector* ) {} diff --git a/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreColor3f.h b/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreColor3f.h index fe8f6cf8b3..656b9a690e 100644 --- a/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreColor3f.h +++ b/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreColor3f.h @@ -69,10 +69,7 @@ class PdmUiFieldSpecialization } /// Methods to get a list of options for a field, specialized for AppEnum - static QList valueOptions( bool* useOptionsOnly, const cvf::Color3f& ) - { - return QList(); - } + static QList valueOptions( const cvf::Color3f& ) { return QList(); } /// Methods to retrieve the possible PdmObject pointed to by a field static void childObjects( const PdmDataValueField&, std::vector* ) {} diff --git a/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreMat4d.h b/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreMat4d.h index 5c56a271f1..25902dd8ab 100644 --- a/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreMat4d.h +++ b/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreMat4d.h @@ -69,10 +69,7 @@ class PdmUiFieldSpecialization } /// Methods to get a list of options for a field, specialized for AppEnum - static QList valueOptions( bool* useOptionsOnly, const cvf::Mat4d& ) - { - return QList(); - } + static QList valueOptions( const cvf::Mat4d& ) { return QList(); } /// Methods to retrieve the possible PdmObject pointed to by a field static void childObjects( const PdmDataValueField&, std::vector* ) {} diff --git a/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreVec3d.h b/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreVec3d.h index 817bd45ddf..073f34da31 100644 --- a/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreVec3d.h +++ b/Fwk/AppFwk/cafPdmCvf/cafPdmUiCoreVec3d.h @@ -69,10 +69,7 @@ class PdmUiFieldSpecialization } /// Methods to get a list of options for a field, specialized for AppEnum - static QList valueOptions( bool* useOptionsOnly, const cvf::Vec3d& ) - { - return QList(); - } + static QList valueOptions( const cvf::Vec3d& ) { return QList(); } /// Methods to retrieve the possible PdmObject pointed to by a field static void childObjects( const PdmDataValueField&, std::vector* ) {} diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmFieldTypeSpecializations.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmFieldTypeSpecializations.h index aaf1fb44bf..ec8a7dcdb9 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmFieldTypeSpecializations.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmFieldTypeSpecializations.h @@ -46,10 +46,7 @@ class PdmUiFieldSpecialization> return variantValue.value>() == variantValue2.value>(); } - static QList valueOptions( bool* useOptionsOnly, const PdmPointer& ) - { - return QList(); - } + static QList valueOptions( const PdmPointer& ) { return QList(); } }; //================================================================================================== @@ -94,10 +91,7 @@ class PdmUiFieldSpecialization> } /// Methods to get a list of options for a field, specialized for AppEnum - static QList valueOptions( bool* useOptionsOnly, const std::list& ) - { - return QList(); - } + static QList valueOptions( const std::list& ) { return QList(); } /// Methods to retrieve the possible PdmObject pointed to by a field static void childObjects( const PdmDataValueField>&, std::vector* ) {} @@ -130,10 +124,7 @@ class PdmUiFieldSpecialization> } /// Methods to get a list of options for a field, specialized for AppEnum - static QList valueOptions( bool* useOptionsOnly, const std::vector& ) - { - return QList(); - } + static QList valueOptions( const std::vector& ) { return QList(); } /// Methods to retrieve the possible PdmObject pointed to by a field static void childObjects( const PdmDataValueField>& field, std::vector* objects ) @@ -169,10 +160,8 @@ class PdmUiFieldSpecialization> } /// Methods to get a list of options for a field, specialized for AppEnum - static QList valueOptions( bool* useOptionsOnly, const caf::AppEnum& ) + static QList valueOptions( const caf::AppEnum& ) { - if ( useOptionsOnly ) *useOptionsOnly = true; - QList optionList; for ( size_t i = 0; i < caf::AppEnum::size(); ++i ) @@ -216,10 +205,7 @@ class PdmUiFieldSpecialization } /// Methods to get a list of options for a field, specialized for AppEnum - static QList valueOptions( bool* useOptionsOnly, const caf::FilePath& ) - { - return QList(); - } + static QList valueOptions( const caf::FilePath& ) { return QList(); } /// Methods to retrieve the possible PdmObject pointed to by a field static void childObjects( const PdmDataValueField& field, std::vector* objects ) {} diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.h index 9f9550805a..2c2c66697c 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.h @@ -18,7 +18,7 @@ class PdmFieldUiCap : public PdmUiFieldHandle public: QVariant uiValue() const override; void setValueFromUiEditor( const QVariant& uiValue, bool notifyFieldChanged ) override; - QList valueOptions( bool* useOptionsOnly ) const override; + QList valueOptions() const override; QVariant toUiBasedQVariant() const override; @@ -49,7 +49,7 @@ class PdmFieldUiCap> : public PdmUiFieldHandle public: QVariant uiValue() const override { return QVariant(); } void setValueFromUiEditor( const QVariant& uiValue, bool notifyFieldChanged ) override {} - QList valueOptions( bool* useOptionsOnly ) const override { return QList(); } + QList valueOptions() const override { return QList(); } QVariant toUiBasedQVariant() const override { return QVariant(); } }; @@ -72,7 +72,7 @@ class PdmFieldUiCap> : public PdmUiFieldHandle public: QVariant uiValue() const override { return QVariant(); } void setValueFromUiEditor( const QVariant& uiValue, bool notifyFieldChanged ) override {} - QList valueOptions( bool* useOptionsOnly ) const override { return QList(); } + QList valueOptions() const override { return QList(); } QVariant toUiBasedQVariant() const override { return QVariant(); } }; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl index b34ee15a6f..9277531673 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafInternalPdmUiFieldCapability.inl @@ -183,22 +183,21 @@ QVariant PdmFieldUiCap::uiValue() const //-------------------------------------------------------------------------------------------------- template -QList PdmFieldUiCap::valueOptions( bool* useOptionsOnly ) const +QList PdmFieldUiCap::valueOptions() const { m_optionEntryCache.clear(); // First check if the owner PdmObject has a value options specification. If it has, we use it. if ( m_field->ownerObject() ) { - m_optionEntryCache = uiObj( m_field->ownerObject() )->calculateValueOptions( this->m_field, useOptionsOnly ); + m_optionEntryCache = uiObj( m_field->ownerObject() )->calculateValueOptions( this->m_field ); } // If we got no options, use the options defined by the type. Normally only caf::AppEnum type if ( !m_optionEntryCache.size() ) { - m_optionEntryCache = - PdmUiFieldSpecialization::valueOptions( useOptionsOnly, m_field->value() ); + m_optionEntryCache = PdmUiFieldSpecialization::valueOptions( m_field->value() ); } if ( m_optionEntryCache.size() && isAutoAddingOptionFromValue() ) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp index b620d72080..ee718b937c 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.cpp @@ -44,7 +44,7 @@ QVariant PdmUiFieldHandle::uiValue() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList PdmUiFieldHandle::valueOptions( bool* useOptionsOnly ) const +QList PdmUiFieldHandle::valueOptions() const { return QList(); } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.h index ee6466a6d8..a6296f1414 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldHandle.h @@ -20,7 +20,7 @@ class PdmUiFieldHandle : public PdmUiItem, public PdmFieldCapability, public Pdm // The QVariant encapsulates the real value, or an index into the valueOptions virtual QVariant uiValue() const; - virtual QList valueOptions( bool* useOptionsOnly ) const; + virtual QList valueOptions() const; void notifyFieldChanged( const QVariant& oldUiBasedQVariant, const QVariant& newUiBasedQVariant ) override; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldSpecialization.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldSpecialization.h index 0c4211da32..59287a8e58 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldSpecialization.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiFieldSpecialization.h @@ -50,10 +50,7 @@ class PdmUiFieldSpecialization } /// Methods to get a list of options for a field, specialized for AppEnum - static QList valueOptions( bool* useOptionsOnly, const T& ) - { - return QList(); - } + static QList valueOptions( const T& ) { return QList(); } /// Methods to retrieve the possible PdmObject pointed to by a field static void childObjects( const PdmDataValueField&, std::vector* ) {} diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h index cc0a8a3d5d..ee395297a1 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.h @@ -61,8 +61,7 @@ class PdmUiObjectHandle : public PdmUiItem, public PdmObjectCapability virtual void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) {} /// Method to re-implement to supply option values for a specific field - virtual QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly ) + virtual QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) { return QList(); } diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp index 2b19200632..865ed7bf59 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp +++ b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp @@ -199,8 +199,7 @@ class SmallDemoPdmObject : public caf::PdmObject //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- - QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) override + QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions) override { QList options; @@ -750,8 +749,7 @@ class SmallDemoPdmObjectA : public caf::PdmObject } } - QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) override + QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions) override { QList options; @@ -794,8 +792,6 @@ class SmallDemoPdmObjectA : public caf::PdmObject } } - if (useOptionsOnly) *useOptionsOnly = true; - return options; } @@ -942,8 +938,7 @@ class DemoPdmObject : public caf::PdmObject //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- - QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) override + QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions) override { QList options; if (&m_multiSelectList == fieldNeedingOptions) @@ -970,8 +965,6 @@ class DemoPdmObject : public caf::PdmObject } } - if (useOptionsOnly) *useOptionsOnly = true; - return options; } diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.cpp b/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.cpp index 8d35e7906e..114b90ac9b 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.cpp +++ b/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.cpp @@ -87,8 +87,7 @@ void ManyGroups::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList ManyGroups::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) +QList ManyGroups::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions) { QList options; diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.h b/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.h index 3464cd52c5..7e01459b50 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.h +++ b/Fwk/AppFwk/cafTests/cafTestApplication/ManyGroups.h @@ -38,8 +38,7 @@ class ManyGroups : public caf::PdmObject //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- - QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) override; + QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions) override; private: double m_doubleMember; diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.cpp b/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.cpp index a1477d84c5..938267befd 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.cpp +++ b/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.cpp @@ -19,8 +19,7 @@ TamComboBox::TamComboBox() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList TamComboBox::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) +QList TamComboBox::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions) { QList options; diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.h b/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.h index 33b3296f16..c5366adb14 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.h +++ b/Fwk/AppFwk/cafTests/cafTestApplication/TamComboBox.h @@ -18,8 +18,7 @@ class TamComboBox : public caf::PdmObject public: TamComboBox(); - virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) override; + virtual QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions) override; virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp index 83045b7465..062fd3689d 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiComboBoxEditor.cpp @@ -217,9 +217,7 @@ void PdmUiComboBoxEditor::configureAndUpdateUi( const QString& uiConfigName ) m_comboBox->setEnabled( !uiField()->isUiReadOnly( uiConfigName ) ); m_comboBox->setToolTip( uiField()->uiToolTip( uiConfigName ) ); - bool fromMenuOnly = true; - QList options = uiField()->valueOptions( &fromMenuOnly ); - CAF_ASSERT( fromMenuOnly ); // Not supported + QList options = uiField()->valueOptions(); m_comboBox->blockSignals( true ); m_comboBox->clear(); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp index 1760042bc4..e5e2404be9 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiFieldEditorHelper.cpp @@ -75,10 +75,7 @@ caf::PdmUiFieldEditorHandle* caf::PdmUiFieldEditorHelper::createFieldEditorForFi { // Handle a single value field with valueOptions: Make a combobox - bool useOptionsOnly = true; - QList options = field->valueOptions( &useOptionsOnly ); - CAF_ASSERT( useOptionsOnly ); // Not supported - + QList options = field->valueOptions(); if ( !options.empty() ) { fieldTypeName = caf::PdmUiComboBoxEditor::uiEditorTypeName(); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp index 00d08e3bb7..4bad41d482 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiLineEditor.cpp @@ -148,11 +148,8 @@ void PdmUiLineEditor::configureAndUpdateUi( const QString& uiConfigName ) } } - bool fromMenuOnly = true; - m_optionCache = uiField()->valueOptions( &fromMenuOnly ); - CAF_ASSERT( fromMenuOnly ); // Not supported - - if ( !m_optionCache.isEmpty() && fromMenuOnly == true ) + m_optionCache = uiField()->valueOptions(); + if ( !m_optionCache.isEmpty() ) { if ( !m_completer ) { diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp index 862c4bc697..1471399f4f 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiListEditor.cpp @@ -159,9 +159,8 @@ void PdmUiListEditor::configureAndUpdateUi( const QString& uiConfigName ) m_listView->setEnabled( !uiField()->isUiReadOnly( uiConfigName ) ); m_listView->setToolTip( uiField()->uiToolTip( uiConfigName ) ); - bool optionsOnly = true; - QList options = uiField()->valueOptions( &optionsOnly ); - m_optionItemCount = options.size(); + QList options = uiField()->valueOptions(); + m_optionItemCount = options.size(); if ( options.size() > 0 || uiField()->isUiReadOnly( uiConfigName ) ) { m_isEditOperationsAvailable = false; @@ -194,8 +193,6 @@ void PdmUiListEditor::configureAndUpdateUi( const QString& uiConfigName ) if ( !options.isEmpty() ) { - CAF_ASSERT( optionsOnly ); // Handling Additions on the fly not implemented - strListModel->setItemsEditable( false ); QModelIndex currentItem = m_listView->selectionModel()->currentIndex(); QStringList texts = PdmOptionItemInfo::extractUiTexts( options ); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp index 342e7d7001..cea9c7bd77 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTableViewQModel.cpp @@ -221,9 +221,7 @@ QVariant PdmUiTableViewQModel::data( const QModelIndex& index, int role /*= Qt:: if ( !valuesSelectedInField.empty() ) { QList options; - bool useOptionsOnly = true; - options = uiFieldHandle->valueOptions( &useOptionsOnly ); - CAF_ASSERT( useOptionsOnly ); // Not supported + options = uiFieldHandle->valueOptions(); for ( const QVariant& v : valuesSelectedInField ) { @@ -243,10 +241,7 @@ QVariant PdmUiTableViewQModel::data( const QModelIndex& index, int role /*= Qt:: return displayText; } - bool useOptionsOnly = true; - QList valueOptions = uiFieldHandle->valueOptions( &useOptionsOnly ); - CAF_ASSERT( useOptionsOnly ); // Not supported - + QList valueOptions = uiFieldHandle->valueOptions(); if ( !valueOptions.isEmpty() ) { int listIndex = uiFieldHandle->uiValue().toInt(); diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp index 2e82015604..94a0fce6ab 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeSelectionEditor.cpp @@ -178,8 +178,7 @@ void PdmUiTreeSelectionEditor::configureAndUpdateUi( const QString& uiConfigName m_treeView->setModel( m_proxyModel ); } - bool optionsOnly = true; - QList options = uiField()->valueOptions( &optionsOnly ); + QList options = uiField()->valueOptions(); bool itemCountHasChaged = false; if ( m_model->optionItemCount() != options.size() ) itemCountHasChaged = true; From 17f169e51352322740f5285546a69fe5fd1eaae7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 29 May 2022 13:25:53 +0200 Subject: [PATCH 335/406] RegressionTests: Add missing show() to mainwindow --- ApplicationLibCode/Application/RiaGuiApplication.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 84e2f3dc28..eb66f11e7c 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -922,6 +922,7 @@ RiuMainWindow* RiaGuiApplication::getOrCreateAndShowMainWindow() else { m_mainWindow->loadWinGeoAndDockToolBarLayout(); + m_mainWindow->show(); } return m_mainWindow; From db589c7e32021defa36ebff0a73002e36b7361bf Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Mon, 30 May 2022 11:39:05 +0200 Subject: [PATCH 336/406] Show progress bar when appending plots to multiplot (#8976) * Show progress bar when appending plots to multiplot * Stop plot manager from going crazy creating plots when filter text is blank * Speed up plot manager create plot --- ...RicAppendSummaryPlotsForObjectsFeature.cpp | 4 +++ ...SummaryPlotsForSummaryAddressesFeature.cpp | 5 ++++ .../RicSummaryPlotBuilder.cpp | 6 ++--- .../ProjectDataModel/RimMultiPlot.cpp | 25 +++++++++++++++++-- .../ProjectDataModel/RimMultiPlot.h | 5 ++++ .../Summary/RimSummaryPlotManager.cpp | 22 +++------------- 6 files changed, 44 insertions(+), 23 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index e2aa633582..ff458695d7 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -35,6 +35,7 @@ #include "RimSummaryPlot.h" #include "cafAssert.h" +#include "cafProgressInfo.h" #include "cafSelectionManager.h" #include @@ -63,6 +64,8 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* s auto sourcePlots = summaryMultiPlot->summaryPlots(); auto plotsForOneInstance = plotsForOneInstanceOfObjectType( sourcePlots, selectionType ); + caf::ProgressInfo info( sumAddressCollections.size(), "Appending plots..." ); + for ( auto summaryAdrCollection : sumAddressCollections ) { auto duplicatedPlots = RicSummaryPlotBuilder::duplicateSummaryPlots( plotsForOneInstance ); @@ -94,6 +97,7 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* s duplicatedPlot->resolveReferencesRecursively(); } } + info.incrementProgress(); } summaryMultiPlot->loadDataAndUpdate(); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp index 76f5cce569..7d0b94eb34 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForSummaryAddressesFeature.cpp @@ -28,6 +28,7 @@ #include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" +#include "cafProgressInfo.h" #include "cafSelectionManager.h" #include @@ -43,6 +44,8 @@ void RicAppendSummaryPlotsForSummaryAddressesFeature::appendPlotsForAddresses( R if ( !summaryMultiPlot ) return; if ( addresses.empty() ) return; + caf::ProgressInfo info( addresses.size(), "Appending plots..." ); + for ( auto adr : addresses ) { auto* plot = new RimSummaryPlot(); @@ -50,6 +53,8 @@ void RicAppendSummaryPlotsForSummaryAddressesFeature::appendPlotsForAddresses( R plot->handleDroppedObjects( { adr } ); summaryMultiPlot->addPlot( plot ); + + info.incrementProgress(); } } diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 9c6e6c465f..113655244a 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -478,11 +478,11 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( con appendPlotsToSummaryMultiPlot( summaryMultiPlot, plots ); summaryMultiPlot->setDefaultRangeAggregationSteppingDimension(); - summaryMultiPlot->zoomAll(); plotCollection->updateAllRequiredEditors(); summaryMultiPlot->loadDataAndUpdate(); summaryMultiPlot->updateAllRequiredEditors(); + summaryMultiPlot->zoomAll(); if ( !plots.empty() ) { @@ -527,6 +527,7 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlo void RicSummaryPlotBuilder::appendPlotsToSummaryMultiPlot( RimSummaryMultiPlot* multiPlot, const std::vector& plots ) { + multiPlot->startBatchAddOperation(); for ( auto plot : plots ) { plot->revokeMdiWindowStatus(); @@ -535,9 +536,8 @@ void RicSummaryPlotBuilder::appendPlotsToSummaryMultiPlot( RimSummaryMultiPlot* plot->resolveReferencesRecursively(); plot->setShowWindow( true ); - - plot->loadDataAndUpdate(); } + multiPlot->endBatchAddOperation(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 4e28c76f25..48c47c656f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -46,6 +46,7 @@ CAF_PDM_SOURCE_INIT( RimMultiPlot, "MultiPlot" ); //-------------------------------------------------------------------------------------------------- RimMultiPlot::RimMultiPlot() : m_isValid( true ) + , m_delayPlotUpdatesDuringBatchAdd( false ) { CAF_PDM_InitObject( "Multi Plot", ":/MultiPlot16x16.png" ); @@ -197,9 +198,12 @@ void RimMultiPlot::insertPlot( RimPlot* plot, size_t index ) plot->createPlotWidget( m_viewer ); m_viewer->insertPlot( plot->plotWidget(), index ); } - plot->updateAfterInsertingIntoMultiPlot(); - onPlotAdditionOrRemoval(); + if ( !m_delayPlotUpdatesDuringBatchAdd ) + { + plot->updateAfterInsertingIntoMultiPlot(); + onPlotAdditionOrRemoval(); + } } } @@ -916,3 +920,20 @@ bool RimMultiPlot::isValid() const { return m_isValid; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::startBatchAddOperation() +{ + m_delayPlotUpdatesDuringBatchAdd = true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::endBatchAddOperation() +{ + m_delayPlotUpdatesDuringBatchAdd = false; + onPlotAdditionOrRemoval(); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 2aa63fd90a..7de61dcb86 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -69,6 +69,9 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection& plots, int insertAtPosition ); + virtual void startBatchAddOperation(); + virtual void endBatchAddOperation(); + virtual void removePlotNoUpdate( RimPlot* plot ); virtual void updateAfterPlotRemove(); @@ -169,6 +172,8 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection m_viewer; + bool m_delayPlotUpdatesDuringBatchAdd; + private: caf::PdmChildArrayField m_plots; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp index d5bf73b064..3b263fe4e5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotManager.cpp @@ -382,6 +382,8 @@ void RimSummaryPlotManager::replaceCurves() //-------------------------------------------------------------------------------------------------- void RimSummaryPlotManager::createNewPlot() { + if ( m_filterText().trimmed().isEmpty() ) return; + std::vector summaryCases; std::vector ensembles; findFilteredSummaryCasesAndEnsembles( summaryCases, ensembles ); @@ -400,24 +402,8 @@ void RimSummaryPlotManager::createNewPlot() auto plots = plotBuilder.createPlots(); if ( m_createMultiPlot ) { - { - auto summaryPlots = plotBuilder.createPlots(); - RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( summaryPlots ); - } - - bool createStandardMultiPlot = false; - if ( createStandardMultiPlot ) - { - // Code to generate a standard multi plot - std::vector plotsForMultiPlot; - for ( auto p : plots ) - { - p->loadDataAndUpdate(); - plotsForMultiPlot.push_back( dynamic_cast( p ) ); - } - - RicSummaryPlotBuilder::createAndAppendMultiPlot( plotsForMultiPlot ); - } + auto summaryPlots = plotBuilder.createPlots(); + RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( summaryPlots ); } else { From 534e74dd31047048ea29ce9a9d613e24b812c572 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Mon, 30 May 2022 17:37:00 +0200 Subject: [PATCH 337/406] Make sure drag'n'drop works when explorer window is undocked, too. --- ApplicationLibCode/UserInterface/RiuDragDrop.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp index fefbed0217..848d03d36d 100644 --- a/ApplicationLibCode/UserInterface/RiuDragDrop.cpp +++ b/ApplicationLibCode/UserInterface/RiuDragDrop.cpp @@ -19,8 +19,6 @@ #include "RiuDragDrop.h" -#include "RiaGuiApplication.h" - #include "OperationsUsingObjReferences/RicPasteEclipseCasesFeature.h" #include "RicCloseCaseFeature.h" #include "WellLogCommands/RicNewWellLogFileCurveFeature.h" @@ -242,7 +240,7 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const { Qt::ItemFlags itemflags; - if ( index.isValid() && RiaGuiApplication::activeMainWindow() ) + if ( index.isValid() ) { caf::PdmUiItem* uiItem = m_projectTreeView->uiItemFromModelIndex( index ); @@ -383,8 +381,6 @@ Qt::ItemFlags RiuDragDrop::flags( const QModelIndex& index ) const //-------------------------------------------------------------------------------------------------- bool RiuDragDrop::dropMimeData( const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& dropTargetIndex ) { - CVF_ASSERT( RiaGuiApplication::activeMainWindow() ); - caf::PdmUiTreeView* uiTreeView = m_projectTreeView; caf::PdmUiItem* dropTargetUiItem = uiTreeView->uiItemFromModelIndex( dropTargetIndex ); caf::PdmObjectHandle* dropTarget = dynamic_cast( dropTargetUiItem ); From 787d3ae379a0dcf9e989a3d7d4dff9f1e11f900b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sat, 28 May 2022 09:53:22 +0200 Subject: [PATCH 338/406] #8868 Well Log Plot: Appearance update not working --- .../ProjectDataModel/WellLog/RimWellLogTrack.cpp | 12 ++++++++++++ .../ProjectDataModel/WellLog/RimWellLogTrack.h | 3 +++ 2 files changed, 15 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 897e12f0d2..38645637ee 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -1233,6 +1233,18 @@ bool RimWellLogTrack::isEmptyVisibleXRange() const 1.0e-6 * std::max( 1.0, std::max( m_visiblePropertyValueRangeMax(), m_visiblePropertyValueRangeMin() ) ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogTrack::onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, + std::vector& updatedObjects ) +{ + if ( childArray == &m_curves ) + { + loadDataAndUpdate(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index 56ef8fdd38..26c597e49b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -241,6 +241,8 @@ class RimWellLogTrack : public RimPlot // RimViewWindow overrides void deleteViewWidget() override; void onLoadDataAndUpdate() override; + void onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, + std::vector& updatedObjects ) override; private: RiuPlotWidget* doCreatePlotViewWidget( QWidget* mainWindowParent = nullptr ) override; @@ -371,4 +373,5 @@ class RimWellLogTrack : public RimPlot double m_availablePropertyValueRangeMax; double m_availableDepthRangeMin; double m_availableDepthRangeMax; + }; From fe1acc93a6ddd645b475693dfd9868789a0e7569 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 31 May 2022 10:22:18 +0200 Subject: [PATCH 339/406] #8938 Sub Plot : Fix visibility of legend Make sure legends are set visible if any items are present in the legend --- ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp | 6 +++++- ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 162cde5bf4..b0ee3ef131 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -600,7 +600,11 @@ void RiuMultiPlotPage::onLegendUpdated() //-------------------------------------------------------------------------------------------------- void RiuMultiPlotPage::refreshLegends() { - // TODO - might need to do something here, but at the moment it looks like alignCanvasTops() is sufficient + QList> legends = this->legendsForVisiblePlots(); + for ( const auto& l : legends ) + { + l->setVisible( !l->isEmpty() ); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp index 438e8a81e4..c98fd6caf9 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotLegend.cpp @@ -108,7 +108,6 @@ QSize RiuQwtPlotLegend::sizeHint() const void RiuQwtPlotLegend::updateLegend( const QVariant& variant, const QList& legendItems ) { QwtLegend::updateLegend( variant, legendItems ); - setVisible( !legendItems.empty() ); emit legendUpdated(); } From c199f960e3339c3f594d5f13aaf350fbaf8cdbd5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 31 May 2022 11:51:16 +0200 Subject: [PATCH 340/406] #8949 Plot Update: Improve visual stability when clicking on curves adjustSize() causes the plot to resize twice which is annoying. Cache the last child count to avoid calls to adjustSize(). --- .../UserInterface/RiuMultiPlotPage.cpp | 20 +++++++++++++++++-- .../UserInterface/RiuMultiPlotPage.h | 2 ++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index b0ee3ef131..328fc5ae91 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -226,6 +226,8 @@ void RiuMultiPlotPage::removePlot( RiuPlotWidget* plotWidget ) m_subTitles.removeAt( plotWidgetIdx ); delete subTitle; + m_childCountForAdjustSizeOperation.clear(); + scheduleUpdate(); } @@ -733,9 +735,23 @@ int RiuMultiPlotPage::alignCanvasTops() { int row = visibleIndex / rowAndColumnCount.second; qwtPlotWidget->qwtPlot()->axisScaleDraw( QwtAxis::XTop )->setMinimumExtent( maxExtents[row] ); - if ( legends[visibleIndex] ) + auto legend = legends[visibleIndex]; + if ( legend ) { - legends[visibleIndex]->adjustSize(); + int previousChildCount = -1; + + auto it = m_childCountForAdjustSizeOperation.find( legend ); + if ( it != m_childCountForAdjustSizeOperation.end() ) + { + previousChildCount = it->second; + } + + auto legendItemCount = legend->contentsWidget()->children().size(); + if ( previousChildCount != legendItemCount ) + { + legends[visibleIndex]->adjustSize(); + m_childCountForAdjustSizeOperation[legend] = legendItemCount; + } } } } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h index 40cf4a2c3b..575bdb6f2b 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.h @@ -147,6 +147,8 @@ private slots: bool m_previewMode; bool m_showSubTitles; + std::map m_childCountForAdjustSizeOperation; + private: friend class RiaPlotWindowRedrawScheduler; }; From c74701b68715ed5c20afc421fcb4e96e4f650a35 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 31 May 2022 13:08:07 +0200 Subject: [PATCH 341/406] Rename several child() and children() functions --- .../RiaCompletionTypeCalculationScheduler.cpp | 4 ++-- .../Application/Tools/RiaProjectModifier.cpp | 2 +- .../RicEclipseShowOnlyFaultFeature.cpp | 2 +- .../RicAdvancedSnapshotExportFeature.cpp | 6 +++--- .../RicExportToLasFileResampleUi.cpp | 2 +- .../RicCreateMultipleFracturesUi.cpp | 8 ++++---- .../Commands/RicCloseCaseFeature.cpp | 6 +++--- .../Commands/RicDeleteItemExec.cpp | 2 +- .../Commands/RicDeleteItemFeature.cpp | 2 +- .../RicElasticPropertiesImportTools.cpp | 2 +- .../SsiHubImportCommands/RimOilFieldEntry.cpp | 2 +- .../RimOilRegionEntry.cpp | 2 +- .../RimWellPathImport.cpp | 6 +++--- .../RiuWellImportWizard.cpp | 8 ++++---- .../RicToggleItemsOnOthersOffFeature.cpp | 2 +- .../RicDeleteAllLinkedViewsFeature.cpp | 2 +- .../ViewLink/RicUnLinkViewFeature.cpp | 2 +- .../RifEclipseInputPropertyLoader.cpp | 2 +- .../AnalysisPlots/RimAnalysisPlot.cpp | 6 +++--- .../RimAnalysisPlotCollection.cpp | 4 ++-- .../RimPlotDataFilterCollection.cpp | 4 ++-- .../RimAnnotationGroupCollection.cpp | 4 ++-- .../RimUserDefinedPolylinesAnnotation.cpp | 6 +++--- .../CellFilters/RimCellFilterCollection.cpp | 6 +++--- .../RimEclipsePropertyFilterCollection.cpp | 2 +- .../RimGeoMechPropertyFilterCollection.cpp | 2 +- .../CellFilters/RimPolygonFilter.cpp | 4 ++-- .../Rim3dWellLogCurveCollection.cpp | 4 ++-- ...imEnsembleFractureStatisticsCollection.cpp | 2 +- .../Completions/RimFishbonesCollection.cpp | 4 ++-- .../RimFractureTemplateCollection.cpp | 2 +- .../Completions/RimPerforationCollection.cpp | 2 +- .../RimSimWellFractureCollection.cpp | 4 ++-- .../RimValveTemplateCollection.cpp | 2 +- .../RimWellPathFractureCollection.cpp | 4 ++-- .../RimAbstractCorrelationPlot.cpp | 4 ++-- .../RimCorrelationPlotCollection.cpp | 8 ++++---- .../Faults/RimFaultInViewCollection.cpp | 4 ++-- .../Faults/RimFaultRASettings.cpp | 12 +++++------ .../Flow/RimFlowPlotCollection.cpp | 6 +++--- .../RimWellDistributionPlotCollection.cpp | 4 ++-- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 2 +- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 2 +- .../GeoMech/RimGeoMechCase.cpp | 4 ++-- .../RimGeoMechContourMapViewCollection.cpp | 2 +- .../GeoMech/RimGeoMechModels.cpp | 4 ++-- .../GeoMech/RimGeoMechPartCollection.cpp | 4 ++-- .../GridCrossPlots/RimGridCrossPlot.cpp | 6 +++--- .../RimGridCrossPlotCollection.cpp | 4 ++-- .../RimGridCrossPlotDataSet.cpp | 10 +++++----- .../RimSaturationPressurePlotCollection.cpp | 4 ++-- .../RimIntersectionCollection.cpp | 8 ++++---- ...ntersectionResultsDefinitionCollection.cpp | 2 +- .../Parameters/RimParameterGroup.cpp | 6 +++--- .../RimPlotTemplateFolderItem.cpp | 12 +++++------ .../Rim2dIntersectionViewCollection.cpp | 6 +++--- .../ProjectDataModel/RimCaseCollection.cpp | 2 +- .../ProjectDataModel/RimColorLegend.cpp | 2 +- .../RimColorLegendCollection.cpp | 6 +++--- .../ProjectDataModel/RimCommandObject.cpp | 4 ++-- .../RimCustomObjectiveFunction.cpp | 4 ++-- .../RimCustomObjectiveFunctionCollection.cpp | 2 +- .../RimCustomObjectiveFunctionWeight.cpp | 4 ++-- .../ProjectDataModel/RimDepthTrackPlot.cpp | 14 ++++++------- .../ProjectDataModel/RimEclipseCase.cpp | 6 +++--- .../RimEclipseCaseCollection.cpp | 6 +++--- .../ProjectDataModel/RimEclipseCellColors.cpp | 2 +- .../RimEclipseContourMapViewCollection.cpp | 2 +- .../RimEclipseInputPropertyCollection.cpp | 2 +- .../ProjectDataModel/RimEclipseResultCase.cpp | 4 ++-- .../RimEclipseStatisticsCase.cpp | 2 +- .../RimEclipseStatisticsCaseCollection.cpp | 2 +- .../ProjectDataModel/RimEclipseView.cpp | 2 +- ...sembleFractureStatisticsPlotCollection.cpp | 4 ++-- .../RimFormationNamesCollection.cpp | 4 ++-- .../ProjectDataModel/RimGridCollection.cpp | 4 ++-- .../RimGridStatisticsPlot.cpp | 2 +- .../RimGridStatisticsPlotCollection.cpp | 4 ++-- .../ProjectDataModel/RimGridView.cpp | 2 +- .../RimIdenticalGridCaseGroup.cpp | 6 ++---- .../ProjectDataModel/RimMultiPlot.cpp | 14 ++++++------- .../RimMultiPlotCollection.cpp | 6 +++--- .../RimObservedDataCollection.cpp | 12 +++++------ .../ProjectDataModel/RimOilField.cpp | 2 +- .../RimPlotAxisProperties.cpp | 4 ++-- .../ProjectDataModel/RimPltPlotCollection.cpp | 6 +++--- .../ProjectDataModel/RimProject.cpp | 20 +++++++++---------- .../ProjectDataModel/RimProject.h | 2 +- .../RimReservoirCellResultsStorage.cpp | 4 ++-- .../ProjectDataModel/RimRftPlotCollection.cpp | 6 +++--- .../ProjectDataModel/RimScriptCollection.cpp | 8 ++++---- .../RimSimWellInViewCollection.cpp | 2 +- .../ProjectDataModel/RimStimPlanColors.cpp | 2 +- .../RimSurfaceIntersectionBand.cpp | 2 +- .../RimSurfaceIntersectionCollection.cpp | 4 ++-- .../RimUserDefinedCalculation.cpp | 4 ++-- .../RimUserDefinedCalculationCollection.cpp | 6 +++--- .../ProjectDataModel/RimVfpPlotCollection.cpp | 8 ++++---- .../ProjectDataModel/RimVfpPlotCollection.h | 2 +- .../ProjectDataModel/RimViewLinker.cpp | 6 +++--- .../RimElasticPropertyScalingCollection.cpp | 2 +- .../StimPlanModel/RimPressureTable.cpp | 6 +++--- .../RimStimPlanModelCollection.cpp | 4 ++-- .../RimStimPlanModelPlotCollection.cpp | 6 +++--- .../RimStimPlanModelTemplate.cpp | 4 ++-- .../RimStimPlanModelTemplateCollection.cpp | 2 +- .../RimStreamlineInViewCollection.cpp | 2 +- .../Summary/RimEnsembleCurveFilter.cpp | 6 +++--- .../RimEnsembleCurveFilterCollection.cpp | 2 +- .../Summary/RimEnsembleCurveSet.cpp | 14 ++++++------- .../Summary/RimEnsembleCurveSetCollection.cpp | 8 ++++---- .../Summary/RimSummaryAddressCollection.cpp | 8 ++++---- .../Summary/RimSummaryAddressCollection.h | 2 +- .../Summary/RimSummaryCase.cpp | 2 +- .../Summary/RimSummaryCaseCollection.cpp | 8 ++++---- .../Summary/RimSummaryCaseMainCollection.cpp | 10 +++++----- .../Summary/RimSummaryCrossPlotCollection.cpp | 6 +++--- .../Summary/RimSummaryCurveCollection.cpp | 10 +++++----- .../Summary/RimSummaryMultiPlotCollection.cpp | 6 +++--- .../Summary/RimSummaryPlot.cpp | 10 +++++----- .../Summary/RimSummaryPlotCollection.cpp | 4 ++-- ...RimSummaryPlotFilterTextCurveSetEditor.cpp | 2 +- .../Summary/RimSummaryTimeAxisProperties.cpp | 4 ++-- .../Surfaces/RimSurfaceCollection.cpp | 8 ++++---- .../Surfaces/RimSurfaceInViewCollection.cpp | 12 +++++------ .../WellLog/RimEnsembleWellLogs.cpp | 4 ++-- .../WellLog/RimEnsembleWellLogsCollection.cpp | 2 +- .../WellLog/RimWellLogFile.cpp | 4 ++-- .../WellLog/RimWellLogPlotCollection.cpp | 6 +++--- .../WellLog/RimWellLogTrack.cpp | 10 +++++----- .../RimWellMeasurementCollection.cpp | 8 ++++---- .../WellPath/RimWellIASettings.cpp | 4 ++-- .../WellPath/RimWellIASettingsCollection.cpp | 2 +- .../ProjectDataModel/WellPath/RimWellPath.cpp | 2 +- .../RimWellPathAttributeCollection.cpp | 4 ++-- .../WellPath/RimWellPathCollection.cpp | 12 +++++------ .../WellPath/RimWellPathGeometryDef.cpp | 6 +++--- .../WellPath/RimWellPathGroup.cpp | 8 ++++---- .../ProjectDataModel/cafTreeNode.cpp | 4 ++-- .../UnitTests/RimRelocatePath-Test.cpp | 2 +- .../RiuAdvancedSnapshotExportWidget.cpp | 2 +- .../RiuSummaryVectorSelectionUi.cpp | 2 +- .../AddAndDelete/cafCmdAddItemExec.cpp | 2 +- .../AddAndDelete/cafCmdDeleteItemExec.cpp | 2 +- .../AddAndDelete/cafCmdDeleteItemFeature.cpp | 2 +- .../cafToggleItemsOnOthersOffFeature.cpp | 4 ++-- .../cafPdmFieldScriptingCapability.h | 2 +- .../cafPdmScriptingBasicTest.cpp | 4 ++-- .../cafPdmCore/cafPdmChildArrayField.h | 14 ++++++------- .../cafPdmCore/cafPdmChildArrayField.inl | 16 +++++++-------- .../cafPdmChildArrayFieldHandle.cpp | 2 +- .../cafPdmCore/cafPdmChildField.h | 8 ++++---- .../cafPdmCore/cafPdmChildField.inl | 6 +++--- .../cafPdmCore_UnitTests/Parent.cpp | 2 +- .../cafPdmChildArrayFieldHandleTest.cpp | 4 ++-- .../cafPdmCoreBasicTest.cpp | 16 +++++++-------- .../cafPdmReferenceHelperTest.cpp | 10 +++++----- .../cafPdmCore/cafPdmFieldHandle.cpp | 4 ++-- .../cafPdmCore/cafPdmFieldHandle.h | 6 +++--- .../cafPdmCore/cafPdmObjectHandle.h | 2 +- .../cafPdmCore/cafPdmPtrArrayField.h | 2 +- .../cafPdmCore/cafPdmPtrArrayField.inl | 6 +++--- .../cafPdmCore/cafPdmPtrArrayFieldHandle.h | 2 +- .../cafPdmCore/cafPdmReferenceHelper.cpp | 4 ++-- .../cafProjectDataModel/cafPdmDocument.cpp | 2 +- .../cafProjectDataModel/cafPdmObject.cpp | 4 ++-- .../cafPdmUiCommandSystemProxy.cpp | 2 +- .../cafPdmUiCore/cafPdmUiObjectHandle.cpp | 6 +++--- .../cafPdmUiCore/cafPdmUiTreeOrdering.cpp | 2 +- .../cafInternalPdmXmlFieldCapability.inl | 6 +++--- .../cafPdmXml/cafPdmSettings.cpp | 4 ++-- .../cafPdmXml/cafPdmXmlObjectHandle.cpp | 6 +++--- .../cafPdmXmlBasicTest.cpp | 4 ++-- .../cafPdmBasicTest.cpp | 10 +++++----- .../cafTestApplication/MainWindow.cpp | 6 +++--- .../cafTestCvfApplication/MainWindow.cpp | 2 +- .../cafPdmUiTreeViewQModel.cpp | 2 +- GrpcInterface/RiaGrpcCommandService.cpp | 2 +- GrpcInterface/RiaGrpcPdmObjectService.cpp | 2 +- 179 files changed, 429 insertions(+), 431 deletions(-) diff --git a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp index 346ea6e38f..c103de733d 100644 --- a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp +++ b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp @@ -56,7 +56,7 @@ RiaCompletionTypeCalculationScheduler* RiaCompletionTypeCalculationScheduler::in void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAndRedrawAllViews() { std::vector eclipseCases = - RimProject::current()->activeOilField()->analysisModels->cases().childObjects(); + RimProject::current()->activeOilField()->analysisModels->cases().children(); scheduleRecalculateCompletionTypeAndRedrawAllViews( eclipseCases ); } @@ -94,7 +94,7 @@ void RiaCompletionTypeCalculationScheduler::scheduleRecalculateCompletionTypeAnd void RiaCompletionTypeCalculationScheduler::clearCompletionTypeResultsInAllCases() { std::vector eclipseCases = - RimProject::current()->activeOilField()->analysisModels->cases().childObjects(); + RimProject::current()->activeOilField()->analysisModels->cases().children(); clearCompletionTypeResults( eclipseCases ); } diff --git a/ApplicationLibCode/Application/Tools/RiaProjectModifier.cpp b/ApplicationLibCode/Application/Tools/RiaProjectModifier.cpp index 30df42387b..3316ec4acc 100644 --- a/ApplicationLibCode/Application/Tools/RiaProjectModifier.cpp +++ b/ApplicationLibCode/Application/Tools/RiaProjectModifier.cpp @@ -169,7 +169,7 @@ void RiaProjectModifier::replaceSourceCases( RimProject* project ) if ( groupIdToReplace == caseGroup->groupId() ) { RimCaseCollection* caseCollection = caseGroup->caseCollection; - caseCollection->reservoirs.deleteAllChildObjects(); + caseCollection->reservoirs.deleteChildren(); for ( QString fileName : item.second ) { diff --git a/ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.cpp b/ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.cpp index cdfaaca98c..c945f45743 100644 --- a/ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.cpp +++ b/ApplicationLibCode/Commands/EclipseCommands/RicEclipseShowOnlyFaultFeature.cpp @@ -77,7 +77,7 @@ void RicEclipseShowOnlyFaultFeature::onActionTriggered( bool isChecked ) if ( !rimFault->parentField() ) return; std::vector children; - rimFault->parentField()->childObjects( &children ); + rimFault->parentField()->children( &children ); for ( auto& child : children ) { diff --git a/ApplicationLibCode/Commands/ExportCommands/RicAdvancedSnapshotExportFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicAdvancedSnapshotExportFeature.cpp index 2fc2cf3946..018afed07e 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicAdvancedSnapshotExportFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicAdvancedSnapshotExportFeature.cpp @@ -147,7 +147,7 @@ void RicAdvancedSnapshotExportFeature::exportMultipleSnapshots( const QString& f exportViewVariations( copyOfEclipseView, msd, folder ); - eclCase->reservoirViews().removeChildObject( copyOfEclipseView ); + eclCase->reservoirViews().removeChild( copyOfEclipseView ); delete copyOfEclipseView; } @@ -172,7 +172,7 @@ void RicAdvancedSnapshotExportFeature::exportMultipleSnapshots( const QString& f exportViewVariations( copyOfGeoMechView, msd, folder ); - geomCase->geoMechViews().removeChildObject( copyOfGeoMechView ); + geomCase->geoMechViews().removeChild( copyOfGeoMechView ); delete copyOfGeoMechView; } @@ -210,7 +210,7 @@ void RicAdvancedSnapshotExportFeature::exportViewVariations( Rim3dView* exportViewVariationsToFolder( copyOfView, msd, folder ); } - eclCase->reservoirViews().removeChildObject( copyOfView ); + eclCase->reservoirViews().removeChild( copyOfView ); delete copyOfView; } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp index 3ad4e5e23e..d7a607ef5d 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicExportToLasFileResampleUi.cpp @@ -84,7 +84,7 @@ RicExportToLasFileResampleUi::RicExportToLasFileResampleUi( void ) //-------------------------------------------------------------------------------------------------- RicExportToLasFileResampleUi::~RicExportToLasFileResampleUi() { - m_tvdrkbOffsets.deleteAllChildObjects(); + m_tvdrkbOffsets.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp index 94f7871476..c209c000e6 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesUi.cpp @@ -127,7 +127,7 @@ void RiuCreateMultipleFractionsUi::setValues( RimEclipseCase* eclipseCase, void RiuCreateMultipleFractionsUi::resetValues() { m_sourceCase = nullptr; - m_options.deleteAllChildObjects(); + m_options.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -135,7 +135,7 @@ void RiuCreateMultipleFractionsUi::resetValues() //-------------------------------------------------------------------------------------------------- std::vector RiuCreateMultipleFractionsUi::options() const { - return m_options.childObjects(); + return m_options.children(); } //-------------------------------------------------------------------------------------------------- @@ -160,7 +160,7 @@ void RiuCreateMultipleFractionsUi::insertOptionItem( RicCreateMultipleFracturesO //-------------------------------------------------------------------------------------------------- void RiuCreateMultipleFractionsUi::deleteOptionItem( RicCreateMultipleFracturesOptionItemUi* optionsItem ) { - m_options.removeChildObject( optionsItem ); + m_options.removeChild( optionsItem ); delete optionsItem; } @@ -169,7 +169,7 @@ void RiuCreateMultipleFractionsUi::deleteOptionItem( RicCreateMultipleFracturesO //-------------------------------------------------------------------------------------------------- void RiuCreateMultipleFractionsUi::clearOptions() { - m_options.deleteAllChildObjects(); + m_options.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/RicCloseCaseFeature.cpp b/ApplicationLibCode/Commands/RicCloseCaseFeature.cpp index 70f1badf31..4765ec620a 100644 --- a/ApplicationLibCode/Commands/RicCloseCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseCaseFeature.cpp @@ -152,7 +152,7 @@ void RicCloseCaseFeature::deleteEclipseCase( RimEclipseCase* eclipseCase ) RimIdenticalGridCaseGroup* caseGroup = caseCollection->parentCaseGroup(); CVF_ASSERT( caseGroup ); - caseGroup->statisticsCaseCollection()->reservoirs.removeChildObject( eclipseCase ); + caseGroup->statisticsCaseCollection()->reservoirs.removeChild( eclipseCase ); caseGroup->updateConnectedEditors(); } else @@ -165,7 +165,7 @@ void RicCloseCaseFeature::deleteEclipseCase( RimEclipseCase* eclipseCase ) if ( caseGroup->caseCollection()->reservoirs.size() == 1 ) { std::vector children; - caseGroup->statisticsCaseCollection()->reservoirs.childObjects( &children ); + caseGroup->statisticsCaseCollection()->reservoirs.children( &children ); for ( size_t i = children.size(); i-- > 0; ) { @@ -213,7 +213,7 @@ void RicCloseCaseFeature::deleteEclipseCase( RimEclipseCase* eclipseCase ) if ( cases.empty() ) { - project->multiSnapshotDefinitions.deleteAllChildObjects(); + project->multiSnapshotDefinitions.deleteChildren(); } else { diff --git a/ApplicationLibCode/Commands/RicDeleteItemExec.cpp b/ApplicationLibCode/Commands/RicDeleteItemExec.cpp index 52863ed379..19f4a932c5 100644 --- a/ApplicationLibCode/Commands/RicDeleteItemExec.cpp +++ b/ApplicationLibCode/Commands/RicDeleteItemExec.cpp @@ -52,7 +52,7 @@ void RicDeleteItemExec::redo() if ( listField ) { std::vector children; - listField->childObjects( &children ); + listField->children( &children ); caf::PdmObjectHandle* obj = children[m_commandData.m_indexToObject]; caf::SelectionManager::instance()->removeObjectFromAllSelections( obj ); diff --git a/ApplicationLibCode/Commands/RicDeleteItemFeature.cpp b/ApplicationLibCode/Commands/RicDeleteItemFeature.cpp index 291446d649..3cd8a0076b 100644 --- a/ApplicationLibCode/Commands/RicDeleteItemFeature.cpp +++ b/ApplicationLibCode/Commands/RicDeleteItemFeature.cpp @@ -80,7 +80,7 @@ void RicDeleteItemFeature::onActionTriggered( bool isChecked ) int indexAfter = -1; std::vector childObjects; - childArrayFieldHandle->childObjects( &childObjects ); + childArrayFieldHandle->children( &childObjects ); for ( size_t i = 0; i < childObjects.size(); i++ ) { diff --git a/ApplicationLibCode/Commands/RicElasticPropertiesImportTools.cpp b/ApplicationLibCode/Commands/RicElasticPropertiesImportTools.cpp index 1fba26238e..28bdf5a291 100644 --- a/ApplicationLibCode/Commands/RicElasticPropertiesImportTools.cpp +++ b/ApplicationLibCode/Commands/RicElasticPropertiesImportTools.cpp @@ -166,7 +166,7 @@ std::vector RicElasticPropertiesImportTools::getFormationNames() RimOilField* oilField = project->activeOilField(); RimFormationNamesCollection* formationNamesCollection = oilField->formationNamesCollection(); - for ( RimFormationNames* formationNames : formationNamesCollection->formationNamesList().childObjects() ) + for ( RimFormationNames* formationNames : formationNamesCollection->formationNamesList().children() ) { if ( formationNames && formationNames->formationNamesData() ) { diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilFieldEntry.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilFieldEntry.cpp index c8c261c8b6..fe23294674 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilFieldEntry.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilFieldEntry.cpp @@ -53,7 +53,7 @@ RimOilFieldEntry::RimOilFieldEntry() //-------------------------------------------------------------------------------------------------- RimOilFieldEntry::~RimOilFieldEntry() { - wells.deleteAllChildObjects(); + wells.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilRegionEntry.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilRegionEntry.cpp index 7a81370e84..f03bb5297a 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilRegionEntry.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RimOilRegionEntry.cpp @@ -41,7 +41,7 @@ RimOilRegionEntry::RimOilRegionEntry() //-------------------------------------------------------------------------------------------------- RimOilRegionEntry::~RimOilRegionEntry() { - fields.deleteAllChildObjects(); + fields.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp index 7bc7edda62..e577c63364 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RimWellPathImport.cpp @@ -99,7 +99,7 @@ void RimWellPathImport::updateRegions( const QStringList& regionStrings, for ( size_t i = 0; i < fieldsToRemove.size(); i++ ) { - this->regions[regionIdx]->fields.removeChildObject( fieldsToRemove[i] ); + this->regions[regionIdx]->fields.removeChild( fieldsToRemove[i] ); delete fieldsToRemove[i]; } @@ -108,7 +108,7 @@ void RimWellPathImport::updateRegions( const QStringList& regionStrings, for ( size_t i = 0; i < regionsToRemove.size(); i++ ) { - this->regions.removeChildObject( regionsToRemove[i] ); + this->regions.removeChild( regionsToRemove[i] ); delete regionsToRemove[i]; } @@ -218,7 +218,7 @@ void RimWellPathImport::defineObjectEditorAttribute( QString uiConfigName, caf:: //-------------------------------------------------------------------------------------------------- RimWellPathImport::~RimWellPathImport() { - regions.deleteAllChildObjects(); + regions.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp index e441f07a84..9496e3fcbc 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp @@ -728,7 +728,7 @@ void RiuWellImportWizard::parseWellsResponse( RimOilFieldEntry* oilFieldEntry ) for ( size_t i = 0; i < wellsToRemove.size(); i++ ) { - oilFieldEntry->wells.removeChildObject( wellsToRemove[i] ); + oilFieldEntry->wells.removeChild( wellsToRemove[i] ); delete wellsToRemove[i]; } @@ -902,7 +902,7 @@ void WellSelectionPage::buildWellTreeView() } // Delete all temporary pdm object groups - m_regionsWithVisibleWells->objects.deleteAllChildObjects(); + m_regionsWithVisibleWells->objects.deleteChildren(); for ( size_t rIdx = 0; rIdx < m_wellPathImportObject->regions.size(); rIdx++ ) { @@ -982,7 +982,7 @@ void WellSelectionPage::selectedWellPathEntries( std::vector& do for ( size_t i = 0; i < childFields.size(); i++ ) { std::vector childObjects; - childFields[i]->childObjects( &childObjects ); + childFields[i]->children( &childObjects ); for ( size_t j = 0; j < childObjects.size(); j++ ) { @@ -1117,7 +1117,7 @@ void WellSummaryPage::initializePage() //-------------------------------------------------------------------------------------------------- void WellSummaryPage::updateSummaryPage() { - m_objectGroup->objects.clear(); + m_objectGroup->objects.clearWithoutDelete(); m_textEdit->setText( "Summary of imported wells\n\n" ); diff --git a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp index e1e6f06277..76d1086480 100644 --- a/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp +++ b/ApplicationLibCode/Commands/ToggleCommands/RicToggleItemsOnOthersOffFeature.cpp @@ -122,7 +122,7 @@ std::vector RicToggleItemsOnOthersOffFeature::childObject std::vector children; if ( parent ) { - parent->childObjects( &children ); + parent->children( &children ); } return children; } diff --git a/ApplicationLibCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.cpp b/ApplicationLibCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.cpp index 4bddb6d8aa..fc60d154ce 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.cpp +++ b/ApplicationLibCode/Commands/ViewLink/RicDeleteAllLinkedViewsFeature.cpp @@ -42,7 +42,7 @@ class DeleteAllLinkedViewsImpl { // Remove the view linker object from the view linker collection // viewLinkerCollection->viewLinker is a PdmChildField containing one RimViewLinker child object - proj->viewLinkerCollection->viewLinker.removeChildObject( viewLinker ); + proj->viewLinkerCollection->viewLinker.removeChild( viewLinker ); viewLinker->applyCellFilterCollectionByUserChoice(); diff --git a/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.cpp b/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.cpp index 710c8f11fd..b399451539 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.cpp +++ b/ApplicationLibCode/Commands/ViewLink/RicUnLinkViewFeature.cpp @@ -87,7 +87,7 @@ void RicUnLinkViewFeature::onActionTriggered( bool isChecked ) { // Remove the view linker object from the view linker collection // viewLinkerCollection->viewLinker is a PdmChildField containing one RimViewLinker child object - RimProject::current()->viewLinkerCollection->viewLinker.removeChildObject( viewLinker ); + RimProject::current()->viewLinkerCollection->viewLinker.removeChild( viewLinker ); delete viewLinker; } diff --git a/ApplicationLibCode/FileInterface/RifEclipseInputPropertyLoader.cpp b/ApplicationLibCode/FileInterface/RifEclipseInputPropertyLoader.cpp index 581ab2c71f..1e541d6334 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseInputPropertyLoader.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseInputPropertyLoader.cpp @@ -45,7 +45,7 @@ void RifEclipseInputPropertyLoader::loadAndSyncronizeInputProperties( RimEclipse const std::vector& filenames, bool allowImportOfFaults ) { - std::vector existingProperties = inputPropertyCollection->inputProperties.childObjects(); + std::vector existingProperties = inputPropertyCollection->inputProperties.children(); caf::ProgressInfo progInfo( static_cast( filenames.size() ), "Reading Input properties" ); diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index 7417aefd2b..9d178e8386 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -206,7 +206,7 @@ RimPlotDataFilterCollection* RimAnalysisPlot::plotDataFilterCollection() const //-------------------------------------------------------------------------------------------------- void RimAnalysisPlot::setCurveDefinitions( const std::vector& curveDefinitions ) { - m_analysisPlotDataSelection.deleteAllChildObjects(); + m_analysisPlotDataSelection.deleteChildren(); for ( auto curveDef : curveDefinitions ) { auto dataEntry = new RimAnalysisPlotDataEntry(); @@ -463,7 +463,7 @@ void RimAnalysisPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { std::vector summaryVectorDefinitions = dlg.curveSelection(); - m_analysisPlotDataSelection.deleteAllChildObjects(); + m_analysisPlotDataSelection.deleteChildren(); for ( const RiaSummaryCurveDefinition& vectorDef : summaryVectorDefinitions ) { auto dataEntry = new RimAnalysisPlotDataEntry(); @@ -1794,7 +1794,7 @@ void RimAnalysisPlot::onCaseRemoved( const SignalEmitter* emitter, RimSummaryCas { if ( existingEntry->summaryCase() == summaryCase ) { - m_analysisPlotDataSelection.removeChildObject( existingEntry ); + m_analysisPlotDataSelection.removeChild( existingEntry ); delete existingEntry; break; } diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp index 41c562d0f4..d65e226c06 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp @@ -123,7 +123,7 @@ void RimAnalysisPlotCollection::updateSummaryNameHasChanged() //-------------------------------------------------------------------------------------------------- std::vector RimAnalysisPlotCollection::plots() const { - return m_analysisPlots.childObjects(); + return m_analysisPlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -263,6 +263,6 @@ void RimAnalysisPlotCollection::insertPlot( RimAnalysisPlot* analysisPlot, size_ //-------------------------------------------------------------------------------------------------- void RimAnalysisPlotCollection::removePlot( RimAnalysisPlot* analysisPlot ) { - m_analysisPlots.removeChildObject( analysisPlot ); + m_analysisPlots.removeChild( analysisPlot ); updateAllRequiredEditors(); } diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp index 36495eb5a9..1292b49321 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimPlotDataFilterCollection.cpp @@ -56,7 +56,7 @@ RimPlotDataFilterItem* RimPlotDataFilterCollection::addFilter() //-------------------------------------------------------------------------------------------------- void RimPlotDataFilterCollection::removeFilter( RimPlotDataFilterItem* filter ) { - m_filters.removeChildObject( filter ); + m_filters.removeChild( filter ); delete filter; filtersChanged.send(); @@ -67,7 +67,7 @@ void RimPlotDataFilterCollection::removeFilter( RimPlotDataFilterItem* filter ) //-------------------------------------------------------------------------------------------------- std::vector RimPlotDataFilterCollection::filters() const { - return m_filters.childObjects(); + return m_filters.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp index 2bc08140b7..7e6ba9cb74 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimAnnotationGroupCollection.cpp @@ -95,7 +95,7 @@ void RimAnnotationGroupCollection::addAnnotation( caf::PdmObject* annotation ) //-------------------------------------------------------------------------------------------------- void RimAnnotationGroupCollection::removeAnnotation( caf::PdmObject* annotation ) { - m_annotations.removeChildObject( annotation ); + m_annotations.removeChild( annotation ); } //-------------------------------------------------------------------------------------------------- @@ -103,7 +103,7 @@ void RimAnnotationGroupCollection::removeAnnotation( caf::PdmObject* annotation //-------------------------------------------------------------------------------------------------- std::vector RimAnnotationGroupCollection::annotations() const { - return m_annotations.childObjects(); + return m_annotations.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp b/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp index 956c1ccd14..15065996a4 100644 --- a/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp +++ b/ApplicationLibCode/ProjectDataModel/Annotations/RimUserDefinedPolylinesAnnotation.cpp @@ -95,7 +95,7 @@ cvf::ref RimUserDefinedPolylinesAnnotation::polyLinesData() //-------------------------------------------------------------------------------------------------- std::vector RimUserDefinedPolylinesAnnotation::activeTargets() const { - return m_targets.childObjects(); + return m_targets.children(); } //-------------------------------------------------------------------------------------------------- @@ -113,7 +113,7 @@ void RimUserDefinedPolylinesAnnotation::appendTarget( const cvf::Vec3d& defaultP { RimPolylineTarget* target = nullptr; - auto targets = m_targets.childObjects(); + auto targets = m_targets.children(); if ( targets.empty() ) { target = new RimPolylineTarget(); @@ -149,7 +149,7 @@ void RimUserDefinedPolylinesAnnotation::insertTarget( const RimPolylineTarget* t //-------------------------------------------------------------------------------------------------- void RimUserDefinedPolylinesAnnotation::deleteTarget( RimPolylineTarget* targetToDelete ) { - m_targets.removeChildObject( targetToDelete ); + m_targets.removeChild( targetToDelete ); delete targetToDelete; } diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp index 6130291f9d..ef0357f0f0 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimCellFilterCollection.cpp @@ -103,7 +103,7 @@ void RimCellFilterCollection::setCase( RimCase* theCase ) //-------------------------------------------------------------------------------------------------- std::vector RimCellFilterCollection::filters() const { - return m_cellFilters.childObjects(); + return m_cellFilters.children(); } //-------------------------------------------------------------------------------------------------- @@ -120,7 +120,7 @@ void RimCellFilterCollection::initAfterRead() } for ( auto& filter : filters ) { - m_rangeFilters_OBSOLETE.removeChildObject( filter ); + m_rangeFilters_OBSOLETE.removeChild( filter ); m_cellFilters.push_back( filter ); } @@ -328,7 +328,7 @@ void RimCellFilterCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* //-------------------------------------------------------------------------------------------------- void RimCellFilterCollection::removeFilter( RimCellFilter* filter ) { - m_cellFilters.removeChildObject( filter ); + m_cellFilters.removeChild( filter ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp index 9ee522722c..857c378294 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimEclipsePropertyFilterCollection.cpp @@ -47,7 +47,7 @@ RimEclipsePropertyFilterCollection::RimEclipsePropertyFilterCollection() //-------------------------------------------------------------------------------------------------- RimEclipsePropertyFilterCollection::~RimEclipsePropertyFilterCollection() { - propertyFilters.deleteAllChildObjects(); + propertyFilters.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp index 33d7c8df4e..7077ea9f95 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimGeoMechPropertyFilterCollection.cpp @@ -45,7 +45,7 @@ RimGeoMechPropertyFilterCollection::RimGeoMechPropertyFilterCollection() //-------------------------------------------------------------------------------------------------- RimGeoMechPropertyFilterCollection::~RimGeoMechPropertyFilterCollection() { - propertyFilters.deleteAllChildObjects(); + propertyFilters.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp index 7fb3d7649b..b6a3dffbfc 100644 --- a/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/CellFilters/RimPolygonFilter.cpp @@ -257,7 +257,7 @@ QString RimPolygonFilter::fullName() const //-------------------------------------------------------------------------------------------------- std::vector RimPolygonFilter::activeTargets() const { - return m_targets.childObjects(); + return m_targets.children(); } //-------------------------------------------------------------------------------------------------- @@ -279,7 +279,7 @@ void RimPolygonFilter::insertTarget( const RimPolylineTarget* targetToInsertBefo //-------------------------------------------------------------------------------------------------- void RimPolygonFilter::deleteTarget( RimPolylineTarget* targetToDelete ) { - m_targets.removeChildObject( targetToDelete ); + m_targets.removeChild( targetToDelete ); delete targetToDelete; } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp index cc14742fa6..561ed9a4d9 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/Rim3dWellLogCurveCollection.cpp @@ -50,7 +50,7 @@ Rim3dWellLogCurveCollection::Rim3dWellLogCurveCollection() //-------------------------------------------------------------------------------------------------- Rim3dWellLogCurveCollection::~Rim3dWellLogCurveCollection() { - m_3dWellLogCurves.deleteAllChildObjects(); + m_3dWellLogCurves.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -80,7 +80,7 @@ void Rim3dWellLogCurveCollection::add3dWellLogCurve( Rim3dWellLogCurve* curve ) //-------------------------------------------------------------------------------------------------- void Rim3dWellLogCurveCollection::remove3dWellLogCurve( Rim3dWellLogCurve* curve ) { - m_3dWellLogCurves.removeChildObject( curve ); + m_3dWellLogCurves.removeChild( curve ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp index 27b94eee6a..bf71d7cfe4 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimEnsembleFractureStatisticsCollection.cpp @@ -46,7 +46,7 @@ void RimEnsembleFractureStatisticsCollection::addFractureGroupStatistics( RimEns //-------------------------------------------------------------------------------------------------- void RimEnsembleFractureStatisticsCollection::loadAndUpdateData() { - for ( auto f : m_fractureGroupStatistics.childObjects() ) + for ( auto f : m_fractureGroupStatistics.children() ) { f->loadAndUpdateData(); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp index 0a33fed054..b1a1c5d74c 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFishbonesCollection.cpp @@ -155,7 +155,7 @@ std::vector RimFishbonesCollection::activeFishbonesSubs() const //-------------------------------------------------------------------------------------------------- std::vector RimFishbonesCollection::allFishbonesSubs() const { - return m_fishbones.childObjects(); + return m_fishbones.children(); } //-------------------------------------------------------------------------------------------------- @@ -228,7 +228,7 @@ double RimFishbonesCollection::endMD() const double endMD = m_startMD; if ( !m_fishbones.empty() ) { - auto lastFishbone = m_fishbones.childObjects().back(); + auto lastFishbone = m_fishbones.children().back(); CVF_ASSERT( lastFishbone ); endMD = lastFishbone->endMD(); } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp index 2f26e6046a..d607ef8463 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp @@ -71,7 +71,7 @@ RimFractureTemplateCollection::RimFractureTemplateCollection() //-------------------------------------------------------------------------------------------------- RimFractureTemplateCollection::~RimFractureTemplateCollection() { - m_fractureDefinitions.deleteAllChildObjects(); + m_fractureDefinitions.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp index 3f148981e0..f35aa426a6 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimPerforationCollection.cpp @@ -59,7 +59,7 @@ RimPerforationCollection::RimPerforationCollection() //-------------------------------------------------------------------------------------------------- RimPerforationCollection::~RimPerforationCollection() { - m_perforations.deleteAllChildObjects(); + m_perforations.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp index 7ad9048437..6fe6f2d766 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimSimWellFractureCollection.cpp @@ -41,7 +41,7 @@ RimSimWellFractureCollection::RimSimWellFractureCollection( void ) //-------------------------------------------------------------------------------------------------- RimSimWellFractureCollection::~RimSimWellFractureCollection() { - simwellFractures.deleteAllChildObjects(); + simwellFractures.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -49,7 +49,7 @@ RimSimWellFractureCollection::~RimSimWellFractureCollection() //-------------------------------------------------------------------------------------------------- void RimSimWellFractureCollection::deleteFractures() { - simwellFractures.deleteAllChildObjects(); + simwellFractures.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp index 1f5aec2f94..144863bbd0 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimValveTemplateCollection.cpp @@ -69,7 +69,7 @@ void RimValveTemplateCollection::addValveTemplate( RimValveTemplate* valveTempla //-------------------------------------------------------------------------------------------------- void RimValveTemplateCollection::removeAndDeleteValveTemplate( RimValveTemplate* valveTemplate ) { - m_valveDefinitions.removeChildObject( valveTemplate ); + m_valveDefinitions.removeChild( valveTemplate ); delete valveTemplate; } diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp index 16714da3ab..2317133b9d 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp @@ -69,7 +69,7 @@ void RimWellPathFractureCollection::addFracture( RimWellPathFracture* fracture ) //-------------------------------------------------------------------------------------------------- void RimWellPathFractureCollection::deleteFractures() { - m_fractures.deleteAllChildObjects(); + m_fractures.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -77,7 +77,7 @@ void RimWellPathFractureCollection::deleteFractures() //-------------------------------------------------------------------------------------------------- std::vector RimWellPathFractureCollection::allFractures() const { - return m_fractures.childObjects(); + return m_fractures.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp index a43636a55d..3f7ebbb600 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimAbstractCorrelationPlot.cpp @@ -105,7 +105,7 @@ RimAbstractCorrelationPlot::~RimAbstractCorrelationPlot() //-------------------------------------------------------------------------------------------------- void RimAbstractCorrelationPlot::setCurveDefinitions( const std::vector& curveDefinitions ) { - m_dataSources.deleteAllChildObjects(); + m_dataSources.deleteChildren(); for ( auto curveDef : curveDefinitions ) { auto dataEntry = new RimAnalysisPlotDataEntry(); @@ -155,7 +155,7 @@ void RimAbstractCorrelationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch if ( !curveSelection.empty() ) { std::vector summaryVectorDefinitions = dlg.curveSelection(); - m_dataSources.deleteAllChildObjects(); + m_dataSources.deleteChildren(); for ( const RiaSummaryCurveDefinition& vectorDef : summaryVectorDefinitions ) { auto plotEntry = new RimAnalysisPlotDataEntry(); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp index 78c5ad7e40..3570687983 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp @@ -193,7 +193,7 @@ void RimCorrelationPlotCollection::insertPlot( RimAbstractCorrelationPlot* plot, //-------------------------------------------------------------------------------------------------- void RimCorrelationPlotCollection::removePlot( RimAbstractCorrelationPlot* plot ) { - m_correlationPlots.removeChildObject( plot ); + m_correlationPlots.removeChild( plot ); updateAllRequiredEditors(); } @@ -202,7 +202,7 @@ void RimCorrelationPlotCollection::removePlot( RimAbstractCorrelationPlot* plot //-------------------------------------------------------------------------------------------------- std::vector RimCorrelationPlotCollection::plots() const { - return m_correlationPlots.childObjects(); + return m_correlationPlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -218,7 +218,7 @@ size_t RimCorrelationPlotCollection::plotCount() const //-------------------------------------------------------------------------------------------------- std::vector RimCorrelationPlotCollection::reports() const { - return m_correlationReports.childObjects(); + return m_correlationReports.children(); } //-------------------------------------------------------------------------------------------------- @@ -227,7 +227,7 @@ std::vector RimCorrelationPlotCollection::reports() c void RimCorrelationPlotCollection::deleteAllPlots() { RimTypedPlotCollection::deleteAllPlots(); - m_correlationReports.deleteAllChildObjects(); + m_correlationReports.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp index c343a8c292..5e26badf1a 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultInViewCollection.cpp @@ -117,7 +117,7 @@ RimFaultInViewCollection::RimFaultInViewCollection() //-------------------------------------------------------------------------------------------------- RimFaultInViewCollection::~RimFaultInViewCollection() { - faults.deleteAllChildObjects(); + faults.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -269,7 +269,7 @@ void RimFaultInViewCollection::syncronizeFaults() newFaults.push_back( rimFault ); } - this->faults().clear(); + this->faults().clearWithoutDelete(); this->faults().insert( 0, newFaults ); QString toolTip = QString( "Fault count (%1)" ).arg( newFaults.size() ); diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp index bd5a791e5e..1e0a3ffff4 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp @@ -270,7 +270,7 @@ void RimFaultRASettings::initFromPreprocSettings( RimFaultRAPreprocSettings* pre RifParameterXmlReader basicreader( RiaPreferencesGeoMech::current()->geomechFRADefaultBasicXML() ); if ( !basicreader.parseFile( errorText ) ) return; - m_basicParameters.clear(); + m_basicParameters.clearWithoutDelete(); for ( auto group : basicreader.parameterGroups() ) { m_basicParameters.push_back( group ); @@ -281,7 +281,7 @@ void RimFaultRASettings::initFromPreprocSettings( RimFaultRAPreprocSettings* pre RifParameterXmlReader advreader( RiaPreferencesGeoMech::current()->geomechFRADefaultAdvXML() ); if ( !advreader.parseFile( errorText ) ) return; - m_advancedParameters.clear(); + m_advancedParameters.clearWithoutDelete(); for ( auto group : advreader.parameterGroups() ) { m_advancedParameters.push_back( group ); @@ -406,7 +406,7 @@ std::list RimFaultRASettings::basicParameters( int faultID retlist.push_back( p ); } - for ( auto& group : m_basicParameters.childObjects() ) + for ( auto& group : m_basicParameters.children() ) { for ( auto& p : group->parameters() ) { @@ -437,7 +437,7 @@ std::list RimFaultRASettings::advancedParameters( int faul retlist.push_back( p ); } - for ( auto& group : m_advancedParameters.childObjects() ) + for ( auto& group : m_advancedParameters.children() ) { for ( auto& p : group->parameters() ) { @@ -611,13 +611,13 @@ RimGenericParameter* RimFaultRASettings::getInputParameter( QString name ) const { RimGenericParameter* retval = nullptr; - for ( auto group : m_basicParameters.childObjects() ) + for ( auto group : m_basicParameters.children() ) { retval = group->parameter( name ); if ( retval != nullptr ) return retval; } - for ( auto group : m_advancedParameters.childObjects() ) + for ( auto group : m_advancedParameters.children() ) { retval = group->parameter( name ); if ( retval != nullptr ) return retval; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp index e2a3390fe3..3c7153ac5f 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp @@ -60,7 +60,7 @@ RimFlowPlotCollection::~RimFlowPlotCollection() { delete m_defaultWellAllocPlot(); - m_storedWellAllocPlots.deleteAllChildObjects(); + m_storedWellAllocPlots.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -78,8 +78,8 @@ void RimFlowPlotCollection::deleteAllPlots() // delete m_dbgWellDistributionPlot; delete m_wellDistributionPlotCollection; - m_storedWellAllocPlots.deleteAllChildObjects(); - m_storedFlowCharacteristicsPlots.deleteAllChildObjects(); + m_storedWellAllocPlots.deleteChildren(); + m_storedFlowCharacteristicsPlots.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp index 7bda3287c9..5df1626e7e 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp @@ -99,7 +99,7 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection() RimWellDistributionPlotCollection::~RimWellDistributionPlotCollection() { removeMdiWindowFromMdiArea(); - m_plots.deleteAllChildObjects(); + m_plots.deleteChildren(); cleanupBeforeClose(); } @@ -384,7 +384,7 @@ void RimWellDistributionPlotCollection::updatePlots() //-------------------------------------------------------------------------------------------------- void RimWellDistributionPlotCollection::cleanupBeforeClose() { - auto plotVector = m_plots.childObjects(); + auto plotVector = m_plots.children(); for ( size_t tIdx = 0; tIdx < plotVector.size(); ++tIdx ) { plotVector[tIdx]->detachAllCurves(); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 84918bbc94..39563b3d8b 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -1045,7 +1045,7 @@ void RimWellPltPlot::initAfterLoad() //-------------------------------------------------------------------------------------------------- void RimWellPltPlot::syncSourcesIoFieldFromGuiField() { - m_selectedSourcesForIo.clear(); + m_selectedSourcesForIo.clearWithoutDelete(); for ( const RifDataSourceForRftPlt& addr : m_selectedSources() ) { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index 911e0b5f3d..f4c91261fd 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -1360,7 +1360,7 @@ void RimWellRftPlot::createEnsembleCurveSets() for ( RimWellRftEnsembleCurveSet* curveSet : curveSetsToDelete ) { - m_ensembleCurveSets.removeChildObject( curveSet ); + m_ensembleCurveSets.removeChild( curveSet ); delete curveSet; } diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp index 6faf651946..9f0b361be2 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp @@ -183,7 +183,7 @@ RimGeoMechCase::RimGeoMechCase( void ) //-------------------------------------------------------------------------------------------------- RimGeoMechCase::~RimGeoMechCase( void ) { - geoMechViews.deleteAllChildObjects(); + geoMechViews.deleteChildren(); RimProject* project = RimProject::current(); if ( project ) @@ -418,7 +418,7 @@ std::vector RimGeoMechCase::allSpecialViews() const void RimGeoMechCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ ) { std::vector children; - geoMechViews.childObjects( &children ); + geoMechViews.children( &children ); for ( auto child : children ) uiTreeOrdering.add( child ); diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapViewCollection.cpp index 61974dc1b2..37dfae92dc 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechContourMapViewCollection.cpp @@ -28,7 +28,7 @@ RimGeoMechContourMapViewCollection::~RimGeoMechContourMapViewCollection() //-------------------------------------------------------------------------------------------------- std::vector RimGeoMechContourMapViewCollection::views() { - return m_contourMapViews.childObjects(); + return m_contourMapViews.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp index 1ba13b3d44..05b3a3c34d 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechModels.cpp @@ -52,7 +52,7 @@ RimGeoMechModels::~RimGeoMechModels( void ) //-------------------------------------------------------------------------------------------------- std::vector RimGeoMechModels::cases() const { - return m_cases.childObjects(); + return m_cases.children(); } //-------------------------------------------------------------------------------------------------- @@ -68,7 +68,7 @@ void RimGeoMechModels::addCase( RimGeoMechCase* thecase ) //-------------------------------------------------------------------------------------------------- void RimGeoMechModels::removeCase( RimGeoMechCase* thecase ) { - m_cases.removeChildObject( thecase ); + m_cases.removeChild( thecase ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp index ed591abb0b..6412b3ffd2 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp @@ -69,7 +69,7 @@ void RimGeoMechPartCollection::syncWithCase( RimGeoMechCase* geoCase ) if ( count != (int)m_parts.size() ) { - m_parts.clear(); + m_parts.clearWithoutDelete(); for ( int i = 0; i < count; i++ ) { @@ -91,7 +91,7 @@ void RimGeoMechPartCollection::syncWithCase( RimGeoMechCase* geoCase ) //-------------------------------------------------------------------------------------------------- std::vector RimGeoMechPartCollection::parts() const { - return m_parts.childObjects(); + return m_parts.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index 8b5581ec14..1151b0c0d7 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -143,7 +143,7 @@ void RimGridCrossPlot::addDataSet( RimGridCrossPlotDataSet* dataSet ) //-------------------------------------------------------------------------------------------------- std::vector RimGridCrossPlot::dataSets() const { - return m_crossPlotDataSets.childObjects(); + return m_crossPlotDataSets.children(); } //-------------------------------------------------------------------------------------------------- @@ -642,8 +642,8 @@ void RimGridCrossPlot::swapAxes() yAxisProperties->plotAxisType().axis() ); yAxisProperties->setNameAndAxis( tmpName, tmpTitle, tmpAxis.axis() ); - m_xAxisProperties.removeChildObject( xAxisProperties ); - m_yAxisProperties.removeChildObject( yAxisProperties ); + m_xAxisProperties.removeChild( xAxisProperties ); + m_yAxisProperties.removeChild( yAxisProperties ); m_yAxisProperties = xAxisProperties; m_xAxisProperties = yAxisProperties; diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp index 51c3fdaeb3..2342240f13 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp @@ -45,7 +45,7 @@ RimGridCrossPlotCollection::~RimGridCrossPlotCollection() //-------------------------------------------------------------------------------------------------- std::vector RimGridCrossPlotCollection::plots() const { - return m_gridCrossPlots.childObjects(); + return m_gridCrossPlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -82,6 +82,6 @@ void RimGridCrossPlotCollection::insertPlot( RimGridCrossPlot* plot, size_t inde //-------------------------------------------------------------------------------------------------- void RimGridCrossPlotCollection::removePlot( RimGridCrossPlot* plot ) { - m_gridCrossPlots.removeChildObject( plot ); + m_gridCrossPlots.removeChild( plot ); updateAllRequiredEditors(); } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp index 3eae5418bb..9d08a5b10c 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp @@ -372,7 +372,7 @@ RimRegularLegendConfig* RimGridCrossPlotDataSet::legendConfig() const //-------------------------------------------------------------------------------------------------- std::vector RimGridCrossPlotDataSet::curves() const { - return m_crossPlotCurves.childObjects(); + return m_crossPlotCurves.children(); } //-------------------------------------------------------------------------------------------------- @@ -684,7 +684,7 @@ void RimGridCrossPlotDataSet::fillCurveDataInExistingCurves( const RigEclipseCro void RimGridCrossPlotDataSet::destroyCurves() { detachAllCurves(); - m_crossPlotCurves.deleteAllChildObjects(); + m_crossPlotCurves.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -970,7 +970,7 @@ QList RimGridCrossPlotDataSet::calculateValueOptions( co if ( eclipseCase ) { options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) ); - for ( RimEclipseView* view : eclipseCase->reservoirViews.childObjects() ) + for ( RimEclipseView* view : eclipseCase->reservoirViews.children() ) { CVF_ASSERT( view && "Really always should have a valid view pointer in ReservoirViews" ); options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) ); @@ -1122,8 +1122,8 @@ void RimGridCrossPlotDataSet::swapAxisProperties( bool updatePlot ) RimEclipseResultDefinition* xAxisProperties = m_xAxisProperty(); RimEclipseResultDefinition* yAxisProperties = m_yAxisProperty(); - m_xAxisProperty.removeChildObject( xAxisProperties ); - m_yAxisProperty.removeChildObject( yAxisProperties ); + m_xAxisProperty.removeChild( xAxisProperties ); + m_yAxisProperty.removeChild( yAxisProperties ); m_yAxisProperty = xAxisProperties; m_xAxisProperty = yAxisProperties; diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp index 7dccc1a41b..da80d9b90f 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp @@ -110,7 +110,7 @@ std::vector //-------------------------------------------------------------------------------------------------- std::vector RimSaturationPressurePlotCollection::plots() const { - return m_saturationPressurePlots.childObjects(); + return m_saturationPressurePlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -126,7 +126,7 @@ size_t RimSaturationPressurePlotCollection::plotCount() const //-------------------------------------------------------------------------------------------------- void RimSaturationPressurePlotCollection::deleteAllPlots() { - m_saturationPressurePlots.deleteAllChildObjects(); + m_saturationPressurePlots.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp index 850c9668e8..af6b931d30 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionCollection.cpp @@ -79,8 +79,8 @@ RimIntersectionCollection::RimIntersectionCollection() //-------------------------------------------------------------------------------------------------- RimIntersectionCollection::~RimIntersectionCollection() { - m_intersections.deleteAllChildObjects(); - m_intersectionBoxes.deleteAllChildObjects(); + m_intersections.deleteChildren(); + m_intersectionBoxes.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -254,7 +254,7 @@ void RimIntersectionCollection::rebuildGeometry() //-------------------------------------------------------------------------------------------------- std::vector RimIntersectionCollection::intersections() const { - return m_intersections.childObjects(); + return m_intersections.children(); } //-------------------------------------------------------------------------------------------------- @@ -262,7 +262,7 @@ std::vector RimIntersectionCollection::intersecti //-------------------------------------------------------------------------------------------------- std::vector RimIntersectionCollection::intersectionBoxes() const { - return m_intersectionBoxes.childObjects(); + return m_intersectionBoxes.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp index ba669d4a05..26275e1ba2 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimIntersectionResultsDefinitionCollection.cpp @@ -61,7 +61,7 @@ bool RimIntersectionResultsDefinitionCollection::isActive() const //-------------------------------------------------------------------------------------------------- std::vector RimIntersectionResultsDefinitionCollection::intersectionResultsDefinitions() const { - return m_intersectionResultsDefs.childObjects(); + return m_intersectionResultsDefs.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp index 517384de5b..590e2f1b89 100644 --- a/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/Parameters/RimParameterGroup.cpp @@ -280,7 +280,7 @@ std::vector RimParameterGroup::parameters() const { std::vector retParams; - for ( const auto& p : m_parameters.childObjects() ) + for ( const auto& p : m_parameters.children() ) { if ( isListParameter( p->name() ) ) continue; retParams.push_back( p ); @@ -288,7 +288,7 @@ std::vector RimParameterGroup::parameters() const for ( const auto& list : m_lists ) { - retParams.push_back( list->getAsListParameter( m_parameters.childObjects() ) ); + retParams.push_back( list->getAsListParameter( m_parameters.children() ) ); } return retParams; @@ -324,7 +324,7 @@ void RimParameterGroup::setParameterValue( QString name, QString value ) //-------------------------------------------------------------------------------------------------- RimGenericParameter* RimParameterGroup::parameter( QString name ) const { - for ( auto& p : m_parameters.childObjects() ) + for ( auto& p : m_parameters.children() ) { if ( p->name() == name ) { diff --git a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp index 89138401af..55dbc92ac6 100644 --- a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp @@ -56,8 +56,8 @@ RimPlotTemplateFolderItem::~RimPlotTemplateFolderItem() //-------------------------------------------------------------------------------------------------- void RimPlotTemplateFolderItem::createRootFolderItemsFromFolderPaths( const QStringList& folderPaths ) { - m_fileNames.deleteAllChildObjects(); - m_subFolders.deleteAllChildObjects(); + m_fileNames.deleteChildren(); + m_subFolders.deleteChildren(); createSubFolderItemsFromFolderPaths( folderPaths ); } @@ -67,7 +67,7 @@ void RimPlotTemplateFolderItem::createRootFolderItemsFromFolderPaths( const QStr //-------------------------------------------------------------------------------------------------- std::vector RimPlotTemplateFolderItem::fileNames() const { - return m_fileNames.childObjects(); + return m_fileNames.children(); } //-------------------------------------------------------------------------------------------------- @@ -75,7 +75,7 @@ std::vector RimPlotTemplateFolderItem::fileNames() con //-------------------------------------------------------------------------------------------------- std::vector RimPlotTemplateFolderItem::subFolders() const { - return m_subFolders.childObjects(); + return m_subFolders.children(); } //-------------------------------------------------------------------------------------------------- @@ -103,8 +103,8 @@ void RimPlotTemplateFolderItem::setFolderPath( const QString& path ) //-------------------------------------------------------------------------------------------------- void RimPlotTemplateFolderItem::searchForFileAndFolderNames() { - m_fileNames.deleteAllChildObjects(); - m_subFolders.deleteAllChildObjects(); + m_fileNames.deleteChildren(); + m_subFolders.deleteChildren(); if ( m_folderName().path().isEmpty() ) { diff --git a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionViewCollection.cpp index 65aefd1f73..6680d03536 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionViewCollection.cpp @@ -47,7 +47,7 @@ Rim2dIntersectionViewCollection::~Rim2dIntersectionViewCollection() //-------------------------------------------------------------------------------------------------- std::vector Rim2dIntersectionViewCollection::views() { - return m_intersectionViews.childObjects(); + return m_intersectionViews.children(); } //-------------------------------------------------------------------------------------------------- @@ -73,7 +73,7 @@ void Rim2dIntersectionViewCollection::syncFromExistingIntersections( bool doUpda // Clean up the container by removing nullptr's - m_intersectionViews.removeChildObject( nullptr ); + m_intersectionViews.removeChild( nullptr ); // Build map from intersection to view @@ -84,7 +84,7 @@ void Rim2dIntersectionViewCollection::syncFromExistingIntersections( bool doUpda intersectionToViewMap[iv->intersection()] = iv; } - m_intersectionViews.clear(); // Not deleting the views. The are managed by the map + m_intersectionViews.clearWithoutDelete(); // Not deleting the views. The are managed by the map // Insert the old views in correct order, and create new views as we go diff --git a/ApplicationLibCode/ProjectDataModel/RimCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimCaseCollection.cpp index 2cf42c7fbe..fc53bd0bcc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCaseCollection.cpp @@ -41,7 +41,7 @@ RimCaseCollection::RimCaseCollection() //-------------------------------------------------------------------------------------------------- RimCaseCollection::~RimCaseCollection() { - reservoirs.deleteAllChildObjects(); + reservoirs.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp b/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp index 863707c04b..da747e72ac 100644 --- a/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimColorLegend.cpp @@ -104,7 +104,7 @@ void RimColorLegend::appendColorLegendItem( RimColorLegendItem* colorLegendItem //-------------------------------------------------------------------------------------------------- std::vector RimColorLegend::colorLegendItems() const { - return m_colorLegendItems.childObjects(); + return m_colorLegendItems.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp index d883e5974c..c2bd9e2f76 100644 --- a/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimColorLegendCollection.cpp @@ -76,7 +76,7 @@ bool RimColorLegendCollection::isStandardColorLegend( RimColorLegend* legend ) //-------------------------------------------------------------------------------------------------- void RimColorLegendCollection::deleteCustomColorLegends() { - m_customColorLegends.deleteAllChildObjects(); + m_customColorLegends.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -138,13 +138,13 @@ std::vector RimColorLegendCollection::allColorLegends() const { std::vector allLegends; - auto standardLegends = m_standardColorLegends.childObjects(); + auto standardLegends = m_standardColorLegends.children(); for ( auto l : standardLegends ) { allLegends.push_back( l ); } - auto customLegends = m_customColorLegends.childObjects(); + auto customLegends = m_customColorLegends.children(); for ( auto l : customLegends ) { allLegends.push_back( l ); diff --git a/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp b/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp index a9c0284551..f732baccb9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCommandObject.cpp @@ -265,7 +265,7 @@ void RimCommandIssueFieldChanged::childObjects( caf::PdmObject* pdmObject, std:: size_t fIdx; for ( fIdx = 0; fIdx < fields.size(); ++fIdx ) { - if ( fields[fIdx] ) fields[fIdx]->childObjects( &children ); + if ( fields[fIdx] ) fields[fIdx]->children( &children ); } } @@ -289,7 +289,7 @@ caf::PdmObjectHandle* RimCommandIssueFieldChanged::findObjectByName( caf::PdmObj if ( fields[fIdx] ) { std::vector children; - fields[fIdx]->childObjects( &children ); + fields[fIdx]->children( &children ); for ( size_t cIdx = 0; cIdx < children.size(); cIdx++ ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp index 7e98c277e0..87b1c1617a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunction.cpp @@ -80,7 +80,7 @@ RimCustomObjectiveFunctionWeight* RimCustomObjectiveFunction::addWeight() //-------------------------------------------------------------------------------------------------- std::vector RimCustomObjectiveFunction::weights() const { - return m_weights.childObjects(); + return m_weights.children(); } //-------------------------------------------------------------------------------------------------- @@ -350,7 +350,7 @@ RimCustomObjectiveFunctionCollection* RimCustomObjectiveFunction::parentCollecti //-------------------------------------------------------------------------------------------------- RimObjectiveFunction* RimCustomObjectiveFunction::objectiveFunction( RimObjectiveFunction::FunctionType functionType ) const { - for ( auto objectiveFunc : m_objectiveFunctions.childObjects() ) + for ( auto objectiveFunc : m_objectiveFunctions.children() ) { if ( objectiveFunc->functionType() == functionType ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp index a4b3f46fb4..2826d0aa38 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionCollection.cpp @@ -58,7 +58,7 @@ void RimCustomObjectiveFunctionCollection::onObjectiveFunctionChanged( RimCustom //-------------------------------------------------------------------------------------------------- std::vector RimCustomObjectiveFunctionCollection::objectiveFunctions() const { - return m_objectiveFunctions.childObjects(); + return m_objectiveFunctions.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp index 103e56379c..98a4f0c0eb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp @@ -155,7 +155,7 @@ void RimCustomObjectiveFunctionWeight::fieldChangedByUi( const caf::PdmFieldHand RimSummaryCaseCollection* candidateEnsemble = parentCurveSet()->summaryCaseCollection(); std::vector candidateAddresses; - for ( auto address : m_objectiveValuesSummaryAddresses().childObjects() ) + for ( auto address : m_objectiveValuesSummaryAddresses().children() ) { candidateAddresses.push_back( address->address() ); } @@ -167,7 +167,7 @@ void RimCustomObjectiveFunctionWeight::fieldChangedByUi( const caf::PdmFieldHand auto curveSelection = dlg.curveSelection(); if ( !curveSelection.empty() ) { - m_objectiveValuesSummaryAddresses.clear(); + m_objectiveValuesSummaryAddresses.clearWithoutDelete(); for ( auto address : curveSelection ) { RimSummaryAddress* summaryAddress = new RimSummaryAddress(); diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index 46f79d0976..59045f5ac8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -165,7 +165,7 @@ RimDepthTrackPlot::~RimDepthTrackPlot() delete m_nameConfig; removeMdiWindowFromMdiArea(); - m_plots.deleteAllChildObjects(); + m_plots.deleteChildren(); cleanupBeforeClose(); } @@ -178,8 +178,8 @@ RimDepthTrackPlot& RimDepthTrackPlot::operator=( RimDepthTrackPlot&& rhs ) RimPlotWindow::operator=( std::move( rhs ) ); // Move all tracks - auto plots = rhs.m_plots.childObjects(); - rhs.m_plots.clear(); + auto plots = rhs.m_plots.children(); + rhs.m_plots.clearWithoutDelete(); for ( auto plot : plots ) { m_plots.push_back( plot ); @@ -190,7 +190,7 @@ RimDepthTrackPlot& RimDepthTrackPlot::operator=( RimDepthTrackPlot&& rhs ) // They had their own description at top level which we don't want to overwrite. auto dataSource = rhs.m_commonDataSource(); - rhs.m_commonDataSource.removeChildObject( dataSource ); + rhs.m_commonDataSource.removeChild( dataSource ); m_commonDataSource = dataSource; m_commonDataSourceEnabled = rhs.m_commonDataSourceEnabled; @@ -270,7 +270,7 @@ std::vector RimDepthTrackPlot::plots() const { std::vector baseClassPlots; - for ( auto p : m_plots.childObjects() ) + for ( auto p : m_plots.children() ) { baseClassPlots.push_back( p ); } @@ -1082,7 +1082,7 @@ void RimDepthTrackPlot::removePlot( RimPlot* plot ) { m_viewer->removePlot( plot->plotWidget() ); } - m_plots.removeChildObject( plot ); + m_plots.removeChild( plot ); onPlotAdditionOrRemoval(); } @@ -1211,7 +1211,7 @@ RiuPlotAxis RimDepthTrackPlot::valueAxis() const //-------------------------------------------------------------------------------------------------- void RimDepthTrackPlot::setAutoScalePropertyValuesEnabled( bool enabled ) { - for ( auto plot : m_plots.childObjects() ) + for ( auto plot : m_plots.children() ) { plot->setAutoScalePropertyValuesEnabled( enabled ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index 0b82ab025f..e82478abc6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -146,7 +146,7 @@ RimEclipseCase::RimEclipseCase() //-------------------------------------------------------------------------------------------------- RimEclipseCase::~RimEclipseCase() { - reservoirViews.deleteAllChildObjects(); + reservoirViews.deleteChildren(); delete m_matrixModelResults(); delete m_fractureModelResults(); @@ -573,7 +573,7 @@ void RimEclipseCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin if ( uiConfigName == "MainWindow.ProjectTree" ) { std::vector children; - reservoirViews.childObjects( &children ); + reservoirViews.children( &children ); for ( auto child : children ) uiTreeOrdering.add( child ); @@ -602,7 +602,7 @@ void RimEclipseCase::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin //-------------------------------------------------------------------------------------------------- void RimEclipseCase::buildChildNodes() { - m_resultAddressCollections.deleteAllChildObjects(); + m_resultAddressCollections.deleteChildren(); std::vector resultTypes = { RiaDefines::ResultCatType::STATIC_NATIVE, RiaDefines::ResultCatType::DYNAMIC_NATIVE, diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp index 39c6234c64..ab21c3210c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseCollection.cpp @@ -67,8 +67,8 @@ void RimEclipseCaseCollection::close() { m_gridCollection->clear(); - cases.deleteAllChildObjects(); - caseGroups.deleteAllChildObjects(); + cases.deleteChildren(); + caseGroups.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -109,7 +109,7 @@ void RimEclipseCaseCollection::removeCaseFromAllGroups( RimEclipseCase* reservoi cg->removeCase( reservoir ); } - cases().removeChildObject( reservoir ); + cases().removeChild( reservoir ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp index fed5b0b2be..cc09ddac0f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCellColors.cpp @@ -81,7 +81,7 @@ RimEclipseCellColors::~RimEclipseCellColors() { CVF_ASSERT( obsoleteField_legendConfig() == nullptr ); - m_legendConfigData.deleteAllChildObjects(); + m_legendConfigData.deleteChildren(); delete m_ternaryLegendConfig(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapViewCollection.cpp index 45ffa07d81..d806f069be 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseContourMapViewCollection.cpp @@ -28,7 +28,7 @@ RimEclipseContourMapViewCollection::~RimEclipseContourMapViewCollection() //-------------------------------------------------------------------------------------------------- std::vector RimEclipseContourMapViewCollection::views() { - return m_contourMapViews.childObjects(); + return m_contourMapViews.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp index 3ec265b115..ce479cf7e4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseInputPropertyCollection.cpp @@ -42,7 +42,7 @@ RimEclipseInputPropertyCollection::RimEclipseInputPropertyCollection() //-------------------------------------------------------------------------------------------------- RimEclipseInputPropertyCollection::~RimEclipseInputPropertyCollection() { - inputProperties.deleteAllChildObjects(); + inputProperties.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp index 5d64d76437..a6f8b85b38 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultCase.cpp @@ -487,8 +487,8 @@ cvf::ref RimEclipseResultCase::createMockModel( QString mode //-------------------------------------------------------------------------------------------------- RimEclipseResultCase::~RimEclipseResultCase() { - reservoirViews.deleteAllChildObjects(); - m_flowDiagSolutions.deleteAllChildObjects(); + reservoirViews.deleteChildren(); + m_flowDiagSolutions.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp index 14d03c2fa4..586a7b9058 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCase.cpp @@ -556,7 +556,7 @@ void RimEclipseStatisticsCase::fieldChangedByUi( const caf::PdmFieldHandle* chan RimEclipseView* reservoirView = reservoirViews()[i]; CVF_ASSERT( reservoirView ); - reservoirView->wellCollection()->wells.deleteAllChildObjects(); + reservoirView->wellCollection()->wells.deleteChildren(); reservoirView->updateDisplayModelForWellResults(); reservoirView->wellCollection()->updateConnectedEditors(); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseCollection.cpp index f414b44cf1..1237dde0b0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseStatisticsCaseCollection.cpp @@ -42,7 +42,7 @@ RimEclipseStatisticsCaseCollection::RimEclipseStatisticsCaseCollection() //-------------------------------------------------------------------------------------------------- RimEclipseStatisticsCaseCollection::~RimEclipseStatisticsCaseCollection() { - cases.deleteAllChildObjects(); + cases.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index c25bcb2b07..f403c5f8c8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -1627,7 +1627,7 @@ void RimEclipseView::syncronizeWellsWithResults() delete well; } } - this->wellCollection()->wells().clear(); + this->wellCollection()->wells().clearWithoutDelete(); // Set the new wells into the field. this->wellCollection()->wells().insert( 0, newWells ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp index cec620b09c..ee31a31207 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEnsembleFractureStatisticsPlotCollection.cpp @@ -69,7 +69,7 @@ void RimEnsembleFractureStatisticsPlotCollection::addEnsembleFractureStatisticsP std::vector RimEnsembleFractureStatisticsPlotCollection::ensembleFractureStatisticsPlots() const { - return m_ensembleFractureStatisticsPlots.childObjects(); + return m_ensembleFractureStatisticsPlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -77,5 +77,5 @@ std::vector //-------------------------------------------------------------------------------------------------- void RimEnsembleFractureStatisticsPlotCollection::deleteAllPlots() { - m_ensembleFractureStatisticsPlots.deleteAllChildObjects(); + m_ensembleFractureStatisticsPlots.deleteChildren(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp index 4fdf3f80ce..166be30358 100644 --- a/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimFormationNamesCollection.cpp @@ -42,7 +42,7 @@ RimFormationNamesCollection::RimFormationNamesCollection() //-------------------------------------------------------------------------------------------------- RimFormationNamesCollection::~RimFormationNamesCollection() { - m_formationNamesList.deleteAllChildObjects(); + m_formationNamesList.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -109,7 +109,7 @@ std::vector RimFormationNamesCollection::importFiles( const RiaLogging::errorInMessageBox( nullptr, "Import Formation Names", totalErrorMessage ); } - return m_formationNamesList.childObjects(); + return m_formationNamesList.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp index 485031fcc7..e5a35b2085 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCollection.cpp @@ -182,7 +182,7 @@ void RimGridInfoCollection::addGridInfo( RimGridInfo* gridInfo ) //-------------------------------------------------------------------------------------------------- void RimGridInfoCollection::clear() { - m_gridInfos.deleteAllChildObjects(); + m_gridInfos.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -219,7 +219,7 @@ void RimGridInfoCollection::deleteGridInfo( const QString& gridName ) //-------------------------------------------------------------------------------------------------- std::vector RimGridInfoCollection::gridInfos() const { - return m_gridInfos.childObjects(); + return m_gridInfos.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp index 6ee0ebd10e..2298cf558c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlot.cpp @@ -193,7 +193,7 @@ QList RimGridStatisticsPlot::calculateValueOptions( cons if ( eclipseCase ) { options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) ); - for ( RimEclipseView* view : eclipseCase->reservoirViews.childObjects() ) + for ( RimEclipseView* view : eclipseCase->reservoirViews.children() ) { CVF_ASSERT( view && "Really always should have a valid view pointer in ReservoirViews" ); options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) ); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp index 31ad011bce..801271794c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridStatisticsPlotCollection.cpp @@ -68,7 +68,7 @@ void RimGridStatisticsPlotCollection::addGridStatisticsPlot( RimGridStatisticsPl //-------------------------------------------------------------------------------------------------- std::vector RimGridStatisticsPlotCollection::gridStatisticsPlots() const { - return m_gridStatisticsPlots.childObjects(); + return m_gridStatisticsPlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -76,5 +76,5 @@ std::vector RimGridStatisticsPlotCollection::gridStatist //-------------------------------------------------------------------------------------------------- void RimGridStatisticsPlotCollection::deleteAllPlots() { - m_gridStatisticsPlots.deleteAllChildObjects(); + m_gridStatisticsPlots.deleteChildren(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimGridView.cpp b/ApplicationLibCode/ProjectDataModel/RimGridView.cpp index 8f51d95cb9..3301ded5e8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridView.cpp @@ -299,7 +299,7 @@ void RimGridView::replaceCellFilterCollectionWithOverride() // Must call removeChildObject() to make sure the object has no parent // No parent is required when assigning a object into a field - m_overrideCellFilterCollection.removeChildObject( overrideRfc ); + m_overrideCellFilterCollection.removeChild( overrideRfc ); m_cellFilterCollection = overrideRfc; diff --git a/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp b/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp index 800d2b53c0..63836de8b0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimIdenticalGridCaseGroup.cpp @@ -140,7 +140,7 @@ void RimIdenticalGridCaseGroup::removeCase( RimEclipseCase* reservoir ) return; } - caseCollection()->reservoirs().removeChildObject( reservoir ); + caseCollection()->reservoirs().removeChild( reservoir ); if ( caseCollection()->reservoirs().size() == 0 ) { @@ -244,9 +244,7 @@ void RimIdenticalGridCaseGroup::loadMainCaseAndActiveCellInfo() computeUnionOfActiveCells(); } - RigCaseCellResultsData::copyResultsMetaDataFromMainCase( rigCaseData, - poroModel, - caseCollection->reservoirs.childObjects() ); + RigCaseCellResultsData::copyResultsMetaDataFromMainCase( rigCaseData, poroModel, caseCollection->reservoirs.children() ); // "Load" the statistical cases diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 48c47c656f..03dadeba68 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -89,7 +89,7 @@ RimMultiPlot::~RimMultiPlot() m_isValid = false; removeMdiWindowFromMdiArea(); - m_plots.deleteAllChildObjects(); + m_plots.deleteChildren(); cleanupBeforeClose(); } @@ -102,8 +102,8 @@ RimMultiPlot& RimMultiPlot::operator=( RimMultiPlot&& rhs ) RimPlotWindow::operator=( std::move( rhs ) ); // Move all tracks - std::vector plots = rhs.m_plots.childObjects(); - rhs.m_plots.clear(); + std::vector plots = rhs.m_plots.children(); + rhs.m_plots.clearWithoutDelete(); for ( RimPlot* plot : plots ) { m_plots.push_back( plot ); @@ -218,7 +218,7 @@ void RimMultiPlot::removePlot( RimPlot* plot ) { m_viewer->removePlot( plot->plotWidget() ); } - m_plots.removeChildObject( plot ); + m_plots.removeChild( plot ); onPlotAdditionOrRemoval(); } @@ -235,7 +235,7 @@ void RimMultiPlot::removePlotNoUpdate( RimPlot* plot ) { m_viewer->removePlotNoUpdate( plot->plotWidget() ); } - m_plots.removeChildObject( plot ); + m_plots.removeChild( plot ); } } @@ -295,7 +295,7 @@ void RimMultiPlot::deleteAllPlots() } } - m_plots.deleteAllChildObjects(); + m_plots.deleteChildren(); onPlotAdditionOrRemoval(); } @@ -320,7 +320,7 @@ size_t RimMultiPlot::plotIndex( const RimPlot* plot ) const //-------------------------------------------------------------------------------------------------- std::vector RimMultiPlot::plots() const { - return m_plots.childObjects(); + return m_plots.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp index 8346816a65..02cf7e86ff 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlotCollection.cpp @@ -48,7 +48,7 @@ RimMultiPlotCollection::~RimMultiPlotCollection() //-------------------------------------------------------------------------------------------------- void RimMultiPlotCollection::deleteAllPlots() { - m_multiPlots.deleteAllChildObjects(); + m_multiPlots.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -56,7 +56,7 @@ void RimMultiPlotCollection::deleteAllPlots() //-------------------------------------------------------------------------------------------------- std::vector RimMultiPlotCollection::multiPlots() const { - return m_multiPlots.childObjects(); + return m_multiPlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -72,7 +72,7 @@ void RimMultiPlotCollection::addMultiPlot( RimMultiPlot* plot ) //-------------------------------------------------------------------------------------------------- void RimMultiPlotCollection::loadDataAndUpdateAllPlots() { - for ( const auto& p : m_multiPlots.childObjects() ) + for ( const auto& p : m_multiPlots.children() ) p->loadDataAndUpdate(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp index 4d0a3322ce..7b7bc9d88d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp @@ -61,8 +61,8 @@ RimObservedDataCollection::RimObservedDataCollection() //-------------------------------------------------------------------------------------------------- RimObservedDataCollection::~RimObservedDataCollection() { - m_observedDataArray.deleteAllChildObjects(); - m_observedFmuRftArray.deleteAllChildObjects(); + m_observedDataArray.deleteChildren(); + m_observedFmuRftArray.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -70,7 +70,7 @@ RimObservedDataCollection::~RimObservedDataCollection() //-------------------------------------------------------------------------------------------------- void RimObservedDataCollection::removeObservedSummaryData( RimObservedSummaryData* observedData ) { - m_observedDataArray.removeChildObject( observedData ); + m_observedDataArray.removeChild( observedData ); caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); } @@ -79,7 +79,7 @@ void RimObservedDataCollection::removeObservedSummaryData( RimObservedSummaryDat //-------------------------------------------------------------------------------------------------- void RimObservedDataCollection::removeObservedFmuRftData( RimObservedFmuRftData* observedFmuRftData ) { - m_observedFmuRftArray.removeChildObject( observedFmuRftData ); + m_observedFmuRftArray.removeChild( observedFmuRftData ); caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); } @@ -88,7 +88,7 @@ void RimObservedDataCollection::removeObservedFmuRftData( RimObservedFmuRftData* //-------------------------------------------------------------------------------------------------- std::vector RimObservedDataCollection::allObservedSummaryData() const { - return m_observedDataArray.childObjects(); + return m_observedDataArray.children(); } //-------------------------------------------------------------------------------------------------- @@ -96,7 +96,7 @@ std::vector RimObservedDataCollection::allObservedSumma //-------------------------------------------------------------------------------------------------- std::vector RimObservedDataCollection::allObservedFmuRftData() const { - return m_observedFmuRftArray.childObjects(); + return m_observedFmuRftArray.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimOilField.cpp b/ApplicationLibCode/ProjectDataModel/RimOilField.cpp index ad2cba145a..df23c0b9ba 100644 --- a/ApplicationLibCode/ProjectDataModel/RimOilField.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimOilField.cpp @@ -126,7 +126,7 @@ void RimOilField::initAfterRead() RimFractureTemplateCollection* fractureTemplateCollection = m_fractureTemplateCollection_OBSOLETE.value(); if ( !fractureTemplateCollection->fractureTemplates().empty() ) { - m_fractureTemplateCollection_OBSOLETE.removeChildObject( fractureTemplateCollection ); + m_fractureTemplateCollection_OBSOLETE.removeChild( fractureTemplateCollection ); completionTemplateCollection->setFractureTemplateCollection( fractureTemplateCollection ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 26334541fc..d6a20d57f1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -409,7 +409,7 @@ bool RimPlotAxisProperties::isAxisInverted() const //-------------------------------------------------------------------------------------------------- std::vector RimPlotAxisProperties::annotations() const { - return m_annotations.childObjects(); + return m_annotations.children(); } //-------------------------------------------------------------------------------------------------- @@ -425,7 +425,7 @@ void RimPlotAxisProperties::appendAnnotation( RimPlotAxisAnnotation* annotation //-------------------------------------------------------------------------------------------------- void RimPlotAxisProperties::removeAllAnnotations() { - m_annotations.clear(); + m_annotations.clearWithoutDelete(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp index 9c8a1e3b41..b095f8edcc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPltPlotCollection.cpp @@ -50,7 +50,7 @@ RimPltPlotCollection::RimPltPlotCollection() //-------------------------------------------------------------------------------------------------- RimPltPlotCollection::~RimPltPlotCollection() { - m_pltPlots.deleteAllChildObjects(); + m_pltPlots.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -246,7 +246,7 @@ void RimPltPlotCollection::addPlot( gsl::not_null newPlot ) //-------------------------------------------------------------------------------------------------- void RimPltPlotCollection::removePlot( gsl::not_null plot ) { - m_pltPlots.removeChildObject( plot ); + m_pltPlots.removeChild( plot ); updateAllRequiredEditors(); } @@ -255,5 +255,5 @@ void RimPltPlotCollection::removePlot( gsl::not_null plot ) //-------------------------------------------------------------------------------------------------- void RimPltPlotCollection::deleteAllPlots() { - m_pltPlots.deleteAllChildObjects(); + m_pltPlots.deleteChildren(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index af1c343b94..cc5cd25974 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -249,17 +249,17 @@ void RimProject::close() mainPlotCollection()->deleteAllContainedObjects(); } - oilFields.deleteAllChildObjects(); + oilFields.deleteChildren(); oilFields.push_back( new RimOilField ); - casesObsolete.deleteAllChildObjects(); - caseGroupsObsolete.deleteAllChildObjects(); + casesObsolete.deleteChildren(); + caseGroupsObsolete.deleteChildren(); - wellPathImport->regions().deleteAllChildObjects(); + wellPathImport->regions().deleteChildren(); - commandObjects.deleteAllChildObjects(); + commandObjects.deleteChildren(); - multiSnapshotDefinitions.deleteAllChildObjects(); + multiSnapshotDefinitions.deleteChildren(); m_dialogData->clearProjectSpecificData(); @@ -314,7 +314,7 @@ void RimProject::initAfterRead() if ( movedOneRimIdenticalGridCaseGroup ) { - caseGroupsObsolete.clear(); + caseGroupsObsolete.clearWithoutDelete(); } bool movedOneRimCase = false; @@ -331,7 +331,7 @@ void RimProject::initAfterRead() if ( movedOneRimCase ) { - casesObsolete.clear(); + casesObsolete.clearWithoutDelete(); } // Set project pointer to each well path @@ -378,8 +378,8 @@ bool RimProject::writeProjectFile() //-------------------------------------------------------------------------------------------------- void RimProject::setScriptDirectories( const QString& scriptDirectories ) { - scriptCollection->calcScripts().deleteAllChildObjects(); - scriptCollection->subDirectories().deleteAllChildObjects(); + scriptCollection->calcScripts().deleteChildren(); + scriptCollection->subDirectories().deleteChildren(); QStringList pathList = scriptDirectories.split( ';' ); foreach ( QString path, pathList ) diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index aab3fc169c..b6f7beb7ec 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -261,7 +261,7 @@ void RimProject::fieldContentsByType( const caf::PdmObjectHandle* object, std::v } } - field->childObjects( &children ); + field->children( &children ); } for ( const auto& child : children ) diff --git a/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp b/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp index e917bf6aa2..c6adfbe8a6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimReservoirCellResultsStorage.cpp @@ -64,7 +64,7 @@ RimReservoirCellResultsStorage::RimReservoirCellResultsStorage() //-------------------------------------------------------------------------------------------------- RimReservoirCellResultsStorage::~RimReservoirCellResultsStorage() { - m_resultCacheMetaData.deleteAllChildObjects(); + m_resultCacheMetaData.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -77,7 +77,7 @@ RimReservoirCellResultsStorage::~RimReservoirCellResultsStorage() //-------------------------------------------------------------------------------------------------- void RimReservoirCellResultsStorage::setupBeforeSave() { - m_resultCacheMetaData.deleteAllChildObjects(); + m_resultCacheMetaData.deleteChildren(); QString newValidCacheFileName = getValidCacheFileName(); // Delete the storage file diff --git a/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp index b6cb68fc8d..39e9a51bcd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimRftPlotCollection.cpp @@ -50,7 +50,7 @@ RimRftPlotCollection::RimRftPlotCollection() //-------------------------------------------------------------------------------------------------- RimRftPlotCollection::~RimRftPlotCollection() { - m_rftPlots.deleteAllChildObjects(); + m_rftPlots.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -246,7 +246,7 @@ void RimRftPlotCollection::addPlot( gsl::not_null newPlot ) //-------------------------------------------------------------------------------------------------- void RimRftPlotCollection::removePlot( gsl::not_null plot ) { - m_rftPlots.removeChildObject( plot ); + m_rftPlots.removeChild( plot ); updateAllRequiredEditors(); } @@ -255,5 +255,5 @@ void RimRftPlotCollection::removePlot( gsl::not_null plot ) //-------------------------------------------------------------------------------------------------- void RimRftPlotCollection::deleteAllPlots() { - m_rftPlots.deleteAllChildObjects(); + m_rftPlots.deleteChildren(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp index 8ebe37ebb8..f50221705e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp @@ -53,8 +53,8 @@ RimScriptCollection::RimScriptCollection() //-------------------------------------------------------------------------------------------------- RimScriptCollection::~RimScriptCollection() { - calcScripts.deleteAllChildObjects(); - subDirectories.deleteAllChildObjects(); + calcScripts.deleteChildren(); + subDirectories.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -62,7 +62,7 @@ RimScriptCollection::~RimScriptCollection() //-------------------------------------------------------------------------------------------------- void RimScriptCollection::readContentFromDisc() { - calcScripts.deleteAllChildObjects(); + calcScripts.deleteChildren(); if ( directory().isEmpty() ) { @@ -104,7 +104,7 @@ void RimScriptCollection::readContentFromDisc() } } - subDirectories.deleteAllChildObjects(); + subDirectories.deleteChildren(); if ( m_searchSubFolders() ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp index 7a092a03a5..c428dfae2f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSimWellInViewCollection.cpp @@ -245,7 +245,7 @@ RimSimWellInViewCollection::RimSimWellInViewCollection() //-------------------------------------------------------------------------------------------------- RimSimWellInViewCollection::~RimSimWellInViewCollection() { - wells.deleteAllChildObjects(); + wells.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp index ef5c266400..df1592856a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimStimPlanColors.cpp @@ -125,7 +125,7 @@ void RimStimPlanColors::loadDataAndUpdate() for ( auto legend : toBeDeleted ) { - m_legendConfigurations.removeChildObject( legend ); + m_legendConfigurations.removeChild( legend ); delete legend; } diff --git a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp index e0bc93d4cb..8948c55391 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionBand.cpp @@ -79,7 +79,7 @@ RimSurfaceIntersectionBand::RimSurfaceIntersectionBand() //-------------------------------------------------------------------------------------------------- void RimSurfaceIntersectionBand::setSurfaces( RimSurface* surface1, RimSurface* surface2 ) { - m_surfaces.clear(); + m_surfaces.clearWithoutDelete(); m_surfaces.push_back( surface1 ); m_surfaces.push_back( surface2 ); diff --git a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCollection.cpp index 87f2c06d56..259a053e2b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimSurfaceIntersectionCollection.cpp @@ -64,7 +64,7 @@ RimSurfaceIntersectionBand* RimSurfaceIntersectionCollection::addIntersectionBan //-------------------------------------------------------------------------------------------------- std::vector RimSurfaceIntersectionCollection::surfaceIntersectionCurves() const { - return m_intersectionCurves.childObjects(); + return m_intersectionCurves.children(); } //-------------------------------------------------------------------------------------------------- @@ -72,7 +72,7 @@ std::vector RimSurfaceIntersectionCollection::surf //-------------------------------------------------------------------------------------------------- std::vector RimSurfaceIntersectionCollection::surfaceIntersectionBands() const { - return m_intersectionBands.childObjects(); + return m_intersectionBands.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp index ef54a26a9d..ed65791696 100644 --- a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculation.cpp @@ -129,7 +129,7 @@ RimUserDefinedCalculationVariable* RimUserDefinedCalculation::addVariable( const //-------------------------------------------------------------------------------------------------- void RimUserDefinedCalculation::deleteVariable( RimUserDefinedCalculationVariable* calcVariable ) { - m_variables.removeChildObject( calcVariable ); + m_variables.removeChild( calcVariable ); delete calcVariable; } @@ -374,5 +374,5 @@ void RimUserDefinedCalculation::defineEditorAttribute( const caf::PdmFieldHandle //-------------------------------------------------------------------------------------------------- std::vector RimUserDefinedCalculation::allVariables() const { - return m_variables.childObjects(); + return m_variables.children(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp index 13a6c5a189..c22ec8a02d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimUserDefinedCalculationCollection.cpp @@ -103,7 +103,7 @@ RimUserDefinedCalculation* void RimUserDefinedCalculationCollection::deleteCalculation( RimUserDefinedCalculation* calculation ) { calculation->removeDependentObjects(); - m_calculations.removeChildObject( calculation ); + m_calculations.removeChild( calculation ); rebuildCaseMetaData(); @@ -115,7 +115,7 @@ void RimUserDefinedCalculationCollection::deleteCalculation( RimUserDefinedCalcu //-------------------------------------------------------------------------------------------------- std::vector RimUserDefinedCalculationCollection::calculations() const { - return m_calculations.childObjects(); + return m_calculations.children(); } //-------------------------------------------------------------------------------------------------- @@ -139,7 +139,7 @@ RimUserDefinedCalculation* RimUserDefinedCalculationCollection::findCalculationB //-------------------------------------------------------------------------------------------------- void RimUserDefinedCalculationCollection::deleteAllContainedObjects() { - m_calculations.deleteAllChildObjects(); + m_calculations.deleteChildren(); rebuildCaseMetaData(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp index 572872bf9e..fbfe6757c6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.cpp @@ -70,15 +70,15 @@ void RimVfpPlotCollection::insertPlot( RimVfpPlot* vfpPlot, size_t index ) //-------------------------------------------------------------------------------------------------- std::vector RimVfpPlotCollection::plots() const { - return m_vfpPlots.childObjects(); + return m_vfpPlots.children(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimVfpPlotCollection::deleteAllChildObjects() +void RimVfpPlotCollection::deleteChildren() { - m_vfpPlots.deleteAllChildObjects(); + m_vfpPlots.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -94,6 +94,6 @@ size_t RimVfpPlotCollection::plotCount() const //-------------------------------------------------------------------------------------------------- void RimVfpPlotCollection::removePlot( RimVfpPlot* vfpPlot ) { - m_vfpPlots.removeChildObject( vfpPlot ); + m_vfpPlots.removeChild( vfpPlot ); updateAllRequiredEditors(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.h b/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.h index 9ea6ebfb4f..b8dda7b337 100644 --- a/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimVfpPlotCollection.h @@ -37,7 +37,7 @@ class RimVfpPlotCollection : public caf::PdmObject, public RimTypedPlotCollectio void addPlot( RimVfpPlot* newPlot ) override; std::vector plots() const override; - void deleteAllChildObjects(); + void deleteChildren(); size_t plotCount() const final; void insertPlot( RimVfpPlot* vfpPlot, size_t index ) final; diff --git a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp index f53b725bc4..dc31bc5b50 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp @@ -84,7 +84,7 @@ RimViewLinker::~RimViewLinker() { removeOverrides(); - m_viewControllers.deleteAllChildObjects(); + m_viewControllers.deleteChildren(); RimGridView* masterView = m_masterView; m_masterView = nullptr; if ( masterView ) masterView->updateAutoName(); @@ -313,7 +313,7 @@ void RimViewLinker::setMasterView( RimGridView* view ) if ( previousViewController ) { delete previousViewController; - this->m_viewControllers.removeChildObject( nullptr ); + this->m_viewControllers.removeChild( nullptr ); } this->removeOverrides(); @@ -673,7 +673,7 @@ void RimViewLinker::updatePropertyFilters( RimPropertyFilter* changedPropertyFil //-------------------------------------------------------------------------------------------------- void RimViewLinker::removeViewController( RimViewController* viewController ) { - m_viewControllers.removeChildObject( viewController ); + m_viewControllers.removeChild( viewController ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp index 43747d7eeb..0374784fc5 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimElasticPropertyScalingCollection.cpp @@ -43,7 +43,7 @@ RimElasticPropertyScalingCollection::RimElasticPropertyScalingCollection() //-------------------------------------------------------------------------------------------------- RimElasticPropertyScalingCollection::~RimElasticPropertyScalingCollection() { - m_elasticPropertyScalings.deleteAllChildObjects(); + m_elasticPropertyScalings.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp index 475987b080..b2af83afab 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimPressureTable.cpp @@ -56,7 +56,7 @@ RimPressureTable::~RimPressureTable() //-------------------------------------------------------------------------------------------------- std::vector RimPressureTable::items() const { - std::vector pressureTableItems = m_pressureTableItems.childObjects(); + std::vector pressureTableItems = m_pressureTableItems.children(); // Sort by depth std::sort( pressureTableItems.begin(), pressureTableItems.end(), []( auto const& a, auto const& b ) { @@ -86,7 +86,7 @@ void RimPressureTable::insertItem( RimPressureTableItem* insertBefore, RimPressu //-------------------------------------------------------------------------------------------------- void RimPressureTable::deleteItem( RimPressureTableItem* itemToDelete ) { - m_pressureTableItems.removeChildObject( itemToDelete ); + m_pressureTableItems.removeChild( itemToDelete ); delete itemToDelete; onTableChanged(); } @@ -96,7 +96,7 @@ void RimPressureTable::deleteItem( RimPressureTableItem* itemToDelete ) //-------------------------------------------------------------------------------------------------- void RimPressureTable::deleteAllItems() { - m_pressureTableItems.deleteAllChildObjects(); + m_pressureTableItems.deleteChildren(); onTableChanged(); } diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCollection.cpp index 742bfdf81b..0411185e9f 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelCollection.cpp @@ -69,7 +69,7 @@ void RimStimPlanModelCollection::addStimPlanModel( RimStimPlanModel* fracture ) //-------------------------------------------------------------------------------------------------- void RimStimPlanModelCollection::deleteStimPlanModels() { - m_stimPlanModels.deleteAllChildObjects(); + m_stimPlanModels.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -77,7 +77,7 @@ void RimStimPlanModelCollection::deleteStimPlanModels() //-------------------------------------------------------------------------------------------------- std::vector RimStimPlanModelCollection::allStimPlanModels() const { - return m_stimPlanModels.childObjects(); + return m_stimPlanModels.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp index 4819a52729..a8803038bf 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelPlotCollection.cpp @@ -41,7 +41,7 @@ RimStimPlanModelPlotCollection::RimStimPlanModelPlotCollection() //-------------------------------------------------------------------------------------------------- RimStimPlanModelPlotCollection::~RimStimPlanModelPlotCollection() { - m_stimPlanModelPlots.deleteAllChildObjects(); + m_stimPlanModelPlots.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -76,7 +76,7 @@ void RimStimPlanModelPlotCollection::addStimPlanModelPlot( RimStimPlanModelPlot* //-------------------------------------------------------------------------------------------------- std::vector RimStimPlanModelPlotCollection::stimPlanModelPlots() const { - return m_stimPlanModelPlots.childObjects(); + return m_stimPlanModelPlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -84,5 +84,5 @@ std::vector RimStimPlanModelPlotCollection::stimPlanModel //-------------------------------------------------------------------------------------------------- void RimStimPlanModelPlotCollection::deleteAllPlots() { - m_stimPlanModelPlots.deleteAllChildObjects(); + m_stimPlanModelPlots.deleteChildren(); } diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp index 291caf0a6e..8f220d694d 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplate.cpp @@ -511,7 +511,7 @@ void RimStimPlanModelTemplate::initAfterRead() m_faciesProperties->setEclipseCase( eclipseCase ); } - for ( auto& fipConfig : m_faciesInitialPressureConfigs.childObjects() ) + for ( auto& fipConfig : m_faciesInitialPressureConfigs.children() ) { fipConfig->changed.connect( this, &RimStimPlanModelTemplate::faciesPropertiesChanged ); } @@ -837,7 +837,7 @@ RimEclipseCase* RimStimPlanModelTemplate::initialPressureEclipseCase() const std::map RimStimPlanModelTemplate::faciesWithInitialPressure() const { std::map valueFractionMap; - for ( const RimFaciesInitialPressureConfig* c : m_faciesInitialPressureConfigs.childObjects() ) + for ( const RimFaciesInitialPressureConfig* c : m_faciesInitialPressureConfigs.children() ) { if ( c->isEnabled() ) valueFractionMap[c->faciesValue()] = c->fraction(); } diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp index c50c4e09cb..b695e5f0d0 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModelTemplateCollection.cpp @@ -50,7 +50,7 @@ RimStimPlanModelTemplateCollection::RimStimPlanModelTemplateCollection() //-------------------------------------------------------------------------------------------------- RimStimPlanModelTemplateCollection::~RimStimPlanModelTemplateCollection() { - m_stimPlanModelTemplates.deleteAllChildObjects(); + m_stimPlanModelTemplates.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp index ec85c72e97..27d6f00861 100644 --- a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp @@ -441,7 +441,7 @@ void RimStreamlineInViewCollection::updateStreamlines() if ( m_shouldGenerateTracers && isActive() ) { // reset generated streamlines - m_streamlines().clear(); + m_streamlines().clearWithoutDelete(); m_wellCellIds.clear(); // get current simulation timestep diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp index 7d778e8433..0651f57040 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp @@ -238,7 +238,7 @@ std::vector RimEnsembleCurveFilter::summaryAddresses() //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveFilter::setSummaryAddresses( std::vector addresses ) { - m_objectiveValuesSummaryAddresses.clear(); + m_objectiveValuesSummaryAddresses.clearWithoutDelete(); for ( auto address : addresses ) { RimSummaryAddress* summaryAddress = new RimSummaryAddress(); @@ -384,7 +384,7 @@ void RimEnsembleCurveFilter::fieldChangedByUi( const caf::PdmFieldHandle* change RimSummaryCaseCollection* candidateEnsemble = parentCurveSet()->summaryCaseCollection(); std::vector candidateAddresses; - for ( auto address : m_objectiveValuesSummaryAddresses().childObjects() ) + for ( auto address : m_objectiveValuesSummaryAddresses().children() ) { candidateAddresses.push_back( address->address() ); } @@ -396,7 +396,7 @@ void RimEnsembleCurveFilter::fieldChangedByUi( const caf::PdmFieldHandle* change auto curveSelection = dlg.curveSelection(); if ( !curveSelection.empty() ) { - m_objectiveValuesSummaryAddresses.clear(); + m_objectiveValuesSummaryAddresses.clearWithoutDelete(); for ( auto address : curveSelection ) { RimSummaryAddress* summaryAddress = new RimSummaryAddress(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp index 9c5feb6a22..d62229c6c6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilterCollection.cpp @@ -67,7 +67,7 @@ RimEnsembleCurveFilter* RimEnsembleCurveFilterCollection::addFilter( const QStri //-------------------------------------------------------------------------------------------------- std::vector RimEnsembleCurveFilterCollection::filters() const { - return m_filters.childObjects(); + return m_filters.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 9db5ad7871..94424bd1e7 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -222,7 +222,7 @@ RimEnsembleCurveSet::RimEnsembleCurveSet() //-------------------------------------------------------------------------------------------------- RimEnsembleCurveSet::~RimEnsembleCurveSet() { - m_curves.deleteAllChildObjects(); + m_curves.deleteChildren(); RimSummaryPlot* parentPlot; firstAncestorOrThisOfType( parentPlot ); @@ -373,7 +373,7 @@ void RimEnsembleCurveSet::deleteCurve( RimSummaryCurve* curve ) { if ( curve ) { - m_curves.removeChildObject( curve ); + m_curves.removeChild( curve ); delete curve; } } @@ -402,7 +402,7 @@ RifEclipseSummaryAddress RimEnsembleCurveSet::summaryAddress() const //-------------------------------------------------------------------------------------------------- std::vector RimEnsembleCurveSet::curves() const { - return m_curves.childObjects(); + return m_curves.children(); } //-------------------------------------------------------------------------------------------------- @@ -808,7 +808,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi RimSummaryCaseCollection* candidateEnsemble = m_yValuesSummaryCaseCollection(); std::vector candidateAddresses; - for ( auto address : m_objectiveValuesSummaryAddresses().childObjects() ) + for ( auto address : m_objectiveValuesSummaryAddresses().children() ) { candidateAddresses.push_back( address->address() ); } @@ -820,7 +820,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi auto curveSelection = dlg.curveSelection(); if ( !curveSelection.empty() ) { - m_objectiveValuesSummaryAddresses.clear(); + m_objectiveValuesSummaryAddresses.clearWithoutDelete(); for ( auto address : curveSelection ) { RimSummaryAddress* summaryAddress = new RimSummaryAddress(); @@ -1385,7 +1385,7 @@ void RimEnsembleCurveSet::updateObjectiveFunctionLegend() if ( m_colorMode() == ColorMode::BY_OBJECTIVE_FUNCTION ) { std::vector addresses; - for ( auto address : m_objectiveValuesSummaryAddresses().childObjects() ) + for ( auto address : m_objectiveValuesSummaryAddresses().children() ) { addresses.push_back( address->address() ); } @@ -1398,7 +1398,7 @@ void RimEnsembleCurveSet::updateObjectiveFunctionLegend() else if ( m_colorMode() == ColorMode::BY_CUSTOM_OBJECTIVE_FUNCTION && m_customObjectiveFunction() ) { std::vector addresses; - for ( auto address : m_objectiveValuesSummaryAddresses().childObjects() ) + for ( auto address : m_objectiveValuesSummaryAddresses().children() ) { addresses.push_back( address->address() ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp index 3e57f0fbae..065f6ae460 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp @@ -60,7 +60,7 @@ RimEnsembleCurveSetCollection::RimEnsembleCurveSetCollection() //-------------------------------------------------------------------------------------------------- RimEnsembleCurveSetCollection::~RimEnsembleCurveSetCollection() { - m_curveSets.deleteAllChildObjects(); + m_curveSets.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -196,7 +196,7 @@ void RimEnsembleCurveSetCollection::deleteCurveSets( const std::vector RimEnsembleCurveSetCollection::curveSets() const { - return m_curveSets.childObjects(); + return m_curveSets.children(); } //-------------------------------------------------------------------------------------------------- @@ -302,7 +302,7 @@ RimSummaryPlotSourceStepping* RimEnsembleCurveSetCollection::sourceSteppingObjec //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveSetCollection::deleteAllCurveSets() { - m_curveSets.deleteAllChildObjects(); + m_curveSets.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index b57801156b..8389d5f766 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -333,10 +333,10 @@ RimSummaryAddressCollection* RimSummaryAddressCollection::getOrCreateSubfolder( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryAddressCollection::deleteAllChildObjects() +void RimSummaryAddressCollection::deleteChildren() { - m_adresses.deleteAllChildObjects(); - m_subfolders.deleteAllChildObjects(); + m_adresses.deleteChildren(); + m_subfolders.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -444,7 +444,7 @@ int RimSummaryAddressCollection::ensembleId() const //-------------------------------------------------------------------------------------------------- std::vector RimSummaryAddressCollection::subFolders() const { - return m_subfolders.childObjects(); + return m_subfolders.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h index 62f4f107bd..168131f088 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.h @@ -64,7 +64,7 @@ class RimSummaryAddressCollection : public RimNamedObject void updateFolderStructure( const std::set& addresses, int caseId, int ensembleId = -1 ); - void deleteAllChildObjects(); + void deleteChildren(); bool isEmpty() const; bool isEnsemble() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp index d6d284206a..882a16c6f4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCase.cpp @@ -239,7 +239,7 @@ QString RimSummaryCase::errorMessagesFromReader() //-------------------------------------------------------------------------------------------------- void RimSummaryCase::buildChildNodes() { - m_dataVectorFolders->deleteAllChildObjects(); + m_dataVectorFolders->deleteChildren(); RifSummaryReaderInterface* reader = summaryReader(); if ( !reader ) return; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index f72529846c..0be851e734 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -144,7 +144,7 @@ RimSummaryCaseCollection::RimSummaryCaseCollection() //-------------------------------------------------------------------------------------------------- RimSummaryCaseCollection::~RimSummaryCaseCollection() { - m_cases.deleteAllChildObjectsAsync(); + m_cases.deleteChildrenAsync(); updateReferringCurveSets(); } @@ -155,7 +155,7 @@ void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase, bool not { size_t caseCountBeforeRemove = m_cases.size(); - m_cases.removeChildObject( summaryCase ); + m_cases.removeChild( summaryCase ); m_cachedSortedEnsembleParameters.clear(); @@ -212,7 +212,7 @@ void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase ) //-------------------------------------------------------------------------------------------------- std::vector RimSummaryCaseCollection::allSummaryCases() const { - return m_cases.childObjects(); + return m_cases.children(); } //-------------------------------------------------------------------------------------------------- @@ -1098,5 +1098,5 @@ void RimSummaryCaseCollection::refreshMetaData() //-------------------------------------------------------------------------------------------------- void RimSummaryCaseCollection::clearChildNodes() { - m_dataVectorFolders->deleteAllChildObjects(); + m_dataVectorFolders->deleteChildren(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp index 76b561e14e..99ed50a838 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseMainCollection.cpp @@ -110,8 +110,8 @@ RimSummaryCaseMainCollection::RimSummaryCaseMainCollection() //-------------------------------------------------------------------------------------------------- RimSummaryCaseMainCollection::~RimSummaryCaseMainCollection() { - m_cases.deleteAllChildObjectsAsync(); - m_caseCollections.deleteAllChildObjectsAsync(); + m_cases.deleteChildrenAsync(); + m_caseCollections.deleteChildrenAsync(); } //-------------------------------------------------------------------------------------------------- @@ -260,7 +260,7 @@ void RimSummaryCaseMainCollection::removeCase( RimSummaryCase* summaryCase, bool } } - m_cases.removeChildObject( summaryCase ); + m_cases.removeChild( summaryCase ); for ( RimSummaryCaseCollection* summaryCaseCollection : m_caseCollections ) { @@ -323,7 +323,7 @@ RimSummaryCaseCollection* } else { - m_cases.removeChildObject( summaryCase ); + m_cases.removeChild( summaryCase ); } summaryCaseCollection->addCase( summaryCase ); @@ -348,7 +348,7 @@ RimSummaryCaseCollection* //-------------------------------------------------------------------------------------------------- void RimSummaryCaseMainCollection::removeCaseCollection( RimSummaryCaseCollection* caseCollection ) { - m_caseCollections.removeChildObject( caseCollection ); + m_caseCollections.removeChild( caseCollection ); dataSourceHasChanged.send(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp index 78735662aa..4b4baa23b9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp @@ -50,7 +50,7 @@ RimSummaryCrossPlotCollection::~RimSummaryCrossPlotCollection() //-------------------------------------------------------------------------------------------------- void RimSummaryCrossPlotCollection::deleteAllPlots() { - m_summaryCrossPlots.deleteAllChildObjects(); + m_summaryCrossPlots.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -58,7 +58,7 @@ void RimSummaryCrossPlotCollection::deleteAllPlots() //-------------------------------------------------------------------------------------------------- std::vector RimSummaryCrossPlotCollection::plots() const { - return m_summaryCrossPlots.childObjects(); + return m_summaryCrossPlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -107,7 +107,7 @@ void RimSummaryCrossPlotCollection::insertPlot( RimSummaryPlot* plot, size_t ind //-------------------------------------------------------------------------------------------------- void RimSummaryCrossPlotCollection::removePlot( RimSummaryPlot* plot ) { - m_summaryCrossPlots.removeChildObject( plot ); + m_summaryCrossPlots.removeChild( plot ); updateAllRequiredEditors(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp index 0d81461539..553c045716 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveCollection.cpp @@ -91,7 +91,7 @@ RimSummaryCurveCollection::RimSummaryCurveCollection() //-------------------------------------------------------------------------------------------------- RimSummaryCurveCollection::~RimSummaryCurveCollection() { - m_curves.deleteAllChildObjects(); + m_curves.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -244,7 +244,7 @@ void RimSummaryCurveCollection::removeCurve( RimSummaryCurve* curve ) { if ( curve ) { - m_curves.removeChildObject( curve ); + m_curves.removeChild( curve ); } } @@ -253,7 +253,7 @@ void RimSummaryCurveCollection::removeCurve( RimSummaryCurve* curve ) //-------------------------------------------------------------------------------------------------- std::vector RimSummaryCurveCollection::curves() const { - return m_curves.childObjects(); + return m_curves.children(); } //-------------------------------------------------------------------------------------------------- @@ -342,7 +342,7 @@ void RimSummaryCurveCollection::deleteCurvesAssosiatedWithCase( RimSummaryCase* } for ( RimSummaryCurve* summaryCurve : summaryCurvesToDelete ) { - m_curves.removeChildObject( summaryCurve ); + m_curves.removeChild( summaryCurve ); delete summaryCurve; } } @@ -352,7 +352,7 @@ void RimSummaryCurveCollection::deleteCurvesAssosiatedWithCase( RimSummaryCase* //-------------------------------------------------------------------------------------------------- void RimSummaryCurveCollection::deleteAllCurves() { - m_curves.deleteAllChildObjects(); + m_curves.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp index e84f5582de..e4cc52336d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -63,7 +63,7 @@ void RimSummaryMultiPlotCollection::initAfterRead() //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlotCollection::deleteAllPlots() { - m_summaryMultiPlots.deleteAllChildObjects(); + m_summaryMultiPlots.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -71,7 +71,7 @@ void RimSummaryMultiPlotCollection::deleteAllPlots() //-------------------------------------------------------------------------------------------------- std::vector RimSummaryMultiPlotCollection::multiPlots() const { - return m_summaryMultiPlots.childObjects(); + return m_summaryMultiPlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -88,7 +88,7 @@ void RimSummaryMultiPlotCollection::addSummaryMultiPlot( RimSummaryMultiPlot* pl //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlotCollection::loadDataAndUpdateAllPlots() { - for ( const auto& p : m_summaryMultiPlots.childObjects() ) + for ( const auto& p : m_summaryMultiPlots.children() ) p->loadDataAndUpdate(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index adb0313a95..86321c182a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -328,8 +328,8 @@ QString RimSummaryPlot::asciiDataForSummaryPlotExport( RiaDefines::DateTimePerio std::vector curves; this->descendantsIncludingThisOfType( curves ); - auto gridCurves = m_gridTimeHistoryCurves.childObjects(); - auto asciiCurves = m_asciiDataCurves.childObjects(); + auto gridCurves = m_gridTimeHistoryCurves.children(); + auto asciiCurves = m_asciiDataCurves.children(); QString text = RimSummaryCurvesData::createTextForExport( curves, asciiCurves, gridCurves, resamplingPeriod, showTimeAsLongString ); @@ -1344,7 +1344,7 @@ void RimSummaryPlot::addGridTimeHistoryCurveNoUpdate( RimGridTimeHistoryCurve* c //-------------------------------------------------------------------------------------------------- std::vector RimSummaryPlot::gridTimeHistoryCurves() const { - return m_gridTimeHistoryCurves.childObjects(); + return m_gridTimeHistoryCurves.children(); } //-------------------------------------------------------------------------------------------------- @@ -1859,7 +1859,7 @@ void RimSummaryPlot::axisPositionChanged( const caf::SignalEmitter* emitter, if ( oldPlotAxis != RiuPlotAxis::defaultLeft() && oldPlotAxis != RiuPlotAxis::defaultRight() ) { auto oldAxisProperties = axisPropertiesForPlotAxis( oldPlotAxis ); - if ( oldAxisProperties ) m_axisProperties.removeChildObject( oldAxisProperties ); + if ( oldAxisProperties ) m_axisProperties.removeChild( oldAxisProperties ); plotWidget()->moveAxis( oldPlotAxis, newPlotAxis ); } @@ -1875,7 +1875,7 @@ void RimSummaryPlot::axisPositionChanged( const caf::SignalEmitter* emitter, //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::deleteAllGridTimeHistoryCurves() { - m_gridTimeHistoryCurves.deleteAllChildObjects(); + m_gridTimeHistoryCurves.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp index 849f07dc67..b0f48e2e33 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp @@ -120,7 +120,7 @@ void RimSummaryPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* //-------------------------------------------------------------------------------------------------- std::vector RimSummaryPlotCollection::plots() const { - return m_summaryPlots.childObjects(); + return m_summaryPlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -144,6 +144,6 @@ void RimSummaryPlotCollection::insertPlot( RimSummaryPlot* summaryPlot, size_t i //-------------------------------------------------------------------------------------------------- void RimSummaryPlotCollection::removePlot( RimSummaryPlot* summaryPlot ) { - m_summaryPlots.removeChildObject( summaryPlot ); + m_summaryPlots.removeChild( summaryPlot ); updateAllRequiredEditors(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp index 0b5b99c420..a787a8a2a1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp @@ -176,7 +176,7 @@ void RimSummaryPlotFilterTextCurveSetEditor::updateTextFilter() if ( !usedSources.empty() ) { - m_selectedSources.clear(); + m_selectedSources.clearWithoutDelete(); m_selectedSources.setValue( usedSources ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index 8b9cda5a31..2217239aaa 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -516,7 +516,7 @@ RiaDefines::TimeFormatComponents RimSummaryTimeAxisProperties::timeComponents( R //-------------------------------------------------------------------------------------------------- std::vector RimSummaryTimeAxisProperties::annotations() const { - return m_annotations.childObjects(); + return m_annotations.children(); } //-------------------------------------------------------------------------------------------------- @@ -532,7 +532,7 @@ void RimSummaryTimeAxisProperties::appendAnnotation( RimPlotAxisAnnotation* anno //-------------------------------------------------------------------------------------------------- void RimSummaryTimeAxisProperties::removeAllAnnotations() { - m_annotations.clear(); + m_annotations.clearWithoutDelete(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp index 252604cc72..c94cbf2d31 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceCollection.cpp @@ -269,7 +269,7 @@ RimSurface* RimSurfaceCollection::addGridCaseSurface( RimCase* sourceCase, int o //-------------------------------------------------------------------------------------------------- std::vector RimSurfaceCollection::surfaces() const { - return m_surfaces.childObjects(); + return m_surfaces.children(); } //-------------------------------------------------------------------------------------------------- @@ -277,7 +277,7 @@ std::vector RimSurfaceCollection::surfaces() const //-------------------------------------------------------------------------------------------------- std::vector RimSurfaceCollection::subCollections() const { - return m_subCollections.childObjects(); + return m_subCollections.children(); } //-------------------------------------------------------------------------------------------------- @@ -392,7 +392,7 @@ void RimSurfaceCollection::orderChanged( const caf::SignalEmitter* emitter ) //-------------------------------------------------------------------------------------------------- void RimSurfaceCollection::removeSurface( RimSurface* surface ) { - m_surfaces.removeChildObject( surface ); + m_surfaces.removeChild( surface ); } //-------------------------------------------------------------------------------------------------- @@ -466,7 +466,7 @@ RimSurface* RimSurfaceCollection::addSurfacesAtIndex( int position, std::vector< } // reset the surface collection and use the new order - m_surfaces.clear(); + m_surfaces.clearWithoutDelete(); for ( auto surf : orderedSurfs ) { m_surfaces.push_back( surf ); diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp index aca225d2f2..7107800e88 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimSurfaceInViewCollection.cpp @@ -137,13 +137,13 @@ void RimSurfaceInViewCollection::updateAllViewItems() void RimSurfaceInViewCollection::syncCollectionsWithView() { // check that we have surface in view collections for all sub-collections - std::vector colls = m_collectionsInView.childObjects(); + std::vector colls = m_collectionsInView.children(); for ( auto surfcoll : colls ) { if ( !surfcoll->surfaceCollection() ) { - m_collectionsInView.removeChildObject( surfcoll ); + m_collectionsInView.removeChild( surfcoll ); delete surfcoll; } } @@ -172,7 +172,7 @@ void RimSurfaceInViewCollection::syncCollectionsWithView() } // make sure our view surfaces have the same order as the source surface collection - m_collectionsInView.clear(); + m_collectionsInView.clearWithoutDelete(); for ( auto viewColl : orderedColls ) { m_collectionsInView.push_back( viewColl ); @@ -188,13 +188,13 @@ void RimSurfaceInViewCollection::syncSurfacesWithView() { // Delete surfaceInView without any real Surface connection - std::vector surfsInView = m_surfacesInView.childObjects(); + std::vector surfsInView = m_surfacesInView.children(); for ( auto surf : surfsInView ) { if ( !surf->surface() ) { - m_surfacesInView.removeChildObject( surf ); + m_surfacesInView.removeChild( surf ); delete surf; } } @@ -229,7 +229,7 @@ void RimSurfaceInViewCollection::syncSurfacesWithView() } // make sure our view surfaces have the same order as the source surface collection - m_surfacesInView.clear(); + m_surfacesInView.clearWithoutDelete(); for ( auto viewSurf : orderedSurfs ) { m_surfacesInView.push_back( viewSurf ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogs.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogs.cpp index 6601de125f..00651b2bb3 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogs.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogs.cpp @@ -43,7 +43,7 @@ RimEnsembleWellLogs::RimEnsembleWellLogs() //-------------------------------------------------------------------------------------------------- void RimEnsembleWellLogs::removeWellLogFile( RimWellLogFile* summaryCase ) { - m_wellLogFiles.removeChildObject( summaryCase ); + m_wellLogFiles.removeChild( summaryCase ); } //-------------------------------------------------------------------------------------------------- @@ -59,7 +59,7 @@ void RimEnsembleWellLogs::addWellLogFile( RimWellLogFile* summaryCase ) //-------------------------------------------------------------------------------------------------- std::vector RimEnsembleWellLogs::wellLogFiles() const { - return m_wellLogFiles().childObjects(); + return m_wellLogFiles().children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp index 8f3c319a91..88eebd918a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimEnsembleWellLogsCollection.cpp @@ -40,7 +40,7 @@ RimEnsembleWellLogsCollection::RimEnsembleWellLogsCollection() //-------------------------------------------------------------------------------------------------- RimEnsembleWellLogsCollection::~RimEnsembleWellLogsCollection() { - m_ensembleWellLogs.deleteAllChildObjects(); + m_ensembleWellLogs.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp index 590e82af9b..cea36412cd 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp @@ -101,7 +101,7 @@ RimWellLogFile::RimWellLogFile() //-------------------------------------------------------------------------------------------------- RimWellLogFile::~RimWellLogFile() { - m_wellLogChannelNames.deleteAllChildObjects(); + m_wellLogChannelNames.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -172,7 +172,7 @@ bool RimWellLogFile::readFile( QString* errorMessage ) m_date = DEFAULT_DATE_TIME; } - m_wellLogChannelNames.deleteAllChildObjects(); + m_wellLogChannelNames.deleteChildren(); QStringList wellLogNames = m_wellLogDataFile->wellLogChannelNames(); for ( int logIdx = 0; logIdx < wellLogNames.size(); logIdx++ ) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp index 7d1390642a..15ad522aaf 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp @@ -147,7 +147,7 @@ RigGeoMechWellLogExtractor* RimWellLogPlotCollection::findOrCreateExtractor( Rim //-------------------------------------------------------------------------------------------------- std::vector RimWellLogPlotCollection::wellLogPlots() const { - return m_wellLogPlots.childObjects(); + return m_wellLogPlots.children(); } //-------------------------------------------------------------------------------------------------- @@ -163,7 +163,7 @@ void RimWellLogPlotCollection::addWellLogPlot( gsl::not_null we //-------------------------------------------------------------------------------------------------- void RimWellLogPlotCollection::deleteAllPlots() { - m_wellLogPlots.deleteAllChildObjects(); + m_wellLogPlots.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -171,7 +171,7 @@ void RimWellLogPlotCollection::deleteAllPlots() //-------------------------------------------------------------------------------------------------- void RimWellLogPlotCollection::removePlot( gsl::not_null plot ) { - m_wellLogPlots.removeChildObject( plot ); + m_wellLogPlots.removeChild( plot ); updateAllRequiredEditors(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 38645637ee..c9af9f159c 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -286,7 +286,7 @@ RimWellLogTrack::RimWellLogTrack() //-------------------------------------------------------------------------------------------------- RimWellLogTrack::~RimWellLogTrack() { - m_curves.deleteAllChildObjects(); + m_curves.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -1172,7 +1172,7 @@ void RimWellLogTrack::removeCurve( RimWellLogCurve* curve ) if ( index < m_curves.size() ) { m_curves[index]->detach(); - m_curves.removeChildObject( curve ); + m_curves.removeChild( curve ); } } @@ -1181,7 +1181,7 @@ void RimWellLogTrack::removeCurve( RimWellLogCurve* curve ) //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::deleteAllCurves() { - m_curves.deleteAllChildObjects(); + m_curves.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -2282,7 +2282,7 @@ std::map> RimWellLogTrack::visibleStackedCurv //-------------------------------------------------------------------------------------------------- std::vector RimWellLogTrack::curves() const { - return m_curves.childObjects(); + return m_curves.children(); } //-------------------------------------------------------------------------------------------------- @@ -2292,7 +2292,7 @@ std::vector RimWellLogTrack::visibleCurves() const { std::vector curvesVector; - for ( RimWellLogCurve* curve : m_curves.childObjects() ) + for ( RimWellLogCurve* curve : m_curves.children() ) { if ( curve->isCurveVisible() ) { diff --git a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp index 92a0a2e96e..01c1c411b8 100644 --- a/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellMeasurement/RimWellMeasurementCollection.cpp @@ -154,7 +154,7 @@ void RimWellMeasurementCollection::appendMeasurement( RimWellMeasurement* measur //-------------------------------------------------------------------------------------------------- void RimWellMeasurementCollection::deleteMeasurement( RimWellMeasurement* measurementToDelete ) { - m_measurements.removeChildObject( measurementToDelete ); + m_measurements.removeChild( measurementToDelete ); delete measurementToDelete; this->updateAllCurves(); @@ -165,7 +165,7 @@ void RimWellMeasurementCollection::deleteMeasurement( RimWellMeasurement* measur //-------------------------------------------------------------------------------------------------- void RimWellMeasurementCollection::deleteAllMeasurements() { - m_measurements.deleteAllChildObjects(); + m_measurements.deleteChildren(); this->updateAllCurves(); } @@ -243,7 +243,7 @@ void RimWellMeasurementCollection::addFilePath( const QString& filePath ) //-------------------------------------------------------------------------------------------------- void RimWellMeasurementCollection::removeFilePath( RimWellMeasurementFilePath* measurementFilePath ) { - m_importedFiles.removeChildObject( measurementFilePath ); + m_importedFiles.removeChild( measurementFilePath ); delete measurementFilePath; } @@ -265,7 +265,7 @@ void RimWellMeasurementCollection::removeMeasurementsForFilePath( RimWellMeasure // Remove then remove them without invalidating the iterator for ( unsigned int i = 0; i < measurementsToRemove.size(); i++ ) { - m_measurements.removeChildObject( measurementsToRemove[i] ); + m_measurements.removeChild( measurementsToRemove[i] ); delete measurementsToRemove[i]; } diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp index 694983c012..a7a26e6f50 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp @@ -116,7 +116,7 @@ bool RimWellIASettings::initSettings( QString& outErrmsg ) RifParameterXmlReader basicreader( RiaPreferencesGeoMech::current()->geomechWIADefaultXML() ); if ( !basicreader.parseFile( outErrmsg ) ) return false; - m_parameters.clear(); + m_parameters.clearWithoutDelete(); for ( auto group : basicreader.parameterGroups() ) { m_parameters.push_back( group ); @@ -525,7 +525,7 @@ void RimWellIASettings::addCsvGroup( QString name, QStringList timeSteps, double //-------------------------------------------------------------------------------------------------- void RimWellIASettings::initCsvParameters() { - m_csvParameters.clear(); + m_csvParameters.clearWithoutDelete(); QStringList timeSteps = m_geomechCase->timeStepStrings(); diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp index 1006a5b33d..c0c77bcace 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettingsCollection.cpp @@ -89,7 +89,7 @@ RimWellIASettings* RimWellIASettingsCollection::startWellIntegrationAnalysis( QS //-------------------------------------------------------------------------------------------------- std::vector RimWellIASettingsCollection::settings() const { - return m_wellIASettings.childObjects(); + return m_wellIASettings.children(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp index 43675e0d5e..764bed1621 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPath.cpp @@ -930,7 +930,7 @@ void RimWellPath::detachWellLogFile( RimWellLogFile* logFileInfo ) { if ( m_wellLogFiles[i] == pdmObject ) { - m_wellLogFiles.removeChildObject( pdmObject ); + m_wellLogFiles.removeChild( pdmObject ); break; } } diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp index a7aaf5d7bc..36731c0373 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathAttributeCollection.cpp @@ -96,7 +96,7 @@ void RimWellPathAttributeCollection::insertAttribute( RimWellPathAttribute* inse //-------------------------------------------------------------------------------------------------- void RimWellPathAttributeCollection::deleteAttribute( RimWellPathAttribute* attributeToDelete ) { - m_attributes.removeChildObject( attributeToDelete ); + m_attributes.removeChild( attributeToDelete ); delete attributeToDelete; this->updateAllReferringTracks(); @@ -107,7 +107,7 @@ void RimWellPathAttributeCollection::deleteAttribute( RimWellPathAttribute* attr //-------------------------------------------------------------------------------------------------- void RimWellPathAttributeCollection::deleteAllAttributes() { - m_attributes.deleteAllChildObjects(); + m_attributes.deleteChildren(); this->updateAllReferringTracks(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp index bf268cab09..e5631a986a 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathCollection.cpp @@ -294,7 +294,7 @@ void RimWellPathCollection::addWellPath( gsl::not_null wellPath, b //-------------------------------------------------------------------------------------------------- std::vector RimWellPathCollection::allWellPaths() const { - return m_wellPaths.childObjects(); + return m_wellPaths.children(); } //-------------------------------------------------------------------------------------------------- @@ -572,8 +572,8 @@ RimWellPath* RimWellPathCollection::tryFindMatchingWellPath( const QString& well //-------------------------------------------------------------------------------------------------- void RimWellPathCollection::deleteAllWellPaths() { - m_wellPaths.deleteAllChildObjects(); - m_wellPathNodes.deleteAllChildObjects(); + m_wellPaths.deleteChildren(); + m_wellPathNodes.deleteChildren(); m_wellPathImporter->clear(); updateAllRequiredEditors(); @@ -584,7 +584,7 @@ void RimWellPathCollection::deleteAllWellPaths() //-------------------------------------------------------------------------------------------------- void RimWellPathCollection::deleteWell( RimWellPath* wellPath ) { - m_wellPaths.removeChildObject( wellPath ); + m_wellPaths.removeChild( wellPath ); delete wellPath; } @@ -789,9 +789,9 @@ caf::AppEnum RimWellPathCollection::findUnitSyste //-------------------------------------------------------------------------------------------------- void RimWellPathCollection::rebuildWellPathNodes() { - m_wellPathNodes.deleteAllChildObjects(); + m_wellPathNodes.deleteChildren(); - std::map> rootWells = wellPathsForWellNameStem( m_wellPaths.childObjects() ); + std::map> rootWells = wellPathsForWellNameStem( m_wellPaths.children() ); for ( auto [groupName, wellPathGroup] : rootWells ) { if ( groupName == unGroupedText() ) diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp index 00e6442c52..7ff2ab11e4 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGeometryDef.cpp @@ -389,7 +389,7 @@ void RimWellPathGeometryDef::insertTarget( const RimWellPathTarget* targetToInse //-------------------------------------------------------------------------------------------------- void RimWellPathGeometryDef::deleteTarget( RimWellPathTarget* targetTodelete ) { - m_wellTargets.removeChildObject( targetTodelete ); + m_wellTargets.removeChild( targetTodelete ); delete targetTodelete; } @@ -398,7 +398,7 @@ void RimWellPathGeometryDef::deleteTarget( RimWellPathTarget* targetTodelete ) //-------------------------------------------------------------------------------------------------- void RimWellPathGeometryDef::deleteAllTargets() { - m_wellTargets.deleteAllChildObjects(); + m_wellTargets.deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -408,7 +408,7 @@ RimWellPathTarget* RimWellPathGeometryDef::appendTarget() { RimWellPathTarget* wellPathTarget = nullptr; - auto targets = m_wellTargets.childObjects(); + auto targets = m_wellTargets.children(); if ( targets.empty() ) { wellPathTarget = new RimWellPathTarget; diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp index febc831b98..3bdc04eab8 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellPathGroup.cpp @@ -99,7 +99,7 @@ void RimWellPathGroup::addChildWellPath( RimWellPath* wellPath ) //-------------------------------------------------------------------------------------------------- std::vector RimWellPathGroup::childWellPaths() const { - return m_childWellPaths.childObjects(); + return m_childWellPaths.children(); } //-------------------------------------------------------------------------------------------------- @@ -123,7 +123,7 @@ bool RimWellPathGroup::hasChildWellPath( RimWellPath* wellPath ) //-------------------------------------------------------------------------------------------------- void RimWellPathGroup::removeChildWellPath( RimWellPath* wellPath ) { - m_childWellPaths.removeChildObject( wellPath ); + m_childWellPaths.removeChild( wellPath ); RimWellPath::copyCompletionSettings( this, wellPath ); if ( auto geometry = wellPath->wellPathGeometry(); geometry ) @@ -145,7 +145,7 @@ void RimWellPathGroup::removeChildWellPath( RimWellPath* wellPath ) //-------------------------------------------------------------------------------------------------- void RimWellPathGroup::removeAllChildWellPaths() { - auto childWellPaths = m_childWellPaths.childObjects(); + auto childWellPaths = m_childWellPaths.children(); for ( auto wellPath : childWellPaths ) { removeChildWellPath( wellPath ); @@ -419,7 +419,7 @@ void RimWellPathGroup::makeMoreLevelsIfNecessary() RimWellPathGroup* newGroup = new RimWellPathGroup; for ( auto wellPath : wellPaths ) { - m_childWellPaths().removeChildObject( wellPath ); + m_childWellPaths().removeChild( wellPath ); newGroup->addChildWellPath( wellPath ); newGroup->wellPathGeometry()->setUniqueStartAndEndIndex( childStartIndex, std::numeric_limits::max() ); diff --git a/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp b/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp index 7f70d847e1..cbe7a2cad4 100644 --- a/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp +++ b/ApplicationLibCode/ProjectDataModel/cafTreeNode.cpp @@ -45,7 +45,7 @@ void cafTreeNode::addChild( cafTreeNode* treeNode ) //-------------------------------------------------------------------------------------------------- std::vector cafTreeNode::childNodes() const { - return m_childNodes.childObjects(); + return m_childNodes.children(); } //-------------------------------------------------------------------------------------------------- @@ -226,7 +226,7 @@ void cafObjectReferenceTreeNode::defineUiTreeOrdering( caf::PdmUiTreeOrdering& u uiTreeOrdering.add( m_referencedObject() ); } - for ( auto c : m_childNodes.childObjects() ) + for ( auto c : m_childNodes.children() ) { if ( auto obj = c->referencedObject() ) { diff --git a/ApplicationLibCode/UnitTests/RimRelocatePath-Test.cpp b/ApplicationLibCode/UnitTests/RimRelocatePath-Test.cpp index 960cf64a3e..f92644935f 100644 --- a/ApplicationLibCode/UnitTests/RimRelocatePath-Test.cpp +++ b/ApplicationLibCode/UnitTests/RimRelocatePath-Test.cpp @@ -39,7 +39,7 @@ void fieldsByType( caf::PdmObjectHandle* object, std::vector& typedFields ) } } - field->childObjects( &children ); + field->children( &children ); } for ( const auto& child : children ) diff --git a/ApplicationLibCode/UserInterface/RiuAdvancedSnapshotExportWidget.cpp b/ApplicationLibCode/UserInterface/RiuAdvancedSnapshotExportWidget.cpp index c14ee2711e..12105bd166 100644 --- a/ApplicationLibCode/UserInterface/RiuAdvancedSnapshotExportWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuAdvancedSnapshotExportWidget.cpp @@ -226,7 +226,7 @@ void RiuAdvancedSnapshotExportWidget::deleteAllSnapshotItems() { if ( !m_rimProject ) return; - m_rimProject->multiSnapshotDefinitions.deleteAllChildObjects(); + m_rimProject->multiSnapshotDefinitions.deleteChildren(); m_rimProject->multiSnapshotDefinitions.uiCapability()->updateConnectedEditors(); } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp index 4b23e8d81c..32b2e8686a 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryVectorSelectionUi.cpp @@ -1336,7 +1336,7 @@ void RiuSummaryVectorSelectionUi::defineEditorAttribute( const caf::PdmFieldHand //-------------------------------------------------------------------------------------------------- void RiuSummaryVectorSelectionUi::resetAllFields() { - m_selectedSources.clear(); + m_selectedSources.clearWithoutDelete(); m_selectedSummaryCategories = std::vector>(); // clear all state in fields diff --git a/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExec.cpp b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExec.cpp index 3779c34405..83a7831eb0 100644 --- a/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExec.cpp +++ b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdAddItemExec.cpp @@ -123,7 +123,7 @@ void CmdAddItemExec::undo() if ( listField && m_commandData->m_createdItemIndex >= 0 ) { std::vector children; - listField->childObjects( &children ); + listField->children( &children ); caf::PdmObjectHandle* obj = children[m_commandData->m_createdItemIndex]; diff --git a/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExec.cpp b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExec.cpp index ae3c873b8c..3ff19477bb 100644 --- a/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExec.cpp +++ b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemExec.cpp @@ -66,7 +66,7 @@ void CmdDeleteItemExec::redo() if ( listField ) { std::vector children; - listField->childObjects( &children ); + listField->children( &children ); PdmObjectHandle* obj = children[m_commandData->m_indexToObject]; caf::SelectionManager::instance()->removeObjectFromAllSelections( obj ); diff --git a/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemFeature.cpp b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemFeature.cpp index 166777e4dc..1ec852d5e4 100644 --- a/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemFeature.cpp +++ b/Fwk/AppFwk/cafCommandFeatures/AddAndDelete/cafCmdDeleteItemFeature.cpp @@ -79,7 +79,7 @@ CmdExecuteCommand* CmdDeleteItemFeature::createExecuteCommand() int indexAfter = -1; std::vector childObjects; - childArrayFieldHandle->childObjects( &childObjects ); + childArrayFieldHandle->children( &childObjects ); for ( size_t i = 0; i < childObjects.size(); i++ ) { diff --git a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.cpp b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.cpp index c44e94f9e4..a43373c6c2 100644 --- a/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.cpp +++ b/Fwk/AppFwk/cafCommandFeatures/ToggleCommands/cafToggleItemsOnOthersOffFeature.cpp @@ -141,7 +141,7 @@ std::vector ToggleItemsOnOthersOffFeature::childObjects( std::vector children; if ( parent ) { - parent->childObjects( &children ); + parent->children( &children ); } return children; } @@ -159,4 +159,4 @@ caf::PdmField* ToggleItemsOnOthersOffFeature::objectToggleField( caf::PdmO return nullptr; } -} // namespace caf \ No newline at end of file +} // namespace caf diff --git a/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h b/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h index 491307c6c8..d096d5f9c5 100644 --- a/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h +++ b/Fwk/AppFwk/cafPdmScripting/cafPdmFieldScriptingCapability.h @@ -648,7 +648,7 @@ class PdmFieldScriptingCapability> : public PdmAbs void readFromField( QTextStream& outputStream, bool quoteStrings = true, bool quoteNonBuiltins = false ) const override { - PdmFieldScriptingCapabilityIOHandler>::readFromField( m_field->childObjects(), + PdmFieldScriptingCapabilityIOHandler>::readFromField( m_field->children(), outputStream, quoteStrings, quoteNonBuiltins ); diff --git a/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/cafPdmScriptingBasicTest.cpp b/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/cafPdmScriptingBasicTest.cpp index e044b0f76d..d828bffded 100644 --- a/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/cafPdmScriptingBasicTest.cpp +++ b/Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests/cafPdmScriptingBasicTest.cpp @@ -201,7 +201,7 @@ class InheritedDemoObj : public DemoPdmObject "Whatsthis SimpleObjectsField" ); } - ~InheritedDemoObj() { m_simpleObjectsField.deleteAllChildObjects(); } + ~InheritedDemoObj() { m_simpleObjectsField.deleteChildren(); } caf::PdmField> m_texts; caf::PdmField> m_numbers; @@ -222,7 +222,7 @@ class MyPdmDocument : public caf::PdmDocument CAF_PDM_InitFieldNoDefault( &objects, "PdmObjects", "", "", "", "" ) } - ~MyPdmDocument() { objects.deleteAllChildObjects(); } + ~MyPdmDocument() { objects.deleteChildren(); } caf::PdmChildArrayField objects; }; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.h index 5096fbb95c..4f6f0b6b9b 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.h @@ -24,7 +24,7 @@ class PdmChildArrayFieldHandle : public PdmPtrArrayFieldHandle PdmChildArrayFieldHandle() {} ~PdmChildArrayFieldHandle() override {} - virtual void deleteAllChildObjects() = 0; + virtual void deleteChildren() = 0; bool hasSameFieldCountForAllObjects(); }; @@ -63,15 +63,15 @@ class PdmChildArrayField : public PdmChildArrayFieldHandle size_t size() const override { return m_pointers.size(); } bool empty() const override { return m_pointers.empty(); } - void clear() override; - void deleteAllChildObjects() override; + void clearWithoutDelete() override; + void deleteChildren() override; void insertAt( int indexAfter, PdmObjectHandle* obj ) override; void insertAt( int indexAfter, std::unique_ptr obj ); PdmObjectHandle* at( size_t index ) override; void setValue( const std::vector& objects ); size_t indexOf( const PdmObjectHandle* obj ) const override; - virtual void deleteAllChildObjectsAsync(); + virtual void deleteChildrenAsync(); // std::vector-like access @@ -95,10 +95,10 @@ class PdmChildArrayField : public PdmChildArrayFieldHandle typename std::vector>::const_iterator end() const { return m_pointers.end(); }; // Child objects - std::vector childObjects() const; + std::vector children() const; - void childObjects( std::vector* objects ) override; - void removeChildObject( PdmObjectHandle* object ) override; + void children( std::vector* objects ) override; + void removeChild( PdmObjectHandle* object ) override; private: // To be disabled PDM_DISABLE_COPY_AND_ASSIGN( PdmChildArrayField ); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.inl index 809ec65a20..a915c10cdd 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayField.inl @@ -14,7 +14,7 @@ namespace caf template PdmChildArrayField::~PdmChildArrayField() { - deleteAllChildObjects(); + deleteChildren(); } //-------------------------------------------------------------------------------------------------- @@ -159,7 +159,7 @@ size_t PdmChildArrayField::indexOf( const PdmObjectHandle* obj ) cons /// Empty the container without deleting the objects pointed to. //-------------------------------------------------------------------------------------------------- template -void PdmChildArrayField::clear() +void PdmChildArrayField::clearWithoutDelete() { CAF_ASSERT( isInitializedByInitFieldMacro() ); @@ -171,7 +171,7 @@ void PdmChildArrayField::clear() /// Deletes all the objects pointed to by the field, then clears the container. //-------------------------------------------------------------------------------------------------- template -void PdmChildArrayField::deleteAllChildObjects() +void PdmChildArrayField::deleteChildren() { CAF_ASSERT( isInitializedByInitFieldMacro() ); @@ -189,7 +189,7 @@ void PdmChildArrayField::deleteAllChildObjects() /// Then clears the container and lets the thread delete the objects. //-------------------------------------------------------------------------------------------------- template -void PdmChildArrayField::deleteAllChildObjectsAsync() +void PdmChildArrayField::deleteChildrenAsync() { CAF_ASSERT( isInitializedByInitFieldMacro() ); @@ -219,7 +219,7 @@ void PdmChildArrayField::erase( size_t index ) template void PdmChildArrayField::setValue( const std::vector& objects ) { - clear(); + clearWithoutDelete(); for ( auto object : objects ) { push_back( object ); @@ -230,7 +230,7 @@ void PdmChildArrayField::setValue( const std::vector& obje /// Removes all instances of object pointer from the container without deleting the object. //-------------------------------------------------------------------------------------------------- template -void PdmChildArrayField::removeChildObject( PdmObjectHandle* object ) +void PdmChildArrayField::removeChild( PdmObjectHandle* object ) { CAF_ASSERT( isInitializedByInitFieldMacro() ); @@ -259,7 +259,7 @@ void PdmChildArrayField::removeChildObject( PdmObjectHandle* object ) /// //-------------------------------------------------------------------------------------------------- template -std::vector caf::PdmChildArrayField::childObjects() const +std::vector caf::PdmChildArrayField::children() const { std::vector objects; @@ -278,7 +278,7 @@ std::vector caf::PdmChildArrayField::childObjects() const /// //-------------------------------------------------------------------------------------------------- template -void PdmChildArrayField::childObjects( std::vector* objects ) +void PdmChildArrayField::children( std::vector* objects ) { if ( !objects ) return; size_t i; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayFieldHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayFieldHandle.cpp index 394be37f4d..88d55d3471 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayFieldHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildArrayFieldHandle.cpp @@ -11,7 +11,7 @@ namespace caf bool PdmChildArrayFieldHandle::hasSameFieldCountForAllObjects() { std::vector listObjects; - this->childObjects( &listObjects ); + this->children( &listObjects ); if ( listObjects.size() == 0 ) { diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildField.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildField.h index 622af931fa..9c664db0d9 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildField.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildField.h @@ -21,8 +21,8 @@ class PdmFieldXmlCap; class PdmChildFieldHandle : public PdmFieldHandle { public: - virtual void childObjects( std::vector* objects ) = 0; - virtual void setChildObject( PdmObjectHandle* object ) = 0; + virtual void children( std::vector* objects ) = 0; + virtual void setChildObject( PdmObjectHandle* object ) = 0; }; template @@ -67,9 +67,9 @@ class PdmChildField : public PdmChildFieldHandle const PdmPointer& v() const { return m_fieldValue; } // Child objects - virtual void childObjects( std::vector* objects ) override; + virtual void children( std::vector* objects ) override; void setChildObject( PdmObjectHandle* object ) override; - virtual void removeChildObject( PdmObjectHandle* object ) override; + virtual void removeChild( PdmObjectHandle* object ) override; private: PDM_DISABLE_COPY_AND_ASSIGN( PdmChildField ); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildField.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildField.inl index bfcd1f24a0..99ab353fee 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildField.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmChildField.inl @@ -9,7 +9,7 @@ namespace caf /// //-------------------------------------------------------------------------------------------------- template -void caf::PdmChildField::childObjects( std::vector* objects ) +void caf::PdmChildField::children( std::vector* objects ) { CAF_ASSERT( objects ); PdmObjectHandle* obj = m_fieldValue.rawPtr(); @@ -28,7 +28,7 @@ void caf::PdmChildField::setChildObject( PdmObjectHandle* object ) if ( m_fieldValue.rawPtr() != nullptr ) { PdmObjectHandle* oldObject = m_fieldValue.rawPtr(); - this->removeChildObject( oldObject ); + this->removeChild( oldObject ); delete oldObject; } m_fieldValue.setRawPtr( object ); @@ -39,7 +39,7 @@ void caf::PdmChildField::setChildObject( PdmObjectHandle* object ) /// //-------------------------------------------------------------------------------------------------- template -void caf::PdmChildField::removeChildObject( PdmObjectHandle* object ) +void caf::PdmChildField::removeChild( PdmObjectHandle* object ) { if ( m_fieldValue.rawPtr() != nullptr && m_fieldValue.rawPtr() == object ) { diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/Parent.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/Parent.cpp index dd2066be8c..74b5371a54 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/Parent.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/Parent.cpp @@ -10,7 +10,7 @@ Parent::Parent() Parent::~Parent() { delete m_simpleObjectF(); - m_simpleObjectsField.deleteAllChildObjects(); + m_simpleObjectsField.deleteChildren(); } void Parent::doSome() diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmChildArrayFieldHandleTest.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmChildArrayFieldHandleTest.cpp index 5bccf96c11..f44a40f599 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmChildArrayFieldHandleTest.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmChildArrayFieldHandleTest.cpp @@ -68,8 +68,8 @@ class ContainerObj : public caf::PdmObjectHandle ~ContainerObj() { - derivedObjs.deleteAllChildObjects(); - derivedOtherObjs.deleteAllChildObjects(); + derivedObjs.deleteChildren(); + derivedOtherObjs.deleteChildren(); } caf::PdmChildArrayField derivedObjs; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmCoreBasicTest.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmCoreBasicTest.cpp index d9a3f814d9..85cb5a98da 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmCoreBasicTest.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmCoreBasicTest.cpp @@ -292,10 +292,10 @@ TEST( BaseTest, PdmChildArrayField ) // childObjects std::vector objects; - ihd1->m_childArrayField.childObjects( &objects ); + ihd1->m_childArrayField.children( &objects ); EXPECT_EQ( size_t( 3 ), objects.size() ); - std::vector typedObjects = ihd1->m_childArrayField.childObjects(); + std::vector typedObjects = ihd1->m_childArrayField.children(); EXPECT_EQ( size_t( 3 ), typedObjects.size() ); // set() @@ -303,7 +303,7 @@ TEST( BaseTest, PdmChildArrayField ) EXPECT_TRUE( NULL == ihd1->m_childArrayField[1] ); EXPECT_TRUE( s2->parentField() == NULL ); - ihd1->m_childArrayField.removeChildObject( NULL ); + ihd1->m_childArrayField.removeChild( NULL ); EXPECT_EQ( size_t( 2 ), ihd1->m_childArrayField.size() ); EXPECT_EQ( s3, ihd1->m_childArrayField[1] ); EXPECT_EQ( s1, ihd1->m_childArrayField[0] ); @@ -325,7 +325,7 @@ TEST( BaseTest, PdmChildArrayField ) EXPECT_TRUE( s2->parentField() == NULL ); // clear() - ihd1->m_childArrayField.clear(); + ihd1->m_childArrayField.clearWithoutDelete(); EXPECT_EQ( size_t( 0 ), ihd1->m_childArrayField.size() ); EXPECT_TRUE( s1->parentField() == NULL ); @@ -334,7 +334,7 @@ TEST( BaseTest, PdmChildArrayField ) ihd1->m_childArrayField.push_back( s2 ); ihd1->m_childArrayField.push_back( s3 ); - ihd1->m_childArrayField.deleteAllChildObjects(); + ihd1->m_childArrayField.deleteChildren(); EXPECT_EQ( size_t( 0 ), ihd1->m_childArrayField.size() ); EXPECT_TRUE( s1 == NULL ); EXPECT_TRUE( s2 == NULL ); @@ -382,7 +382,7 @@ TEST( BaseTest, PdmChildArrayFieldHandle ) // virtual void clear() = 0; // virtual PdmObject* createAppendObject(int indexAfter) = 0; // virtual void erase(size_t index) = 0; - // virtual void deleteAllChildObjects() = 0; + // virtual void deleteChildren() = 0; // // virtual PdmObject* at(size_t index) = 0; // @@ -424,7 +424,7 @@ TEST( BaseTest, PdmChildArrayFieldHandle ) EXPECT_TRUE( listField->hasSameFieldCountForAllObjects() ); EXPECT_FALSE( listField->empty() ); - listField->deleteAllChildObjects(); + listField->deleteChildren(); EXPECT_EQ( 0u, listField->size() ); EXPECT_TRUE( listField->hasSameFieldCountForAllObjects() ); EXPECT_TRUE( listField->empty() ); @@ -474,7 +474,7 @@ TEST( BaseTest, PdmChildField ) EXPECT_TRUE( c2 == a.field2 ); std::vector objects; - a.field2.childObjects( &objects ); + a.field2.children( &objects ); EXPECT_EQ( (size_t)1, objects.size() ); EXPECT_EQ( c2, objects[0] ); } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmReferenceHelperTest.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmReferenceHelperTest.cpp index e79b59dc1c..ee1e11af6a 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmReferenceHelperTest.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmCore_UnitTests/cafPdmReferenceHelperTest.cpp @@ -56,7 +56,7 @@ class ReferenceSimpleObj : public caf::PdmObjectHandle ~ReferenceSimpleObj() { delete m_pointersField(); - m_simpleObjPtrField.deleteAllChildObjects(); + m_simpleObjPtrField.deleteChildren(); } // Fields @@ -203,10 +203,10 @@ TEST( PdmReferenceHelperTest, ObjectFromReference ) QString refString = caf::PdmReferenceHelper::referenceFromRootToObject( ihd1, s2 ); EXPECT_EQ( s2, caf::PdmReferenceHelper::objectFromReference( ihd1, refString ) ); - ihd1->m_simpleObjPtrField.removeChildObject( s2 ); + ihd1->m_simpleObjPtrField.removeChild( s2 ); EXPECT_EQ( NULL, caf::PdmReferenceHelper::objectFromReference( ihd1, refString ) ); - ihd1->m_simpleObjPtrField.deleteAllChildObjects(); + ihd1->m_simpleObjPtrField.deleteChildren(); EXPECT_EQ( NULL, caf::PdmReferenceHelper::objectFromReference( ihd1, refString ) ); @@ -241,10 +241,10 @@ TEST( PdmReferenceHelperTest, FieldFromReference ) QString refString = caf::PdmReferenceHelper::referenceFromRootToField( ihd1, fHandle ); EXPECT_EQ( fHandle, caf::PdmReferenceHelper::fieldFromReference( ihd1, refString ) ); - ihd1->m_simpleObjPtrField.removeChildObject( s2 ); + ihd1->m_simpleObjPtrField.removeChild( s2 ); EXPECT_EQ( NULL, caf::PdmReferenceHelper::fieldFromReference( ihd1, refString ) ); - ihd1->m_simpleObjPtrField.deleteAllChildObjects(); + ihd1->m_simpleObjPtrField.deleteChildren(); EXPECT_EQ( NULL, caf::PdmReferenceHelper::fieldFromReference( ihd1, refString ) ); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldHandle.cpp index 335b1af045..f7fcc74622 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldHandle.cpp @@ -37,10 +37,10 @@ void PdmFieldHandle::setKeyword( const QString& keyword ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool PdmFieldHandle::hasChildObjects() +bool PdmFieldHandle::hasChildren() { std::vector children; - this->childObjects( &children ); + this->children( &children ); return ( children.size() > 0 ); } diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldHandle.h index 026919f6fe..d481f4a869 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmFieldHandle.h @@ -31,9 +31,9 @@ class PdmFieldHandle std::vector keywordAliases() const; // Child objects - bool hasChildObjects(); - virtual void childObjects( std::vector* ) {} - virtual void removeChildObject( PdmObjectHandle* ) {} + bool hasChildren(); + virtual void children( std::vector* ) {} + virtual void removeChild( PdmObjectHandle* ) {} void setOwnerClass( const QString& ownerClass ); // Ptr referenced objects diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h index ca91c5ffb9..2d4608d3a0 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmObjectHandle.h @@ -267,7 +267,7 @@ void PdmObjectHandle::descendantsOfType( std::vector& descendants ) const for ( auto f : m_fields ) { std::vector childObjects; - f->childObjects( &childObjects ); + f->children( &childObjects ); for ( auto childObject : childObjects ) { diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.h index 5a49affe77..c1e1b734d8 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.h @@ -52,7 +52,7 @@ class PdmPtrArrayField : public PdmPtrArrayFieldHandle size_t size() const override { return m_pointers.size(); } bool empty() const override { return m_pointers.empty(); } - void clear() override; + void clearWithoutDelete() override; void insertAt( int indexAfter, PdmObjectHandle* obj ) override; PdmObjectHandle* at( size_t index ) override; size_t indexOf( const PdmObjectHandle* obj ) const override; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.inl index c39224f50f..7430d5b175 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayField.inl @@ -24,7 +24,7 @@ PdmPtrArrayField::~PdmPtrArrayField() template void PdmPtrArrayField::setValue( const std::vector>& fieldValue ) { - this->clear(); + this->clearWithoutDelete(); this->insert( 0, fieldValue ); } @@ -43,7 +43,7 @@ const std::vector>& PdmPtrArrayField::value() co template void PdmPtrArrayField::setValue( const std::vector& fieldValue ) { - this->clear(); + this->clearWithoutDelete(); for ( DataType* rawPtr : fieldValue ) { this->push_back( PdmPointer( rawPtr ) ); @@ -161,7 +161,7 @@ size_t PdmPtrArrayField::indexOf( const PdmObjectHandle* obj ) const /// Empty the container without deleting the objects pointed to. //-------------------------------------------------------------------------------------------------- template -void PdmPtrArrayField::clear() +void PdmPtrArrayField::clearWithoutDelete() { CAF_ASSERT( isInitializedByInitFieldMacro() ); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayFieldHandle.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayFieldHandle.h index 43d806be20..0d60034053 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayFieldHandle.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmPtrArrayFieldHandle.h @@ -17,7 +17,7 @@ class PdmPtrArrayFieldHandle : public PdmFieldHandle virtual size_t size() const = 0; virtual bool empty() const = 0; - virtual void clear() = 0; + virtual void clearWithoutDelete() = 0; virtual void insertAt( int indexAfter, PdmObjectHandle* obj ) = 0; virtual void erase( size_t index ) = 0; virtual size_t indexOf( const PdmObjectHandle* obj ) const = 0; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp index be263c27f7..bb9eb7b9b7 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafPdmReferenceHelper.cpp @@ -141,7 +141,7 @@ QStringList PdmReferenceHelper::referenceFromRootToObjectAsStringList( PdmObject } std::vector childObjects; - parentField->childObjects( &childObjects ); + parentField->children( &childObjects ); if ( childObjects.size() > 0 ) { @@ -220,7 +220,7 @@ PdmObjectHandle* PdmReferenceHelper::objectFromReferenceStringList( PdmObjectHan } std::vector childObjects; - fieldHandle->childObjects( &childObjects ); + fieldHandle->children( &childObjects ); if ( childObjects.size() == 0 ) { diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmDocument.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmDocument.cpp index 72a4b557c8..376d95bd3a 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmDocument.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmDocument.cpp @@ -137,7 +137,7 @@ void PdmDocument::updateUiIconStateRecursively( PdmObjectHandle* object ) size_t fIdx; for ( fIdx = 0; fIdx < fields.size(); ++fIdx ) { - if ( fields[fIdx] ) fields[fIdx]->childObjects( &children ); + if ( fields[fIdx] ) fields[fIdx]->children( &children ); } size_t cIdx; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.cpp index 2339b98d9e..3b8cc2afc0 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmObject.cpp @@ -72,7 +72,7 @@ void PdmObject::descendantsIncludingThisFromClassKeyword( const QString& for ( auto f : fields ) { std::vector childObjects; - f->childObjects( &childObjects ); + f->children( &childObjects ); for ( auto childObject : childObjects ) { PdmObject* pdmObjectChild = dynamic_cast( childObject ); @@ -94,7 +94,7 @@ void PdmObject::childrenFromClassKeyword( const QString& classKeyword, std::vect for ( auto f : fields ) { std::vector childObjects; - f->childObjects( &childObjects ); + f->children( &childObjects ); for ( auto childObject : childObjects ) { PdmObject* pdmObjectChild = dynamic_cast( childObject ); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp index eb692471c4..69c1a2a289 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiCommandSystemProxy.cpp @@ -198,7 +198,7 @@ std::vector PdmUiCommandSystemProxy::fieldsFromSelection( PdmFi for ( auto field : childFields ) { std::vector childObjects; - field->childObjects( &childObjects ); + field->children( &childObjects ); for ( auto childObj : childObjects ) { auto childFieldHandle = childObj->findField( fieldKeyword ); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.cpp index b420bd1b66..3ab7a5201a 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiObjectHandle.cpp @@ -118,13 +118,13 @@ void PdmUiObjectHandle::addDefaultUiTreeChildren( PdmUiTreeOrdering* uiTreeOrder for ( size_t fIdx = 0; fIdx < fields.size(); ++fIdx ) { - if ( fields[fIdx]->hasChildObjects() && !uiTreeOrdering->containsField( fields[fIdx] ) ) + if ( fields[fIdx]->hasChildren() && !uiTreeOrdering->containsField( fields[fIdx] ) ) { if ( fields[fIdx]->uiCapability()->isUiTreeHidden() && !fields[fIdx]->uiCapability()->isUiTreeChildrenHidden() ) { std::vector children; - fields[fIdx]->childObjects( &children ); + fields[fIdx]->children( &children ); std::set objectsAddedByApplication; for ( int i = 0; i < uiTreeOrdering->childCount(); i++ ) @@ -193,7 +193,7 @@ void PdmUiObjectHandle::expandUiTree( PdmUiTreeOrdering* root, const QString& ui !root->field()->uiCapability()->isUiTreeChildrenHidden( uiConfigName ) ) { std::vector fieldsChildObjects; - root->field()->childObjects( &fieldsChildObjects ); + root->field()->children( &fieldsChildObjects ); for ( size_t cIdx = 0; cIdx < fieldsChildObjects.size(); ++cIdx ) { PdmObjectHandle* childObject = fieldsChildObjects[cIdx]; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiTreeOrdering.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiTreeOrdering.cpp index bb9ab1ec3b..90acb343ba 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiTreeOrdering.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiTreeOrdering.cpp @@ -59,7 +59,7 @@ void PdmUiTreeOrdering::add( PdmFieldHandle* field, QString uiConfigName ) if ( !field->uiCapability()->isUiTreeChildrenHidden( uiConfigName ) ) { std::vector children; - field->childObjects( &children ); + field->children( &children ); for ( PdmObjectHandle* objHandle : children ) { diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl index a79b8853b2..9719add212 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafInternalPdmXmlFieldCapability.inl @@ -163,7 +163,7 @@ void caf::PdmFieldXmlCap>::readFieldData( QXmlS m_isResolved = false; m_referenceString = dataString; - m_field->clear(); + m_field->clearWithoutDelete(); } //-------------------------------------------------------------------------------------------------- @@ -193,7 +193,7 @@ bool caf::PdmFieldXmlCap>::resolveReferences() { if ( m_isResolved ) return true; if ( m_referenceString.isEmpty() ) return true; - m_field->clear(); + m_field->clearWithoutDelete(); bool foundValidObjectFromString = true; QStringList tokens = m_referenceString.split( '|' ); @@ -373,7 +373,7 @@ template void caf::PdmFieldXmlCap>::readFieldData( QXmlStreamReader& xmlStream, PdmObjectFactory* objectFactory ) { - m_field->deleteAllChildObjects(); + m_field->deleteChildren(); PdmFieldIOHelper::skipCharactersAndComments( xmlStream ); while ( xmlStream.isStartElement() ) { diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmSettings.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmSettings.cpp index 4ccde3f392..ddebafab34 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmSettings.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmSettings.cpp @@ -61,7 +61,7 @@ void PdmSettings::readFieldsFromApplicationStore( caf::PdmObjectHandle* object, caf::PdmFieldHandle* fieldHandle = fields[i]; std::vector children; - fieldHandle->childObjects( &children ); + fieldHandle->children( &children ); for ( size_t childIdx = 0; childIdx < children.size(); childIdx++ ) { caf::PdmObjectHandle* child = children[childIdx]; @@ -109,7 +109,7 @@ void PdmSettings::writeFieldsToApplicationStore( const caf::PdmObjectHandle* obj caf::PdmFieldHandle* fieldHandle = fields[i]; std::vector children; - fieldHandle->childObjects( &children ); + fieldHandle->children( &children ); for ( size_t childIdx = 0; childIdx < children.size(); childIdx++ ) { caf::PdmObjectHandle* child = children[childIdx]; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp index bb53a79cc5..4284025b72 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXmlObjectHandle.cpp @@ -325,7 +325,7 @@ void PdmXmlObjectHandle::initAfterReadRecursively( PdmObjectHandle* object ) size_t fIdx; for ( fIdx = 0; fIdx < fields.size(); ++fIdx ) { - if ( fields[fIdx] ) fields[fIdx]->childObjects( &children ); + if ( fields[fIdx] ) fields[fIdx]->children( &children ); } size_t cIdx; @@ -359,7 +359,7 @@ void PdmXmlObjectHandle::resolveReferencesRecursively( PdmObjectHandle* PdmFieldHandle* field = fields[fIdx]; if ( field ) { - field->childObjects( &children ); + field->children( &children ); bool resolvedOk = field->xmlCapability()->resolveReferences(); if ( fieldWithFailingResolve && !resolvedOk ) @@ -408,7 +408,7 @@ void PdmXmlObjectHandle::setupBeforeSaveRecursively( PdmObjectHandle* object ) size_t fIdx; for ( fIdx = 0; fIdx < fields.size(); ++fIdx ) { - if ( fields[fIdx] ) fields[fIdx]->childObjects( &children ); + if ( fields[fIdx] ) fields[fIdx]->children( &children ); } size_t cIdx; diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXmlBasicTest.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXmlBasicTest.cpp index 97734d3c42..fc37b8922b 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXmlBasicTest.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmXml/cafPdmXml_UnitTests/cafPdmXmlBasicTest.cpp @@ -189,7 +189,7 @@ class InheritedDemoObj : public DemoPdmObject CAF_PDM_XML_InitField( &m_childArrayField, "DemoPdmObjectects" ); } - ~InheritedDemoObj() { m_childArrayField.deleteAllChildObjects(); } + ~InheritedDemoObj() { m_childArrayField.deleteChildren(); } caf::PdmDataValueField m_texts; caf::PdmChildArrayField m_childArrayField; @@ -257,7 +257,7 @@ class ReferenceDemoPdmObject : public caf::PdmObjectHandle, public caf::PdmXmlOb ~ReferenceDemoPdmObject() { delete m_pointersField(); - m_simpleObjPtrField2.deleteAllChildObjects(); + m_simpleObjPtrField2.deleteChildren(); } // Fields diff --git a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/cafPdmBasicTest.cpp b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/cafPdmBasicTest.cpp index 63dfae0aee..f09a293922 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/cafPdmBasicTest.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafProjectDataModel_UnitTests/cafPdmBasicTest.cpp @@ -193,7 +193,7 @@ class InheritedDemoObj : public DemoPdmObject "Whatsthis SimpleObjectsField" ); } - ~InheritedDemoObj() { m_simpleObjectsField.deleteAllChildObjects(); } + ~InheritedDemoObj() { m_simpleObjectsField.deleteChildren(); } caf::PdmField> m_texts; caf::PdmField> m_testEnumField; @@ -212,7 +212,7 @@ class MyPdmDocument : public caf::PdmDocument CAF_PDM_InitFieldNoDefault( &objects, "PdmObjects", "", "", "", "" ) } - ~MyPdmDocument() { objects.deleteAllChildObjects(); } + ~MyPdmDocument() { objects.deleteChildren(); } caf::PdmChildArrayField objects; }; @@ -550,7 +550,7 @@ TEST( BaseTest, ReadWrite ) } d2->m_simpleObjPtrField = NULL; - xmlDoc.objects.deleteAllChildObjects(); + xmlDoc.objects.deleteChildren(); } { @@ -866,7 +866,7 @@ TEST( BaseTest, PdmChildArrayFieldHandle ) // virtual void clear() = 0; // virtual PdmObject* createAppendObject(int indexAfter) = 0; // virtual void erase(size_t index) = 0; - // virtual void deleteAllChildObjects() = 0; + // virtual void deleteChildren() = 0; // // virtual PdmObject* at(size_t index) = 0; // @@ -907,7 +907,7 @@ TEST( BaseTest, PdmChildArrayFieldHandle ) EXPECT_TRUE( listField->hasSameFieldCountForAllObjects() ); EXPECT_FALSE( listField->empty() ); - listField->deleteAllChildObjects(); + listField->deleteChildren(); EXPECT_EQ( 0u, listField->size() ); EXPECT_TRUE( listField->hasSameFieldCountForAllObjects() ); EXPECT_TRUE( listField->empty() ); diff --git a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp index 865ed7bf59..c9205c7f73 100644 --- a/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp +++ b/Fwk/AppFwk/cafTests/cafTestApplication/MainWindow.cpp @@ -759,7 +759,7 @@ class SmallDemoPdmObjectA : public caf::PdmObject std::vector objects; field = this->parentField(); - field->childObjects(&objects); + field->children(&objects); for (size_t i = 0; i < objects.size(); ++i) { @@ -1308,7 +1308,7 @@ void MainWindow::releaseTestData() { if (m_testRoot) { - m_testRoot->objects.deleteAllChildObjects(); + m_testRoot->objects.deleteChildren(); delete m_testRoot; } } @@ -1407,7 +1407,7 @@ void MainWindow::slotRemove() // Ordering is important - field->removeChildObject(obj); + field->removeChild(obj); // Delete object delete obj; diff --git a/Fwk/AppFwk/cafTests/cafTestCvfApplication/MainWindow.cpp b/Fwk/AppFwk/cafTests/cafTestCvfApplication/MainWindow.cpp index 5834254d13..2cde2fa261 100644 --- a/Fwk/AppFwk/cafTests/cafTestCvfApplication/MainWindow.cpp +++ b/Fwk/AppFwk/cafTests/cafTestCvfApplication/MainWindow.cpp @@ -282,7 +282,7 @@ void MainWindow::slotRemove() // Ordering is important - field->removeChildObject(obj); + field->removeChild(obj); // Delete object delete obj; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp index d5686dc473..a1d77c0029 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp @@ -341,7 +341,7 @@ void PdmUiTreeViewQModel::updateSubTreeRecursive( const QModelIndex& existingSub it != indicesToRemoveFromSource.rend(); ++it ) { - // Use the removeChildrenNoDelete() to remove the pointer from the list without deleting the pointer + // Use the removeChildNoDelete() to remove the pointer from the list without deleting the pointer sourceSubTreeRoot->removeChildrenNoDelete( *it, 1 ); } diff --git a/GrpcInterface/RiaGrpcCommandService.cpp b/GrpcInterface/RiaGrpcCommandService.cpp index a8073357cf..3ee39f216a 100644 --- a/GrpcInterface/RiaGrpcCommandService.cpp +++ b/GrpcInterface/RiaGrpcCommandService.cpp @@ -259,7 +259,7 @@ void RiaGrpcCommandService::assignPdmObjectValues( caf::PdmObjectHandle* if ( pdmChildFieldHandle ) { std::vector childObjects; - pdmChildFieldHandle->childObjects( &childObjects ); + pdmChildFieldHandle->children( &childObjects ); caf::PdmObjectHandle* childObject = nullptr; CAF_ASSERT( childObjects.size() <= 1u ); // We do not support child array fields yet diff --git a/GrpcInterface/RiaGrpcPdmObjectService.cpp b/GrpcInterface/RiaGrpcPdmObjectService.cpp index 2be5c99584..b97d5c5c63 100644 --- a/GrpcInterface/RiaGrpcPdmObjectService.cpp +++ b/GrpcInterface/RiaGrpcPdmObjectService.cpp @@ -416,7 +416,7 @@ grpc::Status RiaGrpcPdmObjectService::GetChildPdmObjects( grpc::ServerContext* if ( scriptability && scriptability->scriptFieldName() == fieldName ) { std::vector childObjects; - field->childObjects( &childObjects ); + field->children( &childObjects ); for ( auto pdmChild : childObjects ) { rips::PdmObject* ripsChild = reply->add_objects(); From 950ec38a1429c186ee3a9de57a3d512c5129046a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Sun, 29 May 2022 08:55:45 +0200 Subject: [PATCH 342/406] Add userInterface unit tests --- CMakeLists.txt | 3 + .../cafUserInterface_UnitTests/CMakeLists.txt | 62 +++++-------------- .../cafPdmUiTreeViewModelTest.cpp | 8 +-- 3 files changed, 21 insertions(+), 52 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2aff03d9e..5af32ce03b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -654,6 +654,9 @@ if(RESINSIGHT_INCLUDE_APPFWK_TESTS) add_subdirectory(Fwk/AppFwk/cafPdmScripting/cafPdmScripting_UnitTests) set_property(TARGET cafPdmScripting_UnitTests PROPERTY FOLDER "AppFwkTests") + add_subdirectory(Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests) + set_property(TARGET cafUserInterface_UnitTests PROPERTY FOLDER "AppFwkTests") + # Executables add_subdirectory(Fwk/AppFwk/cafTests/cafTestApplication) set_property(TARGET cafTestApplication PROPERTY FOLDER "AppFwkTests") diff --git a/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt index e29067d251..a732e52bec 100644 --- a/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt @@ -2,24 +2,12 @@ cmake_minimum_required(VERSION 2.8.12) project(cafUserInterface_UnitTests) -# Qt -option(CEE_USE_QT5 "Use Qt5" OFF) - -if(CEE_USE_QT5) - find_package( - Qt5 - COMPONENTS - REQUIRED Core Gui Widgets - ) - set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) -else() - find_package( - Qt4 - COMPONENTS QtCore QtGui QtMain - REQUIRED - ) - include(${QT_USE_FILE}) -endif(CEE_USE_QT5) +find_package( + Qt5 + COMPONENTS + REQUIRED Core Gui Widgets +) +set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) @@ -37,33 +25,11 @@ target_link_libraries( ) # Copy Qt Dlls -if(Qt5Core_FOUND) - foreach(qtlib ${QT_LIBRARIES}) - add_custom_command( - TARGET ${PROJECT_NAME} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different $ - $ - ) - endforeach(qtlib) - # Copy Qt Dlls -else() - # Copy Qt Dlls - if(MSVC) - set(QTLIBLIST QtCore QtGui QtOpenGl) - foreach(qtlib ${QTLIBLIST}) - - # Debug - execute_process( - COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}d4.dll - ${CMAKE_BINARY_DIR}/Debug/${qtlib}d4.dll - ) - - # Release - execute_process( - COMMAND cmake -E copy_if_different ${QT_BINARY_DIR}/${qtlib}4.dll - ${CMAKE_BINARY_DIR}/Release/${qtlib}4.dll - ) - endforeach(qtlib) - endif(MSVC) -endif(Qt5Core_FOUND) +foreach(qtlib ${QT_LIBRARIES}) + add_custom_command( + TARGET ${PROJECT_NAME} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different $ + $ + ) +endforeach(qtlib) diff --git a/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/cafPdmUiTreeViewModelTest.cpp b/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/cafPdmUiTreeViewModelTest.cpp index 85ae851d3c..805eaba8e7 100644 --- a/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/cafPdmUiTreeViewModelTest.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/cafPdmUiTreeViewModelTest.cpp @@ -36,7 +36,7 @@ class DemoPdmObject : public caf::PdmObject CAF_PDM_InitFieldNoDefault( &m_simpleObjPtrField, "SimpleObjPtrField", "SimpleObjPtrField", "", "Tooltip", "WhatsThis" ); } - ~DemoPdmObject() { m_simpleObjPtrField.deleteAllChildObjects(); } + ~DemoPdmObject() { m_simpleObjPtrField.deleteChildren(); } caf::PdmChildArrayField m_simpleObjPtrField; }; @@ -66,7 +66,7 @@ TEST( PdmUiTreeViewModelTest, DeleteOneItemAndVerifyTreeOrdering ) mi = treeView.findModelIndex( obj1 ); EXPECT_TRUE( mi.isValid() ); - demoObj->m_simpleObjPtrField.removeChildObject( obj1 ); + demoObj->m_simpleObjPtrField.removeChild( obj1 ); demoObj->m_simpleObjPtrField().uiCapability()->updateConnectedEditors(); mi = treeView.findModelIndex( obj1 ); @@ -125,7 +125,7 @@ TEST( PdmUiTreeViewModelTest, ChangeOrderingAndVerifyTreeOrdering ) mi = treeView.findModelIndex( obj4 ); EXPECT_EQ( 3, mi.row() ); - demoObj->m_simpleObjPtrField.clear(); + demoObj->m_simpleObjPtrField.clearWithoutDelete(); demoObj->m_simpleObjPtrField.push_back( obj1 ); demoObj->m_simpleObjPtrField.push_back( obj4 ); demoObj->m_simpleObjPtrField.push_back( obj3 ); @@ -166,7 +166,7 @@ TEST( PdmUiTreeViewModelTest, ChangeDeepInTreeNotifyRootAndVerifyTreeOrdering ) mi = treeView.findModelIndex( obj4 ); EXPECT_EQ( 3, mi.row() ); - demoObj->m_simpleObjPtrField.removeChildObject( obj4 ); + demoObj->m_simpleObjPtrField.removeChild( obj4 ); root->m_simpleObjPtrField().uiCapability()->updateConnectedEditors(); From 6a5b9f7300860b86ba4dc5f9ded1218449ac322f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 31 May 2022 12:56:45 +0200 Subject: [PATCH 343/406] Use deleteChildren() when required to avoid memory leak --- .../Commands/SsiHubImportCommands/RiuWellImportWizard.cpp | 2 +- .../ProjectDataModel/Faults/RimFaultRASettings.cpp | 4 ++-- ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp | 2 +- .../ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp | 2 +- .../ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp | 2 +- ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp | 2 +- .../Streamlines/RimStreamlineInViewCollection.cpp | 2 +- .../ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp | 4 ++-- .../ProjectDataModel/Summary/RimEnsembleCurveSet.cpp | 2 +- .../ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp | 2 +- .../ProjectDataModel/WellPath/RimWellIASettings.cpp | 4 ++-- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp index 9496e3fcbc..eb43b93b88 100644 --- a/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp +++ b/ApplicationLibCode/Commands/SsiHubImportCommands/RiuWellImportWizard.cpp @@ -1117,7 +1117,7 @@ void WellSummaryPage::initializePage() //-------------------------------------------------------------------------------------------------- void WellSummaryPage::updateSummaryPage() { - m_objectGroup->objects.clearWithoutDelete(); + m_objectGroup->objects.deleteChildren(); m_textEdit->setText( "Summary of imported wells\n\n" ); diff --git a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp index 1e0a3ffff4..9fb828c5c7 100644 --- a/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/Faults/RimFaultRASettings.cpp @@ -270,7 +270,7 @@ void RimFaultRASettings::initFromPreprocSettings( RimFaultRAPreprocSettings* pre RifParameterXmlReader basicreader( RiaPreferencesGeoMech::current()->geomechFRADefaultBasicXML() ); if ( !basicreader.parseFile( errorText ) ) return; - m_basicParameters.clearWithoutDelete(); + m_basicParameters.deleteChildren(); for ( auto group : basicreader.parameterGroups() ) { m_basicParameters.push_back( group ); @@ -281,7 +281,7 @@ void RimFaultRASettings::initFromPreprocSettings( RimFaultRAPreprocSettings* pre RifParameterXmlReader advreader( RiaPreferencesGeoMech::current()->geomechFRADefaultAdvXML() ); if ( !advreader.parseFile( errorText ) ) return; - m_advancedParameters.clearWithoutDelete(); + m_advancedParameters.deleteChildren(); for ( auto group : advreader.parameterGroups() ) { m_advancedParameters.push_back( group ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 39563b3d8b..c233327357 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -1045,7 +1045,7 @@ void RimWellPltPlot::initAfterLoad() //-------------------------------------------------------------------------------------------------- void RimWellPltPlot::syncSourcesIoFieldFromGuiField() { - m_selectedSourcesForIo.clearWithoutDelete(); + m_selectedSourcesForIo.deleteChildren(); for ( const RifDataSourceForRftPlt& addr : m_selectedSources() ) { diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp index 6412b3ffd2..3a3e43691f 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechPartCollection.cpp @@ -69,7 +69,7 @@ void RimGeoMechPartCollection::syncWithCase( RimGeoMechCase* geoCase ) if ( count != (int)m_parts.size() ) { - m_parts.clearWithoutDelete(); + m_parts.deleteChildren(); for ( int i = 0; i < count; i++ ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp index 98a4f0c0eb..43015b7f96 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCustomObjectiveFunctionWeight.cpp @@ -167,7 +167,7 @@ void RimCustomObjectiveFunctionWeight::fieldChangedByUi( const caf::PdmFieldHand auto curveSelection = dlg.curveSelection(); if ( !curveSelection.empty() ) { - m_objectiveValuesSummaryAddresses.clearWithoutDelete(); + m_objectiveValuesSummaryAddresses.deleteChildren(); for ( auto address : curveSelection ) { RimSummaryAddress* summaryAddress = new RimSummaryAddress(); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index d6a20d57f1..afc133dcc7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -425,7 +425,7 @@ void RimPlotAxisProperties::appendAnnotation( RimPlotAxisAnnotation* annotation //-------------------------------------------------------------------------------------------------- void RimPlotAxisProperties::removeAllAnnotations() { - m_annotations.clearWithoutDelete(); + m_annotations.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp index 27d6f00861..86351e8f00 100644 --- a/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Streamlines/RimStreamlineInViewCollection.cpp @@ -441,7 +441,7 @@ void RimStreamlineInViewCollection::updateStreamlines() if ( m_shouldGenerateTracers && isActive() ) { // reset generated streamlines - m_streamlines().clearWithoutDelete(); + m_streamlines.deleteChildren(); m_wellCellIds.clear(); // get current simulation timestep diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp index 0651f57040..ceaef0e107 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveFilter.cpp @@ -238,7 +238,7 @@ std::vector RimEnsembleCurveFilter::summaryAddresses() //-------------------------------------------------------------------------------------------------- void RimEnsembleCurveFilter::setSummaryAddresses( std::vector addresses ) { - m_objectiveValuesSummaryAddresses.clearWithoutDelete(); + m_objectiveValuesSummaryAddresses.deleteChildren(); for ( auto address : addresses ) { RimSummaryAddress* summaryAddress = new RimSummaryAddress(); @@ -396,7 +396,7 @@ void RimEnsembleCurveFilter::fieldChangedByUi( const caf::PdmFieldHandle* change auto curveSelection = dlg.curveSelection(); if ( !curveSelection.empty() ) { - m_objectiveValuesSummaryAddresses.clearWithoutDelete(); + m_objectiveValuesSummaryAddresses.deleteChildren(); for ( auto address : curveSelection ) { RimSummaryAddress* summaryAddress = new RimSummaryAddress(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 94424bd1e7..405726bf8b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -820,7 +820,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi auto curveSelection = dlg.curveSelection(); if ( !curveSelection.empty() ) { - m_objectiveValuesSummaryAddresses.clearWithoutDelete(); + m_objectiveValuesSummaryAddresses.deleteChildren(); for ( auto address : curveSelection ) { RimSummaryAddress* summaryAddress = new RimSummaryAddress(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index 2217239aaa..f532a4d8a2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -532,7 +532,7 @@ void RimSummaryTimeAxisProperties::appendAnnotation( RimPlotAxisAnnotation* anno //-------------------------------------------------------------------------------------------------- void RimSummaryTimeAxisProperties::removeAllAnnotations() { - m_annotations.clearWithoutDelete(); + m_annotations.deleteChildren(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp index a7a26e6f50..bca6d5a65b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellPath/RimWellIASettings.cpp @@ -116,7 +116,7 @@ bool RimWellIASettings::initSettings( QString& outErrmsg ) RifParameterXmlReader basicreader( RiaPreferencesGeoMech::current()->geomechWIADefaultXML() ); if ( !basicreader.parseFile( outErrmsg ) ) return false; - m_parameters.clearWithoutDelete(); + m_parameters.deleteChildren(); for ( auto group : basicreader.parameterGroups() ) { m_parameters.push_back( group ); @@ -525,7 +525,7 @@ void RimWellIASettings::addCsvGroup( QString name, QStringList timeSteps, double //-------------------------------------------------------------------------------------------------- void RimWellIASettings::initCsvParameters() { - m_csvParameters.clearWithoutDelete(); + m_csvParameters.deleteChildren(); QStringList timeSteps = m_geomechCase->timeStepStrings(); From e7f27abae79c5aed45d669b955dc4969a5eed927 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 30 May 2022 09:13:50 +0200 Subject: [PATCH 344/406] libecl: add support for network variables --- ThirdParty/Ert/lib/ecl/ecl_smspec.cpp | 2 ++ ThirdParty/Ert/lib/ecl/smspec_node.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/ThirdParty/Ert/lib/ecl/ecl_smspec.cpp b/ThirdParty/Ert/lib/ecl/ecl_smspec.cpp index e0a4742c90..7136067d46 100644 --- a/ThirdParty/Ert/lib/ecl/ecl_smspec.cpp +++ b/ThirdParty/Ert/lib/ecl/ecl_smspec.cpp @@ -754,6 +754,8 @@ static void ecl_smspec_install_special_keys( ecl_smspec_type * ecl_smspec , cons break; case(ECL_SMSPEC_AQUIFER_VAR): break; + case(ECL_SMSPEC_NETWORK_VAR): + break; default: throw std::invalid_argument("Internal error - should not be here \n"); } diff --git a/ThirdParty/Ert/lib/ecl/smspec_node.cpp b/ThirdParty/Ert/lib/ecl/smspec_node.cpp index a1c98178fb..0068dff258 100644 --- a/ThirdParty/Ert/lib/ecl/smspec_node.cpp +++ b/ThirdParty/Ert/lib/ecl/smspec_node.cpp @@ -592,6 +592,10 @@ void smspec_node::set_gen_keys( const char* key_join_string_) { // KEYWORD gen_key1 = keyword; break; + case(ECL_SMSPEC_NETWORK_VAR): + // KEYWORD + gen_key1 = keyword; + break; case(ECL_SMSPEC_GROUP_VAR): // KEYWORD:WGNAME gen_key1 = smspec_alloc_group_key( key_join_string_ , keyword , wgname); @@ -718,6 +722,9 @@ ecl_smspec_var_type smspec_node::valid_type(const char * keyword, const char * w return var_type; } + if (var_type == ECL_SMSPEC_NETWORK_VAR) + return var_type; + return ECL_SMSPEC_INVALID_VAR; } @@ -907,6 +914,8 @@ smspec_node::smspec_node(int param_index, case(ECL_SMSPEC_AQUIFER_VAR): set_num( grid_dims , num ); break; + case(ECL_SMSPEC_NETWORK_VAR): + break; default: throw std::invalid_argument("Should not be here ... "); break; @@ -941,6 +950,8 @@ smspec_node::smspec_node( int param_index_, switch (this->var_type) { case(ECL_SMSPEC_LOCAL_WELL_VAR): break; + case(ECL_SMSPEC_NETWORK_VAR): + break; case(ECL_SMSPEC_LOCAL_BLOCK_VAR): set_lgr_ijk( lgr_i, lgr_j , lgr_k ); break; From 29e1a72d76fd17a3bbb97fbd729aca5cc93b5fcd Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 30 May 2022 09:30:40 +0200 Subject: [PATCH 345/406] libecl: Add more special-case MISC vectors --- ThirdParty/Ert/lib/ecl/smspec_node.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/ThirdParty/Ert/lib/ecl/smspec_node.cpp b/ThirdParty/Ert/lib/ecl/smspec_node.cpp index 0068dff258..fdeada0d78 100644 --- a/ThirdParty/Ert/lib/ecl/smspec_node.cpp +++ b/ThirdParty/Ert/lib/ecl/smspec_node.cpp @@ -57,11 +57,26 @@ ecl_smspec_identify_special_var() and ecl_smspec_identify_var_type(). */ -static const char* special_vars[] = {"NEWTON", - "NAIMFRAC", +static const char* special_vars[] = {"NAIMFRAC", + "NBAKFL", + "NBYTOT", + "NCPRLINS", + "NEWTFL", + "NEWTON", + "NLINEARP", + "NLINEARS", "NLINEARS", - "NLINSMIN", "NLINSMAX", + "NLINSMIN", + "NLRESMAX", + "NLRESSUM", + "NMESSAGE", + "NNUMFL", + "NNUMST", + "NTS", + "NTSECL", + "NTSMCL", + "NTSPCL", "ELAPSED", "MAXDPR", "MAXDSO", From 34a5d3e756142575166186a82d4b37c891e274eb Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 30 May 2022 11:16:00 +0200 Subject: [PATCH 346/406] Summary Quantity Name Provider: special handling for MISC vectors --- .../RiuSummaryQuantityNameInfoProvider.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp index 618c6d6fa9..ff7f4656ce 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp @@ -2133,7 +2133,24 @@ std::unordered_map Date: Tue, 31 May 2022 20:25:35 +0200 Subject: [PATCH 347/406] #8899 Try exact matches for eclipse summary category search. Fixes incorrect classification for vectors with 8 characters starting with 'N' (e.g NLINSMAX). They were classified as "network", but lookup table have them correctly classified as "misc". --- .../FileInterface/RifEclipseSummaryAddress.cpp | 6 ++++++ .../RiuSummaryQuantityNameInfoProvider.cpp | 11 +++++++---- .../RiuSummaryQuantityNameInfoProvider.h | 5 +++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index 02a15de185..3516e79b08 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -157,8 +157,14 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromEclipseTextAddress( const //-------------------------------------------------------------------------------------------------- RifEclipseSummaryAddress::SummaryVarCategory RifEclipseSummaryAddress::identifyCategory( const std::string& vectorName ) { + // Try to an exact match on the vector name first in the vector table. + bool exactMatch = true; + auto exactCategory = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( vectorName, exactMatch ); + if ( exactCategory != SUMMARY_INVALID ) return exactCategory; + if ( vectorName.size() < 3 || vectorName.size() > 8 ) return SUMMARY_INVALID; + // Try to match the base vector name with more heuristics auto strippedQuantityName = baseVectorName( vectorName ); // First, try to lookup vector in vector table diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp index ff7f4656ce..5b4079f0e0 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp @@ -33,9 +33,9 @@ RiuSummaryQuantityNameInfoProvider* RiuSummaryQuantityNameInfoProvider::instance /// //-------------------------------------------------------------------------------------------------- RifEclipseSummaryAddress::SummaryVarCategory - RiuSummaryQuantityNameInfoProvider::categoryFromVectorName( const std::string& vectorName ) const + RiuSummaryQuantityNameInfoProvider::categoryFromVectorName( const std::string& vectorName, bool exactMatch ) const { - auto info = quantityInfo( vectorName ); + auto info = quantityInfo( vectorName, exactMatch ); return info.category; } @@ -44,15 +44,17 @@ RifEclipseSummaryAddress::SummaryVarCategory /// //-------------------------------------------------------------------------------------------------- RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo - RiuSummaryQuantityNameInfoProvider::quantityInfo( const std::string& vectorName ) const + RiuSummaryQuantityNameInfoProvider::quantityInfo( const std::string& vectorName, bool exactMatch ) const { auto it = m_summaryToDescMap.find( vectorName ); - if ( it != m_summaryToDescMap.end() ) { return it->second; } + // Stop searching if not found in lookup table and exact match was requested. + if ( exactMatch ) return RiuSummaryQuantityInfo(); + if ( vectorName.size() > 1 && vectorName[1] == 'U' ) { // User defined vector name @@ -63,6 +65,7 @@ RiuSummaryQuantityNameInfoProvider::RiuSummaryQuantityInfo return RiuSummaryQuantityInfo(); } + if ( vectorName.size() > 5 ) { // Check for custom vector naming diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h index b23f320dba..cbe66dccf3 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h @@ -31,7 +31,8 @@ class RiuSummaryQuantityNameInfoProvider public: static RiuSummaryQuantityNameInfoProvider* instance(); - RifEclipseSummaryAddress::SummaryVarCategory categoryFromVectorName( const std::string& vectorName ) const; + RifEclipseSummaryAddress::SummaryVarCategory categoryFromVectorName( const std::string& vectorName, + bool exactMatch = false ) const; std::string longNameFromVectorName( const std::string& vectorName, bool returnVectorNameIfNotFound = false ) const; private: @@ -55,7 +56,7 @@ class RiuSummaryQuantityNameInfoProvider private: RiuSummaryQuantityNameInfoProvider(); - RiuSummaryQuantityInfo quantityInfo( const std::string& vectorName ) const; + RiuSummaryQuantityInfo quantityInfo( const std::string& vectorName, bool exactMatch = false ) const; static std::unordered_map createInfoForEclipseKeywords(); static std::unordered_map createInfoFor6xKeywords(); From 9f4d242a5d91ac49e693f99fbdbadbfa963b1769 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Wed, 1 Jun 2022 10:45:44 +0200 Subject: [PATCH 348/406] Plot Template updates (#9002) * Ensemble plot templates now have .erpt extension and new icon * Default plot templates are given a checkmark overlay on the icon * Context menu has been cleaned up a bit * Old default template is really just the last used template. Rename it. * Add max. recursive depth setting in preferences for plot template searches * Only create plots based on correct template type when importing ensembles or single cases * Support creating new plot from template explorer * Update last used template when creating a new plot from a template --- .../Resources/CheckOverlay16x16.png | Bin 0 -> 403 bytes ApplicationExeCode/Resources/ResInsight.qrc | 2 + .../SummaryEnsembleTemplate16x16.png | Bin 0 -> 743 bytes .../Application/RiaPreferences.cpp | 25 ++- .../Application/RiaPreferences.h | 10 +- .../Application/RiaPreferencesSummary.cpp | 16 +- .../Application/RiaPreferencesSummary.h | 2 +- .../RicSummaryPlotBuilder.cpp | 5 +- .../CMakeLists_files.cmake | 4 + .../RicCreateNewPlotFromTemplateFeature.cpp | 145 ++++++++++++++++++ .../RicCreateNewPlotFromTemplateFeature.h | 41 +++++ ...reatePlotFromTemplateByShortcutFeature.cpp | 2 +- .../RicEditPlotTemplateFeature.cpp | 1 - .../RicRenamePlotTemplateFeature.cpp | 1 - .../RicSaveMultiPlotTemplateFeature.cpp | 8 +- .../RicSelectCaseOrEnsembleUi.cpp | 134 ++++++++++++++++ .../RicSelectCaseOrEnsembleUi.h | 56 +++++++ .../RicSetAsDefaultTemplateFeature.cpp | 5 +- .../RicSummaryPlotTemplateTools.cpp | 2 +- .../PlotTemplates/RimPlotTemplateFileItem.cpp | 40 +++++ .../PlotTemplates/RimPlotTemplateFileItem.h | 6 + .../RimPlotTemplateFolderItem.cpp | 87 ++++++----- .../PlotTemplates/RimPlotTemplateFolderItem.h | 9 +- .../RimContextCommandBuilder.cpp | 2 + 24 files changed, 532 insertions(+), 71 deletions(-) create mode 100644 ApplicationExeCode/Resources/CheckOverlay16x16.png create mode 100644 ApplicationExeCode/Resources/SummaryEnsembleTemplate16x16.png create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateNewPlotFromTemplateFeature.cpp create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateNewPlotFromTemplateFeature.h create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp create mode 100644 ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.h diff --git a/ApplicationExeCode/Resources/CheckOverlay16x16.png b/ApplicationExeCode/Resources/CheckOverlay16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..23979cd107e67a1bdc990ceb072710bdd8b59d44 GIT binary patch literal 403 zcmV;E0c`$>P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TV5KC!^_NSwLnjg;e_2V!iXLTG@20RRNIVEZS^IlTY?002ovPDHLkV1nJ1rsDtr literal 0 HcmV?d00001 diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index 3b07b776da..f0ce42be12 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -146,6 +146,7 @@ SummaryPlots16x16.png SummaryPlotsLight16x16.png SummaryTemplate16x16.png + SummaryEnsembleTemplate16x16.png SummaryXPlotLight16x16.png SummaryXPlotsLight16x16.png Swap.png @@ -267,6 +268,7 @@ AppendPrevCurve.svg AppendNextCurve.png AppendPrevCurve.png + CheckOverlay16x16.png fs_CellFace.glsl diff --git a/ApplicationExeCode/Resources/SummaryEnsembleTemplate16x16.png b/ApplicationExeCode/Resources/SummaryEnsembleTemplate16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..cac7f2e6bbd2a6367591f7e76cc1eed4b22d015a GIT binary patch literal 743 zcmV?P)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGf6951U69E94oEQKA0(?nCK~y+TZBt!H zlTjFc_Vdm5qt0P9X)OE+GH8MAu9A_|g}ha}PY{L&)aJ|Dzc5Bn-`AQ%jCs_pG1kESom>8iG=sfiWTLM{}-+{@>%y1Ni){ffa)y;$5(aiOIj{pSPa zplCG8nQJMirpMbVeigs%i6g9P$+=&_))t!+XKXlq$qw(W%eZ##KJ5B-UY7`kcFF@) zRXG(M9NW}~_oCTk;;OGggS=Kp%*+nD zx-{tN;a}Gf2n0lCJ|;dt^o!va-C`y2QMg>LeTOJHFz`b}B01hl1rg1}#DqART83)> z0{5w#a2#|~ED($RMIy0|xj7SzMg?tcTJ-js*;j=zjcnzSXB#k>jzXs#z~*KKb#=`s z7PDw*aKPb6prd1%&Y|3;TXaLa9qaLUCgpQ}N@EkTf!IP+h(=setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_searchPlotTemplateFoldersRecursively, - "SearchPlotTemplateFoldersRecursively", - true, - "Search Plot Templates Recursively" ); - caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_searchPlotTemplateFoldersRecursively ); + CAF_PDM_InitField( &m_maxPlotTemplateFoldersDepth, + "MaxPlotTemplateFoldersDepth", + 2, + "Maximum Plot Template Folder Search Depth" ); - CAF_PDM_InitFieldNoDefault( &m_defaultPlotTemplate, "defaultPlotTemplate", "Default Plot Template" ); + CAF_PDM_InitFieldNoDefault( &m_lastUsedPlotTemplate, "defaultPlotTemplate", "Default Plot Template" ); CAF_PDM_InitFieldNoDefault( &m_pageSize, "pageSize", "Page Size" ); CAF_PDM_InitFieldNoDefault( &m_pageOrientation, "pageOrientation", "Page Orientation" ); @@ -383,7 +382,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& caf::PdmUiGroup* group = summaryGrp->addNewGroup( "Plot Templates" ); group->add( &m_plotTemplateFolders ); - group->add( &m_searchPlotTemplateFoldersRecursively ); + group->add( &m_maxPlotTemplateFoldersDepth ); caf::PdmUiGroup* generalGrp = uiOrdering.addNewGroup( "General" ); @@ -671,9 +670,9 @@ QString RiaPreferences::dateTimeFormat( RiaDefines::DateFormatComponents dateCom //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RiaPreferences::searchPlotTemplateFoldersRecursively() const +int RiaPreferences::maxPlotTemplateFoldersDepth() const { - return m_searchPlotTemplateFoldersRecursively(); + return m_maxPlotTemplateFoldersDepth(); } //-------------------------------------------------------------------------------------------------- @@ -714,17 +713,17 @@ void RiaPreferences::appendPlotTemplateFolders( const QString& folder ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiaPreferences::defaultPlotTemplateAbsolutePath() const +QString RiaPreferences::lastUsedPlotTemplateAbsolutePath() const { - return m_defaultPlotTemplate().path(); + return m_lastUsedPlotTemplate().path(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaPreferences::setDefaultPlotTemplatePath( const QString& templatePath ) +void RiaPreferences::setLastUsedPlotTemplatePath( const QString& templatePath ) { - m_defaultPlotTemplate = templatePath; + m_lastUsedPlotTemplate = templatePath; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferences.h b/ApplicationLibCode/Application/RiaPreferences.h index 7e5ad4d062..620fbe2c5c 100644 --- a/ApplicationLibCode/Application/RiaPreferences.h +++ b/ApplicationLibCode/Application/RiaPreferences.h @@ -76,11 +76,11 @@ class RiaPreferences : public caf::PdmObject RiaDefines::DateFormatComponents dateComponents = RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY, RiaDefines::TimeFormatComponents timeComponents = RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ) const; - bool searchPlotTemplateFoldersRecursively() const; + int maxPlotTemplateFoldersDepth() const; QStringList plotTemplateFolders() const; void appendPlotTemplateFolders( const QString& folder ); - QString defaultPlotTemplateAbsolutePath() const; - void setDefaultPlotTemplatePath( const QString& templatePath ); + QString lastUsedPlotTemplateAbsolutePath() const; + void setLastUsedPlotTemplatePath( const QString& templatePath ); bool openExportedPdfInViewer() const; bool useQtChartsAsDefaultPlotType() const; @@ -182,8 +182,8 @@ class RiaPreferences : public caf::PdmObject caf::PdmField m_openExportedPdfInViewer; caf::PdmField m_plotTemplateFolders; - caf::PdmField m_searchPlotTemplateFoldersRecursively; - caf::PdmField m_defaultPlotTemplate; + caf::PdmField m_maxPlotTemplateFoldersDepth; + caf::PdmField m_lastUsedPlotTemplate; caf::PdmField m_useQtChartsPlotByDefault; // Script paths diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp index e555f89bac..31157b72e8 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp @@ -31,6 +31,7 @@ #include "cafPdmUiPushButtonEditor.h" #include +#include namespace caf { @@ -535,9 +536,20 @@ RiaPreferencesSummary::DefaultSummaryPlotType RiaPreferencesSummary::defaultSumm //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::vector RiaPreferencesSummary::defaultSummaryPlotTemplates() const +std::vector RiaPreferencesSummary::defaultSummaryPlotTemplates( bool returnEnsembleTemplates ) const { - return m_selectedDefaultTemplates(); + std::vector templatesToUse; + for ( auto& fileName : m_selectedDefaultTemplates() ) + { + bool singleTemplate = fileName.toLower().endsWith( ".rpt" ); + if ( singleTemplate && returnEnsembleTemplates ) continue; + if ( !singleTemplate && !returnEnsembleTemplates ) continue; + + if ( std::count( templatesToUse.begin(), templatesToUse.end(), fileName ) == 0 ) + templatesToUse.push_back( fileName ); + } + + return templatesToUse; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.h b/ApplicationLibCode/Application/RiaPreferencesSummary.h index 18f3035876..acfaa97169 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.h +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.h @@ -84,7 +84,7 @@ class RiaPreferencesSummary : public caf::PdmObject int createH5SummaryDataThreadCount() const; DefaultSummaryPlotType defaultSummaryPlotType() const; - std::vector defaultSummaryPlotTemplates() const; + std::vector defaultSummaryPlotTemplates( bool returnEnsembleTemplates ) const; bool isDefaultSummaryPlotTemplate( QString filename ) const; void addToDefaultPlotTemplates( QString filename ); void removeFromDefaultPlotTemplates( QString filename ); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 113655244a..c50a907c8d 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -416,8 +416,9 @@ RimSummaryMultiPlot* if ( prefs->defaultSummaryPlotType() == RiaPreferencesSummary::DefaultSummaryPlotType::PLOT_TEMPLATES ) { - RimSummaryMultiPlot* plotToSelect = nullptr; - for ( auto& filename : prefs->defaultSummaryPlotTemplates() ) + RimSummaryMultiPlot* plotToSelect = nullptr; + bool ensembleTemplates = ( ensembles.size() > 0 ); + for ( auto& filename : prefs->defaultSummaryPlotTemplates( ensembleTemplates ) ) { plotToSelect = RicSummaryPlotTemplateTools::create( filename, cases, ensembles ); } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake index 226231216b..667b6c1e0d 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/CMakeLists_files.cmake @@ -10,6 +10,8 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicEditPlotTemplateFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicDeletePlotTemplateFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSetAsDefaultTemplateFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicCreateNewPlotFromTemplateFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicSelectCaseOrEnsembleUi.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -24,6 +26,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicEditPlotTemplateFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicDeletePlotTemplateFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSetAsDefaultTemplateFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicCreateNewPlotFromTemplateFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicSelectCaseOrEnsembleUi.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateNewPlotFromTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateNewPlotFromTemplateFeature.cpp new file mode 100644 index 0000000000..659c2297ba --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateNewPlotFromTemplateFeature.cpp @@ -0,0 +1,145 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicCreateNewPlotFromTemplateFeature.h" + +#include "PlotTemplates/RimPlotTemplateFileItem.h" + +#include "RiaGuiApplication.h" +#include "RiaPreferences.h" + +#include "RicSelectCaseOrEnsembleUi.h" +#include "RicSummaryPlotTemplateTools.h" + +#include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" +#include "RimSummaryMultiPlot.h" + +#include "RiuPlotMainWindow.h" +#include "RiuPlotMainWindowTools.h" + +#include "cafPdmUiPropertyViewDialog.h" +#include "cafSelectionManager.h" + +#include +#include + +CAF_CMD_SOURCE_INIT( RicCreateNewPlotFromTemplateFeature, "RicCreateNewPlotFromTemplateFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicCreateNewPlotFromTemplateFeature::isCommandEnabled() +{ + std::vector uiItems; + caf::SelectionManager::instance()->selectedItems( uiItems ); + if ( uiItems.size() != 1 ) return false; + + RimPlotTemplateFileItem* file = dynamic_cast( uiItems[0] ); + return ( file != nullptr ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateNewPlotFromTemplateFeature::onActionTriggered( bool isChecked ) +{ + std::vector uiItems; + caf::SelectionManager::instance()->selectedItems( uiItems ); + + if ( uiItems.size() != 1 ) return; + + RimPlotTemplateFileItem* file = dynamic_cast( uiItems[0] ); + if ( file == nullptr ) return; + + RimSummaryMultiPlot* plot = nullptr; + + if ( file->isEnsembleTemplate() ) + { + auto ensemble = selectEnsemble(); + if ( !ensemble ) return; + + plot = RicSummaryPlotTemplateTools::create( file->absoluteFilePath(), {}, { ensemble } ); + } + else + { + auto sumCase = selectSummaryCase(); + if ( !sumCase ) return; + + plot = RicSummaryPlotTemplateTools::create( file->absoluteFilePath(), { sumCase }, {} ); + } + + if ( plot != nullptr ) + { + RiaPreferences::current()->setLastUsedPlotTemplatePath( file->absoluteFilePath() ); + RiaPreferences::current()->writePreferencesToApplicationStore(); + } + + RiuPlotMainWindowTools::selectAsCurrentItem( plot ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicCreateNewPlotFromTemplateFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Create New Plot" ); + actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCase* RicCreateNewPlotFromTemplateFeature::selectSummaryCase() +{ + RiuPlotMainWindow* plotwindow = RiaGuiApplication::instance()->mainPlotWindow(); + RicSelectCaseOrEnsembleUi ui; + + ui.setEnsembleSelectionMode( false ); + + caf::PdmUiPropertyViewDialog propertyDialog( plotwindow, &ui, "Create New Plot - Select Summary Case", "" ); + propertyDialog.resize( QSize( 400, 200 ) ); + + if ( propertyDialog.exec() == QDialog::Accepted ) + { + return ui.selectedSummaryCase(); + } + + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCaseCollection* RicCreateNewPlotFromTemplateFeature::selectEnsemble() +{ + RiuPlotMainWindow* plotwindow = RiaGuiApplication::instance()->mainPlotWindow(); + RicSelectCaseOrEnsembleUi ui; + + ui.setEnsembleSelectionMode( true ); + + caf::PdmUiPropertyViewDialog propertyDialog( plotwindow, &ui, "Create New Plot - Select Ensemble", "" ); + propertyDialog.resize( QSize( 400, 200 ) ); + + if ( propertyDialog.exec() == QDialog::Accepted ) + { + return ui.selectedEnsemble(); + } + + return nullptr; +} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateNewPlotFromTemplateFeature.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateNewPlotFromTemplateFeature.h new file mode 100644 index 0000000000..3712ec5be1 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreateNewPlotFromTemplateFeature.h @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +class RimSummaryCase; +class RimSummaryCaseCollection; + +//================================================================================================== +/// +//================================================================================================== +class RicCreateNewPlotFromTemplateFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + +private: + RimSummaryCase* selectSummaryCase(); + RimSummaryCaseCollection* selectEnsemble(); +}; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp index 77a8433b5e..1909f6e78d 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicCreatePlotFromTemplateByShortcutFeature.cpp @@ -47,7 +47,7 @@ bool RicCreatePlotFromTemplateByShortcutFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicCreatePlotFromTemplateByShortcutFeature::onActionTriggered( bool isChecked ) { - QString fileName = RiaPreferences::current()->defaultPlotTemplateAbsolutePath(); + QString fileName = RiaPreferences::current()->lastUsedPlotTemplateAbsolutePath(); if ( !QFile::exists( fileName ) ) { diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.cpp index 7af55df646..d83da0d050 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicEditPlotTemplateFeature.cpp @@ -88,5 +88,4 @@ void RicEditPlotTemplateFeature::onActionTriggered( bool isChecked ) void RicEditPlotTemplateFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setText( "Edit" ); - actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.cpp index 78672c3a31..a180372d95 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicRenamePlotTemplateFeature.cpp @@ -95,5 +95,4 @@ void RicRenamePlotTemplateFeature::onActionTriggered( bool isChecked ) void RicRenamePlotTemplateFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setText( "Rename" ); - actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp index 36f1a81781..c5ced2b877 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp @@ -89,7 +89,13 @@ void RicSaveMultiPlotTemplateFeature::onActionTriggered( bool isChecked ) caf::PdmUiPropertyViewDialog propertyDialog( RiuPlotMainWindow::instance(), &settings, "Export Plot Template", "" ); if ( propertyDialog.exec() != QDialog::Accepted ) return; - QString fileName = settings.filePath() + "/" + settings.name() + ".rpt"; + auto plot = selectedSummaryPlot(); + if ( !plot ) return; + + QString ext = ".rpt"; + if ( selectedSummaryPlot()->curveSets().size() > 0 ) ext = ".erpt"; + + QString fileName = settings.filePath() + "/" + settings.name() + ext; if ( !fileName.isEmpty() ) { QFile exportFile( fileName ); diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp new file mode 100644 index 0000000000..d669925c66 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp @@ -0,0 +1,134 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicSelectCaseOrEnsembleUi.h" + +#include "RimProject.h" +#include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" + +CAF_PDM_SOURCE_INIT( RicSelectCaseOrEnsembleUi, "RicSelectCaseOrEnsembleUi" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RicSelectCaseOrEnsembleUi::RicSelectCaseOrEnsembleUi() + : m_useEnsembleMode( false ) +{ + CAF_PDM_InitObject( "RicSelectCaseOrEnsembleUi" ); + + CAF_PDM_InitFieldNoDefault( &m_selectedSummaryCase, "SelectedSummaryCase", "Summary Case" ); + m_selectedSummaryCase.uiCapability()->setAutoAddingOptionFromValue( false ); + + CAF_PDM_InitFieldNoDefault( &m_selectedEnsemble, "SelectedEnsemble", "Ensemble" ); + m_selectedEnsemble.uiCapability()->setAutoAddingOptionFromValue( false ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSelectCaseOrEnsembleUi::setEnsembleSelectionMode( bool ensembleMode ) +{ + m_useEnsembleMode = ensembleMode; + + RimProject* proj = RimProject::current(); + + if ( ensembleMode ) + { + std::vector groups = proj->summaryGroups(); + + for ( RimSummaryCaseCollection* group : groups ) + { + if ( group->isEnsemble() ) + { + m_selectedEnsemble = group; + break; + } + } + } + else + { + std::vector cases = proj->allSummaryCases(); + if ( cases.size() > 0 ) m_selectedSummaryCase = cases.front(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList + RicSelectCaseOrEnsembleUi::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) +{ + QList options; + + if ( fieldNeedingOptions == &m_selectedSummaryCase ) + { + RimProject* proj = RimProject::current(); + + std::vector cases = proj->allSummaryCases(); + + for ( RimSummaryCase* rimCase : cases ) + { + options.push_back( caf::PdmOptionItemInfo( rimCase->displayCaseName(), rimCase ) ); + } + } + else if ( fieldNeedingOptions == &m_selectedEnsemble ) + { + RimProject* proj = RimProject::current(); + std::vector groups = proj->summaryGroups(); + + for ( RimSummaryCaseCollection* group : groups ) + { + if ( group->isEnsemble() ) options.push_back( caf::PdmOptionItemInfo( group->name(), group ) ); + } + } + + return options; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicSelectCaseOrEnsembleUi::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + if ( m_useEnsembleMode ) + uiOrdering.add( &m_selectedEnsemble ); + else + uiOrdering.add( &m_selectedSummaryCase ); + + uiOrdering.skipRemainingFields(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCase* RicSelectCaseOrEnsembleUi::selectedSummaryCase() const +{ + if ( m_useEnsembleMode ) return nullptr; + + return m_selectedSummaryCase(); +} +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCaseCollection* RicSelectCaseOrEnsembleUi::selectedEnsemble() const +{ + if ( !m_useEnsembleMode ) return nullptr; + + return m_selectedEnsemble(); +} diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.h b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.h new file mode 100644 index 0000000000..bbb77062e6 --- /dev/null +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.h @@ -0,0 +1,56 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafPdmObject.h" +#include "cafPdmPtrField.h" + +#include +#include +#include + +class RimSummaryCase; +class RimSummaryCaseCollection; + +//================================================================================================== +/// +//================================================================================================== +class RicSelectCaseOrEnsembleUi : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RicSelectCaseOrEnsembleUi(); + + void setEnsembleSelectionMode( bool selectEnsemble ); + + RimSummaryCase* selectedSummaryCase() const; + RimSummaryCaseCollection* selectedEnsemble() const; + +protected: + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; + +private: + caf::PdmPtrField m_selectedSummaryCase; + caf::PdmPtrField m_selectedEnsemble; + + bool m_useEnsembleMode; +}; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.cpp index 088e03a826..b6a5b5b088 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSetAsDefaultTemplateFeature.cpp @@ -53,6 +53,8 @@ void RicSetAsDefaultTemplateFeature::onActionTriggered( bool isChecked ) RiaPreferencesSummary::current()->addToDefaultPlotTemplates( file->absoluteFilePath() ); else RiaPreferencesSummary::current()->removeFromDefaultPlotTemplates( file->absoluteFilePath() ); + + file->updateIconState(); } //-------------------------------------------------------------------------------------------------- @@ -67,8 +69,7 @@ void RicSetAsDefaultTemplateFeature::setupActionLook( QAction* actionToSetup ) if ( file != nullptr ) { actionToSetup->setCheckable( true ); - actionToSetup->setChecked( - RiaPreferencesSummary::current()->isDefaultSummaryPlotTemplate( file->absoluteFilePath() ) ); + actionToSetup->setChecked( file->isDefaultTemplate() ); } } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index c0f0a94685..ea6cab589c 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -444,7 +444,7 @@ QString RicSummaryPlotTemplateTools::selectPlotTemplatePath() { QString fileName = ui.selectedPlotTemplates().front()->absoluteFilePath(); - RiaPreferences::current()->setDefaultPlotTemplatePath( fileName ); + RiaPreferences::current()->setLastUsedPlotTemplatePath( fileName ); RiaPreferences::current()->writePreferencesToApplicationStore(); return fileName; diff --git a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.cpp b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.cpp index 6f1d91aa42..78b4bd43ca 100644 --- a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.cpp @@ -20,6 +20,7 @@ #include "RiaFieldHandleTools.h" #include "RiaLogging.h" +#include "RiaPreferencesSummary.h" #include "cafPdmField.h" #include "cafPdmUiFilePathEditor.h" @@ -55,6 +56,9 @@ void RimPlotTemplateFileItem::setFilePath( const QString& filePath ) this->uiCapability()->setUiName( fi.baseName() ); m_absoluteFileName = filePath; + + if ( isEnsembleTemplate() ) + this->uiCapability()->setUiIcon( caf::IconProvider( ":/SummaryEnsembleTemplate16x16.png" ) ); } //-------------------------------------------------------------------------------------------------- @@ -64,3 +68,39 @@ QString RimPlotTemplateFileItem::absoluteFilePath() const { return m_absoluteFileName(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotTemplateFileItem::isEnsembleTemplate() const +{ + return m_absoluteFileName().toLower().endsWith( ".erpt" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotTemplateFileItem::updateIconState() +{ + caf::IconProvider iconProvider = this->uiIconProvider(); + if ( !iconProvider.valid() ) return; + + if ( isDefaultTemplate() ) + { + iconProvider.setOverlayResourceString( ":/CheckOverlay16x16.png" ); + } + else + { + iconProvider.setOverlayResourceString( "" ); + } + + this->setUiIcon( iconProvider ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotTemplateFileItem::isDefaultTemplate() const +{ + return RiaPreferencesSummary::current()->isDefaultSummaryPlotTemplate( absoluteFilePath() ); +} diff --git a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.h b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.h index 6e5d59e15d..ae84a2af8a 100644 --- a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.h +++ b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFileItem.h @@ -36,6 +36,12 @@ class RimPlotTemplateFileItem : public caf::PdmObject void setFilePath( const QString& filePath ); QString absoluteFilePath() const; + bool isEnsembleTemplate() const; + + bool isDefaultTemplate() const; + + void updateIconState(); + private: caf::PdmField m_absoluteFileName; }; diff --git a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp index 55dbc92ac6..6dcd38add2 100644 --- a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp +++ b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.cpp @@ -38,6 +38,7 @@ RimPlotTemplateFolderItem::RimPlotTemplateFolderItem() CAF_PDM_InitObject( "Plot Templates", ":/Folder.png" ); CAF_PDM_InitFieldNoDefault( &m_folderName, "FolderName", "Folder" ); + m_folderName.uiCapability()->setUiReadOnly( true ); CAF_PDM_InitFieldNoDefault( &m_fileNames, "FileNames", "" ); m_fileNames.uiCapability()->setUiTreeHidden( true ); CAF_PDM_InitFieldNoDefault( &m_subFolders, "SubFolders", "" ); @@ -59,7 +60,24 @@ void RimPlotTemplateFolderItem::createRootFolderItemsFromFolderPaths( const QStr m_fileNames.deleteChildren(); m_subFolders.deleteChildren(); - createSubFolderItemsFromFolderPaths( folderPaths ); + createSubFolderItemsFromFolderPaths( folderPaths, RiaPreferences::current()->maxPlotTemplateFoldersDepth() ); + updateIconState(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotTemplateFolderItem::updateIconState() const +{ + for ( auto& folder : m_subFolders() ) + { + folder->updateIconState(); + } + + for ( auto& item : m_fileNames() ) + { + item->updateIconState(); + } } //-------------------------------------------------------------------------------------------------- @@ -101,16 +119,19 @@ void RimPlotTemplateFolderItem::setFolderPath( const QString& path ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotTemplateFolderItem::searchForFileAndFolderNames() +void RimPlotTemplateFolderItem::searchForFileAndFolderNames( int levelsLeft ) { m_fileNames.deleteChildren(); m_subFolders.deleteChildren(); + levelsLeft--; + if ( levelsLeft < 0 ) return; + if ( m_folderName().path().isEmpty() ) { for ( size_t i = 0; i < m_subFolders.size(); ++i ) { - if ( m_subFolders[i] ) m_subFolders[i]->searchForFileAndFolderNames(); + if ( m_subFolders[i] ) m_subFolders[i]->searchForFileAndFolderNames( levelsLeft ); } return; } @@ -121,10 +142,11 @@ void RimPlotTemplateFolderItem::searchForFileAndFolderNames() return; } - // Build a list of all scripts in the specified directory + // Build a list of all templates in the specified directory { QStringList nameFilters; nameFilters << "*.rpt"; + nameFilters << "*.erpt"; QStringList fileList = caf::Utils::getFilesInDirectory( m_folderName().path(), nameFilters, true ); for ( int i = 0; i < fileList.size(); i++ ) @@ -140,7 +162,7 @@ void RimPlotTemplateFolderItem::searchForFileAndFolderNames() } } - if ( searchSubFoldersRecursively() ) + if ( levelsLeft > 0 ) { QStringList folderPaths; @@ -152,23 +174,7 @@ void RimPlotTemplateFolderItem::searchForFileAndFolderNames() folderPaths.push_back( fi.absoluteFilePath() ); } - createSubFolderItemsFromFolderPaths( folderPaths ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotTemplateFolderItem::fieldChangedByUi( const caf::PdmFieldHandle* changedField, - const QVariant& oldValue, - const QVariant& newValue ) -{ - if ( &m_folderName == changedField ) - { - QFileInfo fi( m_folderName().path() ); - this->setUiName( fi.baseName() ); - - this->searchForFileAndFolderNames(); + createSubFolderItemsFromFolderPaths( folderPaths, levelsLeft ); } } @@ -189,6 +195,19 @@ void RimPlotTemplateFolderItem::defineEditorAttribute( const caf::PdmFieldHandle } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotTemplateFolderItem::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) +{ + if ( !m_folderName().path().isEmpty() ) + { + uiOrdering.add( &m_folderName ); + } + + uiOrdering.skipRemainingFields( true ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -209,11 +228,15 @@ void RimPlotTemplateFolderItem::appendOptionItemsForPlotTemplatesRecursively( QL } caf::IconProvider templateIcon( ":/SummaryTemplate16x16.png" ); + caf::IconProvider ensTemplateIcon( ":/SummaryEnsembleTemplate16x16.png" ); auto files = templateFolderItem->fileNames(); for ( auto file : files ) { - caf::PdmOptionItemInfo optionInfo( file->uiName(), file, false, templateIcon ); + caf::IconProvider icon = templateIcon; + if ( file->isEnsembleTemplate() ) icon = ensTemplateIcon; + + caf::PdmOptionItemInfo optionInfo( file->uiName(), file, false, icon ); optionInfo.setLevel( menuLevel ); @@ -224,22 +247,14 @@ void RimPlotTemplateFolderItem::appendOptionItemsForPlotTemplatesRecursively( QL //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotTemplateFolderItem::createSubFolderItemsFromFolderPaths( const QStringList& folderPaths ) +void RimPlotTemplateFolderItem::createSubFolderItemsFromFolderPaths( const QStringList& folderPaths, int levelsLeft ) { for ( const auto& path : folderPaths ) { - RimPlotTemplateFolderItem* scriptLocation = new RimPlotTemplateFolderItem(); - scriptLocation->setFolderPath( path ); - scriptLocation->searchForFileAndFolderNames(); + RimPlotTemplateFolderItem* templateLocation = new RimPlotTemplateFolderItem(); + templateLocation->setFolderPath( path ); + templateLocation->searchForFileAndFolderNames( levelsLeft ); - m_subFolders.push_back( scriptLocation ); + m_subFolders.push_back( templateLocation ); } } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimPlotTemplateFolderItem::searchSubFoldersRecursively() const -{ - return RiaPreferences::current()->searchPlotTemplateFoldersRecursively(); -} diff --git a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.h b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.h index 069685bf92..35a61283ef 100644 --- a/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.h +++ b/ApplicationLibCode/ProjectDataModel/PlotTemplates/RimPlotTemplateFolderItem.h @@ -48,18 +48,17 @@ class RimPlotTemplateFolderItem : public caf::PdmObject static void appendOptionItemsForPlotTemplates( QList& options, RimPlotTemplateFolderItem* templateFolderItem ); + void updateIconState() const; private: - void searchForFileAndFolderNames(); + void searchForFileAndFolderNames( int levelsLeft ); void setFolderPath( const QString& path ); - void createSubFolderItemsFromFolderPaths( const QStringList& folderPaths ); + void createSubFolderItemsFromFolderPaths( const QStringList& folderPaths, int levelsLeft ); - bool searchSubFoldersRecursively() const; - - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; static void appendOptionItemsForPlotTemplatesRecursively( QList& options, RimPlotTemplateFolderItem* templateFolderItem, diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index c7773f1b0d..f66795d28a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1024,6 +1024,8 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() else if ( dynamic_cast( firstUiItem ) || dynamic_cast( firstUiItem ) ) { + menuBuilder << "RicCreateNewPlotFromTemplateFeature"; + menuBuilder << "Separator"; menuBuilder << "RicRenamePlotTemplateFeature"; menuBuilder << "RicDeletePlotTemplateFeature"; menuBuilder << "RicEditPlotTemplateFeature"; From 6a7e2f6033afcebd54fe4eaa0908e2f5c5034a95 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 30 May 2022 15:27:01 +0200 Subject: [PATCH 349/406] #8993 Default Ensemble Curve : Do not show statistics for history vectors --- .../ProjectDataModel/Summary/RimEnsembleCurveSet.cpp | 2 ++ .../ProjectDataModel/Summary/RimEnsembleStatistics.cpp | 8 ++++++++ .../ProjectDataModel/Summary/RimEnsembleStatistics.h | 1 + 3 files changed, 11 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 405726bf8b..eef1eb2a7d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -387,6 +387,8 @@ void RimEnsembleCurveSet::setSummaryAddress( RifEclipseSummaryAddress address ) RimSummaryAddress* summaryAddress = new RimSummaryAddress(); summaryAddress->setAddress( address ); m_objectiveValuesSummaryAddresses.push_back( summaryAddress ); + + m_statistics->setShowStatisticsCurves( !address.isHistoryVector() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp index 27cb5309bc..58f564146b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.cpp @@ -61,6 +61,14 @@ bool RimEnsembleStatistics::isActive() const return m_active; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimEnsembleStatistics::setShowStatisticsCurves( bool show ) +{ + m_active = show; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.h index b8ab31fae6..2fb8bed8c2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatistics.h @@ -35,6 +35,7 @@ class RimEnsembleStatistics : public caf::PdmObject RimEnsembleStatistics( RimEnsembleCurveSetInterface* parentCurveSet = nullptr ); bool isActive() const; + void setShowStatisticsCurves( bool show ); bool hideEnsembleCurves() const { return m_hideEnsembleCurves; } bool basedOnFilteredCases() const { return m_basedOnFilteredCases; } bool showP10Curve() const { return m_showP10Curve; } From c7cf6d19f8f41607742b4f748df8e557dd97df21 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 31 May 2022 07:37:21 +0200 Subject: [PATCH 350/406] #8995 Drag drop summary vector : Optionally include history vector --- .../Application/RiaPreferencesSummary.cpp | 15 +++ .../Application/RiaPreferencesSummary.h | 2 + .../Summary/RimSummaryPlot.cpp | 105 ++++++++++++------ 3 files changed, 86 insertions(+), 36 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp index 31157b72e8..82b228e174 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp @@ -173,6 +173,12 @@ RiaPreferencesSummary::RiaPreferencesSummary() CAF_PDM_InitField( &m_curveColorByPhase, "curveColorByPhase", true, "Curve Color By Phase" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_curveColorByPhase ); + + CAF_PDM_InitField( &m_appendHistoryVectorForDragDrop, + "appendHistoryVectorForDragDrop", + false, + "Append History Vector for Drag/Drop" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_appendHistoryVectorForDragDrop ); } //-------------------------------------------------------------------------------------------------- @@ -273,6 +279,7 @@ void RiaPreferencesSummary::appendItemsToPlottingGroup( caf::PdmUiOrdering& uiOr uiOrdering.add( &m_defaultSummaryHistoryCurveStyle ); uiOrdering.add( &m_curveColorByPhase ); + uiOrdering.add( &m_appendHistoryVectorForDragDrop ); uiOrdering.add( &m_showSummaryTimeAsLongString ); @@ -346,6 +353,14 @@ bool RiaPreferencesSummary::colorCurvesByPhase() const return m_curveColorByPhase(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RiaPreferencesSummary::appendHistoryVectorForDragDrop() const +{ + return m_appendHistoryVectorForDragDrop(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.h b/ApplicationLibCode/Application/RiaPreferencesSummary.h index acfaa97169..d8e75690dd 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.h +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.h @@ -101,6 +101,7 @@ class RiaPreferencesSummary : public caf::PdmObject SummaryRestartFilesImportMode summaryEnsembleImportMode() const; QString defaultSummaryCurvesTextFilter() const; bool colorCurvesByPhase() const; + bool appendHistoryVectorForDragDrop() const; SummaryHistoryCurveStyleMode defaultSummaryHistoryCurveStyle() const; @@ -129,6 +130,7 @@ class RiaPreferencesSummary : public caf::PdmObject caf::PdmField m_defaultSummaryCurvesTextFilter; caf::PdmField m_defaultSummaryHistoryCurveStyle; caf::PdmField m_curveColorByPhase; + caf::PdmField m_appendHistoryVectorForDragDrop; caf::PdmField m_showSummaryTimeAsLongString; caf::PdmField m_useMultipleThreadsWhenLoadingSummaryCases; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 86321c182a..5c1a18e606 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -23,12 +23,14 @@ #include "RiaFieldHandleTools.h" #include "RiaPlotDefines.h" #include "RiaPreferences.h" +#include "RiaPreferencesSummary.h" #include "RiaRegressionTestRunner.h" #include "RiaStdStringTools.h" #include "RiaSummaryAddressAnalyzer.h" #include "RiaSummaryCurveDefinition.h" #include "RiaSummaryTools.h" #include "RiaTimeHistoryCurveResampler.h" +#include "RifReaderEclipseSummary.h" #include "RicfCommandObject.h" @@ -1922,8 +1924,15 @@ std::pair> RimSummaryPlot::handleSummaryCaseD for ( auto& curve : summaryCurves() ) { - const auto curveAddress = curve->summaryAddressY(); - dataVectorMap[curveAddress].insert( curve->summaryCaseY() ); + const auto addr = curve->summaryAddressY(); + dataVectorMap[addr].insert( curve->summaryCaseY() ); + + if ( !addr.isHistoryVector() && RiaPreferencesSummary::current()->appendHistoryVectorForDragDrop() ) + { + auto historyAddr = addr; + historyAddr.setVectorName( addr.vectorName() + RifReaderEclipseSummary::historyIdentifier() ); + dataVectorMap[historyAddr].insert( curve->summaryCaseY() ); + } } for ( const auto& [addr, cases] : dataVectorMap ) @@ -1973,34 +1982,47 @@ std::pair> for ( auto& curveDef : sourceCurveDefs ) { - auto newCurveDef = curveDef; - auto curveAdr = newCurveDef.summaryAddress(); + auto newCurveDef = curveDef; + auto curveAdr = newCurveDef.summaryAddress(); + std::string objectIdentifierString; if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_WELL ) && ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::WELL ) ) { - auto currentObjectString = curveAdr.wellName(); + objectIdentifierString = curveAdr.wellName(); curveAdr.setWellName( droppedName ); newCurveDef.setSummaryAddress( curveAdr ); - newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString ); } else if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_GROUP ) && ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::GROUP ) ) { - auto currentObjectString = curveAdr.groupName(); + objectIdentifierString = curveAdr.groupName(); curveAdr.setGroupName( droppedName ); newCurveDef.setSummaryAddress( curveAdr ); - newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString ); } else if ( ( curveAdr.category() == RifEclipseSummaryAddress::SUMMARY_REGION ) && ( addressCollection->contentType() == RimSummaryAddressCollection::CollectionContentType::REGION ) ) { - auto currentObjectString = std::to_string( curveAdr.regionNumber() ); + objectIdentifierString = std::to_string( curveAdr.regionNumber() ); int droppedRegion = std::stoi( droppedName ); curveAdr.setRegion( droppedRegion ); newCurveDef.setSummaryAddress( curveAdr ); - newCurveDefsWithObjectNames[newCurveDef].insert( currentObjectString ); + } + + if ( !objectIdentifierString.empty() ) + { + newCurveDefsWithObjectNames[newCurveDef].insert( objectIdentifierString ); + const auto& addr = curveDef.summaryAddress(); + if ( !addr.isHistoryVector() && RiaPreferencesSummary::current()->appendHistoryVectorForDragDrop() ) + { + auto historyAddr = addr; + historyAddr.setVectorName( addr.vectorName() + RifReaderEclipseSummary::historyIdentifier() ); + + auto historyCurveDef = newCurveDef; + historyCurveDef.setSummaryAddress( historyAddr ); + newCurveDefsWithObjectNames[historyCurveDef].insert( objectIdentifierString ); + } } } @@ -2032,32 +2054,42 @@ std::pair> RimSummaryPlot::handleSummaryAddre int newCurves = 0; std::vector curves; + std::vector newCurveAddresses; + newCurveAddresses.push_back( summaryAddr->address() ); + if ( !summaryAddr->address().isHistoryVector() && RiaPreferencesSummary::current()->appendHistoryVectorForDragDrop() ) + { + auto historyAddr = summaryAddr->address(); + historyAddr.setVectorName( summaryAddr->address().vectorName() + RifReaderEclipseSummary::historyIdentifier() ); + newCurveAddresses.push_back( historyAddr ); + } + if ( summaryAddr->isEnsemble() ) { std::map> dataVectorMap; for ( auto& curve : curveSets() ) { - const auto curveAddress = curve->summaryAddress(); - dataVectorMap[curveAddress].insert( curve->summaryCaseCollection() ); + const auto addr = curve->summaryAddress(); + dataVectorMap[addr].insert( curve->summaryCaseCollection() ); } auto ensemble = RiaSummaryTools::ensembleById( summaryAddr->ensembleId() ); if ( ensemble ) { - RifEclipseSummaryAddress droppedAddress = summaryAddr->address(); - - bool skipAddress = false; - - if ( dataVectorMap.count( droppedAddress ) > 0 ) + for ( const auto& droppedAddress : newCurveAddresses ) { - skipAddress = ( dataVectorMap[droppedAddress].count( ensemble ) > 0 ); - } + bool skipAddress = false; - if ( !skipAddress ) - { - addNewEnsembleCurveY( droppedAddress, ensemble ); - newCurves++; + if ( dataVectorMap.count( droppedAddress ) > 0 ) + { + skipAddress = ( dataVectorMap[droppedAddress].count( ensemble ) > 0 ); + } + + if ( !skipAddress ) + { + addNewEnsembleCurveY( droppedAddress, ensemble ); + newCurves++; + } } } } @@ -2067,26 +2099,27 @@ std::pair> RimSummaryPlot::handleSummaryAddre for ( auto& curve : summaryCurves() ) { - const auto curveAddress = curve->summaryAddressY(); - dataVectorMap[curveAddress].insert( curve->summaryCaseY() ); + const auto addr = curve->summaryAddressY(); + dataVectorMap[addr].insert( curve->summaryCaseY() ); } auto summaryCase = RiaSummaryTools::summaryCaseById( summaryAddr->caseId() ); if ( summaryCase ) { - RifEclipseSummaryAddress droppedAddress = summaryAddr->address(); - - bool skipAddress = false; - - if ( dataVectorMap.count( droppedAddress ) > 0 ) + for ( const auto& droppedAddress : newCurveAddresses ) { - skipAddress = ( dataVectorMap[droppedAddress].count( summaryCase ) > 0 ); - } + bool skipAddress = false; - if ( !skipAddress ) - { - curves.push_back( addNewCurveY( droppedAddress, summaryCase ) ); - newCurves++; + if ( dataVectorMap.count( droppedAddress ) > 0 ) + { + skipAddress = ( dataVectorMap[droppedAddress].count( summaryCase ) > 0 ); + } + + if ( !skipAddress ) + { + curves.push_back( addNewCurveY( droppedAddress, summaryCase ) ); + newCurves++; + } } } } From 33f0831de5ffaab7bc2c2ec5b2e23de92f36cfcc Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 31 May 2022 13:31:47 +0200 Subject: [PATCH 351/406] #8982 Allow mouse wheel zoom for a single sub plot --- .../ProjectDataModel/Summary/RimSummaryMultiPlot.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index d4b3337c42..2bfb4b84f6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -198,6 +198,9 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); RimMultiPlot::insertPlot( plot, index ); } + + if ( summaryPlots().size() == 1 ) m_disableWheelZoom = false; + if ( summaryPlots().size() == 2 ) m_disableWheelZoom = true; } //-------------------------------------------------------------------------------------------------- From bf8ca661329fd06e04463208f6c31461da124458 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 31 May 2022 14:58:10 +0200 Subject: [PATCH 352/406] #8983 Improve default dock window layout --- .../UserInterface/RiuPlotMainWindow.cpp | 48 ++++++++++++++----- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 8ada2ed27a..adcd5f29ef 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -483,9 +483,15 @@ void RiuPlotMainWindow::createDockPanels() RiuDockWidgetTools::plotMainWindowTemplateTreeName(), RiuDockWidgetTools::plotMainWindowScriptsTreeName() }; + const std::vector defaultDockWidgetArea{ Qt::LeftDockWidgetArea, + Qt::RightDockWidgetArea, + Qt::LeftDockWidgetArea, + Qt::LeftDockWidgetArea }; + createTreeViews( nTreeViews ); - QDockWidget* dockOntopOfWidget = nullptr; + std::vector rightTabbedWidgets; + std::vector leftTabbedWidgets; for ( int i = 0; i < nTreeViews; i++ ) { @@ -513,19 +519,12 @@ void RiuPlotMainWindow::createDockPanels() RiuTreeViewEventFilter* treeViewEventFilter = new RiuTreeViewEventFilter( this, projectTree ); projectTree->treeView()->installEventFilter( treeViewEventFilter ); - addDockWidget( Qt::LeftDockWidgetArea, dockWidget ); + addDockWidget( defaultDockWidgetArea[i], dockWidget ); - if ( dockOntopOfWidget ) - { - tabifyDockWidget( dockOntopOfWidget, dockWidget ); - } - else - { - dockOntopOfWidget = dockWidget; - } + if ( defaultDockWidgetArea[i] == Qt::LeftDockWidgetArea ) leftTabbedWidgets.push_back( dockWidget ); + if ( defaultDockWidgetArea[i] == Qt::RightDockWidgetArea ) rightTabbedWidgets.push_back( dockWidget ); connect( dockWidget, SIGNAL( visibilityChanged( bool ) ), projectTree, SLOT( treeVisibilityChanged( bool ) ) ); - connect( projectTree, SIGNAL( selectionChanged() ), this, SLOT( selectedObjectsChanged() ) ); projectTree->treeView()->setContextMenuPolicy( Qt::CustomContextMenu ); @@ -568,7 +567,10 @@ void RiuPlotMainWindow::createDockPanels() m_summaryPlotManager = std::move( plotManager ); dockWidget->setWidget( m_summaryPlotManagerView.get() ); - addDockWidget( Qt::BottomDockWidgetArea, dockWidget ); + addDockWidget( Qt::RightDockWidgetArea, dockWidget ); + + rightTabbedWidgets.push_back( dockWidget ); + dockWidget->hide(); } @@ -580,10 +582,32 @@ void RiuPlotMainWindow::createDockPanels() dockWidget->setWidget( m_undoView ); addDockWidget( Qt::RightDockWidgetArea, dockWidget ); + rightTabbedWidgets.push_back( dockWidget ); dockWidget->hide(); } + { + QDockWidget* topDock = nullptr; + for ( auto d : leftTabbedWidgets ) + { + if ( !topDock ) + topDock = d; + else + tabifyDockWidget( topDock, d ); + } + } + { + QDockWidget* topDock = nullptr; + for ( auto d : rightTabbedWidgets ) + { + if ( !topDock ) + topDock = d; + else + tabifyDockWidget( topDock, d ); + } + } + setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea ); setCorner( Qt::BottomRightCorner, Qt::BottomDockWidgetArea ); From 75d096eca29a4e561e271b5a9fea4c917dec5f18 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 30 May 2022 13:57:58 +0200 Subject: [PATCH 353/406] #8540 Python: read only active cells for active_cell_property --- GrpcInterface/RiaGrpcPropertiesService.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/GrpcInterface/RiaGrpcPropertiesService.cpp b/GrpcInterface/RiaGrpcPropertiesService.cpp index 0cb7a6d6e1..2c596c584c 100644 --- a/GrpcInterface/RiaGrpcPropertiesService.cpp +++ b/GrpcInterface/RiaGrpcPropertiesService.cpp @@ -248,12 +248,31 @@ class RiaActiveCellResultsStateHandler : public RiaCellResultsStateHandler RigEclipseResultAddress resVarAddr ) override { auto activeCellInfo = caseData->activeCellInfo( porosityModel ); + m_cellCount = activeCellInfo->reservoirActiveCellCount(); m_resultValues = caseData->results( porosityModel )->modifiableCellScalarResult( resVarAddr, timeStepIndex ); if ( m_resultValues->empty() ) { m_resultValues->resize( activeCellInfo->reservoirActiveCellCount() ); } - m_cellCount = activeCellInfo->reservoirActiveCellCount(); + else if ( m_resultValues->size() != m_cellCount ) + { + // Filter out inactive cells + std::vector activeCellResultValues( m_cellCount ); + size_t reservoirCellCount = activeCellInfo->reservoirCellCount(); + for ( size_t cellIdx = 0; cellIdx < reservoirCellCount; cellIdx++ ) + { + size_t activeCellIdx = caseData->activeCellInfo( m_porosityModel )->cellResultIndex( cellIdx ); + if ( activeCellIdx != cvf::UNDEFINED_SIZE_T ) + activeCellResultValues[activeCellIdx] = ( *m_resultValues )[cellIdx]; + } + + // Use the filtered result + m_resultValues->resize( m_cellCount ); + for ( size_t activeIdx = 0; activeIdx < m_cellCount; activeIdx++ ) + { + ( *m_resultValues )[activeIdx] = activeCellResultValues[activeIdx]; + } + } } double cellResult( size_t currentCellIndex ) const override { return ( *m_resultValues )[currentCellIndex]; } From cf9f69b62062e23139459e7810d95a56dc9d60ef Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Wed, 1 Jun 2022 13:41:16 +0200 Subject: [PATCH 354/406] Fix plot layout after plot visibility filter has been applied --- .../ProjectDataModel/Summary/RimSummaryMultiPlot.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 2bfb4b84f6..705f5b1094 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -147,11 +147,11 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Aggregation" ); - CAF_PDM_InitField( &m_hidePlotsWithValuesBelow, "HidePlotsWithValuesBelow", false, "Hide Plots With Values Below" ); + CAF_PDM_InitField( &m_hidePlotsWithValuesBelow, "HidePlotsWithValuesBelow", false, "" ); m_hidePlotsWithValuesBelow.xmlCapability()->disableIO(); m_hidePlotsWithValuesBelow.uiCapability()->setUiEditorTypeName( caf::PdmUiPushButtonEditor::uiEditorTypeName() ); - CAF_PDM_InitField( &m_plotFilterYAxisThreshold, "PlotFilterYAxisThreshold", 0.0, "Y-Axis Threshold" ); + CAF_PDM_InitField( &m_plotFilterYAxisThreshold, "PlotFilterYAxisThreshold", 0.0, "Y-Axis Filter Threshold" ); CAF_PDM_InitFieldNoDefault( &m_sourceStepping, "SourceStepping", "" ); @@ -382,8 +382,8 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde if ( m_autoAdjustAppearance() ) m_linkSubPlotAxes = false; auto plotVisibilityFilterGroup = uiOrdering.addNewGroup( "Plot Visibility Filter" ); - plotVisibilityFilterGroup->add( &m_hidePlotsWithValuesBelow ); plotVisibilityFilterGroup->add( &m_plotFilterYAxisThreshold ); + plotVisibilityFilterGroup->add( &m_hidePlotsWithValuesBelow ); auto dataSourceGroup = uiOrdering.addNewGroup( "Data Source" ); dataSourceGroup->setCollapsedByDefault( true ); @@ -1036,6 +1036,8 @@ void RimSummaryMultiPlot::updatePlotVisibility() plot->setShowWindow( hasValueAboveLimit ); } + updateLayout(); + if ( !m_viewer.isNull() ) m_viewer->scheduleUpdate(); } From cbe731d1873e96b14a374429bfeb697031e417b8 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 1 Jun 2022 12:53:15 +0200 Subject: [PATCH 355/406] #8994 Plot axis range : Fix incorrect reset of user-defined min max value --- .../ProjectDataModel/Summary/RimSummaryMultiPlot.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 705f5b1094..a59a1c4ab5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -700,6 +700,9 @@ void RimSummaryMultiPlot::onLoadDataAndUpdate() //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::zoomAll() { + // Reset zoom to make sure the complete range for min/max is available + RimMultiPlot::zoomAll(); + syncAxisRanges(); } @@ -782,14 +785,15 @@ void RimSummaryMultiPlot::checkAndApplyAutoAppearance() //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::syncAxisRanges() { - // Reset zoom to make sure the complete range for min/max is available - RimMultiPlot::zoomAll(); - if ( m_axisRangeAggregation() == AxisRangeAggregation::INDIVIDUAL ) { return; } - else if ( m_axisRangeAggregation() == AxisRangeAggregation::SUB_PLOTS ) + + // Reset zoom to make sure the complete range for min/max is available + RimMultiPlot::zoomAll(); + + if ( m_axisRangeAggregation() == AxisRangeAggregation::SUB_PLOTS ) { std::map> axisRanges; From 41904df681a9caf9a0716898c2b9fa8cd0ab9030 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 2 Jun 2022 06:50:14 +0200 Subject: [PATCH 356/406] New feature: delete unchecked subitems (#9010) * New feature: delete unchecked subitems --- .../Commands/CMakeLists_files.cmake | 4 +- .../Commands/RicDeleteSubItemsFeature.cpp | 179 ++++++++++++------ .../Commands/RicDeleteSubItemsFeature.h | 8 +- .../RicDeleteUncheckedSubItemsFeature.cpp | 54 ++++++ .../RicDeleteUncheckedSubItemsFeature.h | 39 ++++ .../RimWellPathFractureCollection.cpp | 8 + .../RimWellPathFractureCollection.h | 1 + .../RimContextCommandBuilder.cpp | 1 + .../Summary/RimSummaryMultiPlotCollection.cpp | 9 + .../Summary/RimSummaryMultiPlotCollection.h | 1 + 10 files changed, 245 insertions(+), 59 deletions(-) create mode 100644 ApplicationLibCode/Commands/RicDeleteUncheckedSubItemsFeature.cpp create mode 100644 ApplicationLibCode/Commands/RicDeleteUncheckedSubItemsFeature.h diff --git a/ApplicationLibCode/Commands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/CMakeLists_files.cmake index 1c69971c48..87bd2880c6 100644 --- a/ApplicationLibCode/Commands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/CMakeLists_files.cmake @@ -29,7 +29,6 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/Ric3dViewPickEventHandler.h ${CMAKE_CURRENT_LIST_DIR}/RicContourMapPickEventHandler.h ${CMAKE_CURRENT_LIST_DIR}/RicVec3dPickEventHandler.h - # General delete of any object in a child array field ${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemExec.h ${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemExecData.h ${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemFeature.h @@ -85,6 +84,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicCalculatorWidgetCreator.h ${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorUi.h ${CMAKE_CURRENT_LIST_DIR}/RicShowDataSourcesForRealization.h + ${CMAKE_CURRENT_LIST_DIR}/RicDeleteUncheckedSubItemsFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -117,7 +117,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/Ric3dViewPickEventHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/RicContourMapPickEventHandler.cpp ${CMAKE_CURRENT_LIST_DIR}/RicVec3dPickEventHandler.cpp - # General delete of any object in a child array field ${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemExec.cpp ${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemExecData.cpp ${CMAKE_CURRENT_LIST_DIR}/RicDeleteItemFeature.cpp @@ -173,6 +172,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicCalculatorWidgetCreator.cpp ${CMAKE_CURRENT_LIST_DIR}/RicUserDefinedCalculatorUi.cpp ${CMAKE_CURRENT_LIST_DIR}/RicShowDataSourcesForRealization.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicDeleteUncheckedSubItemsFeature.cpp ) if(RESINSIGHT_USE_QT_CHARTS) diff --git a/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp b/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp index 6784144212..2a0863de91 100644 --- a/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp +++ b/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.cpp @@ -21,7 +21,9 @@ #include "RimProject.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryMultiPlotCollection.h" +#include "RimWellPath.h" #include "RimWellPathCollection.h" +#include "RimWellPathFracture.h" #include "RimWellPathFractureCollection.h" #include "cafPdmUiItem.h" @@ -35,6 +37,14 @@ CAF_CMD_SOURCE_INIT( RicDeleteSubItemsFeature, "RicDeleteSubItemsFeature" ); /// //-------------------------------------------------------------------------------------------------- bool RicDeleteSubItemsFeature::isCommandEnabled() +{ + return RicDeleteSubItemsFeature::canCommandBeEnabled(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicDeleteSubItemsFeature::canCommandBeEnabled() { std::vector items; caf::SelectionManager::instance()->selectedItems( items ); @@ -54,60 +64,8 @@ bool RicDeleteSubItemsFeature::isCommandEnabled() //-------------------------------------------------------------------------------------------------- void RicDeleteSubItemsFeature::onActionTriggered( bool isChecked ) { - std::vector items; - caf::SelectionManager::instance()->selectedItems( items ); - - CVF_ASSERT( items.size() > 0 ); - - for ( auto item : items ) - { - if ( !RicDeleteSubItemsFeature::hasDeletableSubItems( item ) ) continue; - - { - auto multiPlot = dynamic_cast( item ); - if ( multiPlot ) - { - multiPlot->deleteAllPlots(); - - multiPlot->updateConnectedEditors(); - } - } - - { - auto collection = dynamic_cast( item ); - if ( collection ) - { - collection->deleteAllPlots(); - - collection->updateConnectedEditors(); - } - } - - { - auto collection = dynamic_cast( item ); - if ( collection ) - { - collection->deleteAllWellPaths(); - - collection->updateConnectedEditors(); - collection->scheduleRedrawAffectedViews(); - } - } - - { - auto collection = dynamic_cast( item ); - if ( collection ) - { - collection->deleteFractures(); - - collection->updateConnectedEditors(); - - RimProject* proj = nullptr; - collection->firstAncestorOrThisOfType( proj ); - if ( proj ) proj->reloadCompletionTypeResultsInAllViews(); - } - } - } + bool onlyUnchecked = false; + RicDeleteSubItemsFeature::deleteSubItems( onlyUnchecked ); } //-------------------------------------------------------------------------------------------------- @@ -159,3 +117,116 @@ bool RicDeleteSubItemsFeature::hasDeletableSubItems( caf::PdmUiItem* uiItem ) return false; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteSubItemsFeature::deleteSubItems( bool onlyDeleteUnchecked ) +{ + std::vector items; + caf::SelectionManager::instance()->selectedItems( items ); + + CVF_ASSERT( items.size() > 0 ); + + for ( auto item : items ) + { + if ( !RicDeleteSubItemsFeature::hasDeletableSubItems( item ) ) continue; + + { + auto multiPlot = dynamic_cast( item ); + if ( multiPlot ) + { + if ( onlyDeleteUnchecked ) + { + auto plots = multiPlot->plots(); + for ( auto plot : plots ) + { + if ( plot->showWindow() ) continue; + multiPlot->removePlotNoUpdate( plot ); + delete plot; + } + } + else + { + multiPlot->deleteAllPlots(); + } + + multiPlot->updateConnectedEditors(); + } + } + + { + auto collection = dynamic_cast( item ); + if ( collection ) + { + if ( onlyDeleteUnchecked ) + { + auto plots = collection->multiPlots(); + for ( auto plot : plots ) + { + if ( plot->showWindow() ) continue; + collection->removePlotNoUpdate( plot ); + delete plot; + } + } + else + { + collection->deleteAllPlots(); + } + + collection->updateConnectedEditors(); + } + } + + { + auto collection = dynamic_cast( item ); + if ( collection ) + { + if ( onlyDeleteUnchecked ) + { + auto paths = collection->allWellPaths(); + for ( auto path : paths ) + { + if ( path->showWellPath() ) continue; + collection->removeWellPath( path ); + delete path; + } + } + else + { + collection->deleteAllWellPaths(); + } + + collection->updateConnectedEditors(); + collection->scheduleRedrawAffectedViews(); + } + } + + { + auto collection = dynamic_cast( item ); + if ( collection ) + { + if ( onlyDeleteUnchecked ) + { + auto items = collection->allFractures(); + for ( auto item : items ) + { + if ( item->isChecked() ) continue; + collection->removeFracture( item ); + delete item; + } + } + else + { + collection->deleteFractures(); + } + + collection->updateConnectedEditors(); + + RimProject* proj = nullptr; + collection->firstAncestorOrThisOfType( proj ); + if ( proj ) proj->reloadCompletionTypeResultsInAllViews(); + } + } + } +} diff --git a/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.h b/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.h index eda5e8497f..2ae8ffe806 100644 --- a/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.h +++ b/ApplicationLibCode/Commands/RicDeleteSubItemsFeature.h @@ -32,11 +32,13 @@ class RicDeleteSubItemsFeature : public caf::CmdFeature { CAF_CMD_HEADER_INIT; +public: + static bool hasDeletableSubItems( caf::PdmUiItem* uiItem ); + static void deleteSubItems( bool onlyDeleteUnchecked ); + static bool canCommandBeEnabled(); + protected: bool isCommandEnabled() override; void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; - -private: - static bool hasDeletableSubItems( caf::PdmUiItem* uiItem ); }; diff --git a/ApplicationLibCode/Commands/RicDeleteUncheckedSubItemsFeature.cpp b/ApplicationLibCode/Commands/RicDeleteUncheckedSubItemsFeature.cpp new file mode 100644 index 0000000000..32da49d4b3 --- /dev/null +++ b/ApplicationLibCode/Commands/RicDeleteUncheckedSubItemsFeature.cpp @@ -0,0 +1,54 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicDeleteUncheckedSubItemsFeature.h" + +#include "RicDeleteSubItemsFeature.h" + +#include "cafPdmUiItem.h" +#include "cafSelectionManager.h" + +#include + +CAF_CMD_SOURCE_INIT( RicDeleteUncheckedSubItemsFeature, "RicDeleteUncheckedSubItemsFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicDeleteUncheckedSubItemsFeature::isCommandEnabled() +{ + return RicDeleteSubItemsFeature::canCommandBeEnabled(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteUncheckedSubItemsFeature::onActionTriggered( bool isChecked ) +{ + bool onlyUnchecked = true; + RicDeleteSubItemsFeature::deleteSubItems( onlyUnchecked ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicDeleteUncheckedSubItemsFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Delete Unchecked Sub Items" ); + actionToSetup->setIcon( QIcon( ":/Erase.svg" ) ); +} diff --git a/ApplicationLibCode/Commands/RicDeleteUncheckedSubItemsFeature.h b/ApplicationLibCode/Commands/RicDeleteUncheckedSubItemsFeature.h new file mode 100644 index 0000000000..b046e4e5e7 --- /dev/null +++ b/ApplicationLibCode/Commands/RicDeleteUncheckedSubItemsFeature.h @@ -0,0 +1,39 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +namespace caf +{ +class PdmUiItem; +} + +//================================================================================================== +/// +//================================================================================================== +class RicDeleteUncheckedSubItemsFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp index 2317133b9d..faf3eaefb3 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.cpp @@ -64,6 +64,14 @@ void RimWellPathFractureCollection::addFracture( RimWellPathFracture* fracture ) m_fractures.push_back( fracture ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellPathFractureCollection::removeFracture( RimWellPathFracture* fracture ) +{ + m_fractures.removeChild( fracture ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.h b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.h index 054e484b7b..10fdc4783a 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFractureCollection.h @@ -43,6 +43,7 @@ class RimWellPathFractureCollection : public RimCheckableNamedObject bool hasFractures() const; void addFracture( RimWellPathFracture* fracture ); + void removeFracture( RimWellPathFracture* fracture ); void deleteFractures(); std::vector allFractures() const; diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index f66795d28a..6167139ac9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1305,6 +1305,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() if ( caf::CmdFeatureManager::instance()->getCommandFeature( "RicDeleteSubItemsFeature" )->canFeatureBeExecuted() ) { menuBuilder << "Separator"; + menuBuilder << "RicDeleteUncheckedSubItemsFeature"; menuBuilder << "RicDeleteSubItemsFeature"; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp index e4cc52336d..018e4fe6d4 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -83,6 +83,15 @@ void RimSummaryMultiPlotCollection::addSummaryMultiPlot( RimSummaryMultiPlot* pl plot->duplicatePlot.connect( this, &RimSummaryMultiPlotCollection::onDuplicatePlot ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlotCollection::removePlotNoUpdate( RimSummaryMultiPlot* plot ) +{ + if ( plot == nullptr ) return; + m_summaryMultiPlots().removeChild( plot ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h index aab20f1ff5..b207d09a6f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.h @@ -48,6 +48,7 @@ class RimSummaryMultiPlotCollection : public caf::PdmObject, public RimPlotColle void addSummaryMultiPlot( RimSummaryMultiPlot* plot ); void summaryPlotItemInfos( QList* optionInfos ) const; void duplicatePlot( RimSummaryMultiPlot* plotToDuplicate ); + void removePlotNoUpdate( RimSummaryMultiPlot* plotToRemove ); void updateSummaryNameHasChanged(); From fd7821a10b810c59d061d96f911f09a8f427accc Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 2 Jun 2022 06:53:05 +0200 Subject: [PATCH 357/406] Add preferences setting for maximum search depth in script folders. Clean up context menu a bit. (#9012) --- .../Application/RiaApplication.cpp | 4 +- .../Application/RiaPreferences.cpp | 11 +++++ .../Application/RiaPreferences.h | 6 ++- .../RicDeleteScriptPathFeature.cpp | 4 ++ .../RicNewPythonScriptFeature.cpp | 3 +- .../RicRefreshScriptsFeature.cpp | 2 +- .../RicReloadPlotTemplatesFeature.cpp | 2 +- .../ProjectDataModel/RimCalcScript.cpp | 2 +- .../ProjectDataModel/RimProject.cpp | 4 +- .../ProjectDataModel/RimProject.h | 2 +- .../ProjectDataModel/RimScriptCollection.cpp | 40 +++++-------------- .../ProjectDataModel/RimScriptCollection.h | 12 ++---- 12 files changed, 44 insertions(+), 48 deletions(-) diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 8b6a5b3e39..5a2567920e 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -1223,7 +1223,7 @@ void RiaApplication::applyPreferences() if ( this->project() ) { - this->project()->setScriptDirectories( m_preferences->scriptDirectories() ); + this->project()->setScriptDirectories( m_preferences->scriptDirectories(), m_preferences->maxScriptFoldersDepth() ); this->project()->setPlotTemplateFolders( m_preferences->plotTemplateFolders() ); project()->scriptCollection()->updateConnectedEditors(); @@ -1510,7 +1510,7 @@ void RiaApplication::initialize() // Start with a project m_project = std::make_unique(); - m_project->setScriptDirectories( m_preferences->scriptDirectories() ); + m_project->setScriptDirectories( m_preferences->scriptDirectories(), m_preferences->maxScriptFoldersDepth() ); m_project->setPlotTemplateFolders( m_preferences->plotTemplateFolders() ); caf::SelectionManager::instance()->setPdmRootObject( project() ); diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index f1d7970401..83d1a611ca 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -113,6 +113,8 @@ RiaPreferences::RiaPreferences() CAF_PDM_InitField( &scriptEditorExecutable, "scriptEditorExecutable", defaultTextEditor, "Script Editor" ); scriptEditorExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); + CAF_PDM_InitField( &m_maxScriptFoldersDepth, "MaxScriptFoldersDepth", 2, "Maximum Scripts Folder Search Depth" ); + CAF_PDM_InitField( &m_octaveExecutable, "octaveExecutable", QString( "octave" ), "Octave Executable Location" ); m_octaveExecutable.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); m_octaveExecutable.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::TOP ); @@ -426,6 +428,7 @@ void RiaPreferences::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& #endif caf::PdmUiGroup* scriptGroup = uiOrdering.addNewGroup( "Script files" ); scriptGroup->add( &scriptDirectories ); + scriptGroup->add( &m_maxScriptFoldersDepth ); scriptGroup->add( &scriptEditorExecutable ); } #ifdef USE_ODB_API @@ -667,6 +670,14 @@ QString RiaPreferences::dateTimeFormat( RiaDefines::DateFormatComponents dateCom .arg( RiaQDateTimeTools::timeFormatString( m_timeFormat(), timeComponents ) ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiaPreferences::maxScriptFoldersDepth() const +{ + return m_maxScriptFoldersDepth(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferences.h b/ApplicationLibCode/Application/RiaPreferences.h index 620fbe2c5c..2606cadbbb 100644 --- a/ApplicationLibCode/Application/RiaPreferences.h +++ b/ApplicationLibCode/Application/RiaPreferences.h @@ -76,7 +76,9 @@ class RiaPreferences : public caf::PdmObject RiaDefines::DateFormatComponents dateComponents = RiaDefines::DateFormatComponents::DATE_FORMAT_YEAR_MONTH_DAY, RiaDefines::TimeFormatComponents timeComponents = RiaDefines::TimeFormatComponents::TIME_FORMAT_HOUR_MINUTE_SECOND ) const; - int maxPlotTemplateFoldersDepth() const; + int maxScriptFoldersDepth() const; + int maxPlotTemplateFoldersDepth() const; + QStringList plotTemplateFolders() const; void appendPlotTemplateFolders( const QString& folder ); QString lastUsedPlotTemplateAbsolutePath() const; @@ -173,6 +175,8 @@ class RiaPreferences : public caf::PdmObject caf::PdmField> m_guiTheme; + caf::PdmField m_maxScriptFoldersDepth; + caf::PdmField m_pageSize; caf::PdmField m_pageOrientation; caf::PdmField m_pageLeftMargin; diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp b/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp index 919a2fcbd2..9c230fe3d0 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicDeleteScriptPathFeature.cpp @@ -41,6 +41,10 @@ CAF_CMD_SOURCE_INIT( RicDeleteScriptPathFeature, "RicDeleteScriptPathFeature" ); bool RicDeleteScriptPathFeature::isCommandEnabled() { std::vector selection = RicScriptFeatureImpl::selectedScriptCollections(); + if ( selection.size() == 1 ) + { + if ( selection.front()->directory().isEmpty() ) return false; + } return selection.size() > 0; } diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp index f829588820..f86e0ce6c9 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp @@ -21,6 +21,7 @@ #include "RiaApplication.h" #include "RiaLogging.h" +#include "RiaPreferences.h" #include "RicRefreshScriptsFeature.h" #include "RicScriptFeatureImpl.h" @@ -124,7 +125,7 @@ void RicNewPythonScriptFeature::onActionTriggered( bool isChecked ) "resinsight.version_string())\n"; } - scriptColl->readContentFromDisc(); + scriptColl->readContentFromDisc( RiaPreferences::current()->maxScriptFoldersDepth() ); scriptColl->updateConnectedEditors(); if ( calcScript ) diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicRefreshScriptsFeature.cpp b/ApplicationLibCode/Commands/OctaveScriptCommands/RicRefreshScriptsFeature.cpp index 5026f02665..86bf9e8886 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicRefreshScriptsFeature.cpp +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicRefreshScriptsFeature.cpp @@ -60,6 +60,6 @@ void RicRefreshScriptsFeature::refreshScriptFolders() RimProject* proj = RimProject::current(); RiaPreferences* prefs = RiaPreferences::current(); - proj->setScriptDirectories( prefs->scriptDirectories() ); + proj->setScriptDirectories( prefs->scriptDirectories(), prefs->maxScriptFoldersDepth() ); proj->scriptCollection()->updateConnectedEditors(); } diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.cpp index edcf4bf9ce..c23eaa11c5 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicReloadPlotTemplatesFeature.cpp @@ -61,5 +61,5 @@ void RicReloadPlotTemplatesFeature::onActionTriggered( bool isChecked ) void RicReloadPlotTemplatesFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setText( "Reload Templates" ); - actionToSetup->setIcon( QIcon( ":/SummaryTemplate16x16.png" ) ); + actionToSetup->setIcon( QIcon( ":/Refresh.svg" ) ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimCalcScript.cpp b/ApplicationLibCode/ProjectDataModel/RimCalcScript.cpp index 5e44977b2a..712f824b70 100644 --- a/ApplicationLibCode/ProjectDataModel/RimCalcScript.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimCalcScript.cpp @@ -37,7 +37,7 @@ RimCalcScript::RimCalcScript() CAF_PDM_InitObject( "CalcScript", ":/OctaveScriptFile16x16.png", "Calc Script", "" ); CAF_PDM_InitField( &absoluteFileName, "AbsolutePath", QString(), "Location" ); - + absoluteFileName.uiCapability()->setUiReadOnly( true ); absoluteFileName.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index cc5cd25974..2b898a8b06 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -376,7 +376,7 @@ bool RimProject::writeProjectFile() //-------------------------------------------------------------------------------------------------- /// Support list of multiple script paths divided by ';' //-------------------------------------------------------------------------------------------------- -void RimProject::setScriptDirectories( const QString& scriptDirectories ) +void RimProject::setScriptDirectories( const QString& scriptDirectories, int maxFolderDepth ) { scriptCollection->calcScripts().deleteChildren(); scriptCollection->subDirectories().deleteChildren(); @@ -391,7 +391,7 @@ void RimProject::setScriptDirectories( const QString& scriptDirectories ) sharedScriptLocation->directory = path; sharedScriptLocation->setUiName( dir.dirName() ); - sharedScriptLocation->readContentFromDisc(); + sharedScriptLocation->readContentFromDisc( maxFolderDepth ); scriptCollection->subDirectories.push_back( sharedScriptLocation ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index b6f7beb7ec..89d64e4651 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -113,7 +113,7 @@ class RimProject : public caf::PdmDocument bool writeProjectFile(); - void setScriptDirectories( const QString& scriptDirectories ); + void setScriptDirectories( const QString& scriptDirectories, int maxFolderDepth ); void setPlotTemplateFolders( const QStringList& plotTemplateFolders ); QString projectFileVersionString() const; diff --git a/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp index f50221705e..679795298b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimScriptCollection.cpp @@ -38,14 +38,13 @@ RimScriptCollection::RimScriptCollection() CAF_PDM_InitObject( "ScriptLocation", ":/Folder.png" ); CAF_PDM_InitFieldNoDefault( &directory, "ScriptDirectory", "Folder" ); + directory.uiCapability()->setUiReadOnly( true ); + directory.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); + CAF_PDM_InitFieldNoDefault( &calcScripts, "CalcScripts", "" ); calcScripts.uiCapability()->setUiTreeHidden( true ); CAF_PDM_InitFieldNoDefault( &subDirectories, "SubDirectories", "" ); subDirectories.uiCapability()->setUiTreeHidden( true ); - - CAF_PDM_InitField( &m_searchSubFolders, "SearchSubFolders", false, "Add Subfolders" ); - - directory.uiCapability()->setUiEditorTypeName( caf::PdmUiFilePathEditor::uiEditorTypeName() ); } //-------------------------------------------------------------------------------------------------- @@ -60,15 +59,19 @@ RimScriptCollection::~RimScriptCollection() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimScriptCollection::readContentFromDisc() +void RimScriptCollection::readContentFromDisc( int folderLevelsLeft ) { calcScripts.deleteChildren(); + subDirectories.deleteChildren(); + + folderLevelsLeft--; + if ( folderLevelsLeft < 0 ) return; if ( directory().isEmpty() ) { for ( size_t i = 0; i < subDirectories.size(); ++i ) { - if ( subDirectories[i] ) subDirectories[i]->readContentFromDisc(); + if ( subDirectories[i] ) subDirectories[i]->readContentFromDisc( folderLevelsLeft ); } return; } @@ -104,9 +107,7 @@ void RimScriptCollection::readContentFromDisc() } } - subDirectories.deleteChildren(); - - if ( m_searchSubFolders() ) + if ( folderLevelsLeft > 0 ) { QDir dir( directory ); QFileInfoList fileInfoList = dir.entryInfoList( QDir::AllDirs | QDir::NoDotAndDotDot | QDir::Readable ); @@ -120,7 +121,7 @@ void RimScriptCollection::readContentFromDisc() RimScriptCollection* scriptLocation = new RimScriptCollection; scriptLocation->directory = fi.absoluteFilePath(); scriptLocation->setUiName( fi.baseName() ); - scriptLocation->readContentFromDisc(); + scriptLocation->readContentFromDisc( folderLevelsLeft ); subDirectories.push_back( scriptLocation ); } @@ -128,25 +129,6 @@ void RimScriptCollection::readContentFromDisc() } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimScriptCollection::fieldChangedByUi( const caf::PdmFieldHandle* changedField, - const QVariant& oldValue, - const QVariant& newValue ) -{ - if ( &directory == changedField ) - { - QFileInfo fi( directory ); - this->setUiName( fi.baseName() ); - this->readContentFromDisc(); - } - else if ( &m_searchSubFolders == changedField ) - { - this->readContentFromDisc(); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimScriptCollection.h b/ApplicationLibCode/ProjectDataModel/RimScriptCollection.h index afa24804a7..a71529612a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimScriptCollection.h +++ b/ApplicationLibCode/ProjectDataModel/RimScriptCollection.h @@ -43,23 +43,17 @@ class RimScriptCollection : public caf::PdmObject RimScriptCollection(); ~RimScriptCollection() override; -public: // Pdm Fields +public: caf::PdmField directory; caf::PdmChildArrayField calcScripts; caf::PdmChildArrayField subDirectories; -public: // Methods - void readContentFromDisc(); - - // Overrides from PdmObject - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; +public: + void readContentFromDisc( int folderLevelsLeft ); protected: void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - -private: - caf::PdmField m_searchSubFolders; }; From 89773da26e6a56b0ec4262ed2c170ec9ab18be39 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Wed, 1 Jun 2022 17:59:54 +0200 Subject: [PATCH 358/406] Fix intersection crash by making sure we do nothing when top limit is below bottom limit --- .../RivExtrudedCurveIntersectionPartMgr.cpp | 4 ++++ .../Intersections/RimExtrudedCurveIntersection.cpp | 12 ++++++++++++ .../Intersections/RimExtrudedCurveIntersection.h | 5 +++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionPartMgr.cpp b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionPartMgr.cpp index a3126df53e..cd65d860c6 100644 --- a/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/Intersections/RivExtrudedCurveIntersectionPartMgr.cpp @@ -236,6 +236,10 @@ void RivExtrudedCurveIntersectionPartMgr::generatePartGeometry() { if ( m_intersectionGenerator.isNull() ) return; + if ( m_rimIntersection->depthFilterType() == RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN && + ( m_rimIntersection->lowerFilterDepth( 1.0 ) <= m_rimIntersection->upperFilterDepth( 1.0 ) ) ) + return; + bool useBufferObjects = true; // Surface geometry { diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp index fc9fc36464..25760249b8 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.cpp @@ -343,6 +343,18 @@ double RimExtrudedCurveIntersection::upperFilterDepth( double sceneRadius ) cons } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimIntersectionFilterEnum RimExtrudedCurveIntersection::depthFilterType() const +{ + if ( m_depthThresholdOverridden ) + { + return m_collectionDepthFilterType(); + } + return m_depthFilterType(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h index c58febbef6..d1a0a78393 100644 --- a/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h +++ b/ApplicationLibCode/ProjectDataModel/Intersections/RimExtrudedCurveIntersection.h @@ -78,8 +78,9 @@ class RimExtrudedCurveIntersection : public RimIntersection QString name() const override; void setName( const QString& newName ); - double upperFilterDepth( double sceneRadius ) const; - double lowerFilterDepth( double sceneRadius ) const; + double upperFilterDepth( double sceneRadius ) const; + double lowerFilterDepth( double sceneRadius ) const; + RimIntersectionFilterEnum depthFilterType() const; void setDepthOverride( bool collectionOverride ); void setDepthOverrideParameters( double upperThreshold, double lowerThreshold, RimIntersectionFilterEnum filterType ); From 36dab01cf5357d2ee3cfc005d1193cb91fa2510d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 1 Jun 2022 13:43:40 +0200 Subject: [PATCH 359/406] #9009 Data Source Object : Do not allow rename by double-click on item --- .../ProjectDataModel/Summary/RimSummaryAddressCollection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp index 8389d5f766..304a23c616 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryAddressCollection.cpp @@ -76,6 +76,7 @@ RimSummaryAddressCollection::RimSummaryAddressCollection() m_ensembleId.uiCapability()->setUiHidden( true ); nameField()->uiCapability()->setUiHidden( true ); + nameField()->uiCapability()->setUiReadOnly( true ); setUiIconFromResourceString( iconResourceText() ); } From 5e53f5687da4780d0e2c7bce067ec4059b95abf1 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 1 Jun 2022 14:00:35 +0200 Subject: [PATCH 360/406] Improve auto name for curves and plots - use vector name as plot title if a vector and the associated history vector is present - use short vector name as fallback for curve name - use Plot N as fallback name for sub plot --- .../Tools/RiaSummaryAddressAnalyzer.cpp | 5 +++++ .../Summary/RimSummaryCurveAutoName.cpp | 2 ++ .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 15 +++++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp index 15cf0d8568..13d334314c 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp @@ -93,6 +93,11 @@ std::string RiaSummaryAddressAnalyzer::quantityNameForTitle() const return *quantities().begin(); } + if ( quantities().size() == 2 && quantityNamesWithHistory().size() == 1 ) + { + return *quantityNamesWithHistory().begin(); + } + return {}; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp index a0bca30fd9..390306632a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.cpp @@ -243,6 +243,8 @@ QString RimSummaryCurveAutoName::buildCurveName( const RifEclipseSummaryAddress& } } + if ( text.empty() ) text = summaryAddress.vectorName(); + return QString::fromStdString( text ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 5c1a18e606..16c07bbaea 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -563,6 +563,17 @@ void RimSummaryPlot::updatePlotTitle() m_description = m_nameHelperAllCurves->plotTitle(); } + if ( m_description().isEmpty() ) + { + RimMultiPlot* plotWindow = nullptr; + firstAncestorOrThisOfType( plotWindow ); + + auto index = plotWindow->plotIndex( this ); + + QString title = QString( "Sub Plot %1" ).arg( index + 1 ); + m_fallbackPlotName = title; + } + updateCurveNames(); updateMdiWindowTitle(); @@ -2529,10 +2540,6 @@ void RimSummaryPlot::updateCurveNames() { curveSet->updateEnsembleLegendItem(); } - - RimSummaryPlotNameHelper nameHelper; - updateNameHelperWithCurveData( &nameHelper ); - m_fallbackPlotName = nameHelper.plotTitle(); } //-------------------------------------------------------------------------------------------------- From a28cecd19b70c9b873e0b43062d8c1e97ad85362 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 1 Jun 2022 14:13:30 +0200 Subject: [PATCH 361/406] #8961 Auto scale factor : Do not use scale factor for some value ranges --- .../ProjectDataModel/RimPlotAxisProperties.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index afc133dcc7..6f4813cd86 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -467,6 +467,20 @@ void RimPlotAxisProperties::computeAndSetScaleFactor() { auto maxAbsValue = std::max( std::fabs( visibleRangeMax() ), std::fabs( visibleRangeMin() ) ); + if ( maxAbsValue < 1.0 && maxAbsValue > 1e-6 ) + { + // Do not use scale factor for small values above 1e-6 + scaleFactor = 1.0; + return; + } + + if ( maxAbsValue > 1.0 && maxAbsValue < 1e6 ) + { + // Do not use scale factor for values above 1 and below 1e-6 + scaleFactor = 1.0; + return; + } + int exponent = std::floor( std::log10( maxAbsValue ) ); if ( exponent > 0 ) { From 4146e8bbd15fde22d7bc2dcd4e98a0c85e579899 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 2 Jun 2022 10:33:05 +0200 Subject: [PATCH 362/406] #9011 Rename axis range aggregation to None --- .../ProjectDataModel/Summary/RimSummaryMultiPlot.cpp | 8 ++++---- .../ProjectDataModel/Summary/RimSummaryMultiPlot.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index a59a1c4ab5..4a12b72010 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -73,12 +73,12 @@ namespace caf template <> void AppEnum::setUp() { - addItem( RimSummaryMultiPlot::AxisRangeAggregation::INDIVIDUAL, "INDIVIDUAL", "Individual" ); + addItem( RimSummaryMultiPlot::AxisRangeAggregation::NONE, "NONE", "None" ); addItem( RimSummaryMultiPlot::AxisRangeAggregation::SUB_PLOTS, "SUB_PLOTS", "All Sub Plots" ); addItem( RimSummaryMultiPlot::AxisRangeAggregation::WELLS, "WELLS", "All Wells" ); addItem( RimSummaryMultiPlot::AxisRangeAggregation::REGIONS, "REGIONS", "All Regions" ); addItem( RimSummaryMultiPlot::AxisRangeAggregation::REALIZATIONS, "REALIZATIONS", "All Realizations" ); - setDefault( RimSummaryMultiPlot::AxisRangeAggregation::INDIVIDUAL ); + setDefault( RimSummaryMultiPlot::AxisRangeAggregation::NONE ); } } // namespace caf @@ -145,7 +145,7 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" ); CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", true, "Auto Adjust Appearance" ); - CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Aggregation" ); + CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Control" ); CAF_PDM_InitField( &m_hidePlotsWithValuesBelow, "HidePlotsWithValuesBelow", false, "" ); m_hidePlotsWithValuesBelow.xmlCapability()->disableIO(); @@ -785,7 +785,7 @@ void RimSummaryMultiPlot::checkAndApplyAutoAppearance() //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::syncAxisRanges() { - if ( m_axisRangeAggregation() == AxisRangeAggregation::INDIVIDUAL ) + if ( m_axisRangeAggregation() == AxisRangeAggregation::NONE ) { return; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 859d3c9eb0..974d2f739d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -50,7 +50,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep public: enum class AxisRangeAggregation { - INDIVIDUAL, + NONE, SUB_PLOTS, REGIONS, WELLS, From 2b8bab3bd82de6c65742a248531d6293104c5def Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 2 Jun 2022 10:38:18 +0200 Subject: [PATCH 363/406] #9011 Disable input controls controlled by automation Disable fields controlled by automation and append label text with (overridden) --- .../Application/Tools/RiaFieldHandleTools.cpp | 16 +++ .../Application/Tools/RiaFieldHandleTools.h | 3 + .../RimPlotAxisProperties.cpp | 97 +++++++++++++++---- .../ProjectDataModel/RimPlotAxisProperties.h | 22 +++-- .../RimPlotAxisPropertiesInterface.cpp | 20 ++++ .../RimPlotAxisPropertiesInterface.h | 8 ++ .../Summary/RimSummaryMultiPlot.cpp | 39 ++++++++ .../Summary/RimSummaryMultiPlot.h | 2 + .../Summary/RimSummaryPlotAxisFormatter.cpp | 8 +- .../Summary/RimSummaryTimeAxisProperties.cpp | 5 + .../cafPdmUiCore/cafPdmUiItem.cpp | 12 ++- .../cafPdmUiCore/cafPdmUiItem.h | 5 +- 12 files changed, 207 insertions(+), 30 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.cpp b/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.cpp index 55517ec38e..949bfbaa2e 100644 --- a/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.cpp @@ -48,3 +48,19 @@ void RiaFieldhandleTools::disableWriteAndSetFieldHidden( caf::PdmFieldHandle* fi fieldHandle->xmlCapability()->setIOWritable( false ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaFieldhandleTools::updateOverrideStateAndLabel( caf::PdmFieldHandle* fieldHandle, + bool isOverridden, + const QString& toolTip ) +{ + // Get the label text as given by the init_field macro + QString labelText = fieldHandle->uiCapability()->uiName( fieldHandle->uiCapability()->uiConfigNameForStaticData() ); + + if ( isOverridden ) labelText += " (overridden)"; + fieldHandle->uiCapability()->setUiToolTip( toolTip ); + fieldHandle->uiCapability()->setUiName( labelText ); + fieldHandle->uiCapability()->setUiReadOnly( isOverridden ); +} diff --git a/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.h b/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.h index 0eaa0913b4..97fa9b1b7c 100644 --- a/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.h +++ b/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.h @@ -19,6 +19,8 @@ #pragma once +#include + namespace caf { class PdmFieldHandle; @@ -31,4 +33,5 @@ class RiaFieldhandleTools { public: static void disableWriteAndSetFieldHidden( caf::PdmFieldHandle* fieldHandle ); + static void updateOverrideStateAndLabel( caf::PdmFieldHandle* fieldHandle, bool isOverridden, const QString& toolTip ); }; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 6f4813cd86..18892c9b0b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -20,6 +20,7 @@ #include "RimPlotAxisProperties.h" #include "RiaDefines.h" +#include "RiaFieldHandleTools.h" #include "RiaPlotDefines.h" #include "RiaPreferences.h" @@ -61,6 +62,9 @@ RimPlotAxisProperties::RimPlotAxisProperties() CAF_PDM_InitField( &m_isActive, "Active", true, "Active" ); m_isActive.uiCapability()->setUiHidden( true ); + CAF_PDM_InitField( &m_isMinMaxOverridden, "IsMinMaxOverridden", false, "IsMinMaxOverridden" ); + m_isMinMaxOverridden.uiCapability()->setUiHidden( true ); + CAF_PDM_InitFieldNoDefault( &m_objectName, "Name", "Name" ); m_objectName.uiCapability()->setUiHidden( true ); @@ -73,14 +77,14 @@ RimPlotAxisProperties::RimPlotAxisProperties() CAF_PDM_InitField( &m_displayShortName, "DisplayShortName", false, " Acronyms" ); CAF_PDM_InitField( &m_displayUnitText, "DisplayUnitText", true, " Units" ); - CAF_PDM_InitFieldNoDefault( &customTitle, "CustomTitle", "Title" ); + CAF_PDM_InitFieldNoDefault( &m_customTitle, "CustomTitle", "Title" ); CAF_PDM_InitField( &m_visibleRangeMax, "VisibleRangeMax", RiaDefines::maximumDefaultValuePlot(), "Max" ); CAF_PDM_InitField( &m_visibleRangeMin, "VisibleRangeMin", RiaDefines::minimumDefaultValuePlot(), "Min" ); - CAF_PDM_InitFieldNoDefault( &numberFormat, "NumberFormat", "Number Format" ); - CAF_PDM_InitField( &numberOfDecimals, "Decimals", 2, "Number of Decimals" ); - CAF_PDM_InitField( &scaleFactor, "ScaleFactor", 1.0, "Scale Factor" ); + CAF_PDM_InitFieldNoDefault( &m_numberFormat, "NumberFormat", "Number Format" ); + CAF_PDM_InitField( &m_numberOfDecimals, "Decimals", 2, "Number of Decimals" ); + CAF_PDM_InitField( &m_scaleFactor, "ScaleFactor", 1.0, "Scale Factor" ); CAF_PDM_InitField( &m_isAutoZoom, "AutoZoom", true, "Set Range Automatically" ); CAF_PDM_InitField( &m_isLogarithmicScaleEnabled, "LogarithmicScale", false, "Logarithmic Scale" ); @@ -166,7 +170,7 @@ QList RimPlotAxisProperties::calculateValueOptions( cons { QList options; - if ( fieldNeedingOptions == &scaleFactor ) + if ( fieldNeedingOptions == &m_scaleFactor ) { for ( int exp = -12; exp <= 12; exp += 3 ) { @@ -214,12 +218,12 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr titleTextGroup->add( &m_displayShortName ); titleTextGroup->add( &m_displayUnitText ); - customTitle.uiCapability()->setUiReadOnly( true ); + m_customTitle.uiCapability()->setUiReadOnly( true ); } else { - titleTextGroup->add( &customTitle ); - customTitle.uiCapability()->setUiReadOnly( false ); + titleTextGroup->add( &m_customTitle ); + m_customTitle.uiCapability()->setUiReadOnly( false ); } } @@ -236,25 +240,27 @@ void RimPlotAxisProperties::defineUiOrdering( QString uiConfigName, caf::PdmUiOr scaleGroup.add( &m_isAxisInverted ); scaleGroup.add( &m_showNumbers ); } - scaleGroup.add( &numberFormat ); + scaleGroup.add( &m_numberFormat ); - if ( numberFormat() != NUMBER_FORMAT_AUTO ) + if ( m_numberFormat() != NUMBER_FORMAT_AUTO ) { - scaleGroup.add( &numberOfDecimals ); + scaleGroup.add( &m_numberOfDecimals ); } - scaleGroup.add( &scaleFactor ); + scaleGroup.add( &m_scaleFactor ); if ( m_isRangeSettingsEnabled ) { scaleGroup.add( &m_visibleRangeMin ); scaleGroup.add( &m_visibleRangeMax ); } + scaleGroup.add( &m_valuesFontSize ); scaleGroup.add( &m_majorTickmarkCount ); - scaleGroup.add( &m_plotAxis ); m_plotAxis.uiCapability()->setUiReadOnly( m_isAlwaysRequired ); uiOrdering.skipRemainingFields( true ); + + updateOverriddenLabelAndReadOnlyState(); } //-------------------------------------------------------------------------------------------------- @@ -284,6 +290,14 @@ RimPlotAxisPropertiesInterface::AxisTitlePositionType RimPlotAxisProperties::tit return m_titlePositionEnum(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimPlotAxisProperties::customTitle() const +{ + return m_customTitle(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -452,6 +466,30 @@ void RimPlotAxisProperties::setShowNumbers( bool enable ) m_showNumbers = enable; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimPlotAxisProperties::NumberFormatType RimPlotAxisProperties::numberFormat() const +{ + return m_numberFormat(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimPlotAxisProperties::decimalCount() const +{ + return m_numberOfDecimals(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimPlotAxisProperties::scaleFactor() const +{ + return m_scaleFactor(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -470,14 +508,14 @@ void RimPlotAxisProperties::computeAndSetScaleFactor() if ( maxAbsValue < 1.0 && maxAbsValue > 1e-6 ) { // Do not use scale factor for small values above 1e-6 - scaleFactor = 1.0; + m_scaleFactor = 1.0; return; } if ( maxAbsValue > 1.0 && maxAbsValue < 1e6 ) { // Do not use scale factor for values above 1 and below 1e-6 - scaleFactor = 1.0; + m_scaleFactor = 1.0; return; } @@ -497,7 +535,7 @@ void RimPlotAxisProperties::computeAndSetScaleFactor() } } - scaleFactor = std::pow( 10, exponent ); + m_scaleFactor = std::pow( 10, exponent ); } //-------------------------------------------------------------------------------------------------- @@ -524,6 +562,14 @@ double RimPlotAxisProperties::visibleRangeMax() const return m_visibleRangeMax; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::setMinMaxOverridden( bool isOverridden ) +{ + m_isMinMaxOverridden = isOverridden; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -608,7 +654,24 @@ void RimPlotAxisProperties::fieldChangedByUi( const caf::PdmFieldHandle* changed //-------------------------------------------------------------------------------------------------- void RimPlotAxisProperties::updateOptionSensitivity() { - customTitle.uiCapability()->setUiReadOnly( isAutoTitle ); + m_customTitle.uiCapability()->setUiReadOnly( isAutoTitle ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::updateOverriddenLabelAndReadOnlyState() +{ + // Auto Appearance is defined in RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings() + QString axisRangeToolTip = "Controlled by Axis Range Control"; + + RiaFieldhandleTools::updateOverrideStateAndLabel( &m_visibleRangeMin, m_isMinMaxOverridden, axisRangeToolTip ); + RiaFieldhandleTools::updateOverrideStateAndLabel( &m_visibleRangeMax, m_isMinMaxOverridden, axisRangeToolTip ); + + QString autoAppearanceToolTip = "Controlled by Auto Adjust Appearance"; + RiaFieldhandleTools::updateOverrideStateAndLabel( &m_majorTickmarkCount, isAppearanceOverridden(), autoAppearanceToolTip ); + RiaFieldhandleTools::updateOverrideStateAndLabel( &m_scaleFactor, isAppearanceOverridden(), autoAppearanceToolTip ); + RiaFieldhandleTools::updateOverrideStateAndLabel( &m_displayLongName, isAppearanceOverridden(), autoAppearanceToolTip ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index ba60fc813a..8e997b231a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -65,6 +65,8 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface void setNameAndAxis( const QString& objectName, const QString& axistTitle, RiaDefines::PlotAxis axis, int axisIndex = 0 ); AxisTitlePositionType titlePosition() const override; + QString customTitle() const; + int titleFontSize() const override; int valuesFontSize() const override; @@ -90,6 +92,10 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface bool showNumbers() const; void setShowNumbers( bool enable ); + NumberFormatType numberFormat() const; + int decimalCount() const; + double scaleFactor() const; + void setVisible( bool visible ); void computeAndSetScaleFactor(); @@ -99,12 +105,6 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface void appendAnnotation( RimPlotAxisAnnotation* annotation ) override; void removeAllAnnotations() override; - caf::PdmField customTitle; - - caf::PdmField> numberFormat; - caf::PdmField numberOfDecimals; - caf::PdmField scaleFactor; - bool isLogarithmicScaleEnabled() const override; bool isActive() const override; @@ -113,6 +113,7 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface double visibleRangeMin() const override; double visibleRangeMax() const override; + void setMinMaxOverridden( bool isOverridden ); void setVisibleRangeMin( double value ) override; void setVisibleRangeMax( double value ) override; @@ -130,11 +131,14 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface private: void updateOptionSensitivity(); + void updateOverriddenLabelAndReadOnlyState(); caf::FontTools::FontSize plotFontSize() const; private: caf::PdmField m_isActive; + caf::PdmField m_isMinMaxOverridden; + caf::PdmField isAutoTitle; caf::PdmField m_displayShortName; caf::PdmField m_displayLongName; @@ -153,6 +157,12 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface caf::PdmField m_plotAxisIndex; caf::PdmField m_majorTickmarkCount; + caf::PdmField m_customTitle; + + caf::PdmField> m_numberFormat; + caf::PdmField m_numberOfDecimals; + caf::PdmField m_scaleFactor; + caf::PdmField m_isLogarithmicScaleEnabled; bool m_enableTitleTextSettings; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp index 20ef8d8628..03e5081fd3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp @@ -55,6 +55,10 @@ void RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum::setUp() RimPlotAxisPropertiesInterface::RimPlotAxisPropertiesInterface() : settingsChanged( this ) { + CAF_PDM_InitObject( "Time Axis Interface" ); + + CAF_PDM_InitField( &m_isAppearanceOverridden, "IsAppearanceOverridden", false, "IsAppearanceOverridden" ); + m_isAppearanceOverridden.uiCapability()->setUiHidden( true ); } //-------------------------------------------------------------------------------------------------- @@ -73,6 +77,14 @@ bool RimPlotAxisPropertiesInterface::isLogarithmicScaleEnabled() const return false; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisPropertiesInterface::setAppearanceOverridden( bool isOverridden ) +{ + m_isAppearanceOverridden = isOverridden; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -101,6 +113,14 @@ int RimPlotAxisPropertiesInterface::tickmarkCountFromEnum( LegendTickmarkCount c return maxTickmarkCount; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimPlotAxisPropertiesInterface::isAppearanceOverridden() const +{ + return m_isAppearanceOverridden(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h index c43351e47d..1d73b3e533 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h @@ -23,6 +23,7 @@ #include "RiuPlotAxis.h" #include "cafAppEnum.h" +#include "cafPdmField.h" #include "cafPdmObject.h" class RimPlotAxisAnnotation; @@ -77,6 +78,7 @@ class RimPlotAxisPropertiesInterface : public caf::PdmObject virtual LegendTickmarkCount majorTickmarkCount() const = 0; virtual void setMajorTickmarkCount( LegendTickmarkCount count ) = 0; + void setAppearanceOverridden( bool isOverridden ); static int tickmarkCountFromEnum( LegendTickmarkCount count ); @@ -85,6 +87,12 @@ class RimPlotAxisPropertiesInterface : public caf::PdmObject virtual int titleFontSize() const = 0; virtual int valuesFontSize() const = 0; +protected: + bool isAppearanceOverridden() const; + private: void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; + +private: + caf::PdmField m_isAppearanceOverridden; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 4a12b72010..92f8ba4daf 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -196,6 +196,10 @@ void RimSummaryMultiPlot::insertPlot( RimPlot* plot, size_t index ) { sumPlot->axisChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAxisChanged ); sumPlot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); + + bool isMinMaxOverridden = m_axisRangeAggregation() != AxisRangeAggregation::NONE; + setOverriddenFlagsForPlot( sumPlot, isMinMaxOverridden, m_autoAdjustAppearance() ); + RimMultiPlot::insertPlot( plot, index ); } @@ -426,6 +430,8 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi else if ( changedField == &m_linkSubPlotAxes || changedField == &m_axisRangeAggregation ) { syncAxisRanges(); + + setOverriddenFlag(); } else if ( changedField == &m_hidePlotsWithValuesBelow ) { @@ -464,6 +470,7 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi else if ( changedField == &m_autoAdjustAppearance ) { checkAndApplyAutoAppearance(); + setOverriddenFlag(); } else { @@ -766,6 +773,8 @@ void RimSummaryMultiPlot::setDefaultRangeAggregationSteppingDimension() m_axisRangeAggregation = rangeAggregation; m_sourceStepping->setStepDimension( stepDimension ); + + setOverriddenFlag(); } //-------------------------------------------------------------------------------------------------- @@ -1045,6 +1054,36 @@ void RimSummaryMultiPlot::updatePlotVisibility() if ( !m_viewer.isNull() ) m_viewer->scheduleUpdate(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::setOverriddenFlag() +{ + bool isMinMaxOverridden = m_axisRangeAggregation() != AxisRangeAggregation::NONE; + for ( auto p : summaryPlots() ) + { + setOverriddenFlagsForPlot( p, isMinMaxOverridden, m_autoAdjustAppearance() ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::setOverriddenFlagsForPlot( RimSummaryPlot* summaryPlot, + bool isMinMaxOverridden, + bool isAppearanceOverridden ) +{ + for ( auto plotAxis : summaryPlot->plotAxes() ) + { + plotAxis->setAppearanceOverridden( isAppearanceOverridden ); + auto plotAxProp = dynamic_cast( plotAxis ); + if ( plotAxProp ) + { + plotAxProp->setMinMaxOverridden( isMinMaxOverridden ); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 974d2f739d..58c81571b5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -128,6 +128,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void updateSourceStepper(); void updatePlotVisibility(); + void setOverriddenFlag(); + void setOverriddenFlagsForPlot( RimSummaryPlot* summaryPlot, bool isMinMaxOverridden, bool isAppearanceOverridden ); void duplicate(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp index 5b3b019bbc..560741ad03 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotAxisFormatter.cpp @@ -121,7 +121,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot RiuPlotAxis axis = m_axisProperties->plotAxisType(); { - QString axisTitle = m_axisProperties->customTitle; + QString axisTitle = m_axisProperties->customTitle(); if ( m_axisProperties->useAutoTitle() ) axisTitle = autoAxisTitle(); Qt::AlignmentFlag titleAlignment = Qt::AlignCenter; @@ -148,7 +148,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot { auto qwtAxisId = qwtPlotWidget->toQwtPlotAxis( axis ); - if ( m_axisProperties->numberFormat == RimPlotAxisProperties::NUMBER_FORMAT_AUTO && + if ( m_axisProperties->numberFormat() == RimPlotAxisProperties::NUMBER_FORMAT_AUTO && m_axisProperties->scaleFactor() == 1.0 ) { // Default to Qwt's own scale draw to avoid changing too much for default values @@ -158,7 +158,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot { qwtPlotWidget->qwtPlot()->setAxisScaleDraw( qwtAxisId, new SummaryScaleDraw( m_axisProperties->scaleFactor(), - m_axisProperties->numberOfDecimals(), + m_axisProperties->decimalCount(), m_axisProperties->numberFormat() ) ); } } @@ -178,7 +178,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot }; auto formatType = mapToRiaNumberFormatType( m_axisProperties->numberFormat() ); - QString format = RiaNumberFormat::sprintfFormat( formatType, m_axisProperties->numberOfDecimals() ); + QString format = RiaNumberFormat::sprintfFormat( formatType, m_axisProperties->decimalCount() ); qtChartsPlotWidget->setAxisFormat( axis, format ); } #endif diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index f532a4d8a2..a7f48d790c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -19,6 +19,7 @@ #include "RimSummaryTimeAxisProperties.h" #include "RiaApplication.h" +#include "RiaFieldHandleTools.h" #include "RiaFontCache.h" #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" @@ -591,6 +592,10 @@ void RimSummaryTimeAxisProperties::defineUiOrdering( QString uiConfigName, caf:: timeGroup->add( &m_valuesFontSize ); timeGroup->add( &m_majorTickmarkCount ); + // Auto Appearance is defined in RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings() + QString autoAppearanceToolTip = "Controlled by Auto Adjust Appearance"; + RiaFieldhandleTools::updateOverrideStateAndLabel( &m_majorTickmarkCount, isAppearanceOverridden(), autoAppearanceToolTip ); + if ( m_timeMode() == DATE ) { caf::PdmUiGroup* advancedGroup = timeGroup->addNewGroup( "Date/Time Label Format" ); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp index 9d2484e330..dfc2fd83a5 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp @@ -227,9 +227,11 @@ bool PdmUiItem::sm_showExtraDebugText = false; //-------------------------------------------------------------------------------------------------- const QString PdmUiItem::uiName( const QString& uiConfigName ) const { + const PdmUiItemInfo* sttInfo = m_staticItemInfo; + if ( uiConfigName == uiConfigNameForStaticData() && sttInfo ) return sttInfo->m_uiName; + const PdmUiItemInfo* conInfo = configInfo( uiConfigName ); const PdmUiItemInfo* defInfo = defaultInfo(); - const PdmUiItemInfo* sttInfo = m_staticItemInfo; if ( conInfo && !( conInfo->m_uiName.isNull() ) ) return conInfo->m_uiName; if ( defInfo && !( defInfo->m_uiName.isNull() ) ) return defInfo->m_uiName; @@ -246,6 +248,14 @@ void PdmUiItem::setUiName( const QString& uiName, const QString& uiConfigName /* m_configItemInfos[uiConfigName].m_uiName = uiName; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString PdmUiItem::uiConfigNameForStaticData() +{ + return "uiConfigNameForStaticData"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h index 9c67228696..8032082a17 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h @@ -248,8 +248,9 @@ class PdmUiItem PdmUiItem( const PdmUiItem& ) = delete; PdmUiItem& operator=( const PdmUiItem& ) = delete; - const QString uiName( const QString& uiConfigName = "" ) const; - void setUiName( const QString& uiName, const QString& uiConfigName = "" ); + const QString uiName( const QString& uiConfigName = "" ) const; + void setUiName( const QString& uiName, const QString& uiConfigName = "" ); + static QString uiConfigNameForStaticData(); std::unique_ptr uiIcon( const QString& uiConfigName = "" ) const; const IconProvider uiIconProvider( const QString& uiConfigName = "" ) const; From 95e9ef8bf1f8753d48c2bcc48be5d1080440a462 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 2 Jun 2022 15:57:00 +0200 Subject: [PATCH 364/406] Rename to RiaFieldHandleTools --- .../Application/Tools/RiaFieldHandleTools.cpp | 4 ++-- .../Application/Tools/RiaFieldHandleTools.h | 2 +- ApplicationLibCode/ProjectDataModel/Rim3dView.cpp | 4 ++-- .../ProjectDataModel/RimPlotAxisProperties.cpp | 10 +++++----- .../RimPlotAxisPropertiesInterface.cpp | 2 +- ApplicationLibCode/ProjectDataModel/RimProject.cpp | 4 ++-- ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp | 2 +- .../Summary/RimSummaryCaseCollection.cpp | 2 +- .../Summary/RimSummaryTimeAxisProperties.cpp | 2 +- .../ProjectDataModel/WellLog/RimWellLogFile.cpp | 6 +++--- .../ProjectDataModel/WellLog/RimWellLogFileChannel.cpp | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.cpp b/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.cpp index 949bfbaa2e..c65dae93a7 100644 --- a/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.cpp @@ -30,7 +30,7 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaFieldhandleTools::disableWriteAndSetFieldHidden( caf::PdmFieldHandle* fieldHandle ) +void RiaFieldHandleTools::disableWriteAndSetFieldHidden( caf::PdmFieldHandle* fieldHandle ) { CVF_ASSERT( fieldHandle ); @@ -52,7 +52,7 @@ void RiaFieldhandleTools::disableWriteAndSetFieldHidden( caf::PdmFieldHandle* fi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiaFieldhandleTools::updateOverrideStateAndLabel( caf::PdmFieldHandle* fieldHandle, +void RiaFieldHandleTools::updateOverrideStateAndLabel( caf::PdmFieldHandle* fieldHandle, bool isOverridden, const QString& toolTip ) { diff --git a/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.h b/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.h index 97fa9b1b7c..4029b3a313 100644 --- a/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.h +++ b/ApplicationLibCode/Application/Tools/RiaFieldHandleTools.h @@ -29,7 +29,7 @@ class PdmFieldHandle; //================================================================================================== // //================================================================================================== -class RiaFieldhandleTools +class RiaFieldHandleTools { public: static void disableWriteAndSetFieldHidden( caf::PdmFieldHandle* fieldHandle ); diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 1281451d58..f27b3361fd 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -1493,7 +1493,7 @@ void Rim3dView::disableGridBoxField() { m_showGridBox = false; - RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_showGridBox ); + RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_showGridBox ); } //-------------------------------------------------------------------------------------------------- @@ -1503,7 +1503,7 @@ void Rim3dView::disablePerspectiveProjectionField() { isPerspectiveView = false; - RiaFieldhandleTools::disableWriteAndSetFieldHidden( &isPerspectiveView ); + RiaFieldHandleTools::disableWriteAndSetFieldHidden( &isPerspectiveView ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp index 18892c9b0b..e8a4fd86ea 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.cpp @@ -665,13 +665,13 @@ void RimPlotAxisProperties::updateOverriddenLabelAndReadOnlyState() // Auto Appearance is defined in RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings() QString axisRangeToolTip = "Controlled by Axis Range Control"; - RiaFieldhandleTools::updateOverrideStateAndLabel( &m_visibleRangeMin, m_isMinMaxOverridden, axisRangeToolTip ); - RiaFieldhandleTools::updateOverrideStateAndLabel( &m_visibleRangeMax, m_isMinMaxOverridden, axisRangeToolTip ); + RiaFieldHandleTools::updateOverrideStateAndLabel( &m_visibleRangeMin, m_isMinMaxOverridden, axisRangeToolTip ); + RiaFieldHandleTools::updateOverrideStateAndLabel( &m_visibleRangeMax, m_isMinMaxOverridden, axisRangeToolTip ); QString autoAppearanceToolTip = "Controlled by Auto Adjust Appearance"; - RiaFieldhandleTools::updateOverrideStateAndLabel( &m_majorTickmarkCount, isAppearanceOverridden(), autoAppearanceToolTip ); - RiaFieldhandleTools::updateOverrideStateAndLabel( &m_scaleFactor, isAppearanceOverridden(), autoAppearanceToolTip ); - RiaFieldhandleTools::updateOverrideStateAndLabel( &m_displayLongName, isAppearanceOverridden(), autoAppearanceToolTip ); + RiaFieldHandleTools::updateOverrideStateAndLabel( &m_majorTickmarkCount, isAppearanceOverridden(), autoAppearanceToolTip ); + RiaFieldHandleTools::updateOverrideStateAndLabel( &m_scaleFactor, isAppearanceOverridden(), autoAppearanceToolTip ); + RiaFieldHandleTools::updateOverrideStateAndLabel( &m_displayLongName, isAppearanceOverridden(), autoAppearanceToolTip ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp index 03e5081fd3..1db0647380 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp @@ -55,7 +55,7 @@ void RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum::setUp() RimPlotAxisPropertiesInterface::RimPlotAxisPropertiesInterface() : settingsChanged( this ) { - CAF_PDM_InitObject( "Time Axis Interface" ); + CAF_PDM_InitObject( "Plot Axis Properties Interface" ); CAF_PDM_InitField( &m_isAppearanceOverridden, "IsAppearanceOverridden", false, "IsAppearanceOverridden" ); m_isAppearanceOverridden.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 2b898a8b06..a282fc8cc3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -200,10 +200,10 @@ RimProject::RimProject( void ) // Obsolete fields. The content is moved to OilFields and friends CAF_PDM_InitFieldNoDefault( &casesObsolete, "Reservoirs", "" ); - RiaFieldhandleTools::disableWriteAndSetFieldHidden( &casesObsolete ); + RiaFieldHandleTools::disableWriteAndSetFieldHidden( &casesObsolete ); CAF_PDM_InitFieldNoDefault( &caseGroupsObsolete, "CaseGroups", "" ); - RiaFieldhandleTools::disableWriteAndSetFieldHidden( &caseGroupsObsolete ); + RiaFieldHandleTools::disableWriteAndSetFieldHidden( &caseGroupsObsolete ); // Initialization diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index 44608748bf..3740a4444e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -58,7 +58,7 @@ RimViewWindow::RimViewWindow( void ) // Obsolete field CAF_PDM_InitFieldNoDefault( &obsoleteField_windowGeometry, "WindowGeometry", "" ); - RiaFieldhandleTools::disableWriteAndSetFieldHidden( &obsoleteField_windowGeometry ); + RiaFieldHandleTools::disableWriteAndSetFieldHidden( &obsoleteField_windowGeometry ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index 0be851e734..ff0bbfcebb 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -117,7 +117,7 @@ RimSummaryCaseCollection::RimSummaryCaseCollection() CAF_PDM_InitScriptableFieldNoDefault( &m_nameAndItemCount, "NameCount", "Name" ); m_nameAndItemCount.registerGetMethod( this, &RimSummaryCaseCollection::nameAndItemCount ); - RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_nameAndItemCount ); + RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_nameAndItemCount ); CAF_PDM_InitScriptableField( &m_isEnsemble, "IsEnsemble", false, "Is Ensemble" ); m_isEnsemble.uiCapability()->setUiHidden( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index a7f48d790c..ebf55072c6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -594,7 +594,7 @@ void RimSummaryTimeAxisProperties::defineUiOrdering( QString uiConfigName, caf:: // Auto Appearance is defined in RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings() QString autoAppearanceToolTip = "Controlled by Auto Adjust Appearance"; - RiaFieldhandleTools::updateOverrideStateAndLabel( &m_majorTickmarkCount, isAppearanceOverridden(), autoAppearanceToolTip ); + RiaFieldHandleTools::updateOverrideStateAndLabel( &m_majorTickmarkCount, isAppearanceOverridden(), autoAppearanceToolTip ); if ( m_timeMode() == DATE ) { diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp index cea36412cd..498c409ee2 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFile.cpp @@ -68,7 +68,7 @@ RimWellLogFile::RimWellLogFile() CAF_PDM_InitFieldNoDefault( &m_wellName, "WellName", "" ); m_wellName.uiCapability()->setUiReadOnly( true ); - RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_wellName ); + RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_wellName ); CAF_PDM_InitFieldNoDefault( &m_date, "Date", "Date" ); m_date.uiCapability()->setUiReadOnly( true ); @@ -78,10 +78,10 @@ RimWellLogFile::RimWellLogFile() CAF_PDM_InitFieldNoDefault( &m_name, "Name", "" ); m_name.uiCapability()->setUiReadOnly( true ); - RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_name ); + RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_name ); CAF_PDM_InitFieldNoDefault( &m_wellLogChannelNames, "WellLogFileChannels", "" ); - RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_wellLogChannelNames ); + RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_wellLogChannelNames ); CAF_PDM_InitField( &m_wellFlowCondition, "WellFlowCondition", diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileChannel.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileChannel.cpp index c5d6bd779d..6371138944 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileChannel.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogFileChannel.cpp @@ -33,7 +33,7 @@ RimWellLogFileChannel::RimWellLogFileChannel() CAF_PDM_InitObject( "Well Log File Channel" ); CAF_PDM_InitFieldNoDefault( &m_name, "Name", "" ); - RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_name ); + RiaFieldHandleTools::disableWriteAndSetFieldHidden( &m_name ); } //-------------------------------------------------------------------------------------------------- From 2472f4697cd7568e4dcc65cfcd5884e0036576aa Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 3 Jun 2022 13:54:15 +0200 Subject: [PATCH 365/406] Improve summary category detection for opm-common reader (#9018) * Move code to quantitynameinforprovider * Use some region-to-region helper function from opm-common * Add more fallbacks --- .../RifEclipseSummaryAddress.cpp | 32 +------ .../FileInterface/RifEclipseSummaryAddress.h | 2 - .../RifEclipseUserDataKeywordTools.cpp | 5 +- .../RiuSummaryVectorDescriptionMap-Test.cpp | 12 +-- .../RiuSummaryQuantityNameInfoProvider.cpp | 86 +++++++++++++++++++ .../RiuSummaryQuantityNameInfoProvider.h | 6 +- 6 files changed, 101 insertions(+), 42 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index 3516e79b08..bb522a0584 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -152,36 +152,6 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromEclipseTextAddress( const return fromTokens( tokens ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RifEclipseSummaryAddress::SummaryVarCategory RifEclipseSummaryAddress::identifyCategory( const std::string& vectorName ) -{ - // Try to an exact match on the vector name first in the vector table. - bool exactMatch = true; - auto exactCategory = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( vectorName, exactMatch ); - if ( exactCategory != SUMMARY_INVALID ) return exactCategory; - - if ( vectorName.size() < 3 || vectorName.size() > 8 ) return SUMMARY_INVALID; - - // Try to match the base vector name with more heuristics - auto strippedQuantityName = baseVectorName( vectorName ); - - // First, try to lookup vector in vector table - auto category = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( strippedQuantityName ); - if ( category != SUMMARY_INVALID ) return category; - - // Then check LGR categories - std::string firstTwoLetters = strippedQuantityName.substr( 0, 2 ); - - if ( firstTwoLetters == "LB" ) return SUMMARY_BLOCK_LGR; - if ( firstTwoLetters == "LC" ) return SUMMARY_WELL_COMPLETION_LGR; - if ( firstTwoLetters == "LW" ) return SUMMARY_WELL_LGR; - - if ( strippedQuantityName[0] == 'N' ) return SUMMARY_NETWORK; - return SUMMARY_INVALID; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -762,7 +732,7 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector if ( tokens.size() > 1 ) token1 = tokens[1]; if ( tokens.size() > 2 ) token2 = tokens[2]; - SummaryVarCategory category = identifyCategory( vectorName ); + SummaryVarCategory category = RiuSummaryQuantityNameInfoProvider::instance()->identifyCategory( vectorName ); switch ( category ) { diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h index 718447567e..c85579d2b2 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.h @@ -127,8 +127,6 @@ class RifEclipseSummaryAddress static RifEclipseSummaryAddress fromEclipseTextAddress( const std::string& textAddress ); static RifEclipseSummaryAddress fromEclipseTextAddressParseErrorTokens( const std::string& textAddress ); - static SummaryVarCategory identifyCategory( const std::string& vectorName ); - static RifEclipseSummaryAddress fieldAddress( const std::string& vectorName ); static RifEclipseSummaryAddress aquiferAddress( const std::string& vectorName, int aquiferNumber ); static RifEclipseSummaryAddress networkAddress( const std::string& vectorName ); diff --git a/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp b/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp index 61bcdefbfb..f73b1303c1 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseUserDataKeywordTools.cpp @@ -23,6 +23,8 @@ #include "RifEclipseUserDataParserTools.h" +#include "RiuSummaryQuantityNameInfoProvider.h" + #include //-------------------------------------------------------------------------------------------------- @@ -164,7 +166,8 @@ bool RifEclipseUserDataKeywordTools::isYearX( const std::string& identifier ) RifEclipseSummaryAddress RifEclipseUserDataKeywordTools::makeAndFillAddress( const std::string quantityName, const std::vector& columnHeaderText ) { - RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::identifyCategory( quantityName ); + RifEclipseSummaryAddress::SummaryVarCategory category = + RiuSummaryQuantityNameInfoProvider::instance()->identifyCategory( quantityName ); if ( category == RifEclipseSummaryAddress::SUMMARY_INVALID ) { diff --git a/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp b/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp index ed1437e5cf..b4cf28c5cb 100644 --- a/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiuSummaryVectorDescriptionMap-Test.cpp @@ -10,7 +10,7 @@ TEST( RiuSummaryQuantityNameInfoProvider, TestInit ) { { std::string s( "SRSFC" ); - auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); + auto cat = RiuSummaryQuantityNameInfoProvider::instance()->identifyCategory( s ); EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT ); auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s ); @@ -26,7 +26,7 @@ TEST( RiuSummaryQuantityNameInfoProvider, TestInit ) { std::string s( "does not exist" ); - auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); + auto cat = RiuSummaryQuantityNameInfoProvider::instance()->identifyCategory( s ); EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_INVALID ); auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s ); @@ -56,7 +56,7 @@ TEST( RiuSummaryQuantityNameInfoProvider, TestCustomNaming ) { { std::string s( "SRSFCABC" ); - auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); + auto cat = RiuSummaryQuantityNameInfoProvider::instance()->identifyCategory( s ); EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL_SEGMENT ); auto longName = RiuSummaryQuantityNameInfoProvider::instance()->longNameFromVectorName( s ); @@ -78,13 +78,13 @@ TEST( RiuSummaryQuantityNameInfoProvider, Test6x ) { { std::string s( "GLIT" ); - auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); + auto cat = RiuSummaryQuantityNameInfoProvider::instance()->identifyCategory( s ); EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_GROUP ); } { std::string s( "WSBVPROP" ); - auto cat = RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); + auto cat = RiuSummaryQuantityNameInfoProvider::instance()->identifyCategory( s ); EXPECT_TRUE( cat == RifEclipseSummaryAddress::SUMMARY_WELL ); } } @@ -108,7 +108,7 @@ TEST( DISABLED_RiuSummaryQuantityNameInfoProvider, PerformanceLookup ) { for ( const auto& s : values ) { - RiuSummaryQuantityNameInfoProvider::instance()->categoryFromVectorName( s ); + RiuSummaryQuantityNameInfoProvider::instance()->identifyCategory( s ); } } diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp index 5b4079f0e0..c7c779dd9c 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.cpp @@ -18,8 +18,37 @@ #include "RiuSummaryQuantityNameInfoProvider.h" +#include #include +// The region_to_region helper functions are taken from +// https://github.com/OPM/opm-common/blob/e1e0edba7da2d3b30f1f009511a62be073c27eb0/src/opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.cpp#L317-L342 + +namespace ParseHelpers +{ +bool is_supported_region_to_region( const std::string& keyword ) +{ + static const auto supported_kw = std::regex{ R"~~(R[OGW]F[RT][-+GL_]?([A-Z0-9_]{3})?)~~" }; + + // R[OGW]F[RT][-+GL]? (e.g., "ROFTG", "RGFR+", or "RWFT") + return std::regex_match( keyword, supported_kw ); +} + +bool is_unsupported_region_to_region( const std::string& keyword ) +{ + static const auto unsupported_kw = std::regex{ R"~~(R([EK]|NL)F[RT][-+_]?([A-Z0-9_]{3})?)~~" }; + + // R[EK]F[RT][-+]? (e.g., "REFT" or "RKFR+") + // RNLF[RT][-+]? (e.g., "RNLFR-" or "RNLFT") + return std::regex_match( keyword, unsupported_kw ); +} + +bool is_region_to_region( const std::string& keyword ) +{ + return is_supported_region_to_region( keyword ) || is_unsupported_region_to_region( keyword ); +} +} // namespace ParseHelpers + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -29,6 +58,63 @@ RiuSummaryQuantityNameInfoProvider* RiuSummaryQuantityNameInfoProvider::instance return singleton; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifEclipseSummaryAddress::SummaryVarCategory + RiuSummaryQuantityNameInfoProvider::identifyCategory( const std::string& vectorName ) +{ + // Try to an exact match on the vector name first in the vector table. + bool exactMatch = true; + auto exactCategory = categoryFromVectorName( vectorName, exactMatch ); + if ( exactCategory != RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_INVALID ) return exactCategory; + + if ( vectorName.size() < 3 || vectorName.size() > 8 ) + return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_INVALID; + + // Try to match the base vector name with more heuristics + auto strippedQuantityName = RifEclipseSummaryAddress::baseVectorName( vectorName ); + + // First, try to lookup vector in vector table + auto category = categoryFromVectorName( strippedQuantityName ); + if ( category != RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_INVALID ) return category; + + switch ( strippedQuantityName[0] ) + { + case 'A': + return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_AQUIFER; + case 'B': + return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_BLOCK; + case 'F': + return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_FIELD; + case 'N': + return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_NETWORK; + case 'S': + return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_SEGMENT; + case 'W': + return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL; + default: + break; + } + + if ( strippedQuantityName[0] == 'R' ) + { + if ( ParseHelpers::is_region_to_region( strippedQuantityName ) ) + return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_REGION_2_REGION; + + return RifEclipseSummaryAddress::SUMMARY_REGION; + } + + // Then check LGR categories + std::string firstTwoLetters = strippedQuantityName.substr( 0, 2 ); + + if ( firstTwoLetters == "LB" ) return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_BLOCK_LGR; + if ( firstTwoLetters == "LC" ) return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_COMPLETION_LGR; + if ( firstTwoLetters == "LW" ) return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_WELL_LGR; + + return RifEclipseSummaryAddress::SummaryVarCategory::SUMMARY_INVALID; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h index cbe66dccf3..f0bfb31e2d 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h +++ b/ApplicationLibCode/UserInterface/RiuSummaryQuantityNameInfoProvider.h @@ -31,8 +31,8 @@ class RiuSummaryQuantityNameInfoProvider public: static RiuSummaryQuantityNameInfoProvider* instance(); - RifEclipseSummaryAddress::SummaryVarCategory categoryFromVectorName( const std::string& vectorName, - bool exactMatch = false ) const; + RifEclipseSummaryAddress::SummaryVarCategory identifyCategory( const std::string& vectorName ); + std::string longNameFromVectorName( const std::string& vectorName, bool returnVectorNameIfNotFound = false ) const; private: @@ -57,6 +57,8 @@ class RiuSummaryQuantityNameInfoProvider RiuSummaryQuantityNameInfoProvider(); RiuSummaryQuantityInfo quantityInfo( const std::string& vectorName, bool exactMatch = false ) const; + RifEclipseSummaryAddress::SummaryVarCategory categoryFromVectorName( const std::string& vectorName, + bool exactMatch = false ) const; static std::unordered_map createInfoForEclipseKeywords(); static std::unordered_map createInfoFor6xKeywords(); From 6931d46b7598ada9eb9f44ea58621327ec30c1b6 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 3 Jun 2022 15:26:27 +0200 Subject: [PATCH 366/406] Bump version to 2021.10.3-dev.06 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 7d98a7e1eb..e183f27b2d 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".05") +set(RESINSIGHT_DEV_VERSION ".06") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From ed392e63000bf602359a229edffece6fa01b635b Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 3 Jun 2022 15:54:00 +0200 Subject: [PATCH 367/406] Keep source step dimension when saving/loading multiplots, including templates --- .../RicSummaryPlotBuilder.cpp | 36 +++++----- .../RicSaveMultiPlotTemplateFeature.cpp | 2 + .../RicSummaryPlotTemplateTools.cpp | 1 + .../Summary/RimSummaryDataSourceStepping.cpp | 19 ++++++ .../Summary/RimSummaryDataSourceStepping.h | 12 ++++ .../Summary/RimSummaryMultiPlot.cpp | 41 +++++++++--- .../Summary/RimSummaryMultiPlot.h | 5 ++ .../Summary/RimSummaryPlotSourceStepping.cpp | 67 +++++++------------ .../Summary/RimSummaryPlotSourceStepping.h | 22 ++---- 9 files changed, 121 insertions(+), 84 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index c50a907c8d..b0fc38a7db 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -430,9 +430,9 @@ RimSummaryMultiPlot* RimProject* project = RimProject::current(); auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); - auto* plotWindow = new RimSummaryMultiPlot(); - plotWindow->setAsPlotMdiWindow(); - plotCollection->addSummaryMultiPlot( plotWindow ); + auto* summaryMultiPlot = new RimSummaryMultiPlot(); + summaryMultiPlot->setAsPlotMdiWindow(); + plotCollection->addSummaryMultiPlot( summaryMultiPlot ); RimSummaryPlot* plot = new RimSummaryPlot(); plot->setAsPlotMdiWindow(); @@ -453,15 +453,17 @@ RimSummaryMultiPlot* plotCollection->updateConnectedEditors(); - appendPlotsToSummaryMultiPlot( plotWindow, { plot } ); + appendPlotsToSummaryMultiPlot( summaryMultiPlot, { plot } ); + + summaryMultiPlot->setDefaultRangeAggregationSteppingDimension(); plotCollection->updateAllRequiredEditors(); - plotWindow->loadDataAndUpdate(); - plotWindow->updateAllRequiredEditors(); + summaryMultiPlot->loadDataAndUpdate(); + summaryMultiPlot->updateAllRequiredEditors(); RiuPlotMainWindowTools::selectAsCurrentItem( plot ); - return plotWindow; + return summaryMultiPlot; } //-------------------------------------------------------------------------------------------------- @@ -505,21 +507,23 @@ RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlo RimProject* project = RimProject::current(); auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); - auto* plotWindow = new RimSummaryMultiPlot(); - plotWindow->setColumnCount( RiaDefines::ColumnCount::COLUMNS_1 ); - plotWindow->setRowCount( RiaDefines::RowCount::ROWS_1 ); - plotWindow->setAsPlotMdiWindow(); - plotCollection->addSummaryMultiPlot( plotWindow ); + auto* summaryMultiPlot = new RimSummaryMultiPlot(); + summaryMultiPlot->setColumnCount( RiaDefines::ColumnCount::COLUMNS_1 ); + summaryMultiPlot->setRowCount( RiaDefines::RowCount::ROWS_1 ); + summaryMultiPlot->setAsPlotMdiWindow(); + plotCollection->addSummaryMultiPlot( summaryMultiPlot ); + + appendPlotsToSummaryMultiPlot( summaryMultiPlot, { plot } ); - appendPlotsToSummaryMultiPlot( plotWindow, { plot } ); + summaryMultiPlot->setDefaultRangeAggregationSteppingDimension(); plotCollection->updateAllRequiredEditors(); - plotWindow->loadDataAndUpdate(); - plotWindow->updateAllRequiredEditors(); + summaryMultiPlot->loadDataAndUpdate(); + summaryMultiPlot->updateAllRequiredEditors(); RiuPlotMainWindowTools::selectAsCurrentItem( plot ); - return plotWindow; + return summaryMultiPlot; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp index c5ced2b877..57987ba5fc 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSaveMultiPlotTemplateFeature.cpp @@ -92,6 +92,8 @@ void RicSaveMultiPlotTemplateFeature::onActionTriggered( bool isChecked ) auto plot = selectedSummaryPlot(); if ( !plot ) return; + plot->storeStepDimensionFromToolbar(); + QString ext = ".rpt"; if ( selectedSummaryPlot()->curveSets().size() > 0 ) ext = ".erpt"; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp index ea6cab589c..ef44991554 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSummaryPlotTemplateTools.cpp @@ -170,6 +170,7 @@ RimSummaryMultiPlot* RicSummaryPlotTemplateTools::create( const QString& fileNam regions ); newSummaryPlot->initAfterReadRecursively(); newSummaryPlot->loadDataAndUpdate(); + collections->updateConnectedEditors(); return newSummaryPlot; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp index a40f4ed515..b5490334ab 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.cpp @@ -17,3 +17,22 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RimSummaryDataSourceStepping.h" + +#include "cafAppEnum.h" + +namespace caf +{ +template <> +void AppEnum::setUp() +{ + addItem( RimSummaryDataSourceStepping::SourceSteppingDimension::VECTOR, "VECTOR", "Vector" ); + addItem( RimSummaryDataSourceStepping::SourceSteppingDimension::WELL, "WELL", "Well" ); + addItem( RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE, "SUMMARY_CASE", "Summary Case" ); + addItem( RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE, "ENSEMBLE", "Ensemble" ); + addItem( RimSummaryDataSourceStepping::SourceSteppingDimension::GROUP, "GROUP", "Group" ); + addItem( RimSummaryDataSourceStepping::SourceSteppingDimension::REGION, "REGION", "Region" ); + addItem( RimSummaryDataSourceStepping::SourceSteppingDimension::BLOCK, "BLOCK", "Block" ); + addItem( RimSummaryDataSourceStepping::SourceSteppingDimension::AQUIFER, "AQUIFER", "Aquifer" ); + setDefault( RimSummaryDataSourceStepping::SourceSteppingDimension::VECTOR ); +} +} // namespace caf diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.h index 8b0de9a50b..3927844db8 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryDataSourceStepping.h @@ -33,6 +33,18 @@ class RimSummaryDataSourceStepping UNION_X_Y_AXIS }; + enum class SourceSteppingDimension + { + SUMMARY_CASE, + ENSEMBLE, + WELL, + GROUP, + REGION, + VECTOR, + BLOCK, + AQUIFER + }; + public: virtual std::vector availableAxes() const = 0; virtual std::vector curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const = 0; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 92f8ba4daf..48df237ee2 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -162,6 +162,10 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() m_sourceStepping.uiCapability()->setUiTreeChildrenHidden( true ); m_sourceStepping.xmlCapability()->disableIO(); + CAF_PDM_InitFieldNoDefault( &m_defaultStepDimension, "DefaultStepDimension", "Default Step Dimension" ); + m_defaultStepDimension = RimSummaryDataSourceStepping::SourceSteppingDimension::VECTOR; + m_defaultStepDimension.uiCapability()->setUiHidden( true ); + m_nameHelper = std::make_unique(); } @@ -689,6 +693,7 @@ void RimSummaryMultiPlot::initAfterRead() plot->axisChanged.connect( this, &RimSummaryMultiPlot::onSubPlotAxisChanged ); plot->curvesChanged.connect( this, &RimSummaryMultiPlot::onSubPlotChanged ); } + updateStepDimensionFromDefault(); } //-------------------------------------------------------------------------------------------------- @@ -749,26 +754,26 @@ void RimSummaryMultiPlot::setDefaultRangeAggregationSteppingDimension() rangeAggregation = AxisRangeAggregation::SUB_PLOTS; } - auto stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::VECTOR; + auto stepDimension = RimSummaryDataSourceStepping::SourceSteppingDimension::VECTOR; if ( analyzer.wellNames().size() == 1 ) { - stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::WELL; + stepDimension = RimSummaryDataSourceStepping::SourceSteppingDimension::WELL; } else if ( analyzer.groupNames().size() == 1 ) { - stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::GROUP; + stepDimension = RimSummaryDataSourceStepping::SourceSteppingDimension::GROUP; } else if ( analyzer.regionNumbers().size() == 1 ) { - stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::REGION; + stepDimension = RimSummaryDataSourceStepping::SourceSteppingDimension::REGION; } else if ( analyzer.aquifers().size() == 1 ) { - stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::AQUIFER; + stepDimension = RimSummaryDataSourceStepping::SourceSteppingDimension::AQUIFER; } else if ( analyzer.blocks().size() == 1 ) { - stepDimension = RimSummaryPlotSourceStepping::SourceSteppingDimension::BLOCK; + stepDimension = RimSummaryDataSourceStepping::SourceSteppingDimension::BLOCK; } m_axisRangeAggregation = rangeAggregation; @@ -1254,7 +1259,7 @@ void RimSummaryMultiPlot::appendSubPlotByStepping( int direction ) RimSummaryPlot* newPlot = dynamic_cast( newPlots[0] ); if ( newPlot == nullptr ) return; - if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::SUMMARY_CASE ) + if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE ) { newPlot->resolveReferencesRecursively(); @@ -1265,7 +1270,7 @@ void RimSummaryMultiPlot::appendSubPlotByStepping( int direction ) curve->setSummaryCaseY( newCase ); } } - else if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::ENSEMBLE ) + else if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE ) { newPlot->resolveReferencesRecursively(); @@ -1313,7 +1318,7 @@ void RimSummaryMultiPlot::appendCurveByStepping( int direction ) auto address = curve->summaryAddressY(); auto sumCase = curve->summaryCaseY(); int sumCaseId = sumCase->caseId(); - if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::SUMMARY_CASE ) + if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE ) { auto nextSumCase = m_sourceStepping->stepCase( direction ); if ( nextSumCase ) sumCaseId = nextSumCase->caseId(); @@ -1330,7 +1335,7 @@ void RimSummaryMultiPlot::appendCurveByStepping( int direction ) auto address = curveSet->summaryAddress(); auto sumEns = curveSet->summaryCaseCollection(); int sumEnsId = sumEns->ensembleId(); - if ( m_sourceStepping()->stepDimension() == RimSummaryPlotSourceStepping::SourceSteppingDimension::ENSEMBLE ) + if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE ) { auto nextEns = m_sourceStepping->stepEnsemble( direction ); if ( nextEns ) sumEnsId = nextEns->ensembleId(); @@ -1379,3 +1384,19 @@ void RimSummaryMultiPlot::keepVisiblePageAfterUpdate( bool keepPage ) if ( keepPage ) m_viewer->keepCurrentPageAfterUpdate(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::storeStepDimensionFromToolbar() +{ + m_defaultStepDimension = m_sourceStepping->stepDimension(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::updateStepDimensionFromDefault() +{ + m_sourceStepping->setStepDimension( m_defaultStepDimension() ); +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index 58c81571b5..e1aa88d5c1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -106,6 +106,9 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void keepVisiblePageAfterUpdate( bool keepPage ); + void storeStepDimensionFromToolbar(); + void updateStepDimensionFromDefault(); + protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override; @@ -158,6 +161,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep caf::PdmField m_appendNextCurve; caf::PdmField m_appendPrevCurve; + caf::PdmField> m_defaultStepDimension; + caf::PdmField> m_axisRangeAggregation; caf::PdmChildField m_sourceStepping; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index f22445124e..c3e6cd9eac 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -51,23 +51,6 @@ #include #include -namespace caf -{ -template <> -void AppEnum::setUp() -{ - addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::VECTOR, "VECTOR", "Vector" ); - addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::WELL, "WELL", "Well" ); - addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::SUMMARY_CASE, "SUMMARY_CASE", "Summary Case" ); - addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::ENSEMBLE, "ENSEMBLE", "Ensemble" ); - addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::GROUP, "GROUP", "Group" ); - addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::REGION, "REGION", "Region" ); - addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::BLOCK, "BLOCK", "Block" ); - addItem( RimSummaryPlotSourceStepping::SourceSteppingDimension::AQUIFER, "AQUIFER", "Aquifer" ); - setDefault( RimSummaryPlotSourceStepping::SourceSteppingDimension::VECTOR ); -} -} // namespace caf - CAF_PDM_SOURCE_INIT( RimSummaryPlotSourceStepping, "RimSummaryCurveCollectionModifier" ); //-------------------------------------------------------------------------------------------------- @@ -322,6 +305,8 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* { RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); mainPlotWindow->updateMultiPlotToolBar(); + RimSummaryMultiPlot* plot = dynamic_cast( m_objectForSourceStepping.p() ); + if ( plot ) plot->storeStepDimensionFromToolbar(); return; } @@ -560,29 +545,29 @@ caf::PdmValueField* RimSummaryPlotSourceStepping::fieldToModify() { switch ( m_stepDimension() ) { - case SourceSteppingDimension::SUMMARY_CASE: + case RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE: return &m_summaryCase; break; - case SourceSteppingDimension::ENSEMBLE: + case RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE: return &m_ensemble; - case SourceSteppingDimension::WELL: + case RimSummaryDataSourceStepping::SourceSteppingDimension::WELL: return &m_wellName; - case SourceSteppingDimension::GROUP: + case RimSummaryDataSourceStepping::SourceSteppingDimension::GROUP: return &m_groupName; - case SourceSteppingDimension::REGION: + case RimSummaryDataSourceStepping::SourceSteppingDimension::REGION: return &m_region; - case SourceSteppingDimension::VECTOR: + case RimSummaryDataSourceStepping::SourceSteppingDimension::VECTOR: return &m_vectorName; - case SourceSteppingDimension::BLOCK: + case RimSummaryDataSourceStepping::SourceSteppingDimension::BLOCK: return &m_cellBlock; - case SourceSteppingDimension::AQUIFER: + case RimSummaryDataSourceStepping::SourceSteppingDimension::AQUIFER: return &m_aquifer; default: @@ -989,7 +974,7 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu switch ( m_stepDimension() ) { - case SourceSteppingDimension::WELL: + case RimSummaryDataSourceStepping::SourceSteppingDimension::WELL: { auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_WELL, "" ); auto& curName = addr.wellName(); @@ -1009,7 +994,7 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu } break; - case SourceSteppingDimension::GROUP: + case RimSummaryDataSourceStepping::SourceSteppingDimension::GROUP: { auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_GROUP, "" ); auto& curName = addr.groupName(); @@ -1029,7 +1014,7 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu } break; - case SourceSteppingDimension::REGION: + case RimSummaryDataSourceStepping::SourceSteppingDimension::REGION: { auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_REGION, "" ); int curRegion = addr.regionNumber(); @@ -1049,7 +1034,7 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu } break; - case SourceSteppingDimension::VECTOR: + case RimSummaryDataSourceStepping::SourceSteppingDimension::VECTOR: { auto options = optionsForQuantity( addresses ); @@ -1076,7 +1061,7 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu } break; - case SourceSteppingDimension::BLOCK: + case RimSummaryDataSourceStepping::SourceSteppingDimension::BLOCK: { auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_BLOCK, "" ); auto curName = addr.blockAsString(); @@ -1099,7 +1084,7 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu } break; - case SourceSteppingDimension::AQUIFER: + case RimSummaryDataSourceStepping::SourceSteppingDimension::AQUIFER: { auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_AQUIFER, "" ); int curRegion = addr.aquiferNumber(); @@ -1132,35 +1117,35 @@ void RimSummaryPlotSourceStepping::syncWithStepper( RimSummaryPlotSourceStepping { switch ( m_stepDimension() ) { - case SourceSteppingDimension::SUMMARY_CASE: + case RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE: m_summaryCase = other->m_summaryCase(); break; - case SourceSteppingDimension::ENSEMBLE: + case RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE: m_ensemble = other->m_ensemble(); break; - case SourceSteppingDimension::WELL: + case RimSummaryDataSourceStepping::SourceSteppingDimension::WELL: m_wellName = other->m_wellName(); break; - case SourceSteppingDimension::GROUP: + case RimSummaryDataSourceStepping::SourceSteppingDimension::GROUP: m_groupName = other->m_groupName(); break; - case SourceSteppingDimension::REGION: + case RimSummaryDataSourceStepping::SourceSteppingDimension::REGION: m_region = other->m_region(); break; - case SourceSteppingDimension::VECTOR: + case RimSummaryDataSourceStepping::SourceSteppingDimension::VECTOR: m_vectorName = other->m_vectorName(); break; - case SourceSteppingDimension::BLOCK: + case RimSummaryDataSourceStepping::SourceSteppingDimension::BLOCK: m_cellBlock = other->m_cellBlock(); break; - case SourceSteppingDimension::AQUIFER: + case RimSummaryDataSourceStepping::SourceSteppingDimension::AQUIFER: m_aquifer = other->m_aquifer(); break; @@ -1208,7 +1193,7 @@ std::map RimSummaryPlotSourceStepping::optionsForQuantity( std //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimSummaryPlotSourceStepping::SourceSteppingDimension RimSummaryPlotSourceStepping::stepDimension() const +RimSummaryDataSourceStepping::SourceSteppingDimension RimSummaryPlotSourceStepping::stepDimension() const { return m_stepDimension(); } @@ -1216,7 +1201,7 @@ RimSummaryPlotSourceStepping::SourceSteppingDimension RimSummaryPlotSourceSteppi //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryPlotSourceStepping::setStepDimension( SourceSteppingDimension dimension ) +void RimSummaryPlotSourceStepping::setStepDimension( RimSummaryDataSourceStepping::SourceSteppingDimension dimension ) { m_stepDimension = dimension; } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index 4b206c557e..35512dc6d6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -43,19 +43,6 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject { CAF_PDM_HEADER_INIT; -public: - enum class SourceSteppingDimension - { - SUMMARY_CASE, - ENSEMBLE, - WELL, - GROUP, - REGION, - VECTOR, - BLOCK, - AQUIFER - }; - public: RimSummaryPlotSourceStepping(); @@ -73,8 +60,8 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject void syncWithStepper( RimSummaryPlotSourceStepping* other ); - RimSummaryPlotSourceStepping::SourceSteppingDimension stepDimension() const; - void setStepDimension( RimSummaryPlotSourceStepping::SourceSteppingDimension dimension ); + RimSummaryDataSourceStepping::SourceSteppingDimension stepDimension() const; + void setStepDimension( RimSummaryDataSourceStepping::SourceSteppingDimension dimension ); void updateStepIndex( int direction ); @@ -115,8 +102,9 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject private: caf::PdmPointer m_objectForSourceStepping; - caf::PdmField m_indexLabel; - caf::PdmField> m_stepDimension; + caf::PdmField m_indexLabel; + + caf::PdmField> m_stepDimension; caf::PdmPtrField m_summaryCase; caf::PdmPtrField m_ensemble; From fa1f18970907473fbdd3d895ca185e556858c466 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 7 Jun 2022 12:00:57 +0200 Subject: [PATCH 368/406] Simplify "New ... script" enable logic. --- .../RicNewOctaveScriptFeature.cpp | 12 ++---------- .../RicNewPythonScriptFeature.cpp | 12 ++---------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.cpp b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.cpp index 19daa9326a..bb650f963e 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.cpp +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewOctaveScriptFeature.cpp @@ -45,17 +45,9 @@ CAF_CMD_SOURCE_INIT( RicNewOctaveScriptFeature, "RicNewOctaveScriptFeature" ); //-------------------------------------------------------------------------------------------------- bool RicNewOctaveScriptFeature::isCommandEnabled() { - std::vector calcScripts = RicScriptFeatureImpl::selectedScripts(); std::vector calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections(); - if ( calcScripts.size() == 1u && calcScripts.front()->scriptType() == RimCalcScript::OCTAVE ) - { - return true; - } - else if ( calcScriptCollections.size() == 1u && !calcScriptCollections.front()->directory().isEmpty() ) - { - return true; - } - return false; + if ( calcScriptCollections.empty() ) return false; + return !calcScriptCollections.front()->directory().isEmpty(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp index f86e0ce6c9..f1d75cf5f7 100644 --- a/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp +++ b/ApplicationLibCode/Commands/OctaveScriptCommands/RicNewPythonScriptFeature.cpp @@ -46,17 +46,9 @@ CAF_CMD_SOURCE_INIT( RicNewPythonScriptFeature, "RicNewPythonScriptFeature" ); //-------------------------------------------------------------------------------------------------- bool RicNewPythonScriptFeature::isCommandEnabled() { - std::vector calcScripts = RicScriptFeatureImpl::selectedScripts(); std::vector calcScriptCollections = RicScriptFeatureImpl::selectedScriptCollections(); - if ( calcScripts.size() == 1u && calcScripts.front()->scriptType() == RimCalcScript::PYTHON ) - { - return true; - } - else if ( calcScriptCollections.size() == 1u && !calcScriptCollections.front()->directory().isEmpty() ) - { - return true; - } - return false; + if ( calcScriptCollections.empty() ) return false; + return !calcScriptCollections.front()->directory().isEmpty(); } //-------------------------------------------------------------------------------------------------- From d36bf11c62f807bc204e07467b8669f0954c692f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 7 Jun 2022 21:09:36 +0200 Subject: [PATCH 369/406] Several performance fixes (#9026) * #9023 Performance: Use count instead of for loop * #9023 Analyzer: Cache vector names for categories * #9023 Performance : Use cached ensemble analyzer * #9023 Performance : Add min/max values to ensemble statistics * #9023 Performance : Improve statistics calculator * #9023 Performance : Use high performance toInt() * #9023 Performance : Build summary addresses in parallell --- .../Tools/RiaSummaryAddressAnalyzer.cpp | 35 ++++++++- .../Tools/RiaSummaryAddressAnalyzer.h | 6 +- .../RifEclipseSummaryAddress.cpp | 71 ++++++++++++------- .../FileInterface/RifOpmCommonSummary.cpp | 53 +++++++++----- .../RifSummaryReaderInterface.cpp | 10 +-- .../Summary/RimEnsembleCurveSet.cpp | 8 +++ .../Summary/RimEnsembleCurveSet.h | 2 + .../Summary/RimEnsembleStatisticsCase.cpp | 15 ++++ .../Summary/RimEnsembleStatisticsCase.h | 5 ++ .../Summary/RimSummaryCaseCollection.cpp | 19 +++++ .../Summary/RimSummaryCaseCollection.h | 7 +- .../Summary/RimSummaryMultiPlot.cpp | 21 +++++- .../Summary/RimSummaryPlotSourceStepping.cpp | 61 +++++++++++++--- .../Summary/RimSummaryPlotSourceStepping.h | 2 + .../RigStatisticsMath.cpp | 22 +++--- .../RiaSummaryAddressAnalyzer-Test.cpp | 39 ++++++++++ .../UnitTests/RigStatisticsMath-Test.cpp | 35 +++++++++ 17 files changed, 330 insertions(+), 81 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp index 13d334314c..ede8e17170 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.cpp @@ -182,7 +182,7 @@ std::set RiaSummaryAddressAnalyzer::aquifers() const //-------------------------------------------------------------------------------------------------- std::set RiaSummaryAddressAnalyzer::categories() const { - return m_categories; + return keysInMap( m_categories ); } //-------------------------------------------------------------------------------------------------- @@ -312,6 +312,18 @@ std::string RiaSummaryAddressAnalyzer::correspondingHistorySummaryCurveName( con return curveName + historyIdentifier; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::set + RiaSummaryAddressAnalyzer::vectorNamesForCategory( RifEclipseSummaryAddress::SummaryVarCategory category ) +{ + auto it = m_categories.find( category ); + if ( it != m_categories.end() ) return it->second; + + return {}; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -433,7 +445,12 @@ void RiaSummaryAddressAnalyzer::analyzeSingleAddress( const RifEclipseSummaryAdd if ( address.category() != RifEclipseSummaryAddress::SUMMARY_INVALID ) { - m_categories.insert( address.category() ); + if ( m_categories.count( address.category() ) == 0 ) + { + m_categories[address.category()] = { address.vectorName() }; + } + else + m_categories[address.category()].insert( address.vectorName() ); } } @@ -463,6 +480,20 @@ std::set RiaSummaryAddressAnalyzer::keysInMap( const std::multimap RiaSummaryAddressAnalyzer::keysInMap( + const std::map>& map ) +{ + std::set keys; + for ( const auto& [key, value] : map ) + { + keys.insert( key ); + } + return keys; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h index 6a73167784..685470a417 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h +++ b/ApplicationLibCode/Application/Tools/RiaSummaryAddressAnalyzer.h @@ -69,6 +69,8 @@ class RiaSummaryAddressAnalyzer static std::string correspondingHistorySummaryCurveName( const std::string& curveName ); + std::set vectorNamesForCategory( RifEclipseSummaryAddress::SummaryVarCategory category ); + private: void assignCategoryToQuantities() const; void computeQuantityNamesWithHistory() const; @@ -77,6 +79,8 @@ class RiaSummaryAddressAnalyzer static std::set keysInMap( const std::multimap& map ); static std::set keysInMap( const std::multimap& map ); + static std::set + keysInMap( const std::map>& map ); static std::vector> valuesInMap( const std::multimap& map ); @@ -98,5 +102,5 @@ class RiaSummaryAddressAnalyzer std::multimap m_blocks; std::multimap m_aquifers; - std::set m_categories; + std::map> m_categories; }; diff --git a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp index bb522a0584..697c33bdab 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseSummaryAddress.cpp @@ -727,6 +727,10 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector std::string token1; std::string token2; + int intValue0 = 0; + int intValue1 = 0; + int intValue2 = 0; + vectorName = tokens[0]; if ( tokens.size() > 1 ) token1 = tokens[1]; @@ -740,7 +744,11 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector return fieldAddress( vectorName ); case SUMMARY_AQUIFER: - if ( !token1.empty() ) return aquiferAddress( vectorName, RiaStdStringTools::toInt( token1 ) ); + if ( !token1.empty() ) + { + RiaStdStringTools::toInt( token1, intValue0 ); + return aquiferAddress( vectorName, intValue0 ); + } break; case SUMMARY_NETWORK: @@ -752,7 +760,11 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector break; case SUMMARY_REGION: - if ( !token1.empty() ) return regionAddress( vectorName, RiaStdStringTools::toInt( token1 ) ); + if ( !token1.empty() ) + { + RiaStdStringTools::toInt( token1, intValue0 ); + return regionAddress( vectorName, intValue0 ); + } break; case SUMMARY_REGION_2_REGION: @@ -761,9 +773,10 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector auto regions = RiaStdStringTools::splitString( token1, '-' ); if ( regions.size() == 2 ) { - return regionToRegionAddress( vectorName, - RiaStdStringTools::toInt( regions[0] ), - RiaStdStringTools::toInt( regions[1] ) ); + RiaStdStringTools::toInt( regions[0], intValue0 ); + RiaStdStringTools::toInt( regions[1], intValue1 ); + + return regionToRegionAddress( vectorName, intValue0, intValue1 ); } } break; @@ -782,11 +795,11 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector auto ijk = RiaStdStringTools::splitString( token2, ',' ); if ( ijk.size() == 3 ) { - return wellCompletionAddress( vectorName, - token1, - RiaStdStringTools::toInt( ijk[0] ), - RiaStdStringTools::toInt( ijk[1] ), - RiaStdStringTools::toInt( ijk[2] ) ); + RiaStdStringTools::toInt( ijk[0], intValue0 ); + RiaStdStringTools::toInt( ijk[1], intValue1 ); + RiaStdStringTools::toInt( ijk[2], intValue2 ); + + return wellCompletionAddress( vectorName, token1, intValue0, intValue1, intValue2 ); } } break; @@ -802,18 +815,23 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector auto ijk = RiaStdStringTools::splitString( token3, ',' ); if ( ijk.size() == 3 ) { - return wellCompletionLgrAddress( vectorName, - token1, - token2, - RiaStdStringTools::toInt( ijk[0] ), - RiaStdStringTools::toInt( ijk[1] ), - RiaStdStringTools::toInt( ijk[2] ) ); + RiaStdStringTools::toInt( ijk[0], intValue0 ); + RiaStdStringTools::toInt( ijk[1], intValue1 ); + RiaStdStringTools::toInt( ijk[2], intValue2 ); + + return wellCompletionLgrAddress( vectorName, token1, token2, intValue0, intValue1, intValue2 ); } } break; case SUMMARY_WELL_SEGMENT: - if ( !token2.empty() ) return wellSegmentAddress( vectorName, token1, RiaStdStringTools::toInt( token2 ) ); + + if ( !token2.empty() ) + { + RiaStdStringTools::toInt( token2, intValue0 ); + + return wellSegmentAddress( vectorName, token1, intValue0 ); + } break; case SUMMARY_BLOCK: @@ -822,10 +840,11 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector auto ijk = RiaStdStringTools::splitString( token1, ',' ); if ( ijk.size() == 3 ) { - return blockAddress( vectorName, - RiaStdStringTools::toInt( ijk[0] ), - RiaStdStringTools::toInt( ijk[1] ), - RiaStdStringTools::toInt( ijk[2] ) ); + RiaStdStringTools::toInt( ijk[0], intValue0 ); + RiaStdStringTools::toInt( ijk[1], intValue1 ); + RiaStdStringTools::toInt( ijk[2], intValue2 ); + + return blockAddress( vectorName, intValue0, intValue1, intValue2 ); } } break; @@ -836,11 +855,11 @@ RifEclipseSummaryAddress RifEclipseSummaryAddress::fromTokens( const std::vector auto ijk = RiaStdStringTools::splitString( token2, ',' ); if ( ijk.size() == 3 ) { - return blockLgrAddress( vectorName, - token1, - RiaStdStringTools::toInt( ijk[0] ), - RiaStdStringTools::toInt( ijk[1] ), - RiaStdStringTools::toInt( ijk[2] ) ); + RiaStdStringTools::toInt( ijk[0], intValue0 ); + RiaStdStringTools::toInt( ijk[1], intValue1 ); + RiaStdStringTools::toInt( ijk[2], intValue2 ); + + return blockLgrAddress( vectorName, token1, intValue0, intValue1, intValue2 ); } } break; diff --git a/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp b/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp index 6ac6923eee..f4548c79e0 100644 --- a/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp +++ b/ApplicationLibCode/FileInterface/RifOpmCommonSummary.cpp @@ -395,32 +395,49 @@ std::pair, std::map invalidKeywords; - for ( const auto& keyword : keywords ) +#pragma omp parallel { - auto eclAdr = RifEclipseSummaryAddress::fromEclipseTextAddress( keyword ); - if ( !eclAdr.isValid() ) + std::set threadAddresses; + std::map threadAddressToNodeIndexMap; + std::vector threadInvalidKeywords; + +#pragma omp for + for ( int index = 0; index < (int)keywords.size(); index++ ) { - invalidKeywords.push_back( keyword ); + auto keyword = keywords[index]; - // If a category is not found, use the MISC category - eclAdr = RifEclipseSummaryAddress::miscAddress( keyword ); - } + auto eclAdr = RifEclipseSummaryAddress::fromEclipseTextAddress( keyword ); + if ( !eclAdr.isValid() ) + { + threadInvalidKeywords.push_back( keyword ); - if ( eclAdr.isValid() ) - { - addresses.insert( eclAdr ); - addressToNodeIndexMap[eclAdr] = keyword; + // If a category is not found, use the MISC category + eclAdr = RifEclipseSummaryAddress::miscAddress( keyword ); + } + + if ( eclAdr.isValid() ) + { + threadAddresses.insert( eclAdr ); + threadAddressToNodeIndexMap[eclAdr] = keyword; + } } - } - // DEBUG code - // Used to print keywords not being categorized correctly - /* - for ( const auto& kw : invalidKeywords ) +#pragma omp critical { - RiaLogging::warning( QString::fromStdString( kw ) ); + addresses.insert( threadAddresses.begin(), threadAddresses.end() ); + addressToNodeIndexMap.insert( threadAddressToNodeIndexMap.begin(), threadAddressToNodeIndexMap.end() ); + invalidKeywords.insert( invalidKeywords.end(), threadInvalidKeywords.begin(), threadInvalidKeywords.end() ); } - */ + + // DEBUG code + // Used to print keywords not being categorized correctly + /* + for ( const auto& kw : invalidKeywords ) + { + RiaLogging::warning( QString::fromStdString( kw ) ); + } + */ + } return { addresses, addressToNodeIndexMap }; } diff --git a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp index 326fbd0917..599ab33b0e 100644 --- a/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp +++ b/ApplicationLibCode/FileInterface/RifSummaryReaderInterface.cpp @@ -57,13 +57,5 @@ bool RifSummaryReaderInterface::hasAddress( const RifEclipseSummaryAddress& resu static const RifEclipseSummaryAddress defaultAdr = RifEclipseSummaryAddress(); if ( resultAddress == defaultAdr ) return true; - for ( const RifEclipseSummaryAddress& summaryAddress : m_allResultAddresses ) - { - if ( summaryAddress == resultAddress ) - { - return true; - } - } - - return false; + return ( m_allResultAddresses.count( resultAddress ) > 0 ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index eef1eb2a7d..a39c0ed4ba 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -1967,6 +1967,14 @@ bool RimEnsembleCurveSet::hasMeanData() const return m_ensembleStatCase->hasMeanData(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RimEnsembleCurveSet::minimumAndMaximumValues() const +{ + return m_ensembleStatCase->minimumAndMaximumValues(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index 2aa535d10f..10f31b6e88 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -155,6 +155,8 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt bool hasP90Data() const override; bool hasMeanData() const override; + std::pair minimumAndMaximumValues() const; + void appendColorGroup( caf::PdmUiOrdering& uiOrdering ); static void appendOptionItemsForSummaryAddresses( QList* options, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp index 9b1614291b..8692e2b6d0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp @@ -39,6 +39,8 @@ /// //-------------------------------------------------------------------------------------------------- RimEnsembleStatisticsCase::RimEnsembleStatisticsCase( RimEnsembleCurveSet* curveSet ) + : m_minimumValue( DOUBLE_INF ) + , m_maximumValue( -DOUBLE_INF ) { m_curveSet = curveSet; } @@ -83,6 +85,14 @@ const std::vector& RimEnsembleStatisticsCase::mean() const return m_meanData; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +const std::pair RimEnsembleStatisticsCase::minimumAndMaximumValues() const +{ + return { m_minimumValue, m_maximumValue }; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -195,6 +205,11 @@ void RimEnsembleStatisticsCase::calculate( const std::vector su m_p50Data.push_back( p50 ); m_p90Data.push_back( p90 ); m_meanData.push_back( mean ); + + const auto [min, max] = std::minmax_element( begin( valuesAtTimeStep ), end( valuesAtTimeStep ) ); + + m_maximumValue = std::max( m_maximumValue, *max ); + m_minimumValue = std::min( m_minimumValue, *min ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h index 20b53581ac..5e734b6222 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h @@ -40,6 +40,8 @@ class RimEnsembleStatisticsCase : public RimSummaryCase const std::vector& p90() const; const std::vector& mean() const; + const std::pair minimumAndMaximumValues() const; + bool hasP10Data() const { return !m_p10Data.empty(); } bool hasP50Data() const { return !m_p50Data.empty(); } bool hasP90Data() const { return !m_p90Data.empty(); } @@ -72,4 +74,7 @@ class RimEnsembleStatisticsCase : public RimSummaryCase std::vector m_p50Data; std::vector m_p90Data; std::vector m_meanData; + + double m_maximumValue; + double m_minimumValue; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index ff0bbfcebb..33599139e6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -22,6 +22,7 @@ #include "RiaLogging.h" #include "RiaStatisticsTools.h" #include "RiaStdStringTools.h" +#include "RiaSummaryAddressAnalyzer.h" #include "RiaWeightedMeanCalculator.h" #include "RicfCommandObject.h" @@ -158,6 +159,7 @@ void RimSummaryCaseCollection::removeCase( RimSummaryCase* summaryCase, bool not m_cases.removeChild( summaryCase ); m_cachedSortedEnsembleParameters.clear(); + m_analyzer.reset(); caseRemoved.send( summaryCase ); @@ -184,6 +186,7 @@ void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase ) m_cases.push_back( summaryCase ); m_cachedSortedEnsembleParameters.clear(); + m_analyzer.reset(); // Update derived ensemble cases (if any) std::vector referringObjects; @@ -344,6 +347,7 @@ std::set RimSummaryCaseCollection::ensembleTimeSteps() const } return allTimeSteps; } + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -929,6 +933,21 @@ void RimSummaryCaseCollection::updateReferringCurveSets() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiaSummaryAddressAnalyzer* RimSummaryCaseCollection::addressAnalyzer() +{ + if ( !m_analyzer ) + { + m_analyzer = std::make_unique(); + + m_analyzer->appendAddresses( ensembleSummaryAddresses() ); + } + + return m_analyzer.get(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h index 394fc7b6a0..be50d153fa 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h @@ -35,6 +35,7 @@ #include +#include #include #include @@ -42,6 +43,7 @@ class RifReaderRftInterface; class RifReaderEnsembleStatisticsRft; class RimSummaryCase; class RimSummaryAddressCollection; +class RiaSummaryAddressAnalyzer; //================================================================================================== /// @@ -110,6 +112,8 @@ class RimSummaryCaseCollection : public caf::PdmObject void updateReferringCurveSets(); + RiaSummaryAddressAnalyzer* addressAnalyzer(); + private: RigEnsembleParameter createEnsembleParameter( const QString& paramName ) const; static void sortByBinnedVariation( std::vector& parameterVector ); @@ -146,5 +150,6 @@ class RimSummaryCaseCollection : public caf::PdmObject size_t m_commonAddressCount; // if different address count among cases, set to 0 - mutable std::vector m_cachedSortedEnsembleParameters; + mutable std::vector m_cachedSortedEnsembleParameters; + std::unique_ptr m_analyzer; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 48df237ee2..3ae1635ac1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -981,7 +981,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() for ( auto axis : plot->plotAxes() ) { - for ( auto curve : plot->summaryAndEnsembleCurves() ) + for ( auto curve : plot->summaryCurves() ) { if ( curve->axisY() == axis->plotAxisType() ) { @@ -1002,6 +1002,25 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() } } } + + for ( auto curveSet : plot->curveSets() ) + { + if ( curveSet->axisY() == axis->plotAxisType() ) + { + auto [minimum, maximum] = curveSet->minimumAndMaximumValues(); + + if ( axisRanges.count( axis->plotAxisType() ) == 0 ) + { + axisRanges[axis->plotAxisType()] = std::make_pair( minimum, maximum ); + } + else + { + auto& [currentMin, currentMax] = axisRanges[axis->plotAxisType()]; + axisRanges[axis->plotAxisType()] = + std::make_pair( std::min( currentMin, minimum ), std::max( currentMax, maximum ) ); + } + } + } } // set all plots to use the global min/max values for each category diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index c3e6cd9eac..70de196336 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -211,12 +211,29 @@ QList return options; } - auto addresses = adressesForSourceStepping(); - if ( !addresses.empty() ) + RiaSummaryAddressAnalyzer fallbackAnalyzer; + RiaSummaryAddressAnalyzer* analyzer = nullptr; + if ( !dataSourceSteppingObject()->curveSets().empty() ) + { + auto first = dataSourceSteppingObject()->curveSets().front(); + analyzer = first->summaryCaseCollection()->addressAnalyzer(); + } + + if ( !analyzer ) + { + // No cached analyzer found. Fallback to population of a local analyzer. Try to avoid this, as the analysis + // operation is quite expensive. + + auto addresses = adressesForSourceStepping(); + fallbackAnalyzer.appendAddresses( addresses ); + analyzer = &fallbackAnalyzer; + } + + if ( analyzer ) { if ( fieldNeedingOptions == &m_vectorName ) { - std::map displayAndValueStrings = optionsForQuantity( addresses ); + auto displayAndValueStrings = optionsForQuantity( analyzer ); for ( const auto& displayAndValue : displayAndValueStrings ) { @@ -268,10 +285,7 @@ QList if ( category != RifEclipseSummaryAddress::SUMMARY_INVALID ) { - RiaSummaryAddressAnalyzer analyzer; - analyzer.appendAddresses( addresses ); - - identifierTexts = analyzer.identifierTexts( category, secondaryIdentifier ); + identifierTexts = analyzer->identifierTexts( category, secondaryIdentifier ); } if ( !identifierTexts.empty() ) @@ -1175,9 +1189,6 @@ std::map RimSummaryPlotSourceStepping::optionsForQuantity( std auto subset = RiaSummaryAddressAnalyzer::addressesForCategory( addresses, category ); quantityAnalyzer.appendAddresses( subset ); - RiaSummaryAddressAnalyzer analyzerForVisibleCurves; - analyzerForVisibleCurves.appendAddresses( visibleCurveAddresses ); - auto quantities = quantityAnalyzer.quantities(); for ( const auto& s : quantities ) { @@ -1190,6 +1201,36 @@ std::map RimSummaryPlotSourceStepping::optionsForQuantity( std return displayAndValueStrings; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::map RimSummaryPlotSourceStepping::optionsForQuantity( RiaSummaryAddressAnalyzer* analyzser ) +{ + RifEclipseSummaryAddress::SummaryVarCategory category = RifEclipseSummaryAddress::SUMMARY_FIELD; + + auto visibleCurveAddresses = addressesForCurvesInPlot(); + if ( !visibleCurveAddresses.empty() ) + { + category = visibleCurveAddresses.begin()->category(); + } + + std::map displayAndValueStrings; + + if ( analyzser ) + { + auto vectorNames = analyzser->vectorNamesForCategory( category ); + + for ( const auto& s : vectorNames ) + { + QString valueString = QString::fromStdString( s ); + + displayAndValueStrings[valueString] = valueString; + } + } + + return displayAndValueStrings; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index 35512dc6d6..dd1dacda0e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -35,6 +35,7 @@ class RimSummaryCurve; class RifSummaryReaderInterface; class RimSummaryCaseCollection; class RifEclipseSummaryAddress; +class RiaSummaryAddressAnalyzer; //================================================================================================== /// @@ -98,6 +99,7 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject RimSummaryDataSourceStepping* dataSourceSteppingObject() const; std::map optionsForQuantity( std::set addresses ); + std::map optionsForQuantity( RiaSummaryAddressAnalyzer* analyzser ); private: caf::PdmPointer m_objectForSourceStepping; diff --git a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp index 0ae38b380b..b8c75c9281 100644 --- a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp +++ b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.cpp @@ -105,20 +105,16 @@ void RigStatisticsMath::calculateStatisticsCurves( const std::vector& va P90 }; - std::vector sortedValues; - double valueSum = 0; + std::vector sortedValues = values; - { - std::multiset vSet( values.begin(), values.end() ); - for ( double v : vSet ) - { - if ( RiaStatisticsTools::isValidNumber( v ) ) - { - sortedValues.push_back( v ); - valueSum += v; - } - } - } + sortedValues.erase( std::remove_if( sortedValues.begin(), + sortedValues.end(), + []( double x ) { return !RiaStatisticsTools::isValidNumber( x ); } ), + sortedValues.end() ); + + std::sort( sortedValues.begin(), sortedValues.end() ); + + double valueSum = std::accumulate( sortedValues.begin(), sortedValues.end(), 0.0 ); int valueCount = (int)sortedValues.size(); double percentiles[] = { 0.1, 0.5, 0.9 }; diff --git a/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp b/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp index bd9c76de9a..9dc48e58e9 100644 --- a/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp +++ b/ApplicationLibCode/UnitTests/RiaSummaryAddressAnalyzer-Test.cpp @@ -138,3 +138,42 @@ TEST( RiaSummaryAddressAnalyzer, CellBlocks ) auto blocks = analyzer.blocks(); EXPECT_EQ( 3u, blocks.size() ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( RiaSummaryAddressAnalyzer, QuantitiesPerCategory ) +{ + std::vector addresses; + + { + RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::fieldAddress( "FOPT" ); + addresses.push_back( adr ); + } + { + RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::fieldAddress( "FOPR" ); + addresses.push_back( adr ); + } + + { + RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellAddress( "WOPT", "WellA" ); + addresses.push_back( adr ); + } + { + RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellAddress( "WOPR", "WellB" ); + addresses.push_back( adr ); + } + { + RifEclipseSummaryAddress adr = RifEclipseSummaryAddress::wellAddress( "WWPR", "WellA" ); + addresses.push_back( adr ); + } + + RiaSummaryAddressAnalyzer analyzer; + analyzer.appendAddresses( addresses ); + + auto categories = analyzer.categories(); + EXPECT_EQ( 2u, categories.size() ); + + auto vectorNamesForWells = analyzer.vectorNamesForCategory( RifEclipseSummaryAddress::SUMMARY_WELL ); + EXPECT_EQ( 3u, vectorNamesForWells.size() ); +} diff --git a/ApplicationLibCode/UnitTests/RigStatisticsMath-Test.cpp b/ApplicationLibCode/UnitTests/RigStatisticsMath-Test.cpp index 17e42e4c6a..de0a3820c8 100644 --- a/ApplicationLibCode/UnitTests/RigStatisticsMath-Test.cpp +++ b/ApplicationLibCode/UnitTests/RigStatisticsMath-Test.cpp @@ -20,6 +20,7 @@ #include "gtest/gtest.h" +#include "QElapsedTimer" #include "RigStatisticsMath.h" //-------------------------------------------------------------------------------------------------- @@ -295,3 +296,37 @@ TEST( RigStatisticsMath, calculateStatisticsCurves ) EXPECT_DOUBLE_EQ( 1.0, mean ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +TEST( RigStatisticsMath, DISABLED_performanceTesting ) +{ + RigStatisticsMath::PercentileStyle percentileStyle = RigStatisticsMath::PercentileStyle::REGULAR; + { + size_t timerCount = 10; + for ( size_t t = 0; t < timerCount; t++ ) + { + QElapsedTimer timer; + timer.start(); + + size_t iterationCount = 10000; + for ( size_t i = 0; i < iterationCount; i++ ) + { + size_t numberOfValues = 200; + std::vector values( numberOfValues ); + std::iota( values.begin(), values.end(), numberOfValues ); + + double mean = HUGE_VAL; + double p10 = HUGE_VAL; + double p50 = HUGE_VAL; + double p90 = HUGE_VAL; + + RigStatisticsMath::calculateStatisticsCurves( values, &p10, &p50, &p90, &mean, percentileStyle ); + } + + auto testDuration = timer.elapsed(); + std::cout << testDuration << "\n"; + } + } +} From 47fb8957c14bab12ab5ca88cc450405f0f860f37 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 7 Jun 2022 22:44:01 +0200 Subject: [PATCH 370/406] #9023 Performance : Temporary fix for axis range aggregation --- .../Summary/RimSummaryCaseCollection.cpp | 43 +++++++++++++++++++ .../Summary/RimSummaryCaseCollection.h | 6 +++ .../Summary/RimSummaryMultiPlot.cpp | 22 +++++++++- 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index 33599139e6..3443f74f4d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -948,6 +948,49 @@ RiaSummaryAddressAnalyzer* RimSummaryCaseCollection::addressAnalyzer() return m_analyzer.get(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCaseCollection::computeMinMax( const RifEclipseSummaryAddress& address ) +{ + if ( m_minMaxValues.count( address ) > 0 ) return; + + double minimumValue( std::numeric_limits::infinity() ); + double maximumValue( -std::numeric_limits::infinity() ); + + std::vector values; + for ( auto s : m_cases() ) + { + if ( !s->summaryReader() ) continue; + + s->summaryReader()->values( address, &values ); + const auto [min, max] = std::minmax_element( begin( values ), end( values ) ); + + minimumValue = std::min( *min, minimumValue ); + maximumValue = std::max( *max, maximumValue ); + } + + setMinMax( address, minimumValue, maximumValue ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryCaseCollection::setMinMax( const RifEclipseSummaryAddress& address, double min, double max ) +{ + m_minMaxValues[address] = std::pair( min, max ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RimSummaryCaseCollection::minMax( const RifEclipseSummaryAddress& address ) +{ + computeMinMax( address ); + + return m_minMaxValues[address]; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h index be50d153fa..56457714b5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.h @@ -114,6 +114,10 @@ class RimSummaryCaseCollection : public caf::PdmObject RiaSummaryAddressAnalyzer* addressAnalyzer(); + void computeMinMax( const RifEclipseSummaryAddress& address ); + void setMinMax( const RifEclipseSummaryAddress& address, double min, double max ); + std::pair minMax( const RifEclipseSummaryAddress& address ); + private: RigEnsembleParameter createEnsembleParameter( const QString& paramName ) const; static void sortByBinnedVariation( std::vector& parameterVector ); @@ -152,4 +156,6 @@ class RimSummaryCaseCollection : public caf::PdmObject mutable std::vector m_cachedSortedEnsembleParameters; std::unique_ptr m_analyzer; + + std::map> m_minMaxValues; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 3ae1635ac1..85f7a0d086 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -1007,7 +1007,27 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() { if ( curveSet->axisY() == axis->plotAxisType() ) { - auto [minimum, maximum] = curveSet->minimumAndMaximumValues(); + double minimum( std::numeric_limits::infinity() ); + double maximum( -std::numeric_limits::infinity() ); + + auto curves = curveSet->curves(); + if ( !curves.empty() ) + { + // TODO: Use analyzer as input to addressesForCurve instead of curve + + auto curve = curves.front(); + + std::vector addresses = + addressesForCurve( curve, m_axisRangeAggregation() ); + + for ( auto adr : addresses ) + { + auto [min, max] = curveSet->summaryCaseCollection()->minMax( adr ); + + minimum = std::min( min, minimum ); + maximum = std::max( max, maximum ); + } + } if ( axisRanges.count( axis->plotAxisType() ) == 0 ) { From d146ada59210f74b8cb60de2dbb354c1dc07cabb Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 9 Jun 2022 11:01:27 +0200 Subject: [PATCH 371/406] #9037 RFT import: Missing data in RFT file caused crash --- .../FileInterface/RifReaderOpmRft.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp index b73840b077..81db96f123 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp @@ -42,6 +42,10 @@ RifReaderOpmRft::RifReaderOpmRft( const QString& fileName ) buildMetaData(); } + catch ( const std::exception& e ) + { + RiaLogging::error( QString( "Failed to open RFT file %1\n%2" ).arg( fileName ).arg( e.what() ) ); + } catch ( ... ) { RiaLogging::error( QString( "Failed to open RFT file %1" ).arg( fileName ) ); @@ -445,9 +449,16 @@ void RifReaderOpmRft::importWellNames() std::vector RifReaderOpmRft::importWellData( const std::string& wellName, const std::string& propertyName, const RftDate& date ) const { - if ( m_opm_rft->hasArray( propertyName, wellName, date ) ) + try + { + // THe hasArray method can throw, so we must use a try/catch block here + if ( m_opm_rft->hasArray( propertyName, wellName, date ) ) + { + return m_opm_rft->getRft( propertyName, wellName, date ); + } + } + catch ( ... ) { - return m_opm_rft->getRft( propertyName, wellName, date ); } return {}; From 2fdd5875ead1b5ebcc876c32d0bbf5ad9c9f2444 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 9 Jun 2022 13:23:28 +0200 Subject: [PATCH 372/406] Update multiplot source stepping - append plot (#9030) * Make sure we append a new plot for all plots that matches the current source stepper, allows stepping and appending multiple plots at once --- .../Summary/RimSummaryMultiPlot.cpp | 64 ++++----- .../Summary/RimSummaryPlotSourceStepping.cpp | 126 +++++++++++++++++- .../Summary/RimSummaryPlotSourceStepping.h | 4 + 3 files changed, 157 insertions(+), 37 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 85f7a0d086..53ee2a45fa 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -1292,52 +1292,54 @@ void RimSummaryMultiPlot::appendSubPlotByStepping( int direction ) { if ( summaryPlots().empty() ) return; - auto newPlots = RicSummaryPlotBuilder::duplicatePlots( { summaryPlots().back() } ); - if ( newPlots.empty() ) return; + // find matching plots + std::vector plots = m_sourceStepping->plotsMatchingStepSettings( summaryPlots() ); + if ( plots.empty() ) return; - RimSummaryPlot* newPlot = dynamic_cast( newPlots[0] ); - if ( newPlot == nullptr ) return; + // duplicate them + auto newPlots = RicSummaryPlotBuilder::duplicatePlots( plots ); + if ( newPlots.empty() ) return; - if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE ) + for ( auto plot : newPlots ) { + RimSummaryPlot* newPlot = dynamic_cast( plot ); + if ( newPlot == nullptr ) continue; + + addPlot( newPlot ); newPlot->resolveReferencesRecursively(); - RimSummaryCase* newCase = m_sourceStepping()->stepCase( direction ); - for ( auto curve : newPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) ) + if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE ) { - curve->setSummaryCaseX( newCase ); - curve->setSummaryCaseY( newCase ); + RimSummaryCase* newCase = m_sourceStepping()->stepCase( direction ); + for ( auto curve : newPlot->allCurves( RimSummaryDataSourceStepping::Axis::Y_AXIS ) ) + { + curve->setSummaryCaseX( newCase ); + curve->setSummaryCaseY( newCase ); + } } - } - else if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE ) - { - newPlot->resolveReferencesRecursively(); - - RimSummaryCaseCollection* newEnsemble = m_sourceStepping()->stepEnsemble( direction ); - for ( auto curveSet : newPlot->curveSets() ) + else if ( m_sourceStepping()->stepDimension() == RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE ) { - curveSet->setSummaryCaseCollection( newEnsemble ); + RimSummaryCaseCollection* newEnsemble = m_sourceStepping()->stepEnsemble( direction ); + for ( auto curveSet : newPlot->curveSets() ) + { + curveSet->setSummaryCaseCollection( newEnsemble ); + } } - } - else - { - auto mods = RimSummaryAddressModifier::createAddressModifiersForPlot( newPlot ); - for ( auto& mod : mods ) + else { - auto modifiedAdr = m_sourceStepping()->stepAddress( mod.address(), direction ); - mod.setAddress( modifiedAdr ); + auto mods = RimSummaryAddressModifier::createAddressModifiersForPlot( newPlot ); + for ( auto& mod : mods ) + { + auto modifiedAdr = m_sourceStepping()->stepAddress( mod.address(), direction ); + mod.setAddress( modifiedAdr ); + } } } - addPlot( newPlot ); - - newPlot->resolveReferencesRecursively(); - newPlot->loadDataAndUpdate(); - - updatePlotWindowTitle(); + loadDataAndUpdate(); updateConnectedEditors(); - RiuPlotMainWindowTools::selectAsCurrentItem( newPlot, true ); + RiuPlotMainWindowTools::selectAsCurrentItem( newPlots.back(), true ); updateSourceStepper(); RiuPlotMainWindowTools::refreshToolbars(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 70de196336..c694b626a9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -28,6 +28,7 @@ #include "RimEnsembleCurveSet.h" #include "RimEnsembleCurveSetCollection.h" #include "RimProject.h" +#include "RimSummaryAddressModifier.h" #include "RimSummaryCase.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCrossPlot.h" @@ -1030,9 +1031,9 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu case RimSummaryDataSourceStepping::SourceSteppingDimension::REGION: { - auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_REGION, "" ); - int curRegion = addr.regionNumber(); - auto found = std::find( ids.begin(), ids.end(), curRegion ); + auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_REGION, "" ); + QString curRegion = QString::number( addr.regionNumber() ); + auto found = std::find( ids.begin(), ids.end(), curRegion ); if ( found != ids.end() ) { if ( direction > 0 ) @@ -1100,9 +1101,9 @@ RifEclipseSummaryAddress RimSummaryPlotSourceStepping::stepAddress( RifEclipseSu case RimSummaryDataSourceStepping::SourceSteppingDimension::AQUIFER: { - auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_AQUIFER, "" ); - int curRegion = addr.aquiferNumber(); - auto found = std::find( ids.begin(), ids.end(), curRegion ); + auto ids = analyzer.identifierTexts( RifEclipseSummaryAddress::SUMMARY_AQUIFER, "" ); + QString curAq = QString::number( addr.aquiferNumber() ); + auto found = std::find( ids.begin(), ids.end(), curAq ); if ( found != ids.end() ) { if ( direction > 0 ) @@ -1331,3 +1332,116 @@ void RimSummaryPlotSourceStepping::updateStepIndex( int direction ) bool notifyChange = false; modifyCurrentIndex( valueField, direction, notifyChange ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryPlotSourceStepping::plotsMatchingStepSettings( std::vector plots ) +{ + std::vector matchingPlots; + + int caseIdToMatch = -1; + int ensembleIdToMatch = -1; + std::string wellNameToMatch; + std::string groupNameToMatch; + int regionToMatch = -1; + std::string vectorToMatch; + std::string blockToMatch; + int aquiferToMatch = -1; + + switch ( m_stepDimension() ) + { + case RimSummaryDataSourceStepping::SourceSteppingDimension::SUMMARY_CASE: + if ( m_summaryCase() ) caseIdToMatch = m_summaryCase()->caseId(); + break; + + case RimSummaryDataSourceStepping::SourceSteppingDimension::ENSEMBLE: + if ( m_ensemble() ) ensembleIdToMatch = m_ensemble()->ensembleId(); + break; + + case RimSummaryDataSourceStepping::SourceSteppingDimension::WELL: + wellNameToMatch = m_wellName().toStdString(); + break; + + case RimSummaryDataSourceStepping::SourceSteppingDimension::GROUP: + groupNameToMatch = m_groupName().toStdString(); + break; + + case RimSummaryDataSourceStepping::SourceSteppingDimension::REGION: + regionToMatch = m_region(); + break; + + case RimSummaryDataSourceStepping::SourceSteppingDimension::VECTOR: + vectorToMatch = m_vectorName().toStdString(); + break; + + case RimSummaryDataSourceStepping::SourceSteppingDimension::BLOCK: + blockToMatch = m_cellBlock().toStdString(); + break; + + case RimSummaryDataSourceStepping::SourceSteppingDimension::AQUIFER: + aquiferToMatch = m_aquifer(); + break; + + default: + break; + } + + for ( auto plot : plots ) + { + bool isMatching = false; + + if ( caseIdToMatch != -1 ) + { + auto curves = plot->summaryCurves(); + for ( auto c : curves ) + { + if ( c->summaryCaseY()->caseId() == caseIdToMatch ) isMatching = true; + } + } + else if ( ensembleIdToMatch != -1 ) + { + auto curves = plot->curveSets(); + for ( auto c : curves ) + { + if ( c->ensembleId() == ensembleIdToMatch ) isMatching = true; + } + } + else + { + auto addresses = RimSummaryAddressModifier::createEclipseSummaryAddress( plot ); + + for ( const auto& a : addresses ) + { + if ( !wellNameToMatch.empty() && a.wellName() == wellNameToMatch ) + { + isMatching = true; + } + else if ( !vectorToMatch.empty() && a.vectorName() == vectorToMatch ) + { + isMatching = true; + } + else if ( !groupNameToMatch.empty() && a.groupName() == groupNameToMatch ) + { + isMatching = true; + } + else if ( regionToMatch != -1 && a.regionNumber() == regionToMatch ) + { + isMatching = true; + } + else if ( !blockToMatch.empty() && a.blockAsString() == blockToMatch ) + { + isMatching = true; + } + else if ( aquiferToMatch != -1 && a.aquiferNumber() == aquiferToMatch ) + { + isMatching = true; + } + } + } + + if ( isMatching ) matchingPlots.push_back( plot ); + } + + return matchingPlots; +} diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h index dd1dacda0e..9ce872bcc7 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.h @@ -36,6 +36,8 @@ class RifSummaryReaderInterface; class RimSummaryCaseCollection; class RifEclipseSummaryAddress; class RiaSummaryAddressAnalyzer; +class RimSummaryPlot; +class RimPlot; //================================================================================================== /// @@ -66,6 +68,8 @@ class RimSummaryPlotSourceStepping : public caf::PdmObject void updateStepIndex( int direction ); + std::vector plotsMatchingStepSettings( std::vector plots ); + private: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; From 5b4434439ed8a25f406faea8ef1025b660daa834 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 8 Jun 2022 23:17:16 +0200 Subject: [PATCH 373/406] #8991 3D grid cross plot: Select correct grid model. --- .../RicCreateGridCrossPlotFeature.cpp | 8 ++++-- .../RimGridCrossPlotDataSet.cpp | 25 +++++++++++++------ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateGridCrossPlotFeature.cpp b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateGridCrossPlotFeature.cpp index d504673a58..6164d3894e 100644 --- a/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateGridCrossPlotFeature.cpp +++ b/ApplicationLibCode/Commands/GridCrossPlotCommands/RicCreateGridCrossPlotFeature.cpp @@ -68,8 +68,12 @@ void RicCreateGridCrossPlotFeature::onActionTriggered( bool isChecked ) } else { - // Triggered from context menu: get the selected view - // TODO: get the filter from somewhere + caf::PdmObject* selectedObject = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + if ( !selectedObject ) return; + + RimGridView* cellFilterView = nullptr; + selectedObject->firstAncestorOrThisOfType( cellFilterView ); + if ( cellFilterView ) dataSet->setCellFilterView( cellFilterView ); } plot->loadDataAndUpdate(); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp index 9d08a5b10c..063c11398b 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp @@ -165,18 +165,29 @@ void RimGridCrossPlotDataSet::setCellFilterView( RimGridView* cellFilterView ) RigEclipseResultAddress resAddr = eclipseView->cellResult()->eclipseResultAddress(); if ( resAddr.isValid() ) { + m_grouping = NO_GROUPING; + + RimEclipseCase* eclipseCase = eclipseView->eclipseCase(); + if ( eclipseCase ) + { + m_case = eclipseCase; + m_xAxisProperty->setEclipseCase( eclipseCase ); + m_yAxisProperty->setEclipseCase( eclipseCase ); + m_groupingProperty->setEclipseCase( eclipseCase ); + + if ( eclipseCase->activeFormationNames() ) + { + m_grouping = GROUP_BY_FORMATION; + m_groupingProperty->legendConfig()->setColorLegend( + RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::ColorRangesType::CATEGORY ) ); + } + } + m_xAxisProperty->setResultType( resAddr.resultCatType() ); m_xAxisProperty->setResultVariable( resAddr.resultName() ); m_yAxisProperty->setResultType( RiaDefines::ResultCatType::STATIC_NATIVE ); m_yAxisProperty->setResultVariable( "DEPTH" ); m_timeStep = eclipseView->currentTimeStep(); - m_grouping = NO_GROUPING; - if ( eclipseView->eclipseCase() && eclipseView->eclipseCase()->activeFormationNames() ) - { - m_grouping = GROUP_BY_FORMATION; - m_groupingProperty->legendConfig()->setColorLegend( - RimRegularLegendConfig::mapToColorLegend( RimRegularLegendConfig::ColorRangesType::CATEGORY ) ); - } RimGridCrossPlot* parentPlot = nullptr; firstAncestorOrThisOfType( parentPlot ); From 5eafa98038605e94de5fa98dad5f86a3a75f63ef Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 7 Jun 2022 15:26:31 +0200 Subject: [PATCH 374/406] #9023 Performance : Optionally avoid emitting update signals during update Do not notify editors when building tree in PdmUiTreeViewQModel::setPdmItemRoot() --- .../cafPdmUiTreeEditorHandle.h | 4 ++-- .../cafPdmUiTreeItemEditor.cpp | 3 ++- .../cafUserInterface/cafPdmUiTreeView.cpp | 3 ++- .../cafPdmUiTreeViewEditor.cpp | 4 ++-- .../cafUserInterface/cafPdmUiTreeViewEditor.h | 2 +- .../cafPdmUiTreeViewItemDelegate.cpp | 3 ++- .../cafPdmUiTreeViewQModel.cpp | 24 ++++++++++++------- .../cafUserInterface/cafPdmUiTreeViewQModel.h | 5 ++-- 8 files changed, 29 insertions(+), 19 deletions(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeEditorHandle.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeEditorHandle.h index ebe0b98c5c..ff189e739a 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeEditorHandle.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeEditorHandle.h @@ -61,14 +61,14 @@ class PdmUiTreeEditorHandle : public PdmUiEditorHandle void setPdmItemRoot( PdmUiItem* root ); PdmUiItem* pdmItemRoot(); - void updateSubTree( PdmUiItem* root ) { this->updateMySubTree( root ); } + void updateSubTree( PdmUiItem* root, bool notifyEditors ) { this->updateMySubTree( root, notifyEditors ); } protected: virtual QWidget* createWidget( QWidget* parent ) = 0; /// Supposed to update the representation of the tree from root and downwards, as gracefully as possible. /// Will be called when the content of root might have been changed - virtual void updateMySubTree( PdmUiItem* root ) = 0; + virtual void updateMySubTree( PdmUiItem* root, bool notifyEditors ) = 0; protected: QPointer m_widget; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeItemEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeItemEditor.cpp index 70061c2d37..b39f1ae5dd 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeItemEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeItemEditor.cpp @@ -55,7 +55,8 @@ void PdmUiTreeItemEditor::configureAndUpdateUi( const QString& uiConfigName ) { if ( m_treeViewEditor ) { - m_treeViewEditor->updateSubTree( this->pdmItem() ); + bool notifyEditors = true; + m_treeViewEditor->updateSubTree( this->pdmItem(), notifyEditors ); } } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp index a1324aac56..50c7f528fd 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeView.cpp @@ -284,7 +284,8 @@ void PdmUiTreeView::updateSubTree( const QModelIndex& index ) auto uiItem = uiItemFromModelIndex( index ); if ( uiItem ) { - m_treeViewEditor->updateSubTree( uiItem ); + bool notifyEditors = true; + m_treeViewEditor->updateSubTree( uiItem, notifyEditors ); } } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp index d8e8d08f8a..5e9a75d42c 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.cpp @@ -306,7 +306,7 @@ void PdmUiTreeViewEditor::selectedUiItems( std::vector& objects ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void PdmUiTreeViewEditor::updateMySubTree( PdmUiItem* uiItem ) +void PdmUiTreeViewEditor::updateMySubTree( PdmUiItem* uiItem, bool notifyEditors ) { if ( m_treeViewModel ) { @@ -324,7 +324,7 @@ void PdmUiTreeViewEditor::updateMySubTree( PdmUiItem* uiItem ) } } - m_treeViewModel->updateSubTree( itemToUpdate ); + m_treeViewModel->updateSubTree( itemToUpdate, notifyEditors ); QModelIndex itemIndex = m_treeViewModel->findModelIndex( itemToUpdate ); updateItemDelegateForSubTree( itemIndex ); } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h index ca3044656d..bae96c76fa 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewEditor.h @@ -139,7 +139,7 @@ class PdmUiTreeViewEditor : public PdmUiTreeEditorHandle protected: void configureAndUpdateUi( const QString& uiConfigName ) override; - void updateMySubTree( PdmUiItem* uiItem ) override; + void updateMySubTree( PdmUiItem* uiItem, bool notifyEditors ) override; void updateContextMenuSignals(); private slots: diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp index 60ac1d5921..65b436a2d5 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewItemDelegate.cpp @@ -292,7 +292,8 @@ bool PdmUiTreeViewItemDelegate::editorEvent( QEvent* event, } } - m_treeView->updateSubTree( parentUiItem ); + bool notifyEditors = true; + m_treeView->updateSubTree( parentUiItem, notifyEditors ); m_treeView->selectAsCurrentItem( uiItem ); return true; diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp index a1d77c0029..0213272a5c 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.cpp @@ -82,7 +82,8 @@ void PdmUiTreeViewQModel::setPdmItemRoot( PdmUiItem* rootItem ) // Check if we are already watching this root if ( rootItem && m_treeOrderingRoot && m_treeOrderingRoot->activeItem() == rootItem ) { - this->updateSubTree( rootItem ); + bool notifyEditors = false; + this->updateSubTree( rootItem, notifyEditors ); return; } @@ -148,7 +149,7 @@ void PdmUiTreeViewQModel::emitDataChanged( const QModelIndex& index ) //-------------------------------------------------------------------------------------------------- /// Refreshes the UI-tree below the supplied root PdmUiItem //-------------------------------------------------------------------------------------------------- -void PdmUiTreeViewQModel::updateSubTree( PdmUiItem* pdmRoot ) +void PdmUiTreeViewQModel::updateSubTree( PdmUiItem* pdmRoot, bool notifyEditors ) { // Build the new "Correct" Tree @@ -193,7 +194,7 @@ void PdmUiTreeViewQModel::updateSubTree( PdmUiItem* pdmRoot ) existingSubTreeRoot->debugDump( 0 ); #endif - updateSubTreeRecursive( existingSubTreeRootModIdx, existingSubTreeRoot, newTreeRootTmp ); + updateSubTreeRecursive( existingSubTreeRootModIdx, existingSubTreeRoot, newTreeRootTmp, notifyEditors ); delete newTreeRootTmp; @@ -225,7 +226,8 @@ class RecursiveUpdateData //-------------------------------------------------------------------------------------------------- void PdmUiTreeViewQModel::updateSubTreeRecursive( const QModelIndex& existingSubTreeRootModIdx, PdmUiTreeOrdering* existingSubTreeRoot, - PdmUiTreeOrdering* sourceSubTreeRoot ) + PdmUiTreeOrdering* sourceSubTreeRoot, + bool notifyEditors ) { // Build map for source items std::map sourceTreeMap; @@ -296,14 +298,15 @@ void PdmUiTreeViewQModel::updateSubTreeRecursive( const QModelIndex& existingSub if ( !anyChanges ) { // Notify Qt that the toggle/name/icon etc might have been changed - emitDataChanged( existingSubTreeRootModIdx ); + if ( notifyEditors ) emitDataChanged( existingSubTreeRootModIdx ); // No changes to list of children at this level, call update on all children for ( int i = 0; i < existingSubTreeRoot->childCount(); ++i ) { updateSubTreeRecursive( index( i, 0, existingSubTreeRootModIdx ), existingSubTreeRoot->child( i ), - sourceSubTreeRoot->child( i ) ); + sourceSubTreeRoot->child( i ), + notifyEditors ); } } else @@ -311,7 +314,7 @@ void PdmUiTreeViewQModel::updateSubTreeRecursive( const QModelIndex& existingSub std::vector recursiveUpdateData; std::vector newMergedOrdering; - emit layoutAboutToBeChanged(); + if ( notifyEditors ) emit layoutAboutToBeChanged(); { // Detect items to be moved from source to existing // Merge items from existing and source into newMergedOrdering using order in sourceSubTreeRoot @@ -360,7 +363,7 @@ void PdmUiTreeViewQModel::updateSubTreeRecursive( const QModelIndex& existingSub } } - emit layoutChanged(); + if ( notifyEditors ) emit layoutChanged(); // Insert new items into existingSubTreeRoot for ( size_t i = 0; i < newMergedOrdering.size(); i++ ) @@ -380,7 +383,10 @@ void PdmUiTreeViewQModel::updateSubTreeRecursive( const QModelIndex& existingSub QModelIndex mi = index( recursiveUpdateData[i].m_row, 0, existingSubTreeRootModIdx ); CAF_ASSERT( mi.isValid() ); - updateSubTreeRecursive( mi, recursiveUpdateData[i].m_existingChild, recursiveUpdateData[i].m_sourceChild ); + updateSubTreeRecursive( mi, + recursiveUpdateData[i].m_existingChild, + recursiveUpdateData[i].m_sourceChild, + notifyEditors ); } } } diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.h b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.h index 45959eedef..4f95514d23 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.h +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiTreeViewQModel.h @@ -63,7 +63,7 @@ class PdmUiTreeViewQModel : public QAbstractItemModel virtual ~PdmUiTreeViewQModel(); void setPdmItemRoot( PdmUiItem* rootItem ); - void updateSubTree( PdmUiItem* subTreeRoot ); + void updateSubTree( PdmUiItem* subTreeRoot, bool notifyEditors ); void setColumnHeaders( const QStringList& columnHeaders ); void setUiConfigName( const QString& uiConfigName ) { m_uiConfigName = uiConfigName; } @@ -81,7 +81,8 @@ class PdmUiTreeViewQModel : public QAbstractItemModel private: void updateSubTreeRecursive( const QModelIndex& uiSubTreeRootModelIdx, PdmUiTreeOrdering* uiModelSubTreeRoot, - PdmUiTreeOrdering* updatedPdmSubTreeRoot ); + PdmUiTreeOrdering* updatedPdmSubTreeRoot, + bool notifyEditors ); PdmUiTreeOrdering* treeItemFromIndex( const QModelIndex& index ) const; QModelIndex findModelIndexRecursive( const QModelIndex& currentIndex, const PdmUiItem* object ) const; From 3b5139c24d5b2f38fe052d84ef970bdc0b9a279f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 10 Jun 2022 06:24:35 +0200 Subject: [PATCH 375/406] #9023 Performance : Use cached analyzer Remove min max from RimSummaryCaseCollection Guard null pointer access Improve default behaviour for axis range control --- .../Summary/RimEnsembleCurveSet.cpp | 8 --- .../Summary/RimEnsembleCurveSet.h | 2 - .../Summary/RimEnsembleStatisticsCase.cpp | 15 ----- .../Summary/RimEnsembleStatisticsCase.h | 5 -- .../Summary/RimSummaryCaseCollection.cpp | 19 +++--- .../Summary/RimSummaryMultiPlot.cpp | 66 +++++++++---------- 6 files changed, 42 insertions(+), 73 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index a39c0ed4ba..eef1eb2a7d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -1967,14 +1967,6 @@ bool RimEnsembleCurveSet::hasMeanData() const return m_ensembleStatCase->hasMeanData(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::pair RimEnsembleCurveSet::minimumAndMaximumValues() const -{ - return m_ensembleStatCase->minimumAndMaximumValues(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index 10f31b6e88..2aa535d10f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -155,8 +155,6 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt bool hasP90Data() const override; bool hasMeanData() const override; - std::pair minimumAndMaximumValues() const; - void appendColorGroup( caf::PdmUiOrdering& uiOrdering ); static void appendOptionItemsForSummaryAddresses( QList* options, diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp index 8692e2b6d0..9b1614291b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.cpp @@ -39,8 +39,6 @@ /// //-------------------------------------------------------------------------------------------------- RimEnsembleStatisticsCase::RimEnsembleStatisticsCase( RimEnsembleCurveSet* curveSet ) - : m_minimumValue( DOUBLE_INF ) - , m_maximumValue( -DOUBLE_INF ) { m_curveSet = curveSet; } @@ -85,14 +83,6 @@ const std::vector& RimEnsembleStatisticsCase::mean() const return m_meanData; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -const std::pair RimEnsembleStatisticsCase::minimumAndMaximumValues() const -{ - return { m_minimumValue, m_maximumValue }; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -205,11 +195,6 @@ void RimEnsembleStatisticsCase::calculate( const std::vector su m_p50Data.push_back( p50 ); m_p90Data.push_back( p90 ); m_meanData.push_back( mean ); - - const auto [min, max] = std::minmax_element( begin( valuesAtTimeStep ), end( valuesAtTimeStep ) ); - - m_maximumValue = std::max( m_maximumValue, *max ); - m_minimumValue = std::min( m_minimumValue, *min ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h index 5e734b6222..20b53581ac 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleStatisticsCase.h @@ -40,8 +40,6 @@ class RimEnsembleStatisticsCase : public RimSummaryCase const std::vector& p90() const; const std::vector& mean() const; - const std::pair minimumAndMaximumValues() const; - bool hasP10Data() const { return !m_p10Data.empty(); } bool hasP50Data() const { return !m_p50Data.empty(); } bool hasP90Data() const { return !m_p90Data.empty(); } @@ -74,7 +72,4 @@ class RimEnsembleStatisticsCase : public RimSummaryCase std::vector m_p50Data; std::vector m_p90Data; std::vector m_meanData; - - double m_maximumValue; - double m_minimumValue; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index 3443f74f4d..e5949f3f22 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -959,18 +959,24 @@ void RimSummaryCaseCollection::computeMinMax( const RifEclipseSummaryAddress& ad double maximumValue( -std::numeric_limits::infinity() ); std::vector values; - for ( auto s : m_cases() ) + for ( const auto& s : m_cases() ) { if ( !s->summaryReader() ) continue; s->summaryReader()->values( address, &values ); - const auto [min, max] = std::minmax_element( begin( values ), end( values ) ); + if ( values.empty() ) continue; + + const auto [min, max] = std::minmax_element( values.begin(), values.end() ); minimumValue = std::min( *min, minimumValue ); maximumValue = std::max( *max, maximumValue ); } - setMinMax( address, minimumValue, maximumValue ); + if ( minimumValue != std::numeric_limits::infinity() && + maximumValue != -std::numeric_limits::infinity() ) + { + setMinMax( address, minimumValue, maximumValue ); + } } //-------------------------------------------------------------------------------------------------- @@ -1136,12 +1142,7 @@ void RimSummaryCaseCollection::buildChildNodes() { if ( m_dataVectorFolders->isEmpty() ) { - for ( auto& smcase : m_cases ) - { - m_dataVectorFolders->updateFolderStructure( smcase->summaryReader()->allResultAddresses(), - smcase->caseId(), - m_ensembleId ); - } + m_dataVectorFolders->updateFolderStructure( ensembleSummaryAddresses(), -1, m_ensembleId ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 53ee2a45fa..26e5d32108 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -230,14 +230,11 @@ void RimSummaryMultiPlot::handleDroppedObjects( const std::vector( o ); if ( adrColl ) { - if ( objects.size() == 1 ) + if ( objects.size() == 1 && adrColl->isFolder() ) { - if ( adrColl->isFolder() ) - { - // If a folder is selected, return all sub items in folder - auto childObjects = adrColl->subFolders(); - addressCollections.insert( addressCollections.end(), childObjects.begin(), childObjects.end() ); - } + // If a folder is selected, return all sub items in folder + auto childObjects = adrColl->subFolders(); + addressCollections.insert( addressCollections.end(), childObjects.begin(), childObjects.end() ); } else addressCollections.push_back( adrColl ); @@ -731,28 +728,21 @@ void RimSummaryMultiPlot::setDefaultRangeAggregationSteppingDimension() analyzer.appendAddresses( addresses ); } - auto rangeAggregation = AxisRangeAggregation::SUB_PLOTS; + auto rangeAggregation = AxisRangeAggregation::NONE; + if ( analyzer.quantities().size() == 1 && summaryPlots().size() > 1 ) + { + // Many plots, single summary vector + rangeAggregation = AxisRangeAggregation::SUB_PLOTS; + } if ( !analyzer.wellNames().empty() ) { rangeAggregation = AxisRangeAggregation::WELLS; } - else if ( !analyzer.groupNames().empty() ) - { - rangeAggregation = AxisRangeAggregation::SUB_PLOTS; - } else if ( !analyzer.regionNumbers().empty() ) { rangeAggregation = AxisRangeAggregation::REGIONS; } - else if ( !analyzer.aquifers().empty() ) - { - rangeAggregation = AxisRangeAggregation::SUB_PLOTS; - } - else if ( !analyzer.blocks().empty() ) - { - rangeAggregation = AxisRangeAggregation::SUB_PLOTS; - } auto stepDimension = RimSummaryDataSourceStepping::SourceSteppingDimension::VECTOR; if ( analyzer.wellNames().size() == 1 ) @@ -920,35 +910,41 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() else if ( axisRangeAggregation == AxisRangeAggregation::WELLS || axisRangeAggregation == AxisRangeAggregation::REGIONS ) { - RiaSummaryAddressAnalyzer analyzer; + RiaSummaryAddressAnalyzer fallbackAnalyzer; + RiaSummaryAddressAnalyzer* analyzer = nullptr; + if ( curve->summaryCaseY() ) { auto ensemble = curve->summaryCaseY()->ensemble(); if ( ensemble ) { - analyzer.appendAddresses( ensemble->ensembleSummaryAddresses() ); + analyzer = ensemble->addressAnalyzer(); } else { - analyzer.appendAddresses( curve->summaryCaseY()->summaryReader()->allResultAddresses() ); + fallbackAnalyzer.appendAddresses( curve->summaryCaseY()->summaryReader()->allResultAddresses() ); + analyzer = &fallbackAnalyzer; } } - if ( axisRangeAggregation == AxisRangeAggregation::WELLS ) + if ( analyzer ) { - for ( const auto& wellName : analyzer.wellNames() ) + if ( axisRangeAggregation == AxisRangeAggregation::WELLS ) { - addresses.push_back( - RifEclipseSummaryAddress::wellAddress( curve->summaryAddressY().vectorName(), wellName ) ); + for ( const auto& wellName : analyzer->wellNames() ) + { + addresses.push_back( + RifEclipseSummaryAddress::wellAddress( curve->summaryAddressY().vectorName(), wellName ) ); + } } - } - if ( axisRangeAggregation == AxisRangeAggregation::REGIONS ) - { - for ( auto regionNumber : analyzer.regionNumbers() ) + if ( axisRangeAggregation == AxisRangeAggregation::REGIONS ) { - addresses.push_back( RifEclipseSummaryAddress::regionAddress( curve->summaryAddressY().vectorName(), - regionNumber ) ); + for ( auto regionNumber : analyzer->regionNumbers() ) + { + addresses.push_back( RifEclipseSummaryAddress::regionAddress( curve->summaryAddressY().vectorName(), + regionNumber ) ); + } } } } @@ -1005,6 +1001,8 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() for ( auto curveSet : plot->curveSets() ) { + if ( !curveSet->summaryCaseCollection() ) continue; + if ( curveSet->axisY() == axis->plotAxisType() ) { double minimum( std::numeric_limits::infinity() ); @@ -1020,7 +1018,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() std::vector addresses = addressesForCurve( curve, m_axisRangeAggregation() ); - for ( auto adr : addresses ) + for ( const auto& adr : addresses ) { auto [min, max] = curveSet->summaryCaseCollection()->minMax( adr ); From f50b876c99a1d4d508be54a912c1fc38cf769df7 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 3 Jun 2022 11:52:26 +0200 Subject: [PATCH 376/406] #8955 Grid Property Calculator : Add filtering support. --- .../ProjectDataModel/RimGridCalculation.cpp | 284 +++++++++++++----- .../ProjectDataModel/RimGridCalculation.h | 29 +- .../RimGridCalculationVariable.cpp | 71 +++++ .../RimGridCalculationVariable.h | 17 ++ 4 files changed, 332 insertions(+), 69 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp index 7456d07b24..34489e6273 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp @@ -19,16 +19,20 @@ #include "RimGridCalculation.h" #include "RiaDefines.h" +#include "RiaLogging.h" +#include "RiaPorosityModel.h" + #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" #include "RimEclipseView.h" +#include "RimGridCalculationVariable.h" #include "RimReloadCaseTools.h" -#include "RiaLogging.h" -#include "RiaPorosityModel.h" - #include "RigCaseCellResultsData.h" #include "RigEclipseResultAddress.h" +#include "RigMainGrid.h" +#include "RigResultAccessor.h" +#include "RigResultAccessorFactory.h" #include "expressionparser/ExpressionParser.h" @@ -57,78 +61,24 @@ bool RimGridCalculation::calculate() { QString leftHandSideVariableName = RimGridCalculation::findLeftHandSide( m_expression ); - auto porosityModel = RiaDefines::PorosityModelType::MATRIX_MODEL; - RimEclipseCase* eclipseCase = findEclipseCaseFromVariables(); if ( !eclipseCase ) { RiaLogging::errorInMessageBox( nullptr, - "Expression Parser", + "Grid Property Calculator", QString( "No case found for calculation : %1" ).arg( leftHandSideVariableName ) ); return false; } - const size_t timeStepCount = eclipseCase->results( porosityModel )->maxTimeStepCount(); - - std::vector>> values; - for ( size_t i = 0; i < m_variables.size(); i++ ) + auto [isOk, errorMessage] = validateVariables(); + if ( !isOk ) { - RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); - CAF_ASSERT( v != nullptr ); - - if ( !v->eclipseCase() ) - { - RiaLogging::errorInMessageBox( nullptr, - "Expression Parser", - QString( "No case defined for variable : %1" ).arg( v->name() ) ); - return false; - } - - if ( v->resultVariable().isEmpty() ) - { - RiaLogging::errorInMessageBox( nullptr, - "Expression Parser", - QString( "No result variable defined for variable : %1" ).arg( v->name() ) ); - return false; - } - - auto resultCategoryType = v->resultCategoryType(); - RigEclipseResultAddress resAddr( resultCategoryType, v->resultVariable() ); - if ( !eclipseCase->results( porosityModel )->ensureKnownResultLoaded( resAddr ) ) - { - RiaLogging::errorInMessageBox( nullptr, - "Expression Parser", - QString( "Unable to load result for variable : %1" ).arg( v->name() ) ); - return false; - } - - int timeStep = v->timeStep(); - - std::vector> inputValues = eclipseCase->results( porosityModel )->cellScalarResults( resAddr ); - if ( resultCategoryType == RiaDefines::ResultCatType::STATIC_NATIVE ) - { - // Use static data for all time steps - inputValues.resize( timeStepCount ); - for ( size_t tsId = 1; tsId < timeStepCount; tsId++ ) - { - inputValues[tsId] = inputValues[0]; - } - } - else if ( timeStep != RimGridCalculationVariable::allTimeStepsValue() ) - { - // Use data from a specific time step for this variable for all result time steps - for ( size_t tsId = 0; tsId < timeStepCount; tsId++ ) - { - if ( static_cast( tsId ) != timeStep ) - { - inputValues[tsId] = inputValues[timeStep]; - } - } - } - - values.push_back( inputValues ); + RiaLogging::errorInMessageBox( nullptr, "Grid Property Calculator", errorMessage ); + return false; } + auto porosityModel = RiaDefines::PorosityModelType::MATRIX_MODEL; + RigEclipseResultAddress resAddr( RiaDefines::ResultCatType::GENERATED, leftHandSideVariableName ); if ( !eclipseCase->results( porosityModel )->ensureKnownResultLoaded( resAddr ) ) @@ -138,22 +88,32 @@ bool RimGridCalculation::calculate() eclipseCase->results( porosityModel )->clearScalarResult( resAddr ); + const size_t timeStepCount = eclipseCase->results( porosityModel )->maxTimeStepCount(); + std::vector>* scalarResultFrames = eclipseCase->results( porosityModel )->modifiableCellScalarResultTimesteps( resAddr ); scalarResultFrames->resize( timeStepCount ); for ( size_t tsId = 0; tsId < timeStepCount; tsId++ ) { + std::vector> values; + for ( size_t i = 0; i < m_variables.size(); i++ ) + { + RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); + CAF_ASSERT( v != nullptr ); + values.push_back( getInputVectorForVariable( v, tsId, porosityModel ) ); + } + ExpressionParser parser; for ( size_t i = 0; i < m_variables.size(); i++ ) { RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); CAF_ASSERT( v != nullptr ); - parser.assignVector( v->name(), values[i][tsId] ); + parser.assignVector( v->name(), values[i] ); } std::vector resultValues; - resultValues.resize( values[0][tsId].size() ); + resultValues.resize( values[0].size() ); parser.assignVector( leftHandSideVariableName, resultValues ); QString errorText; @@ -161,6 +121,14 @@ bool RimGridCalculation::calculate() if ( evaluatedOk ) { + auto [cellFilterView, defaultValueConfig] = findFilterValuesFromVariables(); + + if ( cellFilterView ) + { + auto [defaultValueType, defaultValue] = defaultValueConfig; + filterResults( cellFilterView, values, defaultValueType, defaultValue, resultValues ); + } + scalarResultFrames->at( tsId ) = resultValues; m_isDirty = false; @@ -170,7 +138,7 @@ bool RimGridCalculation::calculate() QString s = "The following error message was received from the parser library : \n\n"; s += errorText; - RiaLogging::errorInMessageBox( nullptr, "Expression Parser", s ); + RiaLogging::errorInMessageBox( nullptr, "Grid Property Calculator", s ); return false; } } @@ -181,7 +149,7 @@ bool RimGridCalculation::calculate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RimEclipseCase* RimGridCalculation::findEclipseCaseFromVariables() +RimEclipseCase* RimGridCalculation::findEclipseCaseFromVariables() const { for ( auto variable : m_variables ) { @@ -194,6 +162,150 @@ RimEclipseCase* RimGridCalculation::findEclipseCaseFromVariables() return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair + RimGridCalculation::findFilterValuesFromVariables() const +{ + for ( auto variable : m_variables ) + { + RimGridCalculationVariable* v = dynamic_cast( variable.p() ); + CAF_ASSERT( v != nullptr ); + + if ( v->cellFilterView() ) return std::make_pair( v->cellFilterView(), v->defaultValueConfiguration() ); + } + + return std::pair( nullptr, std::make_pair( RimGridCalculationVariable::DefaultValueType::POSITIVE_INFINITY, HUGE_VAL ) ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimGridCalculation::findFilterVariableIndex() const +{ + for ( size_t i = 0; i < m_variables.size(); i++ ) + { + auto variable = m_variables[i]; + RimGridCalculationVariable* v = dynamic_cast( variable ); + CAF_ASSERT( v != nullptr ); + + if ( v->cellFilterView() ) return static_cast( i ); + } + + return -1; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimGridCalculation::getInputVectorForVariable( RimGridCalculationVariable* v, + size_t tsId, + RiaDefines::PorosityModelType porosityModel ) const +{ + int timeStep = v->timeStep(); + + auto resultCategoryType = v->resultCategoryType(); + + // General case is to use the data from the given time step + size_t timeStepToUse = tsId; + + if ( resultCategoryType == RiaDefines::ResultCatType::STATIC_NATIVE ) + { + // Use the first time step for static data for all time steps + timeStepToUse = 0; + } + else if ( timeStep != RimGridCalculationVariable::allTimeStepsValue() ) + { + // Use data from a specific time step for this variable for all result time steps + timeStepToUse = timeStep; + } + + RigEclipseResultAddress resAddr( resultCategoryType, v->resultVariable() ); + + auto mainGrid = v->eclipseCase()->mainGrid(); + size_t maxGridCount = mainGrid->gridCount(); + + size_t cellCount = mainGrid->globalCellArray().size(); + std::vector inputValues( cellCount ); + for ( size_t gridIdx = 0; gridIdx < maxGridCount; ++gridIdx ) + { + auto grid = mainGrid->gridByIndex( gridIdx ); + + cvf::ref sourceResultAccessor = + RigResultAccessorFactory::createFromResultAddress( v->eclipseCase()->eclipseCaseData(), + gridIdx, + porosityModel, + timeStepToUse, + resAddr ); + +#pragma omp parallel for + for ( int localGridCellIdx = 0; localGridCellIdx < static_cast( grid->cellCount() ); localGridCellIdx++ ) + { + const size_t reservoirCellIndex = grid->reservoirCellIndex( localGridCellIdx ); + inputValues[reservoirCellIndex] = sourceResultAccessor->cellScalar( localGridCellIdx ); + } + } + + return inputValues; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculation::replaceFilteredValuesWithVector( const std::vector& inputValues, + cvf::ref visibility, + std::vector& resultValues ) +{ +#pragma omp parallel for + for ( int i = 0; i < static_cast( resultValues.size() ); i++ ) + { + if ( !visibility->val( i ) ) + { + resultValues[i] = inputValues[i]; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculation::replaceFilteredValuesWithDefaultValue( double defaultValue, + cvf::ref visibility, + std::vector& resultValues ) +{ +#pragma omp parallel for + for ( int i = 0; i < static_cast( resultValues.size() ); i++ ) + { + if ( !visibility->val( i ) ) + { + resultValues[i] = defaultValue; + } + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculation::filterResults( RimGridView* cellFilterView, + const std::vector>& values, + RimGridCalculationVariable::DefaultValueType defaultValueType, + double defaultValue, + std::vector& resultValues ) const +{ + auto visibility = cellFilterView->currentTotalCellVisibility(); + + if ( defaultValueType == RimGridCalculationVariable::DefaultValueType::FROM_PROPERTY ) + { + int filterVariableIndex = findFilterVariableIndex(); + replaceFilteredValuesWithVector( values[filterVariableIndex], visibility, resultValues ); + } + else + { + replaceFilteredValuesWithDefaultValue( defaultValue, visibility, resultValues ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -237,3 +349,39 @@ void RimGridCalculation::removeDependentObjects() RimReloadCaseTools::updateAll3dViews( eclipseCase ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RimGridCalculation::validateVariables() +{ + auto porosityModel = RiaDefines::PorosityModelType::MATRIX_MODEL; + + for ( size_t i = 0; i < m_variables.size(); i++ ) + { + RimGridCalculationVariable* v = dynamic_cast( m_variables[i] ); + CAF_ASSERT( v != nullptr ); + + if ( !v->eclipseCase() ) + { + QString errorMessage = QString( "No case defined for variable : %1" ).arg( v->name() ); + return std::make_pair( false, errorMessage ); + } + + if ( v->resultVariable().isEmpty() ) + { + QString errorMessage = QString( "No result variable defined for variable : %1" ).arg( v->name() ); + return std::make_pair( false, errorMessage ); + } + + auto resultCategoryType = v->resultCategoryType(); + RigEclipseResultAddress resAddr( resultCategoryType, v->resultVariable() ); + if ( !v->eclipseCase()->results( porosityModel )->ensureKnownResultLoaded( resAddr ) ) + { + QString errorMessage = QString( "Unable to load result for variable : %1" ).arg( v->name() ); + return std::make_pair( false, errorMessage ); + } + } + + return std::make_pair( true, "" ); +} diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h index 8dbfcf6323..a859f40183 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h @@ -18,10 +18,14 @@ #pragma once +#include "RiaPorosityModel.h" #include "RimGridCalculationVariable.h" #include "RimUserDefinedCalculation.h" +#include "cvfArray.h" + class RimEclipseCase; +class RimGridView; //================================================================================================== /// @@ -40,6 +44,29 @@ class RimGridCalculation : public RimUserDefinedCalculation protected: RimGridCalculationVariable* createVariable() const override; + std::pair validateVariables(); + + RimEclipseCase* findEclipseCaseFromVariables() const; + + std::vector getInputVectorForVariable( RimGridCalculationVariable* v, + size_t tsId, + RiaDefines::PorosityModelType porosityModel ) const; + + void filterResults( RimGridView* cellFilterView, + const std::vector>& values, + RimGridCalculationVariable::DefaultValueType defaultValueType, + double defaultValue, + std::vector& resultValues ) const; + + static void replaceFilteredValuesWithVector( const std::vector& inputValues, + cvf::ref visibility, + std::vector& resultValues ); + + static void replaceFilteredValuesWithDefaultValue( double defaultValue, + cvf::ref visibility, + std::vector& resultValues ); + + int findFilterVariableIndex() const; - RimEclipseCase* findEclipseCaseFromVariables(); + std::pair findFilterValuesFromVariables() const; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp index ecef70c5e9..085fd94b51 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp @@ -29,10 +29,23 @@ #include "RimEclipseCase.h" #include "RimEclipseResultAddress.h" +#include "RimEclipseView.h" #include "RimTools.h" CAF_PDM_SOURCE_INIT( RimGridCalculationVariable, "RimGridCalculationVariable" ); +namespace caf +{ +template <> +void caf::AppEnum::setUp() +{ + addItem( RimGridCalculationVariable::DefaultValueType::POSITIVE_INFINITY, "POSITIVE_INFINITY", "Inf" ); + addItem( RimGridCalculationVariable::DefaultValueType::FROM_PROPERTY, "FROM_PROPERTY", "Property Value" ); + addItem( RimGridCalculationVariable::DefaultValueType::USER_DEFINED, "USER_DEFINED", "User Defined" ); + setDefault( RimGridCalculationVariable::DefaultValueType::POSITIVE_INFINITY ); +} +}; // namespace caf + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -44,6 +57,9 @@ RimGridCalculationVariable::RimGridCalculationVariable() CAF_PDM_InitField( &m_resultVariable, "ResultVariable", RiaResultNames::undefinedResultName(), "Variable" ); CAF_PDM_InitFieldNoDefault( &m_eclipseCase, "EclipseGridCase", "Grid Case" ); CAF_PDM_InitField( &m_timeStep, "TimeStep", allTimeStepsValue(), "Time Step" ); + CAF_PDM_InitFieldNoDefault( &m_cellFilterView, "VisibleCellView", "Filter by 3d View Visibility" ); + CAF_PDM_InitFieldNoDefault( &m_defaultValueType, "DefaultValueType", "Default Value Type" ); + CAF_PDM_InitField( &m_defaultValue, "DefaultValue", 0.0, "Default Value" ); } //-------------------------------------------------------------------------------------------------- @@ -69,11 +85,19 @@ void RimGridCalculationVariable::defineUiOrdering( QString uiConfigName, caf::Pd uiOrdering.add( &m_resultType ); uiOrdering.add( &m_resultVariable ); uiOrdering.add( &m_timeStep ); + uiOrdering.add( &m_cellFilterView ); + uiOrdering.add( &m_defaultValueType ); + uiOrdering.add( &m_defaultValue ); uiOrdering.skipRemainingFields(); m_resultType.uiCapability()->setUiReadOnly( m_eclipseCase == nullptr ); m_timeStep.uiCapability()->setUiReadOnly( m_resultType == RiaDefines::ResultCatType::STATIC_NATIVE ); + + m_cellFilterView.uiCapability()->setUiReadOnly( m_eclipseCase == nullptr ); + m_defaultValueType.uiCapability()->setUiReadOnly( m_cellFilterView == nullptr ); + m_defaultValue.uiCapability()->setUiReadOnly( + m_cellFilterView == nullptr || defaultValueType() != RimGridCalculationVariable::DefaultValueType::USER_DEFINED ); } //-------------------------------------------------------------------------------------------------- @@ -117,6 +141,18 @@ QList RimTools::timeStepsForCase( m_eclipseCase(), &options ); } + else if ( fieldNeedingOptions == &m_cellFilterView ) + { + if ( m_eclipseCase ) + { + options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) ); + for ( RimEclipseView* view : m_eclipseCase->reservoirViews.children() ) + { + CVF_ASSERT( view && "Really always should have a valid view pointer in ReservoirViews" ); + options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) ); + } + } + } return options; } @@ -181,6 +217,41 @@ int RimGridCalculationVariable::allTimeStepsValue() return -1; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGridView* RimGridCalculationVariable::cellFilterView() const +{ + return m_cellFilterView; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimGridCalculationVariable::defaultValue() const +{ + return m_defaultValue; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGridCalculationVariable::DefaultValueType RimGridCalculationVariable::defaultValueType() const +{ + return m_defaultValueType(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimGridCalculationVariable::DefaultValueConfig RimGridCalculationVariable::defaultValueConfiguration() const +{ + if ( m_defaultValueType() == RimGridCalculationVariable::DefaultValueType::USER_DEFINED ) + return std::make_pair( m_defaultValueType(), m_defaultValue() ); + + return std::make_pair( m_defaultValueType(), HUGE_VAL ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h index a3f52f254e..59e3f9e20b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.h @@ -28,6 +28,7 @@ class RimEclipseCase; class RimEclipseResultAddress; +class RimGridView; class RigCaseCellResultsData; //================================================================================================== @@ -39,6 +40,13 @@ class RimGridCalculationVariable : public RimUserDefinedCalculationVariable CAF_PDM_HEADER_INIT; public: + enum class DefaultValueType + { + POSITIVE_INFINITY, + FROM_PROPERTY, + USER_DEFINED + }; + RimGridCalculationVariable(); QString displayString() const override; @@ -47,6 +55,12 @@ class RimGridCalculationVariable : public RimUserDefinedCalculationVariable RiaDefines::ResultCatType resultCategoryType() const; QString resultVariable() const; int timeStep() const; + RimGridView* cellFilterView() const; + double defaultValue() const; + DefaultValueType defaultValueType() const; + + using DefaultValueConfig = std::pair; + DefaultValueConfig defaultValueConfiguration() const; static int allTimeStepsValue(); @@ -67,4 +81,7 @@ class RimGridCalculationVariable : public RimUserDefinedCalculationVariable caf::PdmField> m_resultType; caf::PdmField m_resultVariable; caf::PdmField m_timeStep; + caf::PdmPtrField m_cellFilterView; + caf::PdmField> m_defaultValueType; + caf::PdmField m_defaultValue; }; From 5ea621d36fb7ef746cef132b9124d8c452245276 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 10 Jun 2022 10:56:46 +0200 Subject: [PATCH 377/406] #9033 Grid Property Calculator: fix incorrect filtering when reloading projects Fixes #9033. --- ApplicationLibCode/Application/RiaApplication.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/Application/RiaApplication.cpp b/ApplicationLibCode/Application/RiaApplication.cpp index 5a2567920e..221f6b0da7 100644 --- a/ApplicationLibCode/Application/RiaApplication.cpp +++ b/ApplicationLibCode/Application/RiaApplication.cpp @@ -653,11 +653,6 @@ bool RiaApplication::loadProject( const QString& projectFileName, } } - for ( auto gridCalculation : m_project->gridCalculationCollection()->calculations() ) - { - gridCalculation->calculate(); - } - if ( m_project->viewLinkerCollection() && m_project->viewLinkerCollection()->viewLinker() ) { m_project->viewLinkerCollection()->viewLinker()->updateOverrides(); @@ -713,6 +708,14 @@ bool RiaApplication::loadProject( const QString& projectFileName, // Execute command objects, and release the mutex when the queue is empty executeCommandObjects(); + // Recalculate the results from grid property calculations. + // Has to be done late since the results are filtered by view cell visibility + for ( auto gridCalculation : m_project->gridCalculationCollection()->calculations() ) + { + gridCalculation->calculate(); + gridCalculation->updateDependentObjects(); + } + RiaLogging::info( QString( "Completed open of project file : '%1'" ).arg( projectFileName ) ); return true; From c177e51c45c02c5995ffc428cad96e98eecf5f0d Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 10 Jun 2022 11:55:41 +0200 Subject: [PATCH 378/406] Grid Property Calculator: Improve UI to allow only one filter. --- .../ProjectDataModel/RimGridCalculation.cpp | 18 +++++++++++++++ .../ProjectDataModel/RimGridCalculation.h | 3 +++ .../RimGridCalculationVariable.cpp | 23 ++++++++++++++++--- 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp index 34489e6273..fbea9d7dee 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.cpp @@ -385,3 +385,21 @@ std::pair RimGridCalculation::validateVariables() return std::make_pair( true, "" ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimGridCalculation::onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, + std::vector& updatedObjects ) +{ + if ( childArray == &m_variables ) + { + // Update the editors of all the variables if a variable changes. + // This makes the read-only state of the filter parameters consistent: + // only one filter is allowed at a time. + for ( auto v : m_variables ) + { + v->updateConnectedEditors(); + } + } +} diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h index a859f40183..9d4b559791 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculation.h @@ -43,6 +43,9 @@ class RimGridCalculation : public RimUserDefinedCalculation void removeDependentObjects() override; protected: + void onChildrenUpdated( caf::PdmChildArrayFieldHandle* childArray, + std::vector& updatedObjects ) override; + RimGridCalculationVariable* createVariable() const override; std::pair validateVariables(); diff --git a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp index 085fd94b51..6a6144a3e6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimGridCalculationVariable.cpp @@ -23,6 +23,7 @@ #include "RiaPorosityModel.h" #include "RiaResultNames.h" +#include "RimGridCalculation.h" #include "RiuDragDrop.h" #include "RigCaseCellResultsData.h" @@ -94,10 +95,26 @@ void RimGridCalculationVariable::defineUiOrdering( QString uiConfigName, caf::Pd m_resultType.uiCapability()->setUiReadOnly( m_eclipseCase == nullptr ); m_timeStep.uiCapability()->setUiReadOnly( m_resultType == RiaDefines::ResultCatType::STATIC_NATIVE ); - m_cellFilterView.uiCapability()->setUiReadOnly( m_eclipseCase == nullptr ); - m_defaultValueType.uiCapability()->setUiReadOnly( m_cellFilterView == nullptr ); + // Can have only one variable with cell filter at a time. + // Set read-only state based on the state of the sibling variables. + RimGridCalculation* calculation = nullptr; + firstAncestorOfType( calculation ); + + bool hasOtherVariableWithFilter = false; + for ( auto variable : calculation->allVariables() ) + { + auto v = dynamic_cast( variable ); + if ( variable != this && v->cellFilterView() ) + { + hasOtherVariableWithFilter = true; + } + } + + m_cellFilterView.uiCapability()->setUiReadOnly( m_eclipseCase == nullptr || hasOtherVariableWithFilter ); + m_defaultValueType.uiCapability()->setUiReadOnly( m_cellFilterView == nullptr || hasOtherVariableWithFilter ); m_defaultValue.uiCapability()->setUiReadOnly( - m_cellFilterView == nullptr || defaultValueType() != RimGridCalculationVariable::DefaultValueType::USER_DEFINED ); + m_cellFilterView == nullptr || + defaultValueType() != RimGridCalculationVariable::DefaultValueType::USER_DEFINED || hasOtherVariableWithFilter ); } //-------------------------------------------------------------------------------------------------- From 7d246c15356bfa7c7e356359646f0d68e4ed50a5 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 13 Jun 2022 10:29:03 +0200 Subject: [PATCH 379/406] Add missing link library --- .../cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt b/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt index a732e52bec..d66d8b99aa 100644 --- a/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt +++ b/Fwk/AppFwk/cafUserInterface/cafUserInterface_UnitTests/CMakeLists.txt @@ -7,7 +7,7 @@ find_package( COMPONENTS REQUIRED Core Gui Widgets ) -set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets) +set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) From ccbda23b96fc977ed689e2bfc33d762ecbf26a87 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 13 Jun 2022 13:54:55 +0200 Subject: [PATCH 380/406] Merge pull request #9048 from OPM/9047-performance-avoid-update-project - Avoid update of project when creating new objects - Added icon resource cache - Avoid use of descendantsIncludingThisOfType() --- .../Tools/RiaSimWellBranchTools.cpp | 11 +--- .../RicImportPolylinesAnnotationFeature.cpp | 2 +- .../RicNewStimPlanModelPlotFeature.cpp | 6 -- .../RicCreateMultipleFracturesFeature.cpp | 9 ++- .../RicNewSimWellFractureAtPosFeature.cpp | 2 +- .../RicNewSimWellFractureFeature.cpp | 2 +- .../RicNewStimPlanModelFeature.cpp | 2 +- .../RicNewWellPathFractureFeature.cpp | 2 +- .../Commands/RicWellLogTools.cpp | 4 -- .../ViewLink/RicLinkVisibleViewsFeature.cpp | 2 +- .../ViewLink/RicSetMasterViewFeature.cpp | 2 +- .../RicAdd3dWellLogCurveFeature.cpp | 2 - .../RicAdd3dWellLogFileCurveFeature.cpp | 1 - .../RicAdd3dWellLogRftCurveFeature.cpp | 1 - .../RicAddWellLogToPlotFeature.cpp | 2 - .../RicNewWellLogPlotFeatureImpl.cpp | 2 + .../ProjectDataModel/CMakeLists_files.cmake | 2 + .../Flow/RimFlowCharacteristicsPlot.cpp | 48 ++++++---------- .../Flow/RimWellAllocationPlot.cpp | 19 ++----- .../Flow/RimWellDistributionPlot.cpp | 19 ++----- .../RimWellDistributionPlotCollection.cpp | 19 ++----- .../ProjectDataModel/RimEclipseCaseTools.cpp | 55 +++++++++++++++++++ .../ProjectDataModel/RimEclipseCaseTools.h | 34 ++++++++++++ .../RimEclipseResultAddress.cpp | 14 ++--- .../ProjectDataModel/RimProject.cpp | 41 +++++++------- .../WellLog/RimWellLogPlotCollection.cpp | 10 +--- .../RimcWellLogPlot.cpp | 6 +- .../RimcWellLogTrack.cpp | 2 - .../cafPdmUiCore/cafIconProvider.cpp | 12 +++- 29 files changed, 184 insertions(+), 149 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModel/RimEclipseCaseTools.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimEclipseCaseTools.h diff --git a/ApplicationLibCode/Application/Tools/RiaSimWellBranchTools.cpp b/ApplicationLibCode/Application/Tools/RiaSimWellBranchTools.cpp index bf85d41f73..630d50d011 100644 --- a/ApplicationLibCode/Application/Tools/RiaSimWellBranchTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSimWellBranchTools.cpp @@ -18,12 +18,10 @@ #include "RiaSimWellBranchTools.h" -#include "RiaApplication.h" - #include "RigEclipseCaseData.h" #include "RimEclipseCase.h" -#include "RimProject.h" +#include "RimEclipseCaseTools.h" #include "RimWellPlotTools.h" #include "cafPdmUiOrdering.h" @@ -34,12 +32,7 @@ std::vector RiaSimWellBranchTools::simulationWellBranches( const QString& simWellName, bool useAutoDetectionOfBranches ) { - RiaApplication* app = RiaApplication::instance(); - RimProject* proj = app->project(); - - // Find first case containing the specified simulation well - std::vector simCases; - proj->descendantsIncludingThisOfType( simCases ); + std::vector simCases = RimEclipseCaseTools::eclipseCases(); auto caseItr = std::find_if( simCases.begin(), simCases.end(), [&simWellName]( const RimEclipseCase* eclCase ) { const auto& eclData = eclCase->eclipseCaseData(); diff --git a/ApplicationLibCode/Commands/AnnotationCommands/RicImportPolylinesAnnotationFeature.cpp b/ApplicationLibCode/Commands/AnnotationCommands/RicImportPolylinesAnnotationFeature.cpp index 55aaf7b928..cd783ca58c 100644 --- a/ApplicationLibCode/Commands/AnnotationCommands/RicImportPolylinesAnnotationFeature.cpp +++ b/ApplicationLibCode/Commands/AnnotationCommands/RicImportPolylinesAnnotationFeature.cpp @@ -82,7 +82,7 @@ void RicImportPolylinesAnnotationFeature::onActionTriggered( bool isChecked ) RimPolylinesFromFileAnnotation* lastCreatedOrUpdated = annotColl->importOrUpdatePolylinesFromFile( fileNames ); - proj->updateConnectedEditors(); + proj->activeOilField()->updateConnectedEditors(); if ( lastCreatedOrUpdated ) { diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp index 32f59360fe..1f7f89e54f 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp @@ -292,8 +292,6 @@ void RicNewStimPlanModelPlotFeature::createFaciesTrack( RimStimPlanModelPlot* pl faciesTrack->updateConnectedEditors(); plot->updateConnectedEditors(); - RiaApplication::instance()->project()->updateConnectedEditors(); - RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); RiuPlotMainWindowTools::showPlotMainWindow(); } @@ -343,8 +341,6 @@ void RicNewStimPlanModelPlotFeature::createLayersTrack( RimStimPlanModelPlot* pl faciesTrack->updateConnectedEditors(); plot->updateConnectedEditors(); - RiaApplication::instance()->project()->updateConnectedEditors(); - RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); RiuPlotMainWindowTools::showPlotMainWindow(); } @@ -430,8 +426,6 @@ void RicNewStimPlanModelPlotFeature::createParametersTrack( RimStimPlanModelPlot plotTrack->updateConnectedEditors(); plot->updateConnectedEditors(); - RiaApplication::instance()->project()->updateConnectedEditors(); - RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); RiuPlotMainWindowTools::showPlotMainWindow(); } diff --git a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesFeature.cpp index d63a732990..fbd439c327 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicCreateMultipleFracturesFeature.cpp @@ -107,6 +107,8 @@ void RicCreateMultipleFracturesFeature::slotAppendFractures() RiuCreateMultipleFractionsUi* multipleFractionsUi = this->multipleFractionsUi(); if ( !multipleFractionsUi ) return; + std::set fractureCollectionToUpdate; + auto items = multipleFractionsUi->locationsForNewFractures(); for ( auto item : items ) { @@ -127,6 +129,7 @@ void RicCreateMultipleFracturesFeature::slotAppendFractures() RimWellPathFracture* fracture = new RimWellPathFracture(); fractureCollection->addFracture( fracture ); + fractureCollectionToUpdate.insert( fractureCollection ); fracture->setFractureUnit( item.wellPath->unitSystem() ); fracture->setMeasuredDepth( item.measuredDepth ); @@ -145,7 +148,11 @@ void RicCreateMultipleFracturesFeature::slotAppendFractures() RiaApplication* app = RiaApplication::instance(); RimProject* proj = app->project(); - proj->updateConnectedEditors(); + for ( auto coll : fractureCollectionToUpdate ) + { + coll->updateConnectedEditors(); + } + proj->reloadCompletionTypeResultsInAllViews(); } diff --git a/ApplicationLibCode/Commands/FractureCommands/RicNewSimWellFractureAtPosFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicNewSimWellFractureAtPosFeature.cpp index a9f76af66e..b9b7c74b3d 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicNewSimWellFractureAtPosFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicNewSimWellFractureAtPosFeature.cpp @@ -117,7 +117,7 @@ void RicNewSimWellFractureAtPosFeature::onActionTriggered( bool isChecked ) if ( eclipseCase ) { proj->reloadCompletionTypeResultsForEclipseCase( eclipseCase ); - proj->updateConnectedEditors(); + fractureCollection->updateConnectedEditors(); } Riu3DMainWindowTools::selectAsCurrentItem( fracture ); } diff --git a/ApplicationLibCode/Commands/FractureCommands/RicNewSimWellFractureFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicNewSimWellFractureFeature.cpp index 85015a824d..2ada055df6 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicNewSimWellFractureFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicNewSimWellFractureFeature.cpp @@ -101,7 +101,7 @@ void RicNewSimWellFractureFeature::onActionTriggered( bool isChecked ) if ( eclipseCase ) { proj->reloadCompletionTypeResultsForEclipseCase( eclipseCase ); - proj->updateConnectedEditors(); + eclipseWell->simwellFractureCollection()->updateConnectedEditors(); } Riu3DMainWindowTools::selectAsCurrentItem( fracture ); } diff --git a/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanModelFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanModelFeature.cpp index 642d076e21..4ecda0fb69 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanModelFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicNewStimPlanModelFeature.cpp @@ -86,7 +86,7 @@ RimStimPlanModel* RicNewStimPlanModelFeature::addStimPlanModel( RimWellPath* if ( project ) { project->reloadCompletionTypeResultsInAllViews(); - project->updateAllRequiredEditors(); + stimPlanModelCollection->updateAllRequiredEditors(); } if ( measuredDepth > 0.0 ) diff --git a/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp b/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp index a5f84ffe5b..c56b28148e 100644 --- a/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp +++ b/ApplicationLibCode/Commands/FractureCommands/RicNewWellPathFractureFeature.cpp @@ -101,7 +101,7 @@ RimWellPathFracture* RicNewWellPathFractureFeature::addFracture( gsl::not_nullreloadCompletionTypeResultsInAllViews(); - project->updateAllRequiredEditors(); + fractureCollection->updateAllRequiredEditors(); } Riu3DMainWindowTools::selectAsCurrentItem( fracture ); diff --git a/ApplicationLibCode/Commands/RicWellLogTools.cpp b/ApplicationLibCode/Commands/RicWellLogTools.cpp index 997f6dece3..d4bf8f093d 100644 --- a/ApplicationLibCode/Commands/RicWellLogTools.cpp +++ b/ApplicationLibCode/Commands/RicWellLogTools.cpp @@ -325,7 +325,6 @@ ExtractionCurveType* RicWellLogTools::addExtractionCurve( RimWellLogTrack* plotTrack->updateConnectedEditors(); plot->updateConnectedEditors(); - RimProject::current()->updateConnectedEditors(); RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); RiuPlotMainWindowTools::selectAsCurrentItem( curve ); @@ -387,7 +386,6 @@ RimWellLogRftCurve* plotTrack->setFormationTrajectoryType( RimWellLogTrack::SIMULATION_WELL ); plotTrack->updateConnectedEditors(); - RimProject::current()->updateConnectedEditors(); RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); RiuPlotMainWindowTools::selectAsCurrentItem( curve ); @@ -416,7 +414,6 @@ RimWellLogFileCurve* RicWellLogTools::addFileCurve( RimWellLogTrack* plotTrack, plotTrack->updateConnectedEditors(); - RimProject::current()->updateConnectedEditors(); RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); RiuPlotMainWindowTools::selectAsCurrentItem( curve ); @@ -489,7 +486,6 @@ RimWellMeasurementCurve* RicWellLogTools::addWellMeasurementCurve( RimWellLogTra plotTrack->addCurve( curve ); plotTrack->updateConnectedEditors(); - RimProject::current()->updateConnectedEditors(); RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); RiuPlotMainWindowTools::selectAsCurrentItem( curve ); diff --git a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp index 47a7e10c41..30d2d2e50a 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp +++ b/ApplicationLibCode/Commands/ViewLink/RicLinkVisibleViewsFeature.cpp @@ -164,7 +164,7 @@ void RicLinkVisibleViewsFeature::linkViews( std::vector& linkableV viewLinker->updateUiNameAndIcon(); proj->viewLinkerCollection.uiCapability()->updateConnectedEditors(); - proj->updateConnectedEditors(); + proj->viewLinkerCollection->updateConnectedEditors(); Riu3DMainWindowTools::setExpanded( proj->viewLinkerCollection() ); } diff --git a/ApplicationLibCode/Commands/ViewLink/RicSetMasterViewFeature.cpp b/ApplicationLibCode/Commands/ViewLink/RicSetMasterViewFeature.cpp index 334fee2569..46370e18c2 100644 --- a/ApplicationLibCode/Commands/ViewLink/RicSetMasterViewFeature.cpp +++ b/ApplicationLibCode/Commands/ViewLink/RicSetMasterViewFeature.cpp @@ -75,7 +75,7 @@ void RicSetMasterViewFeature::onActionTriggered( bool isChecked ) viewLinker->addDependentView( previousMasterView ); proj->viewLinkerCollection.uiCapability()->updateConnectedEditors(); - proj->updateConnectedEditors(); + proj->viewLinkerCollection->updateConnectedEditors(); // Set managed view collection to selected and expanded in project tree Riu3DMainWindowTools::selectAsCurrentItem( viewLinker ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogCurveFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogCurveFeature.cpp index 6e6f6327a4..3cbd78644c 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogCurveFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogCurveFeature.cpp @@ -68,8 +68,6 @@ void RicAdd3dWellLogCurveFeature::onActionTriggered( bool isChecked ) RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews(); - RimProject::current()->updateConnectedEditors(); - Riu3DMainWindowTools::selectAsCurrentItem( rim3dWellLogExtractionCurve ); Riu3DMainWindowTools::setExpanded( selectedWellPath ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogFileCurveFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogFileCurveFeature.cpp index 14151cc6e4..534a474039 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogFileCurveFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogFileCurveFeature.cpp @@ -56,7 +56,6 @@ void RicAdd3dWellLogFileCurveFeature::onActionTriggered( bool isChecked ) rim3dWellLogFileCurve->setDefaultFileCurveDataInfo(); RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews(); - RimProject::current()->updateConnectedEditors(); Riu3DMainWindowTools::selectAsCurrentItem( rim3dWellLogFileCurve ); Riu3DMainWindowTools::setExpanded( selectedWellPath ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogRftCurveFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogRftCurveFeature.cpp index dea217328d..8ccabcd309 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogRftCurveFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicAdd3dWellLogRftCurveFeature.cpp @@ -63,7 +63,6 @@ void RicAdd3dWellLogRftCurveFeature::onActionTriggered( bool isChecked ) selectedWellPath->add3dWellLogCurve( rim3dWellLogRftCurve ); RimProject::current()->scheduleCreateDisplayModelAndRedrawAllViews(); - RimProject::current()->updateConnectedEditors(); Riu3DMainWindowTools::selectAsCurrentItem( rim3dWellLogRftCurve ); Riu3DMainWindowTools::setExpanded( selectedWellPath ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp index bf41e15b3a..eab9e8c98e 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicAddWellLogToPlotFeature.cpp @@ -104,8 +104,6 @@ void RicAddWellLogToPlotFeature::onActionTriggered( bool isChecked ) } plot->updateLayout(); - RimProject::current()->updateConnectedEditors(); - RiuPlotMainWindowTools::showPlotMainWindow(); RiuPlotMainWindowTools::selectAsCurrentItem( plot ); RiuPlotMainWindowTools::setExpanded( plotTrack ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp index c67ee0fd10..30f90889ae 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp @@ -106,6 +106,8 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterC QString( "Well Log Plot %1" ).arg( wellLogPlotCollection()->wellLogPlots().size() ) ); } + wellLogPlotColl->updateConnectedEditors(); + if ( showAfterCreation ) { RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow(); diff --git a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake index 9232af4f86..f782207f5e 100644 --- a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake @@ -126,6 +126,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCollection.h ${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddress.h ${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddressCollection.h + ${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -251,6 +252,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimSurfaceIntersectionCollection.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddress.cpp ${CMAKE_CURRENT_LIST_DIR}/RimEclipseResultAddressCollection.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimEclipseCaseTools.cpp ) if(RESINSIGHT_USE_QT_CHARTS) diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp index dc548b18ad..a07b7036a8 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp @@ -26,6 +26,7 @@ #include "RigEclipseCaseData.h" #include "RigFlowDiagResults.h" +#include "RimEclipseCaseTools.h" #include "RimEclipseCellColors.h" #include "RimEclipsePropertyFilter.h" #include "RimEclipsePropertyFilterCollection.h" @@ -33,7 +34,6 @@ #include "RimEclipseView.h" #include "RimFaultInViewCollection.h" #include "RimFlowDiagSolution.h" -#include "RimProject.h" #include "RicEclipsePropertyFilterFeatureImpl.h" #include "RicSelectOrCreateViewFeatureImpl.h" @@ -268,18 +268,12 @@ QList if ( fieldNeedingOptions == &m_case ) { - RimProject* proj = nullptr; - this->firstAncestorOrThisOfType( proj ); - if ( proj ) + auto resultCases = RimEclipseCaseTools::eclipseResultCases(); + for ( RimEclipseResultCase* c : resultCases ) { - std::vector cases; - proj->descendantsIncludingThisOfType( cases ); - for ( RimEclipseResultCase* c : cases ) + if ( c->defaultFlowDiagSolution() ) { - if ( c->defaultFlowDiagSolution() ) - { - options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) ); - } + options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) ); } } } @@ -399,29 +393,23 @@ QList void RimFlowCharacteristicsPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { { - // Ensure a case is selected if one is available - RimProject* proj = nullptr; - this->firstAncestorOrThisOfType( proj ); - if ( proj ) + RimEclipseResultCase* defaultCase = nullptr; + + auto resultCases = RimEclipseCaseTools::eclipseResultCases(); + for ( RimEclipseResultCase* c : resultCases ) { - std::vector cases; - proj->descendantsIncludingThisOfType( cases ); - RimEclipseResultCase* defaultCase = nullptr; - for ( RimEclipseResultCase* c : cases ) + if ( c->defaultFlowDiagSolution() ) { - if ( c->defaultFlowDiagSolution() ) - { - if ( !defaultCase ) defaultCase = c; // Select first - } + if ( !defaultCase ) defaultCase = c; // Select first } - if ( !m_case() && defaultCase ) + } + if ( !m_case() && defaultCase ) + { + m_case = defaultCase; + m_flowDiagSolution = m_case->defaultFlowDiagSolution(); + if ( !m_case()->reservoirViews.empty() ) { - m_case = defaultCase; - m_flowDiagSolution = m_case->defaultFlowDiagSolution(); - if ( !m_case()->reservoirViews.empty() ) - { - m_cellFilterView = m_case()->reservoirViews()[0]; - } + m_cellFilterView = m_case()->reservoirViews()[0]; } } } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 363532cd7b..f217257975 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -30,11 +30,11 @@ #include "RigWellResultPoint.h" #include "RimEclipseCase.h" +#include "RimEclipseCaseTools.h" #include "RimEclipseCellColors.h" #include "RimEclipseResultCase.h" #include "RimEclipseView.h" #include "RimFlowDiagSolution.h" -#include "RimProject.h" #include "RimSimWellInView.h" #include "RimSimWellInViewCollection.h" #include "RimTofAccumulatedPhaseFractionsPlot.h" @@ -43,11 +43,11 @@ #include "RimWellAllocationPlotLegend.h" #include "RimWellFlowRateCurve.h" #include "RimWellLogCurveCommonDataSource.h" +#include "RimWellLogFile.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" - -#include "RimWellLogFile.h" #include "RimWellPlotTools.h" + #include "RiuPlotMainWindow.h" #include "RiuQwtPlotWidget.h" #include "RiuWellAllocationPlot.h" @@ -732,17 +732,10 @@ QList RimWellAllocationPlot::calculateValueOptions( cons } else if ( fieldNeedingOptions == &m_case ) { - RimProject* proj = nullptr; - this->firstAncestorOrThisOfType( proj ); - if ( proj ) + auto resultCases = RimEclipseCaseTools::eclipseResultCases(); + for ( RimEclipseResultCase* c : resultCases ) { - std::vector cases; - proj->descendantsIncludingThisOfType( 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 ) diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp index 880487cdd1..363404e5f8 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlot.cpp @@ -17,9 +17,10 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RimWellDistributionPlot.h" + +#include "RimEclipseCaseTools.h" #include "RimEclipseResultCase.h" #include "RimFlowDiagSolution.h" -#include "RimProject.h" #include "RimTools.h" #include "RigEclipseCaseData.h" @@ -38,10 +39,6 @@ #include #include -//#include "cvfBase.h" -//#include "cvfTrace.h" -//#include "cvfDebugTimer.h" - #include //================================================================================================== @@ -480,16 +477,10 @@ QList RimWellDistributionPlot::calculateValueOptions( co if ( fieldNeedingOptions == &m_case ) { - RimProject* ownerProj = nullptr; - firstAncestorOrThisOfType( ownerProj ); - if ( ownerProj ) + auto resultCases = RimEclipseCaseTools::eclipseResultCases(); + for ( RimEclipseResultCase* c : resultCases ) { - std::vector caseArr; - ownerProj->descendantsIncludingThisOfType( caseArr ); - for ( RimEclipseResultCase* c : caseArr ) - { - options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) ); - } + options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp index 5df1626e7e..38974363b0 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp @@ -17,10 +17,11 @@ ///////////////////////////////////////////////////////////////////////////////// #include "RimWellDistributionPlotCollection.h" + +#include "RimEclipseCaseTools.h" #include "RimEclipseResultCase.h" #include "RimFlowDiagSolution.h" #include "RimPlot.h" -#include "RimProject.h" #include "RimTools.h" #include "RimWellDistributionPlot.h" @@ -42,10 +43,6 @@ #include #include -//#include "cvfBase.h" -//#include "cvfTrace.h" -//#include "cvfDebugTimer.h" - //================================================================================================== // // @@ -258,16 +255,10 @@ QList if ( fieldNeedingOptions == &m_case ) { - RimProject* ownerProj = nullptr; - firstAncestorOrThisOfType( ownerProj ); - if ( ownerProj ) + auto resultCases = RimEclipseCaseTools::eclipseResultCases(); + for ( RimEclipseResultCase* c : resultCases ) { - std::vector caseArr; - ownerProj->descendantsIncludingThisOfType( caseArr ); - for ( RimEclipseResultCase* c : caseArr ) - { - options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) ); - } + options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, true, c->uiIconProvider() ) ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseTools.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseTools.cpp new file mode 100644 index 0000000000..2c8ee8740a --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseTools.cpp @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RimEclipseCaseTools.h" + +#include "RimEclipseResultCase.h" +#include "RimProject.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimEclipseCaseTools::eclipseCases() +{ + if ( RimProject::current() ) + { + return RimProject::current()->eclipseCases(); + } + + return {}; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimEclipseCaseTools::eclipseResultCases() +{ + std::vector resultCases; + + auto eclipseCases = RimEclipseCaseTools::eclipseCases(); + for ( auto ec : eclipseCases ) + { + auto resultCase = dynamic_cast( ec ); + if ( resultCase != nullptr ) + { + resultCases.push_back( resultCase ); + } + } + + return resultCases; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCaseTools.h b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseTools.h new file mode 100644 index 0000000000..751460bb4b --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCaseTools.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include + +class RimEclipseCase; +class RimEclipseResultCase; + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +class RimEclipseCaseTools +{ +public: + static std::vector eclipseCases(); + static std::vector eclipseResultCases(); +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp index 20264bdb64..062e94478f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseResultAddress.cpp @@ -19,7 +19,7 @@ #include "RimEclipseResultAddress.h" #include "RimEclipseCase.h" -#include "RimProject.h" +#include "RimEclipseCaseTools.h" CAF_PDM_SOURCE_INIT( RimEclipseResultAddress, "EclipseResultAddress" ); @@ -104,16 +104,10 @@ QList RimEclipseResultAddress::calculateValueOptions( co if ( fieldNeedingOptions == &m_eclipseCase ) { - RimProject* proj = nullptr; - this->firstAncestorOrThisOfType( proj ); - if ( proj ) + auto cases = RimEclipseCaseTools::eclipseCases(); + for ( auto* c : cases ) { - std::vector cases; - proj->descendantsIncludingThisOfType( cases ); - for ( auto* c : cases ) - { - options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) ); - } + options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index a282fc8cc3..8d374b85e1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -125,8 +125,8 @@ CAF_PDM_SOURCE_INIT( RimProject, "ResInsightProject" ); RimProject::RimProject( void ) : m_nextValidCaseId( 0 ) , m_nextValidCaseGroupId( 0 ) - , m_nextValidViewId( 1 ) - , m_nextValidPlotId( 1 ) + , m_nextValidViewId( -1 ) + , m_nextValidPlotId( -1 ) , m_nextValidSummaryCaseId( 1 ) , m_nextValidEnsembleId( 1 ) { @@ -279,8 +279,8 @@ void RimProject::close() m_nextValidCaseId = 0; m_nextValidCaseGroupId = 0; - m_nextValidViewId = 1; - m_nextValidPlotId = 1; + m_nextValidViewId = -1; + m_nextValidPlotId = -1; m_nextValidSummaryCaseId = 1; m_nextValidEnsembleId = 1; } @@ -579,12 +579,15 @@ void RimProject::assignViewIdToView( Rim3dView* view ) { if ( view ) { - std::vector views; - this->descendantsIncludingThisOfType( views ); - - for ( Rim3dView* existingView : views ) + if ( m_nextValidViewId < 0 ) { - m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 ); + std::vector views; + this->descendantsIncludingThisOfType( views ); + + for ( Rim3dView* existingView : views ) + { + m_nextValidViewId = std::max( m_nextValidViewId, existingView->id() + 1 ); + } } view->setId( m_nextValidViewId++ ); @@ -598,12 +601,15 @@ void RimProject::assignPlotIdToPlotWindow( RimPlotWindow* plotWindow ) { if ( plotWindow ) { - std::vector plotWindows; - this->descendantsIncludingThisOfType( plotWindows ); - - for ( RimPlotWindow* existingPlotWindow : plotWindows ) + if ( m_nextValidPlotId < 0 ) { - m_nextValidPlotId = std::max( m_nextValidPlotId, existingPlotWindow->id() + 1 ); + std::vector plotWindows; + this->descendantsIncludingThisOfType( plotWindows ); + + for ( RimPlotWindow* existingPlotWindow : plotWindows ) + { + m_nextValidPlotId = std::max( m_nextValidPlotId, existingPlotWindow->id() + 1 ); + } } plotWindow->setId( m_nextValidPlotId++ ); @@ -1475,11 +1481,8 @@ void RimProject::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, Q } else { - if ( viewLinkerCollection()->viewLinker() ) - { - // Use object instead of field to avoid duplicate entries in the tree view - uiTreeOrdering.add( viewLinkerCollection() ); - } + // Use object instead of field to avoid duplicate entries in the tree view + uiTreeOrdering.add( viewLinkerCollection() ); RimOilField* oilField = activeOilField(); if ( oilField ) diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp index 15ad522aaf..bf5b9cf690 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogPlotCollection.cpp @@ -251,15 +251,7 @@ void RimWellLogPlotCollection::removeExtractors( const RigGeoMechCaseData* caseD void RimWellLogPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray, std::vector& referringObjects ) { - // Make sure the plot collection disappears with the last plot - if ( m_wellLogPlots().empty() ) - { - RimProject* project = RimProject::current(); - if ( project ) - { - project->updateConnectedEditors(); - } - } + updateConnectedEditors(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); mainPlotWindow->updateWellLogPlotToolBar(); diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlot.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlot.cpp index f791049b21..28421983f6 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlot.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlot.cpp @@ -70,6 +70,7 @@ RimWellLogTrack* RimcWellLogPlot_newWellLogTrack::createWellLogTrack( RimWellLog RimWellLogTrack* plotTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, title, wellLogPlot ); if ( eclipseCase ) plotTrack->setFormationCase( eclipseCase ); if ( wellPath ) plotTrack->setFormationWellPath( wellPath ); + plotTrack->setColSpan( RimPlot::TWO ); plotTrack->setLegendsVisible( true ); plotTrack->setPlotTitleVisible( true ); @@ -78,12 +79,11 @@ RimWellLogTrack* RimcWellLogPlot_newWellLogTrack::createWellLogTrack( RimWellLog plotTrack->setShowRegionLabels( true ); plotTrack->setAutoScalePropertyValuesEnabled( true ); plotTrack->updateConnectedEditors(); + wellLogPlot->setShowWindow( true ); wellLogPlot->updateConnectedEditors(); - - RiaApplication::instance()->project()->updateConnectedEditors(); - wellLogPlot->loadDataAndUpdate(); + return plotTrack; } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogTrack.cpp index 49fba32210..7aca01aa48 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogTrack.cpp @@ -106,8 +106,6 @@ RimWellLogExtractionCurve* wellLogTrack->updateConnectedEditors(); wellLogTrack->setShowWindow( true ); - RiaApplication::instance()->project()->updateConnectedEditors(); - RimWellLogPlot* wellLogPlot = dynamic_cast( wellLogTrack->parentField() ); if ( wellLogPlot ) wellLogPlot->loadDataAndUpdate(); diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp index ca78a25d5c..0f8d6365b6 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafIconProvider.cpp @@ -38,6 +38,7 @@ #include #include #include +#include using namespace caf; @@ -201,9 +202,16 @@ std::unique_ptr IconProvider::icon( const QSize& size ) const if ( !m_iconResourceString.isEmpty() ) { - QIcon resourceStringIcon( m_iconResourceString ); - if ( !resourceStringIcon.isNull() ) + QPixmap pm; + if ( !QPixmapCache::find( m_iconResourceString, &pm ) ) { + pm.load( m_iconResourceString ); + QPixmapCache::insert( m_iconResourceString, pm ); + } + + if ( !pm.isNull() ) + { + QIcon resourceStringIcon( pm ); QPixmap iconPixmap = resourceStringIcon.pixmap( size, m_active ? QIcon::Normal : QIcon::Disabled ); QPainter painter( &pixmap ); painter.drawPixmap( 0, 0, iconPixmap ); From fe0d009b252e59b83de853f1d86ae6932024525f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 13 Jun 2022 15:08:15 +0200 Subject: [PATCH 381/406] Improve visual appearance for ensemble curves (#9016) * Ensemble Curves : Improve visual appearance Set line thickness to 1 If ensemble curves are bright, use a high saturation color for the highlight curve Increase line thickness for highlighted curve * Use color by summary vector phase for ensemble curves * Do not create curves for non-existing history vectors --- .../Summary/RimEnsembleCurveSet.cpp | 1 + .../RimSummaryCurveAppearanceCalculator.cpp | 25 +++++ .../RimSummaryCurveAppearanceCalculator.h | 2 + .../Summary/RimSummaryPlot.cpp | 69 +++++++++++--- .../UserInterface/RiuQwtPlotWidget.cpp | 91 ++++++++++++++++--- .../UserInterface/RiuQwtPlotWidget.h | 11 ++- 6 files changed, 165 insertions(+), 34 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index eef1eb2a7d..5747c996c0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -1703,6 +1703,7 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectorsetSummaryCaseY( sumCase ); curve->setSummaryAddressYAndApplyInterpolation( addr->address() ); curve->setResampling( m_resampling() ); + curve->setLineThickness( 1 ); addCurve( curve ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp index 07762d8f55..4dd261cb3e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp @@ -362,6 +362,31 @@ void RimSummaryCurveAppearanceCalculator::assignColorByPhase( RimSummaryCurve* c } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Color3f RimSummaryCurveAppearanceCalculator::assignColorByPhase( const RifEclipseSummaryAddress& address ) +{ + char secondChar = 0; + std::string vectorName = address.vectorName(); + + if ( vectorName.size() > 1 ) + { + secondChar = vectorName[1]; + if ( !isExcplicitHandled( secondChar ) ) + { + secondChar = 0; // Consider all others as one group for coloring + } + } + + if ( secondChar == 'W' ) return cycledBlueColor( 0 ); + if ( secondChar == 'O' ) return cycledGreenColor( 0 ); + if ( secondChar == 'G' ) return cycledRedColor( 0 ); + if ( secondChar == 'V' ) return cycledBrownColor( 0 ); + + return cycledNoneRGBBrColor( 0 ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h index 66706df477..a50b85ee35 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h @@ -60,6 +60,8 @@ class RimSummaryCurveAppearanceCalculator void setupCurveLook( RimSummaryCurve* curve ); + static cvf::Color3f assignColorByPhase( const RifEclipseSummaryAddress& address ); + void assignColorByPhase( RimSummaryCurve* curve, int colorIndex ); static cvf::Color3f cycledPaletteColor( int colorIndex ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 16c07bbaea..e1b5110ac6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -19,6 +19,7 @@ #include "RimSummaryPlot.h" #include "RiaColorTables.h" +#include "RiaColorTools.h" #include "RiaDefines.h" #include "RiaFieldHandleTools.h" #include "RiaPlotDefines.h" @@ -30,6 +31,7 @@ #include "RiaSummaryCurveDefinition.h" #include "RiaSummaryTools.h" #include "RiaTimeHistoryCurveResampler.h" + #include "RifReaderEclipseSummary.h" #include "RicfCommandObject.h" @@ -763,7 +765,20 @@ void RimSummaryPlot::applyDefaultCurveAppearances() for ( auto& curveSet : this->ensembleCurveSetCollection()->curveSets() ) { if ( curveSet->colorMode() != RimEnsembleCurveSet::ColorMode::SINGLE_COLOR ) continue; - curveSet->setColor( RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex++ ) ); + + cvf::Color3f curveColor; + if ( RiaPreferencesSummary::current()->colorCurvesByPhase() ) + { + auto basePhaseColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( curveSet->summaryAddress() ); + + curveColor = RiaColorTools::blendCvfColors( basePhaseColor, cvf::Color3f::WHITE, 1, 3 ); + } + else + { + curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex++ ); + } + + curveSet->setColor( curveColor ); } } @@ -1942,7 +1957,11 @@ std::pair> RimSummaryPlot::handleSummaryCaseD { auto historyAddr = addr; historyAddr.setVectorName( addr.vectorName() + RifReaderEclipseSummary::historyIdentifier() ); - dataVectorMap[historyAddr].insert( curve->summaryCaseY() ); + + if ( summaryCase->summaryReader() && summaryCase->summaryReader()->hasAddress( historyAddr ) ) + { + dataVectorMap[historyAddr].insert( curve->summaryCaseY() ); + } } } @@ -2044,13 +2063,21 @@ std::pair> if ( curveDef.ensemble() ) { - addNewEnsembleCurveY( curveDef.summaryAddress(), curveDef.ensemble() ); - newCurves++; + auto addresses = curveDef.ensemble()->ensembleSummaryAddresses(); + if ( addresses.find( curveDef.summaryAddress() ) != addresses.end() ) + { + addNewEnsembleCurveY( curveDef.summaryAddress(), curveDef.ensemble() ); + newCurves++; + } } else if ( curveDef.summaryCase() ) { - curves.push_back( addNewCurveY( curveDef.summaryAddress(), curveDef.summaryCase() ) ); - newCurves++; + if ( curveDef.summaryCase()->summaryReader() && + curveDef.summaryCase()->summaryReader()->hasAddress( curveDef.summaryAddress() ) ) + { + curves.push_back( addNewCurveY( curveDef.summaryAddress(), curveDef.summaryCase() ) ); + newCurves++; + } } } @@ -2089,8 +2116,10 @@ std::pair> RimSummaryPlot::handleSummaryAddre { for ( const auto& droppedAddress : newCurveAddresses ) { - bool skipAddress = false; + auto addresses = ensemble->ensembleSummaryAddresses(); + if ( addresses.find( droppedAddress ) == addresses.end() ) continue; + bool skipAddress = false; if ( dataVectorMap.count( droppedAddress ) > 0 ) { skipAddress = ( dataVectorMap[droppedAddress].count( ensemble ) > 0 ); @@ -2119,6 +2148,9 @@ std::pair> RimSummaryPlot::handleSummaryAddre { for ( const auto& droppedAddress : newCurveAddresses ) { + if ( !summaryCase->summaryReader() || !summaryCase->summaryReader()->hasAddress( droppedAddress ) ) + continue; + bool skipAddress = false; if ( dataVectorMap.count( droppedAddress ) > 0 ) @@ -2192,14 +2224,6 @@ void RimSummaryPlot::handleDroppedObjects( const std::vectorensembleCurveSetCollection()->curveSets() ) - { - if ( curveSet->colorMode() != RimEnsembleCurveSet::ColorMode::SINGLE_COLOR ) continue; - curveSet->setColor( RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex++ ) ); - } - loadDataAndUpdate(); curvesChanged.send(); @@ -2230,6 +2254,21 @@ void RimSummaryPlot::addNewEnsembleCurveY( const RifEclipseSummaryAddress& addre curveSet->setSummaryCaseCollection( ensemble ); curveSet->setSummaryAddress( address ); + + cvf::Color3f curveColor; + if ( RiaPreferencesSummary::current()->colorCurvesByPhase() ) + { + auto basePhaseColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( curveSet->summaryAddress() ); + + curveColor = RiaColorTools::blendCvfColors( basePhaseColor, cvf::Color3f::WHITE, 1, 3 ); + } + else + { + curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( + ensembleCurveSetCollection()->curveSetCount() ); + } + curveSet->setColor( curveColor ); + ensembleCurveSetCollection()->addCurveSet( curveSet ); } diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 49576546bd..051d5bcd3d 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -827,6 +827,14 @@ void RiuQwtPlotWidget::recalculateAxisExtents( RiuPlotAxis axis ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RiuQwtPlotWidget::highlightItemWidthAdjustment() +{ + return 2; +} + //-------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -967,13 +975,57 @@ void RiuQwtPlotWidget::replot() //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::highlightPlotItems( const std::set& closestItems ) { + if ( closestItems.size() == 1 ) + { + auto* constPlotCurve = dynamic_cast( *closestItems.begin() ); + auto* plotCurve = const_cast( constPlotCurve ); + + if ( plotCurve ) + { + auto curveColor = plotCurve->pen().color(); + if ( RiaColorTools::isBrightnessAboveThreshold( RiaColorTools::fromQColorTo3f( curveColor ) ) ) + { + // The brightness of selected curve is above threshold. Modify the saturation, and leave the other + // curves unchanged + + QColor symbolColor; + QColor symbolLineColor; + auto* symbol = const_cast( plotCurve->symbol() ); + if ( symbol ) + { + symbolColor = symbol->brush().color(); + symbolLineColor = symbol->pen().color(); + } + + double zValue = plotCurve->z(); + plotCurve->setZ( zValue + 100.0 ); + highlightPlotAxes( plotCurve->xAxis(), plotCurve->yAxis() ); + + auto hightlightColor = curveColor; + qreal h, s, v; + hightlightColor.getHsvF( &h, &s, &v ); + hightlightColor.setHsvF( h, 0.95, v ); + + auto curveWidth = plotCurve->pen().width(); + plotCurve->setPen( hightlightColor, + plotCurve->pen().width() + highlightItemWidthAdjustment(), + plotCurve->pen().style() ); + + CurveProperties properties = { curveColor, symbolColor, symbolLineColor, curveWidth }; + m_originalCurveProperties.insert( std::make_pair( plotCurve, properties ) ); + m_originalZValues.insert( std::make_pair( plotCurve, zValue ) ); + + return; + } + } + } + // NB! Create a copy of the item list before the loop to avoid invalidated iterators when iterating the list // plotCurve->setZ() causes the ordering of items in the list to change auto plotItemList = m_plot->itemList(); for ( QwtPlotItem* plotItem : plotItemList ) { - auto* plotCurve = dynamic_cast( plotItem ); - auto* plotShapeItem = dynamic_cast( plotItem ); + auto* plotCurve = dynamic_cast( plotItem ); if ( plotCurve ) { QPen existingPen = plotCurve->pen(); @@ -982,6 +1034,7 @@ void RiuQwtPlotWidget::highlightPlotItems( const std::set& c QColor curveColor = existingPen.color(); QColor symbolColor; QColor symbolLineColor; + auto penWidth = existingPen.width(); auto* symbol = const_cast( plotCurve->symbol() ); if ( symbol ) @@ -993,6 +1046,8 @@ void RiuQwtPlotWidget::highlightPlotItems( const std::set& c double zValue = plotCurve->z(); if ( closestItems.count( plotCurve ) > 0 ) { + existingPen.setWidth( penWidth + highlightItemWidthAdjustment() ); + plotCurve->setPen( existingPen ); plotCurve->setZ( zValue + 100.0 ); highlightPlotAxes( plotCurve->xAxis(), plotCurve->yAxis() ); } @@ -1009,12 +1064,15 @@ void RiuQwtPlotWidget::highlightPlotItems( const std::set& c symbol->setPen( blendedSymbolLineColor, symbol->pen().width(), symbol->pen().style() ); } } - CurveColors curveColors = { curveColor, symbolColor, symbolLineColor }; - m_originalCurveColors.insert( std::make_pair( plotCurve, curveColors ) ); - m_originalCurveColors.insert( std::make_pair( plotCurve, curveColors ) ); + CurveProperties properties = { curveColor, symbolColor, symbolLineColor, penWidth }; + m_originalCurveProperties.insert( std::make_pair( plotCurve, properties ) ); m_originalZValues.insert( std::make_pair( plotCurve, zValue ) ); + + continue; } - else if ( plotShapeItem && closestItems.count( plotItem ) > 0 ) + + auto* plotShapeItem = dynamic_cast( plotItem ); + if ( plotShapeItem && closestItems.count( plotItem ) > 0 ) { QPen pen = plotShapeItem->pen(); pen.setColor( QColor( Qt::green ) ); @@ -1035,24 +1093,27 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting() auto plotItemList = m_plot->itemList(); for ( QwtPlotItem* plotItem : plotItemList ) { - auto* plotCurve = dynamic_cast( plotItem ); - auto* plotShapeItem = dynamic_cast( plotItem ); - if ( plotCurve && m_originalCurveColors.count( plotCurve ) ) + auto* plotCurve = dynamic_cast( plotItem ); + if ( plotCurve && m_originalCurveProperties.count( plotCurve ) ) { const QPen& existingPen = plotCurve->pen(); - auto colors = m_originalCurveColors[plotCurve]; + auto properties = m_originalCurveProperties[plotCurve]; double zValue = m_originalZValues[plotCurve]; - plotCurve->setPen( colors.lineColor, existingPen.width(), existingPen.style() ); + plotCurve->setPen( properties.lineColor, properties.lineWidth, existingPen.style() ); plotCurve->setZ( zValue ); auto* symbol = const_cast( plotCurve->symbol() ); if ( symbol ) { - symbol->setColor( colors.symbolColor ); - symbol->setPen( colors.symbolLineColor, symbol->pen().width(), symbol->pen().style() ); + symbol->setColor( properties.symbolColor ); + symbol->setPen( properties.symbolLineColor, symbol->pen().width(), symbol->pen().style() ); } + + continue; } - else if ( plotShapeItem ) + + auto* plotShapeItem = dynamic_cast( plotItem ); + if ( plotShapeItem ) { QPen pen = plotShapeItem->pen(); @@ -1064,7 +1125,7 @@ void RiuQwtPlotWidget::resetPlotItemHighlighting() plotShapeItem->setZ( plotShapeItem->z() - 100.0 ); } } - m_originalCurveColors.clear(); + m_originalCurveProperties.clear(); m_originalZValues.clear(); resetPlotAxisHighlighting(); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h index 85534b68c6..75f85ddbdf 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.h @@ -216,17 +216,20 @@ class RiuQwtPlotWidget : public RiuPlotWidget void onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection ); void recalculateAxisExtents( RiuPlotAxis axis ); + static int highlightItemWidthAdjustment(); + private: - struct CurveColors + struct CurveProperties { QColor lineColor; QColor symbolColor; QColor symbolLineColor; + int lineWidth; }; - std::map m_originalCurveColors; - std::map m_originalZValues; - std::map m_axisMapping; + std::map m_originalCurveProperties; + std::map m_originalZValues; + std::map m_axisMapping; QPointer m_plot; }; From 3477ac7cb705b18b4b0ee180093a327e4bfd799a Mon Sep 17 00:00:00 2001 From: magnesj Date: Mon, 13 Jun 2022 13:09:20 +0000 Subject: [PATCH 382/406] Fixes by clang-format --- .../Summary/RimSummaryCurveAppearanceCalculator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp index 4dd261cb3e..ba878fef63 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp @@ -368,7 +368,7 @@ void RimSummaryCurveAppearanceCalculator::assignColorByPhase( RimSummaryCurve* c cvf::Color3f RimSummaryCurveAppearanceCalculator::assignColorByPhase( const RifEclipseSummaryAddress& address ) { char secondChar = 0; - std::string vectorName = address.vectorName(); + std::string vectorName = address.vectorName(); if ( vectorName.size() > 1 ) { From 34a05ec5f4804fc278af390a73ad82c0dd98c21f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 13 Jun 2022 17:30:07 +0200 Subject: [PATCH 383/406] Bump version to 2021.10.3-dev.07 --- .../Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp | 2 ++ ResInsightVersion.cmake | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index b0fc38a7db..089559870e 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -126,6 +126,7 @@ std::vector RicSummaryPlotBuilder::createPlots() const { std::set addresses; addresses.insert( group.begin(), group.end() ); + if ( addresses.empty() ) continue; for ( auto summaryCase : m_summaryCases ) { @@ -184,6 +185,7 @@ std::vector RicSummaryPlotBuilder::createPlots() const { std::set addresses; addresses.insert( group.begin(), group.end() ); + if ( addresses.empty() ) continue; if ( !m_summaryCases.empty() ) { diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index e183f27b2d..68f833c17b 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -11,7 +11,7 @@ set(RESINSIGHT_VERSION_TEXT "-dev") # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".06") +set(RESINSIGHT_DEV_VERSION ".07") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From 226ac4f2b67073cb04e200ef8133b8f5f249ca47 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Mon, 13 Jun 2022 09:46:42 +0200 Subject: [PATCH 384/406] #8989 Grid statistics: Improve precision of p10/p90. --- .../RigEclipseNativeStatCalc.cpp | 33 +++++++++++++++ .../RigEclipseNativeStatCalc.h | 3 ++ .../RigEclipseNativeVisibleCellsStatCalc.cpp | 33 +++++++++++++++ .../RigEclipseNativeVisibleCellsStatCalc.h | 3 ++ .../RigStatisticsCalculator.cpp | 25 +++++++++++ .../RigStatisticsCalculator.h | 4 ++ .../RigStatisticsDataCache.cpp | 41 ++++++++++++++++++- .../RigStatisticsDataCache.h | 2 + .../ResultStatisticsCache/RigStatisticsMath.h | 34 +++++++++++++++ 9 files changed, 176 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp index 8b75882002..eba4764a53 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.cpp @@ -46,6 +46,39 @@ void RigEclipseNativeStatCalc::minMaxCellScalarValues( size_t timeStepIndex, dou max = acc.max; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigEclipseNativeStatCalc::hasPreciseP10p90() const +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseNativeStatCalc::p10p90CellScalarValues( double& p10, double& p90 ) +{ + PercentilAccumulator acc; + + for ( size_t timeStepIndex = 0; timeStepIndex < timeStepCount(); timeStepIndex++ ) + { + traverseCells( acc, timeStepIndex ); + } + + acc.computep10p90( p10, p90 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseNativeStatCalc::p10p90CellScalarValues( size_t timeStepIndex, double& p10, double& p90 ) +{ + PercentilAccumulator acc; + traverseCells( acc, timeStepIndex ); + acc.computep10p90( p10, p90 ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.h b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.h index f044cff832..9a2a8d4969 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.h +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeStatCalc.h @@ -35,6 +35,9 @@ class RigEclipseNativeStatCalc : public RigStatisticsCalculator public: RigEclipseNativeStatCalc( RigCaseCellResultsData* cellResultsData, const RigEclipseResultAddress& eclipseResultAddress ); + bool hasPreciseP10p90() const override; + void p10p90CellScalarValues( double& min, double& max ) override; + void p10p90CellScalarValues( size_t timeStepIndex, double& min, double& max ) override; void minMaxCellScalarValues( size_t timeStepIndex, double& min, double& max ) override; void posNegClosestToZero( size_t timeStepIndex, double& pos, double& neg ) override; void valueSumAndSampleCount( size_t timeStepIndex, double& valueSum, size_t& sampleCount ) override; diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp index 6d3f60aef0..a47db39d5e 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.cpp @@ -49,6 +49,39 @@ void RigEclipseNativeVisibleCellsStatCalc::minMaxCellScalarValues( size_t timeSt max = acc.max; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigEclipseNativeVisibleCellsStatCalc::hasPreciseP10p90() const +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseNativeVisibleCellsStatCalc::p10p90CellScalarValues( double& p10, double& p90 ) +{ + PercentilAccumulator acc; + + for ( size_t timeStepIndex = 0; timeStepIndex < timeStepCount(); timeStepIndex++ ) + { + traverseCells( acc, timeStepIndex ); + } + + acc.computep10p90( p10, p90 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigEclipseNativeVisibleCellsStatCalc::p10p90CellScalarValues( size_t timeStepIndex, double& p10, double& p90 ) +{ + PercentilAccumulator acc; + traverseCells( acc, timeStepIndex ); + acc.computep10p90( p10, p90 ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h index 641e89b977..bd20b6f263 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h @@ -36,6 +36,9 @@ class RigEclipseNativeVisibleCellsStatCalc : public RigStatisticsCalculator const RigEclipseResultAddress& scalarResultIndex, const cvf::UByteArray* cellVisibilities ); + bool hasPreciseP10p90() const override; + void p10p90CellScalarValues( double& min, double& max ) override; + void p10p90CellScalarValues( size_t timeStepIndex, double& min, double& max ) override; void minMaxCellScalarValues( size_t timeStepIndex, double& min, double& max ) override; void posNegClosestToZero( size_t timeStepIndex, double& pos, double& neg ) override; void valueSumAndSampleCount( size_t timeStepIndex, double& valueSum, size_t& sampleCount ) override; diff --git a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsCalculator.cpp b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsCalculator.cpp index b7d8afe85b..41a328ac92 100644 --- a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsCalculator.cpp +++ b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsCalculator.cpp @@ -19,6 +19,7 @@ #include "RigStatisticsCalculator.h" +#include #include // Needed for HUGE_VAL on Linux //-------------------------------------------------------------------------------------------------- @@ -135,3 +136,27 @@ void RigStatisticsCalculator::posNegClosestToZero( const std::vector& va } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RigStatisticsCalculator::hasPreciseP10p90() const +{ + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigStatisticsCalculator::p10p90CellScalarValues( double& p10, double& p90 ) +{ + assert( false && "Precise p10/p90 not available" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RigStatisticsCalculator::p10p90CellScalarValues( size_t timeStepIndex, double& p10, double& p90 ) +{ + assert( false && "Precise p10/p90 not available" ); +} diff --git a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsCalculator.h b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsCalculator.h index 31f4efd9f2..0c37ed37ea 100644 --- a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsCalculator.h +++ b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsCalculator.h @@ -46,6 +46,10 @@ class RigStatisticsCalculator : public cvf::Object virtual void uniqueValues( size_t timeStepIndex, std::set& values ) = 0; + virtual bool hasPreciseP10p90() const; + virtual void p10p90CellScalarValues( double& p10, double& p90 ); + virtual void p10p90CellScalarValues( size_t timeStepIndex, double& p10, double& p90 ); + virtual size_t timeStepCount() = 0; void mobileVolumeWeightedMean( double& mean ); diff --git a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.cpp b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.cpp index 72e37c971b..4176d50a6c 100644 --- a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.cpp +++ b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.cpp @@ -310,7 +310,23 @@ void RigStatisticsDataCache::mobileVolumeWeightedMean( double& mean ) //-------------------------------------------------------------------------------------------------- void RigStatisticsDataCache::p10p90CellScalarValues( double& p10, double& p90 ) { - computeHistogramStatisticsIfNeeded(); + if ( !m_statsAllTimesteps.m_isp10p90Calculated ) + { + if ( m_statisticsCalculator->hasPreciseP10p90() ) + { + // Prefer precise p10/p90 calculation where available + m_statisticsCalculator->p10p90CellScalarValues( p10, p90 ); + + m_statsAllTimesteps.m_p10 = p10; + m_statsAllTimesteps.m_p90 = p90; + } + else + { + computeHistogramStatisticsIfNeeded(); + } + + m_statsAllTimesteps.m_isp10p90Calculated = true; + } p10 = m_statsAllTimesteps.m_p10; p90 = m_statsAllTimesteps.m_p90; @@ -321,7 +337,28 @@ void RigStatisticsDataCache::p10p90CellScalarValues( double& p10, double& p90 ) //-------------------------------------------------------------------------------------------------- void RigStatisticsDataCache::p10p90CellScalarValues( size_t timeStepIndex, double& p10, double& p90 ) { - computeHistogramStatisticsIfNeeded( timeStepIndex ); + if ( timeStepIndex >= m_statsPrTs.size() ) + { + m_statsPrTs.resize( timeStepIndex + 1 ); + } + + if ( !m_statsPrTs[timeStepIndex].m_isp10p90Calculated ) + { + if ( m_statisticsCalculator->hasPreciseP10p90() ) + { + // Prefer precise p10/p90 calculation where available + m_statisticsCalculator->p10p90CellScalarValues( timeStepIndex, p10, p90 ); + + m_statsPrTs[timeStepIndex].m_p10 = p10; + m_statsPrTs[timeStepIndex].m_p90 = p90; + } + else + { + computeHistogramStatisticsIfNeeded( timeStepIndex ); + } + + m_statsPrTs[timeStepIndex].m_isp10p90Calculated = true; + } p10 = m_statsPrTs[timeStepIndex].m_p10; p90 = m_statsPrTs[timeStepIndex].m_p90; diff --git a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.h b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.h index 1cc1147ae3..7ca6f844e5 100644 --- a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.h +++ b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsDataCache.h @@ -82,6 +82,7 @@ class RigStatisticsDataCache : public cvf::Object m_isClosestToZeroCalculated = false; m_p10 = HUGE_VAL; m_p90 = HUGE_VAL; + m_isp10p90Calculated = false; m_valueSum = 0.0; m_isValueSumCalculated = false; m_volumeWeightedMean = HUGE_VAL; @@ -101,6 +102,7 @@ class RigStatisticsDataCache : public cvf::Object double m_p10; double m_p90; + bool m_isp10p90Calculated; double m_valueSum; bool m_isValueSumCalculated; diff --git a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.h b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.h index b1209edb07..91f0e2bc95 100644 --- a/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.h +++ b/ApplicationLibCode/ResultStatisticsCache/RigStatisticsMath.h @@ -130,6 +130,40 @@ class MinMaxAccumulator double min; }; +class PercentilAccumulator +{ +public: + PercentilAccumulator() {} + + void addData( const std::vector& values ) + { + for ( double val : values ) + { + addValue( val ); + } + } + + void addData( const std::vector& values ) + { + for ( float val : values ) + { + addValue( val ); + } + } + + void addValue( double value ) { values.push_back( value ); } + + void computep10p90( double& p10, double& p90 ) + { + double mean = HUGE_VAL; + double p50 = HUGE_VAL; + + RigStatisticsMath::calculateStatisticsCurves( values, &p10, &p50, &p90, &mean, RigStatisticsMath::PercentileStyle::SWITCHED ); + } + + std::vector values; +}; + class PosNegAccumulator { public: From 36e43ae85b7a85ca073e0d02c5e755e3226dcf89 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 15 Jun 2022 15:28:32 +0200 Subject: [PATCH 385/406] Performance: Move bool outside cell loop --- .../RigEclipseNativeVisibleCellsStatCalc.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h index bd20b6f263..bb8511b967 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h +++ b/ApplicationLibCode/ReservoirDataModel/RigEclipseNativeVisibleCellsStatCalc.h @@ -67,8 +67,9 @@ class RigEclipseNativeVisibleCellsStatCalc : public RigStatisticsCalculator return; } - const RigActiveCellInfo* actCellInfo = m_caseData->activeCellInfo(); - size_t cellCount = actCellInfo->reservoirCellCount(); + const RigActiveCellInfo* actCellInfo = m_caseData->activeCellInfo(); + size_t cellCount = actCellInfo->reservoirCellCount(); + bool isUsingGlobalActiveIndex = m_caseData->isUsingGlobalActiveIndex( m_resultAddress ); CVF_TIGHT_ASSERT( cellCount == m_cellVisibilities->size() ); @@ -77,7 +78,7 @@ class RigEclipseNativeVisibleCellsStatCalc : public RigStatisticsCalculator if ( !( *m_cellVisibilities )[cIdx] ) continue; size_t cellResultIndex = cIdx; - if ( m_caseData->isUsingGlobalActiveIndex( m_resultAddress ) ) + if ( isUsingGlobalActiveIndex ) { cellResultIndex = actCellInfo->cellResultIndex( cIdx ); } From 193bc35f6b585854f7c1210a3c018c9a91c7217e Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Wed, 15 Jun 2022 15:29:22 +0200 Subject: [PATCH 386/406] #8876 Fracture: add option to use align dip with formation dip --- .../Completions/RimFracture.cpp | 8 ++++ .../Completions/RimFracture.h | 1 + .../Completions/RimWellPathFracture.cpp | 37 ++++++++++++++++ .../Completions/RimWellPathFracture.h | 5 ++- .../StimPlanModel/RimStimPlanModel.cpp | 2 +- .../StimPlanModel/RimStimPlanModel.h | 7 +-- .../ProjectDataModelCommands/RimcWellPath.cpp | 43 +++++++++++++++++++ .../ProjectDataModelCommands/RimcWellPath.h | 3 ++ .../import_fractures_on_well.py | 2 + 9 files changed, 102 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp index 2967edc7f2..56219f337a 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.cpp @@ -527,6 +527,14 @@ double RimFracture::dip() const return m_dip(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimFracture::setDip( double dip ) +{ + m_dip = dip; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.h b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.h index 56507fbb91..34d8585f7d 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFracture.h @@ -95,6 +95,7 @@ class RimFracture : public RimCheckableNamedObject, public Rim3dPropertiesInterf size_t globalCellIndex ) const; cvf::Mat4d transformMatrix() const; + void setDip( double dip ); double dip() const; double tilt() const; diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp index feba6d6d76..48d4cf7945 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.cpp @@ -134,6 +134,43 @@ double RimWellPathFracture::wellAzimuthAtFracturePosition() const return wellPathAzimuth; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Vec3d RimWellPathFracture::computeFractureDirectionNormal() const +{ + RimWellPath* wellPath = nullptr; + this->firstAncestorOrThisOfType( wellPath ); + if ( !wellPath ) return cvf::Vec3d::UNDEFINED; + + RigWellPath* wellPathGeometry = wellPath->wellPathGeometry(); + + // Find the well path points closest to the anchor position + cvf::Vec3d p1; + cvf::Vec3d p2; + wellPathGeometry->twoClosestPoints( fracturePosition(), &p1, &p2 ); + + // Create a well direction based on the two points + cvf::Vec3d wellDirection = ( p2 - p1 ).getNormalized(); + + cvf::Vec3d fractureDirectionNormal = wellDirection; + if ( fractureTemplate()->orientationType() == RimFractureTemplate::ALONG_WELL_PATH ) + { + cvf::Mat3d azimuthRotation = cvf::Mat3d::fromRotation( cvf::Vec3d::Z_AXIS, cvf::Math::toRadians( 90.0 ) ); + fractureDirectionNormal.transformVector( azimuthRotation ); + } + else if ( fractureTemplate()->orientationType() == RimFractureTemplate::AZIMUTH ) + { + // Azimuth angle of fracture is relative to north. + double wellAzimuth = wellPathGeometry->wellPathAzimuthAngle( fracturePosition() ); + cvf::Mat3d azimuthRotation = + cvf::Mat3d::fromRotation( cvf::Vec3d::Z_AXIS, cvf::Math::toRadians( wellAzimuth - m_azimuth - 90.0 ) ); + fractureDirectionNormal.transformVector( azimuthRotation ); + } + + return fractureDirectionNormal; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.h b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.h index b90a1b8ca9..30b95ea0fa 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimWellPathFracture.h @@ -42,8 +42,9 @@ class RimWellPathFracture : public RimFracture double fractureMD() const override; void setMeasuredDepth( double mdValue ); - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - void updateAzimuthBasedOnWellAzimuthAngle() override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void updateAzimuthBasedOnWellAzimuthAngle() override; + cvf::Vec3d computeFractureDirectionNormal() const; double wellAzimuthAtFracturePosition() const override; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp index 97a39a68fe..30017ee785 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.cpp @@ -747,7 +747,7 @@ cvf::Vec3d RimStimPlanModel::computeFractureDirectionNormal( RimWellPath* wellPa //-------------------------------------------------------------------------------------------------- cvf::Vec3d RimStimPlanModel::projectVectorIntoFracturePlane( const cvf::Vec3d& position, const cvf::Vec3d& fractureDirectionNormal, - const cvf::Vec3d& direction ) const + const cvf::Vec3d& direction ) { // Create a fracture plane cvf::Plane fracturePlane; diff --git a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h index a313f440fe..c3d1c44119 100644 --- a/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h +++ b/ApplicationLibCode/ProjectDataModel/StimPlanModel/RimStimPlanModel.h @@ -192,6 +192,10 @@ class RimStimPlanModel : public RimCheckableNamedObject, public RimWellPathCompo QString unitForProperty( RiaDefines::CurveProperty curveProperty ) const; + static cvf::Vec3d projectVectorIntoFracturePlane( const cvf::Vec3d& position, + const cvf::Vec3d& fractureDirectionNormal, + const cvf::Vec3d& direction ); + protected: void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; @@ -208,9 +212,6 @@ class RimStimPlanModel : public RimCheckableNamedObject, public RimWellPathCompo void updatePerforationInterval(); cvf::Vec3d computeFractureDirectionNormal( RimWellPath* wellPath, const cvf::Vec3d& position ) const; - cvf::Vec3d projectVectorIntoFracturePlane( const cvf::Vec3d& position, - const cvf::Vec3d& fractureDirectionNormal, - const cvf::Vec3d& direction ) const; RigEclipseCaseData* getEclipseCaseData() const; diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp index 85e09af2a9..d58155fa7e 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.cpp @@ -18,14 +18,21 @@ #include "RimcWellPath.h" +#include "RiaLogging.h" + +#include "RimEclipseCase.h" +#include "RimEclipseCaseTools.h" #include "RimPerforationCollection.h" #include "RimPerforationInterval.h" #include "RimStimPlanFractureTemplate.h" +#include "RimStimPlanModel.h" #include "RimTools.h" #include "RimWellPath.h" #include "RimWellPathCollection.h" #include "RimWellPathFracture.h" +#include "RigStimPlanModelTools.h" + #include "FractureCommands/RicNewWellPathFractureFeature.h" #include "cafPdmAbstractFieldScriptingCapability.h" @@ -48,6 +55,8 @@ RimcWellPath_addFracture::RimcWellPath_addFracture( caf::PdmObjectHandle* self ) "", "", "StimPlan Fracture Template" ); + CAF_PDM_InitScriptableField( &m_alignDip, "AlignDip", false, "Align Dip" ); + CAF_PDM_InitScriptableFieldNoDefault( &m_eclipseCase, "EclipseCase", "", "", "", "Eclipse Case" ); } //-------------------------------------------------------------------------------------------------- @@ -61,6 +70,40 @@ caf::PdmObjectHandle* RimcWellPath_addFracture::execute() if ( m_stimPlanFractureTemplate ) wellPathFracture->setFractureTemplate( m_stimPlanFractureTemplate() ); + if ( m_alignDip ) + { + if ( m_eclipseCase && m_eclipseCase->eclipseCaseData() ) + { + RiaLogging::info( "Computing formation dip for fracture alignment" ); + + double boundingBoxHorizontal = 50.0; + double boundingBoxVertical = 100.0; + + cvf::Vec3d position = wellPathFracture->anchorPosition(); + cvf::Vec3d direction = RigStimPlanModelTools::calculateTSTDirection( m_eclipseCase->eclipseCaseData(), + position, + boundingBoxHorizontal, + boundingBoxVertical ); + RiaLogging::info( + QString( "Direction: %1 %2 %3" ).arg( direction.x() ).arg( direction.y() ).arg( direction.z() ) ); + cvf::Vec3d fractureDirectionNormal = wellPathFracture->computeFractureDirectionNormal(); + + cvf::Vec3d formationDirection = + RimStimPlanModel::projectVectorIntoFracturePlane( position, fractureDirectionNormal, direction ); + if ( !formationDirection.isUndefined() ) + { + double formationDip = RigStimPlanModelTools::calculateFormationDip( formationDirection ) - 90.0; + RiaLogging::info( QString( "Computed formation dip: %1" ).arg( formationDip ) ); + + wellPathFracture->setDip( formationDip ); + } + } + else + { + RiaLogging::error( "No eclipse case found. Fracture not aligned with formation dip." ); + } + } + return wellPathFracture; } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.h b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.h index aec0c347e3..f0e2acdc51 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.h +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellPath.h @@ -26,6 +26,7 @@ #include class RimStimPlanFractureTemplate; +class RimEclipseCase; //================================================================================================== /// @@ -44,6 +45,8 @@ class RimcWellPath_addFracture : public caf::PdmObjectMethod private: caf::PdmField m_md; caf::PdmPtrField m_stimPlanFractureTemplate; + caf::PdmField m_alignDip; + caf::PdmPtrField m_eclipseCase; }; //================================================================================================== diff --git a/GrpcInterface/Python/rips/PythonExamples/import_fractures_on_well.py b/GrpcInterface/Python/rips/PythonExamples/import_fractures_on_well.py index cc3b33c12f..97eb8456a7 100644 --- a/GrpcInterface/Python/rips/PythonExamples/import_fractures_on_well.py +++ b/GrpcInterface/Python/rips/PythonExamples/import_fractures_on_well.py @@ -38,6 +38,8 @@ fracture = well_path.add_fracture( measured_depth=measured_depth, stim_plan_fracture_template=fracture_template, + align_dip=True, + eclipse_case=case, ) # Update the orientation of the fracture From 62cf62b9a2739306632d3c6aa1d4b5b5ff920188 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 16 Jun 2022 13:55:42 +0200 Subject: [PATCH 387/406] Improve UI for RFT segment curves (#9061) * Make sure all curve values are set correctly for plot orientation * Make sure depth zoom is propagated to the Qwt plot * Expand min/max value range to allow more space around curves * Use int values to represent RFT segment branch number --- .../FileInterface/RifEclipseRftAddress.cpp | 42 +++--- .../FileInterface/RifEclipseRftAddress.h | 19 ++- .../FileInterface/RifReaderEclipseRft.cpp | 24 ++-- .../RifReaderEnsembleStatisticsRft.cpp | 20 ++- .../FileInterface/RifReaderFmuRft.cpp | 22 ++-- .../FileInterface/RifReaderOpmRft.cpp | 20 +-- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 21 +-- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 21 +-- .../ProjectDataModel/WellLog/RimRftTools.cpp | 6 +- .../WellLog/RimWellLogCurve.cpp | 35 +++-- .../WellLog/RimWellLogCurve.h | 57 +++++---- .../RimWellLogCurveCommonDataSource.cpp | 30 +++-- .../WellLog/RimWellLogCurveCommonDataSource.h | 4 +- .../WellLog/RimWellLogRftCurve.cpp | 120 ++++++++++-------- .../WellLog/RimWellLogRftCurve.h | 6 +- .../WellLog/RimWellLogTrack.cpp | 25 +++- .../WellLog/RimWellLogTrack.h | 2 +- 17 files changed, 291 insertions(+), 183 deletions(-) diff --git a/ApplicationLibCode/FileInterface/RifEclipseRftAddress.cpp b/ApplicationLibCode/FileInterface/RifEclipseRftAddress.cpp index 25b210d2da..7ab3d925cd 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseRftAddress.cpp +++ b/ApplicationLibCode/FileInterface/RifEclipseRftAddress.cpp @@ -21,24 +21,29 @@ //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseRftAddress::RifEclipseRftAddress( QString wellName, QDateTime timeStep, RftWellLogChannelType wellLogChannelName ) +RifEclipseRftAddress::RifEclipseRftAddress( const QString& wellName, + const QDateTime& timeStep, + RftWellLogChannelType wellLogChannelName, + const QString& segmentResultName, + int segmentBranchNumber ) : m_wellName( wellName ) , m_timeStep( timeStep ) , m_wellLogChannel( wellLogChannelName ) - , m_segmentBranchNumber( -1 ) + , m_segmentResultName( segmentResultName ) + , m_segmentBranchNumber( segmentBranchNumber ) { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifEclipseRftAddress RifEclipseRftAddress::createSegmentResult( const QString& wellName, - const QDateTime& dateTime, - const QString& resultName ) +RifEclipseRftAddress RifEclipseRftAddress::createAddress( const QString& wellName, + const QDateTime& timeStep, + RftWellLogChannelType wellLogChannel ) { - auto adr = RifEclipseRftAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ); - - adr.setSegmentResultName( resultName ); + auto segmentResultName = ""; + auto segmentBranchNumber = -1; + auto adr = RifEclipseRftAddress( wellName, timeStep, wellLogChannel, segmentResultName, segmentBranchNumber ); return adr; } @@ -46,9 +51,18 @@ RifEclipseRftAddress RifEclipseRftAddress::createSegmentResult( const QString& //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RifEclipseRftAddress::setSegmentResultName( const QString& resultName ) +RifEclipseRftAddress RifEclipseRftAddress::createSegmentAddress( const QString& wellName, + const QDateTime& dateTime, + const QString& resultName, + int segmentBranchNumber ) { - m_segmentResultName = resultName; + auto adr = RifEclipseRftAddress( wellName, + dateTime, + RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES, + resultName, + segmentBranchNumber ); + + return adr; } //-------------------------------------------------------------------------------------------------- @@ -59,14 +73,6 @@ QString RifEclipseRftAddress::segmentResultName() const return m_segmentResultName; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RifEclipseRftAddress::setSegmentBranchNumber( int branchNumber ) -{ - m_segmentBranchNumber = branchNumber; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifEclipseRftAddress.h b/ApplicationLibCode/FileInterface/RifEclipseRftAddress.h index bd8cf929a7..92e5ac1903 100644 --- a/ApplicationLibCode/FileInterface/RifEclipseRftAddress.h +++ b/ApplicationLibCode/FileInterface/RifEclipseRftAddress.h @@ -52,15 +52,16 @@ class RifEclipseRftAddress }; public: - RifEclipseRftAddress( QString wellName, QDateTime timeStep, RftWellLogChannelType wellLogChannel ); - static RifEclipseRftAddress - createSegmentResult( const QString& wellName, const QDateTime& dateTime, const QString& resultName ); + createAddress( const QString& wellName, const QDateTime& timeStep, RftWellLogChannelType wellLogChannel ); - QString segmentResultName() const; + static RifEclipseRftAddress createSegmentAddress( const QString& wellName, + const QDateTime& dateTime, + const QString& resultName, + int segmentBranchNumber ); - void setSegmentBranchNumber( int branchNumber ); - int segmentBranchNumber() const; + QString segmentResultName() const; + int segmentBranchNumber() const; const QString& wellName() const; QDateTime timeStep() const; @@ -70,7 +71,11 @@ class RifEclipseRftAddress static std::set pltPlotChannelTypes(); private: - void setSegmentResultName( const QString& resultName ); + RifEclipseRftAddress( const QString& wellName, + const QDateTime& timeStep, + RftWellLogChannelType wellLogChannel, + const QString& segmentResultName, + int segmentBranchNumber ); private: QString m_wellName; diff --git a/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp b/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp index 474de5ad53..54873a3cd1 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEclipseRft.cpp @@ -89,39 +89,47 @@ void RifReaderEclipseRft::open() QDateTime timeStep = RiaQDateTimeTools::createUtcDateTime(); timeStep.setTime_t( timeStepTime_t ); - RifEclipseRftAddress addressPressure( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); + RifEclipseRftAddress addressPressure = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); m_eclipseRftAddresses.insert( addressPressure ); m_rftAddressToLibeclNodeIdx[addressPressure] = i; - RifEclipseRftAddress addressDepth( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); + RifEclipseRftAddress addressDepth = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); m_eclipseRftAddresses.insert( addressDepth ); m_rftAddressToLibeclNodeIdx[addressDepth] = i; if ( ecl_rft_node_is_RFT( node ) ) { - RifEclipseRftAddress addressSwat( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::SWAT ); + RifEclipseRftAddress addressSwat = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::SWAT ); m_eclipseRftAddresses.insert( addressSwat ); m_rftAddressToLibeclNodeIdx[addressSwat] = i; - RifEclipseRftAddress addressSoil( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::SOIL ); + RifEclipseRftAddress addressSoil = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::SOIL ); m_eclipseRftAddresses.insert( addressSoil ); m_rftAddressToLibeclNodeIdx[addressSoil] = i; - RifEclipseRftAddress addressSgas( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::SGAS ); + RifEclipseRftAddress addressSgas = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::SGAS ); m_eclipseRftAddresses.insert( addressSgas ); m_rftAddressToLibeclNodeIdx[addressSgas] = i; } else if ( ecl_rft_node_is_PLT( node ) ) { - RifEclipseRftAddress addressWrat( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::WRAT ); + RifEclipseRftAddress addressWrat = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::WRAT ); m_eclipseRftAddresses.insert( addressWrat ); m_rftAddressToLibeclNodeIdx[addressWrat] = i; - RifEclipseRftAddress addressOrat( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::ORAT ); + RifEclipseRftAddress addressOrat = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::ORAT ); m_eclipseRftAddresses.insert( addressOrat ); m_rftAddressToLibeclNodeIdx[addressOrat] = i; - RifEclipseRftAddress addressGrat( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::GRAT ); + RifEclipseRftAddress addressGrat = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::GRAT ); m_eclipseRftAddresses.insert( addressGrat ); m_rftAddressToLibeclNodeIdx[addressGrat] = i; } diff --git a/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp b/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp index 9efaa1b232..427bab8558 100644 --- a/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderEnsembleStatisticsRft.cpp @@ -67,7 +67,7 @@ std::set RifReaderEnsembleStatisticsRft::eclipseRftAddress for ( auto channel : statChannels ) { statisticsAddresses.insert( - RifEclipseRftAddress( regularAddress.wellName(), regularAddress.timeStep(), channel ) ); + RifEclipseRftAddress::createAddress( regularAddress.wellName(), regularAddress.timeStep(), channel ) ); } } } @@ -192,13 +192,19 @@ void RifReaderEnsembleStatisticsRft::calculateStatistics( const RifEclipseRftAdd { const QString& wellName = rftAddress.wellName(); const QDateTime& timeStep = rftAddress.timeStep(); - RifEclipseRftAddress depthAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); - RifEclipseRftAddress pressAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); + RifEclipseRftAddress depthAddress = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); + RifEclipseRftAddress pressAddress = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); - RifEclipseRftAddress p10Address( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P10 ); - RifEclipseRftAddress p50Address( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50 ); - RifEclipseRftAddress p90Address( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P90 ); - RifEclipseRftAddress meanAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_MEAN ); + RifEclipseRftAddress p10Address = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P10 ); + RifEclipseRftAddress p50Address = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P50 ); + RifEclipseRftAddress p90Address = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_P90 ); + RifEclipseRftAddress meanAddress = + RifEclipseRftAddress::createAddress( wellName, timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_MEAN ); RiaCurveMerger curveMerger; diff --git a/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp b/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp index a1f085cba9..eedc034379 100644 --- a/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderFmuRft.cpp @@ -195,14 +195,20 @@ std::set RifReaderFmuRft::eclipseRftAddresses() { if ( observation.valid() ) { - RifEclipseRftAddress tvdAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::TVD ); - RifEclipseRftAddress mdAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::MD ); - RifEclipseRftAddress pressureAddress( wellName, - dateTime, - RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); - RifEclipseRftAddress pressureErrorAddress( wellName, - dateTime, - RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_ERROR ); + RifEclipseRftAddress tvdAddress = + RifEclipseRftAddress::createAddress( wellName, + dateTime, + RifEclipseRftAddress::RftWellLogChannelType::TVD ); + RifEclipseRftAddress mdAddress = + RifEclipseRftAddress::createAddress( wellName, dateTime, RifEclipseRftAddress::RftWellLogChannelType::MD ); + RifEclipseRftAddress pressureAddress = + RifEclipseRftAddress::createAddress( wellName, + dateTime, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); + RifEclipseRftAddress pressureErrorAddress = + RifEclipseRftAddress::createAddress( wellName, + dateTime, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_ERROR ); allAddresses.insert( tvdAddress ); allAddresses.insert( mdAddress ); allAddresses.insert( pressureAddress ); diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp index 81db96f123..ec6daaed52 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp @@ -276,10 +276,10 @@ void RifReaderOpmRft::buildMetaData() auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) ); - auto channelTypes = identifyChannelType( resultDataName ); - if ( channelTypes != RifEclipseRftAddress::RftWellLogChannelType::NONE ) + auto channelType = identifyChannelType( resultDataName ); + if ( channelType != RifEclipseRftAddress::RftWellLogChannelType::NONE ) { - auto adr = RifEclipseRftAddress( QString::fromStdString( wellName ), dt, channelTypes ); + auto adr = RifEclipseRftAddress::createAddress( QString::fromStdString( wellName ), dt, channelType ); m_addresses.insert( adr ); } } @@ -310,16 +310,18 @@ void RifReaderOpmRft::buildMetaData() if ( static_cast( resultValueCount ) != segmentCount ) continue; auto resultName = std::get<0>( resultNameAndSize ); - auto adr = RifEclipseRftAddress::createSegmentResult( QString::fromStdString( wellName ), - dt, - QString::fromStdString( resultName ) ); + auto adr = RifEclipseRftAddress::createSegmentAddress( QString::fromStdString( wellName ), + dt, + QString::fromStdString( resultName ), + -1 ); m_addresses.insert( adr ); } - auto adr = RifEclipseRftAddress::createSegmentResult( QString::fromStdString( wellName ), - dt, - RiaDefines::segmentNumberResultName() ); + auto adr = RifEclipseRftAddress::createSegmentAddress( QString::fromStdString( wellName ), + dt, + RiaDefines::segmentNumberResultName(), + -1 ); m_addresses.insert( adr ); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index c233327357..f07a0a66d1 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -300,15 +300,18 @@ class RigRftResultPointCalculator : public RigResultPointCalculator public: RigRftResultPointCalculator( const QString& wellPathName, RimEclipseResultCase* eclCase, QDateTime m_timeStep ) { - RifEclipseRftAddress gasRateAddress( RimWellPlotTools::simWellName( wellPathName ), - m_timeStep, - RifEclipseRftAddress::RftWellLogChannelType::GRAT ); - RifEclipseRftAddress oilRateAddress( RimWellPlotTools::simWellName( wellPathName ), - m_timeStep, - RifEclipseRftAddress::RftWellLogChannelType::ORAT ); - RifEclipseRftAddress watRateAddress( RimWellPlotTools::simWellName( wellPathName ), - m_timeStep, - RifEclipseRftAddress::RftWellLogChannelType::WRAT ); + RifEclipseRftAddress gasRateAddress = + RifEclipseRftAddress::createAddress( RimWellPlotTools::simWellName( wellPathName ), + m_timeStep, + RifEclipseRftAddress::RftWellLogChannelType::GRAT ); + RifEclipseRftAddress oilRateAddress = + RifEclipseRftAddress::createAddress( RimWellPlotTools::simWellName( wellPathName ), + m_timeStep, + RifEclipseRftAddress::RftWellLogChannelType::ORAT ); + RifEclipseRftAddress watRateAddress = + RifEclipseRftAddress::createAddress( RimWellPlotTools::simWellName( wellPathName ), + m_timeStep, + RifEclipseRftAddress::RftWellLogChannelType::WRAT ); std::vector rftIndices; eclCase->rftReader()->cellIndices( gasRateAddress, &rftIndices ); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index f4c91261fd..6da96b0eaf 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -499,9 +499,10 @@ void RimWellRftPlot::updateCurvesInPlot( const std::setsetEclipseResultCase( dynamic_cast( rftCase ) ); - RifEclipseRftAddress address( simWellName, - curveDefToAdd.timeStep(), - RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); + RifEclipseRftAddress address = + RifEclipseRftAddress::createAddress( simWellName, + curveDefToAdd.timeStep(), + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); curve->setRftAddress( address ); curve->setZOrder( 1 ); curve->setSimWellBranchData( m_branchDetection, m_branchIndex ); @@ -515,9 +516,10 @@ void RimWellRftPlot::updateCurvesInPlot( const std::setsetObservedFmuRftData( observedFmuRftData ); - RifEclipseRftAddress address( m_wellPathNameOrSimWellName, - curveDefToAdd.timeStep(), - RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); + RifEclipseRftAddress address = + RifEclipseRftAddress::createAddress( m_wellPathNameOrSimWellName, + curveDefToAdd.timeStep(), + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); curve->setRftAddress( address ); curve->setZOrder( RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_OBSERVED ) ); @@ -532,9 +534,10 @@ void RimWellRftPlot::updateCurvesInPlot( const std::setsetEnsemble( curveDefToAdd.address().ensemble() ); curve->setObservedFmuRftData( this->findObservedFmuData( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() ) ); - RifEclipseRftAddress address( m_wellPathNameOrSimWellName, - curveDefToAdd.timeStep(), - RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); + RifEclipseRftAddress address = + RifEclipseRftAddress::createAddress( m_wellPathNameOrSimWellName, + curveDefToAdd.timeStep(), + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); curve->setRftAddress( address ); curve->setZOrder( 1 ); applyCurveAppearance( curve ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp index a2da5205fb..0d51edc996 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimRftTools.cpp @@ -146,21 +146,21 @@ QList RimRftTools::segmentBranchIdOptions( RifReaderRftI { QList options; - options.push_front( caf::PdmOptionItemInfo( RiaDefines::allBranches(), RiaDefines::allBranches() ) ); + options.push_front( caf::PdmOptionItemInfo( RiaDefines::allBranches(), -1 ) ); if ( readerRft ) { std::vector values; auto adr = - RifEclipseRftAddress::createSegmentResult( wellName, timeStep, RiaDefines::segmentBranchNumberResultName() ); + RifEclipseRftAddress::createSegmentAddress( wellName, timeStep, RiaDefines::segmentBranchNumberResultName(), -1 ); readerRft->values( adr, &values ); for ( const auto& v : values ) { int intValue = v; auto txt = QString::number( intValue ); - options.push_back( caf::PdmOptionItemInfo( txt, txt ) ); + options.push_back( caf::PdmOptionItemInfo( txt, intValue ) ); } } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp index ccb9058a01..7f2510c472 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.cpp @@ -148,6 +148,33 @@ void RimWellLogCurve::setPropertyValuesAndDepths( const std::vector& pro calculateCurveDataPropertyValueRange(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogCurve::setPropertyAndDepthsAndErrors( const std::vector& propertyValues, + const std::vector& depthValues, + const std::vector& errorValues ) +{ + bool useLogarithmicScale = false; + + if ( isVerticalCurve() ) + { + this->setSamplesFromXYErrorValues( propertyValues, + depthValues, + errorValues, + useLogarithmicScale, + RiaCurveDataTools::ErrorAxis::ERROR_ALONG_X_AXIS ); + } + else + { + this->setSamplesFromXYErrorValues( depthValues, + propertyValues, + errorValues, + useLogarithmicScale, + RiaCurveDataTools::ErrorAxis::ERROR_ALONG_Y_AXIS ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -265,14 +292,6 @@ void RimWellLogCurve::setOverrideCurveData( const std::vector& } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiaDefines::PhaseType RimWellLogCurve::resultPhase() const -{ - return RiaDefines::PhaseType::PHASE_NOT_APPLICABLE; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h index bbfaa414fa..19618f0a5d 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurve.h @@ -45,6 +45,30 @@ class RimWellLogCurve : public RimStackablePlotCurve bool propertyValueRangeInData( double* minimumValue, double* maximumValue ) const; bool depthValueRangeInData( double* minimumValue, double* maximumValue ) const; + const RigWellLogCurveData* curveData() const; + + void updateCurveAppearance() override; + + virtual QString wellName() const = 0; + virtual QString wellLogChannelUiName() const = 0; + virtual QString wellLogChannelName() const; + virtual QString wellLogChannelUnits() const = 0; + virtual QString wellDate() const { return ""; }; + + static QString wellLogCurveIconName(); + + void setOverrideCurveData( const std::vector& propertyValues, + const std::vector& depthValues, + const RiaCurveDataTools::CurveIntervals& curveIntervals ); + +protected: + void updateZoomInParentPlot() override; + void updateLegendsInPlot() override; + void setOverrideCurveDataPropertyValueRange( double minimumValue, double maximumValue ); + void calculateCurveDataPropertyValueRange(); + + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void setPropertyValuesAndDepths( const std::vector& propertyValues, const std::vector& depths, RiaDefines::DepthTypeEnum depthType, @@ -63,6 +87,9 @@ class RimWellLogCurve : public RimStackablePlotCurve bool useLogarithmicScale, const QString& propertyUnit = RiaWellLogUnitTools::noUnitString() ); + void setPropertyAndDepthValuesToPlotCurve( const std::vector& propertyValues, + const std::vector& depthValues ); + void setPropertyValuesAndDepths( const std::vector& propertyValues, const std::map>& depths, double rkbDiff, @@ -71,33 +98,9 @@ class RimWellLogCurve : public RimStackablePlotCurve bool useLogarithmicScale, const QString& propertyUnit = RiaWellLogUnitTools::noUnitString() ); - void setPropertyAndDepthValuesToPlotCurve( const std::vector& propertyValues, - const std::vector& depthValues ); - - const RigWellLogCurveData* curveData() const; - - void updateCurveAppearance() override; - - virtual QString wellName() const = 0; - virtual QString wellLogChannelUiName() const = 0; - virtual QString wellLogChannelName() const; - virtual QString wellLogChannelUnits() const = 0; - virtual QString wellDate() const { return ""; }; - - static QString wellLogCurveIconName(); - - void setOverrideCurveData( const std::vector& propertyValues, - const std::vector& depthValues, - const RiaCurveDataTools::CurveIntervals& curveIntervals ); - - virtual RiaDefines::PhaseType resultPhase() const; - -protected: - void updateZoomInParentPlot() override; - void updateLegendsInPlot() override; - void setOverrideCurveDataPropertyValueRange( double minimumValue, double maximumValue ); - void calculateCurveDataPropertyValueRange(); - void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; + void setPropertyAndDepthsAndErrors( const std::vector& propertyValues, + const std::vector& depthValues, + const std::vector& errorValues ); bool isVerticalCurve() const; RiuPlotAxis depthAxis() const; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp index c44703ed2b..4f8243caad 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp @@ -359,9 +359,13 @@ void RimWellLogCurveCommonDataSource::analyseCurvesAndTracks( const std::vector< m_uniqueCases.insert( rftCurve->eclipseResultCase() ); auto adr = rftCurve->rftAddress(); - m_uniqueRftWellNames.insert( adr.wellName() ); - m_uniqueRftTimeSteps.insert( adr.timeStep() ); - m_uniqueRftBranchIds.insert( QString::number( adr.segmentBranchNumber() ) ); + if ( adr.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES && + adr.segmentResultName() != "None" ) + { + m_uniqueRftWellNames.insert( adr.wellName() ); + m_uniqueRftTimeSteps.insert( adr.timeStep() ); + m_uniqueRftBranchIds.insert( adr.segmentBranchNumber() ); + } } } for ( RimWellLogTrack* track : tracks ) @@ -443,6 +447,11 @@ void RimWellLogCurveCommonDataSource::analyseCurvesAndTracks( const std::vector< { m_rftTimeStep = *( m_uniqueRftTimeSteps.begin() ); } + + if ( m_uniqueRftBranchIds.size() == 1u ) + { + m_rftSegmentBranchId = *( m_uniqueRftBranchIds.begin() ); + } } //-------------------------------------------------------------------------------------------------- @@ -745,7 +754,12 @@ std::vector RimWellLogCurveCommonDataSource::fieldsToShowI { fieldsToDisplay.push_back( &m_simWellName ); } - fieldsToDisplay.push_back( &m_timeStep ); + + if ( m_uniqueRftWellNames.size() == 1u ) fieldsToDisplay.push_back( &m_rftWellName ); + if ( m_uniqueTimeSteps.size() == 1u ) fieldsToDisplay.push_back( &m_timeStep ); + if ( m_uniqueRftTimeSteps.size() == 1u ) fieldsToDisplay.push_back( &m_rftTimeStep ); + if ( m_uniqueRftBranchIds.size() == 1u ) fieldsToDisplay.push_back( &m_rftSegmentBranchId ); + return fieldsToDisplay; } @@ -932,7 +946,7 @@ QList else if ( fieldNeedingOptions == &m_rftTimeStep ) { auto eclipseCase = dynamic_cast( m_case() ); - if ( eclipseCase && eclipseCase->rftReader() ) + if ( eclipseCase && eclipseCase->rftReader() && !m_uniqueRftWellNames.empty() ) { options = RimRftTools::segmentTimeStepOptions( eclipseCase->rftReader(), *( m_uniqueRftWellNames.begin() ) ); } @@ -1005,9 +1019,9 @@ void RimWellLogCurveCommonDataSource::defineUiOrdering( QString uiConfigName, ca group->add( &m_wbsSmoothingThreshold ); } - group->add( &m_rftWellName ); - group->add( &m_rftTimeStep ); - group->add( &m_rftSegmentBranchId ); + if ( !m_uniqueRftTimeSteps.empty() ) group->add( &m_rftTimeStep ); + if ( !m_uniqueRftWellNames.empty() ) group->add( &m_rftWellName ); + if ( !m_uniqueRftBranchIds.empty() ) group->add( &m_rftSegmentBranchId ); uiOrdering.skipRemainingFields( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h index 6f0b3ce44f..180b307769 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h @@ -117,7 +117,7 @@ class RimWellLogCurveCommonDataSource : public caf::PdmObject caf::PdmField m_rftTimeStep; caf::PdmField m_rftWellName; - caf::PdmField m_rftSegmentBranchId; + caf::PdmField m_rftSegmentBranchId; std::set m_uniqueCases; std::set m_uniqueTrajectoryTypes; @@ -131,5 +131,5 @@ class RimWellLogCurveCommonDataSource : public caf::PdmObject std::set m_uniqueRftTimeSteps; std::set m_uniqueRftWellNames; - std::set m_uniqueRftBranchIds; + std::set m_uniqueRftBranchIds; }; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index f5441f089f..0dfcd2b634 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -173,7 +173,7 @@ RimWellLogRftCurve::RimWellLogRftCurve() CAF_PDM_InitFieldNoDefault( &m_rftDataType, "RftDataType", "Data Type" ); CAF_PDM_InitField( &m_segmentResultName, "SegmentResultName", RiaResultNames::undefinedResultName(), "Segment Result Name" ); - CAF_PDM_InitField( &m_segmentBranchId, "SegmentBranchId", RiaResultNames::undefinedResultName(), "Segment Branch" ); + CAF_PDM_InitField( &m_segmentBranchId, "SegmentBranchId", -1, "Segment Branch" ); } //-------------------------------------------------------------------------------------------------- @@ -234,7 +234,7 @@ QDateTime RimWellLogRftCurve::timeStep() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogRftCurve::setSegmentBranchId( const QString& branchId ) +void RimWellLogRftCurve::setSegmentBranchId( int branchId ) { m_segmentBranchId = branchId; } @@ -308,9 +308,20 @@ RimObservedFmuRftData* RimWellLogRftCurve::observedFmuRftData() const //-------------------------------------------------------------------------------------------------- void RimWellLogRftCurve::setRftAddress( RifEclipseRftAddress address ) { - m_timeStep = address.timeStep(); - m_wellName = address.wellName(); - m_wellLogChannelName = address.wellLogChannel(); + m_timeStep = address.timeStep(); + m_wellName = address.wellName(); + + if ( address.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ) + { + m_rftDataType = RftDataType::RFT_SEGMENT_DATA; + m_segmentResultName = address.segmentResultName(); + m_segmentBranchId = address.segmentBranchNumber(); + } + else + { + m_rftDataType = RftDataType::RFT_DATA; + m_wellLogChannelName = address.wellLogChannel(); + } } //-------------------------------------------------------------------------------------------------- @@ -318,7 +329,12 @@ void RimWellLogRftCurve::setRftAddress( RifEclipseRftAddress address ) //-------------------------------------------------------------------------------------------------- RifEclipseRftAddress RimWellLogRftCurve::rftAddress() const { - return { m_wellName, m_timeStep, m_wellLogChannelName() }; + if ( m_rftDataType == RftDataType::RFT_SEGMENT_DATA ) + { + return RifEclipseRftAddress::createSegmentAddress( m_wellName, m_timeStep, m_segmentResultName(), m_segmentBranchId() ); + } + + return RifEclipseRftAddress::createAddress( m_wellName, m_timeStep, m_wellLogChannelName() ); } //-------------------------------------------------------------------------------------------------- @@ -453,7 +469,7 @@ QString RimWellLogRftCurve::createCurveAutoName() { name.push_back( m_segmentResultName ); - QString branchText = "Branch " + m_segmentBranchId(); + QString branchText = QString( "Branch %1" ).arg( m_segmentBranchId() ); name.push_back( branchText ); } @@ -573,15 +589,10 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) auto propertyValues = this->curveData()->propertyValues(); auto depthValues = this->curveData()->depths( RiaDefines::DepthTypeEnum::MEASURED_DEPTH, displayUnit ); - bool useLogarithmicScale = false; if ( !errors.empty() ) { - this->setSamplesFromXYErrorValues( propertyValues, - depthValues, - errors, - useLogarithmicScale, - RiaCurveDataTools::ErrorAxis::ERROR_ALONG_X_AXIS ); + setPropertyAndDepthsAndErrors( propertyValues, depthValues, errors ); } else { @@ -620,22 +631,25 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) { m_plotCurve->setPerPointLabels( perPointLabels ); - auto xValues = this->curveData()->propertyValuesByIntervals(); - auto yValues = + auto propertyValues = this->curveData()->propertyValuesByIntervals(); + auto depthValues = this->curveData()->depthValuesByIntervals( RiaDefines::DepthTypeEnum::TRUE_VERTICAL_DEPTH, displayUnit ); bool useLogarithmicScale = false; if ( !errors.empty() ) { - this->setSamplesFromXYErrorValues( xValues, - yValues, - errors, - useLogarithmicScale, - RiaCurveDataTools::ErrorAxis::ERROR_ALONG_X_AXIS ); + setPropertyAndDepthsAndErrors( propertyValues, depthValues, errors ); } else { - m_plotCurve->setSamplesFromXValuesAndYValues( xValues, yValues, useLogarithmicScale ); + if ( isVerticalCurve() ) + { + m_plotCurve->setSamplesFromXValuesAndYValues( propertyValues, depthValues, useLogarithmicScale ); + } + else + { + m_plotCurve->setSamplesFromXValuesAndYValues( depthValues, propertyValues, useLogarithmicScale ); + } } } @@ -803,7 +817,9 @@ std::vector RimWellLogRftCurve::perPointLabels() const { if ( m_observedFmuRftData() ) { - RifEclipseRftAddress address( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); + auto address = RifEclipseRftAddress::createAddress( m_wellName(), + m_timeStep, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE ); return m_observedFmuRftData()->labels( address ); } return {}; @@ -901,7 +917,8 @@ bool RimWellLogRftCurve::createWellPathIdxToRftFileIdxMapping() globCellIndicesToIndexInWell[intersections[idx].globCellIndex] = idx; } - RifEclipseRftAddress depthAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); + RifEclipseRftAddress depthAddress = + RifEclipseRftAddress::createAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); std::vector rftIndices; if ( !rftReader() ) return false; @@ -972,15 +989,15 @@ std::vector RimWellLogRftCurve::xValues() if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA ) { - auto depthAddress = RifEclipseRftAddress::createSegmentResult( m_wellName(), m_timeStep, m_segmentResultName() ); - depthAddress.setSegmentBranchNumber( segmentBranchNumber() ); + auto depthAddress = + RifEclipseRftAddress::createSegmentAddress( m_wellName(), m_timeStep, m_segmentResultName(), segmentBranchId() ); reader->values( depthAddress, &values ); return values; } - RifEclipseRftAddress address( m_wellName(), m_timeStep, m_wellLogChannelName() ); + auto address = RifEclipseRftAddress::createAddress( m_wellName(), m_timeStep, m_wellLogChannelName() ); reader->values( address, &values ); @@ -1014,9 +1031,10 @@ std::vector RimWellLogRftCurve::errorValues() if ( reader && m_rftDataType() == RftDataType::RFT_DATA ) { - RifEclipseRftAddress errorAddress( m_wellName(), - m_timeStep, - RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_ERROR ); + RifEclipseRftAddress errorAddress = + RifEclipseRftAddress::createAddress( m_wellName(), + m_timeStep, + RifEclipseRftAddress::RftWellLogChannelType::PRESSURE_ERROR ); reader->values( errorAddress, &errorValues ); } @@ -1035,15 +1053,17 @@ std::vector RimWellLogRftCurve::tvDepthValues() if ( m_rftDataType() == RftDataType::RFT_SEGMENT_DATA ) { - auto depthAddress = - RifEclipseRftAddress::createSegmentResult( m_wellName(), m_timeStep, RiaDefines::segmentTvdDepthResultName() ); - depthAddress.setSegmentBranchNumber( segmentBranchNumber() ); + auto depthAddress = RifEclipseRftAddress::createSegmentAddress( m_wellName(), + m_timeStep, + RiaDefines::segmentTvdDepthResultName(), + segmentBranchId() ); reader->values( depthAddress, &values ); return values; } - RifEclipseRftAddress depthAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); + auto depthAddress = + RifEclipseRftAddress::createAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); reader->values( depthAddress, &values ); bool wellPathExists = createWellPathIdxToRftFileIdxMapping(); @@ -1078,10 +1098,10 @@ std::vector RimWellLogRftCurve::measuredDepthValues() RifReaderRftInterface* reader = rftReader(); if ( reader ) { - auto depthAddress = RifEclipseRftAddress::createSegmentResult( m_wellName(), - m_timeStep, - RiaDefines::segmentStartDepthResultName() ); - depthAddress.setSegmentBranchNumber( segmentBranchNumber() ); + auto depthAddress = RifEclipseRftAddress::createSegmentAddress( m_wellName(), + m_timeStep, + RiaDefines::segmentStartDepthResultName(), + segmentBranchId() ); reader->values( depthAddress, &values ); } @@ -1095,7 +1115,8 @@ std::vector RimWellLogRftCurve::measuredDepthValues() if ( !reader ) return values; - RifEclipseRftAddress depthAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::MD ); + RifEclipseRftAddress depthAddress = + RifEclipseRftAddress::createAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::MD ); reader->values( depthAddress, &values ); return values; } @@ -1144,7 +1165,7 @@ bool RimWellLogRftCurve::deriveMeasuredDepthValuesFromWellPath( const std::vecto RimProject* proj = RimProject::current(); RimWellPath* wellPath = proj->wellPathByName( m_wellName ); - if ( wellPath ) + if ( wellPath && wellPath->wellPathGeometry() ) { const std::vector& mdValuesOfWellPath = wellPath->wellPathGeometry()->measuredDepths(); const std::vector& tvdValuesOfWellPath = wellPath->wellPathGeometry()->trueVerticalDepths(); @@ -1171,8 +1192,14 @@ bool RimWellLogRftCurve::deriveMeasuredDepthFromObservedData( const std::vector< std::vector tvdValuesOfObservedData; std::vector mdValuesOfObservedData; - RifEclipseRftAddress tvdAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::TVD ); - RifEclipseRftAddress mdAddress( m_wellName(), m_timeStep, RifEclipseRftAddress::RftWellLogChannelType::MD ); + RifEclipseRftAddress tvdAddress = + RifEclipseRftAddress::createAddress( m_wellName(), + m_timeStep, + RifEclipseRftAddress::RftWellLogChannelType::TVD ); + RifEclipseRftAddress mdAddress = + RifEclipseRftAddress::createAddress( m_wellName(), + m_timeStep, + RifEclipseRftAddress::RftWellLogChannelType::MD ); reader->values( tvdAddress, &tvdValuesOfObservedData ); reader->values( mdAddress, &mdValuesOfObservedData ); @@ -1193,14 +1220,7 @@ bool RimWellLogRftCurve::deriveMeasuredDepthFromObservedData( const std::vector< //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RimWellLogRftCurve::segmentBranchNumber() const +int RimWellLogRftCurve::segmentBranchId() const { - if ( m_segmentBranchId() != RiaDefines::allBranches() ) - { - QString text = m_segmentBranchId(); - auto intValue = text.toInt(); - return intValue; - } - - return -1; + return m_segmentBranchId(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h index 64fe815ac6..73ddae2aee 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.h @@ -76,7 +76,7 @@ class RimWellLogRftCurve : public RimWellLogCurve void setTimeStep( const QDateTime& dateTime ); QDateTime timeStep() const; - void setSegmentBranchId( const QString& branchId ); + void setSegmentBranchId( int branchId ); void setEclipseResultCase( RimEclipseResultCase* eclipseResultCase ); RimEclipseResultCase* eclipseResultCase() const; @@ -130,7 +130,7 @@ class RimWellLogRftCurve : public RimWellLogCurve bool deriveMeasuredDepthFromObservedData( const std::vector& tvDepthValues, std::vector& derivedMDValues ); - int segmentBranchNumber() const; + int segmentBranchId() const; private: caf::PdmPtrField m_eclipseResultCase; @@ -145,7 +145,7 @@ class RimWellLogRftCurve : public RimWellLogCurve caf::PdmField> m_rftDataType; caf::PdmField m_segmentResultName; - caf::PdmField m_segmentBranchId; + caf::PdmField m_segmentBranchId; std::map m_idxInWellPathToIdxInRftFile; caf::PdmField> m_wellLogChannelName; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index c9af9f159c..6e65a48e76 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -401,6 +401,17 @@ void RimWellLogTrack::calculatePropertyValueZoomRange() { std::tie( minValue, maxValue ) = adjustXRange( minValue, maxValue, m_minorTickInterval() ); } + else + { + auto range = std::fabs( maxValue - minValue ); + maxValue += 0.1 * range; + + auto candidateMinValue = minValue - 0.1 * range; + if ( std::signbit( minValue ) == std::signbit( candidateMinValue ) ) + { + minValue = candidateMinValue; + } + } m_availablePropertyValueRangeMin = minValue; m_availablePropertyValueRangeMax = maxValue; @@ -573,7 +584,7 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, } else if ( changedField == &m_visiblePropertyValueRangeMin || changedField == &m_visiblePropertyValueRangeMax ) { - bool emptyRange = isEmptyVisibleXRange(); + bool emptyRange = isEmptyVisiblePropertyRange(); m_explicitTickIntervals.uiCapability()->setUiReadOnly( emptyRange ); m_propertyValueAxisGridVisibility.uiCapability()->setUiReadOnly( emptyRange ); @@ -775,7 +786,7 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() { if ( !m_plotWidget ) return; - bool emptyRange = isEmptyVisibleXRange(); + bool emptyRange = isEmptyVisiblePropertyRange(); if ( emptyRange ) { m_plotWidget->enableGridLines( valueAxis(), false, false ); @@ -1227,7 +1238,7 @@ void RimWellLogTrack::visibleDepthRange( double* minDepth, double* maxDepth ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RimWellLogTrack::isEmptyVisibleXRange() const +bool RimWellLogTrack::isEmptyVisiblePropertyRange() const { return std::abs( m_visiblePropertyValueRangeMax() - m_visiblePropertyValueRangeMin ) < 1.0e-6 * std::max( 1.0, std::max( m_visiblePropertyValueRangeMax(), m_visiblePropertyValueRangeMin() ) ); @@ -1304,10 +1315,12 @@ void RimWellLogTrack::onLoadDataAndUpdate() m_majorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); m_minorTickInterval.uiCapability()->setUiHidden( !m_explicitTickIntervals() ); - bool emptyRange = isEmptyVisibleXRange(); + bool emptyRange = isEmptyVisiblePropertyRange(); m_explicitTickIntervals.uiCapability()->setUiReadOnly( emptyRange ); m_propertyValueAxisGridVisibility.uiCapability()->setUiReadOnly( emptyRange ); + updateDepthZoom(); + updateLegend(); } @@ -1404,7 +1417,7 @@ void RimWellLogTrack::setAutoScaleDepthValuesEnabled( bool enabled ) void RimWellLogTrack::setAutoScalePropertyValuesIfNecessary() { // Avoid resetting if visible range has set to empty by user - bool emptyRange = isEmptyVisibleXRange(); + bool emptyRange = isEmptyVisiblePropertyRange(); if ( !m_isAutoScalePropertyValuesEnabled && emptyRange ) return; const double eps = 1.0e-8; @@ -2332,7 +2345,7 @@ void RimWellLogTrack::uiOrderingForRftPltFormations( caf::PdmUiOrdering& uiOrder //-------------------------------------------------------------------------------------------------- void RimWellLogTrack::uiOrderingForXAxisSettings( caf::PdmUiOrdering& uiOrdering ) { - caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "X Axis Settings" ); + caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Property Axis Settings" ); gridGroup->add( &m_isLogarithmicScaleEnabled ); gridGroup->add( &m_visiblePropertyValueRangeMin ); gridGroup->add( &m_visiblePropertyValueRangeMax ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index 26c597e49b..00496431df 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -309,7 +309,7 @@ class RimWellLogTrack : public RimPlot const RigGeoMechWellLogExtractor* extractor ) const; void connectCurveSignals( RimWellLogCurve* curve ); - bool isEmptyVisibleXRange() const; + bool isEmptyVisiblePropertyRange() const; private: QString m_propertyValueAxisTitle; From d854a3d3e7659a6a71c69c2a66acd36a298645c9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 17 Jun 2022 17:24:58 +0200 Subject: [PATCH 388/406] Merge pull request #9063 from OPM/more-rft-fixes-01 More RFT fixes --- .../Application/RiaRftDefines.h | 8 ++ .../Application/Tools/RiaSummaryTools.cpp | 23 +++ .../Application/Tools/RiaSummaryTools.h | 6 +- .../RicSelectCaseOrEnsembleUi.cpp | 11 +- .../Commands/RicWellLogTools.cpp | 18 +++ .../FileInterface/RifReaderOpmRft.cpp | 75 +++++++++- .../FileInterface/RifReaderOpmRft.h | 2 + .../FileInterface/RifRftSegment.cpp | 37 +++++ .../FileInterface/RifRftSegment.h | 8 ++ .../Summary/RimFileSummaryCase.cpp | 8 +- .../Summary/RimFileSummaryCase.h | 8 +- .../Summary/RimSummaryCurve.cpp | 5 +- .../RimWellLogCurveCommonDataSource.cpp | 132 +++++++++++------- .../WellLog/RimWellLogCurveCommonDataSource.h | 56 ++++---- .../WellLog/RimWellLogRftCurve.cpp | 28 +++- .../WellLog/RimWellLogTrack.cpp | 91 ++++++++---- .../WellLog/RimWellLogTrack.h | 4 +- 17 files changed, 390 insertions(+), 130 deletions(-) diff --git a/ApplicationLibCode/Application/RiaRftDefines.h b/ApplicationLibCode/Application/RiaRftDefines.h index 2f5aa238bb..5467b6c4ed 100644 --- a/ApplicationLibCode/Application/RiaRftDefines.h +++ b/ApplicationLibCode/Application/RiaRftDefines.h @@ -30,4 +30,12 @@ QString segmentNumberResultName(); QString allBranches(); QString segmentBranchNumberResultName(); +enum class RftBranchType +{ + RFT_TUBING, + RFT_ANNULAR, + RFT_DEVICE, + RFT_UNKNOWN +}; + }; // namespace RiaDefines diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp index 2de0eff873..8c43701ea3 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.cpp @@ -299,3 +299,26 @@ RimSummaryCaseCollection* RiaSummaryTools::ensembleById( int ensembleId ) return nullptr; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RiaSummaryTools::optionsForAllSummaryCases() +{ + return optionsForSummaryCases( RimProject::current()->allSummaryCases() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RiaSummaryTools::optionsForSummaryCases( const std::vector& cases ) +{ + QList options; + + for ( RimSummaryCase* c : cases ) + { + options.push_back( caf::PdmOptionItemInfo( c->displayCaseName(), c, false, c->uiIconProvider() ) ); + } + + return options; +} diff --git a/ApplicationLibCode/Application/Tools/RiaSummaryTools.h b/ApplicationLibCode/Application/Tools/RiaSummaryTools.h index a0aaea080f..daaccdff7c 100644 --- a/ApplicationLibCode/Application/Tools/RiaSummaryTools.h +++ b/ApplicationLibCode/Application/Tools/RiaSummaryTools.h @@ -40,7 +40,8 @@ class QStringList; namespace caf { class PdmObject; -} +class PdmOptionItemInfo; +} // namespace caf //================================================================================================== // @@ -75,4 +76,7 @@ class RiaSummaryTools static RimSummaryCase* summaryCaseById( int caseId ); static RimSummaryCaseCollection* ensembleById( int ensembleId ); + + static QList optionsForAllSummaryCases(); + static QList optionsForSummaryCases( const std::vector& cases ); }; diff --git a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp index d669925c66..f52619f36a 100644 --- a/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp +++ b/ApplicationLibCode/Commands/PlotTemplateCommands/RicSelectCaseOrEnsembleUi.cpp @@ -18,6 +18,8 @@ #include "RicSelectCaseOrEnsembleUi.h" +#include "RiaSummaryTools.h" + #include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" @@ -78,14 +80,7 @@ QList if ( fieldNeedingOptions == &m_selectedSummaryCase ) { - RimProject* proj = RimProject::current(); - - std::vector cases = proj->allSummaryCases(); - - for ( RimSummaryCase* rimCase : cases ) - { - options.push_back( caf::PdmOptionItemInfo( rimCase->displayCaseName(), rimCase ) ); - } + options = RiaSummaryTools::optionsForAllSummaryCases(); } else if ( fieldNeedingOptions == &m_selectedEnsemble ) { diff --git a/ApplicationLibCode/Commands/RicWellLogTools.cpp b/ApplicationLibCode/Commands/RicWellLogTools.cpp index d4bf8f093d..3632ed87a5 100644 --- a/ApplicationLibCode/Commands/RicWellLogTools.cpp +++ b/ApplicationLibCode/Commands/RicWellLogTools.cpp @@ -29,6 +29,7 @@ #include "RimEclipseResultCase.h" #include "RimProject.h" #include "RimSimWellInView.h" +#include "RimSummaryCase.h" #include "RimWellLogCurveCommonDataSource.h" #include "RimWellLogExtractionCurve.h" #include "RimWellLogFile.h" @@ -378,6 +379,23 @@ RimWellLogRftCurve* curve->setDefaultAddress( wellName ); } } + else + { + auto sumCases = RimProject::current()->allSummaryCases(); + + for ( auto sc : sumCases ) + { + if ( sc->rftReader() ) + { + auto rftReader = sc->rftReader(); + + curve->setSummaryCase( sc ); + + auto addresses = rftReader->eclipseRftAddresses(); + if ( !addresses.empty() ) curve->setRftAddress( *addresses.begin() ); + } + } + } cvf::Color3f curveColor = RicWellLogPlotCurveFeatureImpl::curveColorFromTable( plotTrack->curveCount() ); curve->setColor( curveColor ); diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp index ec6daaed52..a8fae6a2f1 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp @@ -91,7 +91,7 @@ void RifReaderOpmRft::values( const RifEclipseRftAddress& rftAddress, std::vecto } else if ( rftAddress.segmentResultName() == RiaDefines::segmentBranchNumberResultName() ) { - auto branchNumbers = segment.branchIds(); + auto branchNumbers = segment.tubingBranchIds(); for ( const auto& branchNumber : branchNumbers ) { values->push_back( branchNumber ); @@ -156,6 +156,9 @@ std::set RifReaderOpmRft::availableTimeSteps( const QString& wellName, const RifEclipseRftAddress::RftWellLogChannelType& wellLogChannelName ) { + if ( wellLogChannelName == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ) + return m_rftSegmentTimeSteps; + std::set timeSteps; for ( const auto& address : m_addresses ) @@ -301,6 +304,8 @@ void RifReaderOpmRft::buildMetaData() auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) ); + m_rftSegmentTimeSteps.insert( dt ); + auto segmentCount = segmentData.topology().size(); for ( const auto& resultNameAndSize : resultNameAndSizes ) @@ -394,9 +399,10 @@ void RifReaderOpmRft::buildSegmentData() } } - auto wellDateKey = std::make_pair( wellName, date ); - + auto wellDateKey = std::make_pair( wellName, date ); m_rftWellDateSegments[wellDateKey] = segment; + + buildSegmentBranchTypes( wellDateKey ); } } } @@ -445,6 +451,69 @@ void RifReaderOpmRft::importWellNames() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifReaderOpmRft::buildSegmentBranchTypes( const RftSegmentKey& segmentKey ) +{ + auto wellName = segmentKey.first; + auto date = segmentKey.second; + RifRftSegment& segmentRef = m_rftWellDateSegments[segmentKey]; + + int y = std::get<0>( date ); + int m = std::get<1>( date ); + int d = std::get<2>( date ); + + auto dt = RiaQDateTimeTools::createUtcDateTime( QDate( y, m, d ) ); + + std::vector seglenstValues; + std::vector seglenenValues; + { + auto resultName = + RifEclipseRftAddress::createSegmentAddress( QString::fromStdString( wellName ), dt, "SEGLENST", -1 ); + + values( resultName, &seglenstValues ); + + if ( seglenstValues.size() > 2 ) + { + seglenstValues[0] = seglenstValues[1]; + } + } + { + auto resultName = + RifEclipseRftAddress::createSegmentAddress( QString::fromStdString( wellName ), dt, "SEGLENEN", -1 ); + + values( resultName, &seglenenValues ); + } + + if ( !seglenenValues.empty() && !seglenstValues.empty() ) + { + auto branchIds = segmentRef.branchIds(); + for ( auto id : branchIds ) + { + double minimumMD = std::numeric_limits::max(); + double maximumMD = std::numeric_limits::min(); + + auto indices = segmentRef.indicesForBranchNumber( id ); + for ( auto i : indices ) + { + minimumMD = std::min( minimumMD, seglenstValues[i] ); + maximumMD = std::max( maximumMD, seglenenValues[i] ); + } + + double length = maximumMD - minimumMD; + + segmentRef.setBranchLength( id, length ); + + const double tubingThreshold = 1.0; + RiaDefines::RftBranchType branchType = RiaDefines::RftBranchType::RFT_UNKNOWN; + if ( length > tubingThreshold ) branchType = RiaDefines::RftBranchType::RFT_TUBING; + + segmentRef.setBranchType( id, branchType ); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmRft.h b/ApplicationLibCode/FileInterface/RifReaderOpmRft.h index c0982c5037..bdfac4ceb7 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmRft.h +++ b/ApplicationLibCode/FileInterface/RifReaderOpmRft.h @@ -63,6 +63,7 @@ class RifReaderOpmRft : public RifReaderRftInterface, public cvf::Object void segmentDataDebugLog() const; bool isOpen() const; void importWellNames(); + void buildSegmentBranchTypes( const RftSegmentKey& segmentKey ); std::vector importWellData( const std::string& wellName, const std::string& propertyName, const RftDate& date ) const; @@ -77,4 +78,5 @@ class RifReaderOpmRft : public RifReaderRftInterface, public cvf::Object std::set m_wellNames; std::map m_rftWellDateSegments; + std::set m_rftSegmentTimeSteps; }; diff --git a/ApplicationLibCode/FileInterface/RifRftSegment.cpp b/ApplicationLibCode/FileInterface/RifRftSegment.cpp index 5b74115de4..3cdad97006 100644 --- a/ApplicationLibCode/FileInterface/RifRftSegment.cpp +++ b/ApplicationLibCode/FileInterface/RifRftSegment.cpp @@ -110,6 +110,27 @@ std::vector RifRftSegment::resultNameAndSize() co return m_resultNameAndSize; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RifRftSegment::tubingBranchIds() const +{ + std::vector filteredBranchIds; + + for ( auto branchId : branchIds() ) + { + if ( m_branchType.count( branchId ) ) + { + if ( m_branchType.at( branchId ) == RiaDefines::RftBranchType::RFT_TUBING ) + { + filteredBranchIds.push_back( branchId ); + } + } + } + + return filteredBranchIds; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -128,6 +149,22 @@ std::vector RifRftSegment::branchIds() const return v; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifRftSegment::setBranchLength( int branchId, double length ) +{ + m_branchLength[branchId] = length; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RifRftSegment::setBranchType( int branchId, RiaDefines::RftBranchType branchType ) +{ + m_branchType[branchId] = branchType; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifRftSegment.h b/ApplicationLibCode/FileInterface/RifRftSegment.h index 428b858df9..6093ec89b0 100644 --- a/ApplicationLibCode/FileInterface/RifRftSegment.h +++ b/ApplicationLibCode/FileInterface/RifRftSegment.h @@ -22,6 +22,7 @@ #include #include +#include "RiaRftDefines.h" #include "opm/io/eclipse/EclFile.hpp" class RifRftSegmentData @@ -52,11 +53,18 @@ class RifRftSegment void addResultNameAndSize( const Opm::EclIO::EclFile::EclEntry& resultNameAndSize ); std::vector resultNameAndSize() const; + std::vector tubingBranchIds() const; std::vector branchIds() const; + void setBranchLength( int branchId, double length ); + void setBranchType( int branchId, RiaDefines::RftBranchType branchType ); + std::vector indicesForBranchNumber( int branchNumber ) const; private: std::vector m_topology; std::vector m_resultNameAndSize; + + std::map m_branchLength; + std::map m_branchType; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp index db06b19659..3906ebbffc 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.cpp @@ -29,6 +29,7 @@ #include "RifProjectSummaryDataWriter.h" #include "RifReaderEclipseRft.h" #include "RifReaderEclipseSummary.h" +#include "RifReaderOpmRft.h" #include "RifSummaryReaderMultipleFiles.h" #include "RimProject.h" @@ -185,7 +186,7 @@ RifSummaryReaderInterface* RimFileSummaryCase::findRelatedFilesAndCreateReader( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RifReaderEclipseRft* RimFileSummaryCase::findRftDataAndCreateReader( const QString& headerFileName ) +RifReaderOpmRft* RimFileSummaryCase::findRftDataAndCreateReader( const QString& headerFileName ) { QFileInfo fileInfo( headerFileName ); QString folder = fileInfo.absolutePath(); @@ -195,8 +196,7 @@ RifReaderEclipseRft* RimFileSummaryCase::findRftDataAndCreateReader( const QStri if ( rftFileInfo.exists() ) { - std::unique_ptr rftReader( new RifReaderEclipseRft( rftFileInfo.filePath() ) ); - return rftReader.release(); + return new RifReaderOpmRft( rftFileInfo.filePath() ); } return nullptr; @@ -211,7 +211,7 @@ void RimFileSummaryCase::defineEditorAttribute( const caf::PdmFieldHandle* field { if ( field == &m_additionalSummaryFilePath ) { - caf::PdmUiFilePathEditorAttribute* myAttr = dynamic_cast( attribute ); + auto* myAttr = dynamic_cast( attribute ); if ( myAttr ) { myAttr->m_selectSaveFileName = true; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h index 7ae8e94092..a7daa01d71 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimFileSummaryCase.h @@ -23,7 +23,7 @@ #include "cvfObject.h" class RifReaderRftInterface; -class RifReaderEclipseRft; +class RifReaderOpmRft; class RifReaderEclipseSummary; class RiaThreadSafeLogger; class RifOpmCommonEclipseSummary; @@ -61,8 +61,6 @@ class RimFileSummaryCase : public RimSummaryCase bool includeRestartFiles, RiaThreadSafeLogger* threadSafeLogger ); - static RifReaderEclipseRft* findRftDataAndCreateReader( const QString& headerFileName ); - protected: void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, @@ -73,10 +71,12 @@ class RimFileSummaryCase : public RimSummaryCase QString additionalSummaryDataFilePath() const; static QString createAdditionalSummaryFileName(); + static RifReaderOpmRft* findRftDataAndCreateReader( const QString& headerFileName ); + private: cvf::ref m_fileSummaryReader; cvf::ref m_multiSummaryReader; - cvf::ref m_summaryEclipseRftReader; + cvf::ref m_summaryEclipseRftReader; caf::PdmField m_includeRestartFiles; caf::PdmField m_additionalSummaryFilePath; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 232da869da..c90437f5b7 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -484,10 +484,7 @@ QList RimSummaryCurve::calculateValueOptions( const caf: cases.push_back( proj->calculationCollection->calculationSummaryCase() ); - for ( RimSummaryCase* rimCase : cases ) - { - options.push_back( caf::PdmOptionItemInfo( rimCase->displayCaseName(), rimCase ) ); - } + options = RiaSummaryTools::optionsForSummaryCases( cases ); if ( options.size() > 0 ) { diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp index 4f8243caad..c5ea2f459b 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp @@ -18,6 +18,9 @@ #include "RimWellLogCurveCommonDataSource.h" +#include "RiaSimWellBranchTools.h" +#include "RiaSummaryTools.h" + #include "RimCase.h" #include "RimDataSourceSteppingTools.h" #include "RimEclipseCase.h" @@ -26,6 +29,7 @@ #include "RimOilField.h" #include "RimProject.h" #include "RimRftTools.h" +#include "RimSummaryCase.h" #include "RimTools.h" #include "RimWellFlowRateCurve.h" #include "RimWellLogExtractionCurve.h" @@ -39,8 +43,6 @@ #include "RimWellPath.h" #include "RimWellPathCollection.h" -#include "RiaSimWellBranchTools.h" - #include "cafPdmUiCheckBoxTristateEditor.h" #include "cafPdmUiComboBoxEditor.h" #include "cafPdmUiLineEditor.h" @@ -75,9 +77,10 @@ RimWellLogCurveCommonDataSource::RimWellLogCurveCommonDataSource() CAF_PDM_InitObject( "Change Data Source" ); CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case" ); + CAF_PDM_InitFieldNoDefault( &m_summaryCase, "SummaryCase", "Summary Case" ); CAF_PDM_InitFieldNoDefault( &m_trajectoryType, "TrajectoryType", "Trajectory Type" ); - CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Name" ); + CAF_PDM_InitFieldNoDefault( &m_wellPath, "CurveWellPath", "Well Path" ); CAF_PDM_InitFieldNoDefault( &m_simWellName, "SimulationWellName", "Well Name" ); CAF_PDM_InitFieldNoDefault( &m_branchDetection, @@ -122,6 +125,14 @@ RimCase* RimWellLogCurveCommonDataSource::caseToApply() const return m_case; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogCurveCommonDataSource::setSummaryCaseToApply( RimSummaryCase* val ) +{ + m_summaryCase = val; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -130,6 +141,14 @@ void RimWellLogCurveCommonDataSource::setCaseToApply( RimCase* val ) m_case = val; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryCase* RimWellLogCurveCommonDataSource::summaryCaseToApply() const +{ + return m_summaryCase(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -264,6 +283,7 @@ void RimWellLogCurveCommonDataSource::setTimeStepToApply( int val ) void RimWellLogCurveCommonDataSource::resetDefaultOptions() { setCaseToApply( nullptr ); + setSummaryCaseToApply( nullptr ); setTrajectoryTypeToApply( -1 ); setWellPathToApply( nullptr ); setBranchIndexToApply( -1 ); @@ -274,6 +294,7 @@ void RimWellLogCurveCommonDataSource::resetDefaultOptions() setWbsSmoothingThreshold( -1.0 ); m_uniqueCases.clear(); + m_uniqueSummaryCases.clear(); m_uniqueTrajectoryTypes.clear(); m_uniqueWellPaths.clear(); m_uniqueWellNames.clear(); @@ -355,8 +376,9 @@ void RimWellLogCurveCommonDataSource::analyseCurvesAndTracks( const std::vector< } else if ( rftCurve ) { + if ( rftCurve->summaryCase() ) m_uniqueSummaryCases.insert( rftCurve->summaryCase() ); + if ( rftCurve->eclipseResultCase() ) m_uniqueCases.insert( rftCurve->eclipseResultCase() ); m_uniqueWellNames.insert( rftCurve->wellName() ); - m_uniqueCases.insert( rftCurve->eclipseResultCase() ); auto adr = rftCurve->rftAddress(); if ( adr.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES && @@ -399,6 +421,11 @@ void RimWellLogCurveCommonDataSource::analyseCurvesAndTracks( const std::vector< setCaseToApply( *m_uniqueCases.begin() ); } + if ( m_uniqueSummaryCases.size() == 1u ) + { + setSummaryCaseToApply( *m_uniqueSummaryCases.begin() ); + } + if ( m_uniqueTrajectoryTypes.size() == 1u ) { m_trajectoryType = *m_uniqueTrajectoryTypes.begin(); @@ -745,14 +772,18 @@ std::vector RimWellLogCurveCommonDataSource::fieldsToShowI analyseCurvesAndTracks(); std::vector fieldsToDisplay; - fieldsToDisplay.push_back( &m_case ); - if ( trajectoryTypeToApply() == RimWellLogExtractionCurve::WELL_PATH ) - { - fieldsToDisplay.push_back( &m_wellPath ); - } - else if ( trajectoryTypeToApply() == RimWellLogExtractionCurve::SIMULATION_WELL ) + + if ( !m_uniqueCases.empty() ) { - fieldsToDisplay.push_back( &m_simWellName ); + fieldsToDisplay.push_back( &m_case ); + if ( trajectoryTypeToApply() == RimWellLogExtractionCurve::WELL_PATH ) + { + fieldsToDisplay.push_back( &m_wellPath ); + } + else if ( trajectoryTypeToApply() == RimWellLogExtractionCurve::SIMULATION_WELL ) + { + fieldsToDisplay.push_back( &m_simWellName ); + } } if ( m_uniqueRftWellNames.size() == 1u ) fieldsToDisplay.push_back( &m_rftWellName ); @@ -829,17 +860,11 @@ QList RimTools::caseOptionItems( &options ); } - if ( caseToApply() == nullptr ) - { - if ( !m_uniqueCases.empty() ) - { - options.push_front( caf::PdmOptionItemInfo( "Mixed Cases", nullptr ) ); - } - else - { - options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) ); - } - } + options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) ); + } + if ( fieldNeedingOptions == &m_summaryCase ) + { + options = RiaSummaryTools::optionsForAllSummaryCases(); } else if ( fieldNeedingOptions == &m_trajectoryType ) { @@ -880,17 +905,20 @@ QList } else if ( fieldNeedingOptions == &m_timeStep ) { - RimTools::timeStepsForCase( m_case, &options ); - - if ( timeStepToApply() == -1 ) + if ( m_case() ) { - if ( !m_uniqueTimeSteps.empty() ) - { - options.push_front( caf::PdmOptionItemInfo( "Mixed Time Steps", -1 ) ); - } - else + RimTools::timeStepsForCase( m_case, &options ); + + if ( timeStepToApply() == -1 ) { - options.push_front( caf::PdmOptionItemInfo( "No Time Steps", -1 ) ); + if ( !m_uniqueTimeSteps.empty() ) + { + options.push_front( caf::PdmOptionItemInfo( "Mixed Time Steps", -1 ) ); + } + else + { + options.push_front( caf::PdmOptionItemInfo( "No Time Steps", -1 ) ); + } } } } @@ -945,27 +973,16 @@ QList } else if ( fieldNeedingOptions == &m_rftTimeStep ) { - auto eclipseCase = dynamic_cast( m_case() ); - if ( eclipseCase && eclipseCase->rftReader() && !m_uniqueRftWellNames.empty() ) - { - options = RimRftTools::segmentTimeStepOptions( eclipseCase->rftReader(), *( m_uniqueRftWellNames.begin() ) ); - } + if ( !m_uniqueRftWellNames.empty() ) + options = RimRftTools::segmentTimeStepOptions( rftReader(), *( m_uniqueRftWellNames.begin() ) ); } else if ( fieldNeedingOptions == &m_rftWellName ) { - auto eclipseCase = dynamic_cast( m_case() ); - if ( eclipseCase && eclipseCase->rftReader() ) - { - options = RimRftTools::wellNameOptions( eclipseCase->rftReader() ); - } + options = RimRftTools::wellNameOptions( rftReader() ); } else if ( fieldNeedingOptions == &m_rftSegmentBranchId ) { - auto eclipseCase = dynamic_cast( m_case() ); - if ( eclipseCase && eclipseCase->rftReader() ) - { - options = RimRftTools::segmentBranchIdOptions( eclipseCase->rftReader(), m_rftWellName(), m_rftTimeStep() ); - } + options = RimRftTools::segmentBranchIdOptions( rftReader(), m_rftWellName(), m_rftTimeStep() ); } return options; @@ -979,7 +996,8 @@ void RimWellLogCurveCommonDataSource::defineUiOrdering( QString uiConfigName, ca analyseCurvesAndTracks(); caf::PdmUiGroup* group = uiOrdering.addNewGroup( "Data Source" ); - group->add( &m_case ); + if ( m_case() ) group->add( &m_case ); + if ( m_summaryCase() ) group->add( &m_summaryCase ); auto* eclipseCase = dynamic_cast( m_case() ); if ( eclipseCase ) @@ -1006,12 +1024,13 @@ void RimWellLogCurveCommonDataSource::defineUiOrdering( QString uiConfigName, ca } } } + + group->add( &m_timeStep ); } else { - group->add( &m_wellPath ); + if ( m_wellPath() ) group->add( &m_wellPath ); } - group->add( &m_timeStep ); if ( uiConfigName == smoothingUiOrderinglabel() ) { @@ -1037,7 +1056,7 @@ void RimWellLogCurveCommonDataSource::defineEditorAttribute( const caf::PdmField if ( myAttr ) { if ( field == &m_case || field == &m_simWellName || field == &m_wellPath || field == &m_timeStep || - field == &m_rftTimeStep || field == &m_rftSegmentBranchId ) + field == &m_rftTimeStep || field == &m_rftSegmentBranchId || field == &m_rftWellName ) { myAttr->showPreviousAndNextButtons = true; myAttr->nextIcon = QIcon( ":/ComboBoxDown.svg" ); @@ -1091,3 +1110,16 @@ void RimWellLogCurveCommonDataSource::modifyCurrentIndex( caf::PdmValueField* fi QList options = calculateValueOptions( field ); RimDataSourceSteppingTools::modifyCurrentIndex( field, options, indexOffset ); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RifReaderRftInterface* RimWellLogCurveCommonDataSource::rftReader() +{ + auto eclipseCase = dynamic_cast( m_case() ); + if ( eclipseCase && eclipseCase->rftReader() ) return eclipseCase->rftReader(); + + if ( m_summaryCase() && m_summaryCase()->rftReader() ) return m_summaryCase->rftReader(); + + return nullptr; +} diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h index 180b307769..28c1a490e9 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.h @@ -33,6 +33,8 @@ class RimWellLogCurve; class RimWellLogPlot; class RimWellLogTrack; class RimWellPath; +class RimSummaryCase; +class RifReaderRftInterface; //================================================================================================== /// @@ -56,20 +58,22 @@ class RimWellLogCurveCommonDataSource : public caf::PdmObject void setCaseType( RiaDefines::CaseType caseType ); - RimCase* caseToApply() const; - void setCaseToApply( RimCase* val ); - int trajectoryTypeToApply() const; - void setTrajectoryTypeToApply( int val ); - RimWellPath* wellPathToApply() const; - void setWellPathToApply( RimWellPath* val ); - int branchIndexToApply() const; - void setBranchIndexToApply( int val ); - caf::Tristate branchDetectionToApply() const; - void setBranchDetectionToApply( caf::Tristate::State val ); - caf::Tristate wbsSmoothingToApply() const; - void setWbsSmoothingToApply( caf::Tristate::State val ); - double wbsSmoothingThreshold() const; - void setWbsSmoothingThreshold( double smoothingThreshold ); + RimCase* caseToApply() const; + void setCaseToApply( RimCase* val ); + RimSummaryCase* summaryCaseToApply() const; + void setSummaryCaseToApply( RimSummaryCase* val ); + int trajectoryTypeToApply() const; + void setTrajectoryTypeToApply( int val ); + RimWellPath* wellPathToApply() const; + void setWellPathToApply( RimWellPath* val ); + int branchIndexToApply() const; + void setBranchIndexToApply( int val ); + caf::Tristate branchDetectionToApply() const; + void setBranchDetectionToApply( caf::Tristate::State val ); + caf::Tristate wbsSmoothingToApply() const; + void setWbsSmoothingToApply( caf::Tristate::State val ); + double wbsSmoothingThreshold() const; + void setWbsSmoothingThreshold( double smoothingThreshold ); QString simWellNameToApply() const; void setSimWellNameToApply( const QString& val ); @@ -93,7 +97,7 @@ class RimWellLogCurveCommonDataSource : public caf::PdmObject static QString smoothingUiOrderinglabel(); -protected: +private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; @@ -102,24 +106,28 @@ class RimWellLogCurveCommonDataSource : public caf::PdmObject caf::PdmUiEditorAttribute* attribute ) override; void modifyCurrentIndex( caf::PdmValueField* field, int indexOffset ); + RifReaderRftInterface* rftReader(); + private: RiaDefines::CaseType m_caseType; - caf::PdmPtrField m_case; - caf::PdmField m_trajectoryType; - caf::PdmPtrField m_wellPath; - caf::PdmField m_simWellName; - caf::PdmField m_branchIndex; - caf::PdmField m_branchDetection; - caf::PdmField m_timeStep; - caf::PdmField m_wbsSmoothing; - caf::PdmField m_wbsSmoothingThreshold; + caf::PdmPtrField m_case; + caf::PdmPtrField m_summaryCase; + caf::PdmField m_trajectoryType; + caf::PdmPtrField m_wellPath; + caf::PdmField m_simWellName; + caf::PdmField m_branchIndex; + caf::PdmField m_branchDetection; + caf::PdmField m_timeStep; + caf::PdmField m_wbsSmoothing; + caf::PdmField m_wbsSmoothingThreshold; caf::PdmField m_rftTimeStep; caf::PdmField m_rftWellName; caf::PdmField m_rftSegmentBranchId; std::set m_uniqueCases; + std::set m_uniqueSummaryCases; std::set m_uniqueTrajectoryTypes; std::set m_uniqueWellPaths; std::set m_uniqueWellNames; diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp index 0dfcd2b634..8ee4b02003 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogRftCurve.cpp @@ -24,6 +24,7 @@ #include "RiaResultNames.h" #include "RiaRftDefines.h" #include "RiaSimWellBranchTools.h" +#include "RiaSummaryTools.h" #include "RifEclipseRftAddress.h" #include "RifReaderEclipseRft.h" @@ -308,8 +309,9 @@ RimObservedFmuRftData* RimWellLogRftCurve::observedFmuRftData() const //-------------------------------------------------------------------------------------------------- void RimWellLogRftCurve::setRftAddress( RifEclipseRftAddress address ) { - m_timeStep = address.timeStep(); - m_wellName = address.wellName(); + m_timeStep = address.timeStep(); + m_wellName = address.wellName(); + m_wellLogChannelName = address.wellLogChannel(); if ( address.wellLogChannel() == RifEclipseRftAddress::RftWellLogChannelType::SEGMENT_VALUES ) { @@ -319,8 +321,7 @@ void RimWellLogRftCurve::setRftAddress( RifEclipseRftAddress address ) } else { - m_rftDataType = RftDataType::RFT_DATA; - m_wellLogChannelName = address.wellLogChannel(); + m_rftDataType = RftDataType::RFT_DATA; } } @@ -508,7 +509,7 @@ void RimWellLogRftCurve::onLoadDataAndUpdate( bool updateParentPlot ) if ( values.empty() || values.size() != tvDepthVector.size() ) { - this->detach(); + this->detach( true ); return; } @@ -676,6 +677,7 @@ void RimWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrder caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" ); curveDataGroup->add( &m_eclipseResultCase ); + curveDataGroup->add( &m_summaryCase ); curveDataGroup->add( &m_wellName ); curveDataGroup->add( &m_timeStep ); curveDataGroup->add( &m_rftDataType ); @@ -726,6 +728,11 @@ QList RimWellLogRftCurve::calculateValueOptions( const c options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) ); } + else if ( fieldNeedingOptions == &m_summaryCase ) + { + options = RiaSummaryTools::optionsForSummaryCases( RimProject::current()->allSummaryCases() ); + options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) ); + } else if ( fieldNeedingOptions == &m_wellName ) { options = RimRftTools::wellNameOptions( reader ); @@ -736,7 +743,10 @@ QList RimWellLogRftCurve::calculateValueOptions( const c } else if ( fieldNeedingOptions == &m_timeStep ) { - options = RimRftTools::timeStepOptions( reader, m_wellName, m_wellLogChannelName() ); + if ( m_rftDataType == RimWellLogRftCurve::RftDataType::RFT_SEGMENT_DATA ) + options = RimRftTools::segmentTimeStepOptions( reader, m_wellName ); + else + options = RimRftTools::timeStepOptions( reader, m_wellName, m_wellLogChannelName() ); } else if ( fieldNeedingOptions == &m_branchIndex ) { @@ -1104,6 +1114,12 @@ std::vector RimWellLogRftCurve::measuredDepthValues() segmentBranchId() ); reader->values( depthAddress, &values ); + + // Special handling of first segment + if ( values.size() > 2 && values.front() < 0.001 ) + { + values[0] = values[1]; + } } return values; } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp index 6e65a48e76..0fc0aa01c5 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.cpp @@ -89,6 +89,7 @@ #include "cafPdmFieldReorderCapability.h" #include "cafPdmFieldScriptingCapability.h" #include "cafPdmObjectScriptingCapability.h" +#include "cafPdmUiDoubleValueEditor.h" #include "cafPdmUiSliderEditor.h" #include "cafSelectionManager.h" @@ -191,7 +192,10 @@ RimWellLogTrack::RimWellLogTrack() reorderability->orderChanged.connect( this, &RimWellLogTrack::curveDataChanged ); CAF_PDM_InitField( &m_visiblePropertyValueRangeMin, "VisibleXRangeMin", RI_LOGPLOTTRACK_MINX_DEFAULT, "Min" ); + m_visiblePropertyValueRangeMin.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); CAF_PDM_InitField( &m_visiblePropertyValueRangeMax, "VisibleXRangeMax", RI_LOGPLOTTRACK_MAXX_DEFAULT, "Max" ); + m_visiblePropertyValueRangeMax.uiCapability()->setUiEditorTypeName( caf::PdmUiDoubleValueEditor::uiEditorTypeName() ); + CAF_PDM_InitField( &m_visibleDepthRangeMin, "VisibleYRangeMin", RI_LOGPLOTTRACK_MINX_DEFAULT, "Min" ); CAF_PDM_InitField( &m_visibleDepthRangeMax, "VisibleYRangeMax", RI_LOGPLOTTRACK_MAXX_DEFAULT, "Max" ); m_visibleDepthRangeMin.uiCapability()->setUiHidden( true ); @@ -203,6 +207,7 @@ RimWellLogTrack::RimWellLogTrack() m_isAutoScalePropertyValuesEnabled.uiCapability()->setUiHidden( true ); CAF_PDM_InitField( &m_isLogarithmicScaleEnabled, "LogarithmicScaleX", false, "Logarithmic Scale" ); + CAF_PDM_InitField( &m_invertPropertyValueAxis, "InvertPropertyValueAxis", false, "Invert Axis Range" ); CAF_PDM_InitFieldNoDefault( &m_propertyValueAxisGridVisibility, "ShowXGridLines", "Show Grid Lines" ); @@ -403,14 +408,11 @@ void RimWellLogTrack::calculatePropertyValueZoomRange() } else { - auto range = std::fabs( maxValue - minValue ); - maxValue += 0.1 * range; + double adjustmentFactor = 0.1; + auto [adjustedMin, adjustedMax] = extendMinMaxRange( minValue, maxValue, adjustmentFactor ); - auto candidateMinValue = minValue - 0.1 * range; - if ( std::signbit( minValue ) == std::signbit( candidateMinValue ) ) - { - minValue = candidateMinValue; - } + minValue = adjustedMin; + maxValue = adjustedMax; } m_availablePropertyValueRangeMin = minValue; @@ -465,8 +467,11 @@ void RimWellLogTrack::calculateDepthZoomRange() } } - m_availableDepthRangeMin = minDepth; - m_availableDepthRangeMax = maxDepth; + double adjustmentFactor = 0.02; + auto [adjustedMin, adjustedMax] = extendMinMaxRange( minDepth, maxDepth, adjustmentFactor ); + + m_availableDepthRangeMin = adjustedMin; + m_availableDepthRangeMax = adjustedMax; } //-------------------------------------------------------------------------------------------------- @@ -509,7 +514,18 @@ void RimWellLogTrack::updatePropertyValueZoom() componentRangeMax *= 1.5; } - m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), componentRangeMin, componentRangeMax ); + RimDepthTrackPlot* wellLogPlot; + this->firstAncestorOrThisOfTypeAsserted( wellLogPlot ); + + // Attribute components use the opposite axis to the property values + if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + { + m_plotWidget->setAxisRange( RiuPlotAxis::defaultBottom(), componentRangeMin, componentRangeMax ); + } + else if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL ) + { + m_plotWidget->setAxisRange( RiuPlotAxis::defaultRight(), componentRangeMin, componentRangeMax ); + } } //-------------------------------------------------------------------------------------------------- @@ -578,7 +594,8 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, } } else if ( changedField == &m_propertyValueAxisGridVisibility || changedField == &m_majorTickInterval || - changedField == &m_minorTickInterval || changedField == &m_minAndMaxTicksOnly ) + changedField == &m_minorTickInterval || changedField == &m_minAndMaxTicksOnly || + changedField == &m_invertPropertyValueAxis ) { updatePropertyValueAxisAndGridTickIntervals(); } @@ -796,6 +813,11 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() else { m_plotWidget->setAxisLabelsAndTicksEnabled( valueAxis(), true, true ); + + auto rangeBoundaryA = m_visiblePropertyValueRangeMin(); + auto rangeBoundaryB = m_visiblePropertyValueRangeMax(); + if ( m_invertPropertyValueAxis() ) std::swap( rangeBoundaryA, rangeBoundaryB ); + if ( m_minAndMaxTicksOnly ) { auto roundToDigits = []( double value, int numberOfDigits, bool useFloor ) { @@ -813,16 +835,16 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() return std::ceil( value * factor ) / factor; }; - auto div = QwtScaleDiv( m_visiblePropertyValueRangeMin(), m_visiblePropertyValueRangeMax() ); + auto div = QwtScaleDiv( rangeBoundaryA, rangeBoundaryB ); QList majorTicks; - auto min = roundToDigits( m_visiblePropertyValueRangeMin(), 2, false ); - auto max = roundToDigits( m_visiblePropertyValueRangeMax(), 2, true ); + auto min = roundToDigits( rangeBoundaryA, 2, false ); + auto max = roundToDigits( rangeBoundaryB, 2, true ); if ( min == max ) { - min = roundToDigits( m_visiblePropertyValueRangeMin(), 3, false ); - max = roundToDigits( m_visiblePropertyValueRangeMax(), 3, true ); + min = roundToDigits( rangeBoundaryA, 3, false ); + max = roundToDigits( rangeBoundaryB, 3, true ); } majorTicks.push_back( min ); @@ -846,15 +868,15 @@ void RimWellLogTrack::updatePropertyValueAxisAndGridTickIntervals() m_plotWidget->setMajorAndMinorTickIntervals( valueAxis(), m_majorTickInterval(), m_minorTickInterval(), - m_visiblePropertyValueRangeMin(), - m_visiblePropertyValueRangeMax() ); + rangeBoundaryA, + rangeBoundaryB ); } else { int majorTickIntervals = 5; int minorTickIntervals = 10; m_plotWidget->setAutoTickIntervalCounts( valueAxis(), majorTickIntervals, minorTickIntervals ); - m_plotWidget->setAxisRange( valueAxis(), m_visiblePropertyValueRangeMin, m_visiblePropertyValueRangeMax ); + m_plotWidget->setAxisRange( valueAxis(), rangeBoundaryA, rangeBoundaryB ); } m_plotWidget->enableGridLines( valueAxis(), @@ -986,13 +1008,10 @@ QString RimWellLogTrack::asciiDataForPlotExport() const const std::vector& allDepths = curveMerger.allXValues(); curveDepths = allDepths; - for ( size_t depthIdx = 0; depthIdx < allDepths.size(); depthIdx++ ) + for ( size_t curveIdx = 0; curveIdx < curveMerger.curveCount(); ++curveIdx ) { - for ( size_t curveIdx = 0; curveIdx < curveMerger.curveCount(); ++curveIdx ) - { - const std::vector& curveValues = curveMerger.lookupYValuesForAllXValues( curveIdx ); - curvesPlotXValues.push_back( curveValues ); - } + const std::vector& curveValues = curveMerger.lookupYValuesForAllXValues( curveIdx ); + curvesPlotXValues.push_back( curveValues ); } } @@ -2098,6 +2117,27 @@ std::pair RimWellLogTrack::adjustXRange( double minValue, double return std::make_pair( adjustedMin, adjustedMax ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::pair RimWellLogTrack::extendMinMaxRange( double minValue, double maxValue, double factor ) +{ + auto modifiedMin = minValue; + auto modifiedMax = maxValue; + + auto range = std::fabs( maxValue - minValue ); + modifiedMax += factor * range; + + auto candidateMinValue = minValue - factor * range; + if ( std::signbit( minValue ) == std::signbit( candidateMinValue ) ) + { + // Leave minimum unchanged if the changes causes change of sign to make sure that zero is located properly + modifiedMin = candidateMinValue; + } + + return { modifiedMin, modifiedMax }; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -2349,6 +2389,7 @@ void RimWellLogTrack::uiOrderingForXAxisSettings( caf::PdmUiOrdering& uiOrdering gridGroup->add( &m_isLogarithmicScaleEnabled ); gridGroup->add( &m_visiblePropertyValueRangeMin ); gridGroup->add( &m_visiblePropertyValueRangeMax ); + gridGroup->add( &m_invertPropertyValueAxis ); gridGroup->add( &m_propertyValueAxisGridVisibility ); gridGroup->add( &m_minAndMaxTicksOnly ); diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h index 00496431df..5b23753ce0 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogTrack.h @@ -298,6 +298,8 @@ class RimWellLogTrack : public RimPlot std::pair adjustXRange( double minValue, double maxValue, double tickInterval ); + std::pair extendMinMaxRange( double minValue, double maxValue, double factor ); + void updateWellPathAttributesCollection(); RimDepthTrackPlot* parentWellLogPlot() const; @@ -324,6 +326,7 @@ class RimWellLogTrack : public RimPlot caf::PdmField m_isAutoScalePropertyValuesEnabled; caf::PdmField m_isLogarithmicScaleEnabled; + caf::PdmField m_invertPropertyValueAxis; caf::PdmField m_propertyValueAxisGridVisibility; caf::PdmField m_explicitTickIntervals; @@ -373,5 +376,4 @@ class RimWellLogTrack : public RimPlot double m_availablePropertyValueRangeMax; double m_availableDepthRangeMin; double m_availableDepthRangeMax; - }; From e7ff6f8a7bceead8a2a202cb81f681173c17cf00 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 17 Jun 2022 14:08:39 +0200 Subject: [PATCH 389/406] Janitor: remove empty implementation of updateFilePathsFromProjectPath. --- .../Completions/RimFractureTemplateCollection.cpp | 6 ------ .../Completions/RimStimPlanFractureTemplate.cpp | 10 ---------- .../Completions/RimStimPlanFractureTemplate.h | 2 -- 3 files changed, 18 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp index d607ef8463..6d87884fcb 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp @@ -299,12 +299,6 @@ void RimFractureTemplateCollection::updateFilePathsFromProjectPath( const QStrin { for ( RimFractureTemplate* f : m_fractureDefinitions() ) { - RimStimPlanFractureTemplate* stimPlanFracture = dynamic_cast( f ); - if ( stimPlanFracture ) - { - stimPlanFracture->updateFilePathsFromProjectPath( newProjectPath, oldProjectPath ); - } - RimEllipseFractureTemplate* ellipseFracture = dynamic_cast( f ); if ( ellipseFracture ) { diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index b4e09a4505..01bb2c6688 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -192,16 +192,6 @@ QString RimStimPlanFractureTemplate::fileName() return m_stimPlanFileName().path(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimStimPlanFractureTemplate::updateFilePathsFromProjectPath( const QString& newProjectPath, - const QString& oldProjectPath ) -{ - // m_stimPlanFileName = RimTools::relocateFile( m_stimPlanFileName(), newProjectPath, oldProjectPath, nullptr, - // nullptr ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h index de63748684..4c2dd0c085 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h @@ -61,8 +61,6 @@ class RimStimPlanFractureTemplate : public RimFractureTemplate void setFileName( const QString& fileName ); QString fileName(); - void updateFilePathsFromProjectPath( const QString& newProjectPath, const QString& oldProjectPath ); - std::pair wellPathDepthAtFractureRange() const override; QString wellPathDepthAtFractureUiName() const override; From b4e3586e2cec63c4ca573f72d2143bc61c3b3024 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Fri, 17 Jun 2022 14:10:20 +0200 Subject: [PATCH 390/406] Janitor: StimPlanFractureTemplate: Remove use of obsolete field. Might turn on mesh display for some StimPlan fractures in projects older than v2018.1.0.103. The "show mesh" has been controlled by RimStimPlanColors since 2018. --- .../RimFractureTemplateCollection.cpp | 111 ------------------ .../RimStimPlanFractureTemplate.cpp | 9 +- .../Completions/RimStimPlanFractureTemplate.h | 2 - 3 files changed, 1 insertion(+), 121 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp index 6d87884fcb..ab2084eea7 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimFractureTemplateCollection.cpp @@ -22,7 +22,6 @@ #include "RigStatisticsMath.h" -#include "RigEclipseCaseData.h" #include "RimCase.h" #include "RimEclipseCase.h" #include "RimEclipseView.h" @@ -30,21 +29,11 @@ #include "RimFracture.h" #include "RimFractureTemplate.h" #include "RimProject.h" -#include "RimSimWellInViewCollection.h" -#include "RimStimPlanColors.h" #include "RimStimPlanFractureTemplate.h" -#include "RimTools.h" -#include "RimWellPath.h" -#include "RimWellPathCollection.h" -#include "RimWellPathFracture.h" -#include "RimWellPathFractureCollection.h" -#include "cafPdmFieldScriptingCapability.h" #include "cafPdmObject.h" #include "cafPdmObjectScriptingCapability.h" -#include - CAF_PDM_SOURCE_INIT( RimFractureTemplateCollection, "FractureTemplateCollection", "FractureDefinitionCollection" ); //-------------------------------------------------------------------------------------------------- @@ -317,106 +306,6 @@ void RimFractureTemplateCollection::initAfterRead() { if ( templ->id() < 0 ) templ->setId( nextFractureTemplateId() ); } - - RimProject* proj = nullptr; - this->firstAncestorOrThisOfType( proj ); - if ( proj && proj->isProjectFileVersionEqualOrOlderThan( "2018.1.0.103" ) ) - { - bool setAllShowMeshToFalseOnAllEclipseViews = false; - - std::vector wellPathFractures; - RimWellPathCollection* wellPathCollection = RimTools::wellPathCollection(); - wellPathCollection->descendantsIncludingThisOfType( wellPathFractures ); - - for ( RimWellPathFracture* fracture : wellPathFractures ) - { - RimStimPlanFractureTemplate* stimPlanFractureTemplate = - dynamic_cast( fracture->fractureTemplate() ); - if ( stimPlanFractureTemplate ) - { - if ( stimPlanFractureTemplate->showStimPlanMesh() == false ) - { - setAllShowMeshToFalseOnAllEclipseViews = true; - break; - } - } - } - - std::vector eclipseViews; - - std::vector rimCases; - proj->allCases( rimCases ); - - for ( RimCase* rimCase : rimCases ) - { - for ( Rim3dView* view : rimCase->views() ) - { - RimEclipseView* eclView = dynamic_cast( view ); - if ( eclView ) - { - eclipseViews.push_back( eclView ); - } - } - } - - for ( RimEclipseView* eclipseView : eclipseViews ) - { - if ( setAllShowMeshToFalseOnAllEclipseViews ) - { - eclipseView->fractureColors()->setShowStimPlanMesh( false ); - continue; - } - - // Find all fractures in all simWells - std::map stimPlanFractureTemplatesInView; - - std::vector fractures; - if ( eclipseView->wellCollection() ) - { - eclipseView->wellCollection()->descendantsIncludingThisOfType( fractures ); - } - if ( fractures.empty() ) continue; - - for ( RimFracture* fracture : fractures ) - { - RimStimPlanFractureTemplate* stimPlanFractureTemplate = - dynamic_cast( fracture->fractureTemplate() ); - if ( stimPlanFractureTemplate ) - { - stimPlanFractureTemplatesInView[stimPlanFractureTemplate]; - } - } - - if ( stimPlanFractureTemplatesInView.empty() ) continue; - - auto templateIt = stimPlanFractureTemplatesInView.begin(); - - if ( stimPlanFractureTemplatesInView.size() == 1 ) - { - eclipseView->fractureColors()->setShowStimPlanMesh( templateIt->first->showStimPlanMesh() ); - } - else - { - bool anySetShowStimPlanMeshIsSetToFalse = false; - for ( ; templateIt != stimPlanFractureTemplatesInView.end(); templateIt++ ) - { - if ( templateIt->first->showStimPlanMesh() == false ) - { - anySetShowStimPlanMeshIsSetToFalse = true; - break; - } - } - if ( anySetShowStimPlanMeshIsSetToFalse ) - { - eclipseView->fractureColors()->setShowStimPlanMesh( false ); - } - else - { - eclipseView->fractureColors()->setShowStimPlanMesh( true ); - } - } - } - } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp index 01bb2c6688..bca9c76949 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.cpp @@ -99,6 +99,7 @@ RimStimPlanFractureTemplate::RimStimPlanFractureTemplate() CAF_PDM_InitField( &m_showStimPlanMesh_OBSOLETE, "ShowStimPlanMesh", true, "" ); m_showStimPlanMesh_OBSOLETE.uiCapability()->setUiHidden( true ); + m_showStimPlanMesh_OBSOLETE.xmlCapability()->setIOWritable( false ); m_readError = false; @@ -782,14 +783,6 @@ QString RimStimPlanFractureTemplate::mapUiResultNameToFileResultName( const QStr return fileResultName; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimStimPlanFractureTemplate::showStimPlanMesh() const -{ - return m_showStimPlanMesh_OBSOLETE(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h index 4c2dd0c085..f1290b2e62 100644 --- a/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h +++ b/ApplicationLibCode/ProjectDataModel/Completions/RimStimPlanFractureTemplate.h @@ -95,8 +95,6 @@ class RimStimPlanFractureTemplate : public RimFractureTemplate QString mapUiResultNameToFileResultName( const QString& uiResultName ) const; - bool showStimPlanMesh() const; - void convertToUnitSystem( RiaDefines::EclipseUnitSystem neededUnit ) override; double formationDip() const; From 8aaf98823a5a52bb1383226d18ff95a89cf1392b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 21 Jun 2022 14:40:54 +0200 Subject: [PATCH 391/406] Regression test fixes (#9068) * Make sure font size is updated correctly * Hide empty sub titles * Do not categorize as water cut if no curves are visible * Propagate settings from single summary plot to summary multi plot --- .../RicSummaryPlotBuilder.cpp | 38 +++++++++++++++++++ .../RicSummaryPlotBuilder.h | 1 + .../RimMainPlotCollection.cpp | 2 +- .../Summary/RimSummaryMultiPlot.cpp | 22 +++++------ .../Summary/RimSummaryMultiPlot.h | 8 ++-- .../Summary/RimSummaryPlot.cpp | 4 +- .../UserInterface/RiuAbstractLegendFrame.cpp | 33 +++++++++------- .../RiuAbstractOverlayContentFrame.cpp | 26 +++++++++++-- .../RiuAbstractOverlayContentFrame.h | 6 +++ .../UserInterface/RiuSummaryMultiPlotPage.cpp | 3 +- .../UserInterface/RiuTextContentFrame.cpp | 18 +-------- 11 files changed, 110 insertions(+), 51 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 089559870e..25bceebd5b 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -468,6 +468,44 @@ RimSummaryMultiPlot* return summaryMultiPlot; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlotNoAutoSettings( RimSummaryPlot* plot ) +{ + RimProject* project = RimProject::current(); + auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); + + auto* summaryMultiPlot = new RimSummaryMultiPlot(); + summaryMultiPlot->setColumnCount( RiaDefines::ColumnCount::COLUMNS_1 ); + summaryMultiPlot->setRowCount( RiaDefines::RowCount::ROWS_1 ); + summaryMultiPlot->setAsPlotMdiWindow(); + + if ( !plot->autoPlotTitle() ) + { + // Move settings from the single summary plot to the multi plot, and disable auto titles + summaryMultiPlot->setAutoPlotTitle( false ); + summaryMultiPlot->setAutoSubPlotTitle( false ); + summaryMultiPlot->setMultiPlotTitleVisible( true ); + summaryMultiPlot->setMultiPlotTitle( plot->description() ); + + plot->setPlotTitleVisible( false ); + plot->setDescription( "" ); + } + + plotCollection->addSummaryMultiPlot( summaryMultiPlot ); + + appendPlotsToSummaryMultiPlot( summaryMultiPlot, { plot } ); + + plotCollection->updateAllRequiredEditors(); + summaryMultiPlot->loadDataAndUpdate(); + summaryMultiPlot->updateAllRequiredEditors(); + + RiuPlotMainWindowTools::selectAsCurrentItem( plot ); + + return summaryMultiPlot; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h index 1793428cfe..b4c7d36ea6 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h @@ -79,6 +79,7 @@ class RicSummaryPlotBuilder createAndAppendDefaultSummaryMultiPlot( const std::vector& cases, const std::vector& ensembles ); + static RimSummaryMultiPlot* createAndAppendSingleSummaryMultiPlotNoAutoSettings( RimSummaryPlot* plot ); static RimSummaryMultiPlot* createAndAppendSingleSummaryMultiPlot( RimSummaryPlot* plot ); static RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vector& plots ); static RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vector& objects ); diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp index 12d4e442c1..9f6e42d5c4 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp @@ -169,7 +169,7 @@ void RimMainPlotCollection::initAfterRead() { m_summaryPlotCollection_OBSOLETE()->removePlot( singlePlot ); - RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlot( singlePlot ); + RicSummaryPlotBuilder::createAndAppendSingleSummaryMultiPlotNoAutoSettings( singlePlot ); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 26e5d32108..0354314946 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -109,8 +109,8 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() CAF_PDM_InitObject( "Multi Summary Plot", ":/SummaryPlotLight16x16.png" ); this->setDeletable( true ); - CAF_PDM_InitField( &m_autoPlotTitles, "AutoPlotTitles", true, "Auto Plot Titles" ); - CAF_PDM_InitField( &m_autoPlotTitlesOnSubPlots, "AutoPlotTitlesSubPlots", true, "Auto Plot Titles Sub Plots" ); + CAF_PDM_InitField( &m_autoPlotTitle, "AutoPlotTitle", true, "Auto Plot Title" ); + CAF_PDM_InitField( &m_autoSubPlotTitle, "AutoSubPlotTitle", true, "Auto Sub Plot Title" ); CAF_PDM_InitField( &m_createPlotDuplicate, "DuplicatePlot", false, "", "", "Duplicate Plot" ); m_createPlotDuplicate.xmlCapability()->disableIO(); @@ -396,14 +396,14 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde auto titlesGroup = uiOrdering.addNewGroup( "Main Plot Settings" ); titlesGroup->setCollapsedByDefault( true ); - titlesGroup->add( &m_autoPlotTitles ); + titlesGroup->add( &m_autoPlotTitle ); titlesGroup->add( &m_showPlotWindowTitle ); titlesGroup->add( &m_plotWindowTitle ); titlesGroup->add( &m_titleFontSize ); auto subPlotSettingsGroup = uiOrdering.addNewGroup( "Sub Plot Settings" ); subPlotSettingsGroup->setCollapsedByDefault( true ); - subPlotSettingsGroup->add( &m_autoPlotTitlesOnSubPlots ); + subPlotSettingsGroup->add( &m_autoSubPlotTitle ); subPlotSettingsGroup->add( &m_showIndividualPlotTitles ); subPlotSettingsGroup->add( &m_subTitleFontSize ); @@ -423,7 +423,7 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi const QVariant& oldValue, const QVariant& newValue ) { - if ( changedField == &m_autoPlotTitles || changedField == &m_autoPlotTitlesOnSubPlots ) + if ( changedField == &m_autoPlotTitle || changedField == &m_autoSubPlotTitle ) { onLoadDataAndUpdate(); updateLayout(); @@ -501,7 +501,7 @@ void RimSummaryMultiPlot::defineEditorAttribute( const caf::PdmFieldHandle* fiel //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::updatePlotWindowTitle() { - if ( m_autoPlotTitles ) + if ( m_autoPlotTitle ) { populateNameHelper( m_nameHelper.get() ); @@ -525,7 +525,7 @@ void RimSummaryMultiPlot::updatePlotWindowTitle() setMultiPlotTitle( title ); } - if ( m_autoPlotTitlesOnSubPlots ) + if ( m_autoSubPlotTitle ) { for ( auto plot : summaryPlots() ) { @@ -556,17 +556,17 @@ const RimSummaryNameHelper* RimSummaryMultiPlot::nameHelper() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::setAutoTitlePlot( bool enable ) +void RimSummaryMultiPlot::setAutoPlotTitle( bool enable ) { - m_autoPlotTitles = enable; + m_autoPlotTitle = enable; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimSummaryMultiPlot::setAutoTitleGraphs( bool enable ) +void RimSummaryMultiPlot::setAutoSubPlotTitle( bool enable ) { - m_autoPlotTitlesOnSubPlots = enable; + m_autoSubPlotTitle = enable; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index e1aa88d5c1..d4456d096a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -65,8 +65,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void setLayoutInfo( RimSummaryPlot* summaryPlot, int row, int col ); void clearLayoutInfo(); - void setAutoTitlePlot( bool enable ); - void setAutoTitleGraphs( bool enable ); + void setAutoPlotTitle( bool enable ); + void setAutoSubPlotTitle( bool enable ); std::vector availableAxes() const override; std::vector curvesForStepping( RimSummaryDataSourceStepping::Axis axis ) const override; @@ -145,8 +145,8 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot ); private: - caf::PdmField m_autoPlotTitles; - caf::PdmField m_autoPlotTitlesOnSubPlots; + caf::PdmField m_autoPlotTitle; + caf::PdmField m_autoSubPlotTitle; caf::PdmField m_disableWheelZoom; caf::PdmField m_createPlotDuplicate; caf::PdmField m_linkSubPlotAxes; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index e1b5110ac6..c881c8df53 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -938,8 +938,10 @@ void RimSummaryPlot::updateZoomForAxis( RiuPlotAxis plotAxis ) //-------------------------------------------------------------------------------------------------- bool RimSummaryPlot::isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis ) { + auto curves = visibleSummaryCurvesForAxis( plotAxis ); + if ( curves.empty() ) return false; + size_t waterCutCurveCount = 0; - auto curves = visibleSummaryCurvesForAxis( plotAxis ); for ( auto c : curves ) { auto quantityName = c->summaryAddressY().vectorName(); diff --git a/ApplicationLibCode/UserInterface/RiuAbstractLegendFrame.cpp b/ApplicationLibCode/UserInterface/RiuAbstractLegendFrame.cpp index b0673687c1..edab0cb3fe 100644 --- a/ApplicationLibCode/UserInterface/RiuAbstractLegendFrame.cpp +++ b/ApplicationLibCode/UserInterface/RiuAbstractLegendFrame.cpp @@ -37,6 +37,7 @@ RiuAbstractLegendFrame::RiuAbstractLegendFrame( QWidget* parent, const QString& , m_title( title ) { setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum ); + updateFontSize(); } //-------------------------------------------------------------------------------------------------- @@ -69,7 +70,7 @@ QSize RiuAbstractLegendFrame::sizeHint() const preferredWidth = std::max( preferredWidth, titleWidth ); preferredWidth = std::min( preferredWidth, 200 ); - return QSize( preferredWidth, preferredHeight ); + return { preferredWidth, preferredHeight }; } //-------------------------------------------------------------------------------------------------- @@ -81,11 +82,21 @@ QSize RiuAbstractLegendFrame::minimumSizeHint() const layoutInfo( &layout ); QFontMetrics fontMetrics( this->font() ); - QRect titleRect = fontMetrics.boundingRect( QRect( 0, 0, 200, 200 ), Qt::AlignLeft | Qt::TextWordWrap, m_title ); - int preferredContentHeight = titleRect.height() + 2 * layout.lineSpacing + 1.0 * layout.lineSpacing; - int preferredHeight = preferredContentHeight + layout.margins.top() + layout.margins.bottom(); - int titleWidth = titleRect.width() + layout.margins.left() + layout.margins.right(); + int preferredHeight = 0; + int titleWidth = 0; + + QStringList tokens = m_title.split( "\n" ); + for ( const auto& s : tokens ) + { + QRect titleRect = fontMetrics.boundingRect( QRect( 0, 0, 200, 200 ), Qt::AlignLeft, s ); + int preferredContentHeight = titleRect.height() + 2 * layout.lineSpacing + 1.0 * layout.lineSpacing; + int candidateHeight = preferredContentHeight + layout.margins.top() + layout.margins.bottom(); + int candidateTitleWidth = titleRect.width() + layout.margins.left() + layout.margins.right(); + + preferredHeight = std::max( preferredHeight, candidateHeight ); + titleWidth = std::max( titleWidth, candidateTitleWidth ); + } int firstTextWidth = fontMetrics.boundingRect( label( 0 ) ).width(); int lastTextWidth = fontMetrics.boundingRect( label( labelCount() - 1 ) ).width(); @@ -97,7 +108,7 @@ QSize RiuAbstractLegendFrame::minimumSizeHint() const preferredWidth = std::max( preferredWidth, titleWidth ); preferredWidth = std::min( preferredWidth, 400 ); - return QSize( preferredWidth, preferredHeight ); + return { preferredWidth, preferredHeight }; } //-------------------------------------------------------------------------------------------------- @@ -105,9 +116,7 @@ QSize RiuAbstractLegendFrame::minimumSizeHint() const //-------------------------------------------------------------------------------------------------- void RiuAbstractLegendFrame::renderTo( QPainter* painter, const QRect& targetRect ) { - QFont font = this->font(); - font.setPixelSize( caf::FontTools::pointSizeToPixelSize( RiaPreferences::current()->defaultPlotFontSize() ) ); - this->setFont( font ); + updateFontSize(); QColor textColor = RiuGuiTheme::getColorByVariableName( "textColor" ); @@ -135,7 +144,7 @@ void RiuAbstractLegendFrame::renderTo( QPainter* painter, const QRect& targetRec } std::vector> visibleTickLabels = visibleLabels( layout ); - for ( auto tickLabel : visibleTickLabels ) + for ( const auto& tickLabel : visibleTickLabels ) { painter->save(); painter->translate( tickLabel.first.topLeft() ); @@ -154,8 +163,6 @@ void RiuAbstractLegendFrame::renderTo( QPainter* painter, const QRect& targetRec renderRect( painter, layout, i ); } painter->drawRect( layout.colorBarRect ); - // painter->drawLine( QPointF( layout.tickMidX, layout.tickYPixelPos->get( i ) ), - // QPointF( layout.tickMidX, layout.tickYPixelPos->get( i + 1 ) ) ); painter->restore(); } @@ -187,7 +194,7 @@ std::vector> RiuAbstractLegendFrame::visibleLabels( co QString valueString = label( i ); lastRect = rect; - visibleTickLabels.push_back( { rect, valueString } ); + visibleTickLabels.emplace_back( rect, valueString ); } return visibleTickLabels; } diff --git a/ApplicationLibCode/UserInterface/RiuAbstractOverlayContentFrame.cpp b/ApplicationLibCode/UserInterface/RiuAbstractOverlayContentFrame.cpp index 1f814c3eaa..2567f4ab1d 100644 --- a/ApplicationLibCode/UserInterface/RiuAbstractOverlayContentFrame.cpp +++ b/ApplicationLibCode/UserInterface/RiuAbstractOverlayContentFrame.cpp @@ -41,6 +41,16 @@ RiuAbstractOverlayContentFrame::~RiuAbstractOverlayContentFrame() { } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuAbstractOverlayContentFrame::updateFontSize() +{ + QFont font = this->font(); + font.setPixelSize( caf::FontTools::pointSizeToPixelSize( RiaPreferences::current()->defaultPlotFontSize() ) ); + this->setFont( font ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -52,9 +62,7 @@ RiuTextOverlayContentFrame::RiuTextOverlayContentFrame( QWidget* parent /*= null m_textLabel = new QLabel; layout->addWidget( m_textLabel ); - QFont font = m_textLabel->font(); - caf::FontTools::pointSizeToPixelSize( RiaPreferences::current()->defaultPlotFontSize() ); - m_textLabel->setFont( font ); + updateLabelFont(); } //-------------------------------------------------------------------------------------------------- @@ -70,6 +78,8 @@ void RiuTextOverlayContentFrame::setText( const QString& text ) //-------------------------------------------------------------------------------------------------- void RiuTextOverlayContentFrame::renderTo( QPainter* painter, const QRect& targetRect ) { + updateLabelFont(); + painter->save(); painter->translate( targetRect.topLeft() + QPoint( this->contentsMargins().left(), this->contentsMargins().top() ) ); painter->setFont( m_textLabel->font() ); @@ -81,3 +91,13 @@ void RiuTextOverlayContentFrame::renderTo( QPainter* painter, const QRect& targe painter->restore(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuTextOverlayContentFrame::updateLabelFont() +{ + QFont font = m_textLabel->font(); + font.setPixelSize( caf::FontTools::pointSizeToPixelSize( RiaPreferences::current()->defaultPlotFontSize() ) ); + m_textLabel->setFont( font ); +} diff --git a/ApplicationLibCode/UserInterface/RiuAbstractOverlayContentFrame.h b/ApplicationLibCode/UserInterface/RiuAbstractOverlayContentFrame.h index 6456440b92..b11b0899b5 100644 --- a/ApplicationLibCode/UserInterface/RiuAbstractOverlayContentFrame.h +++ b/ApplicationLibCode/UserInterface/RiuAbstractOverlayContentFrame.h @@ -31,6 +31,9 @@ class RiuAbstractOverlayContentFrame : public QFrame ~RiuAbstractOverlayContentFrame() override; virtual void renderTo( QPainter* painter, const QRect& targetRect ) = 0; + +protected: + void updateFontSize(); }; class RiuTextOverlayContentFrame : public RiuAbstractOverlayContentFrame @@ -42,6 +45,9 @@ class RiuTextOverlayContentFrame : public RiuAbstractOverlayContentFrame void setText( const QString& text ); void renderTo( QPainter* painter, const QRect& targetRect ) override; +private: + void updateLabelFont(); + private: QPointer m_textLabel; }; diff --git a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp index e3be26b1ce..72ff0aa121 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryMultiPlotPage.cpp @@ -103,7 +103,8 @@ void RiuSummaryMultiPlotPage::reinsertPlotWidgets() auto summaryPlot = dynamic_cast( plotWidget->plotDefinition() ); if ( summaryPlot ) m_summaryMultiPlot->setLayoutInfo( summaryPlot, row, col ); - subTitles[visibleIndex]->setVisible( m_showSubTitles ); + bool isSubTitleVisible = m_showSubTitles && !subTitles[visibleIndex]->text().isEmpty(); + subTitles[visibleIndex]->setVisible( isSubTitleVisible ); QFont subTitleFont = subTitles[visibleIndex]->font(); subTitleFont.setPixelSize( m_subTitleFontPixelSize ); subTitles[visibleIndex]->setFont( subTitleFont ); diff --git a/ApplicationLibCode/UserInterface/RiuTextContentFrame.cpp b/ApplicationLibCode/UserInterface/RiuTextContentFrame.cpp index 4e54368360..ce25ee32d8 100644 --- a/ApplicationLibCode/UserInterface/RiuTextContentFrame.cpp +++ b/ApplicationLibCode/UserInterface/RiuTextContentFrame.cpp @@ -31,8 +31,6 @@ #include -//#include - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -94,9 +92,7 @@ QSize RiuTextContentFrame::minimumSizeHint() const //-------------------------------------------------------------------------------------------------- void RiuTextContentFrame::renderTo( QPainter* painter, const QRect& targetRect ) { - QFont font = this->font(); - font.setPixelSize( caf::FontTools::pointSizeToPixelSize( RiaPreferences::current()->defaultPlotFontSize() ) ); - this->setFont( font ); + updateFontSize(); QColor textColor = RiuGuiTheme::getColorByVariableName( "textColor" ); @@ -128,18 +124,6 @@ void RiuTextContentFrame::renderTo( QPainter* painter, const QRect& targetRect ) painter->translate( QPoint( layout.margins.left(), layout.margins.top() + layout.lineSpacing * 2 ) ); painter->setPen( QPen( textColor ) ); - /* - QwtMathMLTextEngine textEngine = QwtMathMLTextEngine(); - textEngine.draw( painter, - QRect( targetRect.left() + layout.margins.left(), - targetRect.top() + layout.margins.top() + layout.lineSpacing * 2, - targetRect.width() - layout.margins.left() - layout.margins.right(), - targetRect.height() - layout.margins.top() - layout.margins.bottom() - - layout.margins.top() + layout.lineSpacing * 2 ), - Qt::AlignLeft, - m_text ); - - */ QTextDocument td; td.setDocumentMargin( 0.0 ); td.setDefaultFont( this->font() ); From 5078f4072fdc6af84a944a72d243cd402ee5d54f Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 21 Jun 2022 15:33:00 +0200 Subject: [PATCH 392/406] Minor adjustments (#9070) * Add system commands to test toolbar * #9069 Summary Plot: Update only Y axis values during source stepping * Reduce default brightness for ensemble summary curves * Add a separate flag to control linking of time axis * Make sure interactive zoom in plot is handled * Move message dock window to right dock panel --- .../Application/RiaPreferencesSystem.cpp | 8 +++ .../Application/RiaPreferencesSystem.h | 1 + .../CMakeLists_files.cmake | 2 + .../RicLaunchRegressionTestsFeature.cpp | 50 +++++++++++++- .../RicLaunchRegressionTestsFeature.h | 15 +++++ .../RicShowClassNamesFeature.cpp | 65 +++++++++++++++++++ .../RicShowClassNamesFeature.h | 35 ++++++++++ .../ProjectDataModel/RimMultiPlot.cpp | 9 +++ .../ProjectDataModel/RimMultiPlot.h | 1 + .../RimPlotAxisProperties.cpp | 24 +++++++ .../ProjectDataModel/RimPlotAxisProperties.h | 1 + .../RimPlotAxisPropertiesInterface.cpp | 25 ------- .../RimPlotAxisPropertiesInterface.h | 3 - .../Summary/RimSummaryMultiPlot.cpp | 53 +++++++++++++-- .../Summary/RimSummaryMultiPlot.h | 3 + .../Summary/RimSummaryPlot.cpp | 43 +++++++++++- .../ProjectDataModel/Summary/RimSummaryPlot.h | 2 + .../Summary/RimSummaryPlotSourceStepping.cpp | 2 +- .../Summary/RimSummaryTimeAxisProperties.cpp | 24 +++++++ .../Summary/RimSummaryTimeAxisProperties.h | 3 + .../UserInterface/RiuMainWindow.cpp | 17 ++--- .../UserInterface/RiuPlotMainWindow.cpp | 2 +- 22 files changed, 334 insertions(+), 54 deletions(-) create mode 100644 ApplicationLibCode/Commands/ApplicationCommands/RicShowClassNamesFeature.cpp create mode 100644 ApplicationLibCode/Commands/ApplicationCommands/RicShowClassNamesFeature.h diff --git a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp index 1565dc7967..b815dfec34 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSystem.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSystem.cpp @@ -101,6 +101,14 @@ RiaPreferencesSystem* RiaPreferencesSystem::current() return RiaApplication::instance()->preferences()->systemPreferences(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaPreferencesSystem::setAppendClassNameToUiText( bool enable ) +{ + m_appendClassNameToUiText = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferencesSystem.h b/ApplicationLibCode/Application/RiaPreferencesSystem.h index 6f1c3da0ef..7b2cb77f66 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSystem.h +++ b/ApplicationLibCode/Application/RiaPreferencesSystem.h @@ -42,6 +42,7 @@ class RiaPreferencesSystem : public caf::PdmObject static RiaPreferencesSystem* current(); + void setAppendClassNameToUiText( bool enable ); bool appendClassNameToUiText() const; bool appendFieldKeywordToToolTipText() const; bool showViewIdInProjectTree() const; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/ApplicationCommands/CMakeLists_files.cmake index 9242df0179..e2d3a74038 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/ApplicationCommands/CMakeLists_files.cmake @@ -19,6 +19,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicDefaultDockConfigGeoMechFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicExportObjectAndFieldKeywordsFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSaveProjectNoGlobalPathsFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicShowClassNamesFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -42,6 +43,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicDefaultDockConfigGeoMechFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicExportObjectAndFieldKeywordsFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSaveProjectNoGlobalPathsFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicShowClassNamesFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.cpp index 4a16a4407d..812bf6e0d8 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.cpp +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.cpp @@ -20,6 +20,8 @@ #include "RiaRegressionTestRunner.h" +#include "cafPdmUiPropertyViewDialog.h" + #include #include @@ -46,5 +48,51 @@ void RicLaunchRegressionTestsFeature::onActionTriggered( bool isChecked ) //-------------------------------------------------------------------------------------------------- void RicLaunchRegressionTestsFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText( "Launch Regression Tests" ); + actionToSetup->setText( "Regression Tests" ); +} + +CAF_CMD_SOURCE_INIT( RicLaunchRegressionTestDialogFeature, "RicLaunchRegressionTestDialogFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicLaunchRegressionTestDialogFeature::showRegressionTestDialog() +{ + RiaRegressionTest regTestConfig; + regTestConfig.readSettingsFromApplicationStore(); + + caf::PdmUiPropertyViewDialog regressionTestDialog( nullptr, ®TestConfig, "Regression Test", "" ); + regressionTestDialog.resize( QSize( 600, 350 ) ); + + if ( regressionTestDialog.exec() == QDialog::Accepted ) + { + // Write preferences using QSettings and apply them to the application + regTestConfig.writeSettingsToApplicationStore(); + + RiaRegressionTestRunner::instance()->executeRegressionTests(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicLaunchRegressionTestDialogFeature::isCommandEnabled() +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicLaunchRegressionTestDialogFeature::onActionTriggered( bool isChecked ) +{ + RicLaunchRegressionTestDialogFeature::showRegressionTestDialog(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicLaunchRegressionTestDialogFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Reg Test Dialog" ); } diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.h index 1662b590f8..d91b6675ee 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.h +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicLaunchRegressionTestsFeature.h @@ -32,3 +32,18 @@ class RicLaunchRegressionTestsFeature : public caf::CmdFeature void onActionTriggered( bool isChecked ) override; void setupActionLook( QAction* actionToSetup ) override; }; + +//================================================================================================== +/// +//================================================================================================== +class RicLaunchRegressionTestDialogFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + + static void showRegressionTestDialog(); + +private: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicShowClassNamesFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicShowClassNamesFeature.cpp new file mode 100644 index 0000000000..83e47b19d2 --- /dev/null +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicShowClassNamesFeature.cpp @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicShowClassNamesFeature.h" + +#include "RiaApplication.h" +#include "RiaGuiApplication.h" +#include "RiaPreferences.h" +#include "RiaPreferencesSystem.h" + +#include + +CAF_CMD_SOURCE_INIT( RicShowClassNamesFeature, "RicShowClassNamesFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicShowClassNamesFeature::isCommandEnabled() +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicShowClassNamesFeature::onActionTriggered( bool isChecked ) +{ + RiaPreferences::current()->systemPreferences()->setAppendClassNameToUiText( isChecked ); + + RiaGuiApplication::instance()->applyPreferences(); + RiaGuiApplication::instance()->applyGuiPreferences(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicShowClassNamesFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Class Names" ); + actionToSetup->setCheckable( true ); + actionToSetup->setChecked( isCommandChecked() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicShowClassNamesFeature::isCommandChecked() +{ + return RiaPreferences::current()->systemPreferences()->appendClassNameToUiText(); +} diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicShowClassNamesFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicShowClassNamesFeature.h new file mode 100644 index 0000000000..6584dad0a6 --- /dev/null +++ b/ApplicationLibCode/Commands/ApplicationCommands/RicShowClassNamesFeature.h @@ -0,0 +1,35 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicShowClassNamesFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; + bool isCommandChecked() override; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 03dadeba68..da433e2739 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -526,6 +526,15 @@ void RimMultiPlot::zoomAll() updateZoom(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimMultiPlot::zoomAllYAxes() +{ + setAutoScaleYEnabled( true ); + updateZoom(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 7de61dcb86..727c2e486a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -101,6 +101,7 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollectiondefaultPlotFontSize(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotAxisProperties::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) +{ + RimSummaryMultiPlot* summaryMultiPlot = nullptr; + firstAncestorOfType( summaryMultiPlot ); + + if ( summaryMultiPlot && summaryMultiPlot->isSubPlotAxesLinked() ) + { + auto* treeItemAttribute = dynamic_cast( attribute ); + if ( treeItemAttribute ) + { + treeItemAttribute->tags.clear(); + auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create(); + tag->icon = caf::IconProvider( ":/chain.png" ); + + treeItemAttribute->tags.push_back( std::move( tag ) ); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h index 8e997b231a..96a5f62b04 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisProperties.h @@ -133,6 +133,7 @@ class RimPlotAxisProperties : public RimPlotAxisPropertiesInterface void updateOptionSensitivity(); void updateOverriddenLabelAndReadOnlyState(); caf::FontTools::FontSize plotFontSize() const; + void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; private: caf::PdmField m_isActive; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp index 1db0647380..7172d61b09 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.cpp @@ -18,10 +18,7 @@ #include "RimPlotAxisPropertiesInterface.h" -#include "RimSummaryMultiPlot.h" - #include "cafAppEnum.h" -#include "cafPdmUiTreeAttributes.h" CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotAxisPropertiesInterface, "PlotAxisPropertiesInterface", @@ -120,25 +117,3 @@ bool RimPlotAxisPropertiesInterface::isAppearanceOverridden() const { return m_isAppearanceOverridden(); } - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimPlotAxisPropertiesInterface::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) -{ - RimSummaryMultiPlot* summaryMultiPlot = nullptr; - firstAncestorOfType( summaryMultiPlot ); - - if ( summaryMultiPlot && summaryMultiPlot->isSubPlotAxesLinked() ) - { - auto* treeItemAttribute = dynamic_cast( attribute ); - if ( treeItemAttribute ) - { - treeItemAttribute->tags.clear(); - auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create(); - tag->icon = caf::IconProvider( ":/chain.png" ); - - treeItemAttribute->tags.push_back( std::move( tag ) ); - } - } -} diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h index 1d73b3e533..9ec8bc4983 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotAxisPropertiesInterface.h @@ -90,9 +90,6 @@ class RimPlotAxisPropertiesInterface : public caf::PdmObject protected: bool isAppearanceOverridden() const; -private: - void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - private: caf::PdmField m_isAppearanceOverridden; }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 0354314946..885dae6ee1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -143,6 +143,7 @@ RimSummaryMultiPlot::RimSummaryMultiPlot() m_appendPrevCurve.uiCapability()->setUiIconFromResourceString( ":/AppendPrevCurve.png" ); CAF_PDM_InitField( &m_linkSubPlotAxes, "LinkSubPlotAxes", true, "Link Sub Plot Axes" ); + CAF_PDM_InitField( &m_linkTimeAxis, "LinkTimeAxis", true, "Link Time Axis" ); CAF_PDM_InitField( &m_autoAdjustAppearance, "AutoAdjustAppearance", true, "Auto Adjust Appearance" ); CAF_PDM_InitFieldNoDefault( &m_axisRangeAggregation, "AxisRangeAggregation", "Axis Range Control" ); @@ -381,6 +382,7 @@ void RimSummaryMultiPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrde auto axesGroup = uiOrdering.addNewGroup( "Axes" ); axesGroup->add( &m_axisRangeAggregation ); axesGroup->add( &m_linkSubPlotAxes ); + axesGroup->add( &m_linkTimeAxis ); axesGroup->add( &m_autoAdjustAppearance ); m_linkSubPlotAxes.uiCapability()->setUiReadOnly( m_autoAdjustAppearance() ); @@ -428,7 +430,16 @@ void RimSummaryMultiPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedFi onLoadDataAndUpdate(); updateLayout(); } - else if ( changedField == &m_linkSubPlotAxes || changedField == &m_axisRangeAggregation ) + else if ( changedField == &m_linkTimeAxis ) + { + auto plots = summaryPlots(); + if ( !plots.empty() ) + { + syncTimeAxisRanges( plots.front() ); + } + } + else if ( changedField == &m_linkSubPlotAxes || changedField == &m_axisRangeAggregation || + changedField == &m_linkTimeAxis ) { syncAxisRanges(); @@ -795,7 +806,7 @@ void RimSummaryMultiPlot::syncAxisRanges() } // Reset zoom to make sure the complete range for min/max is available - RimMultiPlot::zoomAll(); + RimMultiPlot::zoomAllYAxes(); if ( m_axisRangeAggregation() == AxisRangeAggregation::SUB_PLOTS ) { @@ -804,7 +815,7 @@ void RimSummaryMultiPlot::syncAxisRanges() // gather current min/max values for each category (axis label) for ( auto plot : summaryPlots() ) { - for ( auto axis : plot->plotAxes() ) + for ( auto axis : plot->plotYAxes() ) { double minVal = axis->visibleRangeMin(); double maxVal = axis->visibleRangeMax(); @@ -826,7 +837,7 @@ void RimSummaryMultiPlot::syncAxisRanges() // set all plots to use the global min/max values for each category for ( auto plot : summaryPlots() ) { - for ( auto axis : plot->plotAxes() ) + for ( auto axis : plot->plotYAxes() ) { auto [minVal, maxVal] = axisRanges[axis->plotAxisType()]; if ( axis->isAxisInverted() ) std::swap( minVal, maxVal ); @@ -844,6 +855,24 @@ void RimSummaryMultiPlot::syncAxisRanges() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::syncTimeAxisRanges( RimSummaryPlot* summaryPlot ) +{ + if ( m_linkTimeAxis ) + { + for ( auto plot : summaryPlots() ) + { + if ( plot != summaryPlot ) + { + plot->copyAxisPropertiesFromOther( RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM, *summaryPlot ); + plot->updateAll(); + } + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -975,7 +1004,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() { std::map> axisRanges; - for ( auto axis : plot->plotAxes() ) + for ( auto axis : plot->plotYAxes() ) { for ( auto curve : plot->summaryCurves() ) { @@ -1042,7 +1071,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange() } // set all plots to use the global min/max values for each category - for ( auto axis : plot->plotAxes() ) + for ( auto axis : plot->plotYAxes() ) { auto [minVal, maxVal] = axisRanges[axis->plotAxisType()]; if ( RiaDefines::isVertical( axis->plotAxisType().axis() ) && !std::isinf( minVal ) && !std::isinf( maxVal ) ) @@ -1170,7 +1199,7 @@ void RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings() else timeAxisProp->setMajorTickmarkCount( RimPlotAxisProperties::LegendTickmarkCount::TICKMARK_FEW ); - for ( RimPlotAxisPropertiesInterface* axisInterface : p->plotAxes() ) + for ( RimPlotAxisPropertiesInterface* axisInterface : p->plotYAxes() ) { auto axisProp = dynamic_cast( axisInterface ); @@ -1226,6 +1255,14 @@ bool RimSummaryMultiPlot::isSubPlotAxesLinked() const return m_linkSubPlotAxes(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimSummaryMultiPlot::isTimeAxisLinked() const +{ + return m_linkTimeAxis(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1251,6 +1288,8 @@ void RimSummaryMultiPlot::onSubPlotChanged( const caf::SignalEmitter* emitter ) //-------------------------------------------------------------------------------------------------- void RimSummaryMultiPlot::onSubPlotAxisChanged( const caf::SignalEmitter* emitter, RimSummaryPlot* summaryPlot ) { + syncTimeAxisRanges( summaryPlot ); + if ( !m_linkSubPlotAxes() ) { syncAxisRanges(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index d4456d096a..5871d3851e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -84,6 +84,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep std::vector fieldsToShowInToolbar() override; void syncAxisRanges(); + void syncTimeAxisRanges( RimSummaryPlot* summaryPlot ); void handleDroppedObjects( const std::vector& objects ); @@ -96,6 +97,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep void setSubPlotAxesLinked( bool enable ); bool isSubPlotAxesLinked() const; + bool isTimeAxisLinked() const; std::pair gridLayoutInfoForSubPlot( RimSummaryPlot* summaryPlot ) const; @@ -150,6 +152,7 @@ class RimSummaryMultiPlot : public RimMultiPlot, public RimSummaryDataSourceStep caf::PdmField m_disableWheelZoom; caf::PdmField m_createPlotDuplicate; caf::PdmField m_linkSubPlotAxes; + caf::PdmField m_linkTimeAxis; caf::PdmField m_autoAdjustAppearance; caf::PdmField m_hidePlotsWithValuesBelow; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index c881c8df53..437bd6c064 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -623,6 +623,22 @@ void RimSummaryPlot::copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSu } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::copyAxisPropertiesFromOther( RiaDefines::PlotAxis plotAxisType, const RimSummaryPlot& sourceSummaryPlot ) +{ + for ( auto ap : sourceSummaryPlot.plotAxes() ) + { + if ( ap->plotAxisType().axis() != plotAxisType ) continue; + + QString data = ap->writeObjectToXmlString(); + + axisPropertiesForPlotAxis( ap->plotAxisType() ) + ->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -769,15 +785,18 @@ void RimSummaryPlot::applyDefaultCurveAppearances() cvf::Color3f curveColor; if ( RiaPreferencesSummary::current()->colorCurvesByPhase() ) { - auto basePhaseColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( curveSet->summaryAddress() ); - - curveColor = RiaColorTools::blendCvfColors( basePhaseColor, cvf::Color3f::WHITE, 1, 3 ); + curveColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( curveSet->summaryAddress() ); } else { curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex++ ); } + int weightBaseColor = 10; + int weightWhite = 25; + + curveColor = RiaColorTools::blendCvfColors( curveColor, cvf::Color3f::WHITE, weightBaseColor, weightWhite ); + curveSet->setColor( curveColor ); } } @@ -1192,6 +1211,8 @@ void RimSummaryPlot::zoomAll() setAutoScaleXEnabled( true ); setAutoScaleYEnabled( true ); updateZoomInParentPlot(); + + axisChanged.send( this ); } //-------------------------------------------------------------------------------------------------- @@ -2282,6 +2303,8 @@ void RimSummaryPlot::onPlotZoomed() setAutoScaleXEnabled( false ); setAutoScaleYEnabled( false ); updateZoomFromParentPlot(); + + axisChanged.send( this ); } //-------------------------------------------------------------------------------------------------- @@ -2755,6 +2778,20 @@ std::vector RimSummaryPlot::plotAxes() const return axisProps; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimSummaryPlot::plotYAxes() const +{ + std::vector axisProps; + for ( const auto& ap : m_axisProperties ) + { + if ( RiaDefines::isVertical( ap->plotAxisType().axis() ) ) axisProps.push_back( ap ); + } + + return axisProps; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 76f573603e..0f8cf99a54 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -150,6 +150,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping void updateCurveNames(); void copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot ); + void copyAxisPropertiesFromOther( RiaDefines::PlotAxis plotAxisType, const RimSummaryPlot& sourceSummaryPlot ); void copyMatchingAxisPropertiesFromOther( const RimSummaryPlot& sourceSummaryPlot ); void updateAll(); @@ -196,6 +197,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping std::vector allCurves( RimSummaryDataSourceStepping::Axis axis ) const override; std::vector plotAxes() const; + std::vector plotYAxes() const; RimPlotAxisPropertiesInterface* axisPropertiesForPlotAxis( RiuPlotAxis plotAxis ) const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index c694b626a9..a9a6d4f0b1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -516,7 +516,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* { summaryMultiPlot->updatePlots(); summaryMultiPlot->updatePlotWindowTitle(); - summaryMultiPlot->zoomAll(); + summaryMultiPlot->zoomAllYAxes(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); mainPlotWindow->updateMultiPlotToolBar(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp index ebf55072c6..9c6525c699 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.cpp @@ -24,12 +24,14 @@ #include "RiaPreferences.h" #include "RiaQDateTimeTools.h" +#include "RimSummaryMultiPlot.h" #include "RimSummaryPlot.h" #include "cafPdmUiComboBoxEditor.h" #include "cafPdmUiDateEditor.h" #include "cafPdmUiLineEditor.h" #include "cafPdmUiTimeEditor.h" +#include "cafPdmUiTreeAttributes.h" #include "cvfAssert.h" @@ -163,6 +165,28 @@ caf::FontTools::FontSize RimSummaryTimeAxisProperties::plotFontSize() const return RiaPreferences::current()->defaultPlotFontSize(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryTimeAxisProperties::defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) +{ + RimSummaryMultiPlot* summaryMultiPlot = nullptr; + firstAncestorOfType( summaryMultiPlot ); + + if ( summaryMultiPlot && summaryMultiPlot->isTimeAxisLinked() ) + { + auto* treeItemAttribute = dynamic_cast( attribute ); + if ( treeItemAttribute ) + { + treeItemAttribute->tags.clear(); + auto tag = caf::PdmUiTreeViewItemAttribute::Tag::create(); + tag->icon = caf::IconProvider( ":/chain.png" ); + + treeItemAttribute->tags.push_back( std::move( tag ) ); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h index a7c38f65d5..41e908a922 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTimeAxisProperties.h @@ -125,6 +125,9 @@ class RimSummaryTimeAxisProperties : public RimPlotAxisPropertiesInterface void updateDateVisibleRange(); caf::FontTools::FontSize plotFontSize() const; +private: + void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; + private: caf::PdmField> m_timeMode; caf::PdmField> m_timeUnit; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index a32d7acc07..aeba59f0c8 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -74,6 +74,7 @@ #include "cafSelectionManager.h" #include "cafUtils.h" +#include "ApplicationCommands/RicLaunchRegressionTestsFeature.h" #include "ExportCommands/RicSnapshotAllViewsToFileFeature.h" #include "MeasurementCommands/RicToggleMeasurementModeFeature.h" #include "SummaryPlotCommands/RicEditSummaryPlotFeature.h" @@ -707,6 +708,8 @@ void RiuMainWindow::createToolBars() toolbar->setObjectName( toolbar->windowTitle() ); toolbar->addAction( cmdFeatureMgr->action( "RicLaunchUnitTestsFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicLaunchRegressionTestsFeature" ) ); + toolbar->addAction( cmdFeatureMgr->action( "RicLaunchRegressionTestDialogFeature" ) ); + toolbar->addAction( cmdFeatureMgr->action( "RicShowClassNamesFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicRunCommandFileFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicExecuteLastUsedScriptFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicExportCompletionsForVisibleWellPathsFeature" ) ); @@ -1944,19 +1947,7 @@ void RiuMainWindow::slotCreateCommandObject() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::slotShowRegressionTestDialog() { - RiaRegressionTest regTestConfig; - regTestConfig.readSettingsFromApplicationStore(); - - caf::PdmUiPropertyViewDialog regressionTestDialog( this, ®TestConfig, "Regression Test", "" ); - regressionTestDialog.resize( QSize( 600, 350 ) ); - - if ( regressionTestDialog.exec() == QDialog::Accepted ) - { - // Write preferences using QSettings and apply them to the application - regTestConfig.writeSettingsToApplicationStore(); - - RiaRegressionTestRunner::instance()->executeRegressionTests(); - } + RicLaunchRegressionTestDialogFeature::showRegressionTestDialog(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index adcd5f29ef..77f3473fe6 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -551,7 +551,7 @@ void RiuPlotMainWindow::createDockPanels() dockWidget->setObjectName( RiuDockWidgetTools::plotMainWindowMessagesName() ); m_messagePanel = new RiuMessagePanel( dockWidget ); dockWidget->setWidget( m_messagePanel ); - addDockWidget( Qt::BottomDockWidgetArea, dockWidget ); + splitDockWidget( rightTabbedWidgets.front(), dockWidget, Qt::Vertical ); dockWidget->hide(); } From b706192ea39dce8e36a1384fec1b4fa062259add Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 24 Jun 2022 16:16:46 +0200 Subject: [PATCH 393/406] Performance updates (#9082) * Avoid creation of curve legend widgets during construction of a multi plot * Make sure default z-value is correct to avoid expensive Qwt updates * Avoid duplicate plot updates * Do not create internal Qwt legend by default * RFT import: Avoid expensive method throwing exception if no data is found --- .../RiaPlotWindowRedrawScheduler.cpp | 8 ++- ...RicAppendSummaryPlotsForObjectsFeature.cpp | 3 +- .../FileInterface/RifReaderOpmRft.cpp | 7 +- .../ProjectDataModel/RimMultiPlot.cpp | 9 +++ .../ProjectDataModel/RimPlot.cpp | 2 +- .../ProjectDataModel/RimPlotCurve.cpp | 19 ++++- .../ProjectDataModel/RimPlotCurve.h | 2 + .../Summary/RimEnsembleCurveSet.cpp | 16 ++--- .../Summary/RimEnsembleCurveSet.h | 2 +- .../Summary/RimEnsembleCurveSetCollection.cpp | 2 +- .../Summary/RimSummaryCurve.cpp | 70 +++++++++++-------- .../Summary/RimSummaryCurve.h | 5 +- .../Summary/RimSummaryPlot.cpp | 50 ++++++++----- .../ProjectDataModel/Summary/RimSummaryPlot.h | 1 + .../UserInterface/RiuMultiPlotBook.cpp | 2 +- .../UserInterface/RiuSummaryQwtPlot.cpp | 4 +- 16 files changed, 133 insertions(+), 69 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp index a26d6080cc..f0d1f65c2f 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp @@ -107,12 +107,10 @@ void RiaPlotWindowRedrawScheduler::clearAllScheduledUpdates() void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() { std::map, RiaDefines::MultiPlotPageUpdateType> plotBooksToUpdate; - std::set> plotWidgetsToReplot; std::map, RiaDefines::MultiPlotPageUpdateType> pagesToUpdate; pagesToUpdate.swap( m_plotPagesToUpdate ); plotBooksToUpdate.swap( m_plotBooksToUpdate ); - plotWidgetsToReplot.swap( m_plotWidgetsToReplot ); for ( auto& [plotBook, updateType] : plotBooksToUpdate ) { @@ -135,6 +133,12 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdatesAndReplots() page->performUpdate( updateType ); } + // PERFORMANCE NOTE + // As the book and page updates can trigger widget updates, make sure to get the list of widgets to replot after + // these updates + std::set> plotWidgetsToReplot; + plotWidgetsToReplot.swap( m_plotWidgetsToReplot ); + for ( const QPointer& plot : plotWidgetsToReplot ) { if ( !plot.isNull() ) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index ff458695d7..f918369bf8 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -95,12 +95,11 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* s summaryMultiPlot->addPlot( duplicatedPlot ); duplicatedPlot->resolveReferencesRecursively(); + duplicatedPlot->loadDataAndUpdate(); } } info.incrementProgress(); } - - summaryMultiPlot->loadDataAndUpdate(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp index a8fae6a2f1..ad1dabf252 100644 --- a/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp +++ b/ApplicationLibCode/FileInterface/RifReaderOpmRft.cpp @@ -520,9 +520,14 @@ void RifReaderOpmRft::buildSegmentBranchTypes( const RftSegmentKey& segmentKey ) std::vector RifReaderOpmRft::importWellData( const std::string& wellName, const std::string& propertyName, const RftDate& date ) const { + // PERFORMANCE NOTE + // Use method hasRft() that do not throw exception if RFT data is not available. Using this method and avoid + // try/catch and exceptions is way faster. + if ( !m_opm_rft->hasRft( wellName, date ) ) return {}; + try { - // THe hasArray method can throw, so we must use a try/catch block here + // The hasArray method can throw, so we must use a try/catch block here if ( m_opm_rft->hasArray( propertyName, wellName, date ) ) { return m_opm_rft->getRft( propertyName, wellName, date ); diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index da433e2739..aac63f88a2 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -797,12 +797,21 @@ QList RimMultiPlot::calculateValueOptions( const caf::Pd //-------------------------------------------------------------------------------------------------- void RimMultiPlot::onLoadDataAndUpdate() { + // PERFORMANCE NOTE + // Creation and update of the legend widgets is expensive. Disable display of legends during construction of the + // multi plot and creation of widgets. The legends will be made visible due to redraw operations always scheduled + // after this method. + bool originalShowState = m_showPlotLegends(); + m_showPlotLegends = false; + updateMdiWindowVisibility(); updatePlotWindowTitle(); applyPlotWindowTitleToWidgets(); updatePlots(); updateLayout(); RiuPlotMainWindowTools::refreshToolbars(); + + m_showPlotLegends = originalShowState; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index 8960498f63..02d557d66c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -76,7 +76,7 @@ QWidget* RimPlot::createViewWidget( QWidget* parent /*= nullptr */ ) RiuPlotWidget* plotWidget = doCreatePlotViewWidget( parent ); updateWindowVisibility(); - plotWidget->scheduleReplot(); + if ( showWindow() ) plotWidget->scheduleReplot(); return plotWidget; } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index f5108e91c3..c3ac4a6de9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -718,6 +718,14 @@ void RimPlotCurve::setSamplesFromTimeTAndYValues( const std::vector& dat } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimPlotCurve::computeCurveZValue() +{ + return 1.0; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -996,6 +1004,12 @@ void RimPlotCurve::setParentPlotNoReplot( RiuPlotWidget* plotWidget ) } m_plotCurve = m_parentPlot->createPlotCurve( this, "", RiaColorTools::toQColor( m_curveAppearance->color() ) ); + + // PERFORMANCE NOTE + // When the z-value of a curve is changed, several update calls are made to the plot. Make sure that the default + // z-value is correct to avoid these calls. + m_plotCurve->setZ( computeCurveZValue() ); + m_plotCurve->attachToPlot( plotWidget ); } @@ -1005,6 +1019,9 @@ void RimPlotCurve::setParentPlotNoReplot( RiuPlotWidget* plotWidget ) void RimPlotCurve::setParentPlotAndReplot( RiuPlotWidget* plotWidget ) { CAF_ASSERT( plotWidget ); + + if ( m_parentPlot == plotWidget ) return; + setParentPlotNoReplot( plotWidget ); plotWidget->replot(); } @@ -1035,7 +1052,7 @@ void RimPlotCurve::detach( bool deletePlotCurve ) } } - replotParentPlot(); + m_parentPlot->scheduleReplot(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h index 1cb8713bd0..c8a98d55cb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.h @@ -157,6 +157,8 @@ class RimPlotCurve : public caf::PdmObject const std::vector& yValues, bool useLogarithmicScale ); + virtual double computeCurveZValue(); + protected: // Overridden PDM methods void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 5747c996c0..fa6f2fe872 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -302,8 +302,7 @@ void RimEnsembleCurveSet::setParentPlotNoReplot( RiuPlotWidget* plot ) { for ( RimSummaryCurve* curve : m_curves ) { - // TODO: attach without replotting - curve->attach( plot ); + curve->setParentPlotNoReplot( plot ); } if ( !m_plotCurveForLegendText ) @@ -315,11 +314,11 @@ void RimEnsembleCurveSet::setParentPlotNoReplot( RiuPlotWidget* plot ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimEnsembleCurveSet::detachPlotCurves( bool deletePlotCurve ) +void RimEnsembleCurveSet::deletePlotCurves() { for ( RimSummaryCurve* curve : m_curves ) { - curve->detach( deletePlotCurve ); + curve->deletePlotCurve(); } if ( m_plotCurveForLegendText ) @@ -1361,7 +1360,7 @@ void RimEnsembleCurveSet::updateFilterLegend() plot->plotWidget()->removeOverlayFrame( m_filterOverlayFrame ); } } - plot->plotWidget()->scheduleReplot(); + plot->scheduleReplotIfVisible(); } } @@ -1423,7 +1422,7 @@ void RimEnsembleCurveSet::updateObjectiveFunctionLegend() } } } - plot->plotWidget()->scheduleReplot(); + plot->scheduleReplotIfVisible(); } //-------------------------------------------------------------------------------------------------- @@ -1612,7 +1611,7 @@ void RimEnsembleCurveSet::updateCurveColors() plot->plotWidget()->removeOverlayFrame( m_legendOverlayFrame ); } } - plot->plotWidget()->scheduleReplot(); + plot->scheduleReplotIfVisible(); } } @@ -1708,7 +1707,6 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectorsetLeftOrRightAxisY( axisY() ); - curve->updateCurveVisibility(); newSummaryCurves.push_back( curve ); } @@ -1733,7 +1731,7 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectorplotWidget() ) { if ( plot->legendsVisible() ) plot->plotWidget()->updateLegend(); - plot->plotWidget()->scheduleReplot(); + plot->scheduleReplotIfVisible(); plot->updateAxes(); plot->updatePlotInfoLabel(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h index 2aa535d10f..27056ab436 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.h @@ -98,7 +98,7 @@ class RimEnsembleCurveSet : public caf::PdmObject, public RimEnsembleCurveSetInt void loadDataAndUpdate( bool updateParentPlot ); void setParentPlotNoReplot( RiuPlotWidget* plot ); - void detachPlotCurves( bool deletePlotCurve = false ); + void deletePlotCurves(); void reattachPlotCurves(); void addCurve( RimSummaryCurve* curve ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp index 065f6ae460..ad5ac9c921 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSetCollection.cpp @@ -117,7 +117,7 @@ void RimEnsembleCurveSetCollection::detachPlotCurves() { for ( const auto& curveSet : m_curveSets ) { - curveSet->detachPlotCurves(); + curveSet->deletePlotCurves(); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index c90437f5b7..d151c45714 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -786,6 +786,44 @@ void RimSummaryCurve::initAfterRead() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +double RimSummaryCurve::computeCurveZValue() +{ + auto sumAddr = summaryAddressY(); + auto sumCase = summaryCaseY(); + + double zOrder = 0.0; + + if ( sumCase && sumAddr.isValid() ) + { + if ( sumCase->isObservedData() ) + { + zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_OBSERVED ); + } + else if ( sumAddr.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS ) + { + zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_STAT_CURVE ); + } + else if ( sumCase->ensemble() ) + { + zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_CURVE ); + } + else + { + zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_NON_OBSERVED ); + } + } + + if ( m_isTopZWithinCategory ) + { + zOrder += 1.0; + } + + return zOrder; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -894,37 +932,9 @@ void RimSummaryCurve::setResampling( RiaDefines::DateTimePeriodEnum resampling ) //-------------------------------------------------------------------------------------------------- void RimSummaryCurve::setZIndexFromCurveInfo() { - auto sumAddr = summaryAddressY(); - auto sumCase = summaryCaseY(); - - double zOrder = 0.0; - - if ( sumCase && sumAddr.isValid() ) - { - if ( sumCase->isObservedData() ) - { - zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_OBSERVED ); - } - else if ( sumAddr.category() == RifEclipseSummaryAddress::SUMMARY_ENSEMBLE_STATISTICS ) - { - zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_STAT_CURVE ); - } - else if ( sumCase->ensemble() ) - { - zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_ENSEMBLE_CURVE ); - } - else - { - zOrder = RiuQwtPlotCurveDefines::zDepthForIndex( RiuQwtPlotCurveDefines::ZIndex::Z_SINGLE_CURVE_NON_OBSERVED ); - } - } - - if ( m_isTopZWithinCategory ) - { - zOrder += 1.0; - } + auto zValue = computeCurveZValue(); - setZOrder( zOrder ); + setZOrder( zValue ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h index d32b975176..27e403ae77 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -107,8 +107,9 @@ class RimSummaryCurve : public RimStackablePlotCurve void updateLegendsInPlot() override; - void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; - void initAfterRead() override; + void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; + void initAfterRead() override; + double computeCurveZValue() override; private: RifSummaryReaderInterface* valuesSummaryReaderX() const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 437bd6c064..b4519fd1a0 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -237,12 +237,6 @@ void RimSummaryPlot::updateAxes() updateTimeAxis( timeAxisProperties() ); } - if ( plotWidget() ) - { - plotWidget()->updateAxes(); - plotWidget()->scheduleReplot(); - } - updateZoomInParentPlot(); } @@ -584,7 +578,7 @@ void RimSummaryPlot::updatePlotTitle() QString plotTitle = description(); plotWidget()->setPlotTitle( plotTitle ); plotWidget()->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() ); - plotWidget()->scheduleReplot(); + scheduleReplotIfVisible(); } } @@ -869,11 +863,28 @@ void RimSummaryPlot::updateAxis( RiaDefines::PlotAxis plotAxis ) timeHistoryQuantities.insert( c->quantityName() ); } + std::vector curveDefs; + for ( auto summaryCurve : summaryCurves() ) + { + if ( summaryCurve->axisY() != riuPlotAxis ) continue; + + curveDefs.push_back( summaryCurve->curveDefinitionY() ); + } + + for ( auto curveSet : ensembleCurveSetCollection()->curveSets() ) + { + if ( curveSet->axisY() != riuPlotAxis ) continue; + + RiaSummaryCurveDefinition def( curveSet->summaryCaseCollection(), curveSet->summaryAddress() ); + curveDefs.push_back( def ); + } + RimSummaryPlotAxisFormatter calc( axisProperties, - visibleSummaryCurvesForAxis( riuPlotAxis ), {}, + curveDefs, visibleAsciiDataCurvesForAxis( riuPlotAxis ), timeHistoryQuantities ); + calc.applyAxisPropertiesToPlot( plotWidget() ); } } @@ -971,6 +982,14 @@ bool RimSummaryPlot::isOnlyWaterCutCurvesVisible( RiuPlotAxis plotAxis ) return ( waterCutCurveCount == curves.size() ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryPlot::scheduleReplotIfVisible() +{ + if ( showWindow() && plotWidget() ) plotWidget()->scheduleReplot(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1465,7 +1484,7 @@ void RimSummaryPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, for ( auto& curveSet : this->ensembleCurveSetCollection()->curveSets() ) { - curveSet->detachPlotCurves( true ); + curveSet->deletePlotCurves(); } // Destroy viewer @@ -1498,7 +1517,7 @@ void RimSummaryPlot::updateStackedCurveData() if ( plotWidget() && anyStackedCurvesPresent ) { reattachAllCurves(); - plotWidget()->scheduleReplot(); + scheduleReplotIfVisible(); } } @@ -1686,7 +1705,7 @@ void RimSummaryPlot::updateZoomInParentPlot() plotWidget()->updateAxes(); updateZoomFromParentPlot(); plotWidget()->updateZoomDependentCurveProperties(); - plotWidget()->scheduleReplot(); + scheduleReplotIfVisible(); } //-------------------------------------------------------------------------------------------------- @@ -1775,10 +1794,7 @@ void RimSummaryPlot::curveVisibilityChanged( const caf::SignalEmitter* emitter, //-------------------------------------------------------------------------------------------------- void RimSummaryPlot::curveAppearanceChanged( const caf::SignalEmitter* emitter ) { - if ( plotWidget() ) - { - plotWidget()->scheduleReplot(); - } + scheduleReplotIfVisible(); } //-------------------------------------------------------------------------------------------------- @@ -2651,7 +2667,7 @@ bool RimSummaryPlot::handleGlobalKeyEvent( QKeyEvent* keyEvent ) void RimSummaryPlot::onCurveCollectionChanged( const SignalEmitter* emitter ) { updateStackedCurveData(); - if ( plotWidget() ) plotWidget()->scheduleReplot(); + scheduleReplotIfVisible(); updateAllRequiredEditors(); } @@ -2923,7 +2939,7 @@ void RimSummaryPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childAr plotWidget()->pruneAxes( usedPlotAxis ); updateAxes(); - plotWidget()->scheduleReplot(); + scheduleReplotIfVisible(); } } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index 0f8cf99a54..b22152d220 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -206,6 +206,7 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping std::vector visibleCurvesForLegend() override; RimSummaryPlotSourceStepping* sourceStepper(); + void scheduleReplotIfVisible(); public: // RimViewWindow overrides diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 62e9c96253..e866660621 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -491,7 +491,7 @@ bool RiuMultiPlotBook::showYAxis( int row, int column ) const //-------------------------------------------------------------------------------------------------- void RiuMultiPlotBook::performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ) { - if ( !m_plotDefinition || !m_plotDefinition->isValid() ) return; + if ( !m_plotDefinition || !m_plotDefinition->isValid() || !m_plotDefinition->showWindow() ) return; applyLook(); if ( ( ( whatToUpdate & RiaDefines::MultiPlotPageUpdateType::PLOT ) == RiaDefines::MultiPlotPageUpdateType::PLOT ) || diff --git a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp index 85dad5c4ec..deee087cc4 100644 --- a/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuSummaryQwtPlot.cpp @@ -108,7 +108,9 @@ RiuSummaryQwtPlot::RiuSummaryQwtPlot( RimSummaryPlot* plot, QWidget* parent /*= RiuQwtPlotTools::setCommonPlotBehaviour( m_plotWidget->qwtPlot() ); RiuQwtPlotTools::setDefaultAxes( m_plotWidget->qwtPlot() ); - m_plotWidget->setInternalLegendVisible( true ); + // PERFORMANCE NOTE + // Do not set internal legends visible, as this will cause a performance hit. + m_plotWidget->setInternalLegendVisible( false ); m_annotationTool = std::unique_ptr( new RiuPlotAnnotationTool() ); } From 0cc4f69ba35c44b8474764409ca049a968783694 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 24 Jun 2022 14:09:56 +0200 Subject: [PATCH 394/406] Add grid calculator button to 3d view toolbar, add grid calc command to case context menu --- ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp | 1 + ApplicationLibCode/UserInterface/RiuMainWindow.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 6167139ac9..2a162602f5 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1158,6 +1158,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() } else if ( dynamic_cast( firstUiItem ) ) { + menuBuilder << "RicShowGridCalculatorFeature"; menuBuilder << "RicAddEclipseInputPropertyFeature"; menuBuilder << "RicReloadCaseFeature"; menuBuilder << "RicReplaceCaseFeature"; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index aeba59f0c8..a8b7d15f27 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -635,6 +635,7 @@ void RiuMainWindow::createToolBars() toolbar->addAction( cmdFeatureMgr->action( "RicShowPlotWindowFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicLinkVisibleViewsFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicTileWindowsFeature" ) ); + toolbar->addAction( cmdFeatureMgr->action( "RicShowGridCalculatorFeature" ) ); } { From 55966ef6e8348114cf406b7aaecdd1f790482d0b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 27 Jun 2022 15:16:31 +0200 Subject: [PATCH 395/406] RFT : Fix several update issues --- ApplicationLibCode/Application/RiaGuiApplication.cpp | 4 ++++ ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp | 2 -- .../WellLog/RimWellLogCurveCommonDataSource.cpp | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index eb66f11e7c..c492c4d4d3 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -100,6 +100,7 @@ #include "RiuMdiMaximizeWindowGuard.h" #include "RiuMessagePanel.h" #include "RiuPlotMainWindow.h" +#include "RiuPlotMainWindowTools.h" #include "RiuProcessMonitor.h" #include "RiuRecentFileActionProvider.h" #include "RiuViewer.h" @@ -1277,6 +1278,9 @@ void RiaGuiApplication::onProjectOpened() m_maximizeWindowGuard.reset(); processEvents(); + + // Make sure to process events before this function to avoid strange Qt crash + RiuPlotMainWindowTools::refreshToolbars(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp index c3ac4a6de9..eab9ecba4b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotCurve.cpp @@ -1020,8 +1020,6 @@ void RimPlotCurve::setParentPlotAndReplot( RiuPlotWidget* plotWidget ) { CAF_ASSERT( plotWidget ); - if ( m_parentPlot == plotWidget ) return; - setParentPlotNoReplot( plotWidget ); plotWidget->replot(); } diff --git a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp index c5ea2f459b..ae5efde4fd 100644 --- a/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp +++ b/ApplicationLibCode/ProjectDataModel/WellLog/RimWellLogCurveCommonDataSource.cpp @@ -601,7 +601,6 @@ void RimWellLogCurveCommonDataSource::applyDataSourceChanges( const std::vector< RimWellLogPlot* parentPlot = nullptr; extractionCurve->firstAncestorOrThisOfTypeAsserted( parentPlot ); plots.insert( parentPlot ); - curve->updateConnectedEditors(); } } else if ( measurementCurve ) @@ -621,6 +620,8 @@ void RimWellLogCurveCommonDataSource::applyDataSourceChanges( const std::vector< rftCurve->firstAncestorOrThisOfTypeAsserted( parentPlot ); plots.insert( parentPlot ); } + + curve->updateConnectedEditors(); } for ( RimWellLogTrack* track : tracks ) From a86abab3cb47d446511fb26de4a70087aecd6650 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 27 Jun 2022 10:33:17 +0200 Subject: [PATCH 396/406] Regression Test: Guard null pointer access --- ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp | 2 +- ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp index 152c05a8f6..9361179d29 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellPathPartMgr.cpp @@ -810,7 +810,7 @@ void RivWellPathPartMgr::buildWellPathParts( const caf::DisplayCoordTransform* d double cellRadius = 15.0; auto eclipseView = dynamic_cast( m_rimView.p() ); - if ( eclipseView ) + if ( eclipseView && eclipseView->mainGrid() ) { double characteristicCellSize = eclipseView->mainGrid()->characteristicIJCellSize(); cellRadius = sphereRadiusFactor * characteristicCellSize; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp index ebbdba1bad..8468462101 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPlotTools.cpp @@ -550,11 +550,13 @@ std::set RimWellPlotTools::availableSimWellTimesteps( RimEclipseCase* const QString& simWellName, bool addFirstReportTimestep ) { + if ( !eclCase || !eclCase->eclipseCaseData() ) return {}; + std::set availebleTimeSteps; const RigSimWellData* simWell = eclCase->eclipseCaseData()->findSimWellData( simWellName ); - if ( eclCase && eclCase->eclipseCaseData() && simWell ) + if ( simWell ) { std::vector allTimeSteps = eclCase->eclipseCaseData()->results( RiaDefines::PorosityModelType::MATRIX_MODEL )->timeStepDates(); From cb1c94630b10f461ebd7351988b6bc1e94f82022 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 27 Jun 2022 12:02:41 +0200 Subject: [PATCH 397/406] Guard null pointer use --- .../Summary/RimSummaryPlotSourceStepping.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index a9a6d4f0b1..3c4cd5f780 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -217,7 +217,10 @@ QList if ( !dataSourceSteppingObject()->curveSets().empty() ) { auto first = dataSourceSteppingObject()->curveSets().front(); - analyzer = first->summaryCaseCollection()->addressAnalyzer(); + if ( first->summaryCaseCollection() ) + { + analyzer = first->summaryCaseCollection()->addressAnalyzer(); + } } if ( !analyzer ) From e5cf5f4cf352a7dc898aea264e5ab8f785691159 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 27 Jun 2022 15:30:21 +0200 Subject: [PATCH 398/406] Improve history curve color and symbols --- .../Application/RiaPreferencesSummary.cpp | 29 ++++++++--- .../Application/RiaPreferencesSummary.h | 12 ++++- .../Application/Tools/RiaColorTables.cpp | 10 ++++ .../Application/Tools/RiaColorTables.h | 2 + .../Application/Tools/RiaColorTools.cpp | 20 +++++++ .../Application/Tools/RiaColorTools.h | 2 + ...wSummaryMultiPlotFromDataVectorFeature.cpp | 18 +++++++ .../RicNewSummaryEnsembleCurveSetFeature.cpp | 6 ++- .../Summary/RimEnsembleCurveSet.cpp | 9 +++- .../RimSummaryCurveAppearanceCalculator.cpp | 24 +++++++++ .../RimSummaryCurveAppearanceCalculator.h | 4 +- .../Summary/RimSummaryPlot.cpp | 52 ++++++------------- 12 files changed, 137 insertions(+), 51 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp index 82b228e174..0a53be9110 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp @@ -21,6 +21,7 @@ #include "PlotTemplateCommands/RicSummaryPlotTemplateTools.h" #include "RiaApplication.h" +#include "RiaColorTables.h" #include "RiaPreferences.h" #include "PlotTemplates/RimPlotTemplateFileItem.h" @@ -174,11 +175,13 @@ RiaPreferencesSummary::RiaPreferencesSummary() CAF_PDM_InitField( &m_curveColorByPhase, "curveColorByPhase", true, "Curve Color By Phase" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_curveColorByPhase ); - CAF_PDM_InitField( &m_appendHistoryVectorForDragDrop, - "appendHistoryVectorForDragDrop", - false, - "Append History Vector for Drag/Drop" ); - caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_appendHistoryVectorForDragDrop ); + CAF_PDM_InitField( &m_appendHistoryVectors, "appendHistoryVectorForDragDrop", false, "Append History Vectors" ); + caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_appendHistoryVectors ); + + CAF_PDM_InitField( &m_historyCurveContrastColor, + "historyCurveContrastColor", + RiaColorTables::historyCurveContrastColor(), + "History Curve Contrast Color" ); } //-------------------------------------------------------------------------------------------------- @@ -278,8 +281,10 @@ void RiaPreferencesSummary::appendItemsToPlottingGroup( caf::PdmUiOrdering& uiOr } uiOrdering.add( &m_defaultSummaryHistoryCurveStyle ); + uiOrdering.add( &m_curveColorByPhase ); - uiOrdering.add( &m_appendHistoryVectorForDragDrop ); + uiOrdering.add( &m_appendHistoryVectors ); + uiOrdering.add( &m_historyCurveContrastColor, false ); uiOrdering.add( &m_showSummaryTimeAsLongString ); @@ -356,9 +361,9 @@ bool RiaPreferencesSummary::colorCurvesByPhase() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RiaPreferencesSummary::appendHistoryVectorForDragDrop() const +bool RiaPreferencesSummary::appendHistoryVectors() const { - return m_appendHistoryVectorForDragDrop(); + return m_appendHistoryVectors(); } //-------------------------------------------------------------------------------------------------- @@ -522,6 +527,14 @@ RiaDefines::RowCount RiaPreferencesSummary::defaultMultiPlotRowCount() const return m_defaultRowsPerPage(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Color3f RiaPreferencesSummary::historyCurveContrastColor() const +{ + return m_historyCurveContrastColor(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.h b/ApplicationLibCode/Application/RiaPreferencesSummary.h index d8e75690dd..c4611e7f81 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.h +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.h @@ -25,7 +25,11 @@ #include "RiaDefines.h" +// Include to make Pdm work for cvf::Color +#include "cafPdmFieldCvfColor.h" + #include + #include //-------------------------------------------------------------------------------------------------- @@ -101,13 +105,15 @@ class RiaPreferencesSummary : public caf::PdmObject SummaryRestartFilesImportMode summaryEnsembleImportMode() const; QString defaultSummaryCurvesTextFilter() const; bool colorCurvesByPhase() const; - bool appendHistoryVectorForDragDrop() const; + bool appendHistoryVectors() const; SummaryHistoryCurveStyleMode defaultSummaryHistoryCurveStyle() const; RiaDefines::ColumnCount defaultMultiPlotColumnCount() const; RiaDefines::RowCount defaultMultiPlotRowCount() const; + cvf::Color3f historyCurveContrastColor() const; + void defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; @@ -130,7 +136,7 @@ class RiaPreferencesSummary : public caf::PdmObject caf::PdmField m_defaultSummaryCurvesTextFilter; caf::PdmField m_defaultSummaryHistoryCurveStyle; caf::PdmField m_curveColorByPhase; - caf::PdmField m_appendHistoryVectorForDragDrop; + caf::PdmField m_appendHistoryVectors; caf::PdmField m_showSummaryTimeAsLongString; caf::PdmField m_useMultipleThreadsWhenLoadingSummaryCases; @@ -145,4 +151,6 @@ class RiaPreferencesSummary : public caf::PdmObject caf::PdmField m_defaultColumnCount; caf::PdmField m_defaultRowsPerPage; + + caf::PdmField m_historyCurveContrastColor; }; diff --git a/ApplicationLibCode/Application/Tools/RiaColorTables.cpp b/ApplicationLibCode/Application/Tools/RiaColorTables.cpp index 4522989faa..bdb9912a42 100644 --- a/ApplicationLibCode/Application/Tools/RiaColorTables.cpp +++ b/ApplicationLibCode/Application/Tools/RiaColorTables.cpp @@ -682,6 +682,16 @@ cvf::Color3f RiaColorTables::phaseColor( RiaDefines::PhaseType phase ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Color3f RiaColorTables::historyCurveContrastColor() +{ + auto unsignedColor = cvf::Color3ub( 248, 0, 170 ); // Magenta + + return cvf::Color3f( unsignedColor ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaColorTables.h b/ApplicationLibCode/Application/Tools/RiaColorTables.h index aa2db4a804..509447f787 100644 --- a/ApplicationLibCode/Application/Tools/RiaColorTables.h +++ b/ApplicationLibCode/Application/Tools/RiaColorTables.h @@ -81,6 +81,8 @@ class RiaColorTables static std::map phaseColors(); static cvf::Color3f phaseColor( RiaDefines::PhaseType phase ); + static cvf::Color3f historyCurveContrastColor(); + private: static std::vector categoryColors(); static std::vector contrastCategoryColors(); diff --git a/ApplicationLibCode/Application/Tools/RiaColorTools.cpp b/ApplicationLibCode/Application/Tools/RiaColorTools.cpp index 9c333b3423..04bdce0935 100644 --- a/ApplicationLibCode/Application/Tools/RiaColorTools.cpp +++ b/ApplicationLibCode/Application/Tools/RiaColorTools.cpp @@ -184,6 +184,26 @@ QColor RiaColorTools::blendQColors( const QColor& color1, const QColor& color2, ( color1.blue() * weight1 + color2.blue() * weight2 ) / weightsum ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Color3f RiaColorTools::makeLighter( const cvf::Color3f& color, float normalizedScalingFactor ) +{ + auto qColor = toQColor( color ); + + double h = 0.0; + double s = 0.0; + double l = 0.0; + qColor.getHslF( &h, &s, &l ); + + l = l + ( 1.0 - l ) * normalizedScalingFactor; + l = std::min( 1.0, l ); + + qColor.setHslF( h, s, l ); + + return fromQColorTo3f( qColor ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaColorTools.h b/ApplicationLibCode/Application/Tools/RiaColorTools.h index 2030cc233b..7c7b4e2ebe 100644 --- a/ApplicationLibCode/Application/Tools/RiaColorTools.h +++ b/ApplicationLibCode/Application/Tools/RiaColorTools.h @@ -49,6 +49,8 @@ class RiaColorTools blendCvfColors( const cvf::Color3f& color1, const cvf::Color3f& color2, int weight1 = 1, int weight2 = 1 ); static QColor blendQColors( const QColor& color1, const QColor& color2, int weight1 = 1, int weight2 = 1 ); + static cvf::Color3f makeLighter( const cvf::Color3f& color1, float normalizedScalingFactor ); + // Factor > 1 increases saturation, a factor < 1 decreases saturation static QColor modifySaturation( const QColor& color, double factor ); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp index 52382ff43b..cef51ed269 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp @@ -18,13 +18,16 @@ #include "RicNewSummaryMultiPlotFromDataVectorFeature.h" +#include "RiaPreferencesSummary.h" #include "RiaSummaryTools.h" + #include "RimSummaryAddress.h" #include "RimSummaryPlot.h" #include "RicSummaryPlotBuilder.h" #include "RifEclipseSummaryAddress.h" +#include "RifReaderEclipseSummary.h" #include "cafSelectionManagerTools.h" #include "cvfAssert.h" @@ -97,6 +100,21 @@ void RicNewSummaryMultiPlotFromDataVectorFeature::onActionTriggered( bool isChec } } + if ( RiaPreferencesSummary::current()->appendHistoryVectors() ) + { + auto sourceAddresses = eclipseAddresses; + + for ( const auto& addr : sourceAddresses ) + { + if ( !addr.isHistoryVector() ) + { + auto historyAddr = addr; + historyAddr.setVectorName( addr.vectorName() + RifReaderEclipseSummary::historyIdentifier() ); + eclipseAddresses.insert( historyAddr ); + } + } + } + auto newPlot = RicSummaryPlotBuilder::createPlot( eclipseAddresses, selectedCases, selectedEnsembles ); std::vector plots{ newPlot }; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp index 1e96749245..785ee478fb 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp @@ -34,6 +34,7 @@ #include "RimProject.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryCurve.h" +#include "RimSummaryCurveAppearanceCalculator.h" #include "RimSummaryMultiPlot.h" #include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" @@ -80,7 +81,10 @@ std::vector // Use same counting as RicNewSummaryCurveFeature::onActionTriggered auto colorIndex = plot->singleColorCurveCount(); - curveSet->setColor( RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex ) ); + + curveSet->setColor( + RimSummaryCurveAppearanceCalculator::computeTintedCurveColorForAddress( addr, + static_cast( colorIndex ) ) ); curveSet->legendConfig()->setColorLegend( RimRegularLegendConfig::mapToColorLegend( RimEnsembleCurveSetColorManager::cycledEnsembleColorRange( static_cast( colorIndex ) ) ) ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index fa6f2fe872..0e971cb309 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -1702,7 +1702,14 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectorsetSummaryCaseY( sumCase ); curve->setSummaryAddressYAndApplyInterpolation( addr->address() ); curve->setResampling( m_resampling() ); - curve->setLineThickness( 1 ); + + int lineThickness = 1; + if ( addr->address().isHistoryVector() ) + { + lineThickness = 2; + curve->setCurveAppearanceFromCaseType(); + } + curve->setLineThickness( lineThickness ); addCurve( curve ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp index ba878fef63..6539a32574 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.cpp @@ -19,6 +19,7 @@ #include "RimSummaryCurveAppearanceCalculator.h" #include "RiaColorTables.h" +#include "RiaColorTools.h" #include "RiaPreferencesSummary.h" #include "RiaSummaryCurveDefinition.h" @@ -387,6 +388,29 @@ cvf::Color3f RimSummaryCurveAppearanceCalculator::assignColorByPhase( const RifE return cycledNoneRGBBrColor( 0 ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +cvf::Color3f RimSummaryCurveAppearanceCalculator::computeTintedCurveColorForAddress( const RifEclipseSummaryAddress& address, + int colorIndex ) +{ + bool usePhaseColor = RiaPreferencesSummary::current()->colorCurvesByPhase(); + + cvf::Color3f curveColor; + if ( usePhaseColor ) + { + curveColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( address ); + } + else + { + curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex ); + } + + float scalingFactor = 0.25; + curveColor = RiaColorTools::makeLighter( curveColor, scalingFactor ); + return curveColor; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h index a50b85ee35..61592713b5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAppearanceCalculator.h @@ -61,8 +61,7 @@ class RimSummaryCurveAppearanceCalculator void setupCurveLook( RimSummaryCurve* curve ); static cvf::Color3f assignColorByPhase( const RifEclipseSummaryAddress& address ); - - void assignColorByPhase( RimSummaryCurve* curve, int colorIndex ); + static cvf::Color3f computeTintedCurveColorForAddress( const RifEclipseSummaryAddress& address, int colorIndex ); static cvf::Color3f cycledPaletteColor( int colorIndex ); static cvf::Color3f cycledNoneRGBBrColor( int colorIndex ); @@ -84,6 +83,7 @@ class RimSummaryCurveAppearanceCalculator float gradient( size_t totalCount, int index ); cvf::Color3f gradeColor( const cvf::Color3f& color, float factor ); + void assignColorByPhase( RimSummaryCurve* curve, int colorIndex ); static std::set getAllSummaryCaseNames(); static std::set getAllSummaryWellNames(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index b4519fd1a0..cdbaaed199 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -776,20 +776,12 @@ void RimSummaryPlot::applyDefaultCurveAppearances() { if ( curveSet->colorMode() != RimEnsembleCurveSet::ColorMode::SINGLE_COLOR ) continue; - cvf::Color3f curveColor; - if ( RiaPreferencesSummary::current()->colorCurvesByPhase() ) - { - curveColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( curveSet->summaryAddress() ); - } - else - { - curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( colorIndex++ ); - } + cvf::Color3f curveColor = + RimSummaryCurveAppearanceCalculator::computeTintedCurveColorForAddress( curveSet->summaryAddress(), + colorIndex++ ); - int weightBaseColor = 10; - int weightWhite = 25; - - curveColor = RiaColorTools::blendCvfColors( curveColor, cvf::Color3f::WHITE, weightBaseColor, weightWhite ); + auto adr = curveSet->summaryAddress(); + if ( adr.isHistoryVector() ) curveColor = RiaPreferencesSummary::current()->historyCurveContrastColor(); curveSet->setColor( curveColor ); } @@ -1991,17 +1983,6 @@ std::pair> RimSummaryPlot::handleSummaryCaseD { const auto addr = curve->summaryAddressY(); dataVectorMap[addr].insert( curve->summaryCaseY() ); - - if ( !addr.isHistoryVector() && RiaPreferencesSummary::current()->appendHistoryVectorForDragDrop() ) - { - auto historyAddr = addr; - historyAddr.setVectorName( addr.vectorName() + RifReaderEclipseSummary::historyIdentifier() ); - - if ( summaryCase->summaryReader() && summaryCase->summaryReader()->hasAddress( historyAddr ) ) - { - dataVectorMap[historyAddr].insert( curve->summaryCaseY() ); - } - } } for ( const auto& [addr, cases] : dataVectorMap ) @@ -2083,7 +2064,7 @@ std::pair> { newCurveDefsWithObjectNames[newCurveDef].insert( objectIdentifierString ); const auto& addr = curveDef.summaryAddress(); - if ( !addr.isHistoryVector() && RiaPreferencesSummary::current()->appendHistoryVectorForDragDrop() ) + if ( !addr.isHistoryVector() && RiaPreferencesSummary::current()->appendHistoryVectors() ) { auto historyAddr = addr; historyAddr.setVectorName( addr.vectorName() + RifReaderEclipseSummary::historyIdentifier() ); @@ -2133,7 +2114,7 @@ std::pair> RimSummaryPlot::handleSummaryAddre std::vector newCurveAddresses; newCurveAddresses.push_back( summaryAddr->address() ); - if ( !summaryAddr->address().isHistoryVector() && RiaPreferencesSummary::current()->appendHistoryVectorForDragDrop() ) + if ( !summaryAddr->address().isHistoryVector() && RiaPreferencesSummary::current()->appendHistoryVectors() ) { auto historyAddr = summaryAddr->address(); historyAddr.setVectorName( summaryAddr->address().vectorName() + RifReaderEclipseSummary::historyIdentifier() ); @@ -2294,18 +2275,15 @@ void RimSummaryPlot::addNewEnsembleCurveY( const RifEclipseSummaryAddress& addre curveSet->setSummaryCaseCollection( ensemble ); curveSet->setSummaryAddress( address ); - cvf::Color3f curveColor; - if ( RiaPreferencesSummary::current()->colorCurvesByPhase() ) - { - auto basePhaseColor = RimSummaryCurveAppearanceCalculator::assignColorByPhase( curveSet->summaryAddress() ); + cvf::Color3f curveColor = + RimSummaryCurveAppearanceCalculator::computeTintedCurveColorForAddress( curveSet->summaryAddress(), + static_cast( + ensembleCurveSetCollection() + ->curveSetCount() ) ); + + auto adr = curveSet->summaryAddress(); + if ( adr.isHistoryVector() ) curveColor = RiaPreferencesSummary::current()->historyCurveContrastColor(); - curveColor = RiaColorTools::blendCvfColors( basePhaseColor, cvf::Color3f::WHITE, 1, 3 ); - } - else - { - curveColor = RiaColorTables::summaryCurveDefaultPaletteColors().cycledColor3f( - ensembleCurveSetCollection()->curveSetCount() ); - } curveSet->setColor( curveColor ); ensembleCurveSetCollection()->addCurveSet( curveSet ); From 7534a219b55c7c68670a8a4fb64c49b8a7a73c25 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Mon, 27 Jun 2022 15:19:49 +0200 Subject: [PATCH 399/406] Set version to 2022.06.0-RC-01 --- ResInsightVersion.cmake | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 68f833c17b..bbb7d78a5e 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -1,17 +1,17 @@ -set(RESINSIGHT_MAJOR_VERSION 2021) -set(RESINSIGHT_MINOR_VERSION 10) -set(RESINSIGHT_PATCH_VERSION 3) +set(RESINSIGHT_MAJOR_VERSION 2022) +set(RESINSIGHT_MINOR_VERSION 06) +set(RESINSIGHT_PATCH_VERSION 0) # Opional text with no restrictions -set(RESINSIGHT_VERSION_TEXT "-dev") -#set(RESINSIGHT_VERSION_TEXT "-RC_01") +#"set(RESINSIGHT_VERSION_TEXT "-dev") +set(RESINSIGHT_VERSION_TEXT "-RC_01") # Optional text # Must be unique and increasing within one combination of major/minor/patch version # The uniqueness of this text is independent of RESINSIGHT_VERSION_TEXT # Format of text must be ".xx" -set(RESINSIGHT_DEV_VERSION ".07") +# set(RESINSIGHT_DEV_VERSION ".01") # https://github.com/CRAVA/crava/tree/master/libs/nrlib set(NRLIB_GITHUB_SHA "ba35d4359882f1c6f5e9dc30eb95fe52af50fd6f") From aeab09eceb155f0f17511cf17ddb258a6df3bdb9 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Tue, 28 Jun 2022 14:06:32 +0200 Subject: [PATCH 400/406] Minor restructure of summary preferences --- .../Application/RiaPreferencesSummary.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp index 0a53be9110..7cefefb4ac 100644 --- a/ApplicationLibCode/Application/RiaPreferencesSummary.cpp +++ b/ApplicationLibCode/Application/RiaPreferencesSummary.cpp @@ -175,13 +175,19 @@ RiaPreferencesSummary::RiaPreferencesSummary() CAF_PDM_InitField( &m_curveColorByPhase, "curveColorByPhase", true, "Curve Color By Phase" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_curveColorByPhase ); - CAF_PDM_InitField( &m_appendHistoryVectors, "appendHistoryVectorForDragDrop", false, "Append History Vectors" ); + CAF_PDM_InitField( &m_appendHistoryVectors, + "appendHistoryVectorForDragDrop", + false, + "Append History Vectors", + "", + "When a simulated summary vector is inserted into a plot, also include the corresponding " + "history vector" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_appendHistoryVectors ); CAF_PDM_InitField( &m_historyCurveContrastColor, "historyCurveContrastColor", RiaColorTables::historyCurveContrastColor(), - "History Curve Contrast Color" ); + "History Curve Color" ); } //-------------------------------------------------------------------------------------------------- @@ -280,12 +286,13 @@ void RiaPreferencesSummary::appendItemsToPlottingGroup( caf::PdmUiOrdering& uiOr break; } - uiOrdering.add( &m_defaultSummaryHistoryCurveStyle ); + auto historyCurveGroup = uiOrdering.addNewGroup( "History Vectors" ); - uiOrdering.add( &m_curveColorByPhase ); - uiOrdering.add( &m_appendHistoryVectors ); - uiOrdering.add( &m_historyCurveContrastColor, false ); + historyCurveGroup->add( &m_defaultSummaryHistoryCurveStyle ); + historyCurveGroup->add( &m_historyCurveContrastColor ); + historyCurveGroup->add( &m_appendHistoryVectors ); + uiOrdering.add( &m_curveColorByPhase ); uiOrdering.add( &m_showSummaryTimeAsLongString ); auto multiGroup = uiOrdering.addNewGroup( "Multi Plot Defaults" ); From d4ff0a017581ed01f91f55342b2404784af139b2 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Wed, 29 Jun 2022 11:49:46 +0200 Subject: [PATCH 401/406] Missing legend (#9095) * Make sure ensemble curveset legends are shown in multiplot legend. * Remove information already shown in title from curve legend. * Fix missing legend when creating curve plot from ensemble curves * Show actual curve color in legend --- .../RicNewSummaryPlotFromCurveFeature.cpp | 2 + .../Summary/RimEnsembleCurveSet.cpp | 43 +++++++------------ .../UserInterface/RiuPlotCurve.h | 1 + .../UserInterface/RiuQtChartsPlotCurve.cpp | 14 ++++++ .../UserInterface/RiuQtChartsPlotCurve.h | 1 + .../UserInterface/RiuQwtPlotCurve.cpp | 10 +++++ .../UserInterface/RiuQwtPlotCurve.h | 1 + 7 files changed, 44 insertions(+), 28 deletions(-) diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.cpp index 63f972b298..0c517fc5d0 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryPlotFromCurveFeature.cpp @@ -49,6 +49,8 @@ void RicNewSummaryPlotFromCurveFeature::onActionTriggered( bool isChecked ) auto curveCopy = dynamic_cast( curve->copyByXmlSerialization( caf::PdmDefaultObjectFactory::instance() ) ); + curveCopy->setShowInLegend( true ); + RimSummaryPlot* plot = RicSummaryPlotBuilder::createPlot( { curveCopy } ); std::vector plots = { plot }; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index 0e971cb309..249b215956 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -304,11 +304,6 @@ void RimEnsembleCurveSet::setParentPlotNoReplot( RiuPlotWidget* plot ) { curve->setParentPlotNoReplot( plot ); } - - if ( !m_plotCurveForLegendText ) - { - m_plotCurveForLegendText = plot->createPlotCurve( nullptr, "", Qt::black ); - } } //-------------------------------------------------------------------------------------------------- @@ -338,15 +333,6 @@ void RimEnsembleCurveSet::reattachPlotCurves() { curve->reattach(); } - - if ( m_plotCurveForLegendText ) - { - m_plotCurveForLegendText->detach(); - - RimSummaryPlot* plot = nullptr; - firstAncestorOrThisOfType( plot ); - if ( plot && plot->plotWidget() ) m_plotCurveForLegendText->attachToPlot( plot->plotWidget() ); - } } //-------------------------------------------------------------------------------------------------- @@ -625,15 +611,6 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi if ( changedField == &m_showCurves ) { - if ( !m_showCurves() && m_plotCurveForLegendText ) - { - // Need to detach the legend since the plot type might change from Qwt to QtCharts. - // The plot curve for legend text needs to be recreated when curves are shown next time. - m_plotCurveForLegendText->detach(); - delete m_plotCurveForLegendText; - m_plotCurveForLegendText = nullptr; - } - loadDataAndUpdate( true ); updateConnectedEditors(); @@ -1589,6 +1566,11 @@ void RimEnsembleCurveSet::updateCurveColors() curvesToColor[i]->updateCurveAppearance(); } + if ( m_plotCurveForLegendText ) + { + m_plotCurveForLegendText->setColor( RiaColorTools::toQColor( m_color ) ); + } + RimSummaryPlot* plot; firstAncestorOrThisOfType( plot ); if ( plot && plot->plotWidget() ) @@ -1730,9 +1712,6 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectorupdatePlotAxis(); newSummaryCurves[i]->setShowInLegend( false ); } - - if ( plot->plotWidget() && m_plotCurveForLegendText ) - m_plotCurveForLegendText->attachToPlot( plot->plotWidget() ); } if ( plot->plotWidget() ) @@ -1741,6 +1720,14 @@ void RimEnsembleCurveSet::updateEnsembleCurves( const std::vectorscheduleReplotIfVisible(); plot->updateAxes(); plot->updatePlotInfoLabel(); + + if ( !m_plotCurveForLegendText ) + { + m_plotCurveForLegendText = + plot->plotWidget()->createPlotCurve( nullptr, "", RiaColorTools::toQColor( m_color ) ); + } + m_plotCurveForLegendText->attachToPlot( plot->plotWidget() ); + updateEnsembleLegendItem(); } } updateCurveColors(); @@ -2044,8 +2031,8 @@ QString RimEnsembleCurveSet::createAutoName() const RimSummaryPlot* plot = nullptr; firstAncestorOrThisOfTypeAsserted( plot ); - QString curveSetName = m_summaryAddressNameTools->curveNameY( m_yValuesSummaryAddress->address(), - plot->activePlotTitleHelperAllCurves() ); + QString curveSetName = + m_summaryAddressNameTools->curveNameY( m_yValuesSummaryAddress->address(), plot->plotTitleHelper() ); if ( curveSetName.isEmpty() ) { curveSetName = m_summaryAddressNameTools->curveNameY( m_yValuesSummaryAddress->address(), nullptr ); diff --git a/ApplicationLibCode/UserInterface/RiuPlotCurve.h b/ApplicationLibCode/UserInterface/RiuPlotCurve.h index 44cca14c3a..492cd1d929 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuPlotCurve.h @@ -94,6 +94,7 @@ class RiuPlotCurve const QBrush& fillBrush = QBrush( Qt::NoBrush ) ) = 0; virtual void setBrush( const QBrush& brush ) = 0; + virtual void setColor( const QColor& color ) = 0; void setBlackAndWhiteLegendIcon( bool blackAndWhite ); virtual void setVisibleInLegend( bool isVisibleInLegend ) = 0; diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp index aeb5ba98aa..33e7313e99 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.cpp @@ -164,6 +164,20 @@ void RiuQtChartsPlotCurve::setBrush( const QBrush& brush ) areaSeries()->setBrush( brush ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQtChartsPlotCurve::setColor( const QColor& color ) +{ + QPen curvePen = lineSeries()->pen(); + curvePen.setColor( color ); + lineSeries()->setPen( curvePen ); + + curvePen = areaSeries()->pen(); + curvePen.setColor( color ); + areaSeries()->setPen( curvePen ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h index e312a35deb..3518adf4db 100644 --- a/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQtChartsPlotCurve.h @@ -49,6 +49,7 @@ class RiuQtChartsPlotCurve : public QObject, public RiuPlotCurve const QBrush& fillBrush = QBrush( Qt::NoBrush ) ) override; void setBrush( const QBrush& brush ) override; + void setColor( const QColor& color ) override; void setLegendIconSize( const QSize& iconSize ) override; QSize legendIconSize() const override; diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp index 26d1eb4e18..4f5415b654 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.cpp @@ -263,6 +263,16 @@ void RiuQwtPlotCurve::setBrush( const QBrush& brush ) QwtPlotCurve::setBrush( brush ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuQwtPlotCurve::setColor( const QColor& color ) +{ + QPen curvePen = pen(); + curvePen.setColor( color ); + setPen( curvePen ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h index 5654fe4d57..c6f0fc213b 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotCurve.h @@ -45,6 +45,7 @@ class RiuQwtPlotCurve : public RiuPlotCurve, public QwtPlotCurve const QBrush& fillBrush = QBrush( Qt::NoBrush ) ) override; void setBrush( const QBrush& brush ) override; + void setColor( const QColor& color ) override; void setLegendIconSize( const QSize& iconSize ) override; QSize legendIconSize() const override; From 3d53c9de1e5796a192a1826500ede56bb0356e78 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 29 Jun 2022 07:39:02 +0200 Subject: [PATCH 402/406] Do not create curve for empty history vector --- .../Application/RiaPreferences.cpp | 2 +- ...wSummaryMultiPlotFromDataVectorFeature.cpp | 23 ++++++++++++++++--- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPreferences.cpp b/ApplicationLibCode/Application/RiaPreferences.cpp index 83d1a611ca..8cbe778f3b 100644 --- a/ApplicationLibCode/Application/RiaPreferences.cpp +++ b/ApplicationLibCode/Application/RiaPreferences.cpp @@ -210,7 +210,7 @@ RiaPreferences::RiaPreferences() m_timeFormat.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); m_timeFormat = RiaQDateTimeTools::supportedTimeFormats().front(); - CAF_PDM_InitField( &m_useUndoRedo, "useUndoRedo", true, "Enable Undo/Redo for Property Editor changes" ); + CAF_PDM_InitField( &m_useUndoRedo, "useUndoRedo", false, "Enable Undo/Redo for Property Editor changes" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_useUndoRedo ); CAF_PDM_InitFieldNoDefault( &m_plotTemplateFolders, "plotTemplateFolders", "Plot Template Folder(s)" ); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp index cef51ed269..02c9615748 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFromDataVectorFeature.cpp @@ -22,6 +22,8 @@ #include "RiaSummaryTools.h" #include "RimSummaryAddress.h" +#include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" #include "RimSummaryPlot.h" #include "RicSummaryPlotBuilder.h" @@ -85,18 +87,32 @@ void RicNewSummaryMultiPlotFromDataVectorFeature::onActionTriggered( bool isChec isEnsemble = isEnsemble || adr->isEnsemble(); } + std::set availableAddresses; + if ( isEnsemble ) { for ( auto id : ensembleIds ) { - selectedEnsembles.push_back( RiaSummaryTools::ensembleById( id ) ); + auto ensemble = RiaSummaryTools::ensembleById( id ); + if ( ensemble ) + { + selectedEnsembles.push_back( ensemble ); + + if ( availableAddresses.empty() ) availableAddresses = ensemble->ensembleSummaryAddresses(); + } } } else { for ( auto id : caseIds ) { - selectedCases.push_back( RiaSummaryTools::summaryCaseById( id ) ); + auto summaryCase = RiaSummaryTools::summaryCaseById( id ); + if ( summaryCase ) + { + selectedCases.push_back( summaryCase ); + if ( availableAddresses.empty() && summaryCase->summaryReader() ) + availableAddresses = summaryCase->summaryReader()->allResultAddresses(); + } } } @@ -110,7 +126,8 @@ void RicNewSummaryMultiPlotFromDataVectorFeature::onActionTriggered( bool isChec { auto historyAddr = addr; historyAddr.setVectorName( addr.vectorName() + RifReaderEclipseSummary::historyIdentifier() ); - eclipseAddresses.insert( historyAddr ); + + if ( availableAddresses.count( historyAddr ) > 0 ) eclipseAddresses.insert( historyAddr ); } } } From af77fdad81058b86c13cc269f4438f9e334ae5e7 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 30 Jun 2022 18:23:45 +0200 Subject: [PATCH 403/406] Prepare for release Always create plots using Qwt Always create plot for command "New Summary Plot" #9103 : Fix missing updates in multiselect field update operation Add Open Summary Plot Editor Trigger missing load of data Enable data source display for first realization of an ensemble Always show legend text Set version to 2022.06.0-RC-02 --- ...RicAppendSummaryPlotsForObjectsFeature.cpp | 4 +- .../RicNewSummaryMultiPlotFeature.cpp | 29 ++-- .../RicSummaryPlotBuilder.cpp | 18 ++- .../RicSummaryPlotBuilder.h | 3 +- .../CMakeLists_files.cmake | 2 + .../RicOpenSummaryPlotEditorFeature.cpp | 139 ++++++++++++++++++ .../RicOpenSummaryPlotEditorFeature.h | 36 +++++ .../RicSummaryPlotEditorUi.cpp | 10 +- .../RimContextCommandBuilder.cpp | 8 +- .../Summary/RimSummaryCaseCollection.cpp | 2 + .../Summary/RimSummaryMultiPlot.cpp | 10 +- .../Summary/RimSummaryPlot.cpp | 8 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 2 + .../cafCommand/cafCmdFieldChangeExec.cpp | 27 +++- .../cafPdmUiCore/cafPdmUiItem.cpp | 27 ++++ .../cafPdmUiCore/cafPdmUiItem.h | 5 + ResInsightVersion.cmake | 2 +- 17 files changed, 305 insertions(+), 27 deletions(-) create mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp create mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.h diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp index f918369bf8..0793ec30a5 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicAppendSummaryPlotsForObjectsFeature.cpp @@ -93,10 +93,10 @@ void RicAppendSummaryPlotsForObjectsFeature::appendPlots( RimSummaryMultiPlot* s adrMod.setAddress( modifiedAdr ); } summaryMultiPlot->addPlot( duplicatedPlot ); - duplicatedPlot->resolveReferencesRecursively(); - duplicatedPlot->loadDataAndUpdate(); } + + duplicatedPlot->loadDataAndUpdate(); } info.incrementProgress(); } diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp index efcda8508f..4091957c40 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicNewSummaryMultiPlotFeature.cpp @@ -20,6 +20,7 @@ #include "RicSummaryPlotBuilder.h" +#include "RimProject.h" #include "RimSummaryCase.h" #include "RimSummaryCaseCollection.h" #include "RimSummaryMultiPlot.h" @@ -60,22 +61,30 @@ void RicNewSummaryMultiPlotFeature::onActionTriggered( bool isChecked ) std::vector selectedUiItems; caf::SelectionManager::instance()->selectedItems( selectedUiItems ); + std::vector selectedIndividualSummaryCases; + std::vector selectedEnsembles; + RimSummaryMultiPlotCollection* coll = selectedCollection( selectedUiItems ); if ( coll ) { - std::vector objects = {}; - RimSummaryMultiPlot* multiPlot = RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( objects ); - - return; + auto ensembles = RimProject::current()->summaryGroups(); + if ( !ensembles.empty() ) + selectedEnsembles.push_back( ensembles.front() ); + else + { + auto summaryCases = RimProject::current()->allSummaryCases(); + if ( !summaryCases.empty() ) selectedIndividualSummaryCases.push_back( summaryCases.front() ); + } } - - std::vector selectedIndividualSummaryCases; - std::vector selectedEnsembles; - - if ( selectedCases( &selectedIndividualSummaryCases, &selectedEnsembles ) ) + else { - RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( selectedIndividualSummaryCases, selectedEnsembles ); + selectedCases( &selectedIndividualSummaryCases, &selectedEnsembles ); } + + bool skipCreationOfPlotBasedOnPreferences = false; + RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( selectedIndividualSummaryCases, + selectedEnsembles, + skipCreationOfPlotBasedOnPreferences ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp index 25bceebd5b..9e3dfcd53d 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.cpp @@ -410,11 +410,14 @@ void RicSummaryPlotBuilder::appendPlotsToMultiPlot( RimMultiPlot* multiPlot, con //-------------------------------------------------------------------------------------------------- RimSummaryMultiPlot* RicSummaryPlotBuilder::createAndAppendDefaultSummaryMultiPlot( const std::vector& cases, - const std::vector& ensembles ) + const std::vector& ensembles, + bool skipCreationOfPlotBasedOnPreferences ) { RiaPreferencesSummary* prefs = RiaPreferencesSummary::current(); - if ( prefs->defaultSummaryPlotType() == RiaPreferencesSummary::DefaultSummaryPlotType::NONE ) return nullptr; + if ( skipCreationOfPlotBasedOnPreferences && + prefs->defaultSummaryPlotType() == RiaPreferencesSummary::DefaultSummaryPlotType::NONE ) + return nullptr; if ( prefs->defaultSummaryPlotType() == RiaPreferencesSummary::DefaultSummaryPlotType::PLOT_TEMPLATES ) { @@ -424,10 +427,17 @@ RimSummaryMultiPlot* { plotToSelect = RicSummaryPlotTemplateTools::create( filename, cases, ensembles ); } - return plotToSelect; + + if ( plotToSelect ) return plotToSelect; + + if ( skipCreationOfPlotBasedOnPreferences ) + { + return plotToSelect; + } } - if ( prefs->defaultSummaryCurvesTextFilter().trimmed().isEmpty() ) return nullptr; + if ( skipCreationOfPlotBasedOnPreferences && prefs->defaultSummaryCurvesTextFilter().trimmed().isEmpty() ) + return nullptr; RimProject* project = RimProject::current(); auto* plotCollection = project->mainPlotCollection()->summaryMultiPlotCollection(); diff --git a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h index b4c7d36ea6..dba405e40a 100644 --- a/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h +++ b/ApplicationLibCode/Commands/PlotBuilderCommands/RicSummaryPlotBuilder.h @@ -77,7 +77,8 @@ class RicSummaryPlotBuilder static RimSummaryMultiPlot* createAndAppendDefaultSummaryMultiPlot( const std::vector& cases, - const std::vector& ensembles ); + const std::vector& ensembles, + bool skipCreationOfPlotBasedOnPreferences = true ); static RimSummaryMultiPlot* createAndAppendSingleSummaryMultiPlotNoAutoSettings( RimSummaryPlot* plot ); static RimSummaryMultiPlot* createAndAppendSingleSummaryMultiPlot( RimSummaryPlot* plot ); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index 2daeb86cd4..fe183d08c8 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -1,4 +1,5 @@ set(SOURCE_GROUP_HEADER_FILES + ${CMAKE_CURRENT_LIST_DIR}/RicOpenSummaryPlotEditorFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewDefaultSummaryPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCurveFeature.h @@ -46,6 +47,7 @@ set(SOURCE_GROUP_HEADER_FILES ) set(SOURCE_GROUP_SOURCE_FILES + ${CMAKE_CURRENT_LIST_DIR}/RicOpenSummaryPlotEditorFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewDefaultSummaryPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCrossPlotFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryCurveFeature.cpp diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp new file mode 100644 index 0000000000..a1c90e6c01 --- /dev/null +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp @@ -0,0 +1,139 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2022 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 +// (at your option) any later version. +// +// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. +// +// See the GNU General Public License at +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#include "RicOpenSummaryPlotEditorFeature.h" + +#include "RiaSummaryTools.h" + +#include "RicEditSummaryPlotFeature.h" +#include "RicNewSummaryEnsembleCurveSetFeature.h" +#include "RicSummaryPlotEditorDialog.h" +#include "RicSummaryPlotEditorUi.h" +#include "RicSummaryPlotFeatureImpl.h" + +#include "RimCustomObjectiveFunctionCollection.h" +#include "RimEnsembleCurveFilter.h" +#include "RimEnsembleCurveFilterCollection.h" +#include "RimProject.h" +#include "RimRegularLegendConfig.h" +#include "RimSummaryCase.h" +#include "RimSummaryCaseCollection.h" +#include "RimSummaryCaseMainCollection.h" +#include "RimSummaryPlot.h" + +#include "RiuPlotMainWindow.h" + +#include "cafSelectionManagerTools.h" +#include "cvfAssert.h" + +#include + +CAF_CMD_SOURCE_INIT( RicOpenSummaryPlotEditorFeature, "RicOpenSummaryPlotEditorFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicOpenSummaryPlotEditorFeature::isCommandEnabled() +{ + RimSummaryMultiPlot* multiPlot = nullptr; + RimCustomObjectiveFunctionCollection* customObjFuncCollection = nullptr; + + caf::PdmObject* selObj = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); + if ( selObj ) + { + multiPlot = RiaSummaryTools::parentSummaryMultiPlot( selObj ); + selObj->firstAncestorOrThisOfType( customObjFuncCollection ); + } + + auto ensembleFilter = dynamic_cast( selObj ); + auto ensembleFilterColl = dynamic_cast( selObj ); + auto legendConfig = dynamic_cast( selObj ); + + if ( ensembleFilter || ensembleFilterColl || legendConfig || customObjFuncCollection ) return false; + if ( multiPlot ) return true; + + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicOpenSummaryPlotEditorFeature::onActionTriggered( bool isChecked ) +{ + RimProject* project = RimProject::current(); + CVF_ASSERT( project ); + + std::vector selectedCases = caf::selectedObjectsByType(); + std::vector selectedGroups = caf::selectedObjectsByType(); + + std::vector sourcesToSelect( selectedCases.begin(), selectedCases.end() ); + + if ( sourcesToSelect.empty() && selectedGroups.empty() ) + { + const auto allSingleCases = project->firstSummaryCaseMainCollection()->topLevelSummaryCases(); + const auto allGroups = project->summaryGroups(); + std::vector allEnsembles; + for ( const auto group : allGroups ) + if ( group->isEnsemble() ) allEnsembles.push_back( group ); + + if ( !allSingleCases.empty() ) + { + sourcesToSelect.push_back( allSingleCases.front() ); + } + else if ( !allEnsembles.empty() ) + { + sourcesToSelect.push_back( allEnsembles.front() ); + } + } + + // Append grouped cases + for ( auto group : selectedGroups ) + { + if ( group->isEnsemble() ) + { + sourcesToSelect.push_back( group ); + } + else + { + auto groupCases = group->allSummaryCases(); + sourcesToSelect.insert( sourcesToSelect.end(), groupCases.begin(), groupCases.end() ); + } + } + + auto dialog = RicEditSummaryPlotFeature::curveCreatorDialog( true ); + + if ( !dialog->isVisible() ) + { + dialog->show(); + } + else + { + dialog->raise(); + } + + dialog->updateFromDefaultCases( sourcesToSelect ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicOpenSummaryPlotEditorFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Open Summary Plot Editor" ); + actionToSetup->setIcon( QIcon( ":/SummaryPlotLight16x16.png" ) ); +} diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.h new file mode 100644 index 0000000000..c36c873c34 --- /dev/null +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.h @@ -0,0 +1,36 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2016- 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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// + +#pragma once + +#include "RicfCommandObject.h" + +#include "cafCmdFeature.h" + +//================================================================================================== +/// +//================================================================================================== +class RicOpenSummaryPlotEditorFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index ab9f714668..77b6641c07 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -50,6 +50,8 @@ #include "RiuSummaryVectorSelectionUi.h" #include "RiuTools.h" +#include "PlotBuilderCommands/RicSummaryPlotBuilder.h" + #include "cafPdmUiComboBoxEditor.h" #include "cafPdmUiPushButtonEditor.h" @@ -263,7 +265,7 @@ QList RicSummaryPlotEditorUi::calculateValueOptions( con { QList options; - if ( m_targetPlot && ( fieldNeedingOptions == &m_targetPlot ) ) + if ( fieldNeedingOptions == &m_targetPlot ) { // Create New Plot item QString displayName = "( New Plot )"; @@ -845,6 +847,12 @@ void RicSummaryPlotEditorUi::createNewPlot() RimSummaryPlot* newSummaryPlot = nullptr; + if ( !m_plotContainer ) + { + std::vector plots; + m_plotContainer = RicSummaryPlotBuilder::createAndAppendSummaryMultiPlot( plots ); + } + if ( m_plotContainer ) { newSummaryPlot = new RimSummaryPlot(); diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index 2a162602f5..cf6bcf436c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -561,6 +561,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() else if ( dynamic_cast( firstUiItem ) ) { menuBuilder << "RicNewSummaryMultiPlotFeature"; + menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "Separator"; menuBuilder << "RicPasteSummaryPlotFeature"; menuBuilder << "RicPasteAsciiDataToSummaryPlotFeature"; @@ -774,6 +775,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder.addSeparator(); menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; + menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder.addSeparator(); menuBuilder << "RicConvertGroupToEnsembleFeature"; @@ -781,6 +783,9 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() } else if ( dynamic_cast( firstUiItem ) ) { + menuBuilder << "RicShowDataSourcesForRealization"; + menuBuilder.addSeparator(); + menuBuilder.subMenuStart( "Import" ); menuBuilder << "RicImportSummaryCaseFeature"; menuBuilder << "RicImportSummaryCasesFeature"; @@ -789,6 +794,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder.subMenuEnd(); menuBuilder.addSeparator(); menuBuilder << "RicNewSummaryMultiPlotFeature"; + menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder << "RicAppendSummaryCurvesForSummaryCasesFeature"; menuBuilder << "RicAppendSummaryPlotsForSummaryCasesFeature"; @@ -1092,6 +1098,7 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; + menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder << "RicSummaryCurveSwitchAxisFeature"; menuBuilder << "RicNewDerivedSummaryFeature"; @@ -1110,7 +1117,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicReloadSummaryCaseFeature"; menuBuilder << "RicReplaceSummaryCaseFeature"; menuBuilder << "RicCreateSummaryCaseCollectionFeature"; - menuBuilder << "RicShowDataSourcesForRealization"; menuBuilder << "Separator"; menuBuilder << "RicCutReferencesToClipboardFeature"; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp index e5949f3f22..c4327abba6 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCaseCollection.cpp @@ -184,6 +184,8 @@ void RimSummaryCaseCollection::addCase( RimSummaryCase* summaryCase ) { summaryCase->nameChanged.connect( this, &RimSummaryCaseCollection::onCaseNameChanged ); + if ( m_cases.empty() ) summaryCase->setShowRealizationDataSource( true ); + m_cases.push_back( summaryCase ); m_cachedSortedEnsembleParameters.clear(); m_analyzer.reset(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 885dae6ee1..056c310ad1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -1162,7 +1162,13 @@ void RimSummaryMultiPlot::summaryPlotItemInfos( QList* o { for ( RimSummaryPlot* plot : summaryPlots() ) { - QString displayName = plot->description(); + QString displayName; + + if ( plot && plot->userDescriptionField() && plot->userDescriptionField() ) + { + displayName = plot->userDescriptionField()->uiCapability()->uiValue().toString(); + } + optionInfos->push_back( caf::PdmOptionItemInfo( displayName, plot, false, plot->uiCapability()->uiIconProvider() ) ); } } @@ -1217,8 +1223,6 @@ void RimSummaryMultiPlot::analyzePlotsAndAdjustAppearanceSettings() // Disable sub plot linking to be able to configure individually setSubPlotAxesLinked( false ); - axisProp->setShowDescription( false ); - auto [row, col] = gridLayoutInfoForSubPlot( p ); if ( col == 0 ) axisProp->setShowUnitText( true ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index cdbaaed199..e8c9f5805d 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -564,7 +564,8 @@ void RimSummaryPlot::updatePlotTitle() RimMultiPlot* plotWindow = nullptr; firstAncestorOrThisOfType( plotWindow ); - auto index = plotWindow->plotIndex( this ); + size_t index = 0; + if ( plotWindow ) index = plotWindow->plotIndex( this ); QString title = QString( "Sub Plot %1" ).arg( index + 1 ); m_fallbackPlotName = title; @@ -2361,6 +2362,11 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent useQtCharts = true; } + // Disable all use of QtCharts for now. If a plot was created using QtCharts during the period this flag was + // active, the use of QtCharts was stored in the project file or template file. Set flag to false to force use + // of Qwt + useQtCharts = false; + if ( useQtCharts ) { m_summaryPlot = std::make_unique( this, mainWindowParent ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index 3c4cd5f780..0eb550b7a5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -62,6 +62,8 @@ RimSummaryPlotSourceStepping::RimSummaryPlotSourceStepping() { CAF_PDM_InitObject( "Summary Curves Modifier" ); + setNotifyAllFieldsInMultiFieldChangedEvents( true ); + CAF_PDM_InitFieldNoDefault( &m_stepDimension, "StepDimension", "Step Dimension" ); CAF_PDM_InitFieldNoDefault( &m_summaryCase, "CurveCase", "Case" ); diff --git a/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.cpp b/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.cpp index a11c584b6a..4b27c7d692 100644 --- a/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.cpp +++ b/Fwk/AppFwk/cafCommand/cafCmdFieldChangeExec.cpp @@ -89,11 +89,32 @@ void CmdFieldChangeExec::redo() PdmFieldHandle* field = PdmReferenceHelper::fieldFromReference( m_commandData->m_rootObject, fieldTextPath ); if ( !field ) continue; + bool objectFlag = false; + PdmObjectHandle* obj = field->ownerObject(); + auto uiObjectHandle = uiObj( obj ); + if ( uiObjectHandle ) + { + objectFlag = uiObjectHandle->notifyAllFieldsInMultiFieldChangedEvents(); + + // Make sure that uiOrdering has been called on all objects, as some object do some state initialization. + // This is relevant for data source stepping objects. This operation could be made into a virtual function. + caf::PdmUiOrdering ordering; + uiObjectHandle->uiOrdering( "", ordering ); + } + PdmUiFieldHandle* uiFieldHandle = field->uiCapability(); PdmXmlFieldHandle* xmlFieldHandle = field->xmlCapability(); if ( uiFieldHandle && xmlFieldHandle ) { - bool isLastField = ( i == m_commandData->m_pathToFields.size() - 1 ); + // In multi field update operations, a single fieldChanged() notification is sufficient for many use cases + // where properties like color/size are modified. For control operations like changing the data source + // for multiple sub objects, we need to issue fieldChanged() for all modified fields. This behaviour can be + // forced both on object level and field level + + bool isLastField = ( i == m_commandData->m_pathToFields.size() - 1 ); + bool sendFieldChangedNotification = isLastField; + if ( objectFlag ) sendFieldChangedNotification = true; + if ( uiFieldHandle->notifyAllFieldsInMultiFieldChangedEvents() ) sendFieldChangedNotification = true; if ( m_commandData->m_undoFieldValueSerialized[i].isEmpty() ) { @@ -107,7 +128,7 @@ void CmdFieldChangeExec::redo() // The ui value might be an index into the option entry cache, so we need to set the value // and be aware of the option entries, and then serialize the actual field value we ended up with. - uiFieldHandle->setValueFromUiEditor( m_commandData->m_newUiValue, isLastField ); + uiFieldHandle->setValueFromUiEditor( m_commandData->m_newUiValue, sendFieldChangedNotification ); if ( m_commandData->m_redoFieldValueSerialized.isEmpty() ) { @@ -126,7 +147,7 @@ void CmdFieldChangeExec::redo() QVariant newFieldData = uiFieldHandle->toUiBasedQVariant(); // New data is present in field, notify data changed - if ( isLastField ) + if ( sendFieldChangedNotification ) { uiFieldHandle->notifyFieldChanged( oldFieldData, newFieldData ); if ( m_notificationCenter ) diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp index dfc2fd83a5..d6cfa56136 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.cpp @@ -488,6 +488,33 @@ void PdmUiItem::setUiReadOnly( bool isReadOnly, const QString& uiConfigName /*= m_configItemInfos[uiConfigName].m_isReadOnly = isReadOnly; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool PdmUiItem::notifyAllFieldsInMultiFieldChangedEvents( const QString& uiConfigName /*= "" */ ) const +{ + const PdmUiItemInfo* conInfo = configInfo( uiConfigName ); + const PdmUiItemInfo* defInfo = defaultInfo(); + const PdmUiItemInfo* sttInfo = m_staticItemInfo; + + if ( conInfo && !( conInfo->m_notifyAllFieldsInMultiFieldChangedEvents == -1 ) ) + return conInfo->m_notifyAllFieldsInMultiFieldChangedEvents; + if ( defInfo && !( defInfo->m_notifyAllFieldsInMultiFieldChangedEvents == -1 ) ) + return defInfo->m_notifyAllFieldsInMultiFieldChangedEvents; + if ( sttInfo && !( sttInfo->m_notifyAllFieldsInMultiFieldChangedEvents == -1 ) ) + return sttInfo->m_notifyAllFieldsInMultiFieldChangedEvents; + + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void PdmUiItem::setNotifyAllFieldsInMultiFieldChangedEvents( bool enable, const QString& uiConfigName /*= "" */ ) +{ + m_configItemInfos[uiConfigName].m_notifyAllFieldsInMultiFieldChangedEvents = enable; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h index 8032082a17..997ce49b42 100644 --- a/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h +++ b/Fwk/AppFwk/cafProjectDataModel/cafPdmUiCore/cafPdmUiItem.h @@ -71,6 +71,7 @@ class PdmUiItemInfo , m_isReadOnly( -1 ) , m_labelAlignment( LEFT ) , m_isCustomContextMenuEnabled( -1 ) + , m_notifyAllFieldsInMultiFieldChangedEvents( -1 ) { } @@ -105,6 +106,7 @@ class PdmUiItemInfo int m_isReadOnly; ///< UiItem should be insensitive, or read only. -1 means not set. LabelPosType m_labelAlignment; int m_isCustomContextMenuEnabled; + int m_notifyAllFieldsInMultiFieldChangedEvents; }; //================================================================================================== @@ -278,6 +280,9 @@ class PdmUiItem bool isUiReadOnly( const QString& uiConfigName = "" ) const; void setUiReadOnly( bool isReadOnly, const QString& uiConfigName = "" ); + bool notifyAllFieldsInMultiFieldChangedEvents( const QString& uiConfigName = "" ) const; + void setNotifyAllFieldsInMultiFieldChangedEvents( bool enable, const QString& uiConfigName = "" ); + PdmUiItemInfo::LabelPosType uiLabelPosition( const QString& uiConfigName = "" ) const; void setUiLabelPosition( PdmUiItemInfo::LabelPosType alignment, const QString& uiConfigName = "" ); diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index bbb7d78a5e..17950e9b16 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -5,7 +5,7 @@ set(RESINSIGHT_PATCH_VERSION 0) # Opional text with no restrictions #"set(RESINSIGHT_VERSION_TEXT "-dev") -set(RESINSIGHT_VERSION_TEXT "-RC_01") +set(RESINSIGHT_VERSION_TEXT "-RC_02") # Optional text # Must be unique and increasing within one combination of major/minor/patch version From 6ad0bcee95be08bd28e06cb91f1271d6a16f70ea Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Wed, 29 Jun 2022 13:35:28 +0200 Subject: [PATCH 404/406] Fix crash if base time step has undefined data --- .../ReservoirDataModel/RigCaseCellResultCalculator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultCalculator.cpp b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultCalculator.cpp index c35e6826e2..ac00907433 100644 --- a/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultCalculator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/RigCaseCellResultCalculator.cpp @@ -148,9 +148,11 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData* { cvf::ref sourceResultAccessor = RigResultAccessorFactory::createFromResultAddress( sourceCase, gridIdx, porosityModel, fIdx, nativeAddress ); + if ( sourceResultAccessor.isNull() ) continue; cvf::ref resultModifier = RigResultModifierFactory::createResultModifier( sourceCase, gridIdx, porosityModel, fIdx, address ); + if ( resultModifier.isNull() ) continue; size_t baseFrameIdx = fIdx; if ( address.isDeltaTimeStepActive() ) @@ -160,6 +162,7 @@ bool RigCaseCellResultCalculator::computeDifference( RigEclipseCaseData* cvf::ref baseResultAccessor = RigResultAccessorFactory::createFromResultAddress( baseCase, gridIdx, porosityModel, baseFrameIdx, nativeAddress ); + if ( baseResultAccessor.isNull() ) continue; for ( size_t localGridCellIdx = 0; localGridCellIdx < grid->cellCount(); localGridCellIdx++ ) { From d4edc152152f1160c0c163980f8f2ea55fcc4f03 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 1 Jul 2022 11:36:49 +0200 Subject: [PATCH 405/406] Regression test fixes (#9105) * Do not show Open Summary Plot in 3D view Property Editor * Regression Test: Fix missing update of correlation report plot A fix was introduced in 73d598ee7e4177352c97a86c5fc2b061437f5d27 to avoid a crash when deleting a multi plot. This had a unintended side effect causing the sub plots in correlation report plot to not be inserted properly. * Bump release version --- .../ProjectDataModel/RimContextCommandBuilder.cpp | 1 - ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp | 2 +- ResInsightVersion.cmake | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp index cf6bcf436c..2663b6a066 100644 --- a/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimContextCommandBuilder.cpp @@ -1098,7 +1098,6 @@ caf::CmdFeatureMenuBuilder RimContextCommandBuilder::commandsFromSelection() menuBuilder << "RicNewSummaryMultiPlotFeature"; menuBuilder << "RicNewDerivedEnsembleFeature"; - menuBuilder << "RicOpenSummaryPlotEditorFeature"; menuBuilder << "RicNewSummaryCrossPlotFeature"; menuBuilder << "RicSummaryCurveSwitchAxisFeature"; menuBuilder << "RicNewDerivedSummaryFeature"; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 328fc5ae91..176c31acd2 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -566,7 +566,7 @@ bool RiuMultiPlotPage::showYAxis( int row, int column ) const void RiuMultiPlotPage::performUpdate( RiaDefines::MultiPlotPageUpdateType whatToUpdate ) { auto multiPlot = dynamic_cast( m_plotDefinition.p() ); - if ( !multiPlot || !multiPlot->isValid() ) return; + if ( multiPlot && !multiPlot->isValid() ) return; if ( whatToUpdate == RiaDefines::MultiPlotPageUpdateType::ALL ) { diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index 17950e9b16..ee6aba64d6 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -5,7 +5,7 @@ set(RESINSIGHT_PATCH_VERSION 0) # Opional text with no restrictions #"set(RESINSIGHT_VERSION_TEXT "-dev") -set(RESINSIGHT_VERSION_TEXT "-RC_02") +set(RESINSIGHT_VERSION_TEXT "-RC_03") # Optional text # Must be unique and increasing within one combination of major/minor/patch version From 5ac0bc3e6ee1d1b95a08f2dc07116b1026c5ab6b Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Fri, 1 Jul 2022 13:03:16 +0200 Subject: [PATCH 406/406] Set version to 2022.06.0 --- ResInsightVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ResInsightVersion.cmake b/ResInsightVersion.cmake index ee6aba64d6..6cc10100df 100644 --- a/ResInsightVersion.cmake +++ b/ResInsightVersion.cmake @@ -5,7 +5,7 @@ set(RESINSIGHT_PATCH_VERSION 0) # Opional text with no restrictions #"set(RESINSIGHT_VERSION_TEXT "-dev") -set(RESINSIGHT_VERSION_TEXT "-RC_03") +#set(RESINSIGHT_VERSION_TEXT "-RC_03") # Optional text # Must be unique and increasing within one combination of major/minor/patch version